11 #include "libmesh/utility.h"
19 InputParameters params = validParams<DiracKernel>();
20 params.addRequiredParam<std::string>(
22 "The file containing the coordinates of the points and their weightings that approximate the "
23 "line sink. The physical meaning of the weightings depend on the scenario, eg, they may be "
24 "borehole radii. Each line in the file must contain a space-separated weight and "
25 "coordinate, viz r x y z. For boreholes, the last point in the file is defined as the "
26 "borehole bottom, where the borehole pressure is bottom_pressure. If your file contains "
27 "just one point, you must also specify the line_length and line_direction parameters. Note "
28 "that you will get segementation faults if your points do not lie within your mesh!");
29 params.addRangeCheckedParam<Real>(
33 "Line length. Note this is only used if there is only one point in the point_file.");
34 params.addParam<RealVectorValue>(
36 RealVectorValue(0.0, 0.0, 1.0),
37 "Line direction. Note this is only used if there is only one point in the point_file.");
38 params.addClassDescription(
"Approximates a polyline sink in the mesh using a number of Dirac "
39 "point sinks with given weightings that are read from a file");
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"))
49 statefulPropertiesAllowed(
true);
54 mooseError(
"PorousFlowLineGeometry: Error opening file " +
_point_file);
57 std::vector<Real> scratch;
60 if (scratch.size() >= 2)
62 _rs.push_back(scratch[0]);
63 _xs.push_back(scratch[1]);
64 if (scratch.size() >= 3)
65 _ys.push_back(scratch[2]);
68 if (scratch.size() >= 4)
69 _zs.push_back(scratch[3]);
77 const int num_pts =
_zs.size();
84 for (
unsigned int i = 0; i + 1 <
_xs.size(); ++i)
87 Utility::pow<2>(
_ys[i + 1] -
_ys[i]) +
88 Utility::pow<2>(
_zs[i + 1] -
_zs[i]));
90 mooseError(
"PorousFlowLineGeometry: zero-segment length detected at (x,y,z) = ",
109 if (getline(ifs, line))
114 std::istringstream iss(line);
130 for (
unsigned int i = 0; i <
_zs.size(); i++)
131 addPoint(Point(
_xs[i],
_ys[i],
_zs[i]), i);