PolyFEM
Loading...
Searching...
No Matches
polyfem::varform::BilaplacianVarForm Class Reference

#include <BilaplacianVarForm.hpp>

Inheritance diagram for polyfem::varform::BilaplacianVarForm:
[legend]
Collaboration diagram for polyfem::varform::BilaplacianVarForm:
[legend]

Public Member Functions

std::string name () const override
 Get the name of the variational formulation.
 
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 save_json (const Eigen::MatrixXd &solution, std::ostream &out) const override
 Save the solution to a JSON file, for output purposes.
 
void export_data (const Eigen::MatrixXd &solution) const override
 
io::OutputSpace output_space () const override
 Get the output space of the variational formulation, for output purposes.
 
io::OutStatsData compute_errors (const Eigen::MatrixXd &solution) override
 Get the error statistics of the variational formulation, for output purposes.
 
std::vector< io::OutputFieldoutput_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.
 
- Public Member Functions inherited from polyfem::varform::VarForm
virtual ~VarForm ()=default
 
void set_args (const json &args)
 Reset the internal state of the variational formulation, e.g.
 
void set_mesh (std::unique_ptr< mesh::Mesh > mesh, const double loading_mesh_time=0)
 Set the mesh for the variational formulation.
 
void solve (Eigen::MatrixXd &sol)
 Solve the variational formulation and store the solution in the given matrix.
 
void set_time_callback (const std::function< void(int, int, double, double)> &callback)
 
int problem_dimension () const
 Get the problem dimension of the variational formulation, for output purposes.
 
virtual bool is_contact_enabled () const
 Check if contact is enabled for the variational formulation, for output purposes.
 
const io::OutRuntimeDataoutput_timings () const
 Get the runtime timings of the variational formulation, for output purposes.
 
void save_json (const Eigen::MatrixXd &solution) const
 Save the solution to a JSON file, for output purposes.
 

Private Member Functions

void reset () override
 
void load_mesh (const mesh::Mesh &mesh, const json &args) override
 
void build_basis (mesh::Mesh &mesh, const bool iso_parametric, const json &args) override
 
void assemble_rhs (const mesh::Mesh &mesh) override
 
void assemble_mass_mat (const mesh::Mesh &mesh, const json &args) override
 
void solve_problem (Eigen::MatrixXd &sol) override
 
int stacked_ndof () const
 
void prepare_initial_solution (Eigen::MatrixXd &sol) const
 
void split_solution (const Eigen::MatrixXd &stacked, Eigen::MatrixXd &primary, Eigen::MatrixXd &pressure) const
 
void build_stiffness_mat (StiffnessMatrix &stiffness)
 
void solve_linear_system (const std::unique_ptr< polysolve::linear::Solver > &solver, StiffnessMatrix &A, Eigen::VectorXd &b, const bool compute_spectrum, Eigen::MatrixXd &sol)
 
void solve_static_linear (Eigen::MatrixXd &sol)
 
void solve_transient_linear (Eigen::MatrixXd &sol)
 
void build_rhs_assembler () override
 
std::shared_ptr< assembler::RhsAssemblerbuild_rhs_assembler (const int n_bases, const std::vector< basis::ElementBases > &bases, const assembler::AssemblyValsCache &ass_vals_cache)
 

Private Attributes

FESpace space_
 
FESpace pressure_space_
 
VarFormBoundaryState boundary_
 
VarFormBoundaryState pressure_boundary_
 
assembler::AssemblyValsCache ass_vals_cache_
 
assembler::AssemblyValsCache pressure_ass_vals_cache_
 
assembler::AssemblyValsCache mass_ass_vals_cache_
 
assembler::AssemblyValsCache pure_mass_ass_vals_cache_
 
std::shared_ptr< assembler::RhsAssemblerrhs_assembler_
 
StiffnessMatrix mass_
 
StiffnessMatrix pure_mass_
 
double avg_mass_ = 0
 
Eigen::MatrixXd rhs_
 
std::shared_ptr< assembler::Assemblerprimary_assembler_ = nullptr
 
std::shared_ptr< assembler::Massmass_assembler_ = nullptr
 
