https://mooseframework.inl.gov
OneD3EqnEnergyFlux.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 "OneD3EqnEnergyFlux.h"
11 
12 registerMooseObject("ThermalHydraulicsApp", OneD3EqnEnergyFlux);
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>("e", "Specific internal energy material property");
27  params.addRequiredParam<MaterialPropertyName>("p", "Pressure material property");
28  params.addClassDescription("Computes an energy flux for single phase flow");
29  return params;
30 }
31 
34  _A(coupledValue("A")),
35  _dir(getMaterialProperty<RealVectorValue>("direction")),
36  _rho(getMaterialProperty<Real>("rho")),
37  _drho_darhoA(getMaterialPropertyDerivativeTHM<Real>("rho", "arhoA")),
38  _vel(getMaterialProperty<Real>("vel")),
39  _dvel_darhoA(getMaterialPropertyDerivativeTHM<Real>("vel", "arhoA")),
40  _dvel_darhouA(getMaterialPropertyDerivativeTHM<Real>("vel", "arhouA")),
41  _e(getMaterialProperty<Real>("e")),
42  _de_darhoA(getMaterialPropertyDerivativeTHM<Real>("e", "arhoA")),
43  _de_darhouA(getMaterialPropertyDerivativeTHM<Real>("e", "arhouA")),
44  _de_darhoEA(getMaterialPropertyDerivativeTHM<Real>("e", "arhoEA")),
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  _arhoA_var_number(coupled("arhoA")),
50  _arhouA_var_number(coupled("arhouA"))
51 {
52 }
53 
54 Real
56 {
57  return -_vel[_qp] * _dir[_qp] * (_rho[_qp] * (_e[_qp] + 0.5 * _vel[_qp] * _vel[_qp]) + _p[_qp]) *
58  _A[_qp] * _grad_test[_i][_qp];
59 }
60 
61 Real
63 {
64  return -_vel[_qp] * _dir[_qp] * (_rho[_qp] * _de_darhoEA[_qp] + _dp_darhoEA[_qp]) * _A[_qp] *
65  _phi[_j][_qp] * _grad_test[_i][_qp];
66 }
67 
68 Real
70 {
71  if (jvar == _arhoA_var_number)
72  {
73  return -(_dvel_darhoA[_qp] * (_rho[_qp] * (_e[_qp] + 0.5 * _vel[_qp] * _vel[_qp]) + _p[_qp]) +
74  _vel[_qp] * (_drho_darhoA[_qp] * (_e[_qp] + 0.5 * _vel[_qp] * _vel[_qp]) +
75  _rho[_qp] * (_de_darhoA[_qp] + _vel[_qp] * _dvel_darhoA[_qp]) +
76  _dp_darhoA[_qp])) *
77  _dir[_qp] * _A[_qp] * _phi[_j][_qp] * _grad_test[_i][_qp];
78  }
79  else if (jvar == _arhouA_var_number)
80  {
81  return -(_dvel_darhouA[_qp] * (_rho[_qp] * (_e[_qp] + 0.5 * _vel[_qp] * _vel[_qp]) + _p[_qp]) +
82  _vel[_qp] * (_rho[_qp] * (_de_darhouA[_qp] + _vel[_qp] * _dvel_darhouA[_qp]) +
83  _dp_darhouA[_qp])) *
84  _dir[_qp] * _A[_qp] * _phi[_j][_qp] * _grad_test[_i][_qp];
85  }
86  else
87  return 0.;
88 }
virtual Real computeQpOffDiagJacobian(unsigned int jvar)
const MaterialProperty< Real > & _dp_darhoA
static InputParameters validParams()
const MaterialProperty< Real > & _dp_darhouA
static InputParameters validParams()
const MaterialProperty< Real > & _dp_darhoEA
virtual Real computeQpJacobian()
const MaterialProperty< Real > & _rho
void addRequiredParam(const std::string &name, const std::string &doc_string)
const MaterialProperty< Real > & _vel
registerMooseObject("ThermalHydraulicsApp", OneD3EqnEnergyFlux)
const MaterialProperty< Real > & _de_darhoA
const MaterialProperty< Real > & _dvel_darhoA
const MaterialProperty< Real > & _p
const MaterialProperty< Real > & _drho_darhoA
const MaterialProperty< Real > & _de_darhoEA
const MaterialProperty< Real > & _e
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
const VariableValue & _A
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
OneD3EqnEnergyFlux(const InputParameters &parameters)
const MaterialProperty< Real > & _de_darhouA
Energy flux for single phase flow.
void addClassDescription(const std::string &doc_string)
const unsigned int _arhoA_var_number
const MaterialProperty< RealVectorValue > & _dir
The direction of the flow channel.
virtual Real computeQpResidual()
const MaterialProperty< Real > & _dvel_darhouA
const unsigned int _arhouA_var_number