https://mooseframework.inl.gov
AriaLaserWeld304LStainlessSteelFunctorMaterial.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://mooseframework.inl.gov
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
11 #include "NS.h"
12 
14 
17 {
19  params.addParam<Real>("c_mu0", 0.15616, "mu0 coefficient");
20  params.addParam<Real>("c_mu1", -3.3696e-5, "mu1 coefficient");
21  params.addParam<Real>("c_mu2", 1.0191e-8, "mu2 coefficient");
22  params.addParam<Real>("c_mu3", -1.0413e-12, "mu3 coefficient");
23  params.addParam<Real>("Tmax", 4000, "The maximum temperature");
24  params.addParam<Real>("Tl", 1623, "The liquidus temperature");
25  params.addParam<Real>(
26  "T90", 1528, "The T90 temperature (I don't know what this means physically)");
27  params.addParam<Real>("beta", 1e11, "beta coefficient");
28  params.addParam<Real>("c_k0", 10.7143, "k0 coefficient");
29  params.addParam<Real>("c_k1", 14.2857e-3, "k1 coefficient");
30  params.addParam<Real>("c_cp0", 425.75, "cp0 coefficient");
31  params.addParam<Real>("c_cp1", 170.833e-3, "cp1 coefficient");
32  params.addParam<Real>("c_rho0", 7.9e3, "The constant density");
33  params.addParam<Real>("ap0", 0, "");
34  params.addParam<Real>("ap1", 1.851502e1, "");
35  params.addParam<Real>("ap2", -1.96945e-1, "");
36  params.addParam<Real>("ap3", 1.594124e-3, "");
37  params.addParam<Real>("bp0", 0, "");
38  params.addParam<Real>("bp1", -5.809553e1, "");
39  params.addParam<Real>("bp2", 4.610515e-1, "");
40  params.addParam<Real>("bp3", 2.332819e-4, "");
41  params.addParam<Real>("Tb", 3000, "The boiling temperature");
42  params.addParam<Real>("Tbound1", 0, "The first temperature bound");
43  params.addParam<Real>("Tbound2", 170, "The second temperature bound");
44  params.addRequiredParam<MooseFunctorName>(NS::temperature, "The temperature in K");
45  return params;
46 }
47 
49  const InputParameters & parameters)
50  : FunctorMaterial(parameters),
51  _c_mu0(getParam<Real>("c_mu0")),
52  _c_mu1(getParam<Real>("c_mu1")),
53  _c_mu2(getParam<Real>("c_mu2")),
54  _c_mu3(getParam<Real>("c_mu3")),
55  _Tmax(getParam<Real>("Tmax")),
56  _Tl(getParam<Real>("Tl")),
57  _T90(getParam<Real>("T90")),
58  _beta(getParam<Real>("beta")),
59  _c_k0(getParam<Real>("c_k0")),
60  _c_k1(getParam<Real>("c_k1")),
61  _c_cp0(getParam<Real>("c_cp0")),
62  _c_cp1(getParam<Real>("c_cp1")),
63  _c_rho0(getParam<Real>("c_rho0")),
64  _ap0(getParam<Real>("ap0")),
65  _ap1(getParam<Real>("ap1")),
66  _ap2(getParam<Real>("ap2")),
67  _ap3(getParam<Real>("ap3")),
68  _bp0(getParam<Real>("bp0")),
69  _bp1(getParam<Real>("bp1")),
70  _bp2(getParam<Real>("bp2")),
71  _bp3(getParam<Real>("bp3")),
72  _Tb(getParam<Real>("Tb")),
73  _Tbound1(getParam<Real>("Tbound1")),
74  _Tbound2(getParam<Real>("Tbound2")),
75  _temperature(getFunctor<ADReal>(NS::temperature))
76 {
77  addFunctorProperty<ADReal>(
78  NS::mu,
79  [this](const auto & r, const auto & t)
80  {
81  const auto T = _temperature(r, t);
82  if (MetaPhysicL::raw_value(T) < _Tl)
83  return (_c_mu0 + _c_mu1 * _Tl + _c_mu2 * _Tl * _Tl + _c_mu3 * _Tl * _Tl * _Tl) *
84  (_beta + (1 - _beta) * (T - _T90) / (_Tl - _T90));
85  else
86  {
87  const ADReal That = T > _Tmax ? _Tmax : T;
88  return (_c_mu0 + _c_mu1 * That + _c_mu2 * That * That + _c_mu3 * That * That * That);
89  }
90  });
91  addFunctorProperty<ADReal>(
92  NS::k, [this](const auto & r, const auto & t) { return _c_k0 + _c_k1 * _temperature(r, t); });
93 
94  addFunctorProperty<ADReal>(NS::cp,
95  [this](const auto & r, const auto & t)
96  { return _c_cp0 + _c_cp1 * _temperature(r, t); });
97  const auto & h = addFunctorProperty<ADReal>(NS::specific_enthalpy,
98  [this](const auto & r, const auto & t)
99  {
100  const auto T = _temperature(r, t);
101  return _c_cp0 * T + _c_cp1 * Utility::pow<2>(T) / 2;
102  });
103  addFunctorProperty<ADReal>(NS::time_deriv(NS::specific_enthalpy),
104  [this](const auto & r, const auto & t)
105  {
106  const auto T_dot = _temperature.dot(r, t);
107  return _c_cp0 * T_dot + _c_cp1 * _temperature(r, t) * T_dot;
108  });
109  addFunctorProperty<ADReal>(NS::density, [this](const auto &, const auto &) { return _c_rho0; });
110  addFunctorProperty<ADReal>(NS::time_deriv(NS::density),
111  [](const auto &, const auto &) { return 0; });
112  addFunctorProperty<ADReal>(NS::enthalpy_density,
113  [this, &h](const auto & r, const auto & t)
114  { return _c_rho0 * h(r, t); });
115 
116  addFunctorProperty<ADReal>(
117  "rc_pressure",
118  [this](const auto & r, const auto & t)
119  {
120  const auto theta = _temperature(r, t) - _Tb;
121  if (theta < _Tbound1)
122  return ADReal(0);
123  else if (theta < _Tbound2)
124  return _ap0 + _ap1 * theta + _ap2 * theta * theta + _ap3 * theta * theta * theta;
125  else
126  return _bp0 + _bp1 * theta + _bp2 * theta * theta + _bp3 * theta * theta * theta;
127  });
128 }
registerMooseObject("NavierStokesTestApp", AriaLaserWeld304LStainlessSteelFunctorMaterial)
static InputParameters validParams()
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
A material that computes 304L volumetric stainless steel properties relevant to doing laser welding m...
static const std::string density
Definition: NS.h:33
auto raw_value(const Eigen::Map< T > &in)
static const std::string temperature
Definition: NS.h:59
void addRequiredParam(const std::string &name, const std::string &doc_string)
static const std::string cp
Definition: NS.h:121
static const std::string mu
Definition: NS.h:123
static const std::string enthalpy_density
Definition: NS.h:70
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
static const std::string k
Definition: NS.h:130
std::string time_deriv(const std::string &var)
Definition: NS.h:97
static const std::string specific_enthalpy
Definition: NS.h:68