std::shared_ptr< assembler::HRZMasspure_mass_assembler_ = nullptr
 
std::shared_ptr< assembler::MixedAssemblermixed_assembler_ = nullptr
 
std::shared_ptr< assembler::Assemblerpressure_assembler_ = nullptr
 
double t0 = 0
 
int time_steps = 0
 
double dt = 0
 
std::shared_ptr< time_integrator::ImplicitTimeIntegratortime_integrator
 

Friends

class polyfem::test::VarFormTestAccess
 

Additional Inherited Members

- Protected Member Functions inherited from polyfem::varform::VarForm
std::string resolve_output_path (const std::string &path) const
 
std::string resolve_input_path (const std::string &path, const bool only_if_exists=false) const
 
void set_materials (assembler::Assembler &assembler, const int size) const
 
void assign_discr_orders (const json &discr_order, const mesh::Mesh &mesh, Eigen::VectorXi &disc_orders)
 
void prepare ()
 
QuadratureOrders n_boundary_samples (const int discr_order, const int gdiscr_order) const
 
void build_fe_space (mesh::Mesh &mesh, const bool iso_parametric, const Eigen::VectorXi &disc_orders, const std::string &basis_type, const std::string &poly_basis_type, const assembler::Assembler &space_assembler, const int value_dim, const int quadrature_order, const int mass_quadrature_order, const bool use_corner_quadrature, const int n_harmonic_samples, const int integral_constraints, FESpace &space, VarFormBoundaryState &boundary, std::shared_ptr< GeometryMapping > geometry=nullptr)
 
std::shared_ptr< time_integrator::BDFmake_bdf_time_integrator () const
 
void save_step_state (const double t0, const double dt, const int t, const time_integrator::ImplicitTimeIntegrator *time_integrator, const bool rest_mesh_written=false) const
 
void ensure_output_sampler () const
 
void save_restart_json (const double t0, const double dt, const int t, const bool rest_mesh_written) const
 
void save_timestep (const double time, const int t, const double t0, const double dt, const Eigen::MatrixXd &solution) const
 
void save_subsolve (const int i, const int t, const Eigen::MatrixXd &solution) const
 
int output_file_index (const int t) const
 
void notify_time_step (const int t, const int time_steps, const double t0, const double dt) const
 
io::OutGeometryData::ExportOptions export_options (const io::OutputSpace &space) const
 
io::OutputFieldFunction output_field_function (const Eigen::MatrixXd &solution, const io::OutGeometryData::ExportOptions &opts) const
 
- Static Protected Member Functions inherited from polyfem::varform::VarForm
static bool read_initial_x_from_file (const std::string &state_path, const std::string &x_name, const bool reorder, const Eigen::VectorXi &in_node_to_node, const int dim, Eigen::MatrixXd &x)
 
static void rebuild_node_positions (const std::vector< basis::ElementBases > &bases, const std::vector< int > &node_ids, std::vector< RowVectorNd > &positions)
 
- Protected Attributes inherited from polyfem::varform::VarForm
std::shared_ptr< assembler::Problemproblem
 current problem, it contains rhs and bc
 
Units units
 
json args
 
io::OutStatsData stats
 
io::OutRuntimeData timings
 runtime statistics
 
std::string root_path
 
std::string output_path
 
std::unique_ptr< mesh::Meshmesh_
 
std::function< void(int, int, double, double)> time_callback
 
io::OutGeometryData output_geometry_
 
bool output_sampler_initialized_ = false
 
bool prepared_ = false
 

Detailed Description

Definition at line 15 of file BilaplacianVarForm.hpp.

Member Function Documentation

◆ assemble_mass_mat()

◆ assemble_rhs()

◆ build_basis()

void polyfem::varform::BilaplacianVarForm::build_basis ( mesh::Mesh mesh,
const bool  iso_parametric,
const json args 
)
overrideprivatevirtual

Implements polyfem::varform::VarForm.

Definition at line 277 of file BilaplacianVarForm.cpp.

