PolyFEM
Loading...
Searching...
No Matches
OperatorSplittingVarForm.hpp
Go to the documentation of this file.
1#pragma once
2
4
7
8namespace polyfem::varform
9{
11 {
12 public:
13 std::string name() const override { return "OperatorSplitting"; }
14
15 void init(const std::string &formulation, const Units &units, const json &args, const std::string &out_path) override;
16 void save_json(const Eigen::MatrixXd &solution, std::ostream &out) const override;
17 void export_data(const Eigen::MatrixXd &solution) const override;
18 io::OutputSpace output_space() const override;
19 io::OutStatsData compute_errors(const Eigen::MatrixXd &solution) override;
20
21 std::vector<io::OutputField> output_fields(
22 const io::OutputSample &sample,
23 const Eigen::MatrixXd &solution,
24 const io::OutputFieldOptions &options) const override;
25
26 protected:
27 void reset() override;
28 void load_mesh(const mesh::Mesh &mesh, const json &args) override;
29 void build_basis(mesh::Mesh &mesh, const bool iso_parametric, const json &args) override;
30 void assemble_rhs(const mesh::Mesh &mesh) override;
31 void assemble_mass_mat(const mesh::Mesh &mesh, const json &args) override;
32 void solve_problem(Eigen::MatrixXd &sol) override;
33 void build_rhs_assembler() override;
34
35 private:
36 int primary_ndof() const;
37 int pressure_block_size() const;
38 int stacked_ndof() const;
39
40 void prepare_initial_solution(Eigen::MatrixXd &sol) const;
41 void split_solution(const Eigen::MatrixXd &stacked, Eigen::MatrixXd &primary, Eigen::MatrixXd &pressure) const;
42 void stack_solution(const Eigen::MatrixXd &primary, const Eigen::MatrixXd &pressure, Eigen::MatrixXd &stacked) const;
43
46
49
53
54 std::shared_ptr<assembler::RhsAssembler> rhs_assembler_;
55
57 Eigen::MatrixXd rhs_;
58
59 std::shared_ptr<assembler::Assembler> primary_assembler_ = nullptr;
60 std::shared_ptr<assembler::Mass> mass_assembler_ = nullptr;
61 std::shared_ptr<assembler::MixedAssembler> mixed_assembler_ = nullptr;
62 std::shared_ptr<assembler::Assembler> pressure_assembler_ = nullptr;
63
64 bool use_avg_pressure = true;
65 double avg_mass_ = 0;
66 double t0 = 0;
67 int time_steps = 0;
68 double dt = 0;
69 };
70} // 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
std::shared_ptr< assembler::Mass > mass_assembler_
void split_solution(const Eigen::MatrixXd &stacked, Eigen::MatrixXd &primary, Eigen::MatrixXd &pressure) const
void save_json(const Eigen::MatrixXd &solution, std::ostream &out) const override
Save the solution to a JSON file, for output purposes.
void prepare_initial_solution(Eigen::MatrixXd &sol) const
void export_data(const Eigen::MatrixXd &solution) const override
void build_basis(mesh::Mesh &mesh, const bool iso_parametric, const json &args) override
std::shared_ptr< assembler::MixedAssembler > mixed_assembler_
std::shared_ptr< assembler::Assembler > primary_assembler_
void assemble_rhs(const mesh::Mesh &mesh) override
std::shared_ptr< assembler::RhsAssembler > rhs_assembler_
std::shared_ptr< assembler::Assembler > pressure_assembler_
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 stack_solution(const Eigen::MatrixXd &primary, const Eigen::MatrixXd &pressure, Eigen::MatrixXd &stacked) const
void solve_problem(Eigen::MatrixXd &sol) override
io::OutputSpace output_space() const override
Get the output space of the variational formulation, for output purposes.
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.
std::string name() const override
Get the name of the variational formulation.
io::OutStatsData compute_errors(const Eigen::MatrixXd &solution) override
Get the error statistics of the variational formulation, for output purposes.
void load_mesh(const mesh::Mesh &mesh, const json &args) override
void assemble_mass_mat(const mesh::Mesh &mesh, const json &args) override
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