www.mooseframework.org
PorousFlowPolyLineSink.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 
10 #include "PorousFlowPolyLineSink.h"
11 
13 
16 {
18  params.addRequiredParam<std::vector<Real>>(
19  "p_or_t_vals",
20  "Tuple of pressure (or temperature) values. Must be monotonically increasing.");
21  params.addRequiredParam<std::vector<Real>>(
22  "fluxes",
23  "Tuple of flux values (measured in kg.m^-1.s^-1 if no 'use_*' are employed). "
24  "These flux values are multiplied by the line-segment length to achieve a flux in "
25  "kg.s^-1. A piecewise-linear fit is performed to the (p_or_t_vals,flux) pairs to "
26  "obtain the flux at any arbitrary pressure (or temperature). If a quad-point "
27  "pressure is less than the first pressure value, the first flux value is used. If "
28  "quad-point pressure exceeds the final pressure value, the final flux value is "
29  "used. This flux is OUT of the medium: hence positive values of flux means this "
30  "will be a SINK, while negative values indicate this flux will be a SOURCE.");
31  params.addClassDescription(
32  "Approximates a polyline sink by using a number of point sinks with "
33  "given weighting whose positions are read from a file. NOTE: if you are using "
34  "PorousFlowPorosity that depends on volumetric strain, you should set "
35  "strain_at_nearest_qp=true in your GlobalParams, to ensure the nodal Porosity Material uses "
36  "the volumetric strain at the Dirac quadpoints, and can therefore be computed");
37  return params;
38 }
39 
41  : PorousFlowLineSink(parameters),
42  _sink_func(getParam<std::vector<Real>>("p_or_t_vals"), getParam<std::vector<Real>>("fluxes"))
43 {
44 }
45 
46 Real
47 PorousFlowPolyLineSink::computeQpBaseOutflow(unsigned current_dirac_ptid) const
48 {
49  Real outflow = 0.0;
50 
51  if (current_dirac_ptid > 0)
52  // contribution from half-segment "behind" this point (must have >1 point for
53  // current_dirac_ptid>0)
54  outflow += _half_seg_len[current_dirac_ptid - 1];
55 
56  if (current_dirac_ptid + 1 < _zs.size() || _zs.size() == 1)
57  // contribution from half-segment "ahead of" this point, or we only have one point
58  outflow += _half_seg_len[current_dirac_ptid];
59 
60  return outflow * _test[_i][_qp] * _sink_func.sample(ptqp()) * _weight->at(current_dirac_ptid);
61 }
62 
63 void
65  unsigned current_dirac_ptid,
66  Real & outflow,
67  Real & outflowp) const
68 {
69  outflow = 0.0;
70  outflowp = 0.0;
71 
73  return;
74  const unsigned pvar = _dictator.porousFlowVariableNum(jvar);
75 
76  if (current_dirac_ptid > 0)
77  // contribution from half-segment "behind" this point (must have >1 point for
78  // current_dirac_ptid>0)
79  outflow += _half_seg_len[current_dirac_ptid - 1];
80 
81  if (current_dirac_ptid + 1 < _zs.size() || _zs.size() == 1)
82  // contribution from half-segment "ahead of" this point, or we only have one point
83  outflow += _half_seg_len[current_dirac_ptid];
84 
85  outflowp = outflow * _test[_i][_qp] * _sink_func.sampleDerivative(ptqp()) * dptqp(pvar) *
86  _phi[_j][_qp] * _weight->at(current_dirac_ptid);
87  outflow *= _test[_i][_qp] * _sink_func.sample(ptqp()) * _weight->at(current_dirac_ptid);
88 }
const std::vector< Real > *const _weight
PorousFlowPolyLineSink(const InputParameters &parameters)
bool notPorousFlowVariable(unsigned int moose_var_num) const
Returns true if moose_var_num is not a porous flow variabe.
const PorousFlowDictator & _dictator
PorousFlowDictator UserObject.
static InputParameters validParams()
const OutputTools< T >::VariableTestValue & _test
const OutputTools< T >::VariablePhiValue & _phi
virtual Real computeQpBaseOutflow(unsigned current_dirac_ptid) const override
Returns the flux from the line sink (before modification by mobility, etc). Derived classes should ov...
static InputParameters validParams()
T sample(const T &x) const
void addRequiredParam(const std::string &name, const std::string &doc_string)
std::vector< Real > _half_seg_len
0.5*(length of polyline segments between points)
T sampleDerivative(const T &x) const
Approximates a line sink by a sequence of Dirac Points.
registerMooseObject("PorousFlowApp", PorousFlowPolyLineSink)
Real ptqp() const
If _p_or_t==0, then returns the quadpoint porepressure, else returns the quadpoint temperature...
std::vector< Real > _zs
z points of borehole
virtual void computeQpBaseOutflowJacobian(unsigned jvar, unsigned current_dirac_ptid, Real &outflow, Real &outflowp) const override
Calculates the BaseOutflow as well as its derivative wrt jvar. Derived classes should override this...
LinearInterpolation _sink_func
mass flux = _sink_func as a function of porepressure or temperature
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 porousFlowVariableNum(unsigned int moose_var_num) const
The PorousFlow variable number.
Approximates a line sink a sequence of Dirac Points.
unsigned int _i
Real dptqp(unsigned pvar) const
If _p_or_t==0, then returns d(quadpoint porepressure)/d(PorousFlow variable), else returns d(quadpoin...