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

Approximates a borehole by a sequence of Dirac Points. More...

#include <PorousFlowLineGeometry.h>

Inheritance diagram for PorousFlowLineGeometry:
[legend]

Public Member Functions

 PorousFlowLineGeometry (const InputParameters &parameters)
 Creates a new PorousFlowLineGeometry This reads the file containing the lines of the form weight x y z that defines the line geometry. More...
 

Protected Member Functions

virtual void addPoints () override
 Add Dirac Points to the line sink. More...
 
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

const Real _line_length
 line length. This is only used if there is only one borehole point More...
 
const RealVectorValue _line_direction
 line direction. This is only used if there is only one borehole point More...
 
const std::string _point_file
 File defining the geometry of the borehole. More...
 
std::vector< Real > _rs
 radii of the borehole More...
 
std::vector< Real > _xs
 x points of the borehole More...
 
std::vector< Real > _ys
 y points of the borehole More...
 
std::vector< Real > _zs
 z points of borehole More...
 
Point _bottom_point
 the bottom point of the borehole (where bottom_pressure is defined) More...
 
std::vector< Real > _half_seg_len
 0.5*(length of polyline segments between points) More...
 

Detailed Description

Approximates a borehole by a sequence of Dirac Points.

Definition at line 21 of file PorousFlowLineGeometry.h.

Constructor & Destructor Documentation

PorousFlowLineGeometry::PorousFlowLineGeometry ( const InputParameters &  parameters)

Creates a new PorousFlowLineGeometry This reads the file containing the lines of the form weight x y z that defines the line geometry.

It also calculates segment-lengths between the points

Definition at line 41 of file PorousFlowLineGeometry.C.

42  : DiracKernel(parameters),
43  _line_length(getParam<Real>("line_length")),
44  _line_direction(getParam<RealVectorValue>("line_direction")),
45  _point_file(getParam<std::string>("point_file"))
46 {
47  statefulPropertiesAllowed(true);
48 
49  // open file
50  std::ifstream file(_point_file.c_str());
51  if (!file.good())
52  mooseError("PorousFlowLineGeometry: Error opening file " + _point_file);
53 
54  // construct the arrays of weight, x, y and z
55  std::vector<Real> scratch;
56  while (parseNextLineReals(file, scratch))
57  {
58  if (scratch.size() >= 2)
59  {
60  _rs.push_back(scratch[0]);
61  _xs.push_back(scratch[1]);
62  if (scratch.size() >= 3)
63  _ys.push_back(scratch[2]);
64  else
65  _ys.push_back(0.0);
66  if (scratch.size() >= 4)
67  _zs.push_back(scratch[3]);
68  else
69  _zs.push_back(0.0);
70  }
71  }
72 
73  file.close();
74 
75  const int num_pts = _zs.size();
76  _bottom_point(0) = _xs[num_pts - 1];
77  _bottom_point(1) = _ys[num_pts - 1];
78  _bottom_point(2) = _zs[num_pts - 1];
79 
80  // construct the line-segment lengths between each point
81  _half_seg_len.resize(std::max(num_pts - 1, 1));
82  for (unsigned int i = 0; i + 1 < _xs.size(); ++i)
83  {
84  _half_seg_len[i] = 0.5 * std::sqrt(Utility::pow<2>(_xs[i + 1] - _xs[i]) +
85  Utility::pow<2>(_ys[i + 1] - _ys[i]) +
86  Utility::pow<2>(_zs[i + 1] - _zs[i]));
87  if (_half_seg_len[i] == 0)
88  mooseError("PorousFlowLineGeometry: zero-segment length detected at (x,y,z) = ",
89  _xs[i],
90  " ",
91  _ys[i],
92  " ",
93  _zs[i],
94  "\n");
95  }
96  if (num_pts == 1)
98 }
bool parseNextLineReals(std::ifstream &ifs, std::vector< Real > &myvec)
reads a space-separated line of floats from ifs and puts in myvec
const Real _line_length
line length. This is only used if there is only one borehole point
std::vector< Real > _ys
y points of the borehole
std::vector< Real > _half_seg_len
0.5*(length of polyline segments between points)
const RealVectorValue _line_direction
line direction. This is only used if there is only one borehole point
std::vector< Real > _zs
z points of borehole
const std::string _point_file
File defining the geometry of the borehole.
std::vector< Real > _xs
x points of the borehole
std::vector< Real > _rs
radii of the borehole
Point _bottom_point
the bottom point of the borehole (where bottom_pressure is defined)

