70 const word& patchName,
71 const word& groupName,
91 if (!groupName.empty())
109 Info<<
"Patch '" << patchName
110 <<
"' already exists. Only "
111 <<
"moving patch faces - type will remain the same"
136 if (!isA<processorPolyPatch>(pp))
140 isA<coupledPolyPatch>(pp)
146 oldToNew[patchi] = newPatchi++;
155 if (isA<processorPolyPatch>(pp))
157 oldToNew[patchi] = newPatchi++;
162 const label nKeepPatches = newPatchi;
165 if (nKeepPatches != pbm.
size())
172 if (oldToNew[patchi] == -1)
175 <<
" type " << pbm[patchi].type()
176 <<
" at position " << patchi <<
endl;
177 oldToNew[patchi] = newPatchi++;
182 fvMeshTools::reorderPatches(
mesh, oldToNew, nKeepPatches,
true);
194 const bool flipFaceFlux,
195 const label newPatchi,
202 if (modifiedFace.
set(facei))
248 const bool internalFacesOnly,
260 forAll(newMasterPatches, i)
265 for (label facei = 0; facei <
mesh.nInternalFaces(); facei++)
267 label zoneFacei = fZone.
whichFace(facei);
271 if (!fZone.
flipMap()[zoneFacei])
279 mesh.faceOwner()[facei],
296 mesh.faces()[facei].reverseFace(),
298 mesh.faceNeighbour()[facei],
315 for (label facei = 0; facei <
mesh.nInternalFaces(); facei++)
317 label zoneFacei = fZone.
whichFace(facei);
321 if (!fZone.
flipMap()[zoneFacei])
327 mesh.faces()[facei].reverseFace(),
329 mesh.faceNeighbour()[facei],
345 mesh.faceOwner()[facei],
375 const label newMasterPatchi = newMasterPatches[i];
376 const label newSlavePatchi = newSlavePatches[i];
382 pbm[newMasterPatchi].coupled()
383 || pbm[newSlavePatchi].coupled()
390 else if (pp.
coupled() || !internalFacesOnly)
394 label facei = pp.
start()+i;
396 label zoneFacei = fZone.
whichFace(facei);
400 if (patchWarned.
insert(patchi))
403 <<
"Found boundary face (in patch "
405 <<
") in faceZone " << fZone.
name()
406 <<
" to convert to baffle patches "
407 << pbm[newMasterPatchi].
name() <<
"/"
408 << pbm[newSlavePatchi].
name()
410 <<
" Set internalFacesOnly to true in the"
411 <<
" createBaffles control dictionary if you"
412 <<
" don't wish to convert boundary faces."
421 mesh.faceOwner()[facei],
440int main(
int argc,
char *argv[])
444 "Makes internal faces into boundary faces.\n"
445 "Does not duplicate points."
448 argList::addOption(
"dict",
"file",
"Alternative createBafflesDict");
452 argList::noFunctionObjects();
459 const bool overwrite =
args.
found(
"overwrite");
461 const word oldInstance =
mesh.pointsInstance();
466 bool internalFacesOnly(
false);
468 bool noFields(
false);
475 internalFacesOnly =
dict.get<
bool>(
"internalFacesOnly");
476 noFields =
dict.getOrDefault(
"noFields",
false);
480 selectors.
resize(selectionsDict.size());
483 for (
const entry& dEntry : selectionsDict)
490 faceSelection::New(dEntry.keyword(),
mesh, dEntry.dict())
497 selectors.
resize(nselect);
501 if (internalFacesOnly)
503 Info<<
"Not converting faces on non-coupled patches." <<
nl <<
endl;
511 Info<<
"Reading geometric fields" <<
nl <<
endl;
550 forAll(selectors, selectorI)
552 const word&
name = selectors[selectorI].name();
554 if (
mesh.faceZones().findZoneID(name) == -1)
556 mesh.faceZones().clearAddressing();
575 forAll(selectors, selectorI)
577 const word&
name = selectors[selectorI].name();
578 label
zoneID =
mesh.faceZones().findZoneID(name);
580 selectors[selectorI].select(
zoneID, faceToZoneID, faceToFlip);
585 forAll(faceToZoneID, facei)
587 label
zoneID = faceToZoneID[facei];
594 forAll(selectors, selectorI)
596 const word&
name = selectors[selectorI].name();
597 label
zoneID =
mesh.faceZones().findZoneID(name);
603 forAll(faceToZoneID, facei)
605 label
zone = faceToZoneID[facei];
609 flip[
n] = faceToFlip[facei];
638 forAll(selectors, selectorI)
642 if (
dict.found(
"patches"))
644 for (
const entry& dEntry :
dict.subDict(
"patches"))
646 const word patchName(dEntry.dict().get<
word>(
"name"));
648 bafflePatches.
insert(patchName);
653 const word masterName = selectors[selectorI].name() +
"_master";
654 bafflePatches.
insert(masterName);
656 const word slaveName = selectors[selectorI].name() +
"_slave";
657 bafflePatches.
insert(slaveName);
682 forAll(selectors, selectorI)
685 const word& groupName = selectors[selectorI].name();
687 if (
dict.found(
"patches"))
689 for (
const entry& dEntry :
dict.subDict(
"patches"))
698 patchDict.
set(
"nFaces", 0);
699 patchDict.
set(
"startFace", 0);
706 addPatch(
mesh, patchName, groupName, patchDict);
710 Info<<
"Patch '" << patchName
711 <<
"' already exists. Only "
712 <<
"moving patch faces - type will remain the same"
720 const word masterName = groupName +
"_master";
721 const word slaveName = groupName +
"_slave";
723 word groupNameMaster = groupName;
724 word groupNameSlave = groupName;
728 patchDictMaster.set(
"nFaces", 0);
729 patchDictMaster.set(
"startFace", 0);
730 patchDictMaster.set(
"coupleGroup", groupName);
738 const bool sameGroup =
743 groupNameMaster = groupName +
"Group_master";
744 groupNameSlave = groupName +
"Group_slave";
745 patchDictMaster.set(
"coupleGroup", groupNameMaster);
746 patchDictSlave.set(
"coupleGroup", groupNameSlave);
749 addPatch(
mesh, masterName, groupNameMaster, patchDictMaster);
750 addPatch(
mesh, slaveName, groupNameSlave, patchDictSlave);
757 mesh.boundaryMesh().checkParallelSync(
true);
758 mesh.faceZones().checkParallelSync(
true);
779 forAll(selectors, selectorI)
781 const word&
name = selectors[selectorI].name();
782 label
zoneID =
mesh.faceZones().findZoneID(name);
790 if (
dict.found(
"patches"))
794 for (
const entry& dEntry :
dict.subDict(
"patches"))
796 const word patchName(dEntry.dict().get<
word>(
"name"));
802 newMasterPatches.
append(patchi);
806 newSlavePatches.
append(patchi);
813 const word masterName = selectors[selectorI].name() +
"_master";
816 const word slaveName = selectors[selectorI].name() +
"_slave";
836 <<
" faces into boundary faces in patches "
848 mesh.updateMesh(map());
855 bool hasWarned =
false;
857 for (
const word& patchName : bafflePatches)
859 label patchi =
mesh.boundaryMesh().findPatchID(patchName);
869 <<
"Setting field on boundary faces to zero." <<
endl
870 <<
"You might have to edit these fields." <<
endl;
873 fvMeshTools::zeroPatchFields(
mesh, patchi);
884 forAll(selectors, selectorI)
887 if (
dict.found(
"patches"))
889 for (
const entry& dEntry :
dict.subDict(
"patches"))
897 if (dEntry.dict().found(
"patchFields"))
905 fvMeshTools::setPatchFields
918 const bool sameGroup =
921 const word& groupName = selectors[selectorI].name();
923 if (patchSource.
found(
"patchFields"))
933 for (
entry& dEntry : patchFieldsDict)
938 dict.set(
"coupleGroup", groupName);
947 fvMeshTools::setPatchFields
957 const word masterPatchName(groupName +
"_master");
958 const word slavePatchName(groupName +
"_slave");
960 label patchiMaster = pbm.
findPatchID(masterPatchName);
961 label patchiSlave = pbm.
findPatchID(slavePatchName);
963 fvMeshTools::setPatchFields
970 fvMeshTools::setPatchFields
984 if (map().hasMotionPoints())
986 mesh.movePoints(map().preMotionPoints());
991 filterPatches(
mesh, bafflePatches);
996 mesh.setInstance(oldInstance);
1002 topoSet::removeFiles(
mesh);
1003 processorMeshes::removeFiles(
mesh);
Field reading functions for post-processing utilities.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
void append(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 found(const Key &key) const
Return true if hashed entry is 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.
const word & name() const noexcept
Return the object name.
label appendUniq(const T &val)
Append an element if not already in the list.
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.
label size() const noexcept
The number of elements in the list.
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.
This boundary condition is not designed to be evaluated; it is assmued that the value is assigned via...
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
const dictionary & subDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a sub-dictionary.
T getOrDefault(const word &keyword, const T &deflt, enum keyType::option matchOpt=keyType::REGEX) const
bool found(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Search for an entry (const access) with the given keyword.
entry * set(entry *entryPtr)
Assign a new entry, overwriting any existing entry.
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.
Class holds all the necessary information for mapping fields associated with fvMesh.
Mesh data needed to do the Finite Volume discretisation.
Mapping class for a fvPatchField.
virtual label sizeBeforeMapping() const
Return size of field before mapping.
const wordList & inGroups() const noexcept
The (optional) groups that the patch belongs to.
const word & name() const noexcept
The patch name.
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 HashTable< labelList > & groupPatchIDs() const
The patch indices per patch group.
label findPatchID(const word &patchName, const bool allowNotFound=true) const
Find patch index given a name, return -1 if not found.
Class describing modification of a face.
A patch is a list of labels that address the faces in the global face list.
virtual bool coupled() const
Return true if this patch is geometrically coupled (i.e. faces and.
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.
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")
const labelList nFaces(UPstream::listGatherValues< label >(aMesh.nFaces()))
const labelIOList & zoneID
#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.
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.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
T returnReduce(const T &value, const BinaryOp &bop, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
Reduce (copy) and return value.
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.