Smith  0.1
Smith is an implicit thermal structural mechanics simulation code.
Classes | Typedefs | Functions | Variables
smith::detail Namespace Reference

Internal solid mechanics builder after coupling fields are assembled. More...

Classes

struct  is_physics_fields_impl
 
struct  is_physics_fields_impl< PhysicsFields< D, O, R, S... > >
 
struct  is_parameter_pack_impl
 
struct  is_parameter_pack_impl< ParamFields< S... > >
 
struct  is_coupling_fields_impl
 
struct  is_coupling_fields_impl< CouplingFields< PFs... > >
 
struct  is_coupling_packs_impl
 True for a std::tuple<Packs...> returned by collectCouplingFields. More...
 
struct  is_coupling_packs_impl< std::tuple< Packs... > >
 
struct  FlattenCoupling
 Flatten a tuple<Packs...> type into Parameters<all_pack_spaces...>. More...
 
struct  TupleToParameters
 Converts a std::tuple<...> of spaces into Parameters<...>. More...
 
struct  TupleToParameters< std::tuple< Spaces... > >
 Specialization of TupleToParameters for a tuple of spaces. More...
 
struct  pack_tuple
 Maps a coupling pack type to a std::tuple<...> of its spaces. More...
 
struct  pack_tuple< PhysicsFields< D, O, R, Spaces... > >
 Specialization of pack_tuple for physics coupling fields. More...
 
struct  pack_tuple< ParamFields< Spaces... > >
 Specialization of pack_tuple for parameter-only fields. More...
 
struct  AppendParameters
 Appends coupling parameter spaces to an existing Parameters<...> list. More...
 
struct  AppendParameters< Parameters< Coupled... >, Parameters< Fixed... > >
 Specialization of AppendParameters for two Parameters<...> packs. More...
 
struct  FlattenCoupling< std::tuple< Packs... > >
 Specialization of FlattenCoupling for a tuple of coupling packs. More...
 
struct  TimeRuleParamsImpl
 Type trait to construct Parameters<Space, packed_coupling_spaces...> for a weak form's parameter list. More...
 
struct  TimeRuleParamsImpl< Rule, Space, Parameters< CS... > >
 Specialization of TimeRuleParamsImpl. More...
 
struct  AppendCouplingToParams
 Type trait to append coupling parameter spaces to fixed parameters. More...
 
struct  AppendCouplingToParams< PacksTuple, Parameters< Fixed... > >
 Specialization of AppendCouplingToParams. More...
 
struct  CoupledSolidInternalVariableMaterialAdapter
 Adapts coupled internal-variable solids to solid-system material interface. More...
 
struct  CoupledSolidThermoMechanicsMaterialAdapter
 Adapts coupled thermo-mechanical material to solid-system material interface. More...
 
struct  execution_to_memory
 Trait for "translating" between smith::ExecutionSpace and axom::MemorySpace. More...
 
struct  variant_storage
 Storage abstraction to provide trivial destructor when both variant types are trivially destructible. More...
 
struct  variant_storage< T0, T1, std::enable_if_t< std::is_trivially_destructible_v< T0 > &&std::is_trivially_destructible_v< T1 > > >
 
struct  is_variant_assignable
 Determines if T can be assigned to a variant<T0, T1> More...
 
struct  ShapeCorrection
 A helper struct that contains the appropriate parent-to-physical and physical-to-parent transformations for an applied shape field. More...
 

Typedefs

template<typename Tuple >
using tuple_to_parameters_t = typename TupleToParameters< std::decay_t< Tuple > >::type
 Typedef for converting a tuple of spaces into Parameters<...>.
 
template<typename Pack >
using pack_tuple_t = typename pack_tuple< std::decay_t< Pack > >::type
 Typedef for extracting a tuple of spaces from a coupling pack.
 
template<typename... Tuples>
using tuple_cat_t = decltype(std::tuple_cat(std::declval< Tuples >()...))
 Typedef for concatenating space tuples with std::tuple_cat.
 
