https://mooseframework.inl.gov
ADBoundaryFlux3EqnGhostDensityVelocity.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 "Numerics.h"
13 #include "THMIndicesVACE.h"
14 
16 
19 {
21 
22  params.addClassDescription("Computes boundary flux from density and velocity for the 3-equation "
23  "model using a ghost cell approach.");
24 
25  params.addRequiredParam<Real>("rho", "Density");
26  params.addRequiredParam<Real>("vel", "Velocity");
27  params.addParam<bool>("reversible", true, "True for reversible, false for pure inlet");
28 
29  params.addRequiredParam<UserObjectName>("fluid_properties",
30  "1-phase fluid properties user object name");
31 
32  params.declareControllable("rho vel");
33 
34  return params;
35 }
36 
38  const InputParameters & parameters)
39  : ADBoundaryFlux3EqnGhostBase(parameters),
40 
41  _rho(getParam<Real>("rho")),
42  _vel(getParam<Real>("vel")),
43  _reversible(getParam<bool>("reversible")),
44 
45  _fp(getUserObjectByName<SinglePhaseFluidProperties>(
46  getParam<UserObjectName>("fluid_properties")))
47 {
48 }
49 
50 std::vector<ADReal>
52  const std::vector<ADReal> & U_interior) const
53 {
54  const ADReal rhoA = U_interior[THMVACE1D::RHOA];
55  const ADReal rhouA = U_interior[THMVACE1D::RHOUA];
56  const ADReal rhoEA = U_interior[THMVACE1D::RHOEA];
57  const ADReal A = U_interior[THMVACE1D::AREA];
58 
59  std::vector<ADReal> U_ghost(THMVACE1D::N_FLUX_INPUTS);
61  {
62  // Get the pressure from the interior solution
63 
64  const ADReal rho = rhoA / A;
65  const ADReal vel = rhouA / rhoA;
66  const ADReal E = rhoEA / rhoA;
67  const ADReal e = E - 0.5 * vel * vel;
68  const ADReal p = _fp.p_from_v_e(1.0 / rho, e);
69 
70  // Compute remaining boundary quantities
71 
72  const ADReal e_b = _fp.e_from_p_rho(p, _rho);
73  const ADReal E_b = e_b + 0.5 * _vel * _vel;
74 
75  // compute ghost solution
76  U_ghost[THMVACE1D::RHOA] = _rho * A;
77  U_ghost[THMVACE1D::RHOUA] = _rho * _vel * A;
78  U_ghost[THMVACE1D::RHOEA] = _rho * E_b * A;
79  U_ghost[THMVACE1D::AREA] = A;
80  }
81  else
82  {
83  U_ghost[THMVACE1D::RHOA] = rhoA;
84  U_ghost[THMVACE1D::RHOUA] = rhoA * _vel;
85  U_ghost[THMVACE1D::RHOEA] = rhoEA;
86  U_ghost[THMVACE1D::AREA] = A;
87  }
88 
89  return U_ghost;
90 }
static InputParameters validParams()
const SinglePhaseFluidProperties & _fp
Fluid properties object.
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
virtual std::vector< ADReal > getGhostCellSolution(const std::vector< ADReal > &U_interior) const override
Gets the solution vector in the ghost cell.
registerMooseObject("ThermalHydraulicsApp", ADBoundaryFlux3EqnGhostDensityVelocity)
void addRequiredParam(const std::string &name, const std::string &doc_string)
Computes boundary flux from densities and velocities for the 3-equation model using a ghost cell appr...
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.
ADBoundaryFlux3EqnGhostDensityVelocity(const InputParameters &parameters)
void declareControllable(const std::string &name, std::set< ExecFlagType > execute_flags={})