https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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
50std::vector<ADReal>
52 const Point & /*point*/) const
53{
54 mooseAssert(U_interior.size() == THMVACE1D::N_FLUX_INPUTS, "Passive transport not implemented");
55 const ADReal rhoA = U_interior[THMVACE1D::RHOA];
56 const ADReal rhouA = U_interior[THMVACE1D::RHOUA];
57 const ADReal rhoEA = U_interior[THMVACE1D::RHOEA];
58 const ADReal A = U_interior[THMVACE1D::AREA];
59
60 std::vector<ADReal> U_ghost(THMVACE1D::N_FLUX_INPUTS);
62 {
63 // Get the pressure from the interior solution
64
65 const ADReal rho = rhoA / A;
66 const ADReal vel = rhouA / rhoA;
67 const ADReal E = rhoEA / rhoA;
68 const ADReal e = E - 0.5 * vel * vel;
69 const ADReal p = _fp.p_from_v_e(1.0 / rho, e);
70
71 // Compute remaining boundary quantities
72
73 const ADReal e_b = _fp.e_from_p_rho(p, _rho);
74 const ADReal E_b = e_b + 0.5 * _vel * _vel;
75
76 // compute ghost solution
77 U_ghost[THMVACE1D::RHOA] = _rho * A;
78 U_ghost[THMVACE1D::RHOUA] = _rho * _vel * A;
79 U_ghost[THMVACE1D::RHOEA] = _rho * E_b * A;
80 U_ghost[THMVACE1D::AREA] = A;
81 }
82 else
83 {
84 U_ghost[THMVACE1D::RHOA] = rhoA;
85 U_ghost[THMVACE1D::RHOUA] = rhoA * _vel;
86 U_ghost[THMVACE1D::RHOEA] = rhoEA;
87 U_ghost[THMVACE1D::AREA] = A;
88 }
89
90 return U_ghost;
91}
registerMooseObject("ThermalHydraulicsApp", ADBoundaryFlux3EqnGhostDensityVelocity)
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 densities and velocities for the 3-equation model using a ghost cell appr...
virtual std::vector< ADReal > getGhostCellSolution(const std::vector< ADReal > &U_interior, const Point &point) const override
Gets the solution vector in the ghost cell.
const SinglePhaseFluidProperties & _fp
Fluid properties object.
ADBoundaryFlux3EqnGhostDensityVelocity(const InputParameters &parameters)
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