Serac  0.1
Serac is an implicit thermal strucural mechanics simulation code.
Public Types | Public Member Functions | Static Public Attributes | Protected Types | Protected Member Functions | Protected Attributes | List of all members
serac::SolidMechanics< order, dim, Parameters< parameter_space... >, std::integer_sequence< int, parameter_indices... > > Class Template Reference

The nonlinear solid solver class. More...

#include <solid_mechanics.hpp>

Collaboration diagram for serac::SolidMechanics< order, dim, Parameters< parameter_space... >, std::integer_sequence< int, parameter_indices... > >:
Collaboration graph
[legend]

Public Types

template<typename T >
using qdata_type = std::shared_ptr< QuadratureData< T > >
 a container holding quadrature point data of the specified type More...
 

Public Member Functions

 SolidMechanics (const NonlinearSolverOptions nonlinear_opts, const LinearSolverOptions lin_opts, const serac::TimesteppingOptions timestepping_opts, const GeometricNonlinearities geom_nonlin, const std::string &physics_name, std::string mesh_tag, std::vector< std::string > parameter_names={}, int cycle=0, double time=0.0, bool checkpoint_to_disk=false)
 Construct a new SolidMechanics object. More...
 
 SolidMechanics (std::unique_ptr< serac::EquationSolver > solver, const serac::TimesteppingOptions timestepping_opts, const GeometricNonlinearities geom_nonlin, const std::string &physics_name, std::string mesh_tag, std::vector< std::string > parameter_names={}, int cycle=0, double time=0.0, bool checkpoint_to_disk=false)
 Construct a new SolidMechanics object. More...
 
 SolidMechanics (const SolidMechanicsInputOptions &input_options, const std::string &physics_name, std::string mesh_tag, int cycle=0, double time=0.0)
 Construct a new Nonlinear SolidMechanics Solver object. More...
 
virtual ~SolidMechanics ()
 Destroy the SolidMechanics Functional object.
 
void initializeSolidMechanicsStates ()
 Non virtual method to reset thermal states to zero. This does not reset design parameters or shape. More...
 
void resetStates (int cycle=0, double time=0.0) override
 Method to reset physics states to zero. This does not reset design parameters or shape. More...
 
template<typename T >
qdata_type< T > createQuadratureDataBuffer (T initial_state)
 Create a shared ptr to a quadrature data buffer for the given material type. More...
 
void setDisplacementBCs (const std::set< int > &disp_bdr, std::function< void(const mfem::Vector &, mfem::Vector &)> disp)
 Set essential displacement boundary conditions (strongly enforced) More...
 
void setDisplacementBCs (const std::set< int > &disp_bdr, std::function< void(const mfem::Vector &, double, mfem::Vector &)> disp)
 Set essential displacement boundary conditions (strongly enforced) More...
 
void setDisplacementBCs (const std::set< int > &disp_bdr, std::function< double(const mfem::Vector &x)> disp, int component)
 Set the displacement essential boundary conditions on a single component. More...
 
void setDisplacementBCsByDofList (const mfem::Array< int > true_dofs, std::function< void(const mfem::Vector &, double, mfem::Vector &)> disp)
 Set the displacement essential boundary conditions on a set of true degrees of freedom. More...
 
void setDisplacementBCsByDofList (const mfem::Array< int > true_dofs, std::function< void(const mfem::Vector &, mfem::Vector &)> disp)
 Set the displacement essential boundary conditions on a set of true degrees of freedom. More...
 
void setDisplacementBCs (std::function< bool(const mfem::Vector &)> is_node_constrained, std::function< void(const mfem::Vector &, double, mfem::Vector &)> disp)
 Set the displacement boundary conditions on a set of nodes within a spatially-defined area. More...
 
void setDisplacementBCs (std::function< bool(const mfem::Vector &)> is_node_constrained, std::function< void(const mfem::Vector &, mfem::Vector &)> disp)
 Set the displacement boundary conditions on a set of nodes within a spatially-defined area. More...
 
void setDisplacementBCs (std::function< bool(const mfem::Vector &)> is_node_constrained, std::function< double(const mfem::Vector &, double)> disp, int component)
 Set the displacement boundary conditions on a set of nodes within a spatially-defined area for a single displacement vector component. More...
 
void setDisplacementBCs (std::function< bool(const mfem::Vector &x)> is_node_constrained, std::function< double(const mfem::Vector &x)> disp, int component)
 Set the displacement boundary conditions on a set of nodes within a spatially-defined area for a single displacement vector component. More...
 
const FiniteElementStatestate (const std::string &state_name) const override
 Accessor for getting named finite element state fields from the physics modules. More...
 
void setState (const std::string &state_name, const FiniteElementState &state) override
 Set the primal solution field (displacement, velocity) for the underlying solid mechanics solver. More...
 
std::vector< std::string > stateNames () const override
 Get a vector of the finite element state solution variable names. More...
 
template<int... active_parameters, typename callable >
void addCustomBoundaryIntegral (DependsOn< active_parameters... >, callable qfunction, const std::optional< Domain > &optional_domain=std::nullopt)
 register a custom boundary integral calculation as part of the residual More...
 
const FiniteElementStateadjoint (const std::string &state_name) const override
 Accessor for getting named finite element state adjoint solution from the physics modules. More...
 
std::vector< std::string > adjointNames () const override
 Get a vector of the finite element state solution variable names. More...
 
template<int... active_parameters, typename callable , typename StateType = Nothing>
void addCustomDomainIntegral (DependsOn< active_parameters... >, callable qfunction, qdata_type< StateType > qdata=NoQData)
 register a custom domain integral calculation as part of the residual More...
 
template<int... active_parameters, typename MaterialType , typename StateType = Empty>
void setMaterial (DependsOn< active_parameters... >, MaterialType material, qdata_type< StateType > qdata=EmptyQData)
 Set the material stress response and mass properties for the physics module. More...
 
template<typename MaterialType , typename StateType = Empty>
void setMaterial (MaterialType material, std::shared_ptr< QuadratureData< StateType >> qdata=EmptyQData)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
void setDisplacement (std::function< void(const mfem::Vector &x, mfem::Vector &disp)> disp)
 Set the underlying finite element state to a prescribed displacement. More...
 
void setDisplacement (const FiniteElementState &temp)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
void setVelocity (std::function< void(const mfem::Vector &x, mfem::Vector &vel)> vel)
 Set the underlying finite element state to a prescribed velocity. More...
 
void setVelocity (const FiniteElementState &temp)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
template<int... active_parameters, typename BodyForceType >
void addBodyForce (DependsOn< active_parameters... >, BodyForceType body_force, const std::optional< Domain > &optional_domain=std::nullopt)
 Set the body forcefunction. More...
 
template<typename BodyForceType >
void addBodyForce (BodyForceType body_force, const std::optional< Domain > &optional_domain=std::nullopt)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
template<int... active_parameters, typename TractionType >
void setTraction (DependsOn< active_parameters... >, TractionType traction_function, const std::optional< Domain > &optional_domain=std::nullopt)
 Set the traction boundary condition. More...
 
template<typename TractionType >
void setTraction (TractionType traction_function, const std::optional< Domain > &optional_domain=std::nullopt)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
template<int... active_parameters, typename PressureType >
void setPressure (DependsOn< active_parameters... >, PressureType pressure_function, const std::optional< Domain > &optional_domain=std::nullopt)
 Set the pressure boundary condition. More...
 
