https://mooseframework.inl.gov
Loading...
Searching...
No Matches
ADNumericalFlux3EqnCentered.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 "Numerics.h"
13
15
18{
20
22 "Computes internal side flux for the 1-D, 1-phase, variable-area Euler equations using a "
23 "centered average of the left and right side fluxes");
24
25 params.addRequiredParam<UserObjectName>("fluid_properties",
26 "Name for fluid properties user object");
27
28 return params;
29}
30
32 : ADNumericalFlux3EqnBase(parameters),
33
34 _fp(getUserObject<SinglePhaseFluidProperties>("fluid_properties"))
35{
36}
37
38void
39ADNumericalFlux3EqnCentered::calcFlux(const std::vector<ADReal> & U1,
40 const std::vector<ADReal> & U2,
41 const RealVectorValue & nLR,
42 const RealVectorValue & t1,
43 const RealVectorValue & t2,
44 std::vector<ADReal> & FL,
45 std::vector<ADReal> & FR) const
46{
47 const std::vector<ADReal> flux1 = computeFlux(U1, nLR, t1, t2);
48 const std::vector<ADReal> flux2 = computeFlux(U2, nLR, t1, t2);
49
51 for (unsigned int i = 0; i < THMVACE3D::N_FLUX_OUTPUTS; i++)
52 FL[i] = 0.5 * (flux1[i] + flux2[i]);
53
54 FR = FL;
55}
56
57std::vector<ADReal>
58ADNumericalFlux3EqnCentered::computeFlux(const std::vector<ADReal> & U,
59 const RealVectorValue & n,
60 const RealVectorValue & t1,
61 const RealVectorValue & t2) const
62{
63 const ADReal rhoA = U[THMVACE3D::RHOA];
64 const ADReal rhouA = U[THMVACE3D::RHOUA];
65 const ADReal rhovA = U[THMVACE3D::RHOVA];
66 const ADReal rhowA = U[THMVACE3D::RHOWA];
67 const ADReal rhoEA = U[THMVACE3D::RHOEA];
68 const ADReal A = U[THMVACE3D::AREA];
69
70 const ADReal rho = rhoA / A;
71 const ADRealVectorValue uvec(rhouA / rhoA, rhovA / rhoA, rhowA / rhoA);
72 const ADReal un = uvec * n;
73 const ADReal ut1 = uvec * t1;
74 const ADReal ut2 = uvec * t2;
75 const ADReal v = 1.0 / rho;
76 const ADReal E = rhoEA / rhoA;
77 const ADReal e = E - 0.5 * uvec * uvec;
78 const ADReal p = _fp.p_from_v_e(v, e);
79 const ADReal H = E + p / rho;
80
81 std::vector<ADReal> flux(THMVACE3D::N_FLUX_OUTPUTS, 0.0);
82 flux[THMVACE3D::MASS] = rho * un * A;
83 flux[THMVACE3D::MOM_NORM] = (rho * un * un + p) * A;
84 flux[THMVACE3D::MOM_TAN1] = rho * un * ut1 * A;
85 flux[THMVACE3D::MOM_TAN2] = rho * un * ut2 * A;
86 flux[THMVACE3D::ENERGY] = rho * un * H * A;
87
88 return flux;
89}
registerMooseObject("ThermalHydraulicsApp", ADNumericalFlux3EqnCentered)
DualNumber< Real, DNDerivativeType, true > ADReal
const Real p
const double rho
const double v
Base class for computing numerical fluxes for FlowModelSinglePhase.
static InputParameters validParams()
Computes internal side flux for the 1-D, 1-phase, variable-area Euler equations using a centered aver...
virtual void calcFlux(const std::vector< ADReal > &U1, const std::vector< ADReal > &U2, const RealVectorValue &nLR, const RealVectorValue &t1, const RealVectorValue &t2, std::vector< ADReal > &FL, std::vector< ADReal > &FR) const override
Calculates the 3D flux vectors given "left" and "right" states.
ADNumericalFlux3EqnCentered(const InputParameters &parameters)
std::vector< ADReal > computeFlux(const std::vector< ADReal > &U, const RealVectorValue &n, const RealVectorValue &t1, const RealVectorValue &t2) const
const SinglePhaseFluidProperties & _fp
fluid properties user object
void addRequiredParam(const std::string &name, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
Common class for single phase fluid properties.
static const unsigned int N_FLUX_OUTPUTS
Number of numerical flux function outputs for 3D.