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 "PorousFlowSinkPTDefiner.h" 11 : 12 : InputParameters 13 2770 : PorousFlowSinkPTDefiner::validParams() 14 : { 15 2770 : InputParameters params = PorousFlowSink::validParams(); 16 5540 : 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 2770 : return params; 24 0 : } 25 : 26 1573 : PorousFlowSinkPTDefiner::PorousFlowSinkPTDefiner(const InputParameters & parameters) 27 : : PorousFlowSink(parameters), 28 2928 : _pp(_involves_fluid ? &getMaterialProperty<std::vector<Real>>("PorousFlow_porepressure_nodal") 29 : : nullptr), 30 2928 : _dpp_dvar(_involves_fluid ? &getMaterialProperty<std::vector<std::vector<Real>>>( 31 : "dPorousFlow_porepressure_nodal_dvar") 32 : : nullptr), 33 1791 : _temp(!_involves_fluid ? &getMaterialProperty<Real>("PorousFlow_temperature_nodal") : nullptr), 34 3146 : _dtemp_dvar(!_involves_fluid 35 1791 : ? &getMaterialProperty<std::vector<Real>>("dPorousFlow_temperature_nodal_dvar") 36 : : nullptr), 37 3146 : _pt_shift(coupledDofValues("PT_shift")) 38 : { 39 1573 : if (_involves_fluid && (_pp == nullptr || _dpp_dvar == nullptr)) 40 0 : mooseError("PorousFlowSink: There is no porepressure Material"); 41 1573 : if (!_involves_fluid && (_temp == nullptr || _dtemp_dvar == nullptr)) 42 0 : mooseError("PorousFlowSink: There is no temperature Material"); 43 1573 : } 44 : 45 : Real 46 3228828 : PorousFlowSinkPTDefiner::ptVar() const 47 : { 48 3228828 : if (_involves_fluid) 49 3060086 : return (*_pp)[_i][_ph] - _pt_shift[_i]; 50 168742 : return (*_temp)[_i] - _pt_shift[_i]; 51 : } 52 : 53 : Real 54 217102 : PorousFlowSinkPTDefiner::dptVar(unsigned pvar) const 55 : { 56 217102 : if (_involves_fluid) 57 196766 : return (*_dpp_dvar)[_i][_ph][pvar]; 58 20336 : return (*_dtemp_dvar)[_i][pvar]; 59 : }