Smith  0.1
Smith is an implicit thermal structural mechanics simulation code.
parameterized_thermoelastic_material.hpp
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 
7 #pragma once
8 
11 #include "smith/physics/materials/green_saint_venant_thermoelastic.hpp"
12 
14 namespace smith::thermomechanics {
15 
21  double density;
22  double E0;
23  double nu;
24  double C_v;
25  double alpha0;
26  double theta_ref;
27  double kappa0;
28 
30  struct State {
31  double strain_trace;
32  };
33 
39  static constexpr int numParameters() { return 3; }
40 
63  template <typename DispGradType, typename TempType, typename TempGradType, typename YoungsType, typename ConductType,
64  typename CoupleType, int dim>
65  auto operator()(State& state, const tensor<DispGradType, dim, dim>& grad_u, TempType theta,
66  const tensor<TempGradType, dim>& grad_theta, YoungsType DeltaE, ConductType DeltaKappa,
67  CoupleType ScaleAlpha) const
68  {
69  auto E = E0 * get<0>(DeltaE);
70  auto kappa = kappa0 + get<0>(DeltaKappa);
71  auto alpha = alpha0 * get<0>(ScaleAlpha);
72 
73  auto K = E / (3.0 * (1.0 - 2.0 * nu));
74  auto G = 0.5 * E / (1.0 + nu);
75  static constexpr auto I = Identity<dim>();
76  auto F = grad_u + I;
77  const auto Eg = greenStrain(grad_u);
78  const auto trEg = tr(Eg);
79 
80  // stress
81  const auto S = 2.0 * G * dev(Eg) + K * (trEg - 3.0 * alpha * (theta - theta_ref)) * I;
82  const auto Piola = dot(F, S);
83 
84  // internal heat source
85  const auto s0 = -3.0 * K * alpha * theta * (trEg - state.strain_trace);
86 
87  // heat flux
88  const auto q0 = -kappa * grad_theta;
89 
90  state.strain_trace = get_value(trEg);
91 
92  return smith::tuple{Piola, C_v, s0, q0};
93  }
94 };
95 } // namespace smith::thermomechanics
Thermomechanics helper data types.
auto greenStrain(const tensor< T, dim, dim > &grad_u)
Compute Green's strain from the displacement gradient.
constexpr SMITH_HOST_DEVICE auto dev(const tensor< T, n, n > &A)
Calculates the deviator of a matrix (rank-2 tensor)
Definition: tensor.hpp:1193
constexpr SMITH_HOST_DEVICE auto get_value(const T &arg)
return the "value" part from a given type. For non-dual types, this is just the identity function
Definition: dual.hpp:445
constexpr SMITH_HOST_DEVICE auto tr(const isotropic_tensor< T, m, m > &I)
calculate the trace of an isotropic tensor
constexpr SMITH_HOST_DEVICE auto dot(const isotropic_tensor< S, m, m > &I, const tensor< T, m, n... > &A)
dot product between an isotropic and (nonisotropic) tensor
Arbitrary-rank tensor class.
Definition: tensor.hpp:28
Green-Saint Venant isotropic thermoelastic material model.
double alpha0
reference value of thermal expansion coefficient
auto operator()(State &state, const tensor< DispGradType, dim, dim > &grad_u, TempType theta, const tensor< TempGradType, dim > &grad_theta, YoungsType DeltaE, ConductType DeltaKappa, CoupleType ScaleAlpha) const
Evaluate constitutive variables for thermomechanics.
static constexpr int numParameters()
The number of parameters in the model.
This is a class that mimics most of std::tuple's interface, except that it is usable in CUDA kernels ...
Definition: tuple.hpp:28
Implementation of the tensor class used by Functional.
Implements a std::tuple-like object that works in CUDA kernels.