https://mooseframework.inl.gov
OneD3EqnMomentumFormLoss.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 #include "Function.h"
12 
13 registerMooseObject("ThermalHydraulicsApp", OneD3EqnMomentumFormLoss);
14 
17 {
19 
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 
24  params.addRequiredCoupledVar("A", "Cross-sectional area");
25  params.addRequiredParam<MaterialPropertyName>("rho", "Density property");
26  params.addRequiredParam<MaterialPropertyName>("vel", "Velocity property");
27  params.addClassDescription(
28  "Computes a form loss term for the momentum equation for 1-phase flow");
29 
30  return params;
31 }
32 
35 
36  _A(coupledValue("A")),
37 
38  _rho(getMaterialProperty<Real>("rho")),
39  _drho_darhoA(getMaterialPropertyDerivativeTHM<Real>("rho", "arhoA")),
40 
41  _vel(getMaterialProperty<Real>("vel")),
42  _dvel_darhoA(getMaterialPropertyDerivativeTHM<Real>("vel", "arhoA")),
43  _dvel_darhouA(getMaterialPropertyDerivativeTHM<Real>("vel", "arhouA")),
44 
45  _K_prime(getMaterialProperty<Real>("K_prime")),
46 
47  _arhoA_var_number(coupled("arhoA")),
48  _arhouA_var_number(coupled("arhouA")),
49  _arhoEA_var_number(coupled("arhoEA"))
50 {
51 }
52 
53 Real
55 {
56  return _K_prime[_qp] * 0.5 * _rho[_qp] * _vel[_qp] * std::abs(_vel[_qp]) * _A[_qp] *
57  _test[_i][_qp];
58 }
59 
60 Real
62 {
63  return computeQpOffDiagJacobian(_var.number());
64 }
65 
66 Real
68 {
69  if (jvar == _arhoA_var_number)
70  {
71  const Real drhou2_darhoA = _drho_darhoA[_qp] * _vel[_qp] * std::abs(_vel[_qp]) +
72  2.0 * _rho[_qp] * std::abs(_vel[_qp]) * _dvel_darhoA[_qp];
73 
74  return _K_prime[_qp] * 0.5 * drhou2_darhoA * _A[_qp] * _phi[_j][_qp] * _test[_i][_qp];
75  }
76  else if (jvar == _arhouA_var_number)
77  {
78  const Real drhou2_darhouA = 2.0 * _rho[_qp] * std::abs(_vel[_qp]) * _dvel_darhouA[_qp];
79 
80  return _K_prime[_qp] * 0.5 * drhou2_darhouA * _A[_qp] * _phi[_j][_qp] * _test[_i][_qp];
81  }
82  else if (jvar == _arhoEA_var_number)
83  return 0.;
84  else
85  return 0;
86 }
static InputParameters validParams()
const MaterialProperty< Real > & _dvel_darhouA
const MaterialProperty< Real > & _vel
velocity
const VariableValue & _A
area
void addRequiredParam(const std::string &name, const std::string &doc_string)
const MaterialProperty< Real > & _rho
density
virtual Real computeQpResidual() override
static InputParameters validParams()
virtual Real computeQpJacobian() override
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
registerMooseObject("ThermalHydraulicsApp", OneD3EqnMomentumFormLoss)
const MaterialProperty< Real > & _dvel_darhoA
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const MaterialProperty< Real > & _drho_darhoA
Computes the force per unit length due to form loss, provided a form loss coefficient per unit length...
void addClassDescription(const std::string &doc_string)
virtual Real computeQpOffDiagJacobian(unsigned int jvar) override
OneD3EqnMomentumFormLoss(const InputParameters &parameters)
const MaterialProperty< Real > & _K_prime
form loss coefficient per unit length function