PolyFEM
Loading...
Searching...
No Matches
NavierStokesFSIVarForm.hpp
Go to the documentation of this file.
1#pragma once
2
5
6namespace polyfem::solver
7{
8 class ElasticForm;
9 class FSIInterfaceForm;
10 class NavierStokesFSIAveragePressureForm;
11 class NavierStokesFSIForm;
12} // namespace polyfem::solver
13
14namespace polyfem::varform
15{
16 class NonlinearElasticTransientVarForm;
17
19 {
21
22 public:
23 std::string name() const override { return "NavierStokesFSI"; }
24 void init(const std::string &formulation, const Units &units, const json &args, const std::string &out_path) override;
25 std::vector<io::OutputField> output_fields(
26 const io::OutputSample &sample,
27 const Eigen::MatrixXd &solution,
28 const io::OutputFieldOptions &options) const override;
29
30 protected:
31 void reset() override;
32 void load_mesh(const mesh::Mesh &mesh, const json &args) override;
33 void build_basis(mesh::Mesh &mesh, bool iso_parametric, const json &args) override;
34 void assemble_rhs(const mesh::Mesh &mesh) override;
35 void assemble_mass_mat(const mesh::Mesh &mesh, const json &args) override;
36 void build_rhs_assembler() override;
37 void solve_problem(Eigen::MatrixXd &sol) override;
38
39 private:
40 int mesh_displacement_ndof() const;
41 int solid_displacement_ndof() const;
44 int total_ndof() const;
45 int pressure_offset() const { return primary_ndof(); }
53 json time_integrator_args(int fe_space_id) const;
56 void prepare_fsi_initial_solution(Eigen::MatrixXd &sol) const;
57 void build_forms(Eigen::MatrixXd &sol, double t);
58 void solve_nonlinear_step(int step, Eigen::MatrixXd &sol);
60 void save_mesh_integrator_state(int step) const;
61 void save_solid_integrator_state(int step) const;
62 void save_fsi_timestep(double time, int step, const Eigen::MatrixXd &solution) const;
63
68 bool has_solid_ = false;
69 std::string mesh_elastic_formulation_ = "NeoHookean";
70 std::string solid_elastic_formulation_ = "NeoHookean";
72 std::shared_ptr<NonlinearElasticTransientVarForm> solid_varform_;
73 std::vector<std::pair<mesh::Navigation::Index, mesh::Navigation::Index>> interface_2d_;
74 std::vector<std::pair<mesh::Navigation3D::Index, mesh::Navigation3D::Index>> interface_3d_;
77 std::shared_ptr<assembler::Problem> mesh_displacement_problem_;
81 std::shared_ptr<assembler::Assembler> mesh_elastic_assembler_;
82 std::shared_ptr<assembler::Mass> mesh_mass_assembler_;
83 std::shared_ptr<assembler::HRZMass> mesh_pure_mass_assembler_;
84 std::shared_ptr<assembler::RhsAssembler> mesh_rhs_assembler_;
85 Eigen::MatrixXd mesh_rhs_;
86 Eigen::MatrixXd fluid_zero_rhs_;
92
93 std::vector<std::shared_ptr<assembler::MultiSpacesNLAssembler>> ale_assemblers_;
94 std::shared_ptr<time_integrator::ImplicitTimeIntegrator> mesh_displacement_time_integrator_;
95 std::vector<std::shared_ptr<solver::Form>> fsi_forms_;
96 std::vector<std::shared_ptr<solver::AugmentedLagrangianForm>> fsi_al_forms_;
97 std::shared_ptr<solver::NLProblem> fsi_problem_;
98 std::shared_ptr<solver::NavierStokesFSIForm> ale_form_;
99 std::shared_ptr<solver::FSIInterfaceForm> interface_form_;
100 std::shared_ptr<solver::StackedForm> auxiliary_form_;
101 std::shared_ptr<solver::ElasticForm> mesh_elastic_form_;
102 std::shared_ptr<solver::BodyForm> fluid_neumann_form_;
103 std::shared_ptr<solver::BodyForm> mesh_body_form_;
104 std::shared_ptr<solver::NavierStokesFSIAveragePressureForm> average_pressure_form_;
105 };
106} // namespace polyfem::varform
Caches basis evaluation and geometric mapping at every element.
Abstract mesh class to capture 2d/3d conforming and non-conforming meshes.
Definition Mesh.hpp:49
A finite-element space for one scalar- or vector-valued field.
Definition FESpace.hpp:59
int n_bases
Number of globally indexed scalar basis functions in the space.
Definition FESpace.hpp:65
std::shared_ptr< NonlinearElasticTransientVarForm > solid_varform_
void prepare_fsi_initial_solution(Eigen::MatrixXd &sol) const
std::shared_ptr< time_integrator::ImplicitTimeIntegrator > mesh_displacement_time_integrator_
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::string name() const override
Get the name of the variational formulation.
std::shared_ptr< solver::NLProblem > fsi_problem_
void solve_problem(Eigen::MatrixXd &sol) override
std::shared_ptr< assembler::Assembler > mesh_elastic_assembler_
std::shared_ptr< assembler::Problem > mesh_displacement_problem_
std::shared_ptr< assembler::HRZMass > mesh_pure_mass_assembler_
std::vector< std::shared_ptr< solver::Form > > fsi_forms_
std::vector< std::shared_ptr< assembler::MultiSpacesNLAssembler > > ale_assemblers_
void assemble_mass_mat(const mesh::Mesh &mesh, const json &args) override
void load_mesh(const mesh::Mesh &mesh, const json &args) override
std::shared_ptr< solver::NavierStokesFSIForm > ale_form_
std::shared_ptr< solver::FSIInterfaceForm > interface_form_
void build_forms(Eigen::MatrixXd &sol, double t)
std::shared_ptr< solver::BodyForm > mesh_body_form_
std::shared_ptr< assembler::RhsAssembler > mesh_rhs_assembler_
void save_fsi_timestep(double time, int step, const Eigen::MatrixXd &solution) const
std::shared_ptr< solver::ElasticForm > mesh_elastic_form_
std::vector< std::pair< mesh::Navigation::Index, mesh::Navigation::Index > > interface_2d_
std::vector< std::pair< mesh::Navigation3D::Index, mesh::Navigation3D::Index > > interface_3d_
void build_basis(mesh::Mesh &mesh, bool iso_parametric, const json &args) override
std::shared_ptr< solver::BodyForm > fluid_neumann_form_
std::vector< std::shared_ptr< solver::AugmentedLagrangianForm > > fsi_al_forms_
assembler::AssemblyValsCache mesh_displacement_mass_ass_vals_cache_
void solve_nonlinear_step(int step, Eigen::MatrixXd &sol)
std::shared_ptr< assembler::Mass > mesh_mass_assembler_
std::shared_ptr< solver::StackedForm > auxiliary_form_
void assemble_rhs(const mesh::Mesh &mesh) override
assembler::AssemblyValsCache mesh_displacement_pure_mass_ass_vals_cache_
std::shared_ptr< solver::NavierStokesFSIAveragePressureForm > average_pressure_form_
assembler::AssemblyValsCache mesh_displacement_ass_vals_cache_
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.
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