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 27 of file RichardsPolyLineSink.h.

Constructor & Destructor Documentation

RichardsPolyLineSink::RichardsPolyLineSink ( const InputParameters &  parameters)

Definition at line 45 of file RichardsPolyLineSink.C.

46  : DiracKernel(parameters),
48  const_cast<RichardsSumQuantity &>(getUserObject<RichardsSumQuantity>("SumQuantityUO"))),
49  _sink_func(getParam<std::vector<Real>>("pressures"), getParam<std::vector<Real>>("fluxes")),
50  _point_file(getParam<FileName>("point_file")),
51  _richards_name_UO(getUserObject<RichardsVarNames>("richardsVarNames_UO")),
53  _pp(getMaterialProperty<std::vector<Real>>("porepressure")),
54  _dpp_dv(getMaterialProperty<std::vector<std::vector<Real>>>("dporepressure_dv"))
55 {
56  // open file
57  std::ifstream file(_point_file.c_str());
58  if (!file.good())
59  mooseError("Error opening file '" + _point_file + "' from RichardsPolyLineSink.");
60 
61  std::vector<Real> scratch;
62  while (parseNextLineReals(file, scratch))
63  {
64  if (scratch.size() >= 1)
65  {
66  _xs.push_back(scratch[0]);
67  if (scratch.size() >= 2)
68  _ys.push_back(scratch[1]);
69  else
70  _ys.push_back(0.0);
71 
72  if (scratch.size() >= 3)
73  _zs.push_back(scratch[2]);
74  else
75  _zs.push_back(0.0);
76  }
77  }
78 
79  file.close();
80 
81  // To correctly compute the Jacobian terms,
82  // tell MOOSE that this DiracKernel depends on all the Richards Vars
83  const std::vector<MooseVariable *> & coupled_vars = _richards_name_UO.getCoupledMooseVars();
84  for (unsigned int i = 0; i < coupled_vars.size(); i++)
85  addMooseVariableDependency(coupled_vars[i]);
86 }
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)
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.
unsigned int richards_var_num(unsigned int moose_var_num) const
the richards variable number

Member Function Documentation

void RichardsPolyLineSink::addPoints ( )
virtual

Definition at line 111 of file RichardsPolyLineSink.C.

112 {
114 
115  // Add point using the unique ID "i", let the DiracKernel take
116  // care of the caching. This should be fast after the first call,
117  // as long as the points don't move around.
118  for (unsigned int i = 0; i < _zs.size(); i++)
119  addPoint(Point(_xs[i], _ys[i], _zs[i]), i);
120 }
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
Real RichardsPolyLineSink::computeQpJacobian ( )
virtual

Definition at line 132 of file RichardsPolyLineSink.C.

133 {
134  Real test_fcn = _test[_i][_qp];
135  return test_fcn * _sink_func.sampleDerivative(_pp[_qp][_pvar]) * _dpp_dv[_qp][_pvar][_pvar] *
136  _phi[_j][_qp];
137 }
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)
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 140 of file RichardsPolyLineSink.C.

141 {
143  return 0.0;
144  unsigned int dvar = _richards_name_UO.richards_var_num(jvar);
145  Real test_fcn = _test[_i][_qp];
146  return test_fcn * _sink_func.sampleDerivative(_pp[_qp][_pvar]) * _dpp_dv[_qp][_pvar][dvar] *
147  _phi[_j][_qp];
148 }
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)
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.
unsigned int richards_var_num(unsigned int moose_var_num) const
the richards variable number
Real RichardsPolyLineSink::computeQpResidual ( )
virtual

Definition at line 123 of file RichardsPolyLineSink.C.

124 {
125  Real test_fcn = _test[_i][_qp];
126  Real flow = test_fcn * _sink_func.sample(_pp[_qp][_pvar]);
127  _total_outflow_mass.add(flow * _dt);
128  return flow;
129 }
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)
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 89 of file RichardsPolyLineSink.C.

Referenced by RichardsPolyLineSink().

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

Member Data Documentation

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

d(porepressure_i)/d(variable_j)

Definition at line 68 of file RichardsPolyLineSink.h.

Referenced by computeQpJacobian(), and computeQpOffDiagJacobian().

std::string RichardsPolyLineSink::_point_file
protected

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

Definition at line 56 of file RichardsPolyLineSink.h.

Referenced by RichardsPolyLineSink().

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

fluid porepressure (or porepressures in case of multiphase)

Definition at line 65 of file RichardsPolyLineSink.h.

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

unsigned int RichardsPolyLineSink::_pvar
protected

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

Definition at line 62 of file RichardsPolyLineSink.h.

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

const RichardsVarNames& RichardsPolyLineSink::_richards_name_UO
protected

Defines the richards variables in the simulation.

Definition at line 59 of file RichardsPolyLineSink.h.

Referenced by computeQpOffDiagJacobian(), and RichardsPolyLineSink().

LinearInterpolation RichardsPolyLineSink::_sink_func
protected

mass flux = _sink_func as a function of porepressure

Definition at line 53 of file RichardsPolyLineSink.h.

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

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 50 of file RichardsPolyLineSink.h.

Referenced by addPoints(), and computeQpResidual().

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

vector of Dirac Points' x positions

Definition at line 71 of file RichardsPolyLineSink.h.

Referenced by addPoints(), and RichardsPolyLineSink().

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

vector of Dirac Points' y positions

Definition at line 74 of file RichardsPolyLineSink.h.

Referenced by addPoints(), and RichardsPolyLineSink().

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

vector of Dirac Points' z positions

Definition at line 77 of file RichardsPolyLineSink.h.

Referenced by addPoints(), and RichardsPolyLineSink().


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