https://mooseframework.inl.gov
VolumeJunctionCoupledFlux1PhaseKernel.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  params.addRequiredParam<unsigned int>("equation_index", "Equation index");
24  params.addRequiredParam<PostprocessorName>("pressure", "Pressure post-processor");
25  params.addRequiredParam<PostprocessorName>("temperature", "Temperature post-processor");
26  params.addRequiredParam<Real>("A_coupled", "Area of the flux coupling");
27  params.addRequiredParam<RealVectorValue>("normal_from_junction",
28  "Unit normal vector from the junction");
29  params.addRequiredParam<UserObjectName>("volume_junction_uo", "Volume junction object");
30  params.addRequiredParam<UserObjectName>("numerical_flux_uo", "Numerical flux object");
31  params.addRequiredParam<UserObjectName>("fluid_properties", "SinglePhaseFluidProperties object");
32 
33  params.addClassDescription(
34  "Applies a flux to the volume junction for VolumeJunctionCoupledFlux1Phase.");
35 
36  return params;
37 }
38 
40  const InputParameters & params)
41  : ADKernel(params),
42  _equation_index(getParam<unsigned int>("equation_index")),
43  _p(getPostprocessorValue("pressure")),
44  _T(getPostprocessorValue("temperature")),
45  _A_coupled(getParam<Real>("A_coupled")),
46  _normal_from_junction(getParam<RealVectorValue>("normal_from_junction")),
47  _normal_to_junction(-_normal_from_junction),
48  _volume_junction_uo(getUserObject<ADVolumeJunction1PhaseUserObject>("volume_junction_uo")),
49  _numerical_flux_uo(getUserObject<ADNumericalFlux3EqnBase>("numerical_flux_uo")),
50  _fp(getUserObject<SinglePhaseFluidProperties>("fluid_properties"))
51 {
52 }
53 
54 ADReal
56 {
57  const auto rho = _fp.rho_from_p_T(_p, _T);
58  const auto E = _fp.e_from_p_T(_p, _T);
59 
60  std::vector<ADReal> U(THMVACE3D::N_FLUX_INPUTS, 0.0);
62  U[THMVACE3D::RHOEA] = rho * E * _A_coupled;
64 
65  const auto flux_3d =
67  const auto residual = _volume_junction_uo.computeResidual(flux_3d, U, _normal_to_junction, false);
68  return residual[_equation_index];
69 }
Applies a flux to the volume junction for VolumeJunctionCoupledFlux1Phase.
std::vector< ADReal > computeResidual(const std::vector< ADReal > &flux_3d, const std::vector< ADReal > &Ui, const RealVectorValue &ni, bool is_primary_connection) const
registerMooseObject("ThermalHydraulicsApp", VolumeJunctionCoupledFlux1PhaseKernel)
const Real _A_coupled
Coupled area between junction and other application.
DualNumber< Real, DNDerivativeType, false > ADReal
void addRequiredParam(const std::string &name, const std::string &doc_string)
const ADNumericalFlux3EqnBase & _numerical_flux_uo
Numerical flux user object.
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
const unsigned int _equation_index
Index within local system of the equation upon which this object acts.
Base class for computing numerical fluxes for FlowModelSinglePhase.
Computes and caches flux and residual vectors for a 1-phase volume junction.
static InputParameters validParams()
const ADVolumeJunction1PhaseUserObject & _volume_junction_uo
Volume junction user object.
const RealVectorValue _normal_to_junction
Normal vector to the junction from the other application.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const SinglePhaseFluidProperties & _fp
Fluid properties.
void addClassDescription(const std::string &doc_string)
VolumeJunctionCoupledFlux1PhaseKernel(const InputParameters &params)
void ErrorVector unsigned int
static const unsigned int N_FLUX_INPUTS
Number of numerical flux function inputs for 3D.