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