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

Variational form for the (displacement, growth) problem built on the GrowthElasticity mixed assembler, structured like ThermoElasticVarForm without the transient machinery. More...

#include <GrowthElasticVarForm.hpp>

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

Classes

struct  GrowthLawSettings
 Growth law (material "growth_law"): rate-independent, per-element threshold (given, or built from the state), irreversibility theta >= theta_n enforced by a primal-dual active set (pinned DOFs are Dirichlet at theta_n through BCLagrangianForm; free DOFs are unconstrained). More...
 

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 validate_time_dependence () const override
 Solved growth steps its own pseudo-time (growth_law.n_steps, t_end), so its displacement problem is time dependent (the Dirichlet data follow t) without a "time" block, which init refuses.
 
io::OutStatsData compute_errors (const Eigen::MatrixXd &solution) override
 Get the error statistics of the variational formulation, for output purposes.
 
void serialize_checkpoint (io::CheckpointWriter &writer, const Eigen::MatrixXd &solution, const io::CheckpointMetadata &metadata) const override
 both blocks of the stacked (displacement, growth) solution, each with its node ordering, as for the other mixed formulations
 
void deserialize_checkpoint (const io::CheckpointReader &reader, Eigen::MatrixXd &solution) override
 
void export_data (const Eigen::MatrixXd &solution) const override
 
const Eigen::VectorXi & growth_activation_step () const
 growth_law: first increment in which each growth DOF grew (0 = never); empty before a solved run.
 
const Eigen::VectorXd & growth_shear_supply () const
 growth_law threshold from_state: f_gamma per element used by the last increment, and the threshold phi_e in use (empty / the given values otherwise).
 
const Eigen::VectorXd & growth_threshold () const
 
const Eigen::VectorXd & growth_threshold_parallel () const
 
const Eigen::VectorXd & growth_attainment () const
 
const Eigen::VectorXd & growth_lag_residual () const
 
const Eigen::VectorXd & growth_dissipation () const
 
const Eigen::VectorXd & growth_shear_supply_work () const
 
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::NonlinearElasticVarForm
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.
 
bool is_contact_enabled () const override
 Check if contact is enabled for the variational formulation, for output purposes.
 
io::OutputSpace output_space () const override
 Get the output space 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.
 
void prepare_for_embedding ()
 Prepare the standard nonlinear-elastic assembly state for use as a block in a larger nonlinear problem.
 
void initial_solution_for_embedding (Eigen::MatrixXd &solution, const std::string &state_prefix="") const
 
void init_forms_for_embedding (Eigen::MatrixXd &solution, double t, const std::string &state_prefix="")
 
void advance_for_embedding (const Eigen::VectorXd &solution)
 
void update_barrier_stiffness_for_embedding (const Eigen::VectorXd &solution)
 
bool save_timestep_for_embedding (double time, int step, double dt, const Eigen::MatrixXd &solution, paraviewo::VTMWriter &vtm, const std::string &block_prefix, io::OutGeometryData::WriteJobs *writes=nullptr) const
 
int embedding_ndof () const
 
const std::vector< std::shared_ptr< solver::Form > > & embedding_forms () const
 
const std::vector< std::shared_ptr< solver::AugmentedLagrangianForm > > & embedding_al_forms () const
 
const StiffnessMatrix & embedding_norm_matrix () const
 
const std::shared_ptr< time_integrator::ImplicitTimeIntegrator > & embedding_time_integrator () const
 
const FESpace & embedding_space () const
 
- Public Member Functions inherited from polyfem::varform::ElasticVarForm
void save_json (const Eigen::MatrixXd &solution, std::ostream &out) const override
 Save the solution to a JSON file, for output purposes.
 
 VarForm (const io::ResourceIO &resources)
 
- Public Member Functions inherited from polyfem::varform::VarForm
 VarForm (const io::ResourceIO &resources)
 
virtual ~VarForm ()=default
 
void set_args (const json &args)
 Reset the internal state of the variational formulation, e.g.
 
void set_checkpoint_reader (const io::CheckpointReader &reader)
 
void set_mesh (std::unique_ptr< mesh::Mesh > mesh, const double loading_mesh_time=0)
 Set the mesh for the variational formulation.
 
void set_geometry (mesh::LoadedGeometry geometry, double loading_mesh_time=0)
 
void solve (Eigen::MatrixXd &sol, const InitialConditionOverride *initial_condition_override=nullptr, const ForwardStepCallback &post_step={})
 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.
 
bool should_save_timestep (int step) const
 Whether the output index and frame selection include this timestep.
 
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.
 

Private Member Functions

io::OutputFieldFunction snapshot_output_fields (const Eigen::MatrixXd &, const io::OutGeometryData::ExportOptions &, const io::OutputSpace &, double, double) const override
 Capture mutable timestep data for deferred field evaluation.
 
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, const InitialConditionOverride *initial_condition_override, const ForwardStepCallback &post_step) override
 
void build_rhs_assembler () override
 
void read_material_space_ids (const json &args)
 
json elastic_material_args () const
 
void grown_stress_at (const int e, const Eigen::MatrixXd &local_pts, const double t, const Eigen::MatrixXd &displacement, const Eigen::MatrixXd &growth, Eigen::MatrixXd &cauchy, Eigen::MatrixXd &pk1, Eigen::MatrixXd &pk2, Eigen::MatrixXd &von_mises, Eigen::MatrixXd &energy) const
 Grown-material stresses and energy density (GrowthElasticity::grown_stresses) at local points of element e, flattened column-major like the elastic tensor output: cauchy, pk1, pk2 (n x 9), von Mises of the Cauchy stress and the energy density (n x 1).
 
void replace_stress_fields (const io::OutputSample &sample, const Eigen::MatrixXd &displacement, const Eigen::MatrixXd &growth, std::vector< io::OutputField > &fields) const
 The elastic base evaluates von_mises, cauchy_stess_*, pk1_stess_*, pk2_stess_* (and the *_avg variants), energy and energy_avg with the ungrown material at the total F; overwrite the ones it emitted with the grown-material values.
 
void build_displacement_boundary (mesh::Mesh &mesh)
 
void build_growth_basis (mesh::Mesh &mesh, const bool iso_parametric, const json &args)
 
void build_growth_boundary (mesh::Mesh &mesh)
 
void build_forms (Eigen::MatrixXd &solution, const double t)
 
void make_nl_problem (const Eigen::MatrixXd &sol, const double t)
 NLProblem over the current forms and AL forms, initialized at sol, t.
 
void solve_nonlinear_step (const int step, Eigen::MatrixXd &solution, double grad_tol_factor=1.0)
 
void read_growth_law (const json &args)
 
void compute_growth_node_weights ()
 
void assemble_growth_node_weights ()
 w_a = sum_e vn_e phi_e int_e N_a dV from threshold_per_element_ (and the nodal volumes); called once (fixed threshold) or per update (from_state).
 
void threshold_target (const Eigen::MatrixXd &solution, double t, Eigen::VectorXd &par, Eigen::VectorXd &gam, Eigen::VectorXd &clamped)
 the threshold the state implies (from_state): G(x) = (PHI_PAR, f_gamma) at C_check of the state; f_gamma = f_I(Ce) - f_I(Ce with the transverse shears removed and Ce_nn at the layer value), PHI_PAR = max(f_par, 0)
 
void set_threshold (const Eigen::VectorXd &par, const Eigen::VectorXd &gam, const Eigen::VectorXd &clamped, double t, double omega)
 install a threshold (parts), rebuild the node weights, log
 
void evaluate_threshold_state (const Eigen::VectorXd &u, double t, Eigen::VectorXd &phi_full, Eigen::VectorXd &phi_no_shear, Eigen::VectorXd &theta_tot)
 The state-built threshold at C_check of displacement u, per element: f_I(Ce) (phi_full), f_I(Ce shear-free, layer thickness) (phi_no_shear), and the total in-plane area stretch theta_tot.
 
Eigen::VectorXd element_mean_growth (const Eigen::VectorXd &theta)
 element mean of a nodal growth field (growth quadrature)
 
void report_lag_residual (int step, double t, const Eigen::MatrixXd &solution)
 lag residual phi(converged state) - phi used, and attainment, logged per increment
 
void accumulate_dissipation (int step, double t, const Eigen::VectorXd &dtheta)
 split of the increment's dissipation term (D, S), accumulated and logged
 
void log_kkt_residual (int step, double t, const Eigen::MatrixXd &solution, const Eigen::VectorXd &mult, const std::vector< char > &pinned)
 phi - f_I per v_n-weighted nodal volume on the settled set: free and pinned
 
void solve_growth_law (Eigen::MatrixXd &solution)
 
int advance_increment (int step, double t_from, double t_to, Eigen::MatrixXd &solution, int depth)
 one increment (t_from, t_to], split recursively on failure; returns passes
 
void commit_increment (int step, double t, Eigen::MatrixXd &solution)
 D/S accumulation, theta_n update and activation marking after a converged (sub)increment.
 
void save_growth_increment (int step, double t, const Eigen::MatrixXd &solution)
 growth_law.save_increments: the converged stacked state of increment step (pseudo-time t) as growth_step_<step>.vtu, and growth_steps.pvd rewritten to list steps 1..step.
 
int solve_growth_increment (const int step, const double t, Eigen::MatrixXd &solution)
 One increment: primal-dual active-set loop on theta >= theta_n.
 
void solve_with_current_pins (const int step, const double t, Eigen::MatrixXd &solution, double grad_tol_factor=1.0)
 
Eigen::VectorXd growth_multiplier (const Eigen::MatrixXd &solution) const
 d Pi_inc / d theta at the solution: stacked energy gradient plus the dissipation weights (the KKT residual; >= 0 where pinned, ~0 where free).
 
void initial_growth_solution (Eigen::MatrixXd &solution) const
 
const Eigen::MatrixXd & prescribed_growth_field () const
 
void split_solution (const Eigen::MatrixXd &solution, Eigen::MatrixXd &displacement, Eigen::MatrixXd &growth) const
 
Eigen::MatrixXd stacked_solution (const Eigen::MatrixXd &displacement, const Eigen::MatrixXd &growth) const
 
int displacement_ndof () const
 
int growth_ndof () const
 
int total_ndof () const
 

Static Private Member Functions

static double median_of (const Eigen::VectorXd &v)
 

Private Attributes

FESpace growth_space_
 
VarFormBoundaryState growth_boundary_
 
std::shared_ptr< assembler::Problem > growth_problem_
 
assembler::AssemblyValsCache growth_ass_vals_cache_
 
assembler::AssemblyValsCache growth_mass_ass_vals_cache_
 
std::shared_ptr< assembler::Assembler > growth_assembler_
 
std::shared_ptr< assembler::MixedNLAssembler > growthelastic_assembler_
 
std::shared_ptr< assembler::Mass > growth_mass_assembler_
 
std::shared_ptr< assembler::RhsAssembler > growth_rhs_assembler_
 
std::shared_ptr< assembler::Density > growth_rhs_density_
 
StiffnessMatrix growth_mass_
 
StiffnessMatrix stacked_lumped_mass_
 
Eigen::MatrixXd growth_rhs_
 
std::shared_ptr< solver::MixedAssemblerForm > growth_coupling_form_
 
std::shared_ptr< solver::StackedForm > stacked_form_
 
Eigen::MatrixXd converged_solution_
 Converged stacked (u, growth) solution cached at the end of solve_problem.
 
Eigen::MatrixXd prescribed_growth_
 Whole-field growth prescription (boundary_conditions.growth_nodal_field): nodal theta values loaded lazily from file; when set, EVERY growth DOF is Dirichlet with these targets (via BCLagrangianForm's tabulated-target constructor) and the same field is the growth initial solution.
 
int displacement_space_id_ = -1
 
int growth_space_id_ = -1
 
std::string elastic_formulation_ = "MaterialSum"
 
struct polyfem::varform::GrowthElasticVarForm::GrowthLawSettings growth_law_
 
Eigen::VectorXd threshold_per_element_
 phi_e [Pa] in use (from_state: phi_par + f_gamma)
 
Eigen::VectorXd threshold_parallel_
 from_state: phi_par,e of the last update [Pa]
 
Eigen::VectorXd shear_supply_
 from_state: f_gamma,e of the last update [Pa]
 
bool setup_logged_ = false
 the setup line is logged once, not per update
 
Eigen::VectorXd threshold_clamped_
 1 where f_par(C_check) < 0 (zero floor), when computed here
 
Eigen::VectorXd lag_residual_
 phi(converged state) - phi used, last increment [Pa]
 
Eigen::VectorXd attainment_
 vartheta^e / theta_crit at the last converged increment
 
Eigen::VectorXd dissipation_
 cumulative D = sum v_n max(f_par,0) dtheta per element [Pa]
 
Eigen::VectorXd shear_work_
 cumulative S = sum v_n f_gamma dtheta per element [Pa]
 
Eigen::VectorXd element_volume_
 reference element volumes (growth quadrature)
 
Eigen::VectorXd normal_growth_per_element_
 vn_e (1 when not given)
 
Eigen::VectorXd growth_node_volume_
 int N_a dV
 
Eigen::VectorXd growth_node_vn_volume_
 int vn N_a dV (KKT residual in Pa)
 
Eigen::VectorXd growth_node_weights_
 int vn phi N_a dV
 
Eigen::VectorXd theta_n_
 converged growth of the previous increment
 
std::vector< int > pinned_growth_nodes_
 member: BCLagrangianForm keeps a reference
 
std::vector< char > growth_pinned_mask_
 last solved pass: 1 = pinned at theta_n
 
Eigen::VectorXi growth_activation_step_
 first increment in which a growth DOF grew (0 = never)
 
std::shared_ptr< solver::GrowthDissipationForm > dissipation_form_
 

Additional Inherited Members

- Static Public Member Functions inherited from polyfem::varform::NonlinearElasticVarForm
static void build_collision_mesh (const mesh::Mesh &mesh, const int n_bases, const std::vector< basis::ElementBases > &bases, const std::vector< basis::ElementBases > &geom_bases, const std::vector< mesh::LocalBoundary > &total_local_boundary, const mesh::Obstacle &obstacle, const json &args, const io::ResourceIO &resources, const Eigen::VectorXi &in_node_to_node, ipc::CollisionMesh &collision_mesh)
 
- Protected Member Functions inherited from polyfem::varform::NonlinearElasticVarForm
io::OutputFieldFunction snapshot_output_fields (const Eigen::MatrixXd &solution, const io::OutGeometryData::ExportOptions &opts, const io::OutputSpace &space, double time, double dt) const override
 Capture mutable timestep data for deferred field evaluation.
 
void reset () override
 
void set_obstacle (mesh::Obstacle &&obstacle) 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 build_rhs_assembler () override
 
void init_solve (Eigen::MatrixXd &sol, double t, const InitialConditionOverride *initial_condition_override)
 
void init_solve_data (Eigen::MatrixXd &sol, double t, const std::string &state_prefix, const InitialConditionOverride *initial_condition_override=nullptr)
 
virtual void init_forms (const json &args, int dim, Eigen::MatrixXd &sol, double t)
 
bool has_macro_strain () const
 
Eigen::VectorXd init_homogenization_solve (Eigen::MatrixXd &solution, double time, const InitialConditionOverride *initial_condition_override)
 Return the initial extended solution [periodic displacement fluctuation | flatten(G)].
 
void solve_homogenization_step (int step, double time, Eigen::VectorXd &extended_solution, Eigen::MatrixXd &solution, const ForwardStepCallback &post_step)
 
virtual void solve_tensor_nonlinear (int step, Eigen::MatrixXd &sol, bool init_lagging=true)
 
std::shared_ptr< assembler::PressureAssembler > build_pressure_assembler () const
 
void build_collision_mesh (const mesh::Mesh &mesh, const json &args)
 
void build_periodic_collision_mesh ()
 
void preprocess_contact_parameters ()
 
int n_obstacle_vertices () const override
 
- Protected Member Functions inherited from polyfem::varform::ElasticVarForm
io::OutputFieldFunction snapshot_elastic_output_fields (const Eigen::MatrixXd &solution, const io::OutGeometryData::ExportOptions &opts, const mesh::Obstacle *obstacle, const time_integrator::ImplicitTimeIntegrator *time_integrator, const std::vector< std::pair< std::string, std::shared_ptr< solver::Form > > > &named_forms, const solver::Form *elastic_form, const solver::ContactForm *contact_form=nullptr) const
 
void build_elastic_basis (mesh::Mesh &mesh, const bool iso_parametric, const json &args, const int fe_space_id)
 
void initial_solution (Eigen::MatrixXd &solution, const InitialConditionOverride *override=nullptr, const std::string &state_prefix="") const
 
void initial_velocity (Eigen::MatrixXd &velocity, const InitialConditionOverride *override=nullptr, const std::string &state_prefix="") const
 
void initial_acceleration (Eigen::MatrixXd &acceleration, const InitialConditionOverride *override=nullptr, const std::string &state_prefix="") const
 
QuadratureOrders elastic_boundary_samples () const
 
std::vector< int > elastic_primitive_to_node () const
 
std::vector< int > elastic_node_to_primitive () const
 
void build_mesh_matrices (Eigen::MatrixXd &V, Eigen::MatrixXi &F) const
 
void save_elastic_step_state (const double t0, const double dt, const int t, const Eigen::MatrixXd &solution, const time_integrator::ImplicitTimeIntegrator *time_integrator) const
 
std::vector< io::OutputField > elastic_output_fields (const io::OutputSample &sample, const Eigen::MatrixXd &solution, const io::OutputFieldOptions &options, const mesh::Obstacle *obstacle, const time_integrator::ImplicitTimeIntegrator *time_integrator, const std::vector< std::pair< std::string, std::shared_ptr< solver::Form > > > &named_forms, const solver::Form *elastic_form, const solver::ContactForm *contact_form=nullptr, const ElasticOutputState *output_state=nullptr) const
 
void append_primary_output_fields (std::vector< io::OutputField > &fields, const io::OutputSample &sample, const Eigen::MatrixXd &solution, const io::OutputFieldOptions &options, const mesh::Obstacle *obstacle=nullptr, const StiffnessMatrix *interpolation=nullptr) const
 
Eigen::MatrixXd displaced_output_normals (const io::OutputSample &sample, const Eigen::MatrixXd &solution) const
 
- Protected Member Functions inherited from polyfem::varform::VarForm
void prepare ()
 Prepare all discretization and assembly data without running a solve.
 
std::string resolve_output_path (const std::string &path) const
 
void set_materials (assembler::Assembler &assembler, const int size) const
 
void restore_checkpoint_integrator (const std::shared_ptr< time_integrator::ImplicitTimeIntegrator > &integrator, const std::string &group, double dt, const std::string &ordering, const FESpace &space, int block_size) const
 
void write_checkpoint_ordering (io::CheckpointWriter &writer, const std::string &name, const FESpace &space) const
 
void reorder_checkpoint_block (const io::CheckpointReader &reader, const std::string &name, const FESpace &space, int block_size, int row_offset, Eigen::MatrixXd &value) const
 
Eigen::VectorXi checkpoint_ordering (const FESpace &space) const
 
void validate_checkpoint_solution (const Eigen::MatrixXd &solution, int expected_rows) const
 
bool checkpoint_reorder_enabled () const
 
void assign_discr_orders (const json &space_args, const mesh::Mesh &mesh, Eigen::VectorXi &disc_orders, Eigen::VectorXi &disc_ordersq)
 
void assign_discr_orders (const json &space_args, const int fe_space_id, const mesh::Mesh &mesh, Eigen::VectorXi &disc_orders, Eigen::VectorXi &disc_ordersq)
 
QuadratureOrders n_boundary_samples (const int discr_order, const int discr_orderq, const int gdiscr_order) const
 
void build_fe_space (mesh::Mesh &mesh, const bool iso_parametric, const Eigen::VectorXi &disc_orders, const Eigen::VectorXi &disc_ordersq, 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)
 
void build_node_mapping (const mesh::Mesh &mesh, const std::string &basis_type, const FESpace &space, Eigen::VectorXi &space_in_node_to_node, Eigen::VectorXi &space_in_primitive_to_primitive) const
 Input-order -> internal node map of an FE space.
 
void save_step_state (const double t0, const double dt, const int t, const Eigen::MatrixXd &solution, const time_integrator::ImplicitTimeIntegrator *time_integrator) const
 
void ensure_output_sampler () const
 
void save_timestep (const double time, const int t, const double t0, const double dt, const Eigen::MatrixXd &solution) const
 
bool save_timestep_to_vtm (const double time, const int t, const double dt, const Eigen::MatrixXd &solution, paraviewo::VTMWriter &vtm, const std::string &block_prefix, io::OutGeometryData::WriteJobs *writes=nullptr) 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
 
void init_child_varform (VarForm &child, const std::string &formulation, const Units &units, const json &args, const std::string &out_path) 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
 
void flush_output () const
 
- Static Protected Member Functions inherited from polyfem::varform::VarForm
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::NonlinearElasticVarForm
ipc::CollisionMesh collision_mesh_
 
ipc::CollisionMesh periodic_collision_mesh_
 
Eigen::VectorXi periodic_collision_mesh_to_basis_
 
std::shared_ptr< assembler::PressureAssembler > elasticity_pressure_assembler = nullptr
 
std::shared_ptr< assembler::ViscousDamping > damping_assembler_ = nullptr
 
std::shared_ptr< assembler::ViscousDampingPrev > damping_prev_assembler_ = nullptr
 
mesh::Obstacle obstacle
 
assembler::MacroStrainValue macro_strain_constraint_
 Prescribed macro displacement-gradient values and fixed components.
 
Eigen::MatrixXd displacement_gradient_
 For periodic structure, displacement u = periodic fluctuation Å© + macro strain GX.
 
solver::SolveData solve_data_
 
std::vector< std::shared_ptr< solver::Form > > forms
 
bool contact_dhat_was_explicit_ = false
 
- Protected Attributes inherited from polyfem::varform::ElasticVarForm
FESpace space_
 
VarFormBoundaryState boundary_
 
assembler::AssemblyValsCache ass_vals_cache_
 
assembler::AssemblyValsCache mass_ass_vals_cache_
 
assembler::AssemblyValsCache pure_mass_ass_vals_cache_
 
std::shared_ptr< assembler::RhsAssembler > rhs_assembler_
 
StiffnessMatrix mass_
 
StiffnessMatrix pure_mass_
 
double avg_mass_ = 0
 
Eigen::MatrixXd rhs_
 
std::shared_ptr< assembler::Assembler > primary_assembler_ = nullptr
 
std::shared_ptr< assembler::Mass > mass_assembler_ = nullptr
 
std::shared_ptr< assembler::HRZMass > pure_mass_assembler_ = nullptr
 
double t0 = 0
 
int time_steps = 0
 
double dt = 0
 
- Protected Attributes inherited from polyfem::varform::VarForm
std::shared_ptr< assembler::Problem > problem
 current problem, it contains rhs and bc
 
Units units
 
json args
 
io::OutStatsData stats
 
io::OutRuntimeData timings
 runtime statistics
 
std::string output_path
 
std::optional< std::reference_wrapper< const io::CheckpointReader > > checkpoint_reader_
 
std::unique_ptr< mesh::Mesh > mesh_
 
std::function< void(int, int, double, double)> time_callback
 
io::OutGeometryData output_geometry_
 
bool output_sampler_initialized_ = false
 
io::OutputWriter * output_writer_ = nullptr
 
bool prepared_ = false
 
int output_index_offset_ = 0
 
const io::ResourceIO & resources_
 

Detailed Description

Variational form for the (displacement, growth) problem built on the GrowthElasticity mixed assembler, structured like ThermoElasticVarForm without the transient machinery.

Two modes:

  • prescribed growth (boundary_conditions.growth_nodal_field, or the growth-space Dirichlet data): one static solve for the displacement with theta given; output "growth_reaction" is the growth-block energy gradient at the solution, i.e. the conjugate driving force;
  • solved growth (material "growth_law"): theta >= theta_n solved with the displacement over quasi-static pseudo-time increments (growth_law.n_steps, t_end), with a rate-independent threshold (dissipation form) and a primal-dual active set for irreversibility. theta has no PDE of its own: the growth block's stiffness is the K_gg quadrant of the coupling form plus the augmented-Lagrangian forms. The growth initial solution defaults to 1 (identity growth), because zero is singular for theta. No "time" block, no contact, no pressure loads. Exported stresses are those of the grown material.

Definition at line 46 of file GrowthElasticVarForm.hpp.

Member Function Documentation

◆ accumulate_dissipation()

void polyfem::varform::GrowthElasticVarForm::accumulate_dissipation ( int  step,
double  t,
const Eigen::VectorXd &  dtheta 
)
private

split of the increment's dissipation term (D, S), accumulated and logged

Definition at line 1483 of file GrowthElasticVarForm.cpp.

References polyfem::varform::FESpace::basis_list(), polyfem::assembler::AssemblyValsCache::compute(), dissipation_, element_mean_growth(), element_volume_, polyfem::varform::FESpace::geometry_basis_list(), growth_ass_vals_cache_, growth_space_, polyfem::logger(), polyfem::varform::VarForm::mesh_, normal_growth_per_element_, shear_supply_, shear_work_, polyfem::io::OutStatsData::solver_info, polyfem::varform::VarForm::stats, threshold_parallel_, threshold_per_element_, and vals.

Referenced by commit_increment().

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

◆ advance_increment()

int polyfem::varform::GrowthElasticVarForm::advance_increment ( int  step,
double  t_from,
double  t_to,
Eigen::MatrixXd &  solution,
int  depth 
)
private

one increment (t_from, t_to], split recursively on failure; returns passes

Definition at line 1752 of file GrowthElasticVarForm.cpp.

References advance_increment(), commit_increment(), growth_law_, growth_node_weights_, growth_pinned_mask_, polyfem::logger(), polyfem::varform::GrowthElasticVarForm::GrowthLawSettings::max_increment_splits, shear_supply_, solve_growth_increment(), polyfem::io::OutStatsData::solver_info, polyfem::varform::VarForm::stats, threshold_clamped_, threshold_parallel_, and threshold_per_element_.

Referenced by advance_increment(), and solve_growth_law().

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

◆ assemble_growth_node_weights()

void polyfem::varform::GrowthElasticVarForm::assemble_growth_node_weights ( )
private

w_a = sum_e vn_e phi_e int_e N_a dV from threshold_per_element_ (and the nodal volumes); called once (fixed threshold) or per update (from_state).

Definition at line 1287 of file GrowthElasticVarForm.cpp.

References polyfem::varform::FESpace::basis_list(), polyfem::assembler::AssemblyValsCache::compute(), da, polyfem::varform::GrowthElasticVarForm::GrowthLawSettings::from_state, polyfem::varform::FESpace::geometry_basis_list(), growth_ass_vals_cache_, growth_law_, growth_ndof(), growth_node_vn_volume_, growth_node_volume_, growth_node_weights_, growth_space_, polyfem::logger(), polyfem::varform::VarForm::mesh_, polyfem::varform::GrowthElasticVarForm::GrowthLawSettings::n_steps, normal_growth_per_element_, polyfem::varform::GrowthElasticVarForm::GrowthLawSettings::relag_max_updates, setup_logged_, source, polyfem::varform::GrowthElasticVarForm::GrowthLawSettings::t_end, polyfem::varform::GrowthElasticVarForm::GrowthLawSettings::theta_crit, threshold_per_element_, and vals.

Referenced by compute_growth_node_weights(), and set_threshold().

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

◆ assemble_mass_mat()

◆ assemble_rhs()

◆ build_basis()

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

Reimplemented from polyfem::varform::ElasticVarForm.

Definition at line 459 of file GrowthElasticVarForm.cpp.

References polyfem::varform::VarForm::args, polyfem::varform::ElasticVarForm::ass_vals_cache_, polyfem::varform::VarForm::assign_discr_orders(), polyfem::varform::FESpace::basis_list(), polyfem::varform::ElasticVarForm::boundary_, polyfem::varform::VarFormBoundaryState::boundary_nodes, polyfem::varform::NonlinearElasticVarForm::build_collision_mesh(), build_displacement_boundary(), polyfem::varform::VarForm::build_fe_space(), build_growth_basis(), build_growth_boundary(), polyfem::io::OutStatsData::compute_mesh_size(), polyfem::io::OutStatsData::count_flipped_elements(), polyfem::mesh::Mesh::dimension(), displacement_space_id_, polyfem::varform::GrowthElasticVarForm::GrowthLawSettings::enabled, polyfem::varform::FESpace::geometry_basis_list(), growth_ass_vals_cache_, growth_assembler_, growth_law_, growth_mass_ass_vals_cache_, growth_problem_, growth_space_, polyfem::assembler::AssemblyValsCache::init(), polyfem::assembler::AssemblyValsCache::init_empty(), polyfem::mesh::Mesh::is_volume(), polyfem::logger(), polyfem::varform::ElasticVarForm::mass_ass_vals_cache_, polyfem::io::OutStatsData::mesh_size, polyfem::varform::FESpace::n_bases, polyfem::io::OutStatsData::n_flipped, polyfem::mesh::Obstacle::n_vertices(), polyfem::varform::VarFormBoundaryState::normalize_boundary_nodes(), polyfem::varform::NonlinearElasticVarForm::obstacle, polyfem::refinement::APriori::p_refine(), polyfem::varform::NonlinearElasticVarForm::preprocess_contact_parameters(), polyfem::varform::ElasticVarForm::primary_assembler_, polyfem::varform::VarForm::problem, polyfem::varform::ElasticVarForm::pure_mass_ass_vals_cache_, polyfem::varform::ElasticVarForm::space_, polyfem::varform::FESpace::space_in_node_to_node, and polyfem::varform::VarForm::stats.

Here is the call graph for this function:

◆ build_displacement_boundary()

void polyfem::varform::GrowthElasticVarForm::build_displacement_boundary ( mesh::Mesh &  mesh)
private

◆ build_forms()

void polyfem::varform::GrowthElasticVarForm::build_forms ( Eigen::MatrixXd &  solution,
const double  t 
)
private

Definition at line 935 of file GrowthElasticVarForm.cpp.

References polyfem::solver::SolveData::al_form, polyfem::varform::VarForm::args, polyfem::varform::ElasticVarForm::ass_vals_cache_, polyfem::varform::FESpace::basis_list(), polyfem::varform::ElasticVarForm::boundary_, polyfem::varform::VarFormBoundaryState::boundary_nodes, polyfem::varform::FESpace::disc_orders, polyfem::varform::FESpace::disc_ordersq, displacement_ndof(), dissipation_form_, polyfem::varform::ElasticVarForm::elastic_boundary_samples(), polyfem::varform::GrowthElasticVarForm::GrowthLawSettings::enabled, polyfem::varform::NonlinearElasticVarForm::forms, polyfem::varform::FESpace::geometry_basis_list(), growth_ass_vals_cache_, growth_boundary_, growth_coupling_form_, growth_law_, growth_mass_, growth_ndof(), growth_node_weights_, growth_rhs_assembler_, growth_space_, growthelastic_assembler_, polyfem::varform::NonlinearElasticVarForm::init_forms(), polyfem::varform::VarFormBoundaryState::local_boundary, polyfem::varform::VarFormBoundaryState::local_neumann_boundary, polyfem::log_and_throw_error(), polyfem::logger(), polyfem::varform::ElasticVarForm::mass_, polyfem::varform::VarForm::mesh_, polyfem::varform::FESpace::n_bases, polyfem::varform::VarForm::n_boundary_samples(), polyfem::mesh::Obstacle::n_vertices(), polyfem::varform::NonlinearElasticVarForm::obstacle, polyfem::varform::VarForm::output_path, pinned_growth_nodes_, prescribed_growth_field(), polyfem::varform::ElasticVarForm::rhs_assembler_, polyfem::varform::NonlinearElasticVarForm::solve_data_, polyfem::varform::ElasticVarForm::space_, split_solution(), stacked_form_, polyfem::varform::GrowthElasticVarForm::GrowthLawSettings::theta_floor_fraction, theta_n_, polyfem::solver::SolveData::time_integrator, and total_ndof().

Referenced by solve_problem(), and solve_with_current_pins().

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

◆ build_growth_basis()

void polyfem::varform::GrowthElasticVarForm::build_growth_basis ( mesh::Mesh &  mesh,
const bool  iso_parametric,
const json &  args 
)
private

◆ build_growth_boundary()

◆ build_rhs_assembler()

void polyfem::varform::GrowthElasticVarForm::build_rhs_assembler ( )
overrideprivatevirtual

Reimplemented from polyfem::varform::ElasticVarForm.

Definition at line 725 of file GrowthElasticVarForm.cpp.

References polyfem::varform::VarForm::args, polyfem::varform::FESpace::basis_list(), polyfem::varform::ElasticVarForm::boundary_, polyfem::varform::VarFormBoundaryState::dirichlet_nodes, polyfem::varform::VarFormBoundaryState::dirichlet_nodes_position, displacement_space_id_, polyfem::varform::FESpace::geometry_basis_list(), growth_assembler_, growth_boundary_, growth_mass_ass_vals_cache_, growth_problem_, growth_rhs_assembler_, growth_space_, growth_space_id_, polyfem::varform::ElasticVarForm::mass_ass_vals_cache_, polyfem::varform::VarForm::mesh_, polyfem::varform::FESpace::mesh_nodes, polyfem::varform::FESpace::n_bases, polyfem::varform::VarFormBoundaryState::neumann_nodes, polyfem::varform::VarFormBoundaryState::neumann_nodes_position, polyfem::varform::NonlinearElasticVarForm::obstacle, polyfem::varform::ElasticVarForm::primary_assembler_, polyfem::varform::VarForm::problem, polyfem::varform::VarForm::resources_, polyfem::solver::SolveData::rhs_assembler, polyfem::varform::ElasticVarForm::rhs_assembler_, polyfem::varform::NonlinearElasticVarForm::solve_data_, and polyfem::varform::ElasticVarForm::space_.

Referenced by assemble_rhs().

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

◆ commit_increment()

void polyfem::varform::GrowthElasticVarForm::commit_increment ( int  step,
double  t,
Eigen::MatrixXd &  solution 
)
private

D/S accumulation, theta_n update and activation marking after a converged (sub)increment.

Definition at line 1789 of file GrowthElasticVarForm.cpp.

References accumulate_dissipation(), displacement_ndof(), growth_activation_step_, growth_ndof(), growth_pinned_mask_, and theta_n_.

Referenced by advance_increment().

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

◆ compute_errors()

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

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

Returns
Error statistics

Reimplemented from polyfem::varform::ElasticVarForm.

Definition at line 1857 of file GrowthElasticVarForm.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, polyfem::varform::ElasticVarForm::space_, split_solution(), and polyfem::varform::VarForm::stats.

Here is the call graph for this function:

◆ compute_growth_node_weights()

void polyfem::varform::GrowthElasticVarForm::compute_growth_node_weights ( )
private

Definition at line 1230 of file GrowthElasticVarForm.cpp.

References polyfem::varform::VarForm::args, assemble_growth_node_weights(), polyfem::varform::GrowthElasticVarForm::GrowthLawSettings::from_state, growth_law_, polyfem::log_and_throw_error(), polyfem::varform::VarForm::mesh_, normal_growth_per_element_, polyfem::assembler::read_growth_cell_array(), polyfem::varform::VarForm::resources_, shear_supply_, threshold_clamped_, threshold_parallel_, and threshold_per_element_.

Referenced by solve_growth_law().

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

◆ deserialize_checkpoint()

void polyfem::varform::GrowthElasticVarForm::deserialize_checkpoint ( const io::CheckpointReader &  reader,
Eigen::MatrixXd &  solution 
)
overridevirtual

Reimplemented from polyfem::varform::ElasticVarForm.

Definition at line 296 of file GrowthElasticVarForm.cpp.

References polyfem::varform::VarForm::deserialize_checkpoint(), displacement_ndof(), growth_space_, polyfem::varform::VarForm::mesh_, polyfem::varform::VarForm::reorder_checkpoint_block(), polyfem::varform::ElasticVarForm::space_, total_ndof(), and polyfem::varform::VarForm::validate_checkpoint_solution().

Here is the call graph for this function:

◆ displacement_ndof()

int polyfem::varform::GrowthElasticVarForm::displacement_ndof ( ) const
inlineprivate

Definition at line 188 of file GrowthElasticVarForm.hpp.

References polyfem::varform::FESpace::ndof(), and polyfem::varform::ElasticVarForm::space_.

Referenced by assemble_mass_mat(), build_forms(), commit_increment(), deserialize_checkpoint(), report_lag_residual(), solve_growth_increment(), solve_nonlinear_step(), split_solution(), stacked_solution(), threshold_target(), and total_ndof().

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

◆ elastic_material_args()

json polyfem::varform::GrowthElasticVarForm::elastic_material_args ( ) const
private

Definition at line 419 of file GrowthElasticVarForm.cpp.

References polyfem::varform::VarForm::args.

Referenced by load_mesh().

Here is the caller graph for this function:

◆ element_mean_growth()

Eigen::VectorXd polyfem::varform::GrowthElasticVarForm::element_mean_growth ( const Eigen::VectorXd &  theta)
private

element mean of a nodal growth field (growth quadrature)

Definition at line 1430 of file GrowthElasticVarForm.cpp.

References polyfem::varform::FESpace::basis_list(), polyfem::assembler::AssemblyValsCache::compute(), da, polyfem::varform::FESpace::geometry_basis_list(), growth_ass_vals_cache_, growth_space_, polyfem::varform::VarForm::mesh_, and vals.

Referenced by accumulate_dissipation(), and report_lag_residual().

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

◆ evaluate_threshold_state()

void polyfem::varform::GrowthElasticVarForm::evaluate_threshold_state ( const Eigen::VectorXd &  u,
double  t,
Eigen::VectorXd &  phi_full,
Eigen::VectorXd &  phi_no_shear,
Eigen::VectorXd &  theta_tot 
)
private

The state-built threshold at C_check of displacement u, per element: f_I(Ce) (phi_full), f_I(Ce shear-free, layer thickness) (phi_no_shear), and the total in-plane area stretch theta_tot.

f_par = phi_no_shear, f_gamma = phi_full - phi_no_shear.

Definition at line 1329 of file GrowthElasticVarForm.cpp.

References polyfem::varform::ElasticVarForm::ass_vals_cache_, polyfem::varform::FESpace::basis_list(), polyfem::assembler::AssemblyValsCache::compute(), da, polyfem::F, polyfem::varform::FESpace::geometry_basis_list(), growth_law_, growthelastic_assembler_, polyfem::log_and_throw_error(), polyfem::varform::VarForm::mesh_, normal_growth_per_element_, polyfem::varform::ElasticVarForm::space_, polyfem::varform::GrowthElasticVarForm::GrowthLawSettings::theta_crit, and vals.

Referenced by report_lag_residual(), and threshold_target().

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

◆ export_data()

void polyfem::varform::GrowthElasticVarForm::export_data ( const Eigen::MatrixXd &  solution) const
overridevirtual

Reimplemented from polyfem::varform::ElasticVarForm.

Definition at line 1841 of file GrowthElasticVarForm.cpp.

References polyfem::varform::VarForm::args, polyfem::varform::ElasticVarForm::export_data(), polyfem::logger(), and split_solution().

Here is the call graph for this function:

◆ grown_stress_at()

void polyfem::varform::GrowthElasticVarForm::grown_stress_at ( const int  e,
const Eigen::MatrixXd &  local_pts,
const double  t,
const Eigen::MatrixXd &  displacement,
const Eigen::MatrixXd &  growth,
Eigen::MatrixXd &  cauchy,
Eigen::MatrixXd &  pk1,
Eigen::MatrixXd &  pk2,
Eigen::MatrixXd &  von_mises,
Eigen::MatrixXd &  energy 
) const
private

Grown-material stresses and energy density (GrowthElasticity::grown_stresses) at local points of element e, flattened column-major like the elastic tensor output: cauchy, pk1, pk2 (n x 9), von Mises of the Cauchy stress and the energy density (n x 1).

Definition at line 1869 of file GrowthElasticVarForm.cpp.

References polyfem::varform::FESpace::basis_list(), polyfem::assembler::ElementAssemblyValues::compute(), polyfem::compute_diplacement_grad(), polyfem::F, polyfem::varform::FESpace::geometry_basis_list(), growth_space_, growthelastic_assembler_, polyfem::io::Evaluator::interpolate_at_local_vals(), polyfem::log_and_throw_error(), polyfem::varform::VarForm::mesh_, polyfem::varform::ElasticVarForm::space_, vals, and polyfem::von_mises_stress_for_stress_tensor().

Referenced by replace_stress_fields().

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

◆ growth_activation_step()

const Eigen::VectorXi & polyfem::varform::GrowthElasticVarForm::growth_activation_step ( ) const
inline

growth_law: first increment in which each growth DOF grew (0 = never); empty before a solved run.

Also exported as growth_activation_step.

Definition at line 68 of file GrowthElasticVarForm.hpp.

References growth_activation_step_.

◆ growth_attainment()

const Eigen::VectorXd & polyfem::varform::GrowthElasticVarForm::growth_attainment ( ) const
inline

Definition at line 74 of file GrowthElasticVarForm.hpp.

References attainment_.

◆ growth_dissipation()

const Eigen::VectorXd & polyfem::varform::GrowthElasticVarForm::growth_dissipation ( ) const
inline

Definition at line 76 of file GrowthElasticVarForm.hpp.

References dissipation_.

◆ growth_lag_residual()

const Eigen::VectorXd & polyfem::varform::GrowthElasticVarForm::growth_lag_residual ( ) const
inline

Definition at line 75 of file GrowthElasticVarForm.hpp.

References lag_residual_.

◆ growth_multiplier()

Eigen::VectorXd polyfem::varform::GrowthElasticVarForm::growth_multiplier ( const Eigen::MatrixXd &  solution) const
private

d Pi_inc / d theta at the solution: stacked energy gradient plus the dissipation weights (the KKT residual; >= 0 where pinned, ~0 where free).

Definition at line 1563 of file GrowthElasticVarForm.cpp.

References growth_ndof(), and stacked_form_.

Referenced by solve_growth_increment().

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

◆ growth_ndof()

int polyfem::varform::GrowthElasticVarForm::growth_ndof ( ) const
inlineprivate

Definition at line 189 of file GrowthElasticVarForm.hpp.

References growth_space_, and polyfem::varform::FESpace::ndof().

Referenced by assemble_growth_node_weights(), assemble_mass_mat(), build_forms(), commit_increment(), growth_multiplier(), prescribed_growth_field(), report_lag_residual(), solve_growth_increment(), solve_growth_law(), split_solution(), stacked_solution(), and total_ndof().

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

◆ growth_shear_supply()

const Eigen::VectorXd & polyfem::varform::GrowthElasticVarForm::growth_shear_supply ( ) const
inline

growth_law threshold from_state: f_gamma per element used by the last increment, and the threshold phi_e in use (empty / the given values otherwise).

Definition at line 71 of file GrowthElasticVarForm.hpp.

References shear_supply_.

◆ growth_shear_supply_work()

const Eigen::VectorXd & polyfem::varform::GrowthElasticVarForm::growth_shear_supply_work ( ) const
inline

Definition at line 77 of file GrowthElasticVarForm.hpp.

References shear_work_.

◆ growth_threshold()

const Eigen::VectorXd & polyfem::varform::GrowthElasticVarForm::growth_threshold ( ) const
inline

Definition at line 72 of file GrowthElasticVarForm.hpp.

References threshold_per_element_.

◆ growth_threshold_parallel()

const Eigen::VectorXd & polyfem::varform::GrowthElasticVarForm::growth_threshold_parallel ( ) const
inline

Definition at line 73 of file GrowthElasticVarForm.hpp.

References threshold_parallel_.

◆ init()

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

◆ initial_growth_solution()

void polyfem::varform::GrowthElasticVarForm::initial_growth_solution ( Eigen::MatrixXd &  solution) const
private

Definition at line 885 of file GrowthElasticVarForm.cpp.

References growth_rhs_assembler_, polyfem::logger(), and prescribed_growth_field().

Referenced by solve_problem().

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

◆ load_mesh()

◆ log_kkt_residual()

void polyfem::varform::GrowthElasticVarForm::log_kkt_residual ( int  step,
double  t,
const Eigen::MatrixXd &  solution,
const Eigen::VectorXd &  mult,
const std::vector< char > &  pinned 
)
private

phi - f_I per v_n-weighted nodal volume on the settled set: free and pinned

Definition at line 1449 of file GrowthElasticVarForm.cpp.

References growth_node_vn_volume_, polyfem::logger(), polyfem::io::OutStatsData::solver_info, and polyfem::varform::VarForm::stats.

Referenced by solve_growth_increment().

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

◆ make_nl_problem()

void polyfem::varform::GrowthElasticVarForm::make_nl_problem ( const Eigen::MatrixXd &  sol,
const double  t 
)
private

NLProblem over the current forms and AL forms, initialized at sol, t.

Definition at line 1193 of file GrowthElasticVarForm.cpp.

References polyfem::solver::SolveData::al_form, polyfem::varform::VarForm::args, polyfem::varform::NonlinearElasticVarForm::forms, polyfem::logger(), polyfem::varform::VarForm::mesh_, polyfem::solver::SolveData::nl_problem, polyfem::varform::NonlinearElasticVarForm::solve_data_, stacked_lumped_mass_, and total_ndof().

Referenced by solve_problem(), and solve_with_current_pins().

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

◆ median_of()

double polyfem::varform::GrowthElasticVarForm::median_of ( const Eigen::VectorXd &  v)
staticprivate

Definition at line 1278 of file GrowthElasticVarForm.cpp.

Referenced by set_threshold().

Here is the caller graph for this function:

◆ name()

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

Get the name of the variational formulation.

Returns
Name of the variational formulation

Implements polyfem::varform::VarForm.

Definition at line 50 of file GrowthElasticVarForm.hpp.

Referenced by output_fields(), and save_growth_increment().

Here is the caller graph for this function:

◆ output_fields()

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

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

Parameters
sampleOutput sample
solutionSolution matrix
optionsOutput field options
Returns
Output fields

Implements polyfem::varform::VarForm.

Definition at line 2119 of file GrowthElasticVarForm.cpp.

References polyfem::varform::VarForm::args, polyfem::io::OutputSample::Contact, converged_solution_, polyfem::io::OutputSample::domain, polyfem::io::OutputSample::element_ids, polyfem::io::OutputFieldOptions::export_field(), polyfem::io::OutputSample::local_points, polyfem::varform::VarForm::mesh_, name(), polyfem::io::OutputSample::node_ids, polyfem::varform::NonlinearElasticVarForm::output_fields(), polyfem::io::OutputField::Point, polyfem::io::OutputSample::points, replace_stress_fields(), split_solution(), polyfem::io::OutputSample::time, and total_ndof().

Here is the call graph for this function:

◆ prescribed_growth_field()

const Eigen::MatrixXd & polyfem::varform::GrowthElasticVarForm::prescribed_growth_field ( ) const
private

Definition at line 835 of file GrowthElasticVarForm.cpp.

References polyfem::varform::VarForm::args, polyfem::io::ResourceIO::describe(), growth_ndof(), growth_space_, polyfem::log_and_throw_error(), polyfem::io::ResourceIO::open(), prescribed_growth_, polyfem::varform::VarForm::resources_, and polyfem::varform::FESpace::space_in_node_to_node.

Referenced by build_forms(), and initial_growth_solution().

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

◆ read_growth_law()

void polyfem::varform::GrowthElasticVarForm::read_growth_law ( const json &  args)
private

Definition at line 206 of file GrowthElasticVarForm.cpp.

References polyfem::varform::GrowthElasticVarForm::GrowthLawSettings::active_set_tol, polyfem::varform::VarForm::args, polyfem::varform::GrowthElasticVarForm::GrowthLawSettings::enabled, polyfem::varform::GrowthElasticVarForm::GrowthLawSettings::feasibility_tol, polyfem::varform::GrowthElasticVarForm::GrowthLawSettings::final_tol_factor, polyfem::varform::GrowthElasticVarForm::GrowthLawSettings::from_state, growth_law_, polyfem::utils::json_as_array(), polyfem::log_and_throw_error(), polyfem::varform::GrowthElasticVarForm::GrowthLawSettings::max_active_set_iterations, polyfem::varform::GrowthElasticVarForm::GrowthLawSettings::max_increment_splits, polyfem::varform::GrowthElasticVarForm::GrowthLawSettings::n_steps, polyfem::varform::GrowthElasticVarForm::GrowthLawSettings::relag_max_updates, polyfem::varform::GrowthElasticVarForm::GrowthLawSettings::relag_tol, polyfem::varform::GrowthElasticVarForm::GrowthLawSettings::save_increments, polyfem::varform::GrowthElasticVarForm::GrowthLawSettings::t_end, polyfem::varform::GrowthElasticVarForm::GrowthLawSettings::theta_crit, and polyfem::varform::GrowthElasticVarForm::GrowthLawSettings::theta_floor_fraction.

Referenced by init().

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

◆ read_material_space_ids()

void polyfem::varform::GrowthElasticVarForm::read_material_space_ids ( const json &  args)
private

Definition at line 407 of file GrowthElasticVarForm.cpp.

References polyfem::varform::VarForm::args, displacement_space_id_, elastic_formulation_, growth_space_id_, and polyfem::log_and_throw_error().

Referenced by init().

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

◆ replace_stress_fields()

void polyfem::varform::GrowthElasticVarForm::replace_stress_fields ( const io::OutputSample &  sample,
const Eigen::MatrixXd &  displacement,
const Eigen::MatrixXd &  growth,
std::vector< io::OutputField > &  fields 
) const
private

The elastic base evaluates von_mises, cauchy_stess_*, pk1_stess_*, pk2_stess_* (and the *_avg variants), energy and energy_avg with the ungrown material at the total F; overwrite the ones it emitted with the grown-material values.

Definition at line 1915 of file GrowthElasticVarForm.cpp.

References polyfem::basis::ElementBases::bases, polyfem::varform::FESpace::basis_list(), polyfem::assembler::ElementAssemblyValues::compute(), polyfem::varform::FESpace::disc_orders, polyfem::varform::FESpace::disc_ordersq, polyfem::io::OutputSample::element_ids, polyfem::utils::flatten(), polyfem::varform::FESpace::geometry_basis_list(), grown_stress_at(), growthelastic_assembler_, polyfem::io::Evaluator::interpolate_at_local_vals(), polyfem::io::OutputSample::local_points, polyfem::varform::VarForm::mesh_, polyfem::varform::FESpace::n_bases, polyfem::io::OutputSample::node_ids, polyfem::autogen::p_nodes_3d(), point, polyfem::autogen::prism_nodes_3d(), polyfem::autogen::q_nodes_3d(), polyfem::varform::ElasticVarForm::space_, polyfem::io::OutputSample::time, and vals.

Referenced by output_fields().

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

◆ report_lag_residual()

void polyfem::varform::GrowthElasticVarForm::report_lag_residual ( int  step,
double  t,
const Eigen::MatrixXd &  solution 
)
private

lag residual phi(converged state) - phi used, and attainment, logged per increment

Definition at line 1527 of file GrowthElasticVarForm.cpp.

References attainment_, displacement_ndof(), element_mean_growth(), evaluate_threshold_state(), growth_law_, growth_ndof(), lag_residual_, polyfem::logger(), polyfem::io::OutStatsData::solver_info, polyfem::varform::VarForm::stats, polyfem::varform::GrowthElasticVarForm::GrowthLawSettings::theta_crit, and threshold_per_element_.

Referenced by solve_growth_law().

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

◆ reset()

◆ save_growth_increment()

void polyfem::varform::GrowthElasticVarForm::save_growth_increment ( int  step,
double  t,
const Eigen::MatrixXd &  solution 
)
private

growth_law.save_increments: the converged stacked state of increment step (pseudo-time t) as growth_step_<step>.vtu, and growth_steps.pvd rewritten to list steps 1..step.

Definition at line 1811 of file GrowthElasticVarForm.cpp.

References converged_solution_, polyfem::varform::ElasticVarForm::dt, polyfem::varform::VarForm::ensure_output_sampler(), polyfem::varform::VarForm::export_options(), growth_law_, polyfem::logger(), polyfem::io::OutputSpace::mesh, polyfem::varform::GrowthElasticVarForm::GrowthLawSettings::n_steps, name(), polyfem::varform::VarForm::output_field_function(), polyfem::varform::VarForm::output_geometry_, polyfem::varform::NonlinearElasticVarForm::output_space(), polyfem::varform::VarForm::resolve_output_path(), polyfem::io::OutGeometryData::save_vtu(), and polyfem::varform::GrowthElasticVarForm::GrowthLawSettings::t_end.

Referenced by solve_growth_law().

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

◆ serialize_checkpoint()

void polyfem::varform::GrowthElasticVarForm::serialize_checkpoint ( io::CheckpointWriter &  writer,
const Eigen::MatrixXd &  solution,
const io::CheckpointMetadata &  metadata 
) const
overridevirtual

both blocks of the stacked (displacement, growth) solution, each with its node ordering, as for the other mixed formulations

Reimplemented from polyfem::varform::ElasticVarForm.

Definition at line 286 of file GrowthElasticVarForm.cpp.

References growth_space_, polyfem::varform::VarForm::serialize_checkpoint(), polyfem::varform::ElasticVarForm::space_, and polyfem::varform::VarForm::write_checkpoint_ordering().

Here is the call graph for this function:

◆ set_threshold()

void polyfem::varform::GrowthElasticVarForm::set_threshold ( const Eigen::VectorXd &  par,
const Eigen::VectorXd &  gam,
const Eigen::VectorXd &  clamped,
double  t,
double  omega 
)
private

install a threshold (parts), rebuild the node weights, log

Definition at line 1408 of file GrowthElasticVarForm.cpp.

References assemble_growth_node_weights(), polyfem::logger(), median_of(), polyfem::varform::VarForm::mesh_, shear_supply_, threshold_clamped_, threshold_parallel_, and threshold_per_element_.

Referenced by solve_growth_increment().

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

◆ snapshot_output_fields()

io::OutputFieldFunction polyfem::varform::GrowthElasticVarForm::snapshot_output_fields ( const Eigen::MatrixXd &  solution,
const io::OutGeometryData::ExportOptions &  opts,
const io::OutputSpace &  space,
double  time,
double  dt 
) const
inlineoverrideprivatevirtual

Capture mutable timestep data for deferred field evaluation.

An empty callback requests immediate field preparation.

Reimplemented from polyfem::varform::VarForm.

Definition at line 87 of file GrowthElasticVarForm.hpp.

◆ solve_growth_increment()

int polyfem::varform::GrowthElasticVarForm::solve_growth_increment ( const int  step,
const double  t,
Eigen::MatrixXd &  solution 
)
private

◆ solve_growth_law()

void polyfem::varform::GrowthElasticVarForm::solve_growth_law ( Eigen::MatrixXd &  solution)
private

◆ solve_nonlinear_step()

◆ solve_problem()

void polyfem::varform::GrowthElasticVarForm::solve_problem ( Eigen::MatrixXd &  sol,
const InitialConditionOverride *  initial_condition_override,
const ForwardStepCallback &  post_step 
)
overrideprivatevirtual

◆ solve_with_current_pins()

void polyfem::varform::GrowthElasticVarForm::solve_with_current_pins ( const int  step,
const double  t,
Eigen::MatrixXd &  solution,
double  grad_tol_factor = 1.0 
)
private

Definition at line 1571 of file GrowthElasticVarForm.cpp.

References build_forms(), make_nl_problem(), and solve_nonlinear_step().

Referenced by solve_growth_increment().

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

◆ split_solution()

void polyfem::varform::GrowthElasticVarForm::split_solution ( const Eigen::MatrixXd &  solution,
Eigen::MatrixXd &  displacement,
Eigen::MatrixXd &  growth 
) const
private

Definition at line 925 of file GrowthElasticVarForm.cpp.

References displacement_ndof(), growth_ndof(), and total_ndof().

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

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

◆ stacked_solution()

Eigen::MatrixXd polyfem::varform::GrowthElasticVarForm::stacked_solution ( const Eigen::MatrixXd &  displacement,
const Eigen::MatrixXd &  growth 
) const
private

Definition at line 912 of file GrowthElasticVarForm.cpp.

References displacement_ndof(), and growth_ndof().

Referenced by solve_problem().

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

◆ threshold_target()

void polyfem::varform::GrowthElasticVarForm::threshold_target ( const Eigen::MatrixXd &  solution,
double  t,
Eigen::VectorXd &  par,
Eigen::VectorXd &  gam,
Eigen::VectorXd &  clamped 
)
private

the threshold the state implies (from_state): G(x) = (PHI_PAR, f_gamma) at C_check of the state; f_gamma = f_I(Ce) - f_I(Ce with the transverse shears removed and Ce_nn at the layer value), PHI_PAR = max(f_par, 0)

Definition at line 1398 of file GrowthElasticVarForm.cpp.

References displacement_ndof(), and evaluate_threshold_state().

Referenced by solve_growth_increment().

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

◆ total_ndof()

int polyfem::varform::GrowthElasticVarForm::total_ndof ( ) const
inlineprivate

Definition at line 190 of file GrowthElasticVarForm.hpp.

References displacement_ndof(), and growth_ndof().

Referenced by build_forms(), deserialize_checkpoint(), make_nl_problem(), output_fields(), and split_solution().

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

◆ validate_time_dependence()

void polyfem::varform::GrowthElasticVarForm::validate_time_dependence ( ) const
overridevirtual

Solved growth steps its own pseudo-time (growth_law.n_steps, t_end), so its displacement problem is time dependent (the Dirichlet data follow t) without a "time" block, which init refuses.

Reimplemented from polyfem::varform::VarForm.

Definition at line 310 of file GrowthElasticVarForm.cpp.

References polyfem::varform::GrowthElasticVarForm::GrowthLawSettings::enabled, growth_law_, and polyfem::varform::VarForm::validate_time_dependence().

Here is the call graph for this function:

Member Data Documentation

◆ attainment_

Eigen::VectorXd polyfem::varform::GrowthElasticVarForm::attainment_
private

vartheta^e / theta_crit at the last converged increment

Definition at line 268 of file GrowthElasticVarForm.hpp.

Referenced by growth_attainment(), report_lag_residual(), and reset().

◆ converged_solution_

Eigen::MatrixXd polyfem::varform::GrowthElasticVarForm::converged_solution_
private

Converged stacked (u, growth) solution cached at the end of solve_problem.

The output pipeline does not reliably hand output_fields the stacked vector (sizes/ordering differ per export path), so growth sampling and the reaction evaluation use this authoritative copy whenever the passed solution is not total_ndof-sized.

Definition at line 218 of file GrowthElasticVarForm.hpp.

Referenced by output_fields(), reset(), save_growth_increment(), and solve_problem().

◆ displacement_space_id_

int polyfem::varform::GrowthElasticVarForm::displacement_space_id_ = -1
private

◆ dissipation_

Eigen::VectorXd polyfem::varform::GrowthElasticVarForm::dissipation_
private

cumulative D = sum v_n max(f_par,0) dtheta per element [Pa]

Definition at line 269 of file GrowthElasticVarForm.hpp.

Referenced by accumulate_dissipation(), growth_dissipation(), and reset().

◆ dissipation_form_

std::shared_ptr<solver::GrowthDissipationForm> polyfem::varform::GrowthElasticVarForm::dissipation_form_
private

Definition at line 280 of file GrowthElasticVarForm.hpp.

Referenced by build_forms(), and reset().

◆ elastic_formulation_

std::string polyfem::varform::GrowthElasticVarForm::elastic_formulation_ = "MaterialSum"
private

Definition at line 228 of file GrowthElasticVarForm.hpp.

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

◆ element_volume_

Eigen::VectorXd polyfem::varform::GrowthElasticVarForm::element_volume_
private

reference element volumes (growth quadrature)

Definition at line 271 of file GrowthElasticVarForm.hpp.

Referenced by accumulate_dissipation(), and reset().

◆ growth_activation_step_

Eigen::VectorXi polyfem::varform::GrowthElasticVarForm::growth_activation_step_
private

first increment in which a growth DOF grew (0 = never)

Definition at line 279 of file GrowthElasticVarForm.hpp.

Referenced by commit_increment(), growth_activation_step(), reset(), and solve_growth_law().

◆ growth_ass_vals_cache_

assembler::AssemblyValsCache polyfem::varform::GrowthElasticVarForm::growth_ass_vals_cache_
private

◆ growth_assembler_

std::shared_ptr<assembler::Assembler> polyfem::varform::GrowthElasticVarForm::growth_assembler_
private

◆ growth_boundary_

VarFormBoundaryState polyfem::varform::GrowthElasticVarForm::growth_boundary_
private

◆ growth_coupling_form_

std::shared_ptr<solver::MixedAssemblerForm> polyfem::varform::GrowthElasticVarForm::growth_coupling_form_
private

Definition at line 209 of file GrowthElasticVarForm.hpp.

Referenced by build_forms(), and reset().

◆ growth_law_

◆ growth_mass_

StiffnessMatrix polyfem::varform::GrowthElasticVarForm::growth_mass_
private

Definition at line 205 of file GrowthElasticVarForm.hpp.

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

◆ growth_mass_ass_vals_cache_

assembler::AssemblyValsCache polyfem::varform::GrowthElasticVarForm::growth_mass_ass_vals_cache_
private

◆ growth_mass_assembler_

std::shared_ptr<assembler::Mass> polyfem::varform::GrowthElasticVarForm::growth_mass_assembler_
private

Definition at line 201 of file GrowthElasticVarForm.hpp.

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

◆ growth_node_vn_volume_

Eigen::VectorXd polyfem::varform::GrowthElasticVarForm::growth_node_vn_volume_
private

int vn N_a dV (KKT residual in Pa)

Definition at line 274 of file GrowthElasticVarForm.hpp.

Referenced by assemble_growth_node_weights(), and log_kkt_residual().

◆ growth_node_volume_

Eigen::VectorXd polyfem::varform::GrowthElasticVarForm::growth_node_volume_
private

int N_a dV

Definition at line 273 of file GrowthElasticVarForm.hpp.

Referenced by assemble_growth_node_weights(), reset(), and solve_growth_increment().

◆ growth_node_weights_

Eigen::VectorXd polyfem::varform::GrowthElasticVarForm::growth_node_weights_
private

◆ growth_pinned_mask_

std::vector<char> polyfem::varform::GrowthElasticVarForm::growth_pinned_mask_
private

last solved pass: 1 = pinned at theta_n

Definition at line 278 of file GrowthElasticVarForm.hpp.

Referenced by advance_increment(), commit_increment(), reset(), solve_growth_increment(), and solve_growth_law().

◆ growth_problem_

std::shared_ptr<assembler::Problem> polyfem::varform::GrowthElasticVarForm::growth_problem_
private

◆ growth_rhs_

Eigen::MatrixXd polyfem::varform::GrowthElasticVarForm::growth_rhs_
private

Definition at line 207 of file GrowthElasticVarForm.hpp.

Referenced by assemble_rhs(), and reset().

◆ growth_rhs_assembler_

std::shared_ptr<assembler::RhsAssembler> polyfem::varform::GrowthElasticVarForm::growth_rhs_assembler_
private

◆ growth_rhs_density_

std::shared_ptr<assembler::Density> polyfem::varform::GrowthElasticVarForm::growth_rhs_density_
private

Definition at line 203 of file GrowthElasticVarForm.hpp.

Referenced by assemble_rhs(), and reset().

◆ growth_space_

◆ growth_space_id_

int polyfem::varform::GrowthElasticVarForm::growth_space_id_ = -1
private

◆ growthelastic_assembler_

std::shared_ptr<assembler::MixedNLAssembler> polyfem::varform::GrowthElasticVarForm::growthelastic_assembler_
private

◆ lag_residual_

Eigen::VectorXd polyfem::varform::GrowthElasticVarForm::lag_residual_
private

phi(converged state) - phi used, last increment [Pa]

Definition at line 267 of file GrowthElasticVarForm.hpp.

Referenced by growth_lag_residual(), report_lag_residual(), and reset().

◆ normal_growth_per_element_

Eigen::VectorXd polyfem::varform::GrowthElasticVarForm::normal_growth_per_element_
private

◆ pinned_growth_nodes_

std::vector<int> polyfem::varform::GrowthElasticVarForm::pinned_growth_nodes_
private

member: BCLagrangianForm keeps a reference

Definition at line 277 of file GrowthElasticVarForm.hpp.

Referenced by build_forms(), reset(), and solve_growth_increment().

◆ prescribed_growth_

Eigen::MatrixXd polyfem::varform::GrowthElasticVarForm::prescribed_growth_
mutableprivate

Whole-field growth prescription (boundary_conditions.growth_nodal_field): nodal theta values loaded lazily from file; when set, EVERY growth DOF is Dirichlet with these targets (via BCLagrangianForm's tabulated-target constructor) and the same field is the growth initial solution.

Definition at line 224 of file GrowthElasticVarForm.hpp.

Referenced by prescribed_growth_field(), and reset().

◆ setup_logged_

bool polyfem::varform::GrowthElasticVarForm::setup_logged_ = false
private

the setup line is logged once, not per update

Definition at line 265 of file GrowthElasticVarForm.hpp.

Referenced by assemble_growth_node_weights(), and reset().

◆ shear_supply_

Eigen::VectorXd polyfem::varform::GrowthElasticVarForm::shear_supply_
private

◆ shear_work_

Eigen::VectorXd polyfem::varform::GrowthElasticVarForm::shear_work_
private

cumulative S = sum v_n f_gamma dtheta per element [Pa]

Definition at line 270 of file GrowthElasticVarForm.hpp.

Referenced by accumulate_dissipation(), growth_shear_supply_work(), and reset().

◆ stacked_form_

std::shared_ptr<solver::StackedForm> polyfem::varform::GrowthElasticVarForm::stacked_form_
private

Definition at line 210 of file GrowthElasticVarForm.hpp.

Referenced by build_forms(), growth_multiplier(), and reset().

◆ stacked_lumped_mass_

StiffnessMatrix polyfem::varform::GrowthElasticVarForm::stacked_lumped_mass_
private

Definition at line 206 of file GrowthElasticVarForm.hpp.

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

◆ theta_n_

Eigen::VectorXd polyfem::varform::GrowthElasticVarForm::theta_n_
private

converged growth of the previous increment

Definition at line 276 of file GrowthElasticVarForm.hpp.

Referenced by build_forms(), commit_increment(), reset(), solve_growth_increment(), and solve_growth_law().

◆ threshold_clamped_

Eigen::VectorXd polyfem::varform::GrowthElasticVarForm::threshold_clamped_
private

1 where f_par(C_check) < 0 (zero floor), when computed here

Definition at line 266 of file GrowthElasticVarForm.hpp.

Referenced by advance_increment(), compute_growth_node_weights(), reset(), and set_threshold().

◆ threshold_parallel_

Eigen::VectorXd polyfem::varform::GrowthElasticVarForm::threshold_parallel_
private

◆ threshold_per_element_

Eigen::VectorXd polyfem::varform::GrowthElasticVarForm::threshold_per_element_
private

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