|
Smith
0.1
Smith is an implicit thermal structural mechanics simulation code.
|
Manages storage and metadata for fields, parameters, and weak forms. More...
#include <field_store.hpp>
Classes | |
| struct | TimeIntegrationMapping |
| Mapping between primary and history/derivative fields for time integration. More... | |
Public Types | |
| enum class | TimeDerivative { VAL , DOT , DDOT , DDDOT } |
| Enum for different types of time derivatives. More... | |
Public Member Functions | |
| FieldStore (std::shared_ptr< Mesh > mesh, size_t storage_size=50) | |
| Construct a new FieldStore object. More... | |
| template<typename Space > | |
| void | addShapeDisp (FieldType< Space > type) |
| Add a shape displacement field to the store. More... | |
| template<typename Space > | |
| void | addParameter (FieldType< Space > type) |
| Add a parameter field to the store. More... | |
| template<typename Space > | |
| std::shared_ptr< DirichletBoundaryConditions > | addIndependent (FieldType< Space > &type, std::shared_ptr< TimeIntegrationRule > time_rule) |
| Add an independent field (a solver unknown) to the store. More... | |
| template<typename Space > | |
| auto | addDependent (FieldType< Space > independent_field, TimeDerivative derivative, std::string name_override="") |
| Add a dependent field (history value, velocity, or acceleration) to the store. More... | |
| void | addWeakFormUnknownArg (std::string weak_form_name, std::string argument_name, size_t argument_index) |
| Register an argument to a weak form as an unknown. More... | |
| void | addWeakFormArg (std::string weak_form_name, std::string argument_name, size_t argument_index) |
| Register an argument to a weak form. More... | |
| size_t | getNumUnknowns () const |
| Get the number of unknowns in the field store. More... | |
| void | addWeakFormReaction (std::string weak_form_name, std::string field_name) |
| Register the reaction (test) field for a weak form. More... | |
| std::string | getWeakFormReaction (const std::string &weak_form_name) const |
| Get the name of the reaction (test) field for a weak form. More... | |
| template<typename... FieldTypes> | |
| std::vector< const mfem::ParFiniteElementSpace * > | createSpaces (const std::string &weak_form_name, const std::string &reaction_field_name, FieldTypes... types) |
| Register all input fields for a weak form and return their FE spaces. More... | |
| const std::vector< std::pair< std::shared_ptr< TimeIntegrationRule >, TimeIntegrationMapping > > & | getTimeIntegrationRules () const |
| Get all registered time integration rules and their mappings. More... | |
| void | printMap () |
| Print the internal field maps for debugging. | |
| std::vector< std::vector< size_t > > | indexMap (const std::vector< std::string > &residual_names) const |
| Generate an index map for the residuals. More... | |
| std::vector< const BoundaryConditionManager * > | getBoundaryConditionManagers () const |
| Get the boundary condition managers for all independent fields. More... | |
| std::shared_ptr< DirichletBoundaryConditions > | getBoundaryConditions (size_t unknown_index) const |
| Get the Dirichlet boundary conditions for an independent field by its unknown index. More... | |
| size_t | getFieldIndex (const std::string &field_name) const |
| Get the internal index of a field by name. More... | |
| size_t | getUnknownIndex (const std::string &field_name) const |
| Get the unknown index of a field by name. More... | |
| FieldState | getField (const std::string &field_name) const |
| Get a FieldState by name. More... | |
| FieldState | getParameter (const std::string ¶m_name) const |
| Get a parameter field by name. More... | |
| void | setField (const std::string &field_name, FieldState updated_field) |
| Update a field in the store by name. More... | |
| void | setField (size_t index, FieldState updated_field) |
| Update a field in the store by index. More... | |
| FieldState | getShapeDisp () const |
| Get the shape displacement field. More... | |
| const std::vector< FieldState > & | getAllFields () const |
| Get all fields stored in the FieldStore. More... | |
| std::vector< FieldState > | getStates (const std::string &weak_form_name) const |
| Get the state fields associated with a weak form. More... | |
| std::vector< FieldState > | getStatesFromVectors (const std::string &weak_form_name, const std::vector< FieldState > &state_fields, const std::vector< FieldState > ¶m_fields) const |
| Extract state fields for a weak form from provided state and parameter vectors. More... | |
| const std::shared_ptr< smith::Mesh > & | getMesh () const |
| Get the associated mesh. More... | |
| const std::shared_ptr< gretl::DataStore > & | graph () const |
| Get the associated data store graph. More... | |
Manages storage and metadata for fields, parameters, and weak forms.
Definition at line 44 of file field_store.hpp.
|
strong |
Enum for different types of time derivatives.
| Enumerator | |
|---|---|
| DOT | The first time derivative. |
| DDOT | The second time derivative. |
| DDDOT | The third time derivative. |
Definition at line 55 of file field_store.hpp.
| smith::FieldStore::FieldStore | ( | std::shared_ptr< Mesh > | mesh, |
| size_t | storage_size = 50 |
||
| ) |
Construct a new FieldStore object.
| mesh | The mesh associated with the fields. |
| storage_size | Initial storage size for fields (default: 50). |
Definition at line 14 of file field_store.cpp.
|
inline |
Add a dependent field (history value, velocity, or acceleration) to the store.
Creates and registers a new field that carries the previous time-step value of a particular time derivative of an independent field. The relationship is recorded in the TimeIntegrationMapping for the parent independent field so that, at evaluation time, the time integration rule can reconstruct the current rate from the pair (predicted_value, stored_old_value).
Return value: a FieldType<Space> whose name is the name of the newly registered field. This object is intentionally returned (rather than discarded) so that callers can pass it directly to createSpaces when assembling the weak-form argument list. The position at which a FieldType appears in that argument list determines which slot of the lambda the field occupies at quadrature-point evaluation time, which is how the time integration rules reconstruct quantities such as \( \dot{\alpha} = (\alpha_\text{predicted} - \alpha_\text{old}) / \Delta t \).
The field name is derived automatically from the independent field's name plus a suffix that reflects the derivative level (_old for VALUE, _dot_old for DOT, _ddot_old for DDOT), unless name_override is supplied.
| Space | The finite element space type (must match the independent field). |
| independent_field | The FieldType of the independent (predicted) field. |
| derivative | Which time-derivative level this history field stores. |
| name_override | If non-empty, use this as the field name instead of the auto-generated one. |
createSpaces to register it as a weak-form argument. Definition at line 154 of file field_store.hpp.
|
inline |
Add an independent field (a solver unknown) to the store.
Registers the field as an unknown and assigns it an index in the solver's block structure. The type argument is mutated in-place: its unknown_index is set to the assigned index, so the same FieldType<Space> object can later be passed to createSpaces to tell the weak form that this argument is an active unknown (i.e. the Jacobian should be computed with respect to it).
| Space | The finite element space type. |
| type | The field type specification; type.unknown_index is set on return. |
| time_rule | The time integration rule governing how this unknown and its dependents are related across time steps. |
Definition at line 102 of file field_store.hpp.
|
inline |
Add a parameter field to the store.
| Space | The finite element space type. |
| type | The field type specification. |
Definition at line 80 of file field_store.hpp.
|
inline |
Add a shape displacement field to the store.
| Space | The finite element space type. |
| type | The field type specification. |
Definition at line 69 of file field_store.hpp.
| void smith::FieldStore::addWeakFormArg | ( | std::string | weak_form_name, |
| std::string | argument_name, | ||
| size_t | argument_index | ||
| ) |
Register an argument to a weak form.
| weak_form_name | Name of the weak form. |
| argument_name | Name of the argument field. |
| argument_index | Index of the argument in the weak form's argument list. |
Definition at line 36 of file field_store.cpp.
| void smith::FieldStore::addWeakFormReaction | ( | std::string | weak_form_name, |
| std::string | field_name | ||
| ) |
Register the reaction (test) field for a weak form.
The reaction field is the field whose test function space the weak form integrates against. It determines which field's degrees of freedom the assembled residual is "returned to" (i.e. the field whose force/flux vector is populated).
| weak_form_name | Name of the weak form. |
| field_name | Name of the reaction field. |
Definition at line 214 of file field_store.cpp.
| void smith::FieldStore::addWeakFormUnknownArg | ( | std::string | weak_form_name, |
| std::string | argument_name, | ||
| size_t | argument_index | ||
| ) |
Register an argument to a weak form as an unknown.
| weak_form_name | Name of the weak form. |
| argument_name | Name of the argument field. |
| argument_index | Index of the argument in the weak form's argument list. |
Definition at line 26 of file field_store.cpp.
|
inline |
Register all input fields for a weak form and return their FE spaces.
This is the primary setup method for constructing a weak form. It:
reaction_field_name as the reaction/test field via addWeakFormReaction.FieldType in types (in order), registering each as an input argument to the weak form and recording whether it is an active unknown.TimeDiscretizedWeakForm constructor without creating a named temporary.| weak_form_name | Name of the weak form being constructed. |
| reaction_field_name | Name of the test/reaction field (may differ from the first input). |
| types | Ordered list of FieldType descriptors for every input argument. |
Definition at line 246 of file field_store.hpp.
| const std::vector< FieldState > & smith::FieldStore::getAllFields | ( | ) | const |
Get all fields stored in the FieldStore.
Definition at line 137 of file field_store.cpp.
| std::vector< const BoundaryConditionManager * > smith::FieldStore::getBoundaryConditionManagers | ( | ) | const |
Get the boundary condition managers for all independent fields.
Definition at line 80 of file field_store.cpp.
| std::shared_ptr< DirichletBoundaryConditions > smith::FieldStore::getBoundaryConditions | ( | size_t | unknown_index | ) | const |
Get the Dirichlet boundary conditions for an independent field by its unknown index.
| unknown_index | The unknown index of the independent field. |
Definition at line 89 of file field_store.cpp.
| FieldState smith::FieldStore::getField | ( | const std::string & | field_name | ) | const |
Get a FieldState by name.
| field_name | Name of the field. |
Definition at line 107 of file field_store.cpp.
| size_t smith::FieldStore::getFieldIndex | ( | const std::string & | field_name | ) | const |
Get the internal index of a field by name.
| field_name | Name of the field. |
Definition at line 95 of file field_store.cpp.
| const std::shared_ptr< smith::Mesh > & smith::FieldStore::getMesh | ( | ) | const |
Get the associated mesh.
Definition at line 200 of file field_store.cpp.
|
inline |
Get the number of unknowns in the field store.
Definition at line 209 of file field_store.hpp.
| FieldState smith::FieldStore::getParameter | ( | const std::string & | param_name | ) | const |
Get a parameter field by name.
| param_name | Name of the parameter. |
Definition at line 123 of file field_store.cpp.
| FieldState smith::FieldStore::getShapeDisp | ( | ) | const |
Get the shape displacement field.
Definition at line 135 of file field_store.cpp.
| std::vector< FieldState > smith::FieldStore::getStates | ( | const std::string & | weak_form_name | ) | const |
Get the state fields associated with a weak form.
| weak_form_name | Name of the weak form. |
Definition at line 139 of file field_store.cpp.
| std::vector< FieldState > smith::FieldStore::getStatesFromVectors | ( | const std::string & | weak_form_name, |
| const std::vector< FieldState > & | state_fields, | ||
| const std::vector< FieldState > & | param_fields | ||
| ) | const |
Extract state fields for a weak form from provided state and parameter vectors.
| weak_form_name | Name of the weak form. |
| state_fields | Vector of all state fields. |
| param_fields | Vector of all parameter fields. |
Definition at line 164 of file field_store.cpp.
| const std::vector< std::pair< std::shared_ptr< TimeIntegrationRule >, FieldStore::TimeIntegrationMapping > > & smith::FieldStore::getTimeIntegrationRules | ( | ) | const |
Get all registered time integration rules and their mappings.
Definition at line 205 of file field_store.cpp.
| size_t smith::FieldStore::getUnknownIndex | ( | const std::string & | field_name | ) | const |
Get the unknown index of a field by name.
| field_name | Name of the field. |
Definition at line 210 of file field_store.cpp.
| std::string smith::FieldStore::getWeakFormReaction | ( | const std::string & | weak_form_name | ) | const |
Get the name of the reaction (test) field for a weak form.
| weak_form_name | Name of the weak form. |
Definition at line 219 of file field_store.cpp.
| const std::shared_ptr< gretl::DataStore > & smith::FieldStore::graph | ( | ) | const |
Get the associated data store graph.
Definition at line 202 of file field_store.cpp.
| std::vector< std::vector< size_t > > smith::FieldStore::indexMap | ( | const std::vector< std::string > & | residual_names | ) | const |
Generate an index map for the residuals.
| residual_names | Names of the residuals. |
Definition at line 59 of file field_store.cpp.
| void smith::FieldStore::setField | ( | const std::string & | field_name, |
| FieldState | updated_field | ||
| ) |
Update a field in the store by name.
| field_name | Name of the field. |
| updated_field | The new field state. |
Definition at line 129 of file field_store.cpp.
| void smith::FieldStore::setField | ( | size_t | index, |
| FieldState | updated_field | ||
| ) |
Update a field in the store by index.
| index | Index of the field. |
| updated_field | The new field state. |
Definition at line 212 of file field_store.cpp.