https://mooseframework.inl.gov
Loading...
Searching...
No Matches
NumericalFlux3EqnInternalValues.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"
13
15
18{
20 params += SamplerBase::validParams();
21 params.addRequiredCoupledVar("A_linear", "Cross-sectional area, linear");
22 params.addRequiredParam<UserObjectName>("numerical_flux", "Name of numerical flux user object");
23 params.addClassDescription("Computes internal fluxes for FlowChannel1Phase.");
24 return params;
25}
26
29 SamplerBase(parameters, this, _communicator),
30 _A1(adCoupledValue("A_linear")),
31 _A2(adCoupledNeighborValue("A_linear")),
32 _rhoA1(getADMaterialProperty<Real>("rhoA")),
33 _rhouA1(getADMaterialProperty<Real>("rhouA")),
34 _rhoEA1(getADMaterialProperty<Real>("rhoEA")),
35 _rhoA2(getNeighborADMaterialProperty<Real>("rhoA")),
36 _rhouA2(getNeighborADMaterialProperty<Real>("rhouA")),
37 _rhoEA2(getNeighborADMaterialProperty<Real>("rhoEA")),
38 _numerical_flux(getUserObject<ADNumericalFlux3EqnBase>("numerical_flux"))
39{
40 std::vector<std::string> var_names(THMVACE1D::N_FLUX_OUTPUTS);
41 var_names[THMVACE1D::MASS] = "mass_flux";
42 var_names[THMVACE1D::MOMENTUM] = "momentum_flux";
43 var_names[THMVACE1D::ENERGY] = "energy_flux";
44
46}
47
48void
53
54void
56{
57 // Assume we are in 1D, and internal sides have only a single quadrature point
58 const unsigned int _qp = 0;
59
60 std::vector<ADReal> U1 = {_rhoA1[_qp], _rhouA1[_qp], _rhoEA1[_qp], _A1[_qp]};
61 std::vector<ADReal> U2 = {_rhoA2[_qp], _rhouA2[_qp], _rhoEA2[_qp], _A2[_qp]};
62
63 const Real nLR_dot_d = _current_side * 2 - 1.0;
64
65 const std::vector<ADReal> & flux_elem_ad =
66 _numerical_flux.getFlux(_current_side, _current_elem->id(), true, U1, U2, nLR_dot_d);
67 const std::vector<ADReal> & flux_neig_ad =
68 _numerical_flux.getFlux(_current_side, _current_elem->id(), false, U1, U2, nLR_dot_d);
69
70 // Convert vector to non-AD
71 std::vector<Real> flux(flux_elem_ad.size());
72 for (const auto i : index_range(flux))
73 flux[i] = MetaPhysicL::raw_value(0.5 * (flux_elem_ad[i] + flux_neig_ad[i]));
74
76}
77
78void
83
84void
86{
87 const auto & vpp = static_cast<const NumericalFlux3EqnInternalValues &>(y);
88
90}
const std::vector< double > y
registerMooseObject("ThermalHydraulicsApp", NumericalFlux3EqnInternalValues)
Base class for computing numerical fluxes for FlowModelSinglePhase.
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
void addRequiredParam(const std::string &name, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
const unsigned int & _current_side
const Elem *const & _current_elem
const MooseArray< Point > & _q_point
static InputParameters validParams()
virtual const std::vector< ADReal > & getFlux(const unsigned int iside, const dof_id_type ielem, bool res_side_is_left, const std::vector< ADReal > &UL_1d, const std::vector< ADReal > &UR_1d, Real nLR_dot_d) const
Gets the 1D flux vector for an element/side combination.
Computes internal fluxes for FlowChannel1Phase.
const ADMaterialProperty< Real > & _rhoEA2
Reconstructed rho*E*A values in neighbor element.
const ADVariableValue & _A2
Area in neighbor element.
const ADMaterialProperty< Real > & _rhouA2
Reconstructed rho*u*A values in neighbor element.
virtual void threadJoin(const UserObject &y) override
const ADNumericalFlux3EqnBase & _numerical_flux
Numerical flux user object.
const ADMaterialProperty< Real > & _rhoA2
Reconstructed rho*A values in neighbor element.
const ADVariableValue & _A1
Area in current element.
const ADMaterialProperty< Real > & _rhoEA1
Reconstructed rho*E*A values in current element.
NumericalFlux3EqnInternalValues(const InputParameters &parameters)
const ADMaterialProperty< Real > & _rhoA1
Reconstructed rho*A values in current element.
const ADMaterialProperty< Real > & _rhouA1
Reconstructed rho*u*A values in current element.
virtual void addSample(const Point &p, const Real &id, const std::vector< Real > &values)
void setupVariables(const std::vector< std::string > &variable_names)
virtual void initialize()
virtual void threadJoin(const SamplerBase &y)
virtual void finalize()
static InputParameters validParams()
auto raw_value(const Eigen::Map< T > &in)
static const unsigned int N_FLUX_OUTPUTS
Number of numerical flux function outputs for 1D.