Smith  0.1
Smith is an implicit thermal structural mechanics simulation code.
Classes | Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
smith::BasePhysics Class Referenceabstract

This is the abstract base class for a generic forward solver. More...

#include <base_physics.hpp>

Collaboration diagram for smith::BasePhysics:
Collaboration graph
[legend]

Classes

struct  ParameterInfo
 The information needed for the physics parameters stored as Finite Element State fields. More...
 

Public Member Functions

 BasePhysics (std::string physics_name, std::shared_ptr< smith::Mesh > mesh, 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 const std::vector< double > & timesteps () const
 Get a vector of the timestep sizes (i.e. \(\Delta t\)s) taken by the forward solver. More...
 
virtual void resetStates (int cycle=0, double time=0.0)=0
 Base method to reset physics states to the initial time. This does not reset design parameters or shape. More...
 
virtual void resetAdjointStates ()
 Base method to reset physics states back to the end of time to start adjoint calculations again. This does not reset design parameters or shape.
 
virtual void completeSetup ()=0
 Complete the setup and allocate the necessary data structures. More...
 
virtual const FiniteElementStatestate (const std::string &state_name) const =0
 Accessor for getting named finite element state primal solution from the physics modules. More...
 
virtual void setState (const std::string &, const FiniteElementState &)=0
 Set the primal solution field values of the underlying physics solver.
 
virtual std::vector< std::string > stateNames () const =0
 Get a vector of the finite element state primal solution names. More...
 
virtual const FiniteElementStateadjoint (const std::string &adjoint_name) const =0
 Accessor for getting named finite element state adjoint solution from the physics modules. More...
 
virtual std::vector< std::string > adjointNames () const
 Get a vector of the finite element state adjoint solution names. More...
 
virtual std::vector< std::string > dualNames () const
 Get a vector of the finite element state dual (reaction) solution names. More...
 
virtual const FiniteElementDualdual (const std::string &dual_name) const
 Accessor for getting named finite element state dual (reaction) solution from the physics modules. More...
 
virtual const FiniteElementStatedualAdjoint (const std::string &dual_name) const
 Accessor for getting named finite element state dual adjoint (reaction adjoint load) from the physics modules. More...
 
virtual const FiniteElementStateshapeDisplacement () const
 Accessor for getting the shape displacement field from the physics modules. More...
 
virtual const FiniteElementStateparameter (const std::string &parameter_name) const
 Accessor for getting named finite element state parameter fields from the physics modules. More...
 
virtual const FiniteElementStateparameter (std::size_t parameter_index) const
 Accessor for getting indexed finite element state parameter fields from the physics modules. More...
 
virtual std::vector< std::string > parameterNames () const
 Get a vector of the finite element state parameter names. More...
 
virtual 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...
 
virtual void setShapeDisplacement (const FiniteElementState &shape_displacement)
 Set the current shape displacement for the underlying mesh. More...
 
virtual FiniteElementDual computeTimestepSensitivity (size_t parameter_index)
 Compute the implicit sensitivity of the quantity of interest used in defining the adjoint load with respect to the parameter field (d QOI/d state * d state/d parameter). More...
 
virtual const FiniteElementDualcomputeTimestepShapeSensitivity ()
 Compute the implicit sensitivity of the quantity of interest used in defining the adjoint load with respect to the shape displacement field (d QOI/d state * d state/d shape displacement). More...
 
virtual const std::unordered_map< std::string, const smith::FiniteElementDual & > computeInitialConditionSensitivity () const
 Compute the implicit sensitivity of the quantity of interest with respect to the initial condition fields. More...
 
virtual void advanceTimestep (double dt)=0
 Advance the state variables according to the chosen time integrator. More...
 
virtual void setAdjointLoad (std::unordered_map< std::string, const smith::FiniteElementDual & > string_to_dual)
 Set the loads for the adjoint reverse timestep solve. More...
 
virtual void setDualAdjointBcs (std::unordered_map< std::string, const smith::FiniteElementState & > string_to_bc)
 Set the dual loads (dirichlet values) for the adjoint reverse timestep solve This must be called after setAdjointLoad. More...
 
virtual void reverseAdjointTimestep ()
 Solve the adjoint reverse timestep problem. More...
 
virtual void initializationStep ()
 Initialize any fields nessary for before the first step of the time integration.
 
virtual void reverseAdjointInitializationStep ()
 Compute adjoint sensitivities back through initializationStep.
 
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...
 
void loadCheckpointedStatesFromDisk (int cycle)
 load checkpointed states from disk into states array More...
 
virtual FiniteElementState loadCheckpointedState (const std::string &state_name, int cycle)
 Accessor for getting a single named finite element state primal solution from the physics modules at a given checkpointed cycle index. More...
 
virtual FiniteElementDual loadCheckpointedDual ([[maybe_unused]] const std::string &state_name, [[maybe_unused]] int cycle)
 Accessor for getting a single named finite element dual 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 smith::Meshmesh () const
 Returns a reference to the mesh object.
 
const mfem::ParMesh & mfemParMesh () const
 Returns a reference to the mfem ParMesh object.
 
mfem::ParMesh & mfemParMesh ()
 Returns a reference to the mfem ParMesh object.
 
std::string name () const
 Return the name of the physics.
 

Protected Member Functions

const FiniteElementDualshapeDisplacementSensitivity () const
 Internally used accessor for getting the shape displacement sensitivity from the physics modules. More...
 
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...
 
std::unordered_map< std::string, FiniteElementStategetCheckpointedStates (int cycle)
 Accessor for getting all of the primal solutions from the physics modules at a given checkpointed cycle index. More...
 

Protected Attributes

std::string name_ = {}
 Name of the physics module.
 
std::shared_ptr< smith::Meshmesh_
 The primary mesh.
 
MPI_Comm comm_
 The MPI communicator.
 
std::vector< const smith::FiniteElementState * > states_
 List of finite element primal states associated with this physics module.
 
std::vector< const smith::FiniteElementState * > adjoints_
 List of finite element adjoint states associated with this physics module.
 
std::vector< const smith::FiniteElementDual * > duals_
 List of finite element duals associated with this physics module.
 
std::vector< const smith::FiniteElementState * > dual_adjoints_
 List of adjoint finite element duals associated with this physics module.
 
std::vector< ParameterInfoparameters_
 A vector of the parameters associated with this physics module.
 
std::unordered_map< std::string, std::vector< smith::FiniteElementState > > checkpoint_states_
 A map containing optionally in-memory checkpointed primal states for transient adjoint solvers.
 
std::unordered_map< std::string, smith::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 dt_
 Current time step.
 
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.
 
smith::FiniteElementState shape_displacement_
 The shape displacement field.
 
smith::FiniteElementDual shape_displacement_dual_
 The shape displacement field sensitivity.
 
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.
 

Static Protected Attributes

static constexpr int FLOAT_PRECISION_ = 8
 Number of significant figures to output for floating-point.
 

Detailed Description

This is the abstract base class for a generic forward solver.

Definition at line 61 of file base_physics.hpp.

Constructor & Destructor Documentation

◆ BasePhysics() [1/2]

smith::BasePhysics::BasePhysics ( std::string  physics_name,
std::shared_ptr< smith::Mesh mesh,
int  cycle = 0,
double  time = 0.0,
bool  checkpoint_to_disk = false 
)

Empty constructor.

Parameters
[in]physics_nameName of the physics module instance
[in]meshThe mesh used to construct the physics 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
[in]checkpoint_to_diskA flag to save the transient states on disk instead of memory for the transient adjoint solves

Definition at line 22 of file base_physics.cpp.

◆ BasePhysics() [2/2]

smith::BasePhysics::BasePhysics ( BasePhysics &&  other)
default

Construct a new Base Physics object (copy constructor)

Parameters
otherThe other base physics to copy from

Member Function Documentation

◆ adjoint()

virtual const FiniteElementState& smith::BasePhysics::adjoint ( const std::string &  adjoint_name) const
pure virtual

◆ adjointNames()

virtual std::vector<std::string> smith::BasePhysics::adjointNames ( ) const
inlinevirtual

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

Returns
The adjoint solution names

Reimplemented in smith::SolidMechanics< order, dim, Parameters< parameter_space... >, std::integer_sequence< int, parameter_indices... > >.

Definition at line 198 of file base_physics.hpp.

◆ advanceTimestep()

virtual void smith::BasePhysics::advanceTimestep ( double  dt)
pure virtual

Advance the state variables according to the chosen time integrator.

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 physical system

Implemented in smith::ThermomechanicsMonolithic< order, dim, Parameters< parameter_space... >, std::integer_sequence< int, parameter_indices... > >, smith::Thermomechanics< order, dim, parameter_space >, smith::SolidMechanics< order, dim, Parameters< parameter_space... >, std::integer_sequence< int, parameter_indices... > >, and smith::HeatTransfer< order, dim, Parameters< parameter_space... >, std::integer_sequence< int, parameter_indices... > >.

◆ completeSetup()

virtual void smith::BasePhysics::completeSetup ( )
pure virtual

◆ computeInitialConditionSensitivity()

virtual const std::unordered_map<std::string, const smith::FiniteElementDual&> smith::BasePhysics::computeInitialConditionSensitivity ( ) const
inlinevirtual

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

Returns
Fields states corresponding to the sensitivities with respect to the initial condition fields
Precondition
reverseAdjointTimestep with an appropriate adjoint load must be called prior to this method as many times as the forward advance is called.

Reimplemented in smith::SolidMechanics< order, dim, Parameters< parameter_space... >, std::integer_sequence< int, parameter_indices... > >, and smith::HeatTransfer< order, dim, Parameters< parameter_space... >, std::integer_sequence< int, parameter_indices... > >.

Definition at line 351 of file base_physics.hpp.

◆ computeTimestepSensitivity()

FiniteElementDual smith::BasePhysics::computeTimestepSensitivity ( size_t  parameter_index)
virtual

Compute the implicit sensitivity of the quantity of interest used in defining the adjoint load with respect to the parameter field (d QOI/d state * d state/d parameter).

Parameters
parameter_indexthe index of the parameter
Returns
The sensitivity of the QOI (given implicitly by the adjoint load) with respect to the parameter
Precondition
completeSetup(), advanceTimestep(), and reverseAdjointTimestep() must be called prior to this method.

Reimplemented in smith::ThermomechanicsMonolithic< order, dim, Parameters< parameter_space... >, std::integer_sequence< int, parameter_indices... > >, smith::SolidMechanics< order, dim, Parameters< parameter_space... >, std::integer_sequence< int, parameter_indices... > >, and smith::HeatTransfer< order, dim, Parameters< parameter_space... >, std::integer_sequence< int, parameter_indices... > >.

Definition at line 105 of file base_physics.cpp.

◆ computeTimestepShapeSensitivity()

const FiniteElementDual & smith::BasePhysics::computeTimestepShapeSensitivity ( )
virtual

◆ cycle()

int smith::BasePhysics::cycle ( ) const
virtual

Get the current forward-solution cycle iteration number.

Returns
The current forward-solution cycle iteration number

Definition at line 39 of file base_physics.cpp.

◆ dual()

virtual const FiniteElementDual& smith::BasePhysics::dual ( const std::string &  dual_name) const
inlinevirtual

Accessor for getting named finite element state dual (reaction) solution from the physics modules.

Parameters
dual_nameThe name of the Finite Element State dual solution to retrieve
Returns
The named dual Finite Element State

Reimplemented in smith::SolidMechanics< order, dim, Parameters< parameter_space... >, std::integer_sequence< int, parameter_indices... > >.

Definition at line 213 of file base_physics.hpp.

◆ dualAdjoint()

virtual const FiniteElementState& smith::BasePhysics::dualAdjoint ( const std::string &  dual_name) const
inlinevirtual

Accessor for getting named finite element state dual adjoint (reaction adjoint load) from the physics modules.

Parameters
dual_nameThe name of the Finite Element State dual (reaction adjoint load) solution to retrieve
Returns
The named adjoint Finite Element State

Reimplemented in smith::SolidMechanics< order, dim, Parameters< parameter_space... >, std::integer_sequence< int, parameter_indices... > >.

Definition at line 227 of file base_physics.hpp.

◆ dualNames()

virtual std::vector<std::string> smith::BasePhysics::dualNames ( ) const
inlinevirtual

Get a vector of the finite element state dual (reaction) solution names.

Returns
The dual solution names

Reimplemented in smith::SolidMechanics< order, dim, Parameters< parameter_space... >, std::integer_sequence< int, parameter_indices... > >.

Definition at line 205 of file base_physics.hpp.

◆ getCheckpointedStates()

std::unordered_map< std::string, FiniteElementState > smith::BasePhysics::getCheckpointedStates ( int  cycle)
protected

Accessor for getting all of the primal solutions from the physics modules at a given checkpointed cycle index.

Parameters
cycleThe cycle to retrieve state from
Returns
A map containing the primal field names and their associated FiniteElementStates at the requested cycle

Definition at line 374 of file base_physics.cpp.

◆ getCheckpointedTimestep()

double smith::BasePhysics::getCheckpointedTimestep ( int  cycle) const
virtual

Get a timestep increment which has been previously checkpointed at the give cycle.

Parameters
cycleThe previous 'timestep' number where the timestep increment is requested
Returns
The timestep increment

Definition at line 393 of file base_physics.cpp.

◆ initializeBasePhysicsStates()

void smith::BasePhysics::initializeBasePhysicsStates ( int  cycle,
double  time 
)
protected

Protected, non-virtual 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

Definition at line 57 of file base_physics.cpp.

◆ initializeSummary()

void smith::BasePhysics::initializeSummary ( axom::sidre::DataStore &  datastore,
const double  t_final,
const double  dt 
) const
virtual

Initializes the Sidre structure for simulation summary data.

Parameters
[in]datastoreSidre DataStore where data are saved
[in]t_finalFinal time of the simulation
[in]dtThe time step

Definition at line 223 of file base_physics.cpp.

◆ isQuasistatic()

bool smith::BasePhysics::isQuasistatic ( ) const
inline

Check if the physics is setup as quasistatic.

Returns
true if quasistatic, false if transient

Definition at line 129 of file base_physics.hpp.

◆ loadCheckpointedDual()

virtual FiniteElementDual smith::BasePhysics::loadCheckpointedDual ( [[maybe_unused] ] const std::string &  state_name,
[[maybe_unused] ] int  cycle 
)
inlinevirtual

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

Parameters
state_nameThe name of the state to retrieve (e.g. "reaction")
cycleThe cycle to retrieve state from
Returns
The named Finite Element Dual

Definition at line 447 of file base_physics.hpp.

◆ loadCheckpointedState()

FiniteElementState smith::BasePhysics::loadCheckpointedState ( const std::string &  state_name,
int  cycle 
)
virtual

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

Parameters
state_nameThe name of the state to retrieve (e.g. "temperature", "displacement")
cycleThe cycle to retrieve state from
Returns
The named primal Finite Element State

Definition at line 340 of file base_physics.cpp.

◆ loadCheckpointedStatesFromDisk()

void smith::BasePhysics::loadCheckpointedStatesFromDisk ( int  cycle)

load checkpointed states from disk into states array

Parameters
cycleThe cycle to retrieve state from

Definition at line 365 of file base_physics.cpp.

◆ maxCycle()

int smith::BasePhysics::maxCycle ( ) const
virtual

The maximum cycle (timestep iteration number) reached by the forward solver.

Returns
The maximum cycle reached by the forward solver

Definition at line 43 of file base_physics.cpp.

◆ maxTime()

double smith::BasePhysics::maxTime ( ) const
virtual

Get the maximum time reached by the forward solver.

Returns
The maximum time reached by the forward solver

Definition at line 41 of file base_physics.cpp.

◆ minCycle()

int smith::BasePhysics::minCycle ( ) const
virtual

Get the initial cycle (timestep iteration number) used by the forward solver.

Returns
The initial cycle used by the forward solver

Definition at line 47 of file base_physics.cpp.

◆ minTime()

double smith::BasePhysics::minTime ( ) const
virtual

Get the initial time used by the forward solver.

Returns
The initial time used by the forward solver

Definition at line 45 of file base_physics.cpp.

◆ outputStateToDisk()

void smith::BasePhysics::outputStateToDisk ( std::optional< std::string >  paraview_output_dir = {}) const
virtual

Output the current state of the PDE fields in Sidre format and optionally in Paraview format if paraview_output_dir is given.

Parameters
[in]paraview_output_dirOptional output directory for paraview visualization files

Definition at line 187 of file base_physics.cpp.

◆ parameter() [1/2]

virtual const FiniteElementState& smith::BasePhysics::parameter ( const std::string &  parameter_name) const
inlinevirtual

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

Parameters
parameter_nameThe name of the Finite Element State parameter to retrieve
Returns
The named parameter Finite Element State
Note
The input parameter name should not contain the base physics name. It should be identical to what is in the physics module constructor argument list.

Definition at line 250 of file base_physics.hpp.

◆ parameter() [2/2]

virtual const FiniteElementState& smith::BasePhysics::parameter ( std::size_t  parameter_index) const
inlinevirtual

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

Parameters
parameter_indexThe index of the Finite Element State parameter to retrieve
Returns
The indexed parameter Finite Element State

Definition at line 272 of file base_physics.hpp.

◆ parameterNames()

virtual std::vector<std::string> smith::BasePhysics::parameterNames ( ) const
inlinevirtual

Get a vector of the finite element state parameter names.

Returns
The parameter names

Definition at line 287 of file base_physics.hpp.

◆ resetStates()

virtual void smith::BasePhysics::resetStates ( int  cycle = 0,
double  time = 0.0 
)
pure virtual

◆ reverseAdjointTimestep()

virtual void smith::BasePhysics::reverseAdjointTimestep ( )
inlinevirtual

Solve the adjoint reverse timestep problem.

Precondition
It is expected that the forward analysis is complete and the current states are valid
It is expected that the adjoint load has already been set in setAdjointLoad

Reimplemented in smith::ThermomechanicsMonolithic< order, dim, Parameters< parameter_space... >, std::integer_sequence< int, parameter_indices... > >, smith::SolidMechanics< order, dim, Parameters< parameter_space... >, std::integer_sequence< int, parameter_indices... > >, and smith::HeatTransfer< order, dim, Parameters< parameter_space... >, std::integer_sequence< int, parameter_indices... > >.

Definition at line 399 of file base_physics.hpp.

◆ saveSummary()

void smith::BasePhysics::saveSummary ( axom::sidre::DataStore &  datastore,
const double  t 
) const
virtual

Saves the summary data to the Sidre Datastore.

Parameters
[in]datastoreSidre DataStore where curves are saved
[in]tThe current time of the simulation

Definition at line 276 of file base_physics.cpp.

◆ setAdjointLoad()

virtual void smith::BasePhysics::setAdjointLoad ( std::unordered_map< std::string, const smith::FiniteElementDual & >  string_to_dual)
inlinevirtual

Set the loads for the adjoint reverse timestep solve.

Parameters
string_to_dualAn unorder map from the state field name string to the finite element adjoint/dual load The adjoint load is d(qoi)/d(state)

Reimplemented in smith::ThermomechanicsMonolithic< order, dim, Parameters< parameter_space... >, std::integer_sequence< int, parameter_indices... > >, smith::SolidMechanics< order, dim, Parameters< parameter_space... >, std::integer_sequence< int, parameter_indices... > >, and smith::HeatTransfer< order, dim, Parameters< parameter_space... >, std::integer_sequence< int, parameter_indices... > >.

Definition at line 372 of file base_physics.hpp.

◆ setDualAdjointBcs()

virtual void smith::BasePhysics::setDualAdjointBcs ( std::unordered_map< std::string, const smith::FiniteElementState & >  string_to_bc)
inlinevirtual

Set the dual loads (dirichlet values) for the adjoint reverse timestep solve This must be called after setAdjointLoad.

Parameters
string_to_bcAn unorder map from dual name string to finite element adjoint/state boundary condition The adjoint bc is d(qoi)/d(dual)

Reimplemented in smith::SolidMechanics< order, dim, Parameters< parameter_space... >, std::integer_sequence< int, parameter_indices... > >.

Definition at line 386 of file base_physics.hpp.

◆ setParameter()

void smith::BasePhysics::setParameter ( const size_t  parameter_index,
const FiniteElementState parameter_state 
)
virtual

Deep copy a parameter field into the internally-owned parameter used for simulations.

Parameters
parameter_indexthe index of the parameter
parameter_statethe values to use for the specified parameter
Precondition
The discretization space and mesh for this finite element state must be consistent with the arguments provided in the physics module constructor.

The physics module constructs its own parameter FiniteElementState in the physics module constructor. This call sets the internally-owned parameter object by value (i.e. deep copies) from the given argument.

Definition at line 76 of file base_physics.cpp.

◆ setShapeDisplacement()

void smith::BasePhysics::setShapeDisplacement ( const FiniteElementState shape_displacement)
virtual

Set the current shape displacement for the underlying mesh.

Parameters
shape_displacementThe shape displacement to copy for use in the physics module

This updates the shape displacement field associated with the underlying mesh. Note that the input FiniteElementState is deep copied into the shape displacement object owned by the StateManager.

Definition at line 98 of file base_physics.cpp.

◆ shapeDisplacement()

const FiniteElementState & smith::BasePhysics::shapeDisplacement ( ) const
virtual

Accessor for getting the shape displacement field from the physics modules.

Returns
The shape displacement finite element state

Definition at line 96 of file base_physics.cpp.

◆ shapeDisplacementSensitivity()

const FiniteElementDual & smith::BasePhysics::shapeDisplacementSensitivity ( ) const
protected

Internally used accessor for getting the shape displacement sensitivity from the physics modules.

Returns
The shape displacement sensitivity dual

Definition at line 103 of file base_physics.cpp.

◆ state()

virtual const FiniteElementState& smith::BasePhysics::state ( const std::string &  state_name) const
pure virtual

◆ stateNames()

virtual std::vector<std::string> smith::BasePhysics::stateNames ( ) const
pure virtual

◆ time()

double smith::BasePhysics::time ( ) const
virtual

Get the current forward-solution time.

Returns
The current forward-solution time

Definition at line 37 of file base_physics.cpp.

◆ timesteps()

const std::vector< double > & smith::BasePhysics::timesteps ( ) const
virtual

Get a vector of the timestep sizes (i.e. \(\Delta t\)s) taken by the forward solver.

Returns
The vector of timestep sizes taken by the foward solver

Definition at line 49 of file base_physics.cpp.

◆ UpdateParaviewDataCollection()

void smith::BasePhysics::UpdateParaviewDataCollection ( const std::string &  paraview_output_dir) const
protected

Update the paraview states, duals, parameters, and metadata (cycle, time) in preparation for output.

Parameters
paraview_output_dirThe directory to write the paraview output

Definition at line 164 of file base_physics.cpp.

Member Data Documentation

◆ cached_checkpoint_states_

std::unordered_map<std::string, smith::FiniteElementState> smith::BasePhysics::cached_checkpoint_states_
mutableprotected

A container relating a checkpointed cycle and the associated finite element state fields.

Note
This is only used when the disk-based checkpointing is used. It avoids thrashing the disk IO by performing a file open/read/close for every separate retrieval of state checkpoint data for the various primal fields.

Definition at line 621 of file base_physics.hpp.


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