template<typename PressureType >
void setPressure (PressureType pressure_function, const std::optional< Domain > &optional_domain=std::nullopt)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
virtual std::unique_ptr< mfem_ext::StdFunctionOperatorbuildQuasistaticOperator ()
 Build the quasi-static operator corresponding to the total Lagrangian formulation.
 
std::pair< const mfem::HypreParMatrix &, const mfem::HypreParMatrix & > stiffnessMatrix () const
 Return the assembled stiffness matrix. More...
 
void completeSetup () override
 Complete the initialization and allocation of the data structures. More...
 
void zeroEssentials (FiniteElementVector &field) const
 Set field to zero wherever their are essential boundary conditions applies.
 
virtual void quasiStaticSolve (double dt)
 Solve the Quasi-static Newton system.
 
void advanceTimestep (double dt) override
 Advance the solid mechanics physics module in time. More...
 
virtual void setAdjointLoad (std::unordered_map< std::string, const serac::FiniteElementDual & > loads) override
 Set the loads for the adjoint reverse timestep solve. More...
 
void reverseAdjointTimestep () override
 Solve the adjoint problem. More...
 
std::unordered_map< std::string, FiniteElementStategetCheckpointedStates (int cycle_to_load) const override
 Accessor for getting named finite element state primal solution from the physics modules at a given checkpointed cycle index. More...
 
FiniteElementDualcomputeTimestepSensitivity (size_t parameter_field) override
 Compute the implicit sensitivity of the quantity of interest used in defining the load for the adjoint problem with respect to the parameter field. More...
 
FiniteElementDualcomputeTimestepShapeSensitivity () override
 Compute the implicit sensitivity of the quantity of interest used in defining the load for the adjoint problem with respect to the shape displacement field. More...
 
const std::unordered_map< std::string, const serac::FiniteElementDual & > computeInitialConditionSensitivity () override
 Compute the implicit sensitivity of the quantity of interest with respect to the initial temperature. More...
 
const serac::FiniteElementStatedisplacement () const
 Get the displacement state. More...
 
const serac::FiniteElementStatevelocity () const
 Get the velocity state. More...
 
const serac::FiniteElementStateacceleration () const
 Get the acceleration state. More...
 
const serac::FiniteElementDualreactions ()
 getter for nodal forces (before zeroing-out essential dofs)
 
- Public Member Functions inherited from serac::BasePhysics
 BasePhysics (std::string physics_name, std::string mesh_tag, int cycle=0, double time=0.0, bool checkpoint_to_disk=false)
 Empty constructor. More...
 
 BasePhysics (BasePhysics &&other)=default
 Construct a new Base Physics object (copy constructor) More...
 
virtual double time () const
 Get the current forward-solution time. More...
 
virtual int cycle () const
 Get the current forward-solution cycle iteration number. More...
 
virtual double maxTime () const
 Get the maximum time reached by the forward solver. More...
 
virtual double minTime () const
 Get the initial time used by the forward solver. More...
 
virtual int maxCycle () const
 The maximum cycle (timestep iteration number) reached by the forward solver. More...
 
virtual int minCycle () const
 Get the initial cycle (timestep iteration number) used by the forward solver. More...
 
bool isQuasistatic () const
 Check if the physics is setup as quasistatic. More...
 
virtual std::vector< double > timesteps () const
 Get a vector of the timestep sizes (i.e. \(\Delta t\)s) taken by the forward solver. More...
 
const FiniteElementStateshapeDisplacement () const
 Accessor for getting the shape displacement field from the physics modules. More...
 
const FiniteElementStateparameter (const std::string &parameter_name) const
 Accessor for getting named finite element state parameter fields from the physics modules. More...
 
const FiniteElementStateparameter (std::size_t parameter_index) const
 Accessor for getting indexed finite element state parameter fields from the physics modules. More...
 
std::vector< std::string > parameterNames ()
 Get a vector of the finite element state parameter names. More...
 
void setParameter (const size_t parameter_index, const FiniteElementState &parameter_state)
 Deep copy a parameter field into the internally-owned parameter used for simulations. More...
 
void setShapeDisplacement (const FiniteElementState &shape_displacement)
 Set the current shape displacement for the underlying mesh. More...
 
virtual void outputStateToDisk (std::optional< std::string > paraview_output_dir={}) const
 Output the current state of the PDE fields in Sidre format and optionally in Paraview format if paraview_output_dir is given. More...
 
FiniteElementState loadCheckpointedState (const std::string &state_name, int cycle) const
 Accessor for getting a single named finite element state primal solution from the physics modules at a given checkpointed cycle index. More...
 
virtual double getCheckpointedTimestep (int cycle) const
 Get a timestep increment which has been previously checkpointed at the give cycle. More...
 
virtual void initializeSummary (axom::sidre::DataStore &datastore, const double t_final, const double dt) const
 Initializes the Sidre structure for simulation summary data. More...
 
virtual void saveSummary (axom::sidre::DataStore &datastore, const double t) const
 Saves the summary data to the Sidre Datastore. More...
 
virtual ~BasePhysics ()=default
 Destroy the Base Solver object.
 
const mfem::ParMesh & mesh () const
 Returns a reference to the mesh object.
 
mfem::ParMesh & mesh ()
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 

Static Public Attributes

static constexpr auto NUM_STATE_VARS = 2
 The total number of non-parameter state variables (displacement, acceleration) passed to the FEM integrators.
 

Protected Types

using trial = H1< order, dim >
 The compile-time finite element trial space for displacement and velocity (H1 of order p)
 
using test = H1< order, dim >
 The compile-time finite element test space for displacement and velocity (H1 of order p)
 
using shape_trial = H1< SHAPE_ORDER, dim >
 

Protected Member Functions

mfem::Array< int > calculateConstrainedDofs (std::function< bool(const mfem::Vector &)> is_node_constrained, std::optional< int > component={})
 Calculate a list of constrained dofs in the true displacement vector from a function that returns true if a physical coordinate is in the constrained set. More...
 
void warmStartDisplacement ()
 Sets the Dirichlet BCs for the current time and computes an initial guess for parameters and displacement.
 
- Protected Member Functions inherited from serac::BasePhysics
void CreateParaviewDataCollection () const
 Create a paraview data collection for the physics package if requested.
 
void UpdateParaviewDataCollection (const std::string &paraview_output_dir) const
 Update the paraview states, duals, parameters, and metadata (cycle, time) in preparation for output. More...
 
void initializeBasePhysicsStates (int cycle, double time)
 Protected, non-virtual method to reset physics states to zero. This does not reset design parameters or shape. More...
 

Protected Attributes

FiniteElementState displacement_
 The displacement finite element state.
 
FiniteElementState velocity_
 The velocity finite element state.
 
FiniteElementState acceleration_
 The acceleration finite element state.
 
FiniteElementState adjoint_displacement_
 The displacement finite element adjoint state.
 
FiniteElementDual displacement_adjoint_load_
 The adjoint load (RHS) for the displacement adjoint system solve (downstream -dQOI/d displacement)
 
FiniteElementDual velocity_adjoint_load_
 The adjoint load (RHS) for the velocity adjoint system solve (downstream -dQOI/d velocity)
 
FiniteElementDual acceleration_adjoint_load_
 The adjoint load (RHS) for the adjoint system solve (downstream -dQOI/d acceleration)
 
FiniteElementDual implicit_sensitivity_displacement_start_of_step_
 The total/implicit sensitivity of the qoi with respect to the start of the previous timestep's displacement.
 
