www.mooseframework.org
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
RichardsPolyLineSink Class Reference

Approximates a polyline by a sequence of Dirac Points the mass flux from each Dirac Point is _sink_func as a function of porepressure at the Dirac Point. More...

#include <RichardsPolyLineSink.h>

Inheritance diagram for RichardsPolyLineSink:
[legend]

Public Member Functions

 RichardsPolyLineSink (const InputParameters &parameters)
 
virtual void addPoints ()
 
virtual Real computeQpResidual ()
 
virtual Real computeQpJacobian ()
 
virtual Real computeQpOffDiagJacobian (unsigned int jvar)
 Computes the off-diagonal part of the jacobian Note: at March2014 this is never called since moose does not have this functionality. More...
 

Protected Member Functions

bool parseNextLineReals (std::ifstream &ifs, std::vector< Real > &myvec)
 reads a space-separated line of floats from ifs and puts in myvec More...
 

Protected Attributes

RichardsSumQuantity_total_outflow_mass
 This is used to hold the total fluid flowing into the sink Hence, it is positive for sinks where fluid is flowing from porespace into the borehole and removed from the model. More...
 
LinearInterpolation _sink_func
 mass flux = _sink_func as a function of porepressure More...
 
std::string _point_file
 contains rows of the form x y z (space separated) More...
 
const RichardsVarNames_richards_name_UO
 Defines the richards variables in the simulation. More...
 
unsigned int _pvar
 The moose internal variable number of the richards variable of this Dirac Kernel. More...
 
const MaterialProperty< std::vector< Real > > & _pp
 fluid porepressure (or porepressures in case of multiphase) More...
 
const MaterialProperty< std::vector< std::vector< Real > > > & _dpp_dv
 d(porepressure_i)/d(variable_j) More...
 
std::vector< Real > _xs
 vector of Dirac Points' x positions More...
 
std::vector< Real > _ys
 vector of Dirac Points' y positions More...
 
std::vector< Real > _zs
 vector of Dirac Points' z positions More...
 

Detailed Description

Approximates a polyline by a sequence of Dirac Points the mass flux from each Dirac Point is _sink_func as a function of porepressure at the Dirac Point.

Definition at line 29 of file RichardsPolyLineSink.h.

Constructor & Destructor Documentation

◆ RichardsPolyLineSink()

RichardsPolyLineSink::RichardsPolyLineSink ( const InputParameters &  parameters)

Definition at line 49 of file RichardsPolyLineSink.C.

50  : DiracKernel(parameters),
52  const_cast<RichardsSumQuantity &>(getUserObject<RichardsSumQuantity>("SumQuantityUO"))),
53  _sink_func(getParam<std::vector<Real>>("pressures"), getParam<std::vector<Real>>("fluxes")),
54  _point_file(getParam<FileName>("point_file")),
55  _richards_name_UO(getUserObject<RichardsVarNames>("richardsVarNames_UO")),
57  _pp(getMaterialProperty<std::vector<Real>>("porepressure")),
58  _dpp_dv(getMaterialProperty<std::vector<std::vector<Real>>>("dporepressure_dv"))
59 {
60  // open file
61  std::ifstream file(_point_file.c_str());
62  if (!file.good())
63  mooseError("Error opening file '" + _point_file + "' from RichardsPolyLineSink.");
64 
65  std::vector<Real> scratch;
66  while (parseNextLineReals(file, scratch))
67  {
68  if (scratch.size() >= 1)
69  {
70  _xs.push_back(scratch[0]);
71  if (scratch.size() >= 2)
72  _ys.push_back(scratch[1]);
73  else
74  _ys.push_back(0.0);
75 
76  if (scratch.size() >= 3)
77  _zs.push_back(scratch[2]);
78  else
79  _zs.push_back(0.0);
80  }
81  }
82 
83  file.close();
84 
85  // To correctly compute the Jacobian terms,
86  // tell MOOSE that this DiracKernel depends on all the Richards Vars
87  const std::vector<MooseVariableFEBase *> & coupled_vars = _richards_name_UO.getCoupledMooseVars();
88  for (unsigned int i = 0; i < coupled_vars.size(); i++)
89  addMooseVariableDependency(coupled_vars[i]);
90 }
std::string _point_file
contains rows of the form x y z (space separated)
std::vector< Real > _ys
vector of Dirac Points&#39; y positions
LinearInterpolation _sink_func
mass flux = _sink_func as a function of porepressure
unsigned int _pvar
The moose internal variable number of the richards variable of this Dirac Kernel. ...
bool parseNextLineReals(std::ifstream &ifs, std::vector< Real > &myvec)
reads a space-separated line of floats from ifs and puts in myvec
RichardsSumQuantity & _total_outflow_mass
This is used to hold the total fluid flowing into the sink Hence, it is positive for sinks where flui...
const MaterialProperty< std::vector< Real > > & _pp
fluid porepressure (or porepressures in case of multiphase)
unsigned int richards_var_num(unsigned int moose_var_num) const
the richards variable number
const MaterialProperty< std::vector< std::vector< Real > > > & _dpp_dv
d(porepressure_i)/d(variable_j)
std::vector< Real > _xs
vector of Dirac Points&#39; x positions
std::vector< Real > _zs
vector of Dirac Points&#39; z positions
const RichardsVarNames & _richards_name_UO
Defines the richards variables in the simulation.

