https://mooseframework.inl.gov
ADBoundaryFlux3EqnGhostPressure.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 pressure for the 1-D, "
23  "1-phase, variable-area Euler equations");
24 
25  params.addRequiredParam<Real>("p", "Pressure");
26 
27  params.addRequiredParam<UserObjectName>("fluid_properties",
28  "Name of fluid properties user object");
29 
30  params.declareControllable("p");
31  return params;
32 }
33 
35  : ADBoundaryFlux3EqnGhostBase(parameters),
36 
37  _p(getParam<Real>("p")),
38  _fp(getUserObject<SinglePhaseFluidProperties>("fluid_properties"))
39 {
40 }
41 
42 std::vector<ADReal>
43 ADBoundaryFlux3EqnGhostPressure::getGhostCellSolution(const std::vector<ADReal> & U) const
44 {
45  const ADReal rhoA = U[THMVACE1D::RHOA];
46  const ADReal rhouA = U[THMVACE1D::RHOUA];
47  const ADReal A = U[THMVACE1D::AREA];
48 
49  const ADReal rho = rhoA / A;
50  const ADReal vel = rhouA / rhoA;
51  const ADReal E = _fp.e_from_p_rho(_p, rho) + 0.5 * vel * vel;
52 
53  std::vector<ADReal> U_ghost(THMVACE1D::N_FLUX_INPUTS);
54  U_ghost[THMVACE1D::RHOA] = rhoA;
55  U_ghost[THMVACE1D::RHOUA] = rhouA;
56  U_ghost[THMVACE1D::RHOEA] = rhoA * E;
57  U_ghost[THMVACE1D::AREA] = A;
58 
59  return U_ghost;
60 }
static InputParameters validParams()
Computes boundary flux from a specified pressure for the 1-D, 1-phase, variable-area Euler equations...
void addRequiredParam(const std::string &name, const std::string &doc_string)
const SinglePhaseFluidProperties & _fp
Fluid properties object.
ADBoundaryFlux3EqnGhostPressure(const InputParameters &parameters)
virtual std::vector< ADReal > getGhostCellSolution(const std::vector< ADReal > &U1) const override
Gets the solution vector in the ghost cell.
registerMooseObject("ThermalHydraulicsApp", ADBoundaryFlux3EqnGhostPressure)
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
void addClassDescription(const std::string &doc_string)
void declareControllable(const std::string &name, std::set< ExecFlagType > execute_flags={})