Member Function Documentation

void PorousFlowLineGeometry::addPoints ( )
overrideprotectedvirtual

Add Dirac Points to the line sink.

Reimplemented in PorousFlowLineSink.

Definition at line 123 of file PorousFlowLineGeometry.C.

Referenced by PorousFlowLineSink::addPoints().

124 {
125  // Add point using the unique ID "i", let the DiracKernel take
126  // care of the caching. This should be fast after the first call,
127  // as long as the points don't move around.
128  for (unsigned int i = 0; i < _zs.size(); i++)
129  addPoint(Point(_xs[i], _ys[i], _zs[i]), i);
130 }
std::vector< Real > _ys
y points of the borehole
std::vector< Real > _zs
z points of borehole
std::vector< Real > _xs
x points of the borehole
bool PorousFlowLineGeometry::parseNextLineReals ( std::ifstream &  ifs,
std::vector< Real > &  myvec 
)
protected

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

Definition at line 101 of file PorousFlowLineGeometry.C.

Referenced by PorousFlowLineGeometry().

103 {
104  std::string line;
105  myvec.clear();
106  bool gotline(false);
107  if (getline(ifs, line))
108  {
109  gotline = true;
110 
111  // Harvest floats separated by whitespace
112  std::istringstream iss(line);
113  Real f;
114  while (iss >> f)
115  {
116  myvec.push_back(f);
117  }
118  }
119  return gotline;
120 }

Member Data Documentation

Point PorousFlowLineGeometry::_bottom_point
protected

the bottom point of the borehole (where bottom_pressure is defined)

Definition at line 60 of file PorousFlowLineGeometry.h.

Referenced by PorousFlowPeacemanBorehole::computeQpBaseOutflow(), PorousFlowPeacemanBorehole::computeQpBaseOutflowJacobian(), and PorousFlowLineGeometry().

std::vector<Real> PorousFlowLineGeometry::_half_seg_len
protected
const RealVectorValue PorousFlowLineGeometry::_line_direction
protected

line direction. This is only used if there is only one borehole point

Definition at line 38 of file PorousFlowLineGeometry.h.

Referenced by PorousFlowPeacemanBorehole::PorousFlowPeacemanBorehole().

const Real PorousFlowLineGeometry::_line_length
protected

line length. This is only used if there is only one borehole point

Definition at line 35 of file PorousFlowLineGeometry.h.

Referenced by PorousFlowLineGeometry().

const std::string PorousFlowLineGeometry::_point_file
protected

File defining the geometry of the borehole.

Each row has format weight x y z and the list of such points defines a polyline that is the line sink

Definition at line 45 of file PorousFlowLineGeometry.h.

Referenced by PorousFlowLineGeometry().

std::vector<Real> PorousFlowLineGeometry::_rs
protected
std::vector<Real> PorousFlowLineGeometry::_xs
protected

x points of the borehole

Definition at line 51 of file PorousFlowLineGeometry.h.

Referenced by addPoints(), PorousFlowLineGeometry(), and PorousFlowPeacemanBorehole::PorousFlowPeacemanBorehole().

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

y points of the borehole

Definition at line 54 of file PorousFlowLineGeometry.h.

Referenced by addPoints(), PorousFlowLineGeometry(), and PorousFlowPeacemanBorehole::PorousFlowPeacemanBorehole().

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

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