83 const bool flipFaceFlux,
84 const label newPatchi,
91 if (modifiedFace.
set(facei))
139 const Type& exposedValue,
159 GeoField origField(*ioptr, baseMesh);
161 subFields.set(nFields, subsetter.
interpolate(origField));
167 subFields[nFields].boundaryFieldRef()[patchi];
169 const label newStart =
fld.patch().patch().start();
170 const label oldPatchi = subsetter.
patchMap()[patchi];
183 origField.boundaryField()[oldPatchi];
185 const label oldSize = origPfld.
size();
190 const label oldFacei = subsetter.
faceMap()[newStart+j];
192 if (oldFacei < oldStart || oldFacei >= oldStart+oldSize)
194 fld[j] = exposedValue;
206void subsetSurfaceFields
211 const Type& exposedValue,
231 GeoField origField(*ioptr, baseMesh);
233 subFields.set(nFields, subsetter.
interpolate(origField));
239 subFields[nFields].boundaryFieldRef()[patchi];
241 const label newStart =
fld.patch().patch().start();
242 const label oldPatchi = subsetter.
patchMap()[patchi];
255 origField.boundaryField()[oldPatchi];
257 const label oldSize = origPfld.
size();
262 const label oldFacei = subsetter.
faceMap()[newStart+j];
264 if (oldFacei < oldStart || oldFacei >= oldStart+oldSize)
266 fld[j] = exposedValue;
279template<
class GeoField>
280void initCreatedPatches
284 const typename GeoField::value_type initValue
289 mesh.objectRegistry::lookupClass<GeoField>()
294 GeoField&
field =
const_cast<GeoField&
>(*fieldIter());
296 auto& fieldBf =
field.boundaryFieldRef();
303 fieldBf[patchi] = initValue;
305 if (fieldBf[patchi].fixesValue())
307 fieldBf[patchi] == initValue;
315template<
class TopoSet>
327 ReadFields<TopoSet>(objects, sets);
332 TopoSet&
set = sets[seti];
338 for (
const label
id : set)
344 for (
const label
id : map)
355 new TopoSet(subMesh,
set.name(), nSet, IOobject::AUTO_WRITE)
357 TopoSet& subSet = subSets[seti];
361 if (isSet.test(map[i]))
370void createCoupledBaffles
380 forAll(coupledWantedPatch, facei)
382 if (coupledWantedPatch[facei] != -1)
386 bool zoneFlip =
false;
400 mesh.faceOwner()[facei],
402 coupledWantedPatch[facei],
408 if (
mesh.isInternalFace(facei))
411 bool zoneFlip =
false;
424 mesh.faceNeighbour()[facei],
426 coupledWantedPatch[facei],
437void createCyclicCoupledBaffles
448 forAll(cyclicMasterPatch, facei)
450 if (cyclicMasterPatch[facei] != -1)
455 bool zoneFlip =
false;
468 mesh.faceNeighbour()[facei],
470 cyclicMasterPatch[facei],
478 forAll(cyclicSlavePatch, facei)
480 if (cyclicSlavePatch[facei] != -1)
483 if (
mesh.isInternalFace(facei))
486 bool zoneFlip =
false;
499 mesh.faceOwner()[facei],
501 cyclicSlavePatch[facei],
520 Info <<
"faceZone:createBaffle " << faceZones <<
endl;
521 forAll(wantedPatch, facei)
523 if (wantedPatch[facei] != -1)
528 bool zoneFlip =
false;
542 mesh.faceOwner()[facei],
552 if (
mesh.isInternalFace(facei))
555 bool zoneFlip =
false;
568 mesh.faceNeighbour()[facei],
588 label patchi =
patches.findPatchID(patchName);
593 <<
"Illegal patch " << patchName
594 <<
nl <<
"Valid patches are " <<
patches.names()
600 label newPatch = patchi;
603 if (newPatch != patchi)
606 <<
"Patch " << patchName
607 <<
" should have the same patch index on all processors." <<
nl
608 <<
"On my processor it has index " << patchi
609 <<
" ; on some other processor it has index " << newPatch
618int main(
int argc,
char *argv[])
622 "Mesh and field preparation utility for PDR type simulations."
626 argList::noFunctionObjects();
642 IOobject::MUST_READ_IF_MODIFIED,
655 for (
const entry& dEntry : functionDicts)
657 if (!dEntry.isDict())
662 const word&
key = dEntry.keyword();
665 const word cyclicName =
dict.get<
word>(
"cyclicMasterPatch");
668 nameAndType[0] =
key;
669 nameAndType[1] = wallName;
670 nameAndType[2] = cyclicName;
671 coupledAndPatches.append(nameAndType);
674 forAll(setsAndPatches, setI)
676 Info<<
"Faces in faceSet " << setsAndPatches[setI][0]
677 <<
" become baffles in patch " << setsAndPatches[setI][1]
681 forAll(coupledAndPatches, setI)
683 Info<<
"Faces in faceSet " << coupledAndPatches[setI][0]
684 <<
" become coupled baffles in patch " << coupledAndPatches[setI][1]
689 const word defaultPatch(
dict.get<
word>(
"defaultPatch"));
691 Info<<
"Faces that get exposed become boundary faces in patch "
692 << defaultPatch <<
endl;
694 const word blockedSetName(
dict.get<
word>(
"blockedCells"));
696 Info<<
"Reading blocked cells from cellSet " << blockedSetName
699 const bool overwrite =
args.
found(
"overwrite");
707 forAll(setsAndPatches, setI)
711 label patchi = findPatch
714 setsAndPatches[setI][1]
717 for (
const label facei : fSet)
719 if (wantedPatch[facei] != -1)
723 <<
" is in faceSet " << setsAndPatches[setI][0]
724 <<
" destined for patch " << setsAndPatches[setI][1]
725 <<
" but also in patch " << wantedPatch[facei]
728 wantedPatch[facei] = patchi;
737 forAll(coupledAndPatches, setI)
740 const label cyclicId =
741 findPatch(
patches, coupledAndPatches[setI][2]);
743 const label cyclicSlaveId = findPatch
746 refCast<const cyclicFvPatch>
748 mesh.boundary()[cyclicId]
749 ).neighbFvPatch().name()
753 label patchi = findPatch(
patches, coupledAndPatches[setI][1]);
755 for (
const label facei : fSet)
757 if (coupledWantedPatch[facei] != -1)
761 <<
" is in faceSet " << coupledAndPatches[setI][0]
762 <<
" destined for patch " << coupledAndPatches[setI][1]
763 <<
" but also in patch " << coupledWantedPatch[facei]
767 coupledWantedPatch[facei] = patchi;
768 cyclicWantedPatch_half0[facei] = cyclicId;
769 cyclicWantedPatch_half1[facei] = cyclicSlaveId;
774 label defaultPatchi = findPatch(
mesh.boundaryMesh(), defaultPatch);
809 cyclicWantedPatch_half0,
815 cyclicWantedPatch_half1,
828 const auto& obj = *objPtr;
878 sphTensorNames.size()
941 surfSphTensorNames.size()
949 surfSphericalTensorFlds
959 surfSymmTensorNames.size()
1021 Info<<
"Writing mesh without blockedCells to time " <<
runTime.value()
1027 scalarFlds[i].rename(scalarNames[i]);
1028 scalarFlds[i].writeOpt(IOobject::AUTO_WRITE);
1032 vectorFlds[i].rename(vectorNames[i]);
1033 vectorFlds[i].writeOpt(IOobject::AUTO_WRITE);
1037 sphTensorFlds[i].rename(sphTensorNames[i]);
1038 sphTensorFlds[i].writeOpt(IOobject::AUTO_WRITE);
1040 forAll(symmTensorFlds, i)
1042 symmTensorFlds[i].rename(symmTensorNames[i]);
1043 symmTensorFlds[i].writeOpt(IOobject::AUTO_WRITE);
1047 tensorFlds[i].rename(tensorNames[i]);
1048 tensorFlds[i].writeOpt(IOobject::AUTO_WRITE);
1052 forAll(surfScalarFlds, i)
1054 surfScalarFlds[i].rename(surfScalarNames[i]);
1055 surfScalarFlds[i].writeOpt(IOobject::AUTO_WRITE);
1057 forAll(surfVectorFlds, i)
1059 surfVectorFlds[i].rename(surfVectorNames[i]);
1060 surfVectorFlds[i].writeOpt(IOobject::AUTO_WRITE);
1062 forAll(surfSphericalTensorFlds, i)
1064 surfSphericalTensorFlds[i].rename(surfSphTensorNames[i]);
1065 surfSphericalTensorFlds[i].writeOpt(IOobject::AUTO_WRITE);
1067 forAll(surfSymmTensorFlds, i)
1069 surfSymmTensorFlds[i].rename(surfSymmTensorNames[i]);
1070 surfSymmTensorFlds[i].writeOpt(IOobject::AUTO_WRITE);
1072 forAll(surfTensorNames, i)
1074 surfTensorFlds[i].rename(surfTensorNames[i]);
1075 surfTensorFlds[i].writeOpt(IOobject::AUTO_WRITE);
1087 syncTools::syncFaceList
1095 syncTools::syncFaceList
1103 syncTools::syncFaceList
1106 cyclicWantedPatch_half0,
1111 syncTools::syncFaceList
1114 cyclicWantedPatch_half1,
1126 createCoupledBaffles
1135 createCyclicCoupledBaffles
1138 cyclicWantedPatch_half0,
1139 cyclicWantedPatch_half1,
1167 initCreatedPatches<volScalarField>
1173 initCreatedPatches<volVectorField>
1179 initCreatedPatches<volSphericalTensorField>
1185 initCreatedPatches<volSymmTensorField>
1191 initCreatedPatches<volTensorField>
1198 initCreatedPatches<surfaceScalarField>
1204 initCreatedPatches<surfaceVectorField>
1210 initCreatedPatches<surfaceSphericalTensorField>
1216 initCreatedPatches<surfaceSymmTensorField>
1222 initCreatedPatches<surfaceTensorField>
1241 Info<<
"Writing mesh with split blockedFaces to time " <<
runTime.value()
1256 if (cellRegion.nRegions() > 1)
1259 <<
"Removing blocked faces and cells created "
1260 << cellRegion.nRegions()
1261 <<
" regions that are not connected via a face." <<
nl
1262 <<
" This is not supported in solvers." <<
nl
1263 <<
" Use" <<
nl <<
nl
1264 <<
" splitMeshRegions <root> <case> -largestOnly" <<
nl <<
nl
1265 <<
" to extract a single region of the mesh." <<
nl
1266 <<
" This mesh will be written to a new timedirectory"
1267 <<
" so might have to be moved back to constant/" <<
nl
1272 if (startFrom !=
"latestTime")
1275 <<
"To run splitMeshRegions please set your"
1276 <<
" startFrom entry to latestTime" <<
endl;
Field reading functions for post-processing utilities.
Info<< nl<< "Wrote faMesh in vtk format: "<< writer.output().name()<< nl;}{ vtk::lineWriter writer(aMesh.points(), aMesh.edges(), fileName(aMesh.mesh().time().globalPath()/"finiteArea-edges"));writer.writeGeometry();writer.beginCellData(4);writer.writeProcIDs();{ Field< scalar > fld(faMeshTools::flattenEdgeField(aMesh.magLe(), true))
reduce(hasMovingMesh, orOp< bool >())
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
A 1D vector of objects of type <T> with a fixed length <N>.
Generic GeometricField class.
A HashTable similar to std::unordered_map.
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
List of IOobjects with searching and retrieving facilities.
const IOobject * findObject(const word &objName) const
Return const pointer to the object found by name.
wordList sortedNames() const
The sorted names of the IOobjects.
bool add(autoPtr< IOobject > &objectPtr)
Add IOobject to the list.
Defines the attributes of an object for which implicit objectRegistry management is supported,...
bool isHeaderClass() const
Check if headerClassName() equals Type::typeName.
A List with indirect addressing.
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
const T * set(const label i) const
void resize(const label newLen)
Adjust size of PtrList.
void size(const label n)
Older name for setAddressableSize.
label size() const noexcept
The number of elements in the list.
label whichZone(const label objectIndex) const
Given a global object index, return the zone it is in.
bool found(const word &optName) const
Return true if the named option is found.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
void set(const bitSet &bitset)
Set specified bits from another bitset.
A collection of cell labels.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
A keyword and a list of tokens is an 'entry'.
A subset of mesh faces organised as a primitive patch.
label whichFace(const label globalCellID) const
Helper function to re-direct to zone::localID(...)
const boolList & flipMap() const noexcept
Return face flip map.
A face is a list of labels corresponding to mesh vertices.
Holds a reference to the original mesh (the baseMesh) and optionally to a subset of that mesh (the su...
const fvMesh & baseMesh() const noexcept
Original mesh.
const labelList & faceMap() const
Return face map.
const labelList & cellMap() const
Return cell map.
static tmp< DimensionedField< Type, volMesh > > interpolate(const DimensionedField< Type, volMesh > &, const fvMesh &sMesh, const labelUList &cellMap)
Map volume internal (dimensioned) field.
const fvMesh & subMesh() const
Return reference to subset mesh.
const labelList & patchMap() const
Return patch map.
const labelList & pointMap() const
Return point map.
Mesh data needed to do the Finite Volume discretisation.
virtual bool write(const bool valid=true) const
Write mesh using IO settings from time.
virtual void updateMesh(const mapPolyMesh &mpm)
Update mesh corresponding to the given map.
virtual void movePoints(const pointField &)
Move points, returns volumes swept by faces in motion.
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
const fvPatch & patch() const
Return patch.
const polyPatch & patch() const
Return the polyPatch.
An abstract base class with a fat-interface to all derived classes covering all possible ways in whic...
const fvPatch & patch() const
Return patch.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
const pointField & preMotionPoints() const
Pre-motion point positions.
const labelList & oldPatchSizes() const
Return list of the old patch sizes.
bool hasMotionPoints() const
Has valid preMotionPoints?
A face addition data class. A face can be inflated either from a point or from another face and can e...
A polyBoundaryMesh is a polyPatch list with additional search methods and registered IO.
const fileName & facesInstance() const
Return the current instance directory for faces.
Class describing modification of a face.
label start() const
Return start label of this patch in the polyMesh face list.
Direct mesh changes based on v1.3 polyTopoChange syntax.
label setAction(const topoAction &action)
For compatibility with polyTopoChange: set topological action.
autoPtr< mapPolyMesh > changeMesh(polyMesh &mesh, const labelUList &patchMap, const bool inflate, const bool syncParallel=true, const bool orderCells=false, const bool orderPoints=false)
Inplace changes mesh without change of patches.
This class separates the mesh into distinct unconnected regions, each of which is then given a label ...
Tensor of scalars, i.e. Tensor<scalar>.
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
A class for handling words, derived from Foam::string.
const polyBoundaryMesh & patches
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
const labelIOList & zoneID
#define WarningInFunction
Report a warning using Foam::Warning.
void set(List< bool > &bools, const labelUList &locations)
Set the listed locations (assign 'true').
auto key(const Type &t) -> typename std::enable_if< std::is_enum< Type >::value, typename std::underlying_type< Type >::type >::type
messageStream Info
Information stream (stdout output on master, null elsewhere)
Ostream & endl(Ostream &os)
Add newline and flush stream.
errorManipArg< error, int > exit(error &err, const int errNo=1)
constexpr char nl
The newline '\n' character (0x0a)
Foam::argList args(argc, argv)
multivariateSurfaceInterpolationScheme< scalar >::fieldTable fields
#define forAll(list, i)
Loop across all elements in list.
#define forAllIters(container, iter)
Iterate across all elements in the container object.
static const char *const typeName
The type name used in ensight case files.