PolyFEM
Loading...
Searching...
No Matches
ThermoElasticVarForm.hpp
Go to the documentation of this file.
1#pragma once
2
4
5namespace polysolve::linear
6{
7 class Solver;
8}
9
10namespace polyfem::assembler
11{
12 class Density;
13 class GenericScalarProblem;
14 class Laplacian;
15 class MixedNLAssembler;
16} // namespace polyfem::assembler
17
18namespace polyfem::solver
19{
20 class AugmentedLagrangianForm;
21 class BodyForm;
22 class ElasticForm;
23 class Form;
24 class InertiaForm;
25 class MixedAssemblerForm;
26 class NLProblem;
27 class StackedForm;
28} // namespace polyfem::solver
29
31{
32 class ImplicitTimeIntegrator;
33} // namespace polyfem::time_integrator
34
35namespace polyfem::varform
36{
38 {
39 public:
40 using NonlinearElasticVarForm::NonlinearElasticVarForm;
41 std::string name() const override { return "ThermoElastic"; }
42
43 void init(const std::string &formulation, const Units &units, const json &args, const std::string &out_path) override;
44
45 io::OutStatsData compute_errors(const Eigen::MatrixXd &solution) override;
46 void serialize_checkpoint(io::CheckpointWriter &writer, const Eigen::MatrixXd &solution, const io::CheckpointMetadata &metadata) const override;
47 void deserialize_checkpoint(const io::CheckpointReader &reader, Eigen::MatrixXd &solution) override;
48
49 std::vector<io::OutputField> output_fields(
50 const io::OutputSample &sample,
51 const Eigen::MatrixXd &solution,
52 const io::OutputFieldOptions &options) const override;
53
54 private:
55 void reset() override;
56 void load_mesh(const mesh::Mesh &mesh, const json &args) override;
57 void build_basis(mesh::Mesh &mesh, const bool iso_parametric, const json &args) override;
58 void assemble_rhs(const mesh::Mesh &mesh) override;
59 void assemble_mass_mat(const mesh::Mesh &mesh, const json &args) override;
60 void solve_problem(
61 Eigen::MatrixXd &sol,
62 const InitialConditionOverride *initial_condition_override,
63 const ForwardStepCallback &post_step) override;
64 void build_rhs_assembler() override;
65
68 json time_integrator_args(const int fe_space_id) const;
69
71 void build_temperature_basis(mesh::Mesh &mesh, const bool iso_parametric, const json &args);
73 void build_forms(Eigen::MatrixXd &solution, const double t);
75 void solve_nonlinear_step(const int step, Eigen::MatrixXd &solution);
76
77 void initial_temperature_solution(Eigen::MatrixXd &solution) const;
78 void split_solution(
79 const Eigen::MatrixXd &solution,
80 Eigen::MatrixXd &displacement,
81 Eigen::MatrixXd &temperature) const;
82 Eigen::MatrixXd stacked_solution(
83 const Eigen::MatrixXd &displacement,
84 const Eigen::MatrixXd &temperature) const;
85
86 int displacement_ndof() const { return space_.ndof(); }
87 int temperature_ndof() const { return temperature_space_.ndof(); }
88 int total_ndof() const { return displacement_ndof() + temperature_ndof(); }
89
92 std::shared_ptr<assembler::Problem> temperature_problem_;
93
97
98 std::shared_ptr<assembler::Assembler> temperature_assembler_;
99 std::shared_ptr<assembler::MixedNLAssembler> thermoelastic_assembler_;
100 std::shared_ptr<assembler::Mass> temperature_mass_assembler_;
101 std::shared_ptr<assembler::HRZMass> temperature_pure_mass_assembler_;
102 std::shared_ptr<assembler::RhsAssembler> temperature_rhs_assembler_;
103 std::shared_ptr<assembler::Density> temperature_rhs_density_;
104
108 Eigen::MatrixXd temperature_rhs_;
109
110 std::shared_ptr<time_integrator::ImplicitTimeIntegrator> temperature_time_integrator_;
111
112 std::shared_ptr<solver::ElasticForm> temperature_form_;
113 std::shared_ptr<solver::MixedAssemblerForm> thermoelastic_form_;
114 std::shared_ptr<solver::BodyForm> temperature_body_form_;
115 std::shared_ptr<solver::InertiaForm> temperature_inertia_form_;
116 std::shared_ptr<solver::StackedForm> stacked_form_;
117
120 std::string elastic_formulation_ = "NeoHookean";
121 };
122} // namespace polyfem::varform
Caches basis evaluation and geometric mapping at every element.
all stats from polyfem
Abstract mesh class to capture 2d/3d conforming and non-conforming meshes.
Definition Mesh.hpp:50
A finite-element space for one scalar- or vector-valued field.
Definition FESpace.hpp:59
void build_basis(mesh::Mesh &mesh, const bool iso_parametric, const json &args) override
std::vector< io::OutputField > output_fields(const io::OutputSample &sample, const Eigen::MatrixXd &solution, const io::OutputFieldOptions &options) const override
Get the output fields of the variational formulation, for output purposes.
void deserialize_checkpoint(const io::CheckpointReader &reader, Eigen::MatrixXd &solution) override
std::shared_ptr< solver::BodyForm > temperature_body_form_
std::shared_ptr< assembler::HRZMass > temperature_pure_mass_assembler_
std::shared_ptr< assembler::MixedNLAssembler > thermoelastic_assembler_
void serialize_checkpoint(io::CheckpointWriter &writer, const Eigen::MatrixXd &solution, const io::CheckpointMetadata &metadata) const override
assembler::AssemblyValsCache temperature_mass_ass_vals_cache_
std::shared_ptr< time_integrator::ImplicitTimeIntegrator > temperature_time_integrator_
std::shared_ptr< solver::MixedAssemblerForm > thermoelastic_form_
json time_integrator_args(const int fe_space_id) const
void build_forms(Eigen::MatrixXd &solution, const double t)
void load_mesh(const mesh::Mesh &mesh, const json &args) override
std::shared_ptr< solver::ElasticForm > temperature_form_
void solve_nonlinear_step(const int step, Eigen::MatrixXd &solution)
io::OutStatsData compute_errors(const Eigen::MatrixXd &solution) override
Get the error statistics of the variational formulation, for output purposes.
void assemble_rhs(const mesh::Mesh &mesh) override
assembler::AssemblyValsCache temperature_ass_vals_cache_
assembler::AssemblyValsCache temperature_pure_mass_ass_vals_cache_
void assemble_mass_mat(const mesh::Mesh &mesh, const json &args) override
std::shared_ptr< assembler::Problem > temperature_problem_
std::string name() const override
Get the name of the variational formulation.
void split_solution(const Eigen::MatrixXd &solution, Eigen::MatrixXd &displacement, Eigen::MatrixXd &temperature) const
std::shared_ptr< assembler::Assembler > temperature_assembler_
Eigen::MatrixXd stacked_solution(const Eigen::MatrixXd &displacement, const Eigen::MatrixXd &temperature) const
void init(const std::string &formulation, const Units &units, const json &args, const std::string &out_path) override
Initialize the variational formulation with the given parameters.
void build_temperature_basis(mesh::Mesh &mesh, const bool iso_parametric, const json &args)
void initial_temperature_solution(Eigen::MatrixXd &solution) const
std::shared_ptr< assembler::Density > temperature_rhs_density_
std::shared_ptr< solver::InertiaForm > temperature_inertia_form_
std::shared_ptr< assembler::RhsAssembler > temperature_rhs_assembler_
void solve_problem(Eigen::MatrixXd &sol, const InitialConditionOverride *initial_condition_override, const ForwardStepCallback &post_step) override
std::shared_ptr< solver::StackedForm > stacked_form_
std::shared_ptr< assembler::Mass > temperature_mass_assembler_
Used for test only.
std::function< void(int step, const Eigen::MatrixXd &solution)> ForwardStepCallback
Definition VarForm.hpp:53
nlohmann::json json
Definition Common.hpp:9
Eigen::SparseMatrix< double, Eigen::ColMajor > StiffnessMatrix
Definition Types.hpp:24
Temporary compatibility wrapper for boundary data belonging to one FE space.
Definition FESpace.hpp:152