18 #include "smith/physics/boundary_conditions/components.hpp"
32 template <
int order,
int dim,
typename... parameter_space>
52 const std::string& physics_name, std::shared_ptr<smith::Mesh> smith_mesh,
int cycle = 0,
56 std::make_unique<
EquationSolver>(solid_nonlin_opts, solid_lin_opts, smith_mesh->getComm()),
57 solid_timestepping, physics_name, smith_mesh,
cycle,
time)
75 const std::string& physics_name, std::shared_ptr<smith::Mesh> smith_mesh,
int cycle = 0,
78 thermal_(std::move(thermal_solver), thermal_timestepping, physics_name +
"thermal", smith_mesh,
80 solid_(std::move(solid_solver), solid_timestepping, physics_name +
"mechanical", smith_mesh, {
"temperature"},
83 SLIC_ERROR_ROOT_IF(
mfemParMesh().Dimension() != dim,
84 axom::fmt::format(
"Compile time dimension and runtime mesh dimension mismatch"));
102 const std::string& physics_name, std::string mesh_tag,
int cycle = 0,
double time = 0.0)
103 :
Thermomechanics(thermal_options.nonlin_solver_options, thermal_options.lin_solver_options,
104 thermal_options.timestepping_options, solid_options.nonlin_solver_options,
105 solid_options.lin_solver_options, solid_options.timestepping_options, physics_name, mesh_tag,
163 if (state_name ==
"displacement") {
164 return solid_.displacement();
165 }
else if (state_name ==
"velocity") {
167 }
else if (state_name ==
"temperature") {
171 SLIC_ERROR_ROOT(axom::fmt::format(
"State '{}' requested from solid mechanics module '{}', but it doesn't exist",
173 return solid_.displacement();
188 if (state_name ==
"displacement") {
191 }
else if (state_name ==
"velocity") {
194 }
else if (state_name ==
"temperature") {
199 SLIC_ERROR_ROOT(axom::fmt::format(
200 "setState for state named '{}' requested from thermomechanics module '{}', but it doesn't exist", state_name,
211 return std::vector<std::string>{
"displacement",
"velocity",
"temperature"};
222 if (state_name ==
"displacement") {
223 return solid_.adjoint(
"displacement");
224 }
else if (state_name ==
"temperature") {
225 return thermal_.adjoint(
"temperature");
228 SLIC_ERROR_ROOT(axom::fmt::format(
"Adjoint '{}' requested from solid mechanics module '{}', but it doesn't exist",
230 return solid_.displacement();
244 solid_.advanceTimestep(dt);
257 template <
typename T>
260 return solid_.createQuadratureDataBuffer(initial_state);
269 template <
typename ThermalMechanicalMaterial>
271 using State =
typename ThermalMechanicalMaterial::State;
273 const ThermalMechanicalMaterial
mat;
294 template <
typename T1,
typename T2,
typename T3,
typename T4,
typename... param_types>
296 const T4&
displacement, param_types... parameters)
const
303 auto [T, heat_capacity, s0, q0] =
mat(
state, du_dX,
temperature, temperature_gradient, parameters...);
315 template <
typename ThermalMechanicalMaterial>
317 using State =
typename ThermalMechanicalMaterial::State;
319 const ThermalMechanicalMaterial
mat;
340 template <
typename T1,
typename T2,
typename... param_types>
342 param_types... parameters)
const
345 auto [T, heat_capacity, s0, q0] =
mat(
state, displacement_gradient, theta, dtheta_dX, parameters...);
375 template <
int... active_parameters,
typename MaterialType,
typename StateType>
389 template <
typename MaterialType,
typename StateType = Empty>
403 std::function<
double(
const mfem::Vector& x,
double t)> prescribed_value)
405 thermal_.setTemperatureBCs(temperature_attributes, prescribed_value);
426 template <
typename AppliedDisplacementFunction>
430 solid_.setDisplacementBCs(applied_displacement, domain, components);
467 template <
typename FluxType>
478 template <
typename Callable>
509 template <
typename BodyForceType>
512 solid_.addBodyForce(body_force_function);
534 template <
typename HeatSourceType>
537 thermal_.setSource(source_function);
#define SMITH_HOST_DEVICE
Macro that evaluates to __host__ __device__ when compiling with nvcc and does nothing on a host compi...
The base interface class for a generic PDE solver.
This is the abstract base class for a generic forward solver.
std::string name_
Name of the physics module.
std::vector< const smith::FiniteElementState * > states_
List of finite element primal states associated with this physics module.
int cycle_
Current cycle (forward pass time iteration count)
virtual double time() const
Get the current forward-solution time.
double time_
Current time for the forward pass.
virtual int cycle() const
Get the current forward-solution cycle iteration number.
const mfem::ParMesh & mfemParMesh() const
Returns a reference to the mfem ParMesh object.
void initializeBasePhysicsStates(int cycle, double time)
Protected, non-virtual method to reset physics states to zero. This does not reset design parameters ...
A set to flag components of a vector field.
This class manages the objects typically required to solve a nonlinear set of equations arising from ...
Class for encapsulating the critical MFEM components of a primal finite element field.
An object containing the solver for a heat transfer PDE.
The operator-split thermal-structural solver.
Thermomechanics(const ThermomechanicsInputOptions &options, const std::string &physics_name, std::string mesh_tag, int cycle=0, double time=0.0)
Construct a new Thermal-SolidMechanics Functional object from input file options.
std::shared_ptr< QuadratureData< T > > createQuadratureDataBuffer(T initial_state)
Create a shared ptr to a quadrature data buffer for the given material type.
void setDisplacement(Callable displacement)
Set the underlying finite element state to a prescribed displacement.
const smith::FiniteElementState & temperature() const
Get the temperature state.
virtual std::vector< std::string > stateNames() const override
Get a vector of the finite element state solution variable names.
const FiniteElementState & adjoint(const std::string &state_name) const override
Accessor for getting named finite element adjoint fields from the physics modules.
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.
SolidMechanics< order, dim, Parameters< temperature_field, parameter_space... > > solid_
Submodule to compute the mechanics.
const FiniteElementState & state(const std::string &state_name) const override
Accessor for getting named finite element state primal fields from the physics modules.
void setHeatFluxBCs(FluxType flux_function)
Set the thermal flux boundary condition.
void advanceTimestep(double dt) override
Advance the timestep.
void addHeatSource(HeatSourceType source_function)
Set the thermal source function.
void setState(const std::string &state_name, const FiniteElementState &state) override
Set the primal solution field (displacement, velocity, temperature) for the underlying thermomechanic...
void setMaterial(const MaterialType &material, Domain &domain, std::shared_ptr< QuadratureData< StateType >> qdata=EmptyQData)
This is an overloaded member function, provided for convenience. It differs from the above function o...
void setTemperature(std::function< double(const mfem::Vector &x, double t)> temperature)
Set the underlying finite element state to a prescribed temperature.
Thermomechanics(std::unique_ptr< EquationSolver > thermal_solver, TimesteppingOptions thermal_timestepping, std::unique_ptr< EquationSolver > solid_solver, TimesteppingOptions solid_timestepping, const std::string &physics_name, std::shared_ptr< smith::Mesh > smith_mesh, int cycle=0, double time=0.0)
Construct a new coupled Thermal-SolidMechanics object.
const smith::FiniteElementState & displacement() const
Get the displacement state.
H1< order, dim > displacement_field
the function space for the displacement field
void setFixedBCs(Domain &domain, Components components=Component::ALL)
Shortcut to set selected components of displacements to zero for all time.
void setTemperatureBCs(const std::set< int > &temperature_attributes, std::function< double(const mfem::Vector &x, double t)> prescribed_value)
Set essential temperature boundary conditions (strongly enforced)
HeatTransfer< order, dim, Parameters< displacement_field, parameter_space... > > thermal_
Submodule to compute the heat transfer physics.
Thermomechanics(const HeatTransferInputOptions &thermal_options, const SolidMechanicsInputOptions &solid_options, const std::string &physics_name, std::string mesh_tag, int cycle=0, double time=0.0)
Construct a new Thermal-SolidMechanics Functional object from input file options.
void setDisplacementBCs(AppliedDisplacementFunction applied_displacement, Domain &domain, Components components=Component::ALL)
Set essential displacement boundary conditions on selected components.
void completeSetup() override
Complete the initialization and allocation of the data structures.
void setMaterial(DependsOn< active_parameters... >, const MaterialType &material, Domain &domain, std::shared_ptr< QuadratureData< StateType >> qdata)
Set the thermomechanical material response.
H1< order > temperature_field
the function space for the temperature field
void addBodyForce(BodyForceType body_force_function)
Set the body forcefunction.
Thermomechanics(const NonlinearSolverOptions thermal_nonlin_opts, const LinearSolverOptions thermal_lin_opts, TimesteppingOptions thermal_timestepping, const NonlinearSolverOptions solid_nonlin_opts, const LinearSolverOptions solid_lin_opts, TimesteppingOptions solid_timestepping, const std::string &physics_name, std::shared_ptr< smith::Mesh > smith_mesh, int cycle=0, double time=0.0)
Construct a new coupled Thermal-SolidMechanics object.
An object containing the solver for a heat transfer PDE.
Accelerator functionality.
std::shared_ptr< QuadratureData< Empty > > EmptyQData
a single instance of a QuadratureData container of Emptys, since they are all interchangeable
The material and load types for the solid functional physics module.
Tools for tagging a set of components of a vector field for boundary condition enforcement.
a class for representing a geometric region that can be used for integration
Parameters for an iterative linear solution scheme.
Nonlinear solution scheme parameters.
a struct that is used in the physics modules to clarify which template arguments are user-controlled ...
A class for storing and access user-defined types at quadrature points.
This is an adaptor class that makes a thermomechanical material usable by the solid mechanics module,...
SMITH_HOST_DEVICE auto operator()(State &state, const T1 &displacement_gradient, const T2 &temperature, param_types... parameters) const
glue code to evaluate a thermomechanical material and extract the stress
typename ThermalMechanicalMaterial::State State
internal variables for the wrapped material model
MechanicalMaterialInterface(ThermalMechanicalMaterial m)
constructor
const double density
mass density
const ThermalMechanicalMaterial mat
the wrapped material model
This is an adaptor class that makes a thermomechanical material usable by the thermal module,...
SMITH_HOST_DEVICE auto operator()(const T1 &, const T2 &temperature, const T3 &temperature_gradient, const T4 &displacement, param_types... parameters) const
glue code to evaluate a thermomechanical material and extract the thermal outputs
ThermalMaterialInterface(const ThermalMechanicalMaterial &m)
constructor
typename ThermalMechanicalMaterial::State State
internal variables for the wrapped material model
const ThermalMechanicalMaterial mat
the wrapped material model
A timestep and boundary condition enforcement method for a dynamic solver.
This is a class that mimics most of std::tuple's interface, except that it is usable in CUDA kernels ...
The material and load types for the thermal functional physics module.