FiniteElementDual implicit_sensitivity_velocity_start_of_step_
 The total/implicit sensitivity of the qoi with respect to the start of the previous timestep's velocity.
 
FiniteElementDual reactions_
 nodal forces
 
std::unique_ptr< ShapeAwareFunctional< shape_trial, test(trial, trial, parameter_space...)> > residual_
 serac::Functional that is used to calculate the residual and its derivatives
 
std::unique_ptr< mfem_ext::StdFunctionOperatorresidual_with_bcs_
 mfem::Operator that calculates the residual after applying essential boundary conditions
 
std::unique_ptr< EquationSolvernonlin_solver_
 the specific methods and tolerances specified to solve the nonlinear residual equations
 
mfem_ext::SecondOrderODE ode2_
 the ordinary differential equation that describes how to solve for the second time derivative of displacement, given the current displacement, velocity, and source terms
 
std::unique_ptr< mfem::HypreParMatrix > J_
 Assembled sparse matrix for the Jacobian df/du (11 block if using Lagrange multiplier contact)
 
std::unique_ptr< mfem::HypreParMatrix > J_e_
 
mfem::Vector predicted_displacement_
 an intermediate variable used to store the predicted end-step displacement
 
mfem::Vector du_
 vector used to store the change in essential bcs between timesteps
 
mfem::Vector dr_
 vector used to store forces arising from du_ when applying time-dependent bcs
 
mfem::Vector u_
 used to communicate the ODE solver's predicted displacement to the residual operator
 
mfem::Vector v_
 used to communicate the ODE solver's predicted velocity to the residual operator
 
double c0_
 coefficient used to calculate predicted displacement: u_p := u + c0 * d2u_dt2
 
double c1_
 coefficient used to calculate predicted velocity: dudt_p := dudt + c1 * d2u_dt2
 
GeometricNonlinearities geom_nonlin_
 A flag denoting whether to compute geometric nonlinearities in the residual.
 
std::shared_ptr< mfem::VectorCoefficient > disp_bdr_coef_
 Coefficient containing the essential boundary values.
 
std::shared_ptr< mfem::Coefficient > component_disp_bdr_coef_
 Coefficient containing the essential boundary values.
 
std::array< std::function< decltype((*residual_)(DifferentiateWRT< 1 >{}, 0.0, shape_displacement_, displacement_, acceleration_, *parameters_[parameter_indices].state...))(double)>, sizeof...(parameter_indices)> d_residual_d_
 Array functions computing the derivative of the residual with respect to each given parameter. More...
 
- Protected Attributes inherited from serac::BasePhysics
std::string name_ = {}
 Name of the physics module.
 
std::string mesh_tag_ = {}
 ID of the corresponding MFEMSidreDataCollection (denoting a mesh)
 
mfem::ParMesh & mesh_
 The primary mesh.
 
MPI_Comm comm_
 The MPI communicator.
 
std::vector< const serac::FiniteElementState * > states_
 List of finite element primal states associated with this physics module.
 
std::vector< const serac::FiniteElementState * > adjoints_
 List of finite element adjoint states associated with this physics module.
 
std::vector< const serac::FiniteElementDual * > duals_
 List of finite element duals associated with this physics module.
 
std::vector< ParameterInfoparameters_
 A vector of the parameters associated with this physics module.
 
FiniteElementStateshape_displacement_
 The parameter info associated with the shape displacement field. More...
 
std::unique_ptr< FiniteElementDualshape_displacement_sensitivity_
 Sensitivity with respect to the shape displacement field. More...
 
std::unordered_map< std::string, std::vector< serac::FiniteElementState > > checkpoint_states_
 A map containing optionally in-memory checkpointed primal states for transient adjoint solvers.
 
std::unordered_map< std::string, serac::FiniteElementStatecached_checkpoint_states_
 A container relating a checkpointed cycle and the associated finite element state fields. More...
 
std::optional< int > cached_checkpoint_cycle_
 An optional int for disk-based checkpointing containing the cycle number of the last retrieved checkpoint.
 
bool is_quasistatic_ = true
 Whether the simulation is time-independent.
 
double time_
 Current time for the forward pass.
 
double max_time_
 The maximum time reached for the forward solver.
 
double min_time_
 The time the forward solver was initialized to.
 
std::vector< double > timesteps_
 A vector of the timestep sizes (i.e. \(\Delta t\)) taken by the forward solver.
 
int cycle_
 Current cycle (forward pass time iteration count)
 
int max_cycle_
 The maximum cycle (forward pass iteration count) reached by the forward solver.
 
int min_cycle_
 The cycle the forward solver was initialized to.
 
double ode_time_point_
 The value of time at which the ODE solver wants to evaluate the residual.
 
int mpi_rank_
 MPI rank.
 
int mpi_size_
 MPI size.
 
std::unique_ptr< mfem::ParaViewDataCollection > paraview_dc_
 DataCollection pointer for optional paraview output.
 
std::unordered_map< std::string, std::unique_ptr< mfem::ParGridFunction > > paraview_dual_grid_functions_
 A optional map of the dual names and duals in grid function form for paraview output.
 
std::unique_ptr< mfem::ParGridFunction > shape_sensitivity_grid_function_
 A optional view of the shape sensitivity in grid function form for paraview output.
 
BoundaryConditionManager bcs_
 Boundary condition manager instance.
 
bool checkpoint_to_disk_
 A flag denoting whether to save the state to disk or memory as needed for dynamic adjoint solves.
 

Additional Inherited Members

- Static Protected Attributes inherited from serac::BasePhysics
static constexpr int FLOAT_PRECISION_ = 8
 Number of significant figures to output for floating-point.
 

Detailed Description

template<int order, int dim, typename... parameter_space, int... parameter_indices>
class serac::SolidMechanics< order, dim, Parameters< parameter_space... >, std::integer_sequence< int, parameter_indices... > >

The nonlinear solid solver class.

The nonlinear total Lagrangian quasi-static and dynamic hyperelastic solver object. This uses Functional to compute the tangent stiffness matrices.

Template Parameters
orderThe order of the discretization of the displacement and velocity fields
dimThe spatial dimension of the mesh

Definition at line 98 of file solid_mechanics.hpp.

Member Typedef Documentation

◆ qdata_type

template<int order, int dim, typename... parameter_space, int... parameter_indices>
template<typename T >
using serac::SolidMechanics< order, dim, Parameters< parameter_space... >, std::integer_sequence< int, parameter_indices... > >::qdata_type = std::shared_ptr<QuadratureData<T> >

a container holding quadrature point data of the specified type

Template Parameters
Tthe type of data to store at each quadrature point

Definition at line 114 of file solid_mechanics.hpp.

◆ shape_trial

template<int order, int dim, typename... parameter_space, int... parameter_indices>
using serac::SolidMechanics< order, dim, Parameters< parameter_space... >, std::integer_sequence< int, parameter_indices... > >::shape_trial = H1<SHAPE_ORDER, dim>
protected

The compile-time finite element trial space for shape displacement (H1 of order 1, nodal displacements) The choice of polynomial order for the shape sensitivity is determined in the StateManager

Definition at line 1475 of file solid_mechanics.hpp.

Constructor & Destructor Documentation

◆ SolidMechanics() [1/3]

