https://mooseframework.inl.gov
ADBoundaryFlux3EqnGhostVelocityTemperature.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 "THMIndicesVACE.h"
13 #include "Numerics.h"
14 
16 
19 {
21 
22  params.addClassDescription(
23  "Computes a boundary flux from a specified velocity and temperature for the 1-D, "
24  "1-phase, variable-area Euler equations using a ghost cell");
25 
26  params.addRequiredParam<Real>("vel", "Specified velocity");
27  params.addRequiredParam<Real>("T", "Specified temperature");
28  params.addParam<bool>("reversible", true, "True for reversible, false for pure inlet");
29 
30  params.addRequiredParam<UserObjectName>("fluid_properties",
31  "Name of single-phase fluid properties user object");
32 
33  params.declareControllable("vel T");
34  return params;
35 }
36 
38  const InputParameters & parameters)
39  : ADBoundaryFlux3EqnGhostBase(parameters),
40 
41  _vel(getParam<Real>("vel")),
42  _T(getParam<Real>("T")),
43  _reversible(getParam<bool>("reversible")),
44  _fp(getUserObject<SinglePhaseFluidProperties>("fluid_properties"))
45 {
46 }
47 
48 std::vector<ADReal>
50  const std::vector<ADReal> & U) const
51 {
52  const ADReal rhoA = U[THMVACE1D::RHOA];
53  const ADReal rhouA = U[THMVACE1D::RHOUA];
54  const ADReal rhoEA = U[THMVACE1D::RHOEA];
55  const ADReal A = U[THMVACE1D::AREA];
56 
57  const ADReal rho = rhoA / A;
58  std::vector<ADReal> U_ghost(THMVACE1D::N_FLUX_INPUTS);
60  {
61  // Pressure is the only quantity coming from the interior
62  const ADReal vel = rhouA / rhoA;
63  const ADReal E = rhoEA / rhoA;
64  const ADReal e = E - 0.5 * vel * vel;
65  const ADReal p = _fp.p_from_v_e(1.0 / rho, e);
66 
67  const ADReal rho_b = _fp.rho_from_p_T(p, _T);
68  const ADReal rhouA_b = rho_b * _vel * A;
69  const ADReal e_b = _fp.e_from_p_rho(p, rho_b);
70  const ADReal E_b = e_b + 0.5 * _vel * _vel;
71 
72  U_ghost[THMVACE1D::RHOA] = rho_b * A;
73  U_ghost[THMVACE1D::RHOUA] = rhouA_b;
74  U_ghost[THMVACE1D::RHOEA] = rho_b * E_b * A;
75  U_ghost[THMVACE1D::AREA] = A;
76  }
77  else
78  {
79  U_ghost[THMVACE1D::RHOA] = rhoA;
80  U_ghost[THMVACE1D::RHOUA] = rhoA * _vel;
81  U_ghost[THMVACE1D::RHOEA] = rhoEA;
82  U_ghost[THMVACE1D::AREA] = A;
83  }
84 
85  return U_ghost;
86 }
static InputParameters validParams()
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
void addRequiredParam(const std::string &name, const std::string &doc_string)
Computes boundary fluxes for the 1-D, variable-area Euler equations using a numerical flux user objec...
const SinglePhaseFluidProperties & _fp
Fluid properties object.
Common class for single phase fluid properties.
static const unsigned int N_FLUX_INPUTS
Number of numerical flux function inputs for 1D.
ADBoundaryFlux3EqnGhostVelocityTemperature(const InputParameters &parameters)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
bool isInlet(Real vel, Real normal)
Determine if inlet boundary condition should be applied.
Definition: Numerics.C:235
registerMooseObject("ThermalHydraulicsApp", ADBoundaryFlux3EqnGhostVelocityTemperature)
void addClassDescription(const std::string &doc_string)
virtual std::vector< ADReal > getGhostCellSolution(const std::vector< ADReal > &U) const override
Gets the solution vector in the ghost cell.
const Real & _normal
Outward normal.
void declareControllable(const std::string &name, std::set< ExecFlagType > execute_flags={})
Computes a boundary flux from a specified velocity and temperature for the 1-D, 1-phase, variable-area Euler equations using a ghost cell.