https://mooseframework.inl.gov
INSADSmagorinskyEddyViscosity.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 
13 
16 {
18  params.addClassDescription("Computes eddy viscosity term using Smagorinky's LES model");
19  params.addParam<Real>("smagorinsky_constant", 0.18, "Value of Smagorinsky's constant to use");
20  params.addParam<MaterialPropertyName>(
21  "rho_name", "rho", "The name of the density material property");
22  return params;
23 }
24 
26  : ADVectorKernelGrad(parameters),
27  _rho(getADMaterialProperty<Real>("rho_name")),
28  _smagorinsky_constant(getParam<Real>("smagorinsky_constant"))
29 {
30 }
31 
34 {
35  using std::sqrt, std::pow;
36 
37  constexpr Real offset = 1e-15; // prevents explosion of sqrt(x) derivative to infinity
38  const ADReal strain_rate_tensor_mag =
39  sqrt(2.0 * Utility::pow<2>(_grad_u[_qp](0, 0)) + 2.0 * Utility::pow<2>(_grad_u[_qp](1, 1)) +
40  2.0 * Utility::pow<2>(_grad_u[_qp](2, 2)) +
41  Utility::pow<2>(_grad_u[_qp](0, 2) + _grad_u[_qp](2, 0)) +
42  Utility::pow<2>(_grad_u[_qp](0, 1) + _grad_u[_qp](1, 0)) +
43  Utility::pow<2>(_grad_u[_qp](1, 2) + _grad_u[_qp](2, 1)) + offset);
44  constexpr Real one_third = 1.0 / 3.0;
45  return strain_rate_tensor_mag *
46  Utility::pow<2>(_smagorinsky_constant * pow(_current_elem_volume, one_third) /
47  _current_elem->default_order()) *
48  _rho[_qp] * _grad_u[_qp];
49 }
INSADSmagorinskyEddyViscosity(const InputParameters &parameters)
const Real _smagorinsky_constant
Value of Smagorinsky constant (dimensionless). The theory predicts this to be 0.18.
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
static InputParameters validParams()
ADRealTensorValue precomputeQpResidual() override
const Real & _current_elem_volume
const ADMaterialProperty< Real > & _rho
This model calculates a kinematic viscosity, so rho must multiply this.
ExpressionBuilder::EBTerm pow(const ExpressionBuilder::EBTerm &left, T exponent)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
CTSub CT_OPERATOR_BINARY CTMul CTCompareLess CTCompareGreater CTCompareEqual _arg template * sqrt(_arg)) *_arg.template D< dtag >()) CT_SIMPLE_UNARY_FUNCTION(tanh
const ADTemplateVariableGradient< T > & _grad_u
registerMooseObject("NavierStokesApp", INSADSmagorinskyEddyViscosity)
void addClassDescription(const std::string &doc_string)
const Elem *const & _current_elem
This class computes the Smagorinsky LES eddy viscosity residual and Jacobian contributions for that t...
MooseUnits pow(const MooseUnits &, int)
unsigned int _qp