Member Function Documentation

◆ addPoints()

void RichardsPolyLineSink::addPoints ( )
virtual

Definition at line 115 of file RichardsPolyLineSink.C.

116 {
118 
119  // Add point using the unique ID "i", let the DiracKernel take
120  // care of the caching. This should be fast after the first call,
121  // as long as the points don't move around.
122  for (unsigned int i = 0; i < _zs.size(); i++)
123  addPoint(Point(_xs[i], _ys[i], _zs[i]), i);
124 }
std::vector< Real > _ys
vector of Dirac Points&#39; y positions
void zero()
sets _total = 0
RichardsSumQuantity & _total_outflow_mass
This is used to hold the total fluid flowing into the sink Hence, it is positive for sinks where flui...
std::vector< Real > _xs
vector of Dirac Points&#39; x positions
std::vector< Real > _zs
vector of Dirac Points&#39; z positions

◆ computeQpJacobian()

Real RichardsPolyLineSink::computeQpJacobian ( )
virtual

Definition at line 136 of file RichardsPolyLineSink.C.

137 {
138  Real test_fcn = _test[_i][_qp];
139  return test_fcn * _sink_func.sampleDerivative(_pp[_qp][_pvar]) * _dpp_dv[_qp][_pvar][_pvar] *
140  _phi[_j][_qp];
141 }
LinearInterpolation _sink_func
mass flux = _sink_func as a function of porepressure
unsigned int _pvar
The moose internal variable number of the richards variable of this Dirac Kernel. ...
const MaterialProperty< std::vector< Real > > & _pp
fluid porepressure (or porepressures in case of multiphase)
const MaterialProperty< std::vector< std::vector< Real > > > & _dpp_dv
d(porepressure_i)/d(variable_j)

◆ computeQpOffDiagJacobian()

Real RichardsPolyLineSink::computeQpOffDiagJacobian ( unsigned int  jvar)
virtual

Computes the off-diagonal part of the jacobian Note: at March2014 this is never called since moose does not have this functionality.

Hence as of March2014 this has never been tested.

Definition at line 144 of file RichardsPolyLineSink.C.

145 {
147  return 0.0;
148  unsigned int dvar = _richards_name_UO.richards_var_num(jvar);
149  Real test_fcn = _test[_i][_qp];
150  return test_fcn * _sink_func.sampleDerivative(_pp[_qp][_pvar]) * _dpp_dv[_qp][_pvar][dvar] *
151  _phi[_j][_qp];
152 }
bool not_richards_var(unsigned int moose_var_num) const
returns true if moose_var_num is not a richards var
LinearInterpolation _sink_func
mass flux = _sink_func as a function of porepressure
unsigned int _pvar
The moose internal variable number of the richards variable of this Dirac Kernel. ...
const MaterialProperty< std::vector< Real > > & _pp
fluid porepressure (or porepressures in case of multiphase)
unsigned int richards_var_num(unsigned int moose_var_num) const
the richards variable number
const MaterialProperty< std::vector< std::vector< Real > > > & _dpp_dv
d(porepressure_i)/d(variable_j)
const RichardsVarNames & _richards_name_UO
Defines the richards variables in the simulation.

◆ computeQpResidual()

Real RichardsPolyLineSink::computeQpResidual ( )
virtual

Definition at line 127 of file RichardsPolyLineSink.C.

