31 template <
int order,
int dim,
typename... parameter_space>
55 std::make_unique<
EquationSolver>(thermal_nonlin_opts, thermal_lin_opts,
59 solid_timestepping, geom_nonlin, physics_name, mesh_tag,
cycle,
time)
81 thermal_(std::move(thermal_solver), thermal_timestepping, physics_name +
"thermal", mesh_tag, {
"displacement"},
83 solid_(std::move(solid_solver), solid_timestepping, geom_nonlin, physics_name +
"mechanical", mesh_tag,
86 SLIC_ERROR_ROOT_IF(
mesh_.Dimension() != dim,
87 axom::fmt::format(
"Compile time dimension and runtime mesh dimension mismatch"));
105 const std::string& physics_name, std::string mesh_tag,
int cycle = 0,
double time = 0.0)
106 :
Thermomechanics(thermal_options.nonlin_solver_options, thermal_options.lin_solver_options,
107 thermal_options.timestepping_options, solid_options.nonlin_solver_options,
108 solid_options.lin_solver_options, solid_options.timestepping_options, solid_options.geom_nonlin,
166 if (state_name ==
"displacement") {
167 return solid_.displacement();
168 }
else if (state_name ==
"velocity") {
170 }
else if (state_name ==
"temperature") {
174 SLIC_ERROR_ROOT(axom::fmt::format(
"State '{}' requested from solid mechanics module '{}', but it doesn't exist",
176 return solid_.displacement();
191 if (state_name ==
"displacement") {
194 }
else if (state_name ==
"velocity") {
197 }
else if (state_name ==
"temperature") {
202 SLIC_ERROR_ROOT(axom::fmt::format(
203 "setState for state named '{}' requested from thermomechanics module '{}', but it doesn't exist", state_name,
214 return std::vector<std::string>{
"displacement",
"velocity",
"temperature"};
225 if (state_name ==
"displacement") {
226 return solid_.adjoint(
"displacement");
227 }
else if (state_name ==
"temperature") {
228 return thermal_.adjoint(
"temperature");
231 SLIC_ERROR_ROOT(axom::fmt::format(
"Adjoint '{}' requested from solid mechanics module '{}', but it doesn't exist",
233 return solid_.displacement();
247 solid_.advanceTimestep(dt);
260 template <
typename T>
263 return solid_.createQuadratureDataBuffer(initial_state);
272 template <
typename ThermalMechanicalMaterial>
274 using State =
typename ThermalMechanicalMaterial::State;
276 const ThermalMechanicalMaterial
mat;
297 template <
typename T1,
typename T2,
typename T3,
typename T4,
typename... param_types>
299 const T4&
displacement, param_types... parameters)
const
306 auto [T, heat_capacity, s0, q0] =
mat(
state, du_dX,
temperature, temperature_gradient, parameters...);
318 template <
typename ThermalMechanicalMaterial>
320 using State =
typename ThermalMechanicalMaterial::State;
322 const ThermalMechanicalMaterial
mat;
343 template <
typename T1,
typename T2,
typename... param_types>
345 param_types... parameters)
const
348 auto [T, heat_capacity, s0, q0] =
mat(
state, displacement_gradient, theta, dtheta_dX, parameters...);
377 template <
int... active_parameters,
typename MaterialType,
typename StateType>
390 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);
415 std::function<
void(
const mfem::Vector& x, mfem::Vector& disp)> prescribed_value)
417 solid_.setDisplacementBCs(displacement_attributes, prescribed_value);
443 template <
typename FluxType>
484 template <
typename BodyForceType>
487 solid_.addBodyForce(body_force_function);
509 template <
typename HeatSourceType>
512 thermal_.setSource(source_function);
#define SERAC_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.
mfem::ParMesh & mesh_
The primary mesh.
int cycle_
Current cycle (forward pass time iteration count)
std::vector< const serac::FiniteElementState * > states_
List of finite element primal states associated with this physics module.
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 & mesh() const
Returns a reference to the mesh object.
std::string name_
Name of the physics module.
void initializeBasePhysicsStates(int cycle, double time)
Protected, non-virtual method to reset physics states to zero. This does not reset design parameters ...
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.
Manages the lifetimes of FEState objects such that restarts are abstracted from physics modules.
The operator-split thermal-structural solver.
void addHeatSource(HeatSourceType source_function)
Set the thermal source function.
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.
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, GeometricNonlinearities geom_nonlin, const std::string &physics_name, std::string mesh_tag, int cycle=0, double time=0.0)
Construct a new coupled Thermal-SolidMechanics object.
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 o...
H1< order > temperature_field
the function space for the temperature field
const FiniteElementState & adjoint(const std::string &state_name) const override
Accessor for getting named finite element adjoint fields from the physics modules.
std::shared_ptr< QuadratureData< T > > createQuadratureDataBuffer(T initial_state)
Create a shared ptr to a quadrature data buffer for the given material type.
void advanceTimestep(double dt) override
Advance the timestep.
void setState(const std::string &state_name, const FiniteElementState &state) override
Set the primal solution field (displacement, velocity, temperature) for the underlying thermomechanic...
void setDisplacementBCs(const std::set< int > &displacement_attributes, std::function< void(const mfem::Vector &x, mfem::Vector &disp)> prescribed_value)
Set essential displacement boundary conditions (strongly enforced)
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.
void setTemperature(std::function< double(const mfem::Vector &x, double t)> temperature)
Set the underlying finite element state to a prescribed temperature.
H1< order, dim > displacement_field
the function space for the displacement field
virtual std::vector< std::string > stateNames() const override
Get a vector of the finite element state solution variable names.
void setMaterial(DependsOn< active_parameters... >, MaterialType material, std::shared_ptr< QuadratureData< StateType >> qdata)
Set the thermomechanical material response.
void addBodyForce(BodyForceType body_force_function)
Set the body forcefunction.
void setHeatFluxBCs(FluxType flux_function)
Set the thermal flux boundary condition.
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 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.
void setDisplacement(std::function< void(const mfem::Vector &x, mfem::Vector &u)> displacement)
Set the underlying finite element state to a prescribed displacement.
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.
const serac::FiniteElementState & displacement() const
Get the displacement state.
Thermomechanics(std::unique_ptr< EquationSolver > thermal_solver, TimesteppingOptions thermal_timestepping, std::unique_ptr< EquationSolver > solid_solver, TimesteppingOptions solid_timestepping, GeometricNonlinearities geom_nonlin, const std::string &physics_name, std::string mesh_tag, int cycle=0, double time=0.0)
Construct a new coupled Thermal-SolidMechanics object.
void completeSetup() override
Complete the initialization and allocation of the data structures.
const serac::FiniteElementState & temperature() const
Get the temperature state.
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
GeometricNonlinearities
Enum to set the geometric nonlinearity flag.
The material and load types for the solid functional physics module.
An object containing the solver for total Lagrangian finite deformation solid mechanics.
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,...
typename ThermalMechanicalMaterial::State State
internal variables for the wrapped material model
MechanicalMaterialInterface(const ThermalMechanicalMaterial &m)
constructor
SERAC_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
const ThermalMechanicalMaterial mat
the wrapped material model
const double density
mass density
This is an adaptor class that makes a thermomechanical material usable by the thermal module,...
SERAC_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
const ThermalMechanicalMaterial mat
the wrapped material model
typename ThermalMechanicalMaterial::State State
internal variables for 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.