References polyfem::varform::VarForm::args, ass_vals_cache_, polyfem::varform::VarForm::assign_discr_orders(), polyfem::varform::FESpace::bases, polyfem::varform::FESpace::basis_list(), boundary_, polyfem::varform::VarFormBoundaryState::boundary_nodes, polyfem::varform::VarForm::build_fe_space(), build_rhs_assembler(), polyfem::varform::VarFormBoundaryState::clear_boundary_conditions(), polyfem::io::OutStatsData::compute_mesh_size(), polyfem::io::OutStatsData::count_flipped_elements(), polyfem::varform::VarFormBoundaryState::dirichlet_nodes, polyfem::varform::VarFormBoundaryState::dirichlet_nodes_position, polyfem::varform::FESpace::disc_orders, polyfem::varform::FESpace::geometry, polyfem::varform::FESpace::geometry_basis_list(), polyfem::assembler::AssemblyValsCache::init(), polyfem::assembler::AssemblyValsCache::init_empty(), polyfem::mesh::Mesh::is_volume(), polyfem::varform::VarFormBoundaryState::local_boundary, polyfem::varform::VarFormBoundaryState::local_neumann_boundary, polyfem::varform::VarFormBoundaryState::local_pressure_boundary, polyfem::varform::VarFormBoundaryState::local_pressure_cavity, polyfem::log_and_throw_error(), polyfem::logger(), mass_ass_vals_cache_, mass_assembler_, polyfem::io::OutStatsData::mesh_size, polyfem::varform::FESpace::n_bases, polyfem::mesh::Mesh::n_elements(), polyfem::io::OutStatsData::n_flipped, polyfem::varform::VarFormBoundaryState::neumann_nodes, polyfem::varform::VarFormBoundaryState::neumann_nodes_position, polyfem::varform::VarFormBoundaryState::normalize_boundary_nodes(), polyfem::refinement::APriori::p_refine(), polyfem::varform::FESpace::poly_edge_to_data, pressure_ass_vals_cache_, pressure_boundary_, pressure_space_, primary_assembler_, polyfem::varform::VarForm::problem, pure_mass_ass_vals_cache_, pure_mass_assembler_, polyfem::varform::VarForm::rebuild_node_positions(), space_, polyfem::varform::FESpace::space_in_node_to_node, polyfem::varform::VarForm::stats, polyfem::varform::VarFormBoundaryState::total_local_boundary, and polyfem::mesh::Mesh::update_nodes().

Here is the call graph for this function:

◆ build_rhs_assembler() [1/2]

void polyfem::varform::BilaplacianVarForm::build_rhs_assembler ( )
inlineoverrideprivatevirtual

Implements polyfem::varform::VarForm.

Definition at line 54 of file BilaplacianVarForm.hpp.

References polyfem::varform::FESpace::basis_list(), build_rhs_assembler(), mass_ass_vals_cache_, polyfem::varform::FESpace::n_bases, rhs_assembler_, and space_.

Referenced by assemble_rhs(), build_basis(), and build_rhs_assembler().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ build_rhs_assembler() [2/2]

std::shared_ptr< assembler::RhsAssembler > polyfem::varform::BilaplacianVarForm::build_rhs_assembler ( const int  n_bases,
const std::vector< basis::ElementBases > &  bases,
const assembler::AssemblyValsCache ass_vals_cache 
)
private

◆ build_stiffness_mat()

◆ compute_errors()

io::OutStatsData polyfem::varform::BilaplacianVarForm::compute_errors ( const Eigen::MatrixXd &  solution)
overridevirtual

Get the error statistics of the variational formulation, for output purposes.

Returns
Error statistics

Implements polyfem::varform::VarForm.

Definition at line 144 of file BilaplacianVarForm.cpp.

References polyfem::varform::VarForm::args, polyfem::varform::FESpace::basis_list(), polyfem::io::OutStatsData::compute_errors(), polyfem::varform::FESpace::geometry_basis_list(), polyfem::varform::VarForm::mesh_, polyfem::varform::FESpace::n_bases, polyfem::varform::VarForm::problem, space_, split_solution(), and polyfem::varform::VarForm::stats.

Here is the call graph for this function:

◆ export_data()

◆ init()

void polyfem::varform::BilaplacianVarForm::init ( const std::string &  formulation,
const Units units,
const json args,
const std::string &  out_path 
)
overridevirtual

