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 "PorousFlowFluidStateIC.h" 11 : #include "PorousFlowDictator.h" 12 : #include "PorousFlowFluidStateMultiComponentBase.h" 13 : 14 : registerMooseObject("PorousFlowApp", PorousFlowFluidStateIC); 15 : 16 : InputParameters 17 82 : PorousFlowFluidStateIC::validParams() 18 : { 19 82 : InputParameters params = InitialCondition::validParams(); 20 164 : params.addRequiredCoupledVar("gas_porepressure", 21 : "Variable that is the porepressure of the gas phase"); 22 164 : params.addRequiredCoupledVar("temperature", "Variable that is the fluid temperature"); 23 164 : MooseEnum unit_choice("Kelvin=0 Celsius=1", "Kelvin"); 24 164 : params.addParam<MooseEnum>( 25 : "temperature_unit", unit_choice, "The unit of the temperature variable"); 26 164 : params.addCoupledVar("saturation", 0.0, "Gas saturation"); 27 164 : params.addRequiredParam<UserObjectName>("fluid_state", "Name of the FluidState UserObject"); 28 164 : params.addCoupledVar("xnacl", 0, "The salt mass fraction in the brine (kg/kg)"); 29 164 : params.addRequiredParam<UserObjectName>( 30 : "PorousFlowDictator", "The UserObject that holds the list of PorousFlow variable names"); 31 82 : params.addClassDescription("An initial condition to calculate z from saturation"); 32 82 : return params; 33 82 : } 34 : 35 44 : PorousFlowFluidStateIC::PorousFlowFluidStateIC(const InputParameters & parameters) 36 : : InitialCondition(parameters), 37 44 : _gas_porepressure(coupledValue("gas_porepressure")), 38 44 : _temperature(coupledValue("temperature")), 39 44 : _Xnacl(coupledValue("xnacl")), 40 44 : _saturation(coupledValue("saturation")), 41 132 : _T_c2k(getParam<MooseEnum>("temperature_unit") == 0 ? 0.0 : 273.15), 42 44 : _dictator(getUserObject<PorousFlowDictator>("PorousFlowDictator")), 43 88 : _fs(getUserObject<PorousFlowFluidStateMultiComponentBase>("fluid_state")) 44 : { 45 44 : } 46 : 47 : Real 48 72 : PorousFlowFluidStateIC::value(const Point & /*p*/) 49 : { 50 : // The fluid state user object needs temperature in K 51 72 : const Real Tk = _temperature[_qp] + _T_c2k; 52 : 53 : // The total mass fraction corresponding to the input saturation 54 72 : return _fs.totalMassFraction(_gas_porepressure[_qp], Tk, _Xnacl[_qp], _saturation[_qp], _qp); 55 : }