template<int order, int dim, typename... parameter_space, int... parameter_indices>
serac::SolidMechanics< order, dim, Parameters< parameter_space... >, std::integer_sequence< int, parameter_indices... > >::SolidMechanics ( const NonlinearSolverOptions  nonlinear_opts,
const LinearSolverOptions  lin_opts,
const serac::TimesteppingOptions  timestepping_opts,
const GeometricNonlinearities  geom_nonlin,
const std::string &  physics_name,
std::string  mesh_tag,
std::vector< std::string >  parameter_names = {},
int  cycle = 0,
double  time = 0.0,
bool  checkpoint_to_disk = false 
)
inline

Construct a new SolidMechanics object.

Parameters
nonlinear_optsThe nonlinear solver options for solving the nonlinear residual equations
lin_optsThe linear solver options for solving the linearized Jacobian equations
timestepping_optsThe timestepping options for the solid mechanics time evolution operator
geom_nonlinFlag to include geometric nonlinearities
physics_nameA name for the physics module instance
mesh_tagThe tag for the mesh in the StateManager to construct the physics module on
parameter_namesA vector of the names of the requested parameter fields
cycleThe simulation cycle (i.e. timestep iteration) to intialize the physics module to
timeThe simulation time to initialize the physics module to
checkpoint_to_diskA flag to save the transient states on disk instead of memory for the transient adjoint solves
Note
On parallel file systems (e.g. lustre), significant slowdowns and occasional errors were observed when writing and reading the needed trainsient states to disk for adjoint solves

Definition at line 134 of file solid_mechanics.hpp.

◆ SolidMechanics() [2/3]

template<int order, int dim, typename... parameter_space, int... parameter_indices>
serac::SolidMechanics< order, dim, Parameters< parameter_space... >, std::integer_sequence< int, parameter_indices... > >::SolidMechanics ( std::unique_ptr< serac::EquationSolver solver,
const serac::TimesteppingOptions  timestepping_opts,
const GeometricNonlinearities  geom_nonlin,
const std::string &  physics_name,
std::string  mesh_tag,
std::vector< std::string >  parameter_names = {},
int  cycle = 0,
double  time = 0.0,
bool  checkpoint_to_disk = false 
)
inline

Construct a new SolidMechanics object.

Parameters
solverThe nonlinear equation solver for the implicit solid mechanics equations
timestepping_optsThe timestepping options for the solid mechanics time evolution operator
geom_nonlinFlag to include geometric nonlinearities
physics_nameA name for the physics module instance
mesh_tagThe tag for the mesh in the StateManager to construct the physics module on
parameter_namesA vector of the names of the requested parameter fields
cycleThe simulation cycle (i.e. timestep iteration) to intialize the physics module to
timeThe simulation time to initialize the physics module to
checkpoint_to_diskA flag to save the transient states on disk instead of memory for the transient adjoint solves
Note
On parallel file systems (e.g. lustre), significant slowdowns and occasional errors were observed when writing and reading the needed trainsient states to disk for adjoint solves

Definition at line 161 of file solid_mechanics.hpp.

◆ SolidMechanics() [3/3]

template<int order, int dim, typename... parameter_space, int... parameter_indices>
serac::SolidMechanics< order, dim, Parameters< parameter_space... >, std::integer_sequence< int, parameter_indices... > >::SolidMechanics ( const SolidMechanicsInputOptions input_options,
const std::string &  physics_name,
std::string  mesh_tag,
int  cycle = 0,
double  time = 0.0 
)
inline

Construct a new Nonlinear SolidMechanics Solver object.

Parameters
[in]input_optionsThe solver information parsed from the input file
[in]physics_nameA name for the physics module instance
[in]mesh_tagThe tag for the mesh in the StateManager to construct the physics module on
[in]cycleThe simulation cycle (i.e. timestep iteration) to intialize the physics module to
[in]timeThe simulation time to initialize the physics module to

Definition at line 271 of file solid_mechanics.hpp.

Member Function Documentation

◆ acceleration()

template<int order, int dim, typename... parameter_space, int... parameter_indices>
const serac::FiniteElementState& serac::SolidMechanics< order, dim, Parameters< parameter_space... >, std::integer_sequence< int, parameter_indices... > >::acceleration ( ) const
inline

Get the acceleration state.

Returns
A reference to the current acceleration finite element state

Definition at line 1461 of file solid_mechanics.hpp.

◆ addBodyForce()

template<int order, int dim, typename... parameter_space, int... parameter_indices>
template<int... active_parameters, typename BodyForceType >
void serac::SolidMechanics< order, dim, Parameters< parameter_space... >, std::integer_sequence< int, parameter_indices... > >::addBodyForce ( DependsOn< active_parameters... >  ,
BodyForceType  body_force,
const std::optional< Domain > &  optional_domain = std::nullopt 
)
inline

Set the body forcefunction.

Template Parameters
BodyForceTypeThe type of the body force load
Parameters
body_forceA function describing the body force applied
optional_domainThe domain over which the body force is applied. If nothing is supplied the entire domain is used.
Precondition
body_force must be a object that can be called with the following arguments:
  1. tensor<T,dim> x the spatial coordinates for the quadrature point
  2. double t the time (note: time will be handled differently in the future)
  3. tuple{value, derivative}, a variadic list of tuples (each with a values and derivative), one tuple for each of the trial spaces specified in the DependsOn<...> argument.
Note
The actual types of these arguments passed will be double, tensor<double, ... > or tuples thereof when doing direct evaluation. When differentiating with respect to one of the inputs, its stored values will change to dual numbers rather than double. (e.g. tensor<double,3> becomes tensor<dual<...>, 3>)
This method must be called prior to completeSetup()

Definition at line 915 of file solid_mechanics.hpp.

◆ addCustomBoundaryIntegral()

template<int order, int dim, typename... parameter_space, int... parameter_indices>
template<int... active_parameters, typename callable >
void serac::SolidMechanics< order, dim, Parameters< parameter_space... >, std::integer_sequence< int, parameter_indices... > >::addCustomBoundaryIntegral ( DependsOn< active_parameters... >  ,
callable  qfunction,
const std::optional< Domain > &  optional_domain = std::nullopt 
)
inline

register a custom boundary integral calculation as part of the residual

Template Parameters
active_parametersa list of indices, describing which parameters to pass to the q-function
Parameters
qfunctiona callable that returns the traction on a boundary surface
optional_domainThe domain over which the boundary integral is evaluated. If nothing is supplied the entire boundary is used.
solid_mechanics.addCustomBoundaryIntegral(DependsOn<>{}, [](double t, auto position, auto displacement, auto
acceleration, auto shape){ auto [X, dX_dxi] = position;
auto [u, du_dxi] = displacement;
auto f = u * 3.0 (X[0] < 0.01);
return f; // define a displacement-proportional traction at a given support
});
Note
This method must be called prior to completeSetup()

Definition at line 734 of file solid_mechanics.hpp.

◆ addCustomDomainIntegral()

template<int order, int dim, typename... parameter_space, int... parameter_indices>
template<int... active_parameters, typename callable , typename StateType = Nothing>
void serac::SolidMechanics< order, dim, Parameters< parameter_space... >, std::integer_sequence< int, parameter_indices... > >::addCustomDomainIntegral ( DependsOn< active_parameters... >  ,
callable  qfunction,
qdata_type< StateType >  qdata = NoQData 
)
inline

register a custom domain integral calculation as part of the residual

