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 std::string name() const override { return "ThermoElastic"; }
41
42 void init(const std::string &formulation, const Units &units, const json &args, const std::string &out_path) override;
43
44 io::OutStatsData compute_errors(const Eigen::MatrixXd &solution) override;
45
46 std::vector<io::OutputField> output_fields(
47 const io::OutputSample &sample,
48 const Eigen::MatrixXd &solution,
49 const io::OutputFieldOptions &options) const override;
50
51 private:
52 void reset() override;
53 void load_mesh(const mesh::Mesh &mesh, const json &args) override;
54 void build_basis(mesh::Mesh &mesh, const bool iso_parametric, const json &args) override;
55 void assemble_rhs(const mesh::Mesh &mesh) override;
56 void assemble_mass_mat(const mesh::Mesh &mesh, const json &args) override;
57 void solve_problem(Eigen::MatrixXd &sol) override;
58 void build_rhs_assembler() override;
59
62 json time_integrator_args(const int fe_space_id) const;
63
65 void build_temperature_basis(mesh::Mesh &mesh, const bool iso_parametric, const json &args);
67 void build_forms(Eigen::MatrixXd &solution, const double t);
69 void solve_nonlinear_step(const int step, Eigen::MatrixXd &solution);
70
71 void initial_temperature_solution(Eigen::MatrixXd &solution) const;
72 void split_solution(
73 const Eigen::MatrixXd &solution,
74 Eigen::MatrixXd &displacement,
75 Eigen::MatrixXd &temperature) const;
76 Eigen::MatrixXd stacked_solution(
77 const Eigen::MatrixXd &displacement,
78 const Eigen::MatrixXd &temperature) const;
79
80 int displacement_ndof() const { return space_.ndof(); }
81 int temperature_ndof() const { return temperature_space_.ndof(); }
82 int total_ndof() const { return displacement_ndof() + temperature_ndof(); }
83
86 std::shared_ptr<assembler::Problem> temperature_problem_;
87
91
92 std::shared_ptr<assembler::Assembler> temperature_assembler_;
93 std::shared_ptr<assembler::MixedNLAssembler> thermoelastic_assembler_;
94 std::shared_ptr<assembler::Mass> temperature_mass_assembler_;
95 std::shared_ptr<assembler::HRZMass> temperature_pure_mass_assembler_;
96 std::shared_ptr<assembler::RhsAssembler> temperature_rhs_assembler_;
97 std::shared_ptr<assembler::Density> temperature_rhs_density_;
98
102 Eigen::MatrixXd temperature_rhs_;
103
104 std::shared_ptr<time_integrator::ImplicitTimeIntegrator> temperature_time_integrator_;
105
106 std::shared_ptr<solver::ElasticForm> temperature_form_;
107 std::shared_ptr<solver::MixedAssemblerForm> thermoelastic_form_;
108 std::shared_ptr<solver::BodyForm> temperature_body_form_;
109 std::shared_ptr<solver::InertiaForm> temperature_inertia_form_;
110 std::shared_ptr<solver::StackedForm> stacked_form_;
111
114 std::string elastic_formulation_ = "NeoHookean";
115 };
116} // 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:41
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.
std::shared_ptr< solver::BodyForm > temperature_body_form_
std::shared_ptr< assembler::HRZMass > temperature_pure_mass_assembler_
std::shared_ptr< assembler::MixedNLAssembler > thermoelastic_assembler_
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) override
std::shared_ptr< solver::StackedForm > stacked_form_
std::shared_ptr< assembler::Mass > temperature_mass_assembler_
Used for test only.
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