template<typename PacksTuple >
using flatten_coupling_t = typename FlattenCoupling< std::decay_t< PacksTuple > >::parameters
 Typedef for flattened coupling parameter spaces.
 
template<typename Rule , typename Space , typename PacksTuple >
using TimeRuleParams = typename TimeRuleParamsImpl< Rule, Space, flatten_coupling_t< PacksTuple > >::type
 Typedef for TimeRuleParams.
 
template<std::size_t , typename T >
using always_t = T
 Helper: given an index and a type, always produces the type (used to repeat a type N times via pack expansion)
 
template<typename T >
using MaybeOwningPointer = variant< T *, std::unique_ptr< T > >
 A helper type for uniform semantics over owning/non-owning pointers. More...
 
template<typename T >
using first_argument = std::decay_t< decltype(first_argument_helper(std::declval< T >()))>
 

Functions

template<typename PacksTuple >
auto flattenCouplingFields (const PacksTuple &packs)
 Concatenate each pack's .fields tuple — used to derive trailing weak-form parameter spaces.
 
auto collectCouplingFields ()
 Collect no coupling or parameter packs.
 
template<typename... PFs>
auto collectCouplingFields (const CouplingFields< PFs... > &coupled)
 Collect only coupled physics packs.
 
template<typename... Spaces>
auto collectCouplingFields (const ParamFields< Spaces... > &params)
 Collect only registered parameter fields.
 
template<typename... PFs, typename... Spaces>
auto collectCouplingFields (const CouplingFields< PFs... > &coupled, const ParamFields< Spaces... > &params)
 Collect coupled physics packs followed by registered parameter fields.
 
template<typename Rule , typename TimeInfoT , typename ArgsTuple , typename Callback , std::size_t... StateIs, std::size_t... TailIs>
decltype(auto) applyTimeRuleToPrefixImpl (const Rule &rule, const TimeInfoT &t_info, const ArgsTuple &raw_args, Callback &&callback, std::index_sequence< StateIs... >, std::index_sequence< TailIs... >)
 Implementation of time rule prefix application.
 
template<typename Rule , typename TimeInfoT , typename Callback , typename... RawArgs>
decltype(auto) applyTimeRuleToPrefix (const Rule &rule, const TimeInfoT &t_info, Callback &&callback, const RawArgs &... raw_args)
 Apply time rule interpolation to the leading prefix of raw arguments.
 
template<std::size_t Offset, typename Pack , typename TimeInfoT , typename RawTuple , std::size_t... Is>
auto evaluateCouplingPack (const Pack &, const TimeInfoT &t_info, const RawTuple &raw_args, std::index_sequence< Is... >)
 Evaluate a single coupling pack's time rule.
 
template<std::size_t I, std::size_t Offset, typename PacksTuple , typename TimeInfoT , typename RawTuple >
auto evaluateCouplingPacks (const PacksTuple &packs, const TimeInfoT &t_info, const RawTuple &raw_args)
 Evaluate all coupling packs over their corresponding raw arguments.
 
template<typename PacksTuple , typename TimeInfoT , typename Callback , typename... RawArgs>
decltype(auto) applyCouplingTimeRules (const PacksTuple &packs, const TimeInfoT &t_info, Callback &&callback, const RawArgs &... raw_args)
 Interpolate coupling packs and invoke the callback.
 
template<typename Rule , typename Coupling , typename TimeInfoT , typename Callback , typename... RawArgs>
decltype(auto) applyTimeRuleAndCoupling (const Rule &rule, const Coupling &coupling, const TimeInfoT &t_info, Callback &&callback, const RawArgs &... raw_args)
 Interpolate self time-rule states then coupling segments, then invoke callback. More...
 
bool hasRegisteredStressOutput (const std::shared_ptr< FieldStore > &field_store)
 Return true when stress output fields were registered during phase 1.
 
std::shared_ptr< SystemSolvermakeCycleZeroSolver (std::shared_ptr< SystemSolver > solver, const Mesh &mesh)
 Build a cycle-zero solver from the main solver when possible, else use fallback defaults.
 