Initialize the variational formulation with the given parameters.

Parameters
formulationname of the variational formulation
unitsunit system to use for the formulation
argsjson input arguments, used to initialize the formulation
out_pathoutput path for the formulation, used to save intermediate data

Reimplemented from polyfem::varform::VarForm.

Definition at line 53 of file BilaplacianVarForm.cpp.

References polyfem::varform::VarForm::args, dt, polyfem::problem::ProblemFactory::factory(), polyfem::problem::ProblemFactory::get_problem(), polyfem::varform::VarForm::init(), polyfem::assembler::AssemblerUtils::make_assembler(), polyfem::assembler::AssemblerUtils::make_mixed_assembler(), mass_assembler_, mixed_assembler_, polyfem::assembler::AssemblerUtils::other_assembler_name(), pressure_assembler_, primary_assembler_, polyfem::varform::VarForm::problem, pure_mass_assembler_, polyfem::varform::VarForm::root_path, t0, time_steps, and polyfem::varform::VarForm::units.

Here is the call graph for this function:

◆ load_mesh()

void polyfem::varform::BilaplacianVarForm::load_mesh ( const mesh::Mesh mesh,
const json args 
)
overrideprivatevirtual

Implements polyfem::varform::VarForm.

Definition at line 245 of file BilaplacianVarForm.cpp.

References mass_assembler_, mixed_assembler_, pressure_assembler_, primary_assembler_, polyfem::varform::VarForm::problem, pure_mass_assembler_, and polyfem::varform::VarForm::set_materials().

Here is the call graph for this function:

◆ name()

std::string polyfem::varform::BilaplacianVarForm::name ( ) const
inlineoverridevirtual

Get the name of the variational formulation.

Returns
Name of the variational formulation

Implements polyfem::varform::VarForm.

Definition at line 20 of file BilaplacianVarForm.hpp.

Referenced by save_json().

Here is the caller graph for this function:

◆ output_fields()

std::vector< io::OutputField > polyfem::varform::BilaplacianVarForm::output_fields ( const io::OutputSample sample,
const Eigen::MatrixXd &  solution,
const io::OutputFieldOptions options 
) const
overridevirtual

◆ output_space()

io::OutputSpace polyfem::varform::BilaplacianVarForm::output_space ( ) const
overridevirtual

Get the output space of the variational formulation, for output purposes.

Returns
Output space

Implements polyfem::varform::VarForm.

Definition at line 119 of file BilaplacianVarForm.cpp.

References boundary_, polyfem::varform::VarFormBoundaryState::dirichlet_nodes, polyfem::varform::VarFormBoundaryState::dirichlet_nodes_position, polyfem::varform::FESpace::disc_orders, polyfem::varform::FESpace::disc_ordersq, polyfem::varform::FESpace::geometry_basis_list(), polyfem::varform::VarForm::mesh_, polyfem::varform::FESpace::polys, polyfem::varform::FESpace::polys_3d, space_, and polyfem::varform::VarFormBoundaryState::total_local_boundary.

Referenced by export_data().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ prepare_initial_solution()

void polyfem::varform::BilaplacianVarForm::prepare_initial_solution ( Eigen::MatrixXd &  sol) const
private

Definition at line 507 of file BilaplacianVarForm.cpp.

References polyfem::varform::VarForm::args, polyfem::varform::FESpace::n_bases, pressure_space_, polyfem::varform::VarForm::problem, polyfem::varform::VarForm::read_initial_x_from_file(), polyfem::varform::VarForm::resolve_input_path(), rhs_, rhs_assembler_, space_, polyfem::varform::FESpace::space_in_node_to_node, and stacked_ndof().

Referenced by solve_problem().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ reset()

◆ save_json()

void polyfem::varform::BilaplacianVarForm::save_json ( const Eigen::MatrixXd &  solution,
std::ostream &  out 
) const
overridevirtual

Save the solution to a JSON file, for output purposes.

Parameters
solutionSolution matrix to save
outOutput stream to save the solution

Implements polyfem::varform::VarForm.

Definition at line 91 of file BilaplacianVarForm.cpp.

