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 "SaturationPressureFunction.h" 11 : #include "TwoPhaseFluidProperties.h" 12 : 13 : registerMooseObject("FluidPropertiesApp", SaturationPressureFunction); 14 : 15 : InputParameters 16 41 : SaturationPressureFunction::validParams() 17 : { 18 41 : InputParameters params = Function::validParams(); 19 : 20 82 : params.addRequiredParam<FunctionName>("T", "Temperature function"); 21 82 : params.addRequiredParam<UserObjectName>("fp_2phase", "2-phase fluid properties"); 22 : 23 41 : params.addClassDescription( 24 : "Computes saturation pressure from temperature function and 2-phase fluid properties object"); 25 : 26 41 : return params; 27 0 : } 28 : 29 22 : SaturationPressureFunction::SaturationPressureFunction(const InputParameters & parameters) 30 : : Function(parameters), 31 : FunctionInterface(this), 32 : 33 22 : _T_fn(getFunction("T")) 34 : { 35 22 : } 36 : 37 : void 38 22 : SaturationPressureFunction::initialSetup() 39 : { 40 22 : _fp_2phase = &getUserObject<TwoPhaseFluidProperties>("fp_2phase"); 41 22 : } 42 : 43 : Real 44 14 : SaturationPressureFunction::value(Real t, const Point & point) const 45 : { 46 14 : return _fp_2phase->p_sat(_T_fn.value(t, point)); 47 : } 48 : 49 : RealVectorValue 50 0 : SaturationPressureFunction::gradient(Real t, const Point & point) const 51 : { 52 0 : return _T_fn.gradient(t, point) / _fp_2phase->dT_sat_dp(value(t, point)); 53 : }