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  constexpr Real offset = 1e-15; // prevents explosion of sqrt(x) derivative to infinity
36  const ADReal strain_rate_tensor_mag = std::sqrt(
37  2.0 * Utility::pow<2>(_grad_u[_qp](0, 0)) + 2.0 * Utility::pow<2>(_grad_u[_qp](1, 1)) +
38  2.0 * Utility::pow<2>(_grad_u[_qp](2, 2)) +
39  Utility::pow<2>(_grad_u[_qp](0, 2) + _grad_u[_qp](2, 0)) +
40  Utility::pow<2>(_grad_u[_qp](0, 1) + _grad_u[_qp](1, 0)) +
41  Utility::pow<2>(_grad_u[_qp](1, 2) + _grad_u[_qp](2, 1)) + offset);
42  constexpr Real one_third = 1.0 / 3.0;
43  return strain_rate_tensor_mag *
44  Utility::pow<2>(_smagorinsky_constant * std::pow(_current_elem_volume, one_third) /
45  _current_elem->default_order()) *
46  _rho[_qp] * _grad_u[_qp];
47 }
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.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
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