template<int dim, int order, typename DisplacementTimeRule , typename Coupling >
requires detail::is_coupling_packs_v< Coupling > auto buildSolidMechanicsSystemImpl (std::shared_ptr< FieldStore > field_store, const Coupling &coupling, std::shared_ptr< SystemSolver > solver, const SolidMechanicsOptions &options, bool has_stress_output)
 Internal solid builder after public registration and coupling collection.
 
template<typename MaterialType , typename AlphaType , typename AlphaDotType , typename DerivType , typename... ParamTypes>
auto evaluateCoupledInternalVariableMaterial (const MaterialType &material, const TimeInfo &t_info, AlphaType alpha, AlphaDotType alpha_dot, DerivType deriv_u, ParamTypes &&... params)
 Dispatch internal-variable material calls with or without explicit TimeInfo.
 
template<typename MaterialType , typename StateType , typename GradUType , typename GradVType , typename AlphaType , typename... ParamTypes>
auto evaluateSolidInternalVariableMaterial (const MaterialType &material, const TimeInfo &t_info, StateType &state, const GradUType &grad_u, const GradVType &grad_v, AlphaType alpha, ParamTypes &&... params)
 Evaluate solid/internal-variable material using TimeInfo-aware signature.
 
template<int dim, typename StateSpace , typename InternalVarTimeRule , typename Coupling >
requires detail::is_coupling_packs_v< Coupling > auto buildInternalVariableSystemImpl (std::shared_ptr< FieldStore > field_store, const Coupling &coupling, std::shared_ptr< SystemSolver > solver)
 Internal builder for an internal-variable system after public registration and coupling collection.
 
template<typename Space , typename... Tail, std::size_t... Is>
auto time_rule_params_impl (std::index_sequence< Is... >) -> Parameters< always_t< Is, Space >..., Tail... >
 Implementation for TimeRuleParams: repeat Space N times, then append Tail...
 
template<typename WeakFormT , typename FieldStorePtr , typename... Args, std::size_t... Is>
auto buildWeakFormWithCouplingImpl (const FieldStorePtr &field_store, const std::string &weak_form_name, const std::string &unknown_field_name, const std::tuple< Args... > &args_tuple, std::index_sequence< Is... >)
 Expands coupling tuple into trailing weak-form space arguments.
 
template<typename WeakFormT , typename FieldStorePtr , typename... Args>
auto buildWeakFormWithCoupling (const FieldStorePtr &field_store, const std::string &weak_form_name, const std::string &unknown_field_name, const Args &... args)
 Builds weak form using regular args plus final coupling pack argument.
 
template<int dim, int temp_order, typename TemperatureTimeRule , typename Coupling >
requires detail::is_coupling_packs_v< Coupling > auto buildThermalSystemImpl (std::shared_ptr< FieldStore > field_store, const Coupling &coupling, std::shared_ptr< SystemSolver > solver, const ThermalOptions &)
 Internal thermal builder after coupling fields are assembled.
 
template<typename MaterialType , typename StateType , typename GradUType , typename GradVType , typename ThetaType , typename GradThetaType , typename... ParamTypes>
auto evaluateCoupledThermoMechanicsMaterial (const MaterialType &material, const TimeInfo &t_info, StateType &state, const GradUType &grad_u, const GradVType &grad_v, ThetaType theta, const GradThetaType &grad_theta, ParamTypes &&... params)
 Evaluate coupled thermo-mechanical material using TimeInfo-aware signature.
 
template<typename T , int dim, axom::MemorySpace space>
void zero_out (axom::Array< T, dim, space > &arr)
 set the contents of an array to zero, byte-wise
 
template<typename T , int dim>
void zero_out (axom::ArrayView< T, dim, detail::host_memory_space > &arr)
 set the contents of an array to zero, byte-wise
 
template<typename position_type , typename shape_type >
SMITH_HOST_DEVICE auto compute_boundary_area_correction (const position_type &X, const shape_type &shape)
 Compute the boundary area correction term for boundary integrals with a shape displacement field. More...
 
