52int main(
int argc,
char* argv[])
56 "Processes a set of geometrical obstructions to determine the"
57 " equivalent blockage effects when setting cases for PDRFoam"
59 argList::noParallel();
60 argList::noFunctionObjects();
69 argList::addOption(
"dict",
"file",
"Alternative PDRsetFieldsDict");
71 argList::addBoolOption
74 "Force use of legacy obstacles table"
77 argList::addDryRunOption
79 "Read obstacles and write VTK only"
111 patches.resize(PDRpatchDef::NUM_PREDEFINED);
117 PDRpatchDef::BLOCKED_FACE,
118 PDRpatchDef::MERGING_PATCH,
119 PDRpatchDef::WALL_PATCH,
123 patches[predef] = PDRpatchDef::names[predef];
132 PDRlegacy::read_mesh_spec(casepath, pdrBlock);
143 IOobject::MUST_READ_IF_MODIFIED,
148 pdrBlock.
read(iodict);
151 PDRlegacy::print_info(pdrBlock);
159 const scalar volObstacles =
162 ? PDRobstacle::legacyReadFiles
171 pars.obsfile_dir,
pars.obsfile_names,
179 PDRobstacle::generateVtk(casepath/
"VTK", obstacles, cylinders);
184 <<
"dry-run: stopping after reading/writing obstacles" <<
nl
196 labelRange interBlocks(origBlocks.after(), 0);
198 scalar volSubtract = 0;
207 Info<<
" block/cylinder intersections" <<
endl;
209 label nblocked = obstacles.
size();
213 nblocked = (obstacles.
size() - nblocked);
215 interBlocks += nblocked;
216 int1Blocks += nblocked;
225 Info<<
" block/block intersections" <<
endl;
227 label nblocked = obstacles.
size();
231 nblocked = (obstacles.
size() - nblocked);
233 interBlocks += nblocked;
234 int2Blocks += nblocked;
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();
321 PDRarrays::calculateAndWrite(arr, meshIdx, casepath,
patches);
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();
Istream and Ostream manipulators taking arguments.
Preparation of fields for PDRFoam.
scalar block_overlap(DynamicList< PDRobstacle > &blocks, const labelRange &range, const scalar multiplier=1.0)
Calculate block/block overlaps.
scalar block_cylinder_overlap(DynamicList< PDRobstacle > &blocks, const labelRange &range, const UList< PDRobstacle > &cylinders)
Calculate block/cylinder overlaps.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
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,...
Work array definitions for PDR fields.
A single block x-y-z rectilinear mesh addressable as i,j,k with simplified creation....
bool read(const dictionary &dict)
Read dictionary.
OpenFOAM/PDRblock addressing information.
void read(const Time &runTime, const PDRblock &pdrBlock)
Read OpenFOAM mesh and determine i-j-k indices for faces/cells.
static scalar gridPointRelTol
Relative tolerance when matching grid points. Default = 0.02.
Obstacle definitions for PDR.
void read(const dictionary &dict)
Read program parameters from dictionary.
int overlaps
Flag to control which overlap calculations are performed.
predefined
Patch predefines.
SubList< T > slice(const label pos, label len=-1)
Return SubList slice (non-const access) - no range checking.
void size(const label n)
Older name for setAddressableSize.
int dryRun() const noexcept
Return the dry-run flag.
bool found(const word &optName) const
Return true if the named option is found.
bool readIfPresent(const word &optName, T &val) const
Read a value from the named option if present.
A class for handling file names.
A range or interval of labels defined by a start and a size.
A class for handling words, derived from Foam::string.
const polyBoundaryMesh & patches
const word dictName("faMeshDefinition")
messageStream Info
Information stream (stdout output on master, null elsewhere)
Omanip< int > setw(const int i)
Ostream & endl(Ostream &os)
Add newline and flush stream.
Foam::PDRparams pars
Globals for program parameters (ugly hack)
constexpr char nl
The newline '\n' character (0x0a)
Foam::argList args(argc, argv)