70 const word& patchName,
71 const word& groupName,
77 if (
pbm.findPatchID(patchName) == -1)
90 pp.addGroup(groupName);
105 Info<<
"Patch '" << patchName
106 <<
"' already exists. Only "
107 <<
"moving patch faces - type will remain the same"
111 return pbm.findPatchID(patchName);
142 oldToNew[patchi] = newPatchi++;
153 oldToNew[patchi] = newPatchi++;
158 const label nKeepPatches = newPatchi;
161 if (nKeepPatches !=
pbm.size())
168 if (oldToNew[patchi] == -1)
171 <<
" type " <<
pbm[patchi].type()
172 <<
" at position " << patchi <<
endl;
173 oldToNew[patchi] = newPatchi++;
190 const bool flipFaceFlux,
191 const label newPatchi,
198 if (modifiedFace.
set(facei))
244 const bool internalFacesOnly,
250 bitSet& modifiedFace,
256 forAll(newMasterPatches, i)
258 const label newMasterPatchi = newMasterPatches[i];
259 const label newSlavePatchi = newSlavePatches[i];
264 for (label facei = 0; facei <
mesh.nInternalFaces(); ++facei)
266 const label zoneFacei = fZone.
whichFace(facei);
270 if (!fZone.
flipMap()[zoneFacei])
278 mesh.faceOwner()[facei],
295 mesh.faces()[facei].reverseFace(),
297 mesh.faceNeighbour()[facei],
314 for (label facei = 0; facei <
mesh.nInternalFaces(); ++facei)
316 const label zoneFacei = fZone.
whichFace(facei);
320 if (!fZone.
flipMap()[zoneFacei])
326 mesh.faces()[facei].reverseFace(),
328 mesh.faceNeighbour()[facei],
344 mesh.faceOwner()[facei],
373 const bool isCoupled =
pp.coupled();
387 else if (isCoupled || !internalFacesOnly)
391 label facei =
pp.start()+i;
393 label zoneFacei = fZone.
whichFace(facei);
397 if (!isCoupled && patchWarned.
insert(patchi))
400 <<
"Found boundary face (patch " <<
pp.name()
401 <<
") in faceZone " << fZone.
name()
402 <<
" to convert to baffle patches "
403 <<
pbm[newMasterPatchi].name() <<
"/"
404 <<
pbm[newSlavePatchi].name() <<
nl
405 <<
" Set internalFacesOnly to true in the"
406 <<
" createBaffles control dictionary if you"
407 <<
" don't wish to convert boundary faces."
416 mesh.faceOwner()[facei],
435int main(
int argc,
char *argv[])
439 "Makes internal faces into boundary faces.\n"
440 "Does not duplicate points."
454 const bool overwrite =
args.found(
"overwrite");
456 const word oldInstance =
mesh.pointsInstance();
461 bool internalFacesOnly(
false);
463 bool noFields(
false);
470 internalFacesOnly =
dict.get<
bool>(
"internalFacesOnly");
471 noFields =
dict.getOrDefault(
"noFields",
false);
478 for (
const entry& dEntry : selectionsDict)
492 selectors.
resize(nselect);
496 if (internalFacesOnly)
498 Info<<
"Not converting faces on non-coupled patches." <<
nl <<
endl;
506 Info<<
"Reading geometric fields" <<
nl <<
endl;
549 if (
mesh.faceZones().findZoneID(
name) == -1)
551 mesh.faceZones().clearAddressing();
552 const label zoneID =
mesh.faceZones().size();
554 mesh.faceZones().emplace_back(
name, zoneID,
mesh.faceZones());
568 const label zoneID =
mesh.faceZones().findZoneID(
name);
570 selector.select(zoneID, faceToZoneID, faceToFlip);
575 for (
const label zoneID : faceToZoneID)
586 const label zoneID =
mesh.faceZones().findZoneID(
name);
588 label&
n = nFaces[zoneID];
592 forAll(faceToZoneID, facei)
594 label
zone = faceToZoneID[facei];
598 flip[
n] = faceToFlip[facei];
604 <<
" at index " << zoneID
630 const word& groupName = selector.name();
635 for (
const entry& dEntry : *patchesDictPtr)
637 const word patchName(dEntry.dict().get<
word>(
"name"));
639 bafflePatches.
insert(patchName);
644 const word masterName(groupName +
"_master");
645 bafflePatches.
insert(masterName);
647 const word slaveName(groupName +
"_slave");
648 bafflePatches.
insert(slaveName);
676 const word& groupName = selector.name();
681 for (
const entry& dEntry : *patchesDictPtr)
687 if (
pbm.findPatchID(patchName) == -1)
690 patchDict.
set(
"nFaces", 0);
691 patchDict.
set(
"startFace", 0);
698 addPatch(
mesh, patchName, groupName, patchDict);
702 Info<<
"Patch '" << patchName
703 <<
"' already exists. Only "
704 <<
"moving patch faces - type will remain the same"
712 const word masterName(groupName +
"_master");
713 const word slaveName(groupName +
"_slave");
715 word groupNameMaster = groupName;
716 word groupNameSlave = groupName;
720 patchDictMaster.set(
"nFaces", 0);
721 patchDictMaster.set(
"startFace", 0);
722 patchDictMaster.set(
"coupleGroup", groupName);
730 const bool sameGroup =
735 groupNameMaster = groupName +
"Group_master";
736 groupNameSlave = groupName +
"Group_slave";
737 patchDictMaster.set(
"coupleGroup", groupNameMaster);
738 patchDictSlave.set(
"coupleGroup", groupNameSlave);
741 addPatch(
mesh, masterName, groupNameMaster, patchDictMaster);
742 addPatch(
mesh, slaveName, groupNameSlave, patchDictSlave);
749 mesh.boundaryMesh().checkParallelSync(
true);
750 mesh.faceZones().checkParallelSync(
true);
768 bitSet modifiedFace(
mesh.nFaces());
773 const word& groupName = selector.name();
777 const label zoneID =
mesh.faceZones().findZoneID(groupName);
787 for (
const entry& dEntry : *patchesDictPtr)
789 const word patchName(dEntry.dict().get<
word>(
"name"));
791 const label patchi =
pbm.findPatchID(patchName);
806 const word masterName(groupName +
"_master");
807 newMasterPatches.
push_back(
pbm.findPatchID(masterName));
809 const word slaveName(groupName +
"_slave");
829 <<
" faces into boundary faces in patches "
841 mesh.updateMesh(map());
848 bool hasWarned =
false;
850 for (
const word& patchName : bafflePatches)
852 label patchi =
mesh.boundaryMesh().findPatchID(patchName);
862 <<
"Setting field on boundary faces to zero." <<
endl
863 <<
"You might have to edit these fields." <<
endl;
880 const word& groupName = selector.name();
885 for (
const entry& dEntry : *patchesDictPtr)
889 const label patchi =
pbm.findPatchID(patchName);
892 =
dict.findDict(
"patchFields");
894 if (patchFieldsDictPtr)
896 fvMeshTools::setPatchFields
909 const bool sameGroup =
913 = patchSource.
findDict(
"patchFields");
915 if (patchFieldsDictPtr)
920 dictionary patchFieldsDict(*patchFieldsDictPtr);
923 for (
entry& dEntry : patchFieldsDict)
928 dict.set(
"coupleGroup", groupName);
935 :
pbm.groupPatchIDs()[groupName]
938 fvMeshTools::setPatchFields
948 const word masterPatchName(groupName +
"_master");
949 const word slavePatchName(groupName +
"_slave");
951 label patchiMaster =
pbm.findPatchID(masterPatchName);
952 label patchiSlave =
pbm.findPatchID(slavePatchName);
954 fvMeshTools::setPatchFields
961 fvMeshTools::setPatchFields
975 if (map().hasMotionPoints())
977 mesh.movePoints(map().preMotionPoints());
982 filterPatches(
mesh, bafflePatches);
987 mesh.setInstance(oldInstance);
Field reading functions for post-processing utilities.
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
const polyBoundaryMesh & pbm
label size() const noexcept
The number of elements in list.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
void push_back(const T &val)
Copy append an element to the end of this list.
bool insert(const Key &key)
Insert a new entry, not overwriting existing entries.
List< Key > sortedToc() const
The table of contents (the keys) in sorted order.
bool contains(const Key &key) const
True if hashed key is contained (found) in table.
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
List of IOobjects with searching and retrieving facilities. Implemented as a HashTable,...
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
const T * set(const label i) const
Return const pointer to element (can be nullptr), or nullptr for out-of-range access (ie,...
void resize(const label newLen)
Adjust size of PtrList.
static void noFunctionObjects(bool addWithOption=false)
Remove '-noFunctionObjects' option and ignore any occurrences.
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.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
void set(const bitSet &bitset)
Set specified bits from another bitset.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
const dictionary * findDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a sub-dictionary pointer if present (and it is a dictionary) otherwise return nullptr...
T getOrDefault(const word &keyword, const T &deflt, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a T, or return the given default value. FatalIOError if it is found and the number of...
entry * set(entry *entryPtr)
Assign a new entry, overwriting any existing entry.
A keyword and a list of tokens is an 'entry'.
Face selection method for createBaffles.
static autoPtr< faceSelection > New(const word &name, const fvMesh &mesh, const dictionary &dict)
Return a reference to the selected faceSelection.
A subset of mesh faces organised as a primitive patch.
label whichFace(const label meshFaceID) const
The local index of the given mesh face, -1 if not in the zone.
const boolList & flipMap() const noexcept
Return face flip map.
A face is a list of labels corresponding to mesh vertices.
Class holds all the necessary information for mapping fields associated with fvMesh.
Mesh data needed to do the Finite Volume discretisation.
static const word & calculatedType() noexcept
The type name for calculated patch fields.
Mapping class for a fvPatchField.
virtual label sizeBeforeMapping() const
Return size of field before mapping.
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 registered IO, a reference to the associated polyMesh,...
Class describing modification of a face.
A patch is a list of labels that address the faces in the global face list.
static autoPtr< polyPatch > New(const word &patchType, const word &name, const label size, const label start, const label index, const polyBoundaryMesh &bm)
Return pointer to a new patch created on freestore from components.
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.
static void removeFiles(const polyMesh &mesh)
Helper: remove all procAddressing files from mesh instance.
static void removeFiles(const polyMesh &)
Helper: remove all sets files from mesh instance.
A class for handling words, derived from Foam::string.
label index() const noexcept
The index of this zone in the zone list.
const word & name() const noexcept
The zone name.
Base class for mesh zones.
const word dictName("faMeshDefinition")
return returnReduce(nRefine-oldNRefine, sumOp< label >())
#define WarningInFunction
Report a warning using Foam::Warning.
wordList ReadFields(const typename GeoMesh::Mesh &mesh, const IOobjectList &objects, PtrList< GeometricField< Type, PatchField, GeoMesh > > &fields, const bool syncPar=true, const bool readOldTime=false)
Read Geometric fields of templated type.
bool returnReduceOr(const bool value, const int communicator=UPstream::worldComm)
Perform logical (or) MPI Allreduce on a copy. Uses UPstream::reduceOr.
HashSet< word, Hash< word > > wordHashSet
A HashSet of words, uses string hasher.
List< label > labelList
A List of labels.
HashSet< label, Hash< label > > labelHashSet
A HashSet of labels, uses label hasher.
messageStream Info
Information stream (stdout output on master, null elsewhere).
Ostream & incrIndent(Ostream &os)
Increment the indent level.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Ostream & indent(Ostream &os)
Indent stream.
const Type * isA(const U &obj)
Attempt dynamic_cast to Type.
List< bool > boolList
A List of bools.
static constexpr const zero Zero
Global zero (0).
UList< label > labelUList
A UList of labels.
Ostream & decrIndent(Ostream &os)
Decrement the indent level.
constexpr char nl
The newline '\n' character (0x0a).
Foam::argList args(argc, argv)
#define forAll(list, i)
Loop across all elements in list.