https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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
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
48std::vector<ADReal>
50 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 rhoEA = U[THMVACE1D::RHOEA];
56 const ADReal A = U[THMVACE1D::AREA];
57
58 const ADReal rho = rhoA / A;
59 std::vector<ADReal> U_ghost(THMVACE1D::N_FLUX_INPUTS);
61 {
62 // Pressure is the only quantity coming from the interior
63 const ADReal vel = rhouA / rhoA;
64 const ADReal E = rhoEA / rhoA;
65 const ADReal e = E - 0.5 * vel * vel;
66 const ADReal p = _fp.p_from_v_e(1.0 / rho, e);
67
68 const ADReal rho_b = _fp.rho_from_p_T(p, _T);
69 const ADReal rhouA_b = rho_b * _vel * A;
70 const ADReal e_b = _fp.e_from_p_rho(p, rho_b);
71 const ADReal E_b = e_b + 0.5 * _vel * _vel;
72
73 U_ghost[THMVACE1D::RHOA] = rho_b * A;
74 U_ghost[THMVACE1D::RHOUA] = rhouA_b;
75 U_ghost[THMVACE1D::RHOEA] = rho_b * E_b * A;
76 U_ghost[THMVACE1D::AREA] = A;
77 }
78 else
79 {
80 U_ghost[THMVACE1D::RHOA] = rhoA;
81 U_ghost[THMVACE1D::RHOUA] = rhoA * _vel;
82 U_ghost[THMVACE1D::RHOEA] = rhoEA;
83 U_ghost[THMVACE1D::AREA] = A;
84 }
85
86 return U_ghost;
87}
registerMooseObject("ThermalHydraulicsApp", ADBoundaryFlux3EqnGhostVelocityTemperature)
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 a boundary flux from a specified velocity and temperature for the 1-D, 1-phase,...
const SinglePhaseFluidProperties & _fp
Fluid properties object.
virtual std::vector< ADReal > getGhostCellSolution(const std::vector< ADReal > &U, 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