|
PolyFEM
|
#include <FluidVarForm.hpp>
Public Member Functions | |
| 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::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. | |
Public Member Functions inherited from polyfem::varform::VarForm | |
| virtual | ~VarForm ()=default |
| virtual std::string | name () const =0 |
| Get the name of the variational formulation. | |
| 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::OutRuntimeData & | output_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. | |
Protected 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 |
| int | primary_ndof () const |
| int | pressure_block_size () const |
| 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 | build_rhs_assembler () override |
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) |
| virtual void | solve_problem (Eigen::MatrixXd &sol)=0 |
| 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::BDF > | make_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 |
Friends | |
| class | polyfem::test::VarFormTestAccess |
Additional Inherited Members | |
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) |
Definition at line 15 of file FluidVarForm.hpp.
|
overrideprotectedvirtual |
Implements polyfem::varform::VarForm.
Definition at line 492 of file FluidVarForm.cpp.
References polyfem::varform::VarForm::args, polyfem::io::OutRuntimeData::assembling_mass_mat_time, avg_mass_, polyfem::varform::FESpace::basis_list(), polyfem::varform::FESpace::geometry_basis_list(), polyfem::mesh::Mesh::is_volume(), polyfem::logger(), polyfem::utils::lump_matrix(), mass_, mass_ass_vals_cache_, mass_assembler_, polyfem::io::OutStatsData::mat_size, polyfem::varform::FESpace::n_bases, polyfem::io::OutStatsData::nn_zero, polyfem::io::OutStatsData::num_dofs, primary_assembler_, primary_ndof(), polyfem::varform::VarForm::problem, pure_mass_, pure_mass_ass_vals_cache_, pure_mass_assembler_, space_, polyfem::varform::VarForm::stats, and polyfem::varform::VarForm::timings.
|
overrideprotectedvirtual |
Implements polyfem::varform::VarForm.
Definition at line 456 of file FluidVarForm.cpp.
References polyfem::io::OutRuntimeData::assigning_rhs_time, polyfem::mesh::Mesh::bounding_box(), build_rhs_assembler(), polyfem::mesh::Mesh::is_volume(), polyfem::logger(), mass_assembler_, pressure_block_size(), primary_assembler_, polyfem::varform::VarForm::problem, rhs_, rhs_assembler_, polyfem::varform::VarForm::root_path, and polyfem::varform::VarForm::timings.
|
overrideprotectedvirtual |
Implements polyfem::varform::VarForm.
Definition at line 306 of file FluidVarForm.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::mesh::Mesh::dimension(), 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, polyfem::mesh::Mesh::update_nodes(), and use_avg_pressure.
|
overrideprotectedvirtual |
Implements polyfem::varform::VarForm.
Definition at line 290 of file FluidVarForm.cpp.
References polyfem::varform::VarForm::args, polyfem::varform::FESpace::basis_list(), boundary_, polyfem::varform::VarFormBoundaryState::dirichlet_nodes, polyfem::varform::VarFormBoundaryState::dirichlet_nodes_position, polyfem::varform::FESpace::geometry_basis_list(), mass_ass_vals_cache_, polyfem::varform::VarForm::mesh_, polyfem::varform::FESpace::n_bases, polyfem::varform::VarFormBoundaryState::neumann_nodes, polyfem::varform::VarFormBoundaryState::neumann_nodes_position, primary_assembler_, polyfem::varform::VarForm::problem, rhs_assembler_, and space_.
Referenced by assemble_rhs(), and build_basis().
|
protected |
Definition at line 591 of file FluidVarForm.cpp.
References polyfem::varform::VarForm::args, ass_vals_cache_, polyfem::io::OutRuntimeData::assembling_stiffness_mat_time, polyfem::varform::FESpace::basis_list(), polyfem::varform::FESpace::geometry_basis_list(), polyfem::logger(), polyfem::io::OutStatsData::mat_size, polyfem::assembler::AssemblerUtils::merge_mixed_matrices(), polyfem::varform::VarForm::mesh_, mixed_assembler_, polyfem::varform::FESpace::n_bases, polyfem::io::OutStatsData::nn_zero, polyfem::io::OutStatsData::num_dofs, pressure_ass_vals_cache_, pressure_assembler_, pressure_space_, primary_assembler_, space_, polyfem::varform::VarForm::stats, polyfem::varform::VarForm::timings, use_avg_pressure, and polyfem::varform::internal::write_matrix_market().
|
overridevirtual |
Get the error statistics of the variational formulation, for output purposes.
Implements polyfem::varform::VarForm.
Definition at line 161 of file FluidVarForm.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.
|
overridevirtual |
Implements polyfem::varform::VarForm.
Definition at line 176 of file FluidVarForm.cpp.
References polyfem::varform::VarForm::args, polyfem::varform::FESpace::basis_list(), polyfem::io::Evaluator::compute_stress_at_quadrature_points(), polyfem::varform::FESpace::disc_orders, polyfem::varform::FESpace::disc_ordersq, dt, polyfem::varform::VarForm::ensure_output_sampler(), polyfem::io::OutGeometryData::export_data(), polyfem::varform::VarForm::export_options(), polyfem::varform::FESpace::geometry_basis_list(), polyfem::logger(), polyfem::io::OutputSpace::mesh, polyfem::varform::VarForm::mesh_, polyfem::varform::FESpace::n_bases, polyfem::varform::VarForm::output_field_function(), polyfem::varform::VarForm::output_geometry_, output_space(), primary_assembler_, primary_ndof(), polyfem::varform::VarForm::problem, polyfem::varform::VarForm::resolve_output_path(), space_, polyfem::varform::FESpace::space_in_node_to_node, split_solution(), polyfem::utils::unflatten(), and polyfem::io::write_matrix().
|
overridevirtual |
Initialize the variational formulation with the given parameters.
| formulation | name of the variational formulation |
| units | unit system to use for the formulation |
| args | json input arguments, used to initialize the formulation |
| out_path | output path for the formulation, used to save intermediate data |
Reimplemented from polyfem::varform::VarForm.
Definition at line 57 of file FluidVarForm.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.
|
overrideprotectedvirtual |
Implements polyfem::varform::VarForm.
Definition at line 262 of file FluidVarForm.cpp.
References polyfem::mesh::Mesh::dimension(), mass_assembler_, mixed_assembler_, pressure_assembler_, primary_assembler_, polyfem::varform::VarForm::problem, pure_mass_assembler_, and polyfem::varform::VarForm::set_materials().
|
overridevirtual |
Get the output fields of the variational formulation, for output purposes.
| sample | Output sample |
| solution | Solution matrix |
| options | Output field options |
Implements polyfem::varform::VarForm.
Definition at line 648 of file FluidVarForm.cpp.
References polyfem::varform::FESpace::basis_list(), polyfem::io::OutputSample::element_ids, polyfem::io::OutputFieldOptions::export_field(), polyfem::io::OutputFieldOptions::fields, polyfem::varform::FESpace::geometry_basis_list(), polyfem::io::Evaluator::interpolate_at_local_vals(), polyfem::io::OutputSample::local_points, polyfem::varform::VarForm::mesh_, polyfem::io::OutputSample::node_ids, polyfem::io::OutputField::Point, polyfem::io::OutputSample::points, polyfem::varform::VarForm::problem, space_, and split_solution().
|
overridevirtual |
Get the output space of the variational formulation, for output purposes.
Implements polyfem::varform::VarForm.
Definition at line 136 of file FluidVarForm.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().
|
protected |
Definition at line 546 of file FluidVarForm.cpp.
References polyfem::varform::VarForm::args, polyfem::varform::VarForm::mesh_, pressure_block_size(), 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().
|
protected |
Definition at line 280 of file FluidVarForm.cpp.
References polyfem::varform::FESpace::n_bases, pressure_space_, primary_assembler_, and use_avg_pressure.
Referenced by assemble_rhs(), prepare_initial_solution(), and stacked_ndof().
|
protected |
Definition at line 275 of file FluidVarForm.cpp.
References polyfem::varform::VarForm::mesh_, polyfem::varform::FESpace::n_bases, and space_.
Referenced by assemble_mass_mat(), export_data(), save_json(), solve_linear_system(), split_solution(), and stacked_ndof().
|
overrideprotectedvirtual |
Implements polyfem::varform::VarForm.
Definition at line 29 of file FluidVarForm.cpp.
References ass_vals_cache_, avg_mass_, boundary_, dt, polyfem::assembler::AssemblyValsCache::init_empty(), mass_, mass_ass_vals_cache_, mass_assembler_, mixed_assembler_, pressure_ass_vals_cache_, pressure_assembler_, pressure_boundary_, pressure_space_, primary_assembler_, pure_mass_, pure_mass_ass_vals_cache_, pure_mass_assembler_, polyfem::varform::FESpace::reset(), polyfem::varform::VarFormBoundaryState::reset(), polyfem::varform::VarForm::reset(), rhs_, rhs_assembler_, space_, t0, time_integrator, time_steps, and use_avg_pressure.
|
overridevirtual |
Save the solution to a JSON file, for output purposes.
| solution | Solution matrix to save |
| out | Output stream to save the solution |
Implements polyfem::varform::VarForm.
Definition at line 107 of file FluidVarForm.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, polyfem::varform::VarForm::name(), pressure_space_, primary_assembler_, primary_ndof(), polyfem::varform::VarForm::problem, polyfem::io::OutStatsData::save_json(), space_, polyfem::varform::VarForm::stats, and polyfem::varform::VarForm::timings.
|
protected |
Definition at line 618 of file FluidVarForm.cpp.
References polyfem::varform::VarForm::args, boundary_, polyfem::varform::VarFormBoundaryState::boundary_nodes, polyfem::logger(), primary_ndof(), polyfem::io::OutStatsData::solver_info, polyfem::io::OutStatsData::spectrum, polyfem::varform::VarForm::stats, use_avg_pressure, and x.
|
protected |
Definition at line 573 of file FluidVarForm.cpp.
References polyfem::varform::FESpace::n_bases, pressure_space_, and primary_ndof().
Referenced by compute_errors(), export_data(), and output_fields().
|
protected |
Definition at line 285 of file FluidVarForm.cpp.
References pressure_block_size(), and primary_ndof().
Referenced by prepare_initial_solution().
|
friend |
Definition at line 17 of file FluidVarForm.hpp.
|
protected |
Definition at line 60 of file FluidVarForm.hpp.
Referenced by build_basis(), build_stiffness_mat(), and reset().
|
protected |
Definition at line 70 of file FluidVarForm.hpp.
Referenced by assemble_mass_mat(), and reset().
|
protected |
Definition at line 57 of file FluidVarForm.hpp.
Referenced by build_basis(), build_rhs_assembler(), output_space(), reset(), and solve_linear_system().
|
protected |
Definition at line 81 of file FluidVarForm.hpp.
Referenced by export_data(), init(), and reset().
|
protected |
Definition at line 67 of file FluidVarForm.hpp.
Referenced by assemble_mass_mat(), and reset().
|
protected |
Definition at line 62 of file FluidVarForm.hpp.
Referenced by assemble_mass_mat(), build_basis(), build_rhs_assembler(), and reset().
|
protected |
Definition at line 74 of file FluidVarForm.hpp.
Referenced by assemble_mass_mat(), assemble_rhs(), build_basis(), init(), load_mesh(), and reset().
|
protected |
Definition at line 76 of file FluidVarForm.hpp.
Referenced by build_stiffness_mat(), init(), load_mesh(), and reset().
|
protected |
Definition at line 61 of file FluidVarForm.hpp.
Referenced by build_basis(), build_stiffness_mat(), and reset().
|
protected |
Definition at line 77 of file FluidVarForm.hpp.
Referenced by build_stiffness_mat(), init(), load_mesh(), and reset().
|
protected |
Definition at line 58 of file FluidVarForm.hpp.
Referenced by build_basis(), and reset().
|
protected |
Definition at line 55 of file FluidVarForm.hpp.
Referenced by build_basis(), build_stiffness_mat(), pressure_block_size(), reset(), save_json(), and split_solution().
|
protected |
Definition at line 73 of file FluidVarForm.hpp.
Referenced by assemble_mass_mat(), assemble_rhs(), build_basis(), build_rhs_assembler(), build_stiffness_mat(), export_data(), init(), load_mesh(), pressure_block_size(), reset(), and save_json().
|
protected |
Definition at line 68 of file FluidVarForm.hpp.
Referenced by assemble_mass_mat(), and reset().
|
protected |
Definition at line 63 of file FluidVarForm.hpp.
Referenced by assemble_mass_mat(), build_basis(), and reset().
|
protected |
Definition at line 75 of file FluidVarForm.hpp.
Referenced by assemble_mass_mat(), build_basis(), init(), load_mesh(), and reset().
|
protected |
Definition at line 71 of file FluidVarForm.hpp.
Referenced by assemble_rhs(), prepare_initial_solution(), and reset().
|
protected |
Definition at line 65 of file FluidVarForm.hpp.
Referenced by assemble_rhs(), build_rhs_assembler(), prepare_initial_solution(), and reset().
|
protected |
Definition at line 54 of file FluidVarForm.hpp.
Referenced by assemble_mass_mat(), build_basis(), build_rhs_assembler(), build_stiffness_mat(), compute_errors(), export_data(), output_fields(), output_space(), prepare_initial_solution(), primary_ndof(), reset(), and save_json().
|
protected |
Definition at line 79 of file FluidVarForm.hpp.
|
protected |
Definition at line 82 of file FluidVarForm.hpp.
Referenced by reset().
|
protected |
Definition at line 80 of file FluidVarForm.hpp.
|
protected |
Definition at line 78 of file FluidVarForm.hpp.
Referenced by build_basis(), build_stiffness_mat(), pressure_block_size(), reset(), and solve_linear_system().