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