Go to the documentation of this file.
52 int main(
int argc,
char* argv[])
56 "Processes a set of geometrical obstructions to determine the"
57 " equivalent blockage effects when setting cases for PDRFoam"
74 "Force use of legacy obstacles table"
80 "Read obstacles and write VTK only"
93 const bool dryrun =
args.
found(
"dry-run");
151 pdrBlock.
read(iodict);
162 const scalar volObstacles =
187 <<
"dry-run: stopping after reading/writing obstacles" <<
nl
196 const labelRange origBlocks(0, obstacles.size());
199 labelRange interBlocks(origBlocks.after(), 0);
201 scalar volSubtract = 0;
210 Info<<
" block/cylinder intersections" <<
endl;
212 label nblocked = obstacles.size();
216 nblocked = (obstacles.size() - nblocked);
218 interBlocks += nblocked;
219 int1Blocks += nblocked;
228 Info<<
" block/block intersections" <<
endl;
230 label nblocked = obstacles.size();
234 nblocked = (obstacles.size() - nblocked);
236 interBlocks += nblocked;
237 int2Blocks += nblocked;
246 Info<<
" triple intersections" <<
endl;
248 label nblocked = obstacles.size();
250 volSubtract +=
block_overlap(obstacles, interBlocks, 1.0/3.0);
252 nblocked = (obstacles.size() - nblocked);
254 interBlocks += nblocked;
255 int3Blocks += nblocked;
268 if (origBlocks.size())
270 Info<<
" negative blocks: " << origBlocks.size() <<
nl;
272 for (
const PDRobstacle& obs : obstacles[origBlocks])
274 arr.addBlockage(obs,
patches, -1);
281 if (interBlocks.size())
283 Info<<
" blocks " << interBlocks.size() <<
nl;
285 for (
const PDRobstacle& obs : obstacles[interBlocks])
287 arr.addBlockage(obs,
patches, 0);
292 if (origBlocks.size())
294 Info<<
" positive blocks: " << origBlocks.size() <<
nl;
296 for (
const PDRobstacle& obs : obstacles[origBlocks])
298 arr.addBlockage(obs,
patches, 1);
303 if (cylinders.size())
305 Info<<
" cylinders: " << cylinders.size() <<
nl;
309 arr.addCylinder(obs);
316 arr.blockageSummary();
327 <<
setw(6) << origBlocks.size() <<
" blocks and "
328 << cylinders.size() <<
" cylinders/diagonal blocks" <<
nl;
331 <<
" intersections amongst blocks" <<
nl;
334 <<
" intersections between blocks and cyl/beams" <<
nl;
337 <<
"/3 triple intersections" <<
nl;
339 Info<<
"Volume of obstacles read in: " << volObstacles
340 <<
", volume of intersections: " << volSubtract <<
nl;
342 Info<<
nl <<
"After corrections:" <<
nl;
343 arr.blockageSummary();
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Preparation of fields for PDRFoam.
const word & name() const
Return name.
A class for handling words, derived from Foam::string.
A class for handling file names.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
Foam::PDRparams pars
Globals for program parameters (ugly hack)
scalar block_overlap(DynamicList< PDRobstacle > &blocks, const labelRange &range, const scalar multiplier=1.0)
Calculate block/block overlaps.
static void addNote(const string ¬e)
Add extra notes for the usage information.
const word dictName("blockMeshDict")
Ostream & endl(Ostream &os)
Add newline and flush stream.
bool readIfPresent(const word &optName, T &val) const
Read a value from the named option if present.
const boundBox & bounds() const
The mesh bounding box.
static const Enum< predefined > names
Names for predefined types.
void read_mesh_spec(const fileName &casepath, PDRblock &pdrBlock)
static void calculateAndWrite(PDRarrays &arr, const PDRmeshArrays &meshIndexing, const fileName &casepath, const UList< PDRpatchDef > &patches)
void print_info(const PDRblock &block)
void read(const dictionary &dict)
Read program parameters from dictionary.
static void noFunctionObjects(bool addWithOption=false)
Remove '-noFunctionObjects' option and ignore any occurrences.
messageStream Info
Information stream (uses stdout - output is on the master only)
Work array definitions for PDR fields.
static scalar legacyReadFiles(const fileName &obsFileDir, const wordList &obsFileNames, const boundBox &meshBb, DynamicList< PDRobstacle > &blocks, DynamicList< PDRobstacle > &cylinders)
Read obstacle files and add to the lists.
Istream and Ostream manipulators taking arguments.
A range or interval of labels defined by a start and a size.
static scalar readFiles(const fileName &obsFileDir, const wordList &obsFileNames, const boundBox &meshBb, DynamicList< PDRobstacle > &blocks, DynamicList< PDRobstacle > &cylinders)
Read obstacle files and set the lists.
Omanip< int > setw(const int i)
A single block x-y-z rectilinear mesh addressable as i,j,k with simplified creation....
void resize(const label newLen)
Adjust size of PtrList.
void read(const Time &runTime, const PDRblock &pdrBlock)
Read OpenFOAM mesh and determine i-j-k indices for faces/cells.
static void addBoolOption(const word &optName, const string &usage="", bool advanced=false)
Add a bool option to validOptions with usage information.
const word & system() const
Return system name.
int overlaps
Flag to control which overlap calculations are performed.
Obstacle definitions for PDR.
const polyBoundaryMesh & patches
fileName globalPath() const
Return global path for the case.
OpenFOAM/PDRblock addressing information.
static void generateVtk(const fileName &outputDir, const UList< PDRobstacle > &obslist, const UList< PDRobstacle > &cyllist)
Generate multi-piece VTK (vtp) file of obstacles.
scalar block_cylinder_overlap(DynamicList< PDRobstacle > &blocks, const labelRange &range, const UList< PDRobstacle > &cylinders)
Calculate block/cylinder overlaps.
static scalar gridPointRelTol
Relative tolerance when matching grid points. Default = 0.02.
static void noParallel()
Remove the parallel options.
static void addOption(const word &optName, const string ¶m="", const string &usage="", bool advanced=false)
Add an option to validOptions with usage information.
Foam::argList args(argc, argv)
bool read(const dictionary &dict)
Read dictionary.
predefined
Patch predefines.
bool found(const word &optName) const
Return true if the named option is found.