Template Parameters
active_parametersa list of indices, describing which parameters to pass to the q-function
StateTypethe type that contains the internal variables (if any) for q-function
Parameters
qfunctiona callable that returns a tuple of body-force and stress
qdatathe buffer of material internal variables at each quadrature point
double lambda = 500.0;
double mu = 500.0;
solid_mechanics.addCustomDomainIntegral(DependsOn<>{}, [=](auto x, auto displacement, auto acceleration, auto
shape_displacement){ auto du_dx = serac::get<1>(displacement);
auto I = Identity<dim>();
auto epsilon = 0.5 * (transpose(du_dx) + du_dx);
auto stress = lambda * tr(epsilon) * I + 2.0 * mu * epsilon;
auto d2u_dt2 = serac::get<0>(acceleration);
double rho = 1.0 + x[0]; // spatially-varying density
return serac::tuple{rho * d2u_dt2, stress};
});
constexpr SERAC_HOST_DEVICE auto tr(const isotropic_tensor< T, m, m > &I)
calculate the trace of an isotropic tensor
constexpr SERAC_HOST_DEVICE auto transpose(const isotropic_tensor< T, m, m > &I)
return the transpose of an isotropic tensor
This is a class that mimics most of std::tuple's interface, except that it is usable in CUDA kernels ...
Definition: tuple.hpp:28
Note
This method must be called prior to completeSetup()

Definition at line 797 of file solid_mechanics.hpp.

◆ adjoint()

template<int order, int dim, typename... parameter_space, int... parameter_indices>
const FiniteElementState& serac::SolidMechanics< order, dim, Parameters< parameter_space... >, std::integer_sequence< int, parameter_indices... > >::adjoint ( const std::string &  state_name) const
inlineoverridevirtual

Accessor for getting named finite element state adjoint solution from the physics modules.

Parameters
state_nameThe name of the Finite Element State adjoint solution to retrieve
Returns
The named adjoint Finite Element State

Implements serac::BasePhysics.

Definition at line 749 of file solid_mechanics.hpp.

◆ adjointNames()

template<int order, int dim, typename... parameter_space, int... parameter_indices>
std::vector<std::string> serac::SolidMechanics< order, dim, Parameters< parameter_space... >, std::integer_sequence< int, parameter_indices... > >::adjointNames ( ) const
inlineoverridevirtual

Get a vector of the finite element state solution variable names.

Returns
The solution variable names

Reimplemented from serac::BasePhysics.

Definition at line 765 of file solid_mechanics.hpp.

◆ advanceTimestep()

template<int order, int dim, typename... parameter_space, int... parameter_indices>
void serac::SolidMechanics< order, dim, Parameters< parameter_space... >, std::integer_sequence< int, parameter_indices... > >::advanceTimestep ( double  dt)
inlineoverridevirtual

Advance the solid mechanics physics module in time.

Advance the underlying ODE with the requested time integration scheme using the previously set timestep.

Parameters
dtThe increment of simulation time to advance the underlying solid mechanics problem

Implements serac::BasePhysics.

Definition at line 1194 of file solid_mechanics.hpp.

◆ calculateConstrainedDofs()

template<int order, int dim, typename... parameter_space, int... parameter_indices>
mfem::Array<int> serac::SolidMechanics< order, dim, Parameters< parameter_space... >, std::integer_sequence< int, parameter_indices... > >::calculateConstrainedDofs ( std::function< bool(const mfem::Vector &)>  is_node_constrained,
std::optional< int >  component = {} 
)
inlineprotected

Calculate a list of constrained dofs in the true displacement vector from a function that returns true if a physical coordinate is in the constrained set.

Parameters
is_node_constrainedA function that takes a point in physical space and returns true if the contained degrees of freedom should be constrained
componentwhich component is constrained (uninitialized implies all components are constrained)
Returns
An array of the constrained true dofs

Definition at line 1581 of file solid_mechanics.hpp.

◆ completeSetup()

template<int order, int dim, typename... parameter_space, int... parameter_indices>
void serac::SolidMechanics< order, dim, Parameters< parameter_space... >, std::integer_sequence< int, parameter_indices... > >::completeSetup ( )
inlineoverridevirtual

Complete the initialization and allocation of the data structures.

Note
This must be called before AdvanceTimestep().

Implements serac::BasePhysics.

Reimplemented in serac::SolidMechanicsContact< order, dim, Parameters< parameter_space... >, std::integer_sequence< int, parameter_indices... > >.

Definition at line 1099 of file solid_mechanics.hpp.

◆ computeInitialConditionSensitivity()

template<int order, int dim, typename... parameter_space, int... parameter_indices>
const std::unordered_map<std::string, const serac::FiniteElementDual&> serac::SolidMechanics< order, dim, Parameters< parameter_space... >, std::integer_sequence< int, parameter_indices... > >::computeInitialConditionSensitivity ( )
inlineoverridevirtual

Compute the implicit sensitivity of the quantity of interest with respect to the initial temperature.

Returns
The sensitivity with respect to the initial temperature
Precondition
reverseAdjointTimestep must be called as many times as the forward solver was advanced before this is called

Reimplemented from serac::BasePhysics.

Definition at line 1436 of file solid_mechanics.hpp.

◆ computeTimestepSensitivity()

template<int order, int dim, typename... parameter_space, int... parameter_indices>
FiniteElementDual& serac::SolidMechanics< order, dim, Parameters< parameter_space... >, std::integer_sequence< int, parameter_indices... > >::computeTimestepSensitivity ( size_t  parameter_field)
inlineoverridevirtual

Compute the implicit sensitivity of the quantity of interest used in defining the load for the adjoint problem with respect to the parameter field.

Parameters
parameter_fieldThe index of the parameter to take a derivative with respect to
Returns
The sensitivity with respect to the parameter
Precondition
reverseAdjointTimestep with an appropriate adjoint load must be called prior to this method.

Reimplemented from serac::BasePhysics.

Definition at line 1393 of file solid_mechanics.hpp.

◆ computeTimestepShapeSensitivity()

template<int order, int dim, typename... parameter_space, int... parameter_indices>
FiniteElementDual& serac::SolidMechanics< order, dim, Parameters< parameter_space... >, std::integer_sequence< int, parameter_indices... > >::computeTimestepShapeSensitivity ( )
inlineoverridevirtual

Compute the implicit sensitivity of the quantity of interest used in defining the load for the adjoint problem with respect to the shape displacement field.

Returns
The sensitivity with respect to the shape displacement
Precondition
reverseAdjointTimestep with an appropriate adjoint load must be called prior to this method.

Reimplemented from serac::BasePhysics.

Definition at line 1416 of file solid_mechanics.hpp.

◆ createQuadratureDataBuffer()

template<int order, int dim, typename... parameter_space, int... parameter_indices>
template<typename T >
qdata_type<T> serac::SolidMechanics< order, dim, Parameters< parameter_space... >, std::integer_sequence< int, parameter_indices... > >::createQuadratureDataBuffer ( initial_state)
inline

Create a shared ptr to a quadrature data buffer for the given material type.

Template Parameters
Tthe type to be created at each quadrature point
Parameters
initial_statethe value to be broadcast to each quadrature point
Returns
std::shared_ptr< QuadratureData<T> >

Definition at line 414 of file solid_mechanics.hpp.

◆ displacement()

template<int order, int dim, typename... parameter_space, int... parameter_indices>
const serac::FiniteElementState& serac::SolidMechanics< order, dim, Parameters< parameter_space... >, std::integer_sequence< int, parameter_indices... > >::displacement ( ) const
inline

