70 const word& patchName,
71 const word& groupName,
90 pp.addGroup(groupName);
105 Info<<
"Patch '" << patchName
106 <<
"' already exists. Only " 107 <<
"moving patch faces - type will remain the same" 132 if (!isA<processorPolyPatch>(
pp))
136 isA<coupledPolyPatch>(
pp)
142 oldToNew[patchi] = newPatchi++;
151 if (isA<processorPolyPatch>(
pp))
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,
256 forAll(newMasterPatches, i)
258 const label newMasterPatchi = newMasterPatches[i];
259 const label newSlavePatchi = newSlavePatches[i];
266 const label zoneFacei = fZone.
whichFace(facei);
270 if (!fZone.
flipMap()[zoneFacei])
316 const label zoneFacei = fZone.
whichFace(facei);
320 if (!fZone.
flipMap()[zoneFacei])
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() <<
"/" 405 <<
" Set internalFacesOnly to true in the" 406 <<
" createBaffles control dictionary if you" 407 <<
" don't wish to convert boundary faces." 435 int 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");
461 bool internalFacesOnly(
false);
463 bool noFields(
false);
470 internalFacesOnly =
dict.
get<
bool>(
"internalFacesOnly");
475 selectors.
resize(selectionsDict.size());
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;
570 selector.select(zoneID, faceToZoneID, faceToFlip);
575 for (
const label zoneID : faceToZoneID)
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)
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);
773 const word& groupName = selector.name();
787 for (
const entry& dEntry : *patchesDictPtr)
789 const word patchName(dEntry.dict().get<
word>(
"name"));
806 const word masterName(groupName +
"_master");
809 const word slaveName(groupName +
"_slave");
829 <<
" faces into boundary faces in patches " 848 bool hasWarned =
false;
850 for (
const word& patchName : bafflePatches)
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)
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);
938 fvMeshTools::setPatchFields
948 const word masterPatchName(groupName +
"_master");
949 const word slavePatchName(groupName +
"_slave");
954 fvMeshTools::setPatchFields
961 fvMeshTools::setPatchFields
975 if (map().hasMotionPoints())
982 filterPatches(
mesh, bafflePatches);
label findPatchID(const word &patchName, const bool allowNotFound=true) const
Find patch index given a name, return -1 if not found.
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.
const polyBoundaryMesh & pbm
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...
virtual const labelList & faceNeighbour() const
Return face neighbour.
const word & name() const noexcept
Return the object name.
constexpr char nl
The newline '\n' character (0x0a)
const word dictName("faMeshDefinition")
Ostream & endl(Ostream &os)
Add newline and flush stream.
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.
T & emplace_back(Args &&... args)
Construct and append an element to the end of the list, return reference to the new list element...
A face addition data class. A face can be inflated either from a point or from another face and can e...
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.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
bool contains(const Key &key) const
True if hashed key is contained (found) in table.
label findZoneID(const word &zoneName) const
Find zone index by name, return -1 if not found.
Base class for mesh zones.
const polyBoundaryMesh & boundaryMesh() const noexcept
Return boundary mesh.
A class for handling words, derived from Foam::string.
label size() const noexcept
The number of entries in the list.
Face selection method for createBaffles.
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.
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...
virtual bool write(const bool writeOnProc=true) const
Write mesh using IO settings from time.
A polyBoundaryMesh is a polyPatch list with additional search methods and registered IO...
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 a time name for the given scalar time value formatted with the given precision.
const faceZoneMesh & faceZones() const noexcept
Return face zone mesh.
Ostream & decrIndent(Ostream &os)
Decrement the indent level.
void push_back(const T &val)
Copy append an element to the end of this list.
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.
const word & name() const noexcept
The zone name.
static const word & calculatedType() noexcept
The type name for calculated patch fields.
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...
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.
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
A keyword and a list of tokens is an 'entry'.
label setAction(const topoAction &action)
For compatibility with polyTopoChange: set topological action.
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...
static constexpr const zero Zero
Global zero (0)