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" 79 "Read obstacles and write VTK only" 148 pdrBlock.
read(iodict);
159 const scalar volObstacles =
184 <<
"dry-run: stopping after reading/writing obstacles" <<
nl 196 labelRange interBlocks(origBlocks.end_value(), 0);
198 scalar volSubtract = 0;
203 labelRange int1Blocks(origBlocks.end_value(), 0);
207 Info<<
" block/cylinder intersections" <<
endl;
209 label nblocked = obstacles.
size();
213 nblocked = (obstacles.
size() - nblocked);
215 interBlocks += nblocked;
216 int1Blocks += nblocked;
222 labelRange int2Blocks(int1Blocks.end_value(), 0);
225 Info<<
" block/block intersections" <<
endl;
227 label nblocked = obstacles.
size();
231 nblocked = (obstacles.
size() - nblocked);
233 interBlocks += nblocked;
234 int2Blocks += nblocked;
240 labelRange int3Blocks(int2Blocks.end_value(), 0);
243 Info<<
" triple intersections" <<
endl;
245 label nblocked = obstacles.
size();
247 volSubtract +=
block_overlap(obstacles, interBlocks, 1.0/3.0);
249 nblocked = (obstacles.
size() - nblocked);
251 interBlocks += nblocked;
252 int3Blocks += nblocked;
265 if (origBlocks.size())
267 Info<<
" negative blocks: " << origBlocks.size() <<
nl;
271 arr.addBlockage(obs,
patches, -1);
278 if (interBlocks.size())
280 Info<<
" blocks " << interBlocks.size() <<
nl;
284 arr.addBlockage(obs,
patches, 0);
289 if (origBlocks.size())
291 Info<<
" positive blocks: " << origBlocks.size() <<
nl;
295 arr.addBlockage(obs,
patches, 1);
300 if (cylinders.
size())
302 Info<<
" cylinders: " << cylinders.
size() <<
nl;
306 arr.addCylinder(obs);
313 arr.blockageSummary();
324 <<
setw(6) << origBlocks.size() <<
" blocks and " 325 << cylinders.size() <<
" cylinders/diagonal blocks" <<
nl;
328 <<
" intersections amongst blocks" <<
nl;
331 <<
" intersections between blocks and cyl/beams" <<
nl;
334 <<
"/3 triple intersections" <<
nl;
336 Info<<
"Volume of obstacles read in: " << volObstacles
337 <<
", volume of intersections: " << volSubtract <<
nl;
339 Info<<
nl <<
"After corrections:" <<
nl;
340 arr.blockageSummary();
static void noFunctionObjects(bool addWithOption=false)
Remove '-noFunctionObjects' option and ignore any occurrences.
static const Enum< predefined > names
Names for predefined types.
static void addNote(const string ¬e)
Add extra notes for the usage information.
void size(const label n)
Older name for setAddressableSize.
A class for handling file names.
const word & name() const noexcept
Return the object name.
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.
static void calculateAndWrite(PDRarrays &arr, const PDRmeshArrays &meshIndexing, const fileName &casepath, const UList< PDRpatchDef > &patches)
A range or interval of labels defined by a start and a size.
constexpr char nl
The newline '\n' character (0x0a)
static scalar gridPointRelTol
Relative tolerance when matching grid points. Default = 0.02.
void read(const dictionary &dict)
Read program parameters from dictionary.
const word dictName("faMeshDefinition")
Ostream & endl(Ostream &os)
Add newline and flush stream.
scalar block_cylinder_overlap(DynamicList< PDRobstacle > &blocks, const labelRange &range, const UList< PDRobstacle > &cylinders)
Calculate block/cylinder overlaps.
static void addBoolOption(const word &optName, const string &usage="", bool advanced=false)
Add a bool option to validOptions with usage information.
static void noParallel()
Remove the parallel options.
Ignore writing from objectRegistry::writeObject()
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
bool read(const dictionary &dict)
Read dictionary.
void read_mesh_spec(const fileName &casepath, PDRblock &pdrBlock)
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects...
SubList< T > slice(const label pos, label len=-1)
Return SubList slice (non-const access) - no range checking.
void read(const Time &runTime, const PDRblock &pdrBlock)
Read OpenFOAM mesh and determine i-j-k indices for faces/cells.
fileName globalPath() const
Return global path for the case = rootPath/globalCaseName. Same as TimePaths::globalPath() ...
A class for handling words, derived from Foam::string.
static void addDryRunOption(const string &usage, bool advanced=false)
Enable a 'dry-run' bool option, with usage information.
int overlaps
Flag to control which overlap calculations are performed.
int dryRun() const noexcept
Return the dry-run flag.
const word & system() const noexcept
Return system name.
A single block x-y-z rectilinear mesh addressable as i,j,k with simplified creation. Some of the input is similar to blockMeshDict, but since this specialization is for a single-block that is aligned with the x-y-z directions, it provides a different means of specifying the mesh.
static void addOption(const word &optName, const string ¶m="", const string &usage="", bool advanced=false)
Add an option to validOptions with usage information.
Preparation of fields for PDRFoam.
static void generateVtk(const fileName &outputDir, const UList< PDRobstacle > &obslist, const UList< PDRobstacle > &cyllist)
Generate multi-piece VTK (vtp) file of obstacles.
Istream and Ostream manipulators taking arguments.
void resize(const label newLen)
Adjust size of PtrList.
predefined
Patch predefines.
OpenFOAM/PDRblock addressing information.
const polyBoundaryMesh & patches
Foam::PDRparams pars
Globals for program parameters (ugly hack)
messageStream Info
Information stream (stdout output on master, null elsewhere)
scalar block_overlap(DynamicList< PDRobstacle > &blocks, const labelRange &range, const scalar multiplier=1.0)
Calculate block/block overlaps.
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.
void print_info(const PDRblock &block)
Work array definitions for PDR fields.
Omanip< int > setw(const int i)
bool readIfPresent(const word &optName, T &val) const
Read a value from the named option if present.
Foam::argList args(argc, argv)
Defines the attributes of an object for which implicit objectRegistry management is supported...
Obstacle definitions for PDR.
bool found(const word &optName) const
Return true if the named option is found.