52 #define XMESH_TAG "xmesh" 53 #define YMESH_TAG "ymesh" 54 #define ZMESH_TAG "zmesh" 77 struct pdrMeshSpecLine
83 pdrMeshSpecLine() : knot(0),
ndiv(0), factor(0) {}
94 Istream&
operator>>(Istream& is, pdrMeshSpecLine& spec)
100 is.readBegin(
"pdrMeshSpecLine");
108 spec.ndiv = tok.labelToken();
120 is.readEnd(
"pdrMeshSpecLine");
128 Ostream&
operator<<(Ostream&
os,
const pdrMeshSpecLine& spec)
145 void read_spec(ISstream& is,
const direction cmpt, List<scalar>& gridPoint)
147 if (!gridPoint.empty())
150 <<
"Duplicate specification of " 151 << vector::componentNames[cmpt]
156 List<pdrMeshSpecLine> specs(is);
158 if (specs.size() < 2)
161 <<
"Grid specification for " << vector::componentNames[cmpt]
162 <<
" is too small. Need at least two points!" <<
nl 166 specs.last().ndiv = 0;
169 DynamicList<scalar> knots;
170 DynamicList<label> divisions;
171 DynamicList<scalar> factors;
173 for (
const auto& spec : specs)
175 knots.append(spec.knot);
181 divisions.append(spec.ndiv);
182 factors.append(spec.factor);
186 for (
const label nDiv : divisions)
194 <<
"No cells defined for direction " 195 << vector::componentNames[cmpt] <<
nl 203 const label nSegments = divisions.size();
207 for (label segmenti=0; segmenti < nSegments; ++segmenti)
209 const label nDiv = divisions[segmenti];
210 const scalar factor = factors[segmenti];
212 SubList<scalar> subPoint(gridPoint, nDiv+1, start);
215 subPoint[0] = knots[segmenti];
216 subPoint[nDiv] = knots[segmenti+1];
218 const scalar dist = (subPoint.last() - subPoint.first());
220 if (
equal(factor, scalar(1)))
222 for (label i=1; i < nDiv; ++i)
224 subPoint[i] = (subPoint[0] + (dist * i)/nDiv);
229 scalar
delta = dist * (1.0 - factor) / (1.0 - ::
pow(factor, nDiv));
231 scalar xyz = subPoint[0];
233 for (label i=0; i < nDiv; ++i)
254 <<
" nCells: " << block.sizes() <<
nl 255 <<
" Box: " << block.bounds() <<
nl 265 Info<<
"Reading pdrMeshSpec (legacy format)" <<
nl;
267 bool processed =
false;
269 for (
const fileName dirName : {
"system",
"constant/polyMesh" })
273 casepath / dirName /
"pdrMeshSpec" 289 <<
"Did not process pdrMeshSpec" <<
nl 297 Vector<scalarList> grid;
306 if (line == XMESH_TAG)
308 Detail::read_spec(is, vector::X, grid.x());
310 else if (line == YMESH_TAG)
312 Detail::read_spec(is,
vector::Y, grid.y());
314 else if (line == ZMESH_TAG)
316 Detail::read_spec(is, vector::Z, grid.z());
320 for (
direction cmpt=0; cmpt < vector::nComponents; ++cmpt)
322 if (grid[cmpt].empty())
325 <<
"No specification for " 326 << vector::componentNames[cmpt]
332 block.reset(grid.x(), grid.y(), grid.z());
errorManipArg< error, int > exit(error &err, const int errNo=1)
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
bool equal(const T &a, const T &b)
Compare two values for equality.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
constexpr char nl
The newline '\n' character (0x0a)
void inplaceTrim(std::string &s)
Trim leading and trailing whitespace inplace.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Begin list [isseparator].
Functions used by OpenFOAM that are specific to POSIX compliant operating systems and need to be repl...
void read_mesh_spec(const fileName &casepath, PDRblock &pdrBlock)
Istream & operator>>(Istream &, directionInfo &)
OBJstream os(runTime.globalPath()/outputName)
fileName path(UMean.rootPath()/UMean.caseName()/"graphs"/UMean.instance())
bool isFile(const fileName &name, const bool checkGzip=true, const bool followLink=true)
Does the name exist as a FILE in the file system?
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
PtrList< volScalarField > & Y
messageStream Info
Information stream (stdout output on master, null elsewhere)
bool operator!=(const eddy &a, const eddy &b)
void print_info(const PDRblock &block)
tmp< GeometricField< Type, faPatchField, areaMesh > > ndiv(const GeometricField< Type, faePatchField, edgeMesh > &ssf)
FlatOutput::OutputAdaptor< Container, Delimiters > flatOutput(const Container &obj, Delimiters delim)
Global flatOutput() function with specified output delimiters.