https://mooseframework.inl.gov
Loading...
Searching...
No Matches
VolumeJunction1PhaseAux.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
12#include "Numerics.h"
13
15
18{
20
21 params.addClassDescription("Computes various quantities for a VolumeJunction1Phase.");
22
23 MooseEnum quantity("pressure temperature speed");
24 params.addRequiredParam<MooseEnum>("quantity", quantity, "Which quantity to compute");
25 params.addRequiredParam<Real>("volume", "Volume of the junction");
26 params.addRequiredCoupledVar("rhoV", "rho*V of the junction");
27 params.addRequiredCoupledVar("rhouV", "rho*u*V of the junction");
28 params.addRequiredCoupledVar("rhovV", "rho*v*V of the junction");
29 params.addRequiredCoupledVar("rhowV", "rho*w*V of the junction");
30 params.addRequiredCoupledVar("rhoEV", "rho*E*V of the junction");
31 params.addRequiredParam<UserObjectName>("fp", "Fluid properties user object name");
32
33 return params;
34}
35
37 : AuxKernel(parameters),
38 _quantity(getParam<MooseEnum>("quantity").getEnum<Quantity>()),
39 _volume(getParam<Real>("volume")),
40 _rhoV(coupledValue("rhoV")),
41 _rhouV(coupledValue("rhouV")),
42 _rhovV(coupledValue("rhovV")),
43 _rhowV(coupledValue("rhowV")),
44 _rhoEV(coupledValue("rhoEV")),
45 _fp(getUserObject<SinglePhaseFluidProperties>("fp"))
46{
47}
48
49Real
51{
52 Real vJ, dvJ_drhoV;
53 THM::v_from_rhoA_A(_rhoV[0], _volume, vJ, dvJ_drhoV);
54
55 const RealVectorValue vel(_rhouV[0] / _rhoV[0], _rhovV[0] / _rhoV[0], _rhowV[0] / _rhoV[0]);
56 const Real eJ = _rhoEV[0] / _rhoV[0] - 0.5 * vel * vel;
57
58 switch (_quantity)
59 {
61 return _fp.p_from_v_e(vJ, eJ);
62 break;
64 return _fp.T_from_v_e(vJ, eJ);
65 break;
66 case Quantity::SPEED:
67 return vel.norm();
68 break;
69 default:
70 mooseError("Invalid 'quantity' parameter.");
71 }
72}
registerMooseObject("ThermalHydraulicsApp", VolumeJunction1PhaseAux)
static InputParameters validParams()
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)
void mooseError(Args &&... args) const
Common class for single phase fluid properties.
Computes various quantities for a VolumeJunction1Phase.
const VariableValue & _rhoEV
rho*E*V of the junction
VolumeJunction1PhaseAux(const InputParameters &parameters)
virtual Real computeValue() override
static InputParameters validParams()
const VariableValue & _rhouV
rho*u*V of the junction
const SinglePhaseFluidProperties & _fp
Single-phase fluid properties user object.
const VariableValue & _rhowV
rho*w*V of the junction
const Real & _volume
Volume of the junction.
const VariableValue & _rhovV
rho*v*V of the junction
const Quantity _quantity
Which quantity to compute.
const VariableValue & _rhoV
rho*V of the junction
void v_from_rhoA_A(Real rhoA, Real A, Real &v, Real &dv_drhoA)
Computes specific volume and its derivatives from rho*A, and area.
Definition Numerics.C:100