https://mooseframework.inl.gov
PorousFlowPointEnthalpySourceFromPostprocessor.C
Go to the documentation of this file.
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 
12 
14 
17 {
19  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  params.addRequiredParam<UserObjectName>(
24  "fp",
25  "The name of the user object used to calculate the fluid properties of the injected fluid");
26  params.addRequiredCoupledVar(
27  "pressure", "Pressure used to calculate the injected fluid enthalpy (measured in Pa)");
28  params.addRequiredParam<PostprocessorName>(
29  "T_in", "The postprocessor name holding the temperature of injected fluid (measured in K)");
30  params.addRequiredParam<Point>("point", "The x,y,z coordinates of the point source");
31  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  return params;
35 }
36 
38  const InputParameters & parameters)
39  : DiracKernel(parameters),
40  _mass_flux(getPostprocessorValue("mass_flux")),
41  _pressure(coupledValue("pressure")),
42  _T_in(getPostprocessorValue("T_in")),
43  _fp(getUserObject<SinglePhaseFluidProperties>("fp")),
44  _p(getParam<Point>("point")),
45  _p_var_num(coupled("pressure"))
46 {
47 }
48 
49 void
51 {
52  addPoint(_p, 0);
53 }
54 
55 Real
57 {
58  // Negative sign to make a positive mass_flux in the input file a source
59  Real h = _fp.h_from_p_T(_pressure[_qp], _T_in);
60  return -_test[_i][_qp] * _mass_flux * h;
61 }
62 
63 Real
65 {
66  return 0.;
67 }
68 
69 Real
71 {
72  if (jvar == _p_var_num)
73  {
74  Real h, dh_dp, dh_dT;
75  _fp.h_from_p_T(_pressure[_qp], _T_in, h, dh_dp, dh_dT);
76  return -_test[_i][_qp] * _phi[_j][_qp] * _mass_flux * dh_dp;
77  }
78  else
79  return 0.;
80 }
Point source that adds heat energy corresponding to adding a fluid with flux rate specified by a post...
const SinglePhaseFluidProperties & _fp
Fluid properties UserObject.
const PostprocessorValue & _mass_flux
The constant mass flux (kg/s)
void addPoint(const Elem *elem, Point p, unsigned id=libMesh::invalid_uint)
const OutputTools< T >::VariableTestValue & _test
const OutputTools< T >::VariablePhiValue & _phi
void addRequiredParam(const std::string &name, const std::string &doc_string)
Common class for single phase fluid properties.
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
unsigned int _j
unsigned int _qp
void addClassDescription(const std::string &doc_string)
unsigned int _i
static InputParameters validParams()
registerMooseObject("PorousFlowApp", PorousFlowPointEnthalpySourceFromPostprocessor)