www.mooseframework.org
PorousFlowPolyLineSink.C
Go to the documentation of this file.
1 /****************************************************************/
2 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
3 /* */
4 /* All contents are licensed under LGPL V2.1 */
5 /* See LICENSE for full restrictions */
6 /****************************************************************/
7 
9 
10 template <>
11 InputParameters
13 {
14  InputParameters params = validParams<PorousFlowLineSink>();
15  params.addRequiredParam<std::vector<Real>>(
16  "p_or_t_vals",
17  "Tuple of pressure (or temperature) values. Must be monotonically increasing.");
18  params.addRequiredParam<std::vector<Real>>(
19  "fluxes",
20  "Tuple of flux values (measured in kg.m^-1.s^-1 if no 'use_*' are employed). "
21  "These flux values are multiplied by the line-segment length to achieve a flux in "
22  "kg.s^-1. A piecewise-linear fit is performed to the (p_or_t_vals,flux) pairs to "
23  "obtain the flux at any arbitrary pressure (or temperature). If a quad-point "
24  "pressure is less than the first pressure value, the first flux value is used. If "
25  "quad-point pressure exceeds the final pressure value, the final flux value is "
26  "used. This flux is OUT of the medium: hence positive values of flux means this "
27  "will be a SINK, while negative values indicate this flux will be a SOURCE.");
28  params.addClassDescription("Approximates a polyline sink by using a number of point sinks with "
29  "given weighting whose positions are read from a file");
30  return params;
31 }
32 
33 PorousFlowPolyLineSink::PorousFlowPolyLineSink(const InputParameters & parameters)
34  : PorousFlowLineSink(parameters),
35  _sink_func(getParam<std::vector<Real>>("p_or_t_vals"), getParam<std::vector<Real>>("fluxes"))
36 {
37 }
38 
39 Real
40 PorousFlowPolyLineSink::computeQpBaseOutflow(unsigned current_dirac_ptid) const
41 {
42  Real outflow = 0.0;
43 
44  if (current_dirac_ptid > 0)
45  // contribution from half-segment "behind" this point (must have >1 point for
46  // current_dirac_ptid>0)
47  outflow += _half_seg_len[current_dirac_ptid - 1];
48 
49  if (current_dirac_ptid + 1 < _zs.size() || _zs.size() == 1)
50  // contribution from half-segment "ahead of" this point, or we only have one point
51  outflow += _half_seg_len[current_dirac_ptid];
52 
53  return outflow * _test[_i][_qp] * _sink_func.sample(ptqp()) * _rs[current_dirac_ptid];
54 }
55 
56 void
58  unsigned current_dirac_ptid,
59  Real & outflow,
60  Real & outflowp) const
61 {
62  outflow = 0.0;
63  outflowp = 0.0;
64 
66  return;
67  const unsigned pvar = _dictator.porousFlowVariableNum(jvar);
68 
69  if (current_dirac_ptid > 0)
70  // contribution from half-segment "behind" this point (must have >1 point for
71  // current_dirac_ptid>0)
72  outflow += _half_seg_len[current_dirac_ptid - 1];
73 
74  if (current_dirac_ptid + 1 < _zs.size() || _zs.size() == 1)
75  // contribution from half-segment "ahead of" this point, or we only have one point
76  outflow += _half_seg_len[current_dirac_ptid];
77 
78  outflowp = outflow * _test[_i][_qp] * _sink_func.sampleDerivative(ptqp()) * dptqp(pvar) *
79  _phi[_j][_qp] * _rs[current_dirac_ptid];
80  outflow *= _test[_i][_qp] * _sink_func.sample(ptqp()) * _rs[current_dirac_ptid];
81 }
InputParameters validParams< PorousFlowPolyLineSink >()
PorousFlowPolyLineSink(const InputParameters &parameters)
const PorousFlowDictator & _dictator
PorousFlow UserObject.
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...
std::vector< Real > _half_seg_len
0.5*(length of polyline segments between points)
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
LinearInterpolation _sink_func
mass flux = _sink_func as a function of porepressure or temperature
Real computeQpBaseOutflow(unsigned current_dirac_ptid) const override
Returns the flux from the line sink (before modification by mobility, etc). Derived classes should ov...
InputParameters validParams< PorousFlowLineSink >()
Approximates a line sink a sequence of Dirac Points.
Real dptqp(unsigned pvar) const
If _p_or_t==0, then returns d(quadpoint porepressure)/d(PorousFlow variable), else returns d(quadpoin...
std::vector< Real > _rs
radii of the borehole
bool notPorousFlowVariable(unsigned int moose_var_num) const
returns true if moose_var_num is not a porous flow variabe
unsigned int porousFlowVariableNum(unsigned int moose_var_num) const
the PorousFlow variable number