https://mooseframework.inl.gov
Loading...
Searching...
No Matches
SlopeReconstructionGasMixMaterial.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 "THMIndicesGasMix.h"
13#include "THMNames.h"
14
16
19{
22
23 params.addClassDescription("Computes reconstructed solution values for FlowModelGasMix.");
24
25 params.addRequiredCoupledVar("A_elem", "Cross-sectional area, elemental");
26 params.addRequiredCoupledVar("A_linear", "Cross-sectional area, linear");
27 params.addRequiredCoupledVar("xirhoA", "Conserved variable xi*rho*A");
28 params.addRequiredCoupledVar("rhoA", "Conserved variable rho*A");
29 params.addRequiredCoupledVar("rhouA", "Conserved variable rho*u*A");
30 params.addRequiredCoupledVar("rhoEA", "Conserved variable rho*E*A");
31
32 params.addRequiredParam<UserObjectName>("fluid_properties",
33 "The VaporMixtureFluidProperties object");
34
35 return params;
36}
37
39 const InputParameters & parameters)
40 : Material(parameters),
42
43 _A_avg(adCoupledValue("A_elem")),
44 _A_linear(adCoupledValue("A_linear")),
45 _xirhoA_avg(adCoupledValue("xirhoA")),
46 _rhoA_avg(adCoupledValue("rhoA")),
47 _rhouA_avg(adCoupledValue("rhouA")),
48 _rhoEA_avg(adCoupledValue("rhoEA")),
49
50 _A_var(getVar("A_elem", 0)),
51 _xirhoA_var(getVar("xirhoA", 0)),
52 _rhoA_var(getVar("rhoA", 0)),
53 _rhouA_var(getVar("rhouA", 0)),
54 _rhoEA_var(getVar("rhoEA", 0)),
55
56 _dir(getMaterialProperty<RealVectorValue>(THM::DIRECTION)),
57
58 _xirhoA(declareADProperty<Real>(THM::XIRHOA)),
59 _rhoA(declareADProperty<Real>(THM::RHOA)),
60 _rhouA(declareADProperty<Real>(THM::RHOUA)),
61 _rhoEA(declareADProperty<Real>(THM::RHOEA)),
62
63 _fp(getUserObject<VaporMixtureFluidProperties>("fluid_properties"))
64{
71}
72
73void
75{
76 if (_scheme == None)
77 {
78 const auto A_ratio = _A_linear[_qp] / _A_avg[_qp];
79 _xirhoA[_qp] = _xirhoA_avg[_qp] * A_ratio;
80 _rhoA[_qp] = _rhoA_avg[_qp] * A_ratio;
81 _rhouA[_qp] = _rhouA_avg[_qp] * A_ratio;
82 _rhoEA[_qp] = _rhoEA_avg[_qp] * A_ratio;
83 }
84 else
85 {
86 // compute primitive variables from the cell-average solution
87 std::vector<ADReal> U_avg(THMGasMix1D::N_FLUX_INPUTS, 0.0);
93 auto W = FlowModelGasMixUtils::computePrimitiveSolution<true>(U_avg, _fp);
94
95 // compute and apply slopes to primitive variables
96 const auto slopes = getElementSlopes(_current_elem);
97 const auto delta_x = (_q_point[_qp] - _current_elem->vertex_average()) * _dir[_qp];
98 for (unsigned int m = 0; m < THMGasMix1D::N_PRIM_VARS; m++)
99 W[m] = W[m] + slopes[m] * delta_x;
100
101 // compute reconstructed conservative variables
102 const auto U = FlowModelGasMixUtils::computeConservativeSolution<true>(W, _A_linear[_qp], _fp);
107 }
108}
109
110std::vector<ADReal>
112{
113 const auto U =
114 FlowModelGasMixUtils::getElementalSolutionVector<true>(elem, _U_vars, _is_implicit);
115 return FlowModelGasMixUtils::computePrimitiveSolution<true>(U, _fp);
116}
registerMooseObject("ThermalHydraulicsApp", SlopeReconstructionGasMixMaterial)
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)
unsigned int _qp
static InputParameters validParams()
const Elem *const & _current_elem
const MooseArray< Point > & _q_point
Interface class for 1-D slope reconstruction.
const ESlopeReconstructionType _scheme
Slope reconstruction scheme.
std::vector< GenericReal< is_ad > > getElementSlopes(const Elem *elem) const
Gets limited slopes for the primitive variables in the 1-D direction.
Computes reconstructed solution values for FlowModelGasMix.
const MaterialProperty< RealVectorValue > & _dir
Flow channel direction.
const ADVariableValue & _A_linear
Cross-sectional area, linear.
std::vector< MooseVariable * > _U_vars
Solution variables vector.
const ADVariableValue & _A_avg
Cross-sectional area, piecewise constant.
virtual std::vector< ADReal > computeElementPrimitiveVariables(const Elem *elem) const override
Computes the cell-average primitive variable values for an element.
const VaporMixtureFluidProperties & _fp
fluid properties user object
SlopeReconstructionGasMixMaterial(const InputParameters &parameters)
bool _is_implicit
Base class for fluid properties of vapor mixtures.
static const unsigned int N_FLUX_INPUTS
Number of numerical flux function inputs.
static const unsigned int N_PRIM_VARS