Go to the documentation of this file.
83 const bool flipFaceFlux,
84 const label newPatchi,
91 if (modifiedFace.
set(facei))
139 const Type& exposedValue,
155 Info<<
"Subsetting " << GeoField::typeName <<
nl;
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;
206 void subsetSurfaceFields
211 const Type& exposedValue,
227 Info<<
"Subsetting " << GeoField::typeName <<
nl;
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;
279 template<
class GeoField>
280 void 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;
315 template<
class TopoSet>
327 ReadFields<TopoSet>(objects, sets);
329 subSets.
resize(sets.size());
332 TopoSet& set = sets[seti];
334 Info<<
"Subsetting " << set.type() <<
" " << set.name() <<
endl;
338 for (
const label
id : set)
344 for (
const label
id : map)
357 TopoSet& subSet = subSets[seti];
361 if (isSet.test(map[i]))
370 void createCoupledBaffles
380 forAll(coupledWantedPatch, facei)
382 if (coupledWantedPatch[facei] != -1)
386 bool zoneFlip =
false;
402 coupledWantedPatch[facei],
411 bool zoneFlip =
false;
426 coupledWantedPatch[facei],
437 void createCyclicCoupledBaffles
448 forAll(cyclicMasterPatch, facei)
450 if (cyclicMasterPatch[facei] != -1)
455 bool zoneFlip =
false;
470 cyclicMasterPatch[facei],
478 forAll(cyclicSlavePatch, facei)
480 if (cyclicSlavePatch[facei] != -1)
486 bool zoneFlip =
false;
501 cyclicSlavePatch[facei],
520 Info <<
"faceZone:createBaffle " << faceZones <<
endl;
521 forAll(wantedPatch, facei)
523 if (wantedPatch[facei] != -1)
528 bool zoneFlip =
false;
555 bool zoneFlip =
false;
593 <<
"Illegal patch " << patchName
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
618 int main(
int argc,
char *argv[])
622 "Mesh and field preparation utility for PDR type simulations."
655 for (
const entry& dEntry : functionDicts)
657 if (!dEntry.isDict())
662 const word& key = dEntry.keyword();
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]
691 Info<<
"Faces that get exposed become boundary faces in patch "
692 << defaultPatch <<
endl;
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>
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;
809 cyclicWantedPatch_half0,
815 cyclicWantedPatch_half1,
828 const auto& obj = *objPtr;
832 obj.headerClassName() == volScalarField::typeName
833 || obj.headerClassName() == volVectorField::typeName
834 || obj.headerClassName() == volSphericalTensorField::typeName
835 || obj.headerClassName() == volTensorField::typeName
836 || obj.headerClassName() == volSymmTensorField::typeName
837 || obj.headerClassName() == surfaceScalarField::typeName
838 || obj.headerClassName() == surfaceVectorField::typeName
839 || obj.headerClassName() == surfaceSphericalTensorField::typeName
840 || obj.headerClassName() == surfaceSymmTensorField::typeName
841 || obj.headerClassName() == surfaceTensorField::typeName
878 sphTensorNames.size()
941 surfSphTensorNames.size()
949 surfSphericalTensorFlds
959 surfSymmTensorNames.size()
1027 scalarFlds[i].rename(scalarNames[i]);
1032 vectorFlds[i].rename(vectorNames[i]);
1037 sphTensorFlds[i].rename(sphTensorNames[i]);
1040 forAll(symmTensorFlds, i)
1042 symmTensorFlds[i].rename(symmTensorNames[i]);
1047 tensorFlds[i].rename(tensorNames[i]);
1052 forAll(surfScalarFlds, i)
1054 surfScalarFlds[i].rename(surfScalarNames[i]);
1057 forAll(surfVectorFlds, i)
1059 surfVectorFlds[i].rename(surfVectorNames[i]);
1062 forAll(surfSphericalTensorFlds, i)
1064 surfSphericalTensorFlds[i].rename(surfSphTensorNames[i]);
1067 forAll(surfSymmTensorFlds, i)
1069 surfSymmTensorFlds[i].rename(surfSymmTensorNames[i]);
1072 forAll(surfTensorNames, i)
1074 surfTensorFlds[i].rename(surfTensorNames[i]);
1106 cyclicWantedPatch_half0,
1114 cyclicWantedPatch_half1,
1126 createCoupledBaffles
1135 createCyclicCoupledBaffles
1138 cyclicWantedPatch_half0,
1139 cyclicWantedPatch_half1,
1159 meshMod.changeMesh(subsetter.
subMesh(),
false);
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>
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;
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
A keyword and a list of tokens is an 'entry'.
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
bitSet create(const label n, const labelHashSet &locations, const bool on=true)
Create a bitSet with length n with the specified on locations.
Defines the attributes of an object for which implicit objectRegistry management is supported,...
SphericalTensor< scalar > sphericalTensor
SphericalTensor of scalars, i.e. SphericalTensor<scalar>.
const word & name() const
Return name.
A class for handling words, derived from Foam::string.
virtual bool write(const bool valid=true) const
Write mesh using IO settings from time.
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
const labelList & cellMap() const
Return cell map.
A polyBoundaryMesh is a polyPatch list with additional search methods and registered IO.
const labelList & pointMap() const
Return point map.
Given the original mesh and the list of selected cells, it creates the mesh consisting only of the de...
static constexpr const zero Zero
Global zero (0)
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
label nFaces() const
Number of mesh faces.
const IOobject * findObject(const word &objName) const
Return const pointer to the object found by name.
static word timeName(const scalar t, const int precision=precision_)
An abstract base class with a fat-interface to all derived classes covering all possible ways in whic...
Direct mesh changes based on v1.3 polyTopoChange syntax.
static void addNote(const string ¬e)
Add extra notes for the usage information.
const fileName & facesInstance() const
Return the current instance directory for faces.
wordList sortedNames() const
The sorted names of the IOobjects.
void set(const bitSet &bitset)
Set specified bits from another bitset.
Class describing modification of a face.
virtual tmp< scalarField > movePoints(const pointField &)
Move points, returns volumes swept by faces in motion.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
Ostream & endl(Ostream &os)
Add newline and flush stream.
const Type & value() const
Return const reference to value.
const labelList & oldPatchSizes() const
Return list of the old patch sizes.
const pointField & preMotionPoints() const
Pre-motion point positions.
T get(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
wordList names() const
Return a list of patch names.
#define forAll(list, i)
Loop across all elements in list.
const faceZoneMesh & faceZones() const
Return face zone mesh.
const fvMesh & baseMesh() const
Original mesh.
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
static void noFunctionObjects(bool addWithOption=false)
Remove '-noFunctionObjects' option and ignore any occurrences.
label nCells() const
Number of mesh cells.
virtual void updateMesh(const mapPolyMesh &morphMap)
Update any stored data for new labels. Not implemented.
const fvMesh & subMesh() const
Return reference to subset mesh.
A subset of mesh faces organised as a primitive patch.
messageStream Info
Information stream (uses stdout - output is on the master only)
virtual const labelList & faceOwner() const
Return face owner.
const dictionary & subDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a sub-dictionary.
A List with indirect addressing.
virtual void updateMesh(const mapPolyMesh &mpm)
Update mesh corresponding to the given map.
SymmTensor< scalar > symmTensor
SymmTensor of scalars, i.e. SymmTensor<scalar>.
This class separates the mesh into distinct unconnected regions, each of which is then given a label ...
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
label findPatchID(const word &patchName, const bool allowNotFound=true) const
Find patch index given a name, return -1 if not found.
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< ' ';}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< ' ';}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< ' ';}gmvFile<< nl;for(const word &name :lagrangianScalarNames){ IOField< scalar > fld(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
#define forAllIters(container, iter)
Iterate across all elements in the container object.
ITstream & lookup(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
label whichZone(const label objectIndex) const
Given a global object index, return the zone it is in.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
const dictionary & controlDict() const
Return read access to the controlDict dictionary.
const labelIOList & zoneID
Mesh data needed to do the Finite Volume discretisation.
label whichFace(const label globalCellID) const
Helper function to re-direct to zone::localID(...)
const T * set(const label i) const
Return const pointer to element (if set) or nullptr.
A collection of cell labels.
Vector< scalar > vector
A scalar version of the templated Vector.
label start() const
Return start label of this patch in the polyMesh face list.
List of IOobjects with searching and retrieving facilities.
errorManipArg< error, int > exit(error &err, const int errNo=1)
void resize(const label newLen)
Adjust size of PtrList.
A HashTable similar to std::unordered_map.
const fvBoundaryMesh & boundary() const
Return reference to boundary mesh.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
const word & system() const
Return system name.
virtual const faceList & faces() const
Return raw faces.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
label setAction(const topoAction &action)
For compatibility with polyTopoChange: set topological action.
Field reading functions for post-processing utilities.
bool add(autoPtr< IOobject > &objectPtr)
Add IOobject to the list.
const fvPatch & patch() const
Return patch.
bool isInternalFace(const label faceIndex) const
Return true if given face label is internal to the mesh.
A 1D vector of objects of type <T> with a fixed length <N>.
const polyBoundaryMesh & patches
static tmp< GeometricField< Type, fvPatchField, volMesh > > interpolate(const GeometricField< Type, fvPatchField, volMesh > &, const fvMesh &sMesh, const labelUList &patchMap, const labelUList &cellMap, const labelUList &faceMap)
Map volume field.
const polyPatch & patch() const
Return the polyPatch.
const labelList & faceMap() const
Return face map.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
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 face is a list of labels corresponding to mesh vertices.
const fvPatch & patch() const
Return patch.
const labelList & patchMap() const
Return patch map.
Foam::argList args(argc, argv)
const boolList & flipMap() const
Return face flip map.
#define WarningInFunction
Report a warning using Foam::Warning.
Tensor< scalar > tensor
Tensor of scalars, i.e. Tensor<scalar>.
multivariateSurfaceInterpolationScheme< scalar >::fieldTable fields
virtual const labelList & faceNeighbour() const
Return face neighbour.
bool found(const word &optName) const
Return true if the named option is found.