www.mooseframework.org
INSADTauMaterial.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
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 
10 // Navier-Stokes includes
11 #include "INSADTauMaterial.h"
12 #include "NonlinearSystemBase.h"
13 
14 registerADMooseObject("NavierStokesApp", INSADTauMaterial);
15 
19  params.addClassDescription(
20  "This is the material class used to compute the stabilization parameter tau.");
21  params.addParam<Real>("alpha",
22  1.,
23  "Multiplicative factor on the stabilization parameter tau."););
24 
25 template <ComputeStage compute_stage>
26 INSADTauMaterial<compute_stage>::INSADTauMaterial(const InputParameters & parameters)
27  : INSADMaterial<compute_stage>(parameters),
28  _alpha(getParam<Real>("alpha")),
29  _tau(declareADProperty<Real>("tau"))
30 {
31 }
32 
33 template <ComputeStage compute_stage>
34 void
36 {
37  _hmax = _current_elem->hmax();
38 }
39 
40 template <>
41 void
43 {
44  if (!_displacements.size())
45  {
46  _hmax = _current_elem->hmax();
47  return;
48  }
49 
50  _hmax = 0;
51 
52  for (unsigned int n_outer = 0; n_outer < _current_elem->n_vertices(); n_outer++)
53  for (unsigned int n_inner = n_outer + 1; n_inner < _current_elem->n_vertices(); n_inner++)
54  {
55  VectorValue<DualReal> diff = (_current_elem->point(n_outer) - _current_elem->point(n_inner));
56  unsigned dimension = 0;
57  for (const auto & disp_num : _displacements)
58  {
59  diff(dimension)
60  .derivatives()[disp_num * _fe_problem.getNonlinearSystemBase().getMaxVarNDofsPerElem() +
61  n_outer] = 1.;
62  diff(dimension++)
63  .derivatives()[disp_num * _fe_problem.getNonlinearSystemBase().getMaxVarNDofsPerElem() +
64  n_inner] = -1.;
65  }
66 
67  _hmax = std::max(_hmax, diff.norm_sq());
68  }
69 
70  _hmax = std::sqrt(_hmax);
71 }
72 
73 template <ComputeStage compute_stage>
74 void
76 {
77  computeHMax();
78 
79  Material::computeProperties();
80 }
81 
82 template <ComputeStage compute_stage>
83 void
85 {
87 
88  auto && nu = _mu[_qp] / _rho[_qp];
89  auto && transient_part = _transient_term ? 4. / (_dt * _dt) : 0.;
90  _tau[_qp] = _alpha / std::sqrt(transient_part +
91  (2. * _velocity[_qp].norm() / _hmax) *
92  (2. * _velocity[_qp].norm() / _hmax) +
93  9. * (4. * nu / (_hmax * _hmax)) * (4. * nu / (_hmax * _hmax)));
94 }
registerADMooseObject
registerADMooseObject("NavierStokesApp", INSADTauMaterial)
defineADValidParams
defineADValidParams(INSADTauMaterial, INSADMaterial, params.addClassDescription("This is the material class used to compute the stabilization parameter tau.");params.addParam< Real >("alpha", 1., "Multiplicative factor on the stabilization parameter tau.");)
INSADMaterial::computeQpProperties
virtual void computeQpProperties() override
Definition: INSADMaterial.C:77
INSADTauMaterial::computeHMax
void computeHMax()
Definition: INSADTauMaterial.C:35
INSADTauMaterial::INSADTauMaterial
INSADTauMaterial(const InputParameters &parameters)
Definition: INSADTauMaterial.C:26
INSADTauMaterial.h
INSADTauMaterial::computeQpProperties
virtual void computeQpProperties() override
Definition: INSADTauMaterial.C:84
INSADMaterial
Definition: INSADMaterial.h:22
INSADTauMaterial::computeProperties
virtual void computeProperties() override
Definition: INSADTauMaterial.C:75
INSADTauMaterial
Definition: INSADTauMaterial.h:15