Smith  0.1
Smith is an implicit thermal structural mechanics simulation code.
thermo_mechanics_system.hpp
Go to the documentation of this file.
1 // Copyright (c) Lawrence Livermore National Security, LLC and
2 // other Smith Project Developers. See the top-level LICENSE file for
3 // details.
4 //
5 // SPDX-License-Identifier: (BSD-3-Clause)
6 
12 #pragma once
13 
16 
17 namespace smith {
18 
19 namespace detail {
20 
24 template <typename MaterialType, typename StateType, typename GradUType, typename GradVType, typename ThetaType,
25  typename GradThetaType, typename... ParamTypes>
26 auto evaluateCoupledThermoMechanicsMaterial(const MaterialType& material, const TimeInfo& t_info, StateType& state,
27  const GradUType& grad_u, const GradVType& grad_v, ThetaType theta,
28  const GradThetaType& grad_theta, ParamTypes&&... params)
29 {
30  return material(t_info, state, grad_u, grad_v, theta, grad_theta, std::forward<ParamTypes>(params)...);
31 }
32 
33 template <typename MaterialType>
37  using State = typename MaterialType::State;
38 
39  MaterialType material;
40  double density;
41 
42  template <typename StateType, typename GradUType, typename GradVType, typename TemperatureType,
43  typename TemperatureDotType, typename... ParamTypes>
45  auto operator()(const TimeInfo& t_info, StateType& state, GradUType grad_u, GradVType grad_v,
46  TemperatureType temperature, TemperatureDotType /*temperature_dot*/, ParamTypes&&... params) const
47  {
48  auto [pk, C_v, s0, q0] =
49  evaluateCoupledThermoMechanicsMaterial(material, t_info, state, grad_u, grad_v, get<VALUE>(temperature),
50  get<DERIVATIVE>(temperature), std::forward<ParamTypes>(params)...);
51  return pk;
52  }
53 };
54 
55 } // namespace detail
56 
83 template <int dim, int disp_order_, int temp_order_, typename DispRule, typename TempRule, typename SolidCoupling,
84  typename ThermalCoupling, typename MaterialType>
87  std::shared_ptr<ThermalSystem<dim, temp_order_, TempRule, ThermalCoupling>> thermal, const MaterialType& material,
88  const std::string& domain_name)
89 {
90  auto solid_material = detail::CoupledSolidThermoMechanicsMaterialAdapter<MaterialType>{material, material.density};
91 
92  solid->setMaterial(solid_material, domain_name);
93 
94  thermal->setMaterialAndHeatSource(
95  [=](const TimeInfo& t_info, auto temperature, auto grad_temperature, auto u, auto v, auto /*a*/, auto... params) {
96  typename MaterialType::State state{};
97  auto [pk, C_v, s0, q0] = detail::evaluateCoupledThermoMechanicsMaterial(
98  material, t_info, state, get<DERIVATIVE>(u), get<DERIVATIVE>(v), temperature, grad_temperature, params...);
99  // Material's s0 sits on the LHS (residual = C_v*T_dot + s0 - q·∇v); negate to fit the
100  // physical-heat-source convention used by setMaterialAndHeatSource.
101  return smith::tuple{C_v, q0, -s0};
102  },
103  domain_name);
104 }
105 
106 } // namespace smith
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.
Accelerator functionality.
Definition: smith.cpp:36
mfem::future::tuple< T... > tuple
Expose MFEM tuple in the Smith namespace.
Definition: tuple.hpp:241
void setCoupledThermoMechanicsMaterial(std::shared_ptr< SolidMechanicsSystem< dim, disp_order_, DispRule, SolidCoupling >> solid, std::shared_ptr< ThermalSystem< dim, temp_order_, TempRule, ThermalCoupling >> thermal, const MaterialType &material, const std::string &domain_name)
Register a coupled thermo-mechanical material integrand on a SolidMechanicsSystem and ThermalSystem t...
Defines the SolidMechanicsSystem struct and its factory function.
System struct for solid dynamics with configurable time integration.
Container for a thermal system with configurable time integration.
struct storing time and timestep information
Definition: common.hpp:18
Adapts coupled thermo-mechanical material to solid-system material interface.
typename MaterialType::State State
Material state type forwarded to solid system.
double density
Material density exposed for solid residual.
auto operator()(const TimeInfo &t_info, StateType &state, GradUType grad_u, GradVType grad_v, TemperatureType temperature, TemperatureDotType, ParamTypes &&... params) const
Evaluate wrapped material and return solid PK1 contribution.
MaterialType material
Wrapped thermo-mechanical material.
Defines the ThermalSystem struct and its factory function.