LCOV - code coverage report
Current view: top level - src/dirackernels - PorousFlowPointEnthalpySourceFromPostprocessor.C (source / functions) Hit Total Coverage
Test: idaholab/moose porous_flow: #32971 (54bef8) with base c6cf66 Lines: 30 31 96.8 %
Date: 2026-05-29 20:38:56 Functions: 6 6 100.0 %
Legend: Lines: hit not hit

          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          32 : PorousFlowPointEnthalpySourceFromPostprocessor::validParams()
      17             : {
      18          32 :   InputParameters params = DiracKernel::validParams();
      19          64 :   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          64 :   params.addRequiredParam<UserObjectName>(
      24             :       "fp",
      25             :       "The name of the user object used to calculate the fluid properties of the injected fluid");
      26          64 :   params.addRequiredCoupledVar(
      27             :       "pressure", "Pressure used to calculate the injected fluid enthalpy (measured in Pa)");
      28          64 :   params.addRequiredParam<PostprocessorName>(
      29             :       "T_in", "The postprocessor name holding the temperature of injected fluid (measured in K)");
      30          64 :   params.addRequiredParam<Point>("point", "The x,y,z coordinates of the point source");
      31          32 :   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          32 :   return params;
      35           0 : }
      36             : 
      37          17 : PorousFlowPointEnthalpySourceFromPostprocessor::PorousFlowPointEnthalpySourceFromPostprocessor(
      38          17 :     const InputParameters & parameters)
      39             :   : DiracKernel(parameters),
      40          17 :     _mass_flux(getPostprocessorValue("mass_flux")),
      41          17 :     _pressure(coupledValue("pressure")),
      42          17 :     _T_in(getPostprocessorValue("T_in")),
      43          17 :     _fp(getUserObject<SinglePhaseFluidProperties>("fp")),
      44          34 :     _p(getParam<Point>("point")),
      45          34 :     _p_var_num(coupled("pressure"))
      46             : {
      47          17 : }
      48             : 
      49             : void
      50        1286 : PorousFlowPointEnthalpySourceFromPostprocessor::addPoints()
      51             : {
      52        1286 :   addPoint(_p, 0);
      53        1286 : }
      54             : 
      55             : Real
      56        2032 : PorousFlowPointEnthalpySourceFromPostprocessor::computeQpResidual()
      57             : {
      58             :   // Negative sign to make a positive mass_flux in the input file a source
      59        2032 :   Real h = _fp.h_from_p_T(_pressure[_qp], _T_in);
      60        2032 :   return -_test[_i][_qp] * _mass_flux * h;
      61             : }
      62             : 
      63             : Real
      64        5488 : PorousFlowPointEnthalpySourceFromPostprocessor::computeQpJacobian()
      65             : {
      66        5488 :   return 0.;
      67             : }
      68             : 
      69             : Real
      70        5488 : PorousFlowPointEnthalpySourceFromPostprocessor::computeQpOffDiagJacobian(unsigned int jvar)
      71             : {
      72        5488 :   if (jvar == _p_var_num)
      73             :   {
      74             :     Real h, dh_dp, dh_dT;
      75        5488 :     _fp.h_from_p_T(_pressure[_qp], _T_in, h, dh_dp, dh_dT);
      76        5488 :     return -_test[_i][_qp] * _phi[_j][_qp] * _mass_flux * dh_dp;
      77             :   }
      78             :   else
      79             :     return 0.;
      80             : }

Generated by: LCOV version 1.14