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++;
194 const bool flipFaceFlux,
195 const label newPatchi,
202 if (modifiedFace.
set(facei))
248 const bool internalFacesOnly,
260 forAll(newMasterPatches, i)
267 label zoneFacei = fZone.
whichFace(facei);
271 if (!fZone.
flipMap()[zoneFacei])
317 label zoneFacei = fZone.
whichFace(facei);
321 if (!fZone.
flipMap()[zoneFacei])
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." 440 int main(
int argc,
char *argv[])
444 "Makes internal faces into boundary faces.\n" 445 "Does not duplicate points." 459 const bool overwrite =
args.
found(
"overwrite");
466 bool internalFacesOnly(
false);
468 bool noFields(
false);
475 internalFacesOnly =
dict.
get<
bool>(
"internalFacesOnly");
480 selectors.
resize(selectionsDict.size());
483 for (
const entry& dEntry : selectionsDict)
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();
575 forAll(selectors, selectorI)
577 const word&
name = selectors[selectorI].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();
599 label&
n = nFaces[zoneID];
603 forAll(faceToZoneID, facei)
605 label
zone = faceToZoneID[facei];
609 flip[
n] = faceToFlip[facei];
615 <<
" at index " << zoneID
638 forAll(selectors, selectorI)
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();
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);
779 forAll(selectors, selectorI)
781 const word&
name = selectors[selectorI].name();
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 " 855 bool hasWarned =
false;
857 for (
const word& patchName : bafflePatches)
869 <<
"Setting field on boundary faces to zero." <<
endl 870 <<
"You might have to edit these fields." <<
endl;
884 forAll(selectors, selectorI)
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())
991 filterPatches(
mesh, bafflePatches);
label findPatchID(const word &patchName, const bool allowNotFound=true) const
Find patch index given a name, return -1 if not found.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
bool checkParallelSync(const bool report=false) const
Check whether all procs have all zones and in same order.
virtual label sizeBeforeMapping() const
Return size of field before mapping.
static void noFunctionObjects(bool addWithOption=false)
Remove '-noFunctionObjects' option and ignore any occurrences.
static void addNote(const string ¬e)
Add extra notes for the usage information.
static void removeFiles(const polyMesh &mesh)
Helper: remove all procAddressing files from mesh instance.
void clearAddressing()
Clear addressing.
void set(const bitSet &bitset)
Set specified bits from another bitset.
Ostream & indent(Ostream &os)
Indent stream.
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.
List of IOobjects with searching and retrieving facilities. Implemented as a HashTable, so the various sorted methods should be used if traversing in parallel.
Class describing modification of a face.
A face is a list of labels corresponding to mesh vertices.
A list of keyword definitions, which are a keyword followed by a number of values (eg...
bool found(const Key &key) const
True if hashed key is found in table.
virtual const labelList & faceNeighbour() const
Return face neighbour.
const word & name() const noexcept
Return the object name.
virtual bool write(const bool valid=true) const
Write mesh using IO settings from time.
constexpr char nl
The newline '\n' character (0x0a)
const wordList & inGroups() const noexcept
The (optional) groups that the patch belongs to.
const word dictName("faMeshDefinition")
Ostream & endl(Ostream &os)
Add newline and flush stream.
label appendUniq(const T &val)
Append an element if not already in the list.
virtual void movePoints(const pointField &)
Move points, returns volumes swept by faces in motion.
label whichFace(const label globalCellID) const
Helper function to re-direct to zone::localID(...)
Field reading functions for post-processing utilities.
T get(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a T. FatalIOError if not found, or if the number of tokens is incorrect.
label nFaces() const noexcept
Number of mesh faces.
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.
bool insert(const Key &key)
Insert a new entry, not overwriting existing entries.
T returnReduce(const T &value, const BinaryOp &bop, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
Perform reduction on a copy, using specified binary operation.
Class holds all the necessary information for mapping fields associated with fvMesh.
const dictionary & subDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a sub-dictionary.
A face addition data class. A face can be inflated either from a point or from another face and can e...
bool found(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find an entry (const access) with the given keyword.
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
#define forAll(list, i)
Loop across all elements in list.
static void removeFiles(const polyMesh &)
Helper: remove all sets files from mesh instance.
const fileName & pointsInstance() const
Return the current instance directory for points.
virtual void updateMesh(const mapPolyMesh &mpm)
Update mesh corresponding to the given map.
virtual bool coupled() const
Return true if this patch is geometrically coupled (i.e. faces and.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
label findZoneID(const word &zoneName) const
Find zone index by name, return -1 if not found.
Base class for mesh zones.
A class for handling words, derived from Foam::string.
label size() const noexcept
The number of elements in the list.
This boundary condition is not designed to be evaluated; it is assmued that the value is assigned via...
virtual const labelList & faceOwner() const
Return face owner.
static void addOption(const word &optName, const string ¶m="", const string &usage="", bool advanced=false)
Add an option to validOptions with usage information.
label nInternalFaces() const noexcept
Number of internal faces.
void append(const T &val)
Copy append an element to the end of this list.
virtual const faceList & faces() const
Return raw faces.
const HashTable< labelList > & groupPatchIDs() const
The patch indices per patch group.
const T * set(const label i) const
Return const pointer to element (can be nullptr), or nullptr for out-of-range access (ie...
A polyBoundaryMesh is a polyPatch list with additional search methods and registered IO...
const word & name() const noexcept
The patch name.
label index() const noexcept
The index of this zone in the zone list.
bool checkParallelSync(const bool report=false) const
Check whether all procs have all patches and in same order.
static word timeName(const scalar t, const int precision=precision_)
Return time name of given scalar time formatted with the given precision.
const faceZoneMesh & faceZones() const noexcept
Return face zone mesh.
Ostream & decrIndent(Ostream &os)
Decrement the indent level.
void setSize(const label newLen)
Same as resize()
void resize(const label newLen)
Adjust size of PtrList.
static autoPtr< faceSelection > New(const word &name, const fvMesh &mesh, const dictionary &dict)
Return a reference to the selected faceSelection.
void setInstance(const fileName &instance, const IOobjectOption::writeOption wOpt=IOobject::AUTO_WRITE)
Set the instance for mesh files.
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
#define WarningInFunction
Report a warning using Foam::Warning.
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers...
Mesh data needed to do the Finite Volume discretisation.
List< Key > sortedToc() const
The table of contents (the keys) in sorted order.
Direct mesh changes based on v1.3 polyTopoChange syntax.
label start() const
Return start label of this patch in the polyMesh face list.
const word & name() const noexcept
The zone name.
const boolList & flipMap() const noexcept
Return face flip map.
messageStream Info
Information stream (stdout output on master, null elsewhere)
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.
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
entry * set(entry *entryPtr)
Assign a new entry, overwriting any existing entry.
A subset of mesh faces organised as a primitive patch.
Mapping class for a fvPatchField.
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...
List< label > labelList
A List of labels.
A patch is a list of labels that address the faces in the global face list.
Foam::argList args(argc, argv)
bool returnReduceOr(const bool value, const label comm=UPstream::worldComm)
Perform logical (or) MPI Allreduce on a copy. Uses UPstream::reduceOr.
Ostream & incrIndent(Ostream &os)
Increment the indent level.
bool found(const word &optName) const
Return true if the named option is found.
A keyword and a list of tokens is an 'entry'.
label setAction(const topoAction &action)
For compatibility with polyTopoChange: set topological action.
static constexpr const zero Zero
Global zero (0)