https://mooseframework.inl.gov
DynamicViscosityMaterial.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 
13 registerMooseObject("ThermalHydraulicsApp", DynamicViscosityMaterial);
14 
17 {
19 
20  params.addCoupledVar("beta", "Remapped volume fraction of liquid");
21  params.addRequiredCoupledVar("arhoA", "alpha*rho*A");
22  params.addRequiredCoupledVar("arhouA", "alpha*rho*vel*A");
23  params.addRequiredCoupledVar("arhoEA", "alpha*rho*E*A");
24 
25  params.addRequiredParam<MaterialPropertyName>("mu", "Dynamic viscosity property");
26  params.addRequiredParam<MaterialPropertyName>("v", "Specific volume property");
27  params.addRequiredParam<MaterialPropertyName>("e", "Specific internal energy property");
28 
29  params.addRequiredParam<UserObjectName>("fp_1phase", "Single-phase fluid properties");
30 
31  params.addClassDescription("Computes the dynamic viscosity as a material property");
32 
33  return params;
34 }
35 
38 
39  _mu_name(getParam<MaterialPropertyName>("mu")),
40  _mu(declareProperty<Real>(_mu_name)),
41  _dmu_dbeta(isParamValid("beta") ? &declarePropertyDerivativeTHM<Real>(_mu_name, "beta")
42  : nullptr),
43  _dmu_darhoA(declarePropertyDerivativeTHM<Real>(_mu_name, "arhoA")),
44  _dmu_darhouA(declarePropertyDerivativeTHM<Real>(_mu_name, "arhouA")),
45  _dmu_darhoEA(declarePropertyDerivativeTHM<Real>(_mu_name, "arhoEA")),
46 
47  _v(getMaterialProperty<Real>("v")),
48  _dv_dbeta(isParamValid("beta") ? &getMaterialPropertyDerivativeTHM<Real>("v", "beta")
49  : nullptr),
50  _dv_darhoA(getMaterialPropertyDerivativeTHM<Real>("v", "arhoA")),
51 
52  _e(getMaterialProperty<Real>("e")),
53  _de_darhoA(getMaterialPropertyDerivativeTHM<Real>("e", "arhoA")),
54  _de_darhouA(getMaterialPropertyDerivativeTHM<Real>("e", "arhouA")),
55  _de_darhoEA(getMaterialPropertyDerivativeTHM<Real>("e", "arhoEA")),
56 
57  _fp_1phase(getUserObject<SinglePhaseFluidProperties>("fp_1phase"))
58 {
59 }
60 
61 void
63 {
64  Real dmu_dv, dmu_de;
65  _fp_1phase.mu_from_v_e(_v[_qp], _e[_qp], _mu[_qp], dmu_dv, dmu_de);
66 
67  if (isParamValid("beta"))
68  (*_dmu_dbeta)[_qp] = dmu_dv * (*_dv_dbeta)[_qp];
69  _dmu_darhoA[_qp] = dmu_dv * _dv_darhoA[_qp] + dmu_de * _de_darhoA[_qp];
70  _dmu_darhouA[_qp] = dmu_de * _de_darhouA[_qp];
71  _dmu_darhoEA[_qp] = dmu_de * _de_darhoEA[_qp];
72 }
MaterialProperty< Real > & _dmu_darhoA
const MaterialProperty< Real > & _dv_darhoA
registerMooseObject("ThermalHydraulicsApp", DynamicViscosityMaterial)
Computes dynamic viscosity.
void addRequiredParam(const std::string &name, const std::string &doc_string)
const MaterialProperty< Real > & _de_darhoA
const MaterialProperty< Real > & _de_darhoEA
bool isParamValid(const std::string &name) const
virtual void computeQpProperties() override
static InputParameters validParams()
static InputParameters validParams()
const MaterialProperty< Real > & _e
Specific internal energy.
Common class for single phase fluid properties.
MaterialProperty< Real > & _dmu_darhoEA
void addCoupledVar(const std::string &name, const std::string &doc_string)
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
MaterialProperty< Real > & _dmu_darhouA
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
MaterialProperty< Real > & _mu
void addClassDescription(const std::string &doc_string)
const MaterialProperty< Real > & _v
Specific volume.
const MaterialProperty< Real > & _de_darhouA
DynamicViscosityMaterial(const InputParameters &parameters)
const SinglePhaseFluidProperties & _fp_1phase
Single-phase fluid properties.