www.mooseframework.org
PorousFlowSinkPTDefiner.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
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 
11 
14 {
16  params.addCoupledVar("PT_shift",
17  0.0,
18  "Whenever the sink is an explicit function of porepressure "
19  "(such as a PiecewiseLinear function) the argument of the "
20  "function is set to P - PT_shift instead of simply P. "
21  "Similarly for temperature. PT_shift does not enter into "
22  "any use_* calculations.");
23  return params;
24 }
25 
27  : PorousFlowSink(parameters),
28  _pp(_involves_fluid ? &getMaterialProperty<std::vector<Real>>("PorousFlow_porepressure_nodal")
29  : nullptr),
30  _dpp_dvar(_involves_fluid ? &getMaterialProperty<std::vector<std::vector<Real>>>(
31  "dPorousFlow_porepressure_nodal_dvar")
32  : nullptr),
33  _temp(!_involves_fluid ? &getMaterialProperty<Real>("PorousFlow_temperature_nodal") : nullptr),
34  _dtemp_dvar(!_involves_fluid
35  ? &getMaterialProperty<std::vector<Real>>("dPorousFlow_temperature_nodal_dvar")
36  : nullptr),
37  _pt_shift(coupledDofValues("PT_shift"))
38 {
39  if (_involves_fluid && (_pp == nullptr || _dpp_dvar == nullptr))
40  mooseError("PorousFlowSink: There is no porepressure Material");
41  if (!_involves_fluid && (_temp == nullptr || _dtemp_dvar == nullptr))
42  mooseError("PorousFlowSink: There is no temperature Material");
43 }
44 
45 Real
47 {
48  if (_involves_fluid)
49  return (*_pp)[_i][_ph] - _pt_shift[_i];
50  return (*_temp)[_i] - _pt_shift[_i];
51 }
52 
53 Real
54 PorousFlowSinkPTDefiner::dptVar(unsigned pvar) const
55 {
56  if (_involves_fluid)
57  return (*_dpp_dvar)[_i][_ph][pvar];
58  return (*_dtemp_dvar)[_i][pvar];
59 }
const bool _involves_fluid
Whether this BC involves fluid (whether the user has supplied a fluid phase number) ...
PorousFlowSinkPTDefiner(const InputParameters &parameters)
const unsigned int _ph
The phase number.
virtual Real ptVar() const
Provides the variable value (either porepressure, or temperature, depending on _involves_fluid) ...
const VariableValue & _pt_shift
Subtract this from porepressure or temperature before evaluating PiecewiseLinearSink, HalfCubicSink, etc.
unsigned int _i
static InputParameters validParams()
const MaterialProperty< std::vector< Real > > *const _pp
Nodal pore pressure in each phase.
Applies a flux sink to a boundary.
virtual Real dptVar(unsigned pvar) const
Provides the d(variable)/(d PorousFlow Variable pvar)
const MaterialProperty< Real > *const _temp
Nodal temperature.
const MaterialProperty< std::vector< Real > > *const _dtemp_dvar
d(Nodal temperature)/d(PorousFlow variable)
void addCoupledVar(const std::string &name, const std::string &doc_string)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void mooseError(Args &&... args) const
static InputParameters validParams()
const MaterialProperty< std::vector< std::vector< Real > > > *const _dpp_dvar
d(Nodal pore pressure in each phase)/d(PorousFlow variable)