References polyfem::varform::VarForm::args, polyfem::varform::FESpace::disc_orders, polyfem::varform::FESpace::disc_ordersq, polyfem::varform::FESpace::is_iso_parametric(), polyfem::logger(), polyfem::varform::VarForm::mesh_, polyfem::varform::FESpace::n_bases, name(), pressure_space_, primary_assembler_, polyfem::varform::VarForm::problem, polyfem::io::OutStatsData::save_json(), space_, polyfem::varform::VarForm::stats, and polyfem::varform::VarForm::timings.

Here is the call graph for this function:

◆ solve_linear_system()

void polyfem::varform::BilaplacianVarForm::solve_linear_system ( const std::unique_ptr< polysolve::linear::Solver > &  solver,
StiffnessMatrix A,
Eigen::VectorXd &  b,
const bool  compute_spectrum,
Eigen::MatrixXd &  sol 
)
private

Definition at line 574 of file BilaplacianVarForm.cpp.

References polyfem::varform::VarForm::args, boundary_, polyfem::varform::VarFormBoundaryState::boundary_nodes, polyfem::varform::FESpace::n_bases, polyfem::io::OutStatsData::solver_info, space_, polyfem::io::OutStatsData::spectrum, polyfem::varform::VarForm::stats, and x.

Referenced by solve_static_linear(), and solve_transient_linear().

Here is the caller graph for this function:

◆ solve_problem()

void polyfem::varform::BilaplacianVarForm::solve_problem ( Eigen::MatrixXd &  sol)
overrideprivatevirtual

◆ solve_static_linear()

void polyfem::varform::BilaplacianVarForm::solve_static_linear ( Eigen::MatrixXd &  sol)
private

Definition at line 597 of file BilaplacianVarForm.cpp.

References polyfem::varform::VarForm::args, boundary_, polyfem::varform::VarFormBoundaryState::boundary_nodes, build_stiffness_mat(), polyfem::varform::FESpace::disc_orders, polyfem::varform::VarFormBoundaryState::local_boundary, polyfem::varform::VarFormBoundaryState::local_neumann_boundary, polyfem::logger(), polyfem::varform::VarForm::mesh_, polyfem::varform::VarForm::n_boundary_samples(), primary_assembler_, rhs_, rhs_assembler_, solve_linear_system(), and space_.

Referenced by solve_problem().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ solve_transient_linear()

◆ split_solution()

void polyfem::varform::BilaplacianVarForm::split_solution ( const Eigen::MatrixXd &  stacked,
Eigen::MatrixXd &  primary,
Eigen::MatrixXd &  pressure 
) const
private

Definition at line 534 of file BilaplacianVarForm.cpp.

References polyfem::varform::FESpace::n_bases, pressure_space_, and space_.

Referenced by compute_errors(), export_data(), output_fields(), and solve_transient_linear().

Here is the caller graph for this function:

◆ stacked_ndof()

int polyfem::varform::BilaplacianVarForm::stacked_ndof ( ) const
private

Definition at line 502 of file BilaplacianVarForm.cpp.

References polyfem::varform::FESpace::n_bases, pressure_space_, and space_.

Referenced by prepare_initial_solution(), and solve_transient_linear().

Here is the caller graph for this function:

Friends And Related Symbol Documentation

◆ polyfem::test::VarFormTestAccess

friend class polyfem::test::VarFormTestAccess
friend

Definition at line 17 of file BilaplacianVarForm.hpp.

Member Data Documentation

◆ ass_vals_cache_

assembler::AssemblyValsCache polyfem::varform::BilaplacianVarForm::ass_vals_cache_
private

Definition at line 70 of file BilaplacianVarForm.hpp.

Referenced by build_basis(), build_stiffness_mat(), and reset().

◆ avg_mass_

double polyfem::varform::BilaplacianVarForm::avg_mass_ = 0
private

Definition at line 80 of file BilaplacianVarForm.hpp.

Referenced by assemble_mass_mat(), and reset().

◆ boundary_

VarFormBoundaryState polyfem::varform::BilaplacianVarForm::boundary_
private

◆ dt

double polyfem::varform::BilaplacianVarForm::dt = 0
private

