https://mooseframework.inl.gov
OneD3EqnMomentumFlux.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 "OneD3EqnMomentumFlux.h"
11 
12 registerMooseObject("ThermalHydraulicsApp", OneD3EqnMomentumFlux);
13 
16 {
18  params.addRequiredCoupledVar("A", "Cross-sectional area");
19  params.addRequiredCoupledVar("arhoA", "alpha*rho*A");
20  params.addRequiredCoupledVar("arhouA", "alpha*rho*u*A");
21  params.addRequiredCoupledVar("arhoEA", "alpha*rho*E*A");
22  params.addRequiredParam<MaterialPropertyName>(
23  "direction", "The direction of the flow channel material property");
24  params.addRequiredParam<MaterialPropertyName>("rho", "Density material property");
25  params.addRequiredParam<MaterialPropertyName>("vel", "Velocity material property");
26  params.addRequiredParam<MaterialPropertyName>("p", "Pressure material property");
27  params.addClassDescription("Computes a momentum flux term for 1-phase flow");
28  return params;
29 }
30 
33 
34  _A(coupledValue("A")),
35 
36  _dir(getMaterialProperty<RealVectorValue>("direction")),
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  _p(getMaterialProperty<Real>("p")),
46  _dp_darhoA(getMaterialPropertyDerivativeTHM<Real>("p", "arhoA")),
47  _dp_darhouA(getMaterialPropertyDerivativeTHM<Real>("p", "arhouA")),
48  _dp_darhoEA(getMaterialPropertyDerivativeTHM<Real>("p", "arhoEA")),
49 
50  _arhoA_var_number(coupled("arhoA")),
51  _arhouA_var_number(coupled("arhouA")),
52  _arhoEA_var_number(coupled("arhoEA"))
53 {
54 }
55 
56 Real
58 {
59  return -(_rho[_qp] * _vel[_qp] * _vel[_qp] + _p[_qp]) * _A[_qp] * _dir[_qp] * _grad_test[_i][_qp];
60 }
61 
62 Real
64 {
65  return -(_rho[_qp] * 2.0 * _vel[_qp] * _dvel_darhouA[_qp] + _dp_darhouA[_qp]) * _A[_qp] *
66  _dir[_qp] * _phi[_j][_qp] * _grad_test[_i][_qp];
67 }
68 
69 Real
71 {
72  if (jvar == _arhoA_var_number)
73  {
74  return -(_drho_darhoA[_qp] * _vel[_qp] * _vel[_qp] +
75  _rho[_qp] * 2.0 * _vel[_qp] * _dvel_darhoA[_qp] + _dp_darhoA[_qp]) *
76  _A[_qp] * _dir[_qp] * _phi[_j][_qp] * _grad_test[_i][_qp];
77  }
78  else if (jvar == _arhoEA_var_number)
79  {
80  return -_dp_darhoEA[_qp] * _A[_qp] * _dir[_qp] * _phi[_j][_qp] * _grad_test[_i][_qp];
81  }
82  else
83  return 0.;
84 }
const MaterialProperty< Real > & _dp_darhoA
const MaterialProperty< Real > & _rho
static InputParameters validParams()
const MaterialProperty< Real > & _dvel_darhouA
Momentum flux for 1-phase flow.
registerMooseObject("ThermalHydraulicsApp", OneD3EqnMomentumFlux)
const MaterialProperty< Real > & _drho_darhoA
void addRequiredParam(const std::string &name, const std::string &doc_string)
virtual Real computeQpOffDiagJacobian(unsigned int jvar)
const unsigned int _arhoEA_var_number
const VariableValue & _A
const MaterialProperty< Real > & _dp_darhoEA
const unsigned int _arhoA_var_number
OneD3EqnMomentumFlux(const InputParameters &parameters)
const MaterialProperty< Real > & _p
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
virtual Real computeQpResidual()
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
static InputParameters validParams()
const MaterialProperty< Real > & _vel
const MaterialProperty< Real > & _dp_darhouA
void addClassDescription(const std::string &doc_string)
virtual Real computeQpJacobian()
const MaterialProperty< RealVectorValue > & _dir
The direction of the flow channel.
const MaterialProperty< Real > & _dvel_darhoA