PolyFEM
Loading...
Searching...
No Matches
BilaplacianVarForm.hpp
Go to the documentation of this file.
1#pragma once
2
4
7
8namespace polysolve::linear
9{
10 class Solver;
11}
12
13namespace polyfem::varform
14{
16 {
18
19 public:
20 std::string name() const override { return "Bilaplacian"; }
21
22 void init(const std::string &formulation, const Units &units, const json &args, const std::string &out_path) override;
23 void save_json(const Eigen::MatrixXd &solution, std::ostream &out) const override;
24 void export_data(const Eigen::MatrixXd &solution) const override;
25 io::OutputSpace output_space() const override;
26 io::OutStatsData compute_errors(const Eigen::MatrixXd &solution) override;
27
28 std::vector<io::OutputField> output_fields(
29 const io::OutputSample &sample,
30 const Eigen::MatrixXd &solution,
31 const io::OutputFieldOptions &options) const override;
32
33 private:
34 void reset() override;
35 void load_mesh(const mesh::Mesh &mesh, const json &args) override;
36 void build_basis(mesh::Mesh &mesh, const bool iso_parametric, const json &args) override;
37 void assemble_rhs(const mesh::Mesh &mesh) override;
38 void assemble_mass_mat(const mesh::Mesh &mesh, const json &args) override;
39 void solve_problem(Eigen::MatrixXd &sol) override;
40
41 int stacked_ndof() const;
42 void prepare_initial_solution(Eigen::MatrixXd &sol) const;
43 void split_solution(const Eigen::MatrixXd &stacked, Eigen::MatrixXd &primary, Eigen::MatrixXd &pressure) const;
44 void build_stiffness_mat(StiffnessMatrix &stiffness);
46 const std::unique_ptr<polysolve::linear::Solver> &solver,
48 Eigen::VectorXd &b,
49 const bool compute_spectrum,
50 Eigen::MatrixXd &sol);
51 void solve_static_linear(Eigen::MatrixXd &sol);
52 void solve_transient_linear(Eigen::MatrixXd &sol);
53
58
59 std::shared_ptr<assembler::RhsAssembler> build_rhs_assembler(
60 const int n_bases,
61 const std::vector<basis::ElementBases> &bases,
62 const assembler::AssemblyValsCache &ass_vals_cache);
63
66
69
74
75 std::shared_ptr<assembler::RhsAssembler> rhs_assembler_;
76
79
80 double avg_mass_ = 0;
81 Eigen::MatrixXd rhs_;
82
83 std::shared_ptr<assembler::Assembler> primary_assembler_ = nullptr;
84 std::shared_ptr<assembler::Mass> mass_assembler_ = nullptr;
85 std::shared_ptr<assembler::HRZMass> pure_mass_assembler_ = nullptr;
86 std::shared_ptr<assembler::MixedAssembler> mixed_assembler_ = nullptr;
87 std::shared_ptr<assembler::Assembler> pressure_assembler_ = nullptr;
88
89 double t0 = 0;
90 int time_steps = 0;
91 double dt = 0;
92 std::shared_ptr<time_integrator::ImplicitTimeIntegrator> time_integrator;
93 };
94} // 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
std::string name() const override
Get the name of the variational formulation.
void save_json(const Eigen::MatrixXd &solution, std::ostream &out) const override
Save the solution to a JSON file, for output purposes.
io::OutStatsData compute_errors(const Eigen::MatrixXd &solution) override
Get the error statistics of the variational formulation, for output purposes.
void build_basis(mesh::Mesh &mesh, const bool iso_parametric, const json &args) override
std::shared_ptr< time_integrator::ImplicitTimeIntegrator > time_integrator
assembler::AssemblyValsCache mass_ass_vals_cache_
std::shared_ptr< assembler::MixedAssembler > mixed_assembler_
void solve_static_linear(Eigen::MatrixXd &sol)
void solve_problem(Eigen::MatrixXd &sol) override
std::shared_ptr< assembler::Mass > mass_assembler_
std::shared_ptr< assembler::HRZMass > pure_mass_assembler_
assembler::AssemblyValsCache pure_mass_ass_vals_cache_
void assemble_mass_mat(const mesh::Mesh &mesh, const json &args) override
void assemble_rhs(const mesh::Mesh &mesh) override
void solve_transient_linear(Eigen::MatrixXd &sol)
assembler::AssemblyValsCache ass_vals_cache_
void load_mesh(const mesh::Mesh &mesh, 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 build_stiffness_mat(StiffnessMatrix &stiffness)
void prepare_initial_solution(Eigen::MatrixXd &sol) const
void export_data(const Eigen::MatrixXd &solution) const override
std::shared_ptr< assembler::Assembler > primary_assembler_
io::OutputSpace output_space() const override
Get the output space of the variational formulation, for output purposes.
assembler::AssemblyValsCache pressure_ass_vals_cache_
void split_solution(const Eigen::MatrixXd &stacked, Eigen::MatrixXd &primary, Eigen::MatrixXd &pressure) const
void solve_linear_system(const std::unique_ptr< polysolve::linear::Solver > &solver, StiffnessMatrix &A, Eigen::VectorXd &b, const bool compute_spectrum, Eigen::MatrixXd &sol)
std::shared_ptr< assembler::Assembler > pressure_assembler_
friend class polyfem::test::VarFormTestAccess
std::shared_ptr< assembler::RhsAssembler > rhs_assembler_
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.
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
const std::vector< basis::ElementBases > & basis_list() const
Definition FESpace.hpp:109
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