128 {
129  Real test_fcn = _test[_i][_qp];
130  Real flow = test_fcn * _sink_func.sample(_pp[_qp][_pvar]);
131  _total_outflow_mass.add(flow * _dt);
132  return flow;
133 }
LinearInterpolation _sink_func
mass flux = _sink_func as a function of porepressure
unsigned int _pvar
The moose internal variable number of the richards variable of this Dirac Kernel. ...
RichardsSumQuantity & _total_outflow_mass
This is used to hold the total fluid flowing into the sink Hence, it is positive for sinks where flui...
void add(Real contrib)
adds contrib to _total
const MaterialProperty< std::vector< Real > > & _pp
fluid porepressure (or porepressures in case of multiphase)

◆ parseNextLineReals()

bool RichardsPolyLineSink::parseNextLineReals ( std::ifstream &  ifs,
std::vector< Real > &  myvec 
)
protected

reads a space-separated line of floats from ifs and puts in myvec

Parameters
ifsthe file stream
myvecupon return will contain the space-separated flows encountered in ifs

Definition at line 93 of file RichardsPolyLineSink.C.

Referenced by RichardsPolyLineSink().

95 {
96  std::string line;
97  myvec.clear();
98  bool gotline(false);
99  if (getline(ifs, line))
100  {
101  gotline = true;
102 
103  // Harvest floats separated by whitespace
104  std::istringstream iss(line);
105  Real f;
106  while (iss >> f)
107  {
108  myvec.push_back(f);
109  }
110  }
111  return gotline;
112 }

Member Data Documentation

◆ _dpp_dv

const MaterialProperty<std::vector<std::vector<Real> > >& RichardsPolyLineSink::_dpp_dv
protected

d(porepressure_i)/d(variable_j)

Definition at line 70 of file RichardsPolyLineSink.h.

Referenced by computeQpJacobian(), and computeQpOffDiagJacobian().

◆ _point_file

std::string RichardsPolyLineSink::_point_file
protected

contains rows of the form x y z (space separated)

Definition at line 58 of file RichardsPolyLineSink.h.

Referenced by RichardsPolyLineSink().

◆ _pp

const MaterialProperty<std::vector<Real> >& RichardsPolyLineSink::_pp
protected

fluid porepressure (or porepressures in case of multiphase)

Definition at line 67 of file RichardsPolyLineSink.h.

Referenced by computeQpJacobian(), computeQpOffDiagJacobian(), and computeQpResidual().

◆ _pvar

unsigned int RichardsPolyLineSink::_pvar
protected

The moose internal variable number of the richards variable of this Dirac Kernel.

Definition at line 64 of file RichardsPolyLineSink.h.

Referenced by computeQpJacobian(), computeQpOffDiagJacobian(), and computeQpResidual().

◆ _richards_name_UO

const RichardsVarNames& RichardsPolyLineSink::_richards_name_UO
protected

Defines the richards variables in the simulation.

Definition at line 61 of file RichardsPolyLineSink.h.

Referenced by computeQpOffDiagJacobian(), and RichardsPolyLineSink().

◆ _sink_func

LinearInterpolation RichardsPolyLineSink::_sink_func
protected

mass flux = _sink_func as a function of porepressure

Definition at line 55 of file RichardsPolyLineSink.h.

Referenced by computeQpJacobian(), computeQpOffDiagJacobian(), and computeQpResidual().

◆ _total_outflow_mass

RichardsSumQuantity& RichardsPolyLineSink::_total_outflow_mass
protected

This is used to hold the total fluid flowing into the sink Hence, it is positive for sinks where fluid is flowing from porespace into the borehole and removed from the model.

Definition at line 52 of file RichardsPolyLineSink.h.

Referenced by addPoints(), and computeQpResidual().

◆ _xs

std::vector<Real> RichardsPolyLineSink::_xs
protected

vector of Dirac Points' x positions

Definition at line 73 of file RichardsPolyLineSink.h.

Referenced by addPoints(), and RichardsPolyLineSink().

◆ _ys

std::vector<Real> RichardsPolyLineSink::_ys
protected

vector of Dirac Points' y positions

Definition at line 76 of file RichardsPolyLineSink.h.

Referenced by addPoints(), and RichardsPolyLineSink().

◆ _zs

std::vector<Real> RichardsPolyLineSink::_zs
protected

vector of Dirac Points' z positions

Definition at line 79 of file RichardsPolyLineSink.h.

Referenced by addPoints(), and RichardsPolyLineSink().


The documentation for this class was generated from the following files: