https://mooseframework.inl.gov
VolumeJunctionCoupledFlux1PhasePostprocessor.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 
14 #include "THMIndicesVACE.h"
15 
17 
20 {
22 
23  MooseEnum equation("mass energy");
25  "equation", equation, "Equation for which to query flux vector");
26  params.addRequiredParam<PostprocessorName>("pressure", "Pressure post-processor");
27  params.addRequiredParam<PostprocessorName>("temperature", "Temperature post-processor");
28  params.addRequiredParam<Real>("A_coupled", "Area of the flux coupling");
29  params.addRequiredParam<RealVectorValue>("normal_from_junction",
30  "Unit normal vector from the junction");
31  params.addRequiredParam<UserObjectName>(
32  "volume_junction_uo",
33  "ADVolumeJunction1PhaseUserObject object corresponding to the volume junction");
34  params.addRequiredParam<UserObjectName>("numerical_flux_uo", "ADNumericalFlux3EqnBase object");
35  params.addRequiredParam<UserObjectName>("fluid_properties", "SinglePhaseFluidProperties object");
36 
37  params.addClassDescription("Computes a mass or energy flux for VolumeJunctionCoupledFlux1Phase.");
38 
39  return params;
40 }
41 
43  const InputParameters & parameters)
44  : GeneralPostprocessor(parameters),
45  _equation(getParam<MooseEnum>("equation")),
46  _p(getPostprocessorValue("pressure")),
47  _T(getPostprocessorValue("temperature")),
48  _A_coupled(getParam<Real>("A_coupled")),
49  _normal_from_junction(getParam<RealVectorValue>("normal_from_junction")),
50  _normal_to_junction(-_normal_from_junction),
51  _volume_junction_uo(getUserObject<ADVolumeJunction1PhaseUserObject>("volume_junction_uo")),
52  _numerical_flux_uo(getUserObject<ADNumericalFlux3EqnBase>("numerical_flux_uo")),
53  _fp(getUserObject<SinglePhaseFluidProperties>("fluid_properties"))
54 {
55 }
56 
57 void
59 {
60  const auto rho = _fp.rho_from_p_T(_p, _T);
61  const auto E = _fp.e_from_p_T(_p, _T);
62 
63  std::vector<ADReal> U(THMVACE3D::N_FLUX_INPUTS, 0.0);
65  U[THMVACE3D::RHOEA] = rho * E * _A_coupled;
67 
68  const auto flux_3d =
70 
71  if (_equation == "mass")
72  _value = raw_value(flux_3d[THMVACE3D::MASS]);
73  else if (_equation == "energy")
75  else
76  mooseError("Invalid MooseEnum value.");
77 }
78 
81 {
82  return _value;
83 }
const RealVectorValue _normal_to_junction
Normal vector to the junction from the other application.
auto raw_value(const Eigen::Map< T > &in)
void addRequiredParam(const std::string &name, const std::string &doc_string)
const SinglePhaseFluidProperties & _fp
Fluid properties.
static InputParameters validParams()
const double rho
Common class for single phase fluid properties.
std::vector< ADReal > compute3DFlux(const ADNumericalFlux3EqnBase &numerical_flux, const std::vector< ADReal > &Ui, const RealVectorValue &ni) const
Base class for computing numerical fluxes for FlowModelSinglePhase.
registerMooseObject("ThermalHydraulicsApp", VolumeJunctionCoupledFlux1PhasePostprocessor)
Computes and caches flux and residual vectors for a 1-phase volume junction.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const ADNumericalFlux3EqnBase & _numerical_flux_uo
Numerical flux user object.
Scalar< const PostprocessorValue > PostprocessorValue
void mooseError(Args &&... args) const
void addClassDescription(const std::string &doc_string)
Computes a mass or energy flux for VolumeJunctionCoupledFlux1Phase.
static const unsigned int N_FLUX_INPUTS
Number of numerical flux function inputs for 3D.
const Real _A_coupled
Coupled area between junction and other application.
const ADVolumeJunction1PhaseUserObject & _volume_junction_uo
Volume junction user object.