https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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
12#include "Numerics.h"
13#include "MathUtils.h"
14
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
68void
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}
registerMooseObject("ThermalHydraulicsApp", ReynoldsNumberMaterial)
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
void addRequiredParam(const std::string &name, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
void addCoupledVar(const std::string &name, const std::string &doc_string)
static InputParameters validParams()
Computes Reynolds number as a material property.
ReynoldsNumberMaterial(const InputParameters &parameters)
MaterialProperty< Real > & _Re
Reynolds.
const MaterialProperty< Real > & _dmu_darhouA
const MaterialProperty< Real > & _drho_darhoA
static InputParameters validParams()
MaterialProperty< Real > & _dRe_darhoEA
const MaterialProperty< Real > & _dvel_darhoA
const MaterialProperty< Real > & _rho
Density of the phase.
const MaterialProperty< Real > & _dmu_darhoA
const MaterialProperty< Real > & _D_h
Hydraulic diameter.
MaterialProperty< Real > & _dRe_darhoA
MaterialProperty< Real > & _dRe_darhouA
const MaterialProperty< Real > & _mu
Dynamic viscosity of the phase.
const MaterialProperty< Real > & _vel
Velocity of the phase.
const MaterialProperty< Real > & _dmu_darhoEA
const MaterialProperty< Real > & _dvel_darhouA
T sign(T x)
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