Get the displacement state.

Returns
A reference to the current displacement finite element state

Definition at line 1447 of file solid_mechanics.hpp.

◆ getCheckpointedStates()

template<int order, int dim, typename... parameter_space, int... parameter_indices>
std::unordered_map<std::string, FiniteElementState> serac::SolidMechanics< order, dim, Parameters< parameter_space... >, std::integer_sequence< int, parameter_indices... > >::getCheckpointedStates ( int  cycle_to_load) const
inlineoverridevirtual

Accessor for getting named finite element state primal solution from the physics modules at a given checkpointed cycle index.

Parameters
cycle_to_loadThe previous timestep where the state solution is requested
Returns
The named primal Finite Element State

Reimplemented from serac::BasePhysics.

Definition at line 1361 of file solid_mechanics.hpp.

◆ initializeSolidMechanicsStates()

template<int order, int dim, typename... parameter_space, int... parameter_indices>
void serac::SolidMechanics< order, dim, Parameters< parameter_space... >, std::integer_sequence< int, parameter_indices... > >::initializeSolidMechanicsStates ( )
inline

Non virtual method to reset thermal states to zero. This does not reset design parameters or shape.

Parameters
[in]cycleThe simulation cycle (i.e. timestep iteration) to intialize the physics module to
[in]timeThe simulation time to initialize the physics module to

Definition at line 360 of file solid_mechanics.hpp.

◆ resetStates()

template<int order, int dim, typename... parameter_space, int... parameter_indices>
void serac::SolidMechanics< order, dim, Parameters< parameter_space... >, std::integer_sequence< int, parameter_indices... > >::resetStates ( int  cycle = 0,
double  time = 0.0 
)
inlineoverridevirtual

Method to reset physics states to zero. This does not reset design parameters or shape.

Parameters
[in]cycleThe simulation cycle (i.e. timestep iteration) to intialize the physics module to
[in]timeThe simulation time to initialize the physics module to

Implements serac::BasePhysics.

Definition at line 400 of file solid_mechanics.hpp.

◆ reverseAdjointTimestep()

template<int order, int dim, typename... parameter_space, int... parameter_indices>
void serac::SolidMechanics< order, dim, Parameters< parameter_space... >, std::integer_sequence< int, parameter_indices... > >::reverseAdjointTimestep ( )
inlineoverridevirtual

Solve the adjoint problem.

Precondition
It is expected that the forward analysis is complete and the current displacement state is valid
It is expected that the adjoint load has already been set in SolidMechanics::setAdjointLoad

Reimplemented from serac::BasePhysics.

Definition at line 1288 of file solid_mechanics.hpp.

◆ setAdjointLoad()

template<int order, int dim, typename... parameter_space, int... parameter_indices>
virtual void serac::SolidMechanics< order, dim, Parameters< parameter_space... >, std::integer_sequence< int, parameter_indices... > >::setAdjointLoad ( std::unordered_map< std::string, const serac::FiniteElementDual & >  loads)
inlineoverridevirtual

Set the loads for the adjoint reverse timestep solve.

Parameters
loadsThe loads (e.g. right hand sides) for the adjoint problem
Precondition
The adjoint load map is expected to contain an entry named "displacement"
The adjoint load map may contain an entry named "velocity"
The adjoint load map may contain an entry named "acceleration"

These loads are typically defined as derivatives of a downstream quantity of intrest with respect to a primal solution field (in this case, displacement). For this physics module, the unordered map is expected to have one entry with the keys "displacement".

Reimplemented from serac::BasePhysics.

Definition at line 1254 of file solid_mechanics.hpp.

◆ setDisplacement()

template<int order, int dim, typename... parameter_space, int... parameter_indices>
void serac::SolidMechanics< order, dim, Parameters< parameter_space... >, std::integer_sequence< int, parameter_indices... > >::setDisplacement ( std::function< void(const mfem::Vector &x, mfem::Vector &disp)>  disp)
inline

Set the underlying finite element state to a prescribed displacement.

Parameters
dispThe function describing the displacement field

Definition at line 870 of file solid_mechanics.hpp.

◆ setDisplacementBCs() [1/7]

template<int order, int dim, typename... parameter_space, int... parameter_indices>
void serac::SolidMechanics< order, dim, Parameters< parameter_space... >, std::integer_sequence< int, parameter_indices... > >::setDisplacementBCs ( const std::set< int > &  disp_bdr,
std::function< double(const mfem::Vector &x)>  disp,
int  component 
)
inline

Set the displacement essential boundary conditions on a single component.

Parameters
[in]disp_bdrThe set of boundary attributes to set the displacement on
[in]dispThe vector function containing the set displacement values
[in]componentThe component to set the displacment on

For the displacement function, the argument is the input position and the output is the value of the component of the displacement.

Note
This method must be called prior to completeSetup()

Definition at line 486 of file solid_mechanics.hpp.

◆ setDisplacementBCs() [2/7]

template<int order, int dim, typename... parameter_space, int... parameter_indices>
void serac::SolidMechanics< order, dim, Parameters< parameter_space... >, std::integer_sequence< int, parameter_indices... > >::setDisplacementBCs ( const std::set< int > &  disp_bdr,
std::function< void(const mfem::Vector &, double, mfem::Vector &)>  disp 
)
inline

Set essential displacement boundary conditions (strongly enforced)

Parameters
[in]disp_bdrThe boundary attributes from the mesh on which to enforce a displacement
[in]dispThe prescribed boundary displacement function

For the displacement function, the first argument is the input position, the second argument is the time, and the third argument is the output prescribed displacement.

Note
This method must be called prior to completeSetup()

Definition at line 465 of file solid_mechanics.hpp.

◆ setDisplacementBCs() [3/7]

template<int order, int dim, typename... parameter_space, int... parameter_indices>
void serac::SolidMechanics< order, dim, Parameters< parameter_space... >, std::integer_sequence< int, parameter_indices... > >::setDisplacementBCs ( const std::set< int > &  disp_bdr,
std::function< void(const mfem::Vector &, mfem::Vector &)>  disp 
)
inline

Set essential displacement boundary conditions (strongly enforced)

Parameters
[in]disp_bdrThe boundary attributes from the mesh on which to enforce a displacement
[in]dispThe prescribed boundary displacement function
Note
This method must be called prior to completeSetup()

For the displacement function, the first argument is the input position and the second argument is the output prescribed displacement.

Definition at line 446 of file solid_mechanics.hpp.

◆ setDisplacementBCs() [4/7]

template<int order, int dim, typename... parameter_space, int... parameter_indices>
void serac::SolidMechanics< order, dim, Parameters< parameter_space... >, std::integer_sequence< int, parameter_indices... > >::setDisplacementBCs ( std::function< bool(const mfem::Vector &)>  is_node_constrained,
std::function< double(const mfem::Vector &, double)>  disp,
int  component 
)
inline

Set the displacement boundary conditions on a set of nodes within a spatially-defined area for a single displacement vector component.

Parameters
is_node_constrainedA callback function that returns true if displacement nodes at a certain position should be constrained by this boundary condition
dispThe scalar function containing the prescribed component displacement values
componentThe component of the displacement vector that should be set by this boundary condition. The other components of displacement are unconstrained.

The displacement function takes a spatial position as the first argument and current time as the second argument. It computes the desired displacement scalar for the given component and returns that value.

Note
This method searches over the entire mesh, not just the boundary nodes.
This method must be called prior to completeSetup()

