https://mooseframework.inl.gov
ReynoldsNumberMaterial.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 
10 #include "ReynoldsNumberMaterial.h"
12 #include "Numerics.h"
13 #include "MathUtils.h"
14 
15 registerMooseObject("ThermalHydraulicsApp", ReynoldsNumberMaterial);
16 
19 {
21 
22  params.addCoupledVar("beta", "Remapped volume fraction of liquid");
23  params.addRequiredCoupledVar("arhoA", "alpha*rho*A");
24  params.addRequiredCoupledVar("arhouA", "alpha*rho*vel*A");
25  params.addRequiredCoupledVar("arhoEA", "alpha*rho*E*A");
26 
27  params.addRequiredParam<MaterialPropertyName>("Re", "Reynolds number property name");
28  params.addRequiredParam<MaterialPropertyName>("rho", "Density of the phase");
29  params.addRequiredParam<MaterialPropertyName>("vel", "Velocity of the phase");
30  params.addRequiredParam<MaterialPropertyName>("D_h", "Hydraulic diameter");
31  params.addRequiredParam<MaterialPropertyName>("mu", "Dynamic viscosity of the phase");
32 
33  params.addClassDescription("Computes Reynolds number as a material property");
34 
35  return params;
36 }
37 
40 
41  _Re_name(getParam<MaterialPropertyName>("Re")),
42 
43  _rho(getMaterialProperty<Real>("rho")),
44  _drho_dbeta(isCoupled("beta") ? &getMaterialPropertyDerivativeTHM<Real>("rho", "beta")
45  : nullptr),
46  _drho_darhoA(getMaterialPropertyDerivativeTHM<Real>("rho", "arhoA")),
47 
48  _vel(getMaterialProperty<Real>("vel")),
49  _dvel_darhoA(getMaterialPropertyDerivativeTHM<Real>("vel", "arhoA")),
50  _dvel_darhouA(getMaterialPropertyDerivativeTHM<Real>("vel", "arhouA")),
51 
52  _D_h(getMaterialProperty<Real>("D_h")),
53 
54  _mu(getMaterialProperty<Real>("mu")),
55  _dmu_dbeta(isCoupled("beta") ? &getMaterialPropertyDerivative<Real>("mu", "beta") : nullptr),
56  _dmu_darhoA(getMaterialPropertyDerivative<Real>("mu", "arhoA")),
57  _dmu_darhouA(getMaterialPropertyDerivative<Real>("mu", "arhouA")),
58  _dmu_darhoEA(getMaterialPropertyDerivative<Real>("mu", "arhoEA")),
59 
60  _Re(declareProperty<Real>(_Re_name)),
61  _dRe_dbeta(isCoupled("beta") ? &declarePropertyDerivativeTHM<Real>(_Re_name, "beta") : nullptr),
62  _dRe_darhoA(declarePropertyDerivativeTHM<Real>(_Re_name, "arhoA")),
63  _dRe_darhouA(declarePropertyDerivativeTHM<Real>(_Re_name, "arhouA")),
64  _dRe_darhoEA(declarePropertyDerivativeTHM<Real>(_Re_name, "arhoEA"))
65 {
66 }
67 
68 void
70 {
71  _Re[_qp] = THM::Reynolds(1., _rho[_qp], _vel[_qp], _D_h[_qp], _mu[_qp]);
72 
73  const Real dRe_drho = std::fabs(_vel[_qp]) * _D_h[_qp] / _mu[_qp];
74  const Real dRe_dvel = MathUtils::sign(_vel[_qp]) * _rho[_qp] * _D_h[_qp] / _mu[_qp];
75  const Real dRe_dmu = -_rho[_qp] * std::fabs(_vel[_qp]) * _D_h[_qp] / std::pow(_mu[_qp], 2);
76 
77  if (isCoupled("beta"))
78  (*_dRe_dbeta)[_qp] = dRe_drho * (*_drho_dbeta)[_qp] + dRe_dmu * (*_dmu_dbeta)[_qp];
79  _dRe_darhoA[_qp] =
80  dRe_drho * _drho_darhoA[_qp] + dRe_dvel * _dvel_darhoA[_qp] + dRe_dmu * _dmu_darhoA[_qp];
81  _dRe_darhouA[_qp] = dRe_dvel * _dvel_darhouA[_qp] + dRe_dmu * _dmu_darhouA[_qp];
82  _dRe_darhoEA[_qp] = dRe_dmu * _dmu_darhoEA[_qp];
83 }
virtual bool isCoupled(const std::string &var_name, unsigned int i=0) const
const MaterialProperty< Real > & _dmu_darhoA
MaterialProperty< Real > & _Re
Reynolds.
const MaterialProperty< Real > & _dmu_darhoEA
const MaterialProperty< Real > & _vel
Velocity of the phase.
auto Reynolds(const T1 &volume_fraction, const T2 &rho, const T3 &vel, const T4 &D_h, const T5 &mu)
Compute Reynolds number.
Definition: Numerics.h:118
const MaterialProperty< Real > & _drho_darhoA
void addRequiredParam(const std::string &name, const std::string &doc_string)
MaterialProperty< Real > & _dRe_darhoEA
const MaterialProperty< Real > & _dmu_darhouA
static InputParameters validParams()
const MaterialProperty< Real > & _dvel_darhoA
MaterialProperty< Real > & _dRe_darhouA
ReynoldsNumberMaterial(const InputParameters &parameters)
T sign(T x)
const MaterialProperty< Real > & _rho
Density of the phase.
const MaterialProperty< Real > & _mu
Dynamic viscosity of the phase.
void addCoupledVar(const std::string &name, const std::string &doc_string)
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
const MaterialProperty< Real > & _dvel_darhouA
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
MaterialProperty< Real > & _dRe_darhoA
void addClassDescription(const std::string &doc_string)
static InputParameters validParams()
Computes Reynolds number as a material property.
MooseUnits pow(const MooseUnits &, int)
registerMooseObject("ThermalHydraulicsApp", ReynoldsNumberMaterial)
const MaterialProperty< Real > & _D_h
Hydraulic diameter.