https://mooseframework.inl.gov
ADBoundaryFlux3EqnGhostStagnationPressureTemperature.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 
12 #include "THMIndicesVACE.h"
13 #include "Numerics.h"
14 
16 
19 {
21 
22  params.addClassDescription("Computes boundary flux from a specified stagnation pressure and "
23  "temperature for the 1-D, 1-phase, variable-area Euler equations");
24 
25  params.addRequiredParam<Real>("p0", "Stagnation pressure");
26  params.addRequiredParam<Real>("T0", "Stagnation temperature");
27  params.addParam<bool>("reversible", true, "True for reversible, false for pure inlet");
28 
29  params.addRequiredParam<UserObjectName>("fluid_properties",
30  "Name of fluid properties user object");
31 
32  params.declareControllable("p0 T0");
33 
34  return params;
35 }
36 
39  : ADBoundaryFlux3EqnGhostBase(parameters),
40 
41  _p0(getParam<Real>("p0")),
42  _T0(getParam<Real>("T0")),
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 A = U[THMVACE1D::AREA];
55 
56  const ADReal vel = rhouA / rhoA;
57 
58  std::vector<ADReal> U_ghost(THMVACE1D::N_FLUX_INPUTS);
59  if (!_reversible || THM::isInlet(vel, _normal))
60  {
61  // compute stagnation quantities
62  const ADReal rho0 = _fp.rho_from_p_T(_p0, _T0);
63  const ADReal e0 = _fp.e_from_p_rho(_p0, rho0);
64  const ADReal v0 = 1.0 / rho0;
65  const ADReal h0 = _fp.h_from_p_T(_p0, _T0);
66  const ADReal s0 = _fp.s_from_v_e(v0, e0);
67 
68  // compute static quantities
69  const ADReal h = h0 - 0.5 * vel * vel;
70  const ADReal s = s0;
71  const ADReal p = _fp.p_from_h_s(h, s);
72  const ADReal rho = _fp.rho_from_p_s(p, s);
73  const ADReal e = _fp.e_from_p_rho(p, rho);
74  const ADReal E = e + 0.5 * vel * vel;
75 
76  U_ghost[THMVACE1D::RHOA] = rho * A;
77  U_ghost[THMVACE1D::RHOUA] = rho * vel * A;
78  U_ghost[THMVACE1D::RHOEA] = rho * E * A;
79  U_ghost[THMVACE1D::AREA] = A;
80  }
81  else
82  {
83  const ADReal rho = rhoA / A;
84  const ADReal E = _fp.e_from_p_rho(_p0, rho) + 0.5 * vel * vel;
85 
86  U_ghost[THMVACE1D::RHOA] = rhoA;
87  U_ghost[THMVACE1D::RHOUA] = rhouA;
88  U_ghost[THMVACE1D::RHOEA] = rhoA * E;
89  U_ghost[THMVACE1D::AREA] = A;
90  }
91 
92  return U_ghost;
93 }
static InputParameters validParams()
virtual std::vector< ADReal > getGhostCellSolution(const std::vector< ADReal > &U1) const override
Gets the solution vector in the ghost cell.
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
Computes boundary flux from a specified stagnation pressure and temperature for the 1-D...
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...
Common class for single phase fluid properties.
static const unsigned int N_FLUX_INPUTS
Number of numerical flux function inputs for 1D.
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
void addClassDescription(const std::string &doc_string)
const Real & _normal
Outward normal.
void declareControllable(const std::string &name, std::set< ExecFlagType > execute_flags={})
registerMooseObject("ThermalHydraulicsApp", ADBoundaryFlux3EqnGhostStagnationPressureTemperature)