PolyFEM
Loading...
Searching...
No Matches
SolveData.hpp
Go to the documentation of this file.
1#pragma once
2
10
11#include <ipc/collision_mesh.hpp>
12#include <ipc/broad_phase/broad_phase.hpp>
13
14#include <Eigen/Core>
15
16#include <memory>
17#include <string>
18#include <unordered_map>
19
21
23{
24 class ImplicitTimeIntegrator;
25} // namespace polyfem::time_integrator
26
27namespace polyfem::utils
28{
29 class PeriodicBoundary;
30}
31
32namespace polyfem::assembler
33{
34 class ViscousDamping;
35 class MacroStrainValue;
36 class PressureAssembler;
37} // namespace polyfem::assembler
38
39namespace polyfem::solver
40{
41 class NLProblem;
42 class Form;
43 class ContactForm;
44 class PeriodicContactForm;
45 class MacroStrainALForm;
46 class FrictionForm;
47 class BodyForm;
48 class AugmentedLagrangianForm;
49 class MacroStrainLagrangianForm;
50 class MacroStrainALForm;
51 class InertiaForm;
52 class ElasticForm;
53 class PressureForm;
54
57 {
58 public:
61 std::vector<std::shared_ptr<Form>> init_forms(
62 // General
63 const Units &units,
64 const int dim,
65 const double t,
66
67 // Elastic form
68 const int n_bases,
69 std::vector<basis::ElementBases> &bases,
70 const std::vector<basis::ElementBases> &geom_bases,
71 const assembler::Assembler &assembler,
72 assembler::AssemblyValsCache &ass_vals_cache,
73 const assembler::AssemblyValsCache &mass_ass_vals_cache,
74 const double jacobian_threshold,
75 const solver::ElementInversionCheck check_inversion,
76
77 // Body form
78 const int n_pressure_bases,
79 const std::vector<int> &boundary_nodes,
80 const std::vector<mesh::LocalBoundary> &local_boundary,
81 const std::vector<mesh::LocalBoundary> &local_neumann_boundary,
82 const int n_boundary_samples,
83 const Eigen::MatrixXd &rhs,
84 const Eigen::MatrixXd &sol,
85 const assembler::Density &density,
86
87 // Pressure form
88 const std::vector<mesh::LocalBoundary> &local_pressure_boundary,
89 const std::unordered_map<int, std::vector<mesh::LocalBoundary>> &local_pressure_cavity,
90 const std::shared_ptr<assembler::PressureAssembler> pressure_assembler,
91
92 // Inertia form
93 const bool ignore_inertia,
94 const StiffnessMatrix &mass,
95 const std::shared_ptr<assembler::ViscousDamping> damping_assembler,
96
97 // Lagged regularization form
98 const double lagged_regularization_weight,
99 const int lagged_regularization_iterations,
100
101 // Augemented lagrangian form
102 // const std::vector<int> &boundary_nodes,
103 // const std::vector<mesh::LocalBoundary> &local_boundary,
104 // const std::vector<mesh::LocalBoundary> &local_neumann_boundary,
105 // const int n_boundary_samples,
106 // const StiffnessMatrix &mass,
107 const size_t obstacle_ndof,
108
109 // Contact form
110 const bool contact_enabled,
111 const ipc::CollisionMesh &collision_mesh,
112 const double dhat,
113 const double avg_mass,
114 const bool use_convergent_contact_formulation,
115 const json &barrier_stiffness,
116 const ipc::BroadPhaseMethod broad_phase,
117 const double ccd_tolerance,
118 const long ccd_max_iterations,
119 const bool enable_shape_derivatives,
120
121 // Homogenization
122 const assembler::MacroStrainValue &macro_strain_constraint,
123
124 // Periodic contact
125 const bool periodic_contact,
126 const Eigen::VectorXi &tiled_to_single,
127 const std::shared_ptr<utils::PeriodicBoundary> &periodic_bc,
128
129 // Friction form
130 const double friction_coefficient,
131 const double epsv,
132 const int friction_iterations,
133
134 // Rayleigh damping form
135 const json &rayleigh_damping);
136
139 void update_barrier_stiffness(const Eigen::VectorXd &x);
140
142 void update_dt();
143
144 std::vector<std::pair<std::string, std::shared_ptr<solver::Form>>> named_forms() const;
145
146 public:
147 std::shared_ptr<assembler::RhsAssembler> rhs_assembler;
148 std::shared_ptr<assembler::PressureAssembler> pressure_assembler;
149 std::shared_ptr<solver::NLProblem> nl_problem;
150
151 std::vector<std::shared_ptr<solver::AugmentedLagrangianForm>> al_form;
152 std::shared_ptr<solver::MacroStrainLagrangianForm> strain_al_lagr_form;
153 std::shared_ptr<solver::BodyForm> body_form;
154 std::shared_ptr<solver::ContactForm> contact_form;
155 std::shared_ptr<solver::ElasticForm> damping_form;
156 std::shared_ptr<solver::ElasticForm> elastic_form;
157 std::shared_ptr<solver::FrictionForm> friction_form;
158 std::shared_ptr<solver::InertiaForm> inertia_form;
159 std::shared_ptr<solver::PressureForm> pressure_form;
160
161 std::shared_ptr<solver::PeriodicContactForm> periodic_contact_form;
162
163 std::shared_ptr<time_integrator::ImplicitTimeIntegrator> time_integrator;
164 };
165} // namespace polyfem::solver
int x
Caches basis evaluation and geometric mapping at every element.
class to store time stepping data
Definition SolveData.hpp:57
std::shared_ptr< solver::FrictionForm > friction_form
std::vector< std::shared_ptr< Form > > init_forms(const Units &units, const int dim, const double t, const int n_bases, std::vector< basis::ElementBases > &bases, const std::vector< basis::ElementBases > &geom_bases, const assembler::Assembler &assembler, assembler::AssemblyValsCache &ass_vals_cache, const assembler::AssemblyValsCache &mass_ass_vals_cache, const double jacobian_threshold, const solver::ElementInversionCheck check_inversion, const int n_pressure_bases, const std::vector< int > &boundary_nodes, const std::vector< mesh::LocalBoundary > &local_boundary, const std::vector< mesh::LocalBoundary > &local_neumann_boundary, const int n_boundary_samples, const Eigen::MatrixXd &rhs, const Eigen::MatrixXd &sol, const assembler::Density &density, const std::vector< mesh::LocalBoundary > &local_pressure_boundary, const std::unordered_map< int, std::vector< mesh::LocalBoundary > > &local_pressure_cavity, const std::shared_ptr< assembler::PressureAssembler > pressure_assembler, const bool ignore_inertia, const StiffnessMatrix &mass, const std::shared_ptr< assembler::ViscousDamping > damping_assembler, const double lagged_regularization_weight, const int lagged_regularization_iterations, const size_t obstacle_ndof, const bool contact_enabled, const ipc::CollisionMesh &collision_mesh, const double dhat, const double avg_mass, const bool use_convergent_contact_formulation, const json &barrier_stiffness, const ipc::BroadPhaseMethod broad_phase, const double ccd_tolerance, const long ccd_max_iterations, const bool enable_shape_derivatives, const assembler::MacroStrainValue &macro_strain_constraint, const bool periodic_contact, const Eigen::VectorXi &tiled_to_single, const std::shared_ptr< utils::PeriodicBoundary > &periodic_bc, const double friction_coefficient, const double epsv, const int friction_iterations, const json &rayleigh_damping)
Initialize the forms and return a vector of pointers to them.
Definition SolveData.cpp:27
std::shared_ptr< solver::InertiaForm > inertia_form
std::shared_ptr< solver::PeriodicContactForm > periodic_contact_form
void update_dt()
updates the dt inside the different forms
std::shared_ptr< solver::PressureForm > pressure_form
std::shared_ptr< solver::BodyForm > body_form
std::shared_ptr< solver::NLProblem > nl_problem
std::shared_ptr< solver::MacroStrainLagrangianForm > strain_al_lagr_form
std::shared_ptr< solver::ContactForm > contact_form
std::vector< std::pair< std::string, std::shared_ptr< solver::Form > > > named_forms() const
std::shared_ptr< solver::ElasticForm > damping_form
std::shared_ptr< solver::ElasticForm > elastic_form
std::vector< std::shared_ptr< solver::AugmentedLagrangianForm > > al_form
std::shared_ptr< time_integrator::ImplicitTimeIntegrator > time_integrator
void update_barrier_stiffness(const Eigen::VectorXd &x)
update the barrier stiffness for the forms
std::shared_ptr< assembler::PressureAssembler > pressure_assembler
std::shared_ptr< assembler::RhsAssembler > rhs_assembler
Used for test only.
nlohmann::json json
Definition Common.hpp:9
Eigen::SparseMatrix< double, Eigen::ColMajor > StiffnessMatrix
Definition Types.hpp:22