30 void Foam::meshingSurfaceList::mergeBoundingBoxes
36 if (bb1.volume() == 0)
55 void Foam::meshingSurfaceList::swapExternalIndexZero(
const label index)
62 autoPtr<meshingSurface> s0Ptr(set(0,
nullptr));
63 autoPtr<meshingSurface> sIndexPtr(set(index,
nullptr));
65 set(index, s0Ptr.ptr());
66 set(0, sIndexPtr.ptr());
70 bool Foam::meshingSurfaceList::regionsValid
77 if (specifiedRegions.empty())
88 match = (specifiedRegions[
s] == regions[r]) || match;
98 <<
"Region '"<< specifiedRegions[
s]
99 <<
"' specified with the '" << opt
101 <<
"does not match any regions in the external surface"
110 void Foam::meshingSurfaceList::setSurfaceTypes
112 const List<word>& surfaces,
113 const surfaceType&
type
118 const word surface = fileName(surfaces[i]).lessExt();
125 if (surface ==
operator[](surfi).
name())
130 !
operator[](surfi).closed()
138 <<
"Argument to '-" << surfaceType
139 <<
"' contains the " << surfaceType <<
" '"
140 << surface <<
"'" <<
nl
141 <<
"which is not a closed surface."
145 operator[](surfi).type() =
type;
154 <<
"Argument to '-" << surfaceType
155 <<
"' contains the " << surfaceType <<
" '"
156 << surface <<
"'" <<
nl
157 <<
"which does not correspond to any surfaces."
164 void Foam::meshingSurfaceList::setRotatingZoneBounds()
168 if (
operator[](surfi).
type() == surfaceType::rotatingZone)
170 mergeBoundingBoxes(rzbb_,
operator[](surfi).bb());
176 void Foam::meshingSurfaceList::identifyCellZones()
182 operator[](i).
type() == surfaceType::external
183 ||
operator[](i).
type() == surfaceType::rotatingZone
184 ||
operator[](i).nParts() != 1
185 || !
operator[](i).closed()
198 if (
operator[](i).bb().contains(
operator[](j).bb()))
200 operator[](i).type() = surfaceType::cellZone;
208 void Foam::meshingSurfaceList::reportWordList(
const wordList& wl)
213 if (i != wl.size() - 1)
223 void Foam::meshingSurfaceList::reportSurfaces()
225 Info<<
"Case contains the following surface geometry files:"
230 Info<<
"+ " << operator[](i).name() <<
nl
231 <<
" + File: " << operator[](i).file() <<
nl
232 <<
" + Bounding box: " << operator[](i).bb() <<
nl
233 <<
" + " << (operator[](i).closed() ?
"Closed" :
"Open")
234 <<
" surface" <<
endl;
236 switch (
operator[](i).type())
238 case surfaceType::external:
240 Info <<
" + External boundary surface" <<
endl;
242 if (!
operator[](i).inletRegions().empty())
244 Info<<
" + Inlet regions: ";
245 reportWordList(
operator[](i).inletRegions());
248 if (!
operator[](i).outletRegions().empty())
250 Info <<
" + Outlet regions: ";
251 reportWordList(
operator[](i).outletRegions());
257 case surfaceType::wall:
259 Info <<
" + Wall boundary surface" <<
endl;
263 case surfaceType::cellZone:
265 Info <<
" + Cell zone surface" <<
endl;
269 case surfaceType::rotatingZone:
271 Info <<
" + Rotating zone surface" <<
endl;
275 case surfaceType::baffle:
277 Info <<
" + Baffle wall surface" <<
endl;
287 void Foam::meshingSurfaceList::setBounds(
const boundBox& bb)
289 if (bb.contains(bb_))
291 Info<<
"Specified bounding box contains the overall bounding box"
297 <<
"Specified bounding box does not contain the overall "
302 if (bb.mag() > 1.5*bb_.mag())
304 Info<<
"Specified bounding box is > (1.5 * overall "
305 <<
"bounding box)" <<
nl
306 <<
"**Assuming this is an external flow**"
309 operator[](0).type() = surfaceType::wall;
328 const wordList& specifiedInletRegions,
329 const wordList& specifiedOutletRegions
332 PtrList<meshingSurface>(),
339 append(
new meshingSurface(surfaces[i], time));
341 mergeBoundingBoxes(bb_, last().bb());
344 label externalID = 0;
349 boundBox bbInflate = operator[](i).bb();
350 bbInflate.inflate(1
e-4);
354 operator[](i).closed()
355 &&
operator[](i).nParts() == 1
356 && bbInflate.contains(bb_)
360 operator[](i).type() = surfaceType::external;
364 const wordList& regions = operator[](i).regions();
366 wordList& inletRegions = operator[](i).inletRegions();
367 if (regionsValid(specifiedInletRegions, regions,
"-inletRegions"))
369 inletRegions = specifiedInletRegions;
372 wordList& outletRegions = operator[](i).outletRegions();
373 if (regionsValid(specifiedOutletRegions, regions,
"-outletRegions"))
375 outletRegions = specifiedOutletRegions;
380 if (inletRegions.empty() && outletRegions.empty())
382 inletRegions.
append(
"<inletRegion>");
383 outletRegions.append(
"<outletRegion>");
388 swapExternalIndexZero(externalID);
390 if (!rotatingZones.empty())
392 setSurfaceTypes(rotatingZones, surfaceType::rotatingZone);
395 if (!baffles.empty())
397 setSurfaceTypes(baffles, surfaceType::baffle);
400 setRotatingZoneBounds();
402 if (cellZones.empty())
408 setSurfaceTypes(cellZones, surfaceType::cellZone);
413 if (bb.volume() != 0)
#define forAll(list, i)
Loop across all elements in list.
void append(const T &)
Append an element at the end of the list.
~meshingSurfaceList()
Destructor.
meshingSurfaceList(const Time &time, const fileNameList &surfaces, const wordList &cellZones, const wordList &rotatingZones, const wordList &baffles, const boundBox &bb, const wordList &inletRegions, const wordList &outletRegions)
Construct from components.
static const NamedEnum< surfaceType, 5 > surfaceTypeNames
Enumeration names for surfaceTypes.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().x()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().y()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.name(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
#define WarningInFunction
Report a warning using Foam::Warning.
const dimensionedScalar e
Elementary charge.
errorManipArg< error, int > exit(error &err, const int errNo=1)
List< word > wordList
A List of words.
List< fileName > fileNameList
A List of fileNames.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Ostream & endl(Ostream &os)
Add newline and flush stream.
word name(const bool)
Return a word representation of a bool.
vector point
Point is a vector.
layerAndWeight min(const layerAndWeight &a, const layerAndWeight &b)
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.