template<typename lambda , typename coord_type , typename shape_type , typename space_types , typename trial_types , typename correction_type , int... i>
SMITH_HOST_DEVICE auto apply_shape_aware_qf_helper (const lambda &qf, double t, const coord_type &position, const shape_type &shape, const space_types &space_tuple, const trial_types &arg_tuple, const correction_type &correction, std::integer_sequence< int, i... >)
 A helper function to modify all of the trial function input derivatives according to the given shape displacement for integrands without state variables. More...
 
template<typename lambda , typename coord_type , typename state_type , typename shape_type , typename space_types , typename trial_types , typename correction_type , int... i>
SMITH_HOST_DEVICE auto apply_shape_aware_qf_helper_with_state (const lambda &qf, double t, const coord_type &position, state_type &state, const shape_type &shape, const space_types &space_tuple, const trial_types &arg_tuple, const correction_type &correction, std::integer_sequence< int, i... >)
 A helper function to modify all of the trial function input derivatives according to the given shape displacement for integrands without state variables. More...
 
std::string addPrefix (const std::string &prefix, const std::string &target)
 Prepends a prefix to a target string if name is non-empty with an underscore delimiter. More...
 
std::string removePrefix (const std::string &prefix, const std::string &target)
 Removes a prefix and the underscore delimiter from a target string. More...
 
template<int dim, typename signature , int... i, typename func , typename... T>
FiniteElementState fit (std::integer_sequence< int, i... >, func f, mfem::ParMesh &pmesh, const T &... solution_fields)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
template<int dim>
void setMfemVectorFromTensorOrDouble (mfem::Vector &v_mfem, const tensor< double, dim > &v)
 Helper function to copy a tensor into an mfem Vector.
 
void setMfemVectorFromTensorOrDouble (mfem::Vector &v_mfem, double v)
 Helper function to copy a double into a singleton mfem Vector.
 
template<typename Ret , typename Arg , typename... Rest>
Arg first_argument_helper (Ret(*)(Arg, Rest...))
 Helper for extracting type of first argument of a free function.
 
template<typename Ret , typename F , typename Arg , typename... Rest>
Arg first_argument_helper (Ret(F::*)(Arg, Rest...))
 Helper for extracting type of first argument of a class method. More...
 
template<typename Callable >
auto evaluateTensorFunctionOnMfemVector (const mfem::Vector &X_mfem, Callable &&f)
 Evaluate a function of a tensor with an mfem Vector object.
 

Variables

template<typename T >
constexpr bool is_physics_fields_v = is_physics_fields_impl<std::decay_t<T>>::value
 True when T is a PhysicsFields pack.
 
template<typename T >
constexpr bool is_parameter_pack_v = is_parameter_pack_impl<std::decay_t<T>>::value
 True if T is a ParamFields type.
 
template<typename T >
constexpr bool is_coupling_fields_v = is_coupling_fields_impl<std::decay_t<T>>::value
 True if T is a CouplingFields type.
 
template<typename T >
constexpr bool is_coupling_packs_v = is_coupling_packs_impl<std::decay_t<T>>::value
 True if T is a tuple of coupling packs.
 
template<typename T , typename = void>
constexpr bool has_time_rule_v = false
 Base case: T does not have a time rule.
 
template<ExecutionSpace space>
constexpr axom::MemorySpace execution_to_memory_v = execution_to_memory<space>::value
 Helper template for execution_to_memory trait.
 
constexpr axom::MemorySpace host_memory_space = axom::MemorySpace::Dynamic
 Sets the axom memory space based on whether or not Umpire is being used.
 
constexpr std::array< mfem::Geometry::Type, 5 > qdata_geometries
 a list of mfem::Geometry types supported by QuadratureData More...
 
constexpr std::array< std::string_view, 5 > qdata_geometry_names
 a list of strings associated with the corresponding mfem::Geometry type supported by QuadratureData More...
 
template<typename F >
decltype(first_argument_helper(&F::operator())) first_argument_helper (F)
 

Detailed Description

Internal solid mechanics builder after coupling fields are assembled.

