https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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
48std::vector<ADReal>
50 const std::vector<ADReal> & U, const Point & /*point*/) const
51{
52 mooseAssert(U.size() == THMVACE1D::N_FLUX_INPUTS, "Passive transport not implemented");
53 const ADReal rhoA = U[THMVACE1D::RHOA];
54 const ADReal rhouA = U[THMVACE1D::RHOUA];
55 const ADReal A = U[THMVACE1D::AREA];
56
57 const ADReal vel = rhouA / rhoA;
58
59 std::vector<ADReal> U_ghost(THMVACE1D::N_FLUX_INPUTS);
60 if (!_reversible || THM::isInlet(vel, _normal))
61 {
62 // compute stagnation quantities
63 const ADReal rho0 = _fp.rho_from_p_T(_p0, _T0);
64 const ADReal e0 = _fp.e_from_p_rho(_p0, rho0);
65 const ADReal v0 = 1.0 / rho0;
66 const ADReal h0 = _fp.h_from_p_T(_p0, _T0);
67 const ADReal s0 = _fp.s_from_v_e(v0, e0);
68
69 // compute static quantities
70 const ADReal h = h0 - 0.5 * vel * vel;
71 const ADReal s = s0;
72 const ADReal p = _fp.p_from_h_s(h, s);
73 const ADReal rho = _fp.rho_from_p_s(p, s);
74 const ADReal e = _fp.e_from_p_rho(p, rho);
75 const ADReal E = e + 0.5 * vel * vel;
76
77 U_ghost[THMVACE1D::RHOA] = rho * A;
78 U_ghost[THMVACE1D::RHOUA] = rho * vel * A;
79 U_ghost[THMVACE1D::RHOEA] = rho * E * A;
80 U_ghost[THMVACE1D::AREA] = A;
81 }
82 else
83 {
84 const ADReal rho = rhoA / A;
85 const ADReal E = _fp.e_from_p_rho(_p0, rho) + 0.5 * vel * vel;
86
87 U_ghost[THMVACE1D::RHOA] = rhoA;
88 U_ghost[THMVACE1D::RHOUA] = rhouA;
89 U_ghost[THMVACE1D::RHOEA] = rhoA * E;
90 U_ghost[THMVACE1D::AREA] = A;
91 }
92
93 return U_ghost;
94}
registerMooseObject("ThermalHydraulicsApp", ADBoundaryFlux3EqnGhostStagnationPressureTemperature)
DualNumber< Real, DNDerivativeType, true > ADReal
const Real p
const double rho
Computes boundary fluxes for the 1-D, variable-area Euler equations using a numerical flux user objec...
const Real & _normal
Outward normal.
Computes boundary flux from a specified stagnation pressure and temperature for the 1-D,...
virtual std::vector< ADReal > getGhostCellSolution(const std::vector< ADReal > &U1, const Point &point) const override
Gets the solution vector in the ghost cell.
void declareControllable(const std::string &name, std::set< ExecFlagType > execute_flags={})
void addRequiredParam(const std::string &name, const std::string &doc_string)
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
Common class for single phase fluid properties.
static const unsigned int N_FLUX_INPUTS
Number of numerical flux function inputs for 1D.
bool isInlet(Real vel, Real normal)
Determine if inlet boundary condition should be applied.
Definition Numerics.C:235