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 "FlowModelGasMixIC.h" 11 : #include "Function.h" 12 : #include "FlowModelGasMixUtils.h" 13 : #include "THMIndicesGasMix.h" 14 : 15 : registerMooseObject("ThermalHydraulicsApp", FlowModelGasMixIC); 16 : 17 : InputParameters 18 164 : FlowModelGasMixIC::validParams() 19 : { 20 164 : InputParameters params = InitialCondition::validParams(); 21 : 22 328 : MooseEnum quantity("rho rhoEA"); 23 328 : params.addRequiredParam<MooseEnum>("quantity", quantity, "Quantity to compute"); 24 : 25 328 : params.addRequiredParam<FunctionName>("mass_fraction", "Secondary gas mass fraction function"); 26 328 : params.addRequiredParam<FunctionName>("pressure", "Pressure function"); 27 328 : params.addRequiredParam<FunctionName>("temperature", "Temperature function"); 28 328 : params.addRequiredParam<FunctionName>("velocity", "Velocity function"); 29 328 : params.addRequiredCoupledVar("area", "Cross-sectional area variable"); 30 : 31 328 : params.addRequiredParam<UserObjectName>("fluid_properties", 32 : "The VaporMixtureFluidProperties object"); 33 : 34 164 : params.addClassDescription("IC for the solution variables of FlowModelGasMix."); 35 : 36 164 : return params; 37 164 : } 38 : 39 88 : FlowModelGasMixIC::FlowModelGasMixIC(const InputParameters & parameters) 40 : : InitialCondition(parameters), 41 88 : _quantity(getParam<MooseEnum>("quantity").getEnum<Quantity>()), 42 88 : _xi(getFunction("mass_fraction")), 43 88 : _p(getFunction("pressure")), 44 88 : _T(getFunction("temperature")), 45 88 : _vel(getFunction("velocity")), 46 88 : _area(coupledValue("area")), 47 176 : _fp(getUserObject<VaporMixtureFluidProperties>("fluid_properties")) 48 : { 49 88 : } 50 : 51 : Real 52 1080 : FlowModelGasMixIC::value(const Point & pt) 53 : { 54 1080 : const auto xi = _xi.value(_t, pt); 55 1080 : const auto p = _p.value(_t, pt); 56 1080 : const auto T = _T.value(_t, pt); 57 : 58 1080 : const auto v = _fp.v_from_p_T(p, T, {xi}); 59 1080 : const auto rho = 1.0 / v; 60 : 61 1080 : switch (_quantity) 62 : { 63 : case Quantity::DENSITY: 64 : { 65 : return rho; 66 : break; 67 : } 68 540 : case Quantity::RHOEA: 69 : { 70 540 : const auto vel = _vel.value(_t, pt); 71 540 : const auto e = _fp.e_from_p_T(p, T, {xi}); 72 540 : const auto E = e + 0.5 * vel * vel; 73 540 : return rho * E * _area[_qp]; 74 : break; 75 : } 76 0 : default: 77 : mooseAssert(false, "Invalid 'quantity' parameter."); 78 0 : return 0; 79 : } 80 : }