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 23 of file PorousFlowLineGeometry.h.

Constructor & Destructor Documentation

◆ PorousFlowLineGeometry()

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 43 of file PorousFlowLineGeometry.C.

44  : DiracKernel(parameters),
45  _line_length(getParam<Real>("line_length")),
46  _line_direction(getParam<RealVectorValue>("line_direction")),
47  _point_file(getParam<std::string>("point_file"))
48 {
49  statefulPropertiesAllowed(true);
50 
51  // open file
52  std::ifstream file(_point_file.c_str());
53  if (!file.good())
54  mooseError("PorousFlowLineGeometry: Error opening file " + _point_file);
55 
56  // construct the arrays of weight, x, y and z
57  std::vector<Real> scratch;
58  while (parseNextLineReals(file, scratch))
59  {
60  if (scratch.size() >= 2)
61  {
62  _rs.push_back(scratch[0]);
63  _xs.push_back(scratch[1]);
64  if (scratch.size() >= 3)
65  _ys.push_back(scratch[2]);
66  else
67  _ys.push_back(0.0);
68  if (scratch.size() >= 4)
69  _zs.push_back(scratch[3]);
70  else
71  _zs.push_back(0.0);
72  }
73  }
74 
75  file.close();
76 
77  const int num_pts = _zs.size();
78  _bottom_point(0) = _xs[num_pts - 1];
79  _bottom_point(1) = _ys[num_pts - 1];
80  _bottom_point(2) = _zs[num_pts - 1];
81 
82  // construct the line-segment lengths between each point
83  _half_seg_len.resize(std::max(num_pts - 1, 1));
84  for (unsigned int i = 0; i + 1 < _xs.size(); ++i)
85  {
86  _half_seg_len[i] = 0.5 * std::sqrt(Utility::pow<2>(_xs[i + 1] - _xs[i]) +
87  Utility::pow<2>(_ys[i + 1] - _ys[i]) +
88  Utility::pow<2>(_zs[i + 1] - _zs[i]));
89  if (_half_seg_len[i] == 0)
90  mooseError("PorousFlowLineGeometry: zero-segment length detected at (x,y,z) = ",
91  _xs[i],
92  " ",
93  _ys[i],
94  " ",
95  _zs[i],
96  "\n");
97  }
98  if (num_pts == 1)
100 }
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

◆ addPoints()

void PorousFlowLineGeometry::addPoints ( )
overrideprotectedvirtual

Add Dirac Points to the line sink.

Reimplemented in PorousFlowLineSink.

Definition at line 125 of file PorousFlowLineGeometry.C.

Referenced by PorousFlowLineSink::addPoints().

126 {
127  // Add point using the unique ID "i", let the DiracKernel take
128  // care of the caching. This should be fast after the first call,
129  // as long as the points don't move around.
130  for (unsigned int i = 0; i < _zs.size(); i++)
131  addPoint(Point(_xs[i], _ys[i], _zs[i]), i);
132 }
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

◆ parseNextLineReals()

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 103 of file PorousFlowLineGeometry.C.

Referenced by PorousFlowLineGeometry().

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

Member Data Documentation

◆ _bottom_point

Point PorousFlowLineGeometry::_bottom_point
protected

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

Definition at line 62 of file PorousFlowLineGeometry.h.

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

◆ _half_seg_len

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

◆ _line_direction

const RealVectorValue PorousFlowLineGeometry::_line_direction
protected

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

Definition at line 40 of file PorousFlowLineGeometry.h.

Referenced by PorousFlowPeacemanBorehole::PorousFlowPeacemanBorehole().

◆ _line_length

const Real PorousFlowLineGeometry::_line_length
protected

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

Definition at line 37 of file PorousFlowLineGeometry.h.

Referenced by PorousFlowLineGeometry().

◆ _point_file

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 47 of file PorousFlowLineGeometry.h.

Referenced by PorousFlowLineGeometry().

◆ _rs

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

◆ _xs

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

x points of the borehole

Definition at line 53 of file PorousFlowLineGeometry.h.

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

◆ _ys

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

y points of the borehole

Definition at line 56 of file PorousFlowLineGeometry.h.

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

◆ _zs

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

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