Definition at line 604 of file solid_mechanics.hpp.

◆ setDisplacementBCs() [5/7]

template<int order, int dim, typename... parameter_space, int... parameter_indices>
void serac::SolidMechanics< order, dim, Parameters< parameter_space... >, std::integer_sequence< int, parameter_indices... > >::setDisplacementBCs ( std::function< bool(const mfem::Vector &)>  is_node_constrained,
std::function< void(const mfem::Vector &, double, mfem::Vector &)>  disp 
)
inline

Set the displacement boundary conditions on a set of nodes within a spatially-defined area.

Parameters
is_node_constrainedA callback function that returns true if displacement nodes at a certain position should be constrained by this boundary condition
dispThe vector function containing the prescribed displacement values

The displacement function takes a spatial position as the first argument and time as the second argument. It computes the desired displacement and fills the third argument with these displacement values.

Note
This method searches over the entire mesh, not just the boundary nodes.
This method must be called prior to completeSetup()

Definition at line 557 of file solid_mechanics.hpp.

◆ setDisplacementBCs() [6/7]

template<int order, int dim, typename... parameter_space, int... parameter_indices>
void serac::SolidMechanics< order, dim, Parameters< parameter_space... >, std::integer_sequence< int, parameter_indices... > >::setDisplacementBCs ( std::function< bool(const mfem::Vector &)>  is_node_constrained,
std::function< void(const mfem::Vector &, mfem::Vector &)>  disp 
)
inline

Set the displacement boundary conditions on a set of nodes within a spatially-defined area.

Parameters
is_node_constrainedA callback function that returns true if displacement nodes at a certain position should be constrained by this boundary condition
dispThe vector function containing the prescribed displacement values

The displacement function takes a spatial position as the first argument. It computes the desired displacement and fills the second argument with these displacement values.

Note
This method searches over the entire mesh, not just the boundary nodes.
This method must be called prior to completeSetup()

Definition at line 579 of file solid_mechanics.hpp.

◆ setDisplacementBCs() [7/7]

template<int order, int dim, typename... parameter_space, int... parameter_indices>
void serac::SolidMechanics< order, dim, Parameters< parameter_space... >, std::integer_sequence< int, parameter_indices... > >::setDisplacementBCs ( std::function< bool(const mfem::Vector &x)>  is_node_constrained,
std::function< double(const mfem::Vector &x)>  disp,
int  component 
)
inline

Set the displacement boundary conditions on a set of nodes within a spatially-defined area for a single displacement vector component.

Parameters
is_node_constrainedA callback function that returns true if displacement nodes at a certain position should be constrained by this boundary condition
dispThe scalar function containing the prescribed component displacement values
componentThe component of the displacement vector that should be set by this boundary condition. The other components of displacement are unconstrained.

The displacement function takes a spatial position as an argument. It computes the desired displacement scalar for the given component and returns that value.

Note
This method searches over the entire mesh, not just the boundary nodes.
This method must be called prior to completeSetup()

Definition at line 634 of file solid_mechanics.hpp.

◆ setDisplacementBCsByDofList() [1/2]

template<int order, int dim, typename... parameter_space, int... parameter_indices>
void serac::SolidMechanics< order, dim, Parameters< parameter_space... >, std::integer_sequence< int, parameter_indices... > >::setDisplacementBCsByDofList ( const mfem::Array< int >  true_dofs,
std::function< void(const mfem::Vector &, double, mfem::Vector &)>  disp 
)
inline

Set the displacement essential boundary conditions on a set of true degrees of freedom.

Parameters
true_dofsA set of true degrees of freedom to set the displacement on
dispThe vector function containing the prescribed displacement values

The true_dofs list can be determined using functions from the mfem::ParFiniteElementSpace related to the displacement serac::FiniteElementState .

For the displacement function, the first argument is the input position, the second argument is time, and the third argument is the prescribed output displacement vector.

Note
The displacement function is required to be vector-valued. However, only the dofs specified in the true_dofs array will be set. This means that if the true_dofs array only contains dofs for a specific vector component in a vector-valued finite element space, only that component will be set.
This method must be called prior to completeSetup()

Definition at line 513 of file solid_mechanics.hpp.

◆ setDisplacementBCsByDofList() [2/2]

template<int order, int dim, typename... parameter_space, int... parameter_indices>
void serac::SolidMechanics< order, dim, Parameters< parameter_space... >, std::integer_sequence< int, parameter_indices... > >::setDisplacementBCsByDofList ( const mfem::Array< int >  true_dofs,
std::function< void(const mfem::Vector &, mfem::Vector &)>  disp 
)
inline

Set the displacement essential boundary conditions on a set of true degrees of freedom.

Parameters
true_dofsA set of true degrees of freedom to set the displacement on
dispThe vector function containing the prescribed displacement values

The true_dofs list can be determined using functions from the mfem::ParFiniteElementSpace class.

Note
The coefficient is required to be vector-valued. However, only the dofs specified in the true_dofs array will be set. This means that if the true_dofs array only contains dofs for a specific vector component in a vector-valued finite element space, only that component will be set.
This method must be called prior to completeSetup()

Definition at line 535 of file solid_mechanics.hpp.

◆ setMaterial()

template<int order, int dim, typename... parameter_space, int... parameter_indices>
template<int... active_parameters, typename MaterialType , typename StateType = Empty>
void serac::SolidMechanics< order, dim, Parameters< parameter_space... >, std::integer_sequence< int, parameter_indices... > >::setMaterial ( DependsOn< active_parameters... >  ,
MaterialType  material,
qdata_type< StateType >  qdata = EmptyQData 
)
inline

Set the material stress response and mass properties for the physics module.

Template Parameters
MaterialTypeThe solid material type
StateTypethe type that contains the internal variables for MaterialType
Parameters
materialA material that provides a function to evaluate stress
Precondition
material must be a object that can be called with the following arguments:
  1. MaterialType::State & state an mutable reference to the internal variables for this quadrature point
  2. tensor<T,dim,dim> du_dx the displacement gradient at this quadrature point
  3. tuple{value, derivative}, a tuple of values and derivatives for each parameter field specified in the DependsOn<...> argument.
Note
The actual types of these arguments passed will be double, tensor<double, ... > or tuples thereof when doing direct evaluation. When differentiating with respect to one of the inputs, its stored values will change to dual numbers rather than double. (e.g. tensor<double,3> becomes tensor<dual<...>, 3>)
Parameters
qdatathe buffer of material internal variables at each quadrature point
Precondition
MaterialType must have a public member variable density
MaterialType must define operator() that returns the Cauchy stress
Note
This method must be called prior to completeSetup()

Definition at line 829 of file solid_mechanics.hpp.

◆ setPressure()

template<int order, int dim, typename... parameter_space, int... parameter_indices>
template<int... active_parameters, typename PressureType >
void serac::SolidMechanics< order, dim, Parameters< parameter_space... >, std::integer_sequence< int, parameter_indices... > >::setPressure ( DependsOn< active_parameters... >  ,
PressureType  pressure_function,
const std::optional< Domain > &  optional_domain = std::nullopt 
)
inline

Set the pressure boundary condition.