Definition at line 91 of file BilaplacianVarForm.hpp.

Referenced by export_data(), init(), reset(), and solve_transient_linear().

◆ mass_

StiffnessMatrix polyfem::varform::BilaplacianVarForm::mass_
private

Definition at line 77 of file BilaplacianVarForm.hpp.

Referenced by assemble_mass_mat(), reset(), and solve_transient_linear().

◆ mass_ass_vals_cache_

assembler::AssemblyValsCache polyfem::varform::BilaplacianVarForm::mass_ass_vals_cache_
private

Definition at line 72 of file BilaplacianVarForm.hpp.

Referenced by assemble_mass_mat(), build_basis(), build_rhs_assembler(), and reset().

◆ mass_assembler_

std::shared_ptr<assembler::Mass> polyfem::varform::BilaplacianVarForm::mass_assembler_ = nullptr
private

◆ mixed_assembler_

std::shared_ptr<assembler::MixedAssembler> polyfem::varform::BilaplacianVarForm::mixed_assembler_ = nullptr
private

Definition at line 86 of file BilaplacianVarForm.hpp.

Referenced by build_stiffness_mat(), init(), load_mesh(), and reset().

◆ pressure_ass_vals_cache_

assembler::AssemblyValsCache polyfem::varform::BilaplacianVarForm::pressure_ass_vals_cache_
private

Definition at line 71 of file BilaplacianVarForm.hpp.

Referenced by assemble_rhs(), build_basis(), build_stiffness_mat(), and reset().

◆ pressure_assembler_

std::shared_ptr<assembler::Assembler> polyfem::varform::BilaplacianVarForm::pressure_assembler_ = nullptr
private

Definition at line 87 of file BilaplacianVarForm.hpp.

Referenced by build_stiffness_mat(), init(), load_mesh(), and reset().

◆ pressure_boundary_

VarFormBoundaryState polyfem::varform::BilaplacianVarForm::pressure_boundary_
private

Definition at line 68 of file BilaplacianVarForm.hpp.

Referenced by build_basis(), and reset().

◆ pressure_space_

FESpace polyfem::varform::BilaplacianVarForm::pressure_space_
private

◆ primary_assembler_

std::shared_ptr<assembler::Assembler> polyfem::varform::BilaplacianVarForm::primary_assembler_ = nullptr
private

◆ pure_mass_

StiffnessMatrix polyfem::varform::BilaplacianVarForm::pure_mass_
private

Definition at line 78 of file BilaplacianVarForm.hpp.

Referenced by reset().

◆ pure_mass_ass_vals_cache_

assembler::AssemblyValsCache polyfem::varform::BilaplacianVarForm::pure_mass_ass_vals_cache_
private

Definition at line 73 of file BilaplacianVarForm.hpp.

Referenced by build_basis(), and reset().

◆ pure_mass_assembler_

std::shared_ptr<assembler::HRZMass> polyfem::varform::BilaplacianVarForm::pure_mass_assembler_ = nullptr
private

Definition at line 85 of file BilaplacianVarForm.hpp.

Referenced by build_basis(), init(), load_mesh(), and reset().

◆ rhs_

Eigen::MatrixXd polyfem::varform::BilaplacianVarForm::rhs_
private

◆ rhs_assembler_

std::shared_ptr<assembler::RhsAssembler> polyfem::varform::BilaplacianVarForm::rhs_assembler_
private

◆ space_

◆ t0

double polyfem::varform::BilaplacianVarForm::t0 = 0
private

Definition at line 89 of file BilaplacianVarForm.hpp.

Referenced by init(), reset(), and solve_transient_linear().

◆ time_integrator

std::shared_ptr<time_integrator::ImplicitTimeIntegrator> polyfem::varform::BilaplacianVarForm::time_integrator
private

Definition at line 92 of file BilaplacianVarForm.hpp.

Referenced by reset(), solve_problem(), and solve_transient_linear().

◆ time_steps

int polyfem::varform::BilaplacianVarForm::time_steps = 0
private

Definition at line 90 of file BilaplacianVarForm.hpp.

Referenced by init(), reset(), and solve_transient_linear().


The documentation for this class was generated from the following files: