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 "PorousFlowPointEnthalpySourceFromPostprocessor.h" 11 : #include "SinglePhaseFluidProperties.h" 12 : 13 : registerMooseObject("PorousFlowApp", PorousFlowPointEnthalpySourceFromPostprocessor); 14 : 15 : InputParameters 16 60 : PorousFlowPointEnthalpySourceFromPostprocessor::validParams() 17 : { 18 60 : InputParameters params = DiracKernel::validParams(); 19 120 : params.addRequiredParam<PostprocessorName>( 20 : "mass_flux", 21 : "The postprocessor name holding the mass flux of injected fluid at this point in kg/s " 22 : "(please ensure this is positive so that this object acts like a source)"); 23 120 : params.addRequiredParam<UserObjectName>( 24 : "fp", 25 : "The name of the user object used to calculate the fluid properties of the injected fluid"); 26 120 : params.addRequiredCoupledVar( 27 : "pressure", "Pressure used to calculate the injected fluid enthalpy (measured in Pa)"); 28 120 : params.addRequiredParam<PostprocessorName>( 29 : "T_in", "The postprocessor name holding the temperature of injected fluid (measured in K)"); 30 120 : params.addRequiredParam<Point>("point", "The x,y,z coordinates of the point source"); 31 60 : params.addClassDescription("Point source that adds heat energy corresponding to injection of a " 32 : "fluid with specified mass flux rate (specified by a postprocessor) " 33 : "at given temperature (specified by a postprocessor)"); 34 60 : return params; 35 0 : } 36 : 37 33 : PorousFlowPointEnthalpySourceFromPostprocessor::PorousFlowPointEnthalpySourceFromPostprocessor( 38 33 : const InputParameters & parameters) 39 : : DiracKernel(parameters), 40 33 : _mass_flux(getPostprocessorValue("mass_flux")), 41 33 : _pressure(coupledValue("pressure")), 42 33 : _T_in(getPostprocessorValue("T_in")), 43 33 : _fp(getUserObject<SinglePhaseFluidProperties>("fp")), 44 66 : _p(getParam<Point>("point")), 45 66 : _p_var_num(coupled("pressure")) 46 : { 47 33 : } 48 : 49 : void 50 4646 : PorousFlowPointEnthalpySourceFromPostprocessor::addPoints() 51 : { 52 4646 : addPoint(_p, 0); 53 4646 : } 54 : 55 : Real 56 5384 : PorousFlowPointEnthalpySourceFromPostprocessor::computeQpResidual() 57 : { 58 : // Negative sign to make a positive mass_flux in the input file a source 59 5384 : Real h = _fp.h_from_p_T(_pressure[_qp], _T_in); 60 5384 : return -_test[_i][_qp] * _mass_flux * h; 61 : } 62 : 63 : Real 64 17760 : PorousFlowPointEnthalpySourceFromPostprocessor::computeQpJacobian() 65 : { 66 17760 : return 0.; 67 : } 68 : 69 : Real 70 17760 : PorousFlowPointEnthalpySourceFromPostprocessor::computeQpOffDiagJacobian(unsigned int jvar) 71 : { 72 17760 : if (jvar == _p_var_num) 73 : { 74 : Real h, dh_dp, dh_dT; 75 17760 : _fp.h_from_p_T(_pressure[_qp], _T_in, h, dh_dp, dh_dT); 76 17760 : return -_test[_i][_qp] * _phi[_j][_qp] * _mass_flux * dh_dp; 77 : } 78 : else 79 : return 0.; 80 : }