70 const word& patchName,
71 const word& groupName,
91 if (!groupName.empty())
93 pp.inGroups().appendUniq(groupName);
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)
262 const label newMasterPatchi = newMasterPatches[i];
263 const label newSlavePatchi = newSlavePatches[i];
270 const label zoneFacei = fZone.
whichFace(facei);
274 if (!fZone.
flipMap()[zoneFacei])
320 const label zoneFacei = fZone.
whichFace(facei);
324 if (!fZone.
flipMap()[zoneFacei])
377 const bool isCoupled =
pp.coupled();
391 else if (isCoupled || !internalFacesOnly)
395 label facei =
pp.start()+i;
397 label zoneFacei = fZone.
whichFace(facei);
401 if (!isCoupled && patchWarned.
insert(patchi))
404 <<
"Found boundary face (patch " <<
pp.name()
405 <<
") in faceZone " << fZone.
name()
406 <<
" to convert to baffle patches " 407 <<
pbm[newMasterPatchi].
name() <<
"/" 409 <<
" Set internalFacesOnly to true in the" 410 <<
" createBaffles control dictionary if you" 411 <<
" don't wish to convert boundary faces." 439 int main(
int argc,
char *argv[])
443 "Makes internal faces into boundary faces.\n" 444 "Does not duplicate points." 458 const bool overwrite =
args.
found(
"overwrite");
465 bool internalFacesOnly(
false);
467 bool noFields(
false);
474 internalFacesOnly =
dict.
get<
bool>(
"internalFacesOnly");
479 selectors.
resize(selectionsDict.size());
482 for (
const entry& dEntry : selectionsDict)
496 selectors.
resize(nselect);
500 if (internalFacesOnly)
502 Info<<
"Not converting faces on non-coupled patches." <<
nl <<
endl;
510 Info<<
"Reading geometric fields" <<
nl <<
endl;
574 selector.select(zoneID, faceToZoneID, faceToFlip);
579 for (
const label zoneID : faceToZoneID)
592 label&
n = nFaces[zoneID];
596 forAll(faceToZoneID, facei)
598 label
zone = faceToZoneID[facei];
602 flip[
n] = faceToFlip[facei];
608 <<
" at index " << zoneID
634 const word& groupName = selector.name();
639 for (
const entry& dEntry : *patchesDictPtr)
641 const word patchName(dEntry.dict().get<
word>(
"name"));
643 bafflePatches.
insert(patchName);
648 const word masterName(groupName +
"_master");
649 bafflePatches.
insert(masterName);
651 const word slaveName(groupName +
"_slave");
652 bafflePatches.
insert(slaveName);
680 const word& groupName = selector.name();
685 for (
const entry& dEntry : *patchesDictPtr)
694 patchDict.
set(
"nFaces", 0);
695 patchDict.
set(
"startFace", 0);
702 addPatch(
mesh, patchName, groupName, patchDict);
706 Info<<
"Patch '" << patchName
707 <<
"' already exists. Only " 708 <<
"moving patch faces - type will remain the same" 716 const word masterName(groupName +
"_master");
717 const word slaveName(groupName +
"_slave");
719 word groupNameMaster = groupName;
720 word groupNameSlave = groupName;
724 patchDictMaster.set(
"nFaces", 0);
725 patchDictMaster.set(
"startFace", 0);
726 patchDictMaster.set(
"coupleGroup", groupName);
734 const bool sameGroup =
739 groupNameMaster = groupName +
"Group_master";
740 groupNameSlave = groupName +
"Group_slave";
741 patchDictMaster.set(
"coupleGroup", groupNameMaster);
742 patchDictSlave.set(
"coupleGroup", groupNameSlave);
745 addPatch(
mesh, masterName, groupNameMaster, patchDictMaster);
746 addPatch(
mesh, slaveName, groupNameSlave, patchDictSlave);
777 const word& groupName = selector.name();
791 for (
const entry& dEntry : *patchesDictPtr)
793 const word patchName(dEntry.dict().get<
word>(
"name"));
810 const word masterName(groupName +
"_master");
813 const word slaveName(groupName +
"_slave");
833 <<
" faces into boundary faces in patches " 852 bool hasWarned =
false;
854 for (
const word& patchName : bafflePatches)
866 <<
"Setting field on boundary faces to zero." <<
endl 867 <<
"You might have to edit these fields." <<
endl;
884 const word& groupName = selector.name();
889 for (
const entry& dEntry : *patchesDictPtr)
898 if (patchFieldsDictPtr)
900 fvMeshTools::setPatchFields
913 const bool sameGroup =
917 = patchSource.
findDict(
"patchFields");
919 if (patchFieldsDictPtr)
924 dictionary patchFieldsDict(*patchFieldsDictPtr);
927 for (
entry& dEntry : patchFieldsDict)
932 dict.
set(
"coupleGroup", groupName);
942 fvMeshTools::setPatchFields
952 const word masterPatchName(groupName +
"_master");
953 const word slavePatchName(groupName +
"_slave");
958 fvMeshTools::setPatchFields
965 fvMeshTools::setPatchFields
979 if (map().hasMotionPoints())
986 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)
bool coupled(solutionDict.getOrDefault("coupledEnergyField", false))
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 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 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 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 a sub-dictionary) otherwise return nullptr...
static constexpr const zero Zero
Global zero (0)