Template Parameters
PressureTypeThe type of the pressure load
Parameters
pressure_functionA function describing the pressure applied to a boundary
optional_domainThe domain over which the pressure is applied. If nothing is supplied the entire boundary is used.
Precondition
PressureType must be a object that can be called with the following arguments:
  1. tensor<T,dim> x the reference configuration spatial coordinates for the quadrature point
  2. double t the time (note: time will be handled differently in the future)
  3. tuple{value, derivative}, a variadic list of tuples (each with a values and derivative), one tuple for each of the trial spaces specified in the DependsOn<...> argument.
Note
The actual types of these arguments passed will be double, tensor<double, ... > or tuples thereof when doing direct evaluation. When differentiating with respect to one of the inputs, its stored values will change to dual numbers rather than double. (e.g. tensor<double,3> becomes tensor<dual<...>, 3>)
This pressure is applied in the deformed (current) configuration if GeometricNonlinearities are on.
This method must be called prior to completeSetup()

Definition at line 1004 of file solid_mechanics.hpp.

◆ setState()

template<int order, int dim, typename... parameter_space, int... parameter_indices>
void serac::SolidMechanics< order, dim, Parameters< parameter_space... >, std::integer_sequence< int, parameter_indices... > >::setState ( const std::string &  state_name,
const FiniteElementState state 
)
inlineoverridevirtual

Set the primal solution field (displacement, velocity) for the underlying solid mechanics solver.

Parameters
state_nameThe name of the field to initialize ("displacement", or "velocity")
stateThe finite element state vector containing the values for either the displacement or velocity fields

It is expected that state has the same underlying finite element space and mesh as the selected primal solution field.

Implements serac::BasePhysics.

Definition at line 677 of file solid_mechanics.hpp.

◆ setTraction()

template<int order, int dim, typename... parameter_space, int... parameter_indices>
template<int... active_parameters, typename TractionType >
void serac::SolidMechanics< order, dim, Parameters< parameter_space... >, std::integer_sequence< int, parameter_indices... > >::setTraction ( DependsOn< active_parameters... >  ,
TractionType  traction_function,
const std::optional< Domain > &  optional_domain = std::nullopt 
)
inline

Set the traction boundary condition.

Template Parameters
TractionTypeThe type of the traction load
Parameters
traction_functionA function describing the traction applied to a boundary
optional_domainThe domain over which the traction is applied. If nothing is supplied the entire boundary is used.
Precondition
TractionType must be a object that can be called with the following arguments:
  1. tensor<T,dim> x the spatial coordinates for the quadrature point
  2. tensor<T,dim> n the outward-facing unit normal for the quadrature point
  3. double t the time (note: time will be handled differently in the future)
  4. tuple{value, derivative}, a variadic list of tuples (each with a values and derivative), one tuple for each of the trial spaces specified in the DependsOn<...> argument.
Note
The actual types of these arguments passed will be double, tensor<double, ... > or tuples thereof when doing direct evaluation. When differentiating with respect to one of the inputs, its stored values will change to dual numbers rather than double. (e.g. tensor<double,3> becomes tensor<dual<...>, 3>)
This traction is applied in the reference (undeformed) configuration.
This method must be called prior to completeSetup()

Definition at line 959 of file solid_mechanics.hpp.

◆ setVelocity()

template<int order, int dim, typename... parameter_space, int... parameter_indices>
void serac::SolidMechanics< order, dim, Parameters< parameter_space... >, std::integer_sequence< int, parameter_indices... > >::setVelocity ( std::function< void(const mfem::Vector &x, mfem::Vector &vel)>  vel)
inline

Set the underlying finite element state to a prescribed velocity.

Parameters
velThe function describing the velocity field

Definition at line 885 of file solid_mechanics.hpp.

◆ state()

template<int order, int dim, typename... parameter_space, int... parameter_indices>
const FiniteElementState& serac::SolidMechanics< order, dim, Parameters< parameter_space... >, std::integer_sequence< int, parameter_indices... > >::state ( const std::string &  state_name) const
inlineoverridevirtual

Accessor for getting named finite element state fields from the physics modules.

Parameters
state_nameThe name of the Finite Element State to retrieve
Returns
The named Finite Element State

Implements serac::BasePhysics.

Definition at line 653 of file solid_mechanics.hpp.

◆ stateNames()

template<int order, int dim, typename... parameter_space, int... parameter_indices>
std::vector<std::string> serac::SolidMechanics< order, dim, Parameters< parameter_space... >, std::integer_sequence< int, parameter_indices... > >::stateNames ( ) const
inlineoverridevirtual

Get a vector of the finite element state solution variable names.

Returns
The solution variable names

Implements serac::BasePhysics.

Definition at line 703 of file solid_mechanics.hpp.

◆ stiffnessMatrix()

template<int order, int dim, typename... parameter_space, int... parameter_indices>
std::pair<const mfem::HypreParMatrix&, const mfem::HypreParMatrix&> serac::SolidMechanics< order, dim, Parameters< parameter_space... >, std::integer_sequence< int, parameter_indices... > >::stiffnessMatrix ( ) const
inline

Return the assembled stiffness matrix.

This method returns a pair {K, K_e} representing the last computed linearized stiffness matrix. The K matrix has the essential degree of freedom rows and columns zeroed with a 1 on the diagonal and K_e contains the zeroed rows and columns, e.g. K_total = K + K_e.

Warning
This interface is not stable and may change in the future.
Returns
A pair of the eliminated stiffness matrix and a matrix containing the eliminated rows and cols

Definition at line 1087 of file solid_mechanics.hpp.

◆ velocity()

template<int order, int dim, typename... parameter_space, int... parameter_indices>
const serac::FiniteElementState& serac::SolidMechanics< order, dim, Parameters< parameter_space... >, std::integer_sequence< int, parameter_indices... > >::velocity ( ) const
inline

Get the velocity state.

Returns
A reference to the current velocity finite element state

Definition at line 1454 of file solid_mechanics.hpp.

Member Data Documentation

◆ d_residual_d_

template<int order, int dim, typename... parameter_space, int... parameter_indices>
std::array<std::function<decltype((*residual_)(DifferentiateWRT<1>{}, 0.0, shape_displacement_, displacement_, acceleration_, *parameters_[parameter_indices].state...))(double)>, sizeof...(parameter_indices)> serac::SolidMechanics< order, dim, Parameters< parameter_space... >, std::integer_sequence< int, parameter_indices... > >::d_residual_d_
protected
Initial value:
= {[&](double t) {
return (*residual_)(DifferentiateWRT<NUM_STATE_VARS + 1 + parameter_indices>{}, t, shape_displacement_,
displacement_, acceleration_, *parameters_[parameter_indices].state...);
}...}
FiniteElementState & shape_displacement_
The parameter info associated with the shape displacement field.
std::vector< ParameterInfo > parameters_
A vector of the parameters associated with this physics module.
std::unique_ptr< ShapeAwareFunctional< shape_trial, test(trial, trial, parameter_space...)> > residual_
serac::Functional that is used to calculate the residual and its derivatives

Array functions computing the derivative of the residual with respect to each given parameter.

Note
This is needed so the user can ask for a specific sensitivity at runtime as opposed to it being a template parameter.

Definition at line 1567 of file solid_mechanics.hpp.

◆ J_e_

template<int order, int dim, typename... parameter_space, int... parameter_indices>
std::unique_ptr<mfem::HypreParMatrix> serac::SolidMechanics< order, dim, Parameters< parameter_space... >, std::integer_sequence< int, parameter_indices... > >::J_e_
protected

rows and columns of J_ that have been separated out because are associated with essential boundary conditions

Definition at line 1529 of file solid_mechanics.hpp.


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