https://mooseframework.inl.gov
BoundaryFlux3EqnFunction.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"
12 #include "Function.h"
13 #include "Assembly.h"
14 
15 registerMooseObject("ThermalHydraulicsTestApp", BoundaryFlux3EqnFunction);
16 
19 {
21 
22  params.addClassDescription(
23  "Computes the 1-phase boundary flux directly from specified functions.");
24 
25  params.addRequiredParam<FunctionName>("rho", "Specified density function");
26  params.addRequiredParam<FunctionName>("vel", "Specified velocity function");
27  params.addRequiredParam<FunctionName>("p", "Specified pressure function");
28 
29  params.addRequiredParam<UserObjectName>("fluid_properties",
30  "Name of fluid properties user object");
31 
32  return params;
33 }
34 
36  : ADBoundaryFluxBase(parameters),
37 
38  _rho_fn(getFunction("rho")),
39  _vel_fn(getFunction("vel")),
40  _p_fn(getFunction("p")),
41  _fp(getUserObject<SinglePhaseFluidProperties>("fluid_properties"))
42 {
43 }
44 
45 void
46 BoundaryFlux3EqnFunction::calcFlux(unsigned int /*iside*/,
47  dof_id_type /*ielem*/,
48  const std::vector<ADReal> & U1,
49  const RealVectorValue & /*normal*/,
50  std::vector<ADReal> & flux) const
51 {
52  const Point & q_point = _assembly.sideElem()->vertex_average();
53  const Real rho = _rho_fn.value(_t, q_point);
54  const Real vel = _vel_fn.value(_t, q_point);
55  const Real p = _p_fn.value(_t, q_point);
56 
58 
59  const Real e = _fp.e_from_p_rho(p, rho);
60  const Real E = e + 0.5 * vel * vel;
61 
62  flux.resize(THMVACE1D::N_FLUX_OUTPUTS);
63  flux[THMVACE1D::MASS] = rho * vel * A;
64  flux[THMVACE1D::MOMENTUM] = (rho * vel * vel + p) * A;
65  flux[THMVACE1D::ENERGY] = vel * (rho * E + p) * A;
66 }
const SinglePhaseFluidProperties & _fp
static InputParameters validParams()
virtual void calcFlux(unsigned int iside, dof_id_type ielem, const std::vector< ADReal > &U1, const RealVectorValue &normal, std::vector< ADReal > &flux) const override
Solve the Riemann problem on the boundary face.
auto raw_value(const Eigen::Map< T > &in)
void addRequiredParam(const std::string &name, const std::string &doc_string)
BoundaryFlux3EqnFunction(const InputParameters &parameters)
Common class for single phase fluid properties.
A base class for computing/caching fluxes at boundaries.
static const unsigned int N_FLUX_OUTPUTS
Number of numerical flux function outputs for 1D.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void addClassDescription(const std::string &doc_string)
Computes the 1-phase boundary flux directly from specified functions.
static InputParameters validParams()
virtual Real value(Real t, const Point &p) const
const Elem *& sideElem()
uint8_t dof_id_type
registerMooseObject("ThermalHydraulicsTestApp", BoundaryFlux3EqnFunction)