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"
74 "Force use of legacy obstacles table"
79 "Read obstacles and write VTK only"
95 args.readIfPresent(
"time",
pars.timeName);
98 pars.read(setFieldsDict);
100 if (
args.found(
"legacy"))
102 pars.legacyObsSpec =
true;
130 if (
pars.legacyMeshSpec)
148 pdrBlock.
read(iodict);
159 const scalar volObstacles =
164 pars.obsfile_dir,
pars.obsfile_names,
171 pars.obsfile_dir,
pars.obsfile_names,
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);
205 if (
pars.overlaps % 2 > 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);
223 if (
pars.overlaps % 4 > 1)
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);
241 if (
pars.overlaps % 8 > 3)
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();
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...
@ NO_WRITE
Ignore writing from objectRegistry::writeObject().
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Work array definitions for PDR fields.
static void calculateAndWrite(PDRarrays &arr, const PDRmeshArrays &meshIndexing, const fileName &casepath, const UList< PDRpatchDef > &patches)
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.
static void generateVtk(const fileName &outputDir, const UList< PDRobstacle > &obslist, const UList< PDRobstacle > &cyllist)
Generate multi-piece VTK (vtp) file of obstacles.
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 const Enum< predefined > names
Names for predefined types.
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.
static void noFunctionObjects(bool addWithOption=false)
Remove '-noFunctionObjects' option and ignore any occurrences.
static void addDryRunOption(const string &usage, bool advanced=false)
Enable a 'dry-run' bool option, with usage information.
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.
static void addOption(const word &optName, const string ¶m="", const string &usage="", bool advanced=false)
Add an option to validOptions with usage information.
static void addNote(const string ¬e)
Add extra notes for the usage information.
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")
void read_mesh_spec(const fileName &casepath, PDRblock &pdrBlock)
void print_info(const PDRblock &block)
Namespace for bounding specifications. At the moment, mostly for tables.
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)