Line data Source code
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 : 10 : #include "VolumeJunction1PhaseAux.h" 11 : #include "SinglePhaseFluidProperties.h" 12 : #include "Numerics.h" 13 : 14 : registerMooseObject("ThermalHydraulicsApp", VolumeJunction1PhaseAux); 15 : 16 : InputParameters 17 7116 : VolumeJunction1PhaseAux::validParams() 18 : { 19 7116 : InputParameters params = AuxKernel::validParams(); 20 : 21 7116 : params.addClassDescription("Computes various quantities for a VolumeJunction1Phase."); 22 : 23 14232 : MooseEnum quantity("pressure temperature speed"); 24 14232 : params.addRequiredParam<MooseEnum>("quantity", quantity, "Which quantity to compute"); 25 14232 : params.addRequiredParam<Real>("volume", "Volume of the junction"); 26 14232 : params.addRequiredCoupledVar("rhoV", "rho*V of the junction"); 27 14232 : params.addRequiredCoupledVar("rhouV", "rho*u*V of the junction"); 28 14232 : params.addRequiredCoupledVar("rhovV", "rho*v*V of the junction"); 29 14232 : params.addRequiredCoupledVar("rhowV", "rho*w*V of the junction"); 30 14232 : params.addRequiredCoupledVar("rhoEV", "rho*E*V of the junction"); 31 14232 : params.addRequiredParam<UserObjectName>("fp", "Fluid properties user object name"); 32 : 33 7116 : return params; 34 7116 : } 35 : 36 3894 : VolumeJunction1PhaseAux::VolumeJunction1PhaseAux(const InputParameters & parameters) 37 : : AuxKernel(parameters), 38 3894 : _quantity(getParam<MooseEnum>("quantity").getEnum<Quantity>()), 39 7788 : _volume(getParam<Real>("volume")), 40 3894 : _rhoV(coupledValue("rhoV")), 41 3894 : _rhouV(coupledValue("rhouV")), 42 3894 : _rhovV(coupledValue("rhovV")), 43 3894 : _rhowV(coupledValue("rhowV")), 44 3894 : _rhoEV(coupledValue("rhoEV")), 45 7788 : _fp(getUserObject<SinglePhaseFluidProperties>("fp")) 46 : { 47 3894 : } 48 : 49 : Real 50 145566 : VolumeJunction1PhaseAux::computeValue() 51 : { 52 : Real vJ, dvJ_drhoV; 53 145566 : THM::v_from_rhoA_A(_rhoV[0], _volume, vJ, dvJ_drhoV); 54 : 55 145566 : const RealVectorValue vel(_rhouV[0] / _rhoV[0], _rhovV[0] / _rhoV[0], _rhowV[0] / _rhoV[0]); 56 145566 : const Real eJ = _rhoEV[0] / _rhoV[0] - 0.5 * vel * vel; 57 : 58 145566 : switch (_quantity) 59 : { 60 48522 : case Quantity::PRESSURE: 61 48522 : return _fp.p_from_v_e(vJ, eJ); 62 : break; 63 48522 : case Quantity::TEMPERATURE: 64 48522 : return _fp.T_from_v_e(vJ, eJ); 65 : break; 66 48522 : case Quantity::SPEED: 67 48522 : return vel.norm(); 68 : break; 69 0 : default: 70 0 : mooseError("Invalid 'quantity' parameter."); 71 : } 72 : }