https://mooseframework.inl.gov
OneD3EqnMomentumFriction.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 
12 registerMooseObject("ThermalHydraulicsApp", OneD3EqnMomentumFriction);
13 
16 {
18  params.addRequiredCoupledVar("A", "Cross-sectional area");
19  params.addRequiredParam<MaterialPropertyName>("D_h", "Hydraulic diameter");
20  params.addRequiredCoupledVar("arhoA", "Solution variable alpha*rho*A");
21  params.addRequiredCoupledVar("arhouA", "Solution variable alpha*rho*u*A");
22  params.addRequiredCoupledVar("arhoEA", "Solution variable alpha*rho*E*A");
23  params.addRequiredParam<MaterialPropertyName>("rho", "Density property");
24  params.addRequiredParam<MaterialPropertyName>("vel", "Velocity property");
25  params.addRequiredParam<MaterialPropertyName>("f_D",
26  "Darcy friction factor coefficient property");
27  params.addClassDescription("Computes wall friction term for single phase flow.");
28  return params;
29 }
30 
33  _A(coupledValue("A")),
34  _D_h(getMaterialProperty<Real>("D_h")),
35  _rho(getMaterialProperty<Real>("rho")),
36  _drho_darhoA(getMaterialPropertyDerivativeTHM<Real>("rho", "arhoA")),
37  _vel(getMaterialProperty<Real>("vel")),
38  _dvel_darhoA(getMaterialPropertyDerivativeTHM<Real>("vel", "arhoA")),
39  _dvel_darhouA(getMaterialPropertyDerivativeTHM<Real>("vel", "arhouA")),
40  _f_D(getMaterialProperty<Real>("f_D")),
41  _df_D_darhoA(getMaterialPropertyDerivativeTHM<Real>("f_D", "arhoA")),
42  _df_D_darhouA(getMaterialPropertyDerivativeTHM<Real>("f_D", "arhouA")),
43  _df_D_darhoEA(getMaterialPropertyDerivativeTHM<Real>("f_D", "arhoEA")),
44  _arhoA_var_number(coupled("arhoA")),
45  _arhouA_var_number(coupled("arhouA")),
46  _arhoEA_var_number(coupled("arhoEA"))
47 {
48 }
49 
50 Real
52 {
53  return 0.5 * _f_D[_qp] * _rho[_qp] * _vel[_qp] * std::abs(_vel[_qp]) * _A[_qp] / _D_h[_qp] *
54  _test[_i][_qp];
55 }
56 
57 Real
59 {
60  return computeQpOffDiagJacobian(_var.number());
61 }
62 
63 Real
65 {
66  if (jvar == _arhoA_var_number)
67  {
68  const Real vel2 = _vel[_qp] * std::abs(_vel[_qp]);
69  const Real dvel2_darhoA = 2 * std::abs(_vel[_qp]) * _dvel_darhoA[_qp];
70  return (_df_D_darhoA[_qp] * _rho[_qp] * vel2 + _f_D[_qp] * _drho_darhoA[_qp] * vel2 +
71  _f_D[_qp] * _rho[_qp] * dvel2_darhoA) *
72  0.5 * _A[_qp] / _D_h[_qp] * _phi[_j][_qp] * _test[_i][_qp];
73  }
74  else if (jvar == _arhouA_var_number)
75  {
76  const Real vel2 = _vel[_qp] * std::abs(_vel[_qp]);
77  const Real dvel2_darhouA = 2 * std::abs(_vel[_qp]) * _dvel_darhouA[_qp];
78  return (_df_D_darhouA[_qp] * vel2 + _f_D[_qp] * dvel2_darhouA) * 0.5 * _rho[_qp] * _A[_qp] /
79  _D_h[_qp] * _phi[_j][_qp] * _test[_i][_qp];
80  }
81  else if (jvar == _arhoEA_var_number)
82  {
83  return _df_D_darhoEA[_qp] * 0.5 * _rho[_qp] * _vel[_qp] * std::abs(_vel[_qp]) * _A[_qp] /
84  _D_h[_qp] * _phi[_j][_qp] * _test[_i][_qp];
85  }
86  else
87  return 0;
88 }
const MaterialProperty< Real > & _f_D
Darcy friction factor.
const MaterialProperty< Real > & _df_D_darhoEA
static InputParameters validParams()
const MaterialProperty< Real > & _vel
velocity
Computes wall friction term for single phase flow.
const MaterialProperty< Real > & _rho
Density.
const MaterialProperty< Real > & _dvel_darhoA
void addRequiredParam(const std::string &name, const std::string &doc_string)
const MaterialProperty< Real > & _D_h
Hydraulic diameter.
const MaterialProperty< Real > & _drho_darhoA
const MaterialProperty< Real > & _dvel_darhouA
const MaterialProperty< Real > & _df_D_darhoA
virtual Real computeQpResidual() override
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
OneD3EqnMomentumFriction(const InputParameters &parameters)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
static InputParameters validParams()
const VariableValue & _A
area
void addClassDescription(const std::string &doc_string)
registerMooseObject("ThermalHydraulicsApp", OneD3EqnMomentumFriction)
virtual Real computeQpOffDiagJacobian(unsigned int jvar) override
virtual Real computeQpJacobian() override
const MaterialProperty< Real > & _df_D_darhouA