Internal thermal builder after coupling fields are assembled.

Build an InternalVariableSystem with coupling, assuming fields are already registered.

Phase 2 of the two-phase initialization.

Typedef Documentation

◆ first_argument

template<typename T >
using smith::detail::first_argument = typedef std::decay_t<decltype(first_argument_helper(std::declval<T>()))>

Extract type of first argument of a free callable

Definition at line 78 of file finite_element_state.hpp.

◆ MaybeOwningPointer

template<typename T >
using smith::detail::MaybeOwningPointer = typedef variant<T*, std::unique_ptr<T> >

A helper type for uniform semantics over owning/non-owning pointers.

This logic is needed to integrate with the mesh and field reconstruction logic provided by Sidre's MFEMSidreDataCollection. When a Smith restart occurs, the saved data is used to construct fully functional mfem::(Par)Mesh and mfem::(Par)GridFunction objects. The FiniteElementCollection and (Par)FiniteElementSpace objects are intermediates in the construction of these objects and are therefore owned by the MFEMSidreDataCollection in the case of a restart/reconstruction. In a normal run, Smith constructs the mesh and fields, so these FEColl and FESpace objects are owned by Smith. In both cases, the MFEMSidreDataCollection maintains ownership of the mesh and field objects themselves.

Definition at line 436 of file variant.hpp.

Function Documentation

◆ addPrefix()

std::string smith::detail::addPrefix ( const std::string &  prefix,
const std::string &  target 
)

Prepends a prefix to a target string if name is non-empty with an underscore delimiter.

Parameters
[in]prefixThe string to prepend
[in]targetThe string to prepend to

Definition at line 399 of file base_physics.cpp.

◆ apply_shape_aware_qf_helper()

template<typename lambda , typename coord_type , typename shape_type , typename space_types , typename trial_types , typename correction_type , int... i>
SMITH_HOST_DEVICE auto smith::detail::apply_shape_aware_qf_helper ( const lambda &  qf,
double  t,
const coord_type &  position,
const shape_type &  shape,
const space_types &  space_tuple,
const trial_types &  arg_tuple,
const correction_type &  correction,
std::integer_sequence< int, i... >   
)

A helper function to modify all of the trial function input derivatives according to the given shape displacement for integrands without state variables.

Template Parameters
lambdaThe q-function type
coord_typeThe input position type
shape_typeThe type of the shape displacement argument
space_typesThe type of the input finite element space tuple for the trial functions
trial_typesThe type of the input finite element argument tuple (values and derivatives)
correction_typeThe type of the shape correction struct
iIndices for accessing the individual arguments for the underlying q-function
Parameters
qfThe q-function integrand with expects shape-adjusted arguments
tThe time at which to evaluate the integrand
positionThe quadrature point spatial coordinates and isoparametric derivatives
shapeThe space displacement at which to evaluate the integrand
space_tupleThe tuple of finite element spaces used by the input trial functions
arg_tupleThe tuple of input arguments for the trial functions (value and gradient)
correctionThe shape correction struct containing the data and methods used to calculate the appropriate pullback mappings
Returns
The q-function value using the shape-modified input arguments. Note that the returned value and flux have not been modified to reflect the shape displacement.

Definition at line 195 of file shape_aware_functional.hpp.

◆ apply_shape_aware_qf_helper_with_state()

template<typename lambda , typename coord_type , typename state_type , typename shape_type , typename space_types , typename trial_types , typename correction_type , int... i>
SMITH_HOST_DEVICE auto smith::detail::apply_shape_aware_qf_helper_with_state ( const lambda &  qf,
double  t,
const coord_type &  position,
state_type &  state,
const shape_type &  shape,
const space_types &  space_tuple,
const trial_types &  arg_tuple,
const correction_type &  correction,
std::integer_sequence< int, i... >   
)

A helper function to modify all of the trial function input derivatives according to the given shape displacement for integrands without state variables.

Template Parameters
lambdaThe q-function type
coord_typeThe input position type
state_typeThe quadrature data container type
shape_typeThe type of the shape displacement argument
space_typesThe type of the input finite element space tuple for the trial functions
trial_typesThe type of the input finite element argument tuple (values and derivatives)
correction_typeThe type of the shape correction struct
iIndices for accessing the individual arguments for the underlying q-function
Parameters
qfThe q-function integrand with expects shape-adjusted arguments
tThe time at which to evaluate the integrand
positionThe quadrature point spatial coordinates and isoparametric derivatives
stateThe quadrature data at which to evaluate the integrand
shapeThe space displacement at which to evaluate the integrand
space_tupleThe tuple of finite element spaces used by the input trial functions
arg_tupleThe tuple of input arguments for the trial functions (value and gradient)
correctionThe shape correction struct containing the data and methods used to calculate the appropriate pullback mappings
Returns
The q-function value using the shape-modified input arguments. Note that the returned value and flux have not been modified to reflect the shape displacement.

Definition at line 241 of file shape_aware_functional.hpp.

◆ applyTimeRuleAndCoupling()

template<typename Rule , typename Coupling , typename TimeInfoT , typename Callback , typename... RawArgs>
decltype(auto) smith::detail::applyTimeRuleAndCoupling ( const Rule &  rule,
const Coupling &  coupling,
const TimeInfoT &  t_info,
Callback &&  callback,
const RawArgs &...  raw_args 
)

Interpolate self time-rule states then coupling segments, then invoke callback.

Combines applyTimeRuleToPrefix with applyCouplingTimeRules into a single helper so per-method weak-form bodies stop repeating the same 3-level nested-lambda boilerplate.

Callback signature: (self_states..., interpolated_coupling...).

Definition at line 271 of file coupling_params.hpp.

◆ compute_boundary_area_correction()

template<typename position_type , typename shape_type >
SMITH_HOST_DEVICE auto smith::detail::compute_boundary_area_correction ( const position_type &  X,
const shape_type &  shape 
)

Compute the boundary area correction term for boundary integrals with a shape displacement field.

Template Parameters
position_typeThe position input argument type
shape_typeThe shape displacement input argument type
Parameters
XThe input position (value and gradient)
shapeThe input shape displacement (value and gradient)
Returns
The area correction factor transforming the boundary integral from the reference domain area into the shape-displaced area

Definition at line 149 of file shape_aware_functional.hpp.

◆ first_argument_helper()

template<typename Ret , typename F , typename Arg , typename... Rest>
Arg smith::detail::first_argument_helper ( Ret(F::*)(Arg, Rest...)  )

Helper for extracting type of first argument of a class method.

Helper for extracting type of first argument of a const class method.

◆ removePrefix()

std::string smith::detail::removePrefix ( const std::string &  prefix,
const std::string &  target 
)

Removes a prefix and the underscore delimiter from a target string.

Parameters
[in]prefixThe prefix string to remove
[in]targetThe larger string to remove the prefix from

Definition at line 407 of file base_physics.cpp.

Variable Documentation

◆ first_argument_helper

template<typename F >
decltype(first_argument_helper(&F::operator())) smith::detail::first_argument_helper(F) ( )

Extract type of first argument of a class method

Definition at line 72 of file finite_element_state.hpp.

◆ qdata_geometries

constexpr std::array<mfem::Geometry::Type, 5> smith::detail::qdata_geometries
constexpr
Initial value:
= {mfem::Geometry::SEGMENT, mfem::Geometry::TRIANGLE,
mfem::Geometry::SQUARE, mfem::Geometry::TETRAHEDRON,
mfem::Geometry::CUBE}

a list of mfem::Geometry types supported by QuadratureData

Definition at line 111 of file quadrature_data.hpp.

◆ qdata_geometry_names

constexpr std::array<std::string_view, 5> smith::detail::qdata_geometry_names
constexpr
Initial value:
= {"Segment", "Triangle", "Square", "Tetrahedron",
"Cube"}

a list of strings associated with the corresponding mfem::Geometry type supported by QuadratureData

Definition at line 115 of file quadrature_data.hpp.