95 struct nonConformalCouple
123 const word& primaryRegionName,
132 ncPatchType +
"_on_" +
args[1],
133 ncPatchType +
"_on_" +
args[2]
143 const word& primaryRegionName,
147 const bool haveRegion =
dict.
found(
"region");
148 const bool haveRegions =
dict.
found(
"regions");
150 if (haveRegion && haveRegions)
153 <<
"Regions should be specified either by a \"region\" "
154 <<
"entry with a single region name (for in-region "
155 <<
"cyclics), or by a \"regions\" entry with a pair of "
156 <<
"names (for inter-region mapped walls)"
160 const bool havePatches =
dict.
found(
"patches");
161 const bool haveOwnerNeighbour =
164 if (havePatches == haveOwnerNeighbour)
167 <<
"Patches should be specified with either a single "
168 <<
"\"patches\" entry with a pair of patch names, "
169 <<
"or with two sub-dictionaries named \"owner\" and "
175 const word thisRegionName =
179 haveRegion ?
Pair<word>(thisRegionName, thisRegionName)
181 :
Pair<
word>(primaryRegionName, primaryRegionName);
204 ncPatchDicts[i] =
dict;
205 ncPatchDicts[i].remove(
"region");
206 ncPatchDicts[i].remove(
"regions");
207 ncPatchDicts[i].remove(
"patches");
208 ncPatchDicts[i].remove(
"type");
209 ncPatchDicts[i].remove(
"names");
262 ncPatchDicts[0] = ownerDict;
263 ncPatchDicts[1] = neighbourDict;
266 ncPatchDicts[i].remove(
"region");
267 ncPatchDicts[i].remove(
"patch");
268 ncPatchDicts[i].remove(
"name");
269 ncPatchDicts[i].remove(
"patchFields");
286 void evaluateNonConformalProcessorCyclics(
const fvMesh&
mesh)
299 if (isA<nonConformalProcessorCyclicPolyPatch>(pf.patch().poly()))
319 if (isA<nonConformalProcessorCyclicPolyPatch>(pf.patch().poly()))
330 int main(
int argc,
char *argv[])
345 "add non-conformal boundary conditions to the fields"
365 couples.
append(nonConformalCouple(primaryRegionName,
args));
373 "createNonConformalCouplesDict",
387 if (!iter().isDict())
continue;
391 const bool havePatches = subDict.
found(
"patches");
392 const bool haveOwnerNeighbour =
393 subDict.
found(
"owner") || subDict.
found(
"neighbour");
395 if (havePatches == haveOwnerNeighbour)
398 <<
"Patches should be specified with either a single "
399 <<
"\"patches\" entry with a pair of patch names, "
400 <<
"or with two sub-dictionaries named \"owner\" and "
404 couples.
append(nonConformalCouple(primaryRegionName, subDict));
446 if (regionMeshes.
empty())
456 const word oldInstance = regionMeshes[0].pointsInstance();
461 #define DeclareRegionGeoTypeFields(Type, Geo) \
462 PtrList<PtrList<Geo##Field<Type>>> \
463 CAT4(region, Geo, CAPITALIZE(Type), Fields)(regionMeshes.size()); \
464 forAll(regionMeshes, regioni) \
466 CAT4(region, Geo, CAPITALIZE(Type), Fields).set \
469 new PtrList<Geo##Field<Type>> \
475 #undef DeclareRegionGeoTypeFields
481 forAll(regionMeshes, regioni)
487 #define ReadRegionGeoTypeFields(Type, Geo, mesh) \
492 CAT4(region, Geo, CAPITALIZE(Type), Fields)[regioni] \
498 #undef ReadRegionGeoTypeFields
510 forAll(regionMeshes, regioni)
512 regionMeshes[regioni].conform();
518 forAll(regionMeshes, regioni)
522 label& firstProcPatchi = regionFirstProcPatchis[regioni];
523 label& firstProcFacei = regionFirstProcFaceis[regioni];
532 const bool isProcPp = isA<processorPolyPatch>(pp);
537 firstProcFacei = pp.
start();
540 if (!isProcPp && firstProcPatchi !=
patches.
size())
543 <<
"Processor patches of region " <<
regionNames[regioni]
544 <<
" do not follow boundary patches"
556 forAll(regionMeshes, regioni)
560 const label firstProcPatchi = regionFirstProcPatchis[regioni];
566 newPatches[regioni].
append
576 newPatchIsCouple[regioni].append(
false);
577 newPatchFieldDicts[regioni].append(
dictionary());
584 const nonConformalCouple& couple = couples[couplei];
586 Info<<
indent <<
"Adding " << couple.ncPatchType
594 couple.transform.write(
Info);
597 auto appendPatch = [&](
const bool owner)
599 if (!
regionNames.found(couple.regionNames[!owner]))
return;
601 const label regioni =
606 "type", couple.ncPatchType,
608 "startFace", regionFirstProcFaceis[regioni],
609 "originalPatch", couple.origPatchNames[!owner],
610 "neighbourRegion", couple.regionNames[owner],
611 "neighbourPatch", couple.ncPatchNames[owner],
617 (owner ? couple.transform :
inv(couple.transform)).
write(oss);
621 patchDict.
merge(couple.ncPatchDicts[!owner]);
623 newPatches[regioni].append
627 couple.ncPatchNames[!owner],
629 newPatches[regioni].size(),
630 regionMeshes[regioni].poly().boundary()
633 newPatchIsCouple[regioni].append(
true);
634 newPatchFieldDicts[regioni].append
636 couple.ncPatchFieldDicts[!owner]
651 const nonConformalCouple& couple = couples[couplei];
652 forAll(couple.regionNames, i)
656 couple.regionNames[i],
657 couple.origPatchNames[i]
660 if (!regionOrigPatchToIndex.
found(regionOrigPatch))
662 regionOrigPatchToIndex.
insert
665 regionOrigPatches.
size()
667 regionOrigPatches.
append(regionOrigPatch);
673 forAll(regionOrigPatches, i)
680 const word& origPatchName = regionOrigPatches[i].second();
682 newPatches[regioni].
append
690 regionFirstProcFaceis[regioni],
691 newPatches[regioni].size(),
692 regionMeshes[regioni].poly().
boundary(),
696 newPatchIsCouple[regioni].append(
false);
697 newPatchFieldDicts[regioni].append(
dictionary());
702 forAll(regionMeshes, regioni)
706 const label firstProcPatchi = regionFirstProcPatchis[regioni];
712 newPatches[regioni].
append
717 newPatches[regioni].
size(),
722 newPatchIsCouple[regioni].append(
false);
723 newPatchFieldDicts[regioni].append(
dictionary());
732 const nonConformalCouple& couple = couples[couplei];
737 if (!
regionNames.found(couples[couplei].regionNames[0]))
769 auto appendProcPatches = [&](
const bool owner,
const bool first)
772 owner ? procHasPatch1 : procHasPatch2;
774 owner ? procHasPatch2 : procHasPatch1;
778 forAll(procHasPatchB, proci)
786 && procHasPatchB[proci]
789 newPatches[regioni].append
799 couple.ncPatchNames[!owner],
800 couple.origPatchNames[!owner]
803 newPatchIsCouple[regioni].append(
true);
804 newPatchFieldDicts[regioni].append
806 couple.ncPatchFieldDicts[!owner]
813 appendProcPatches(
true,
true);
814 appendProcPatches(
false,
true);
815 appendProcPatches(
false,
false);
816 appendProcPatches(
true,
false);
825 forAll(regionMeshes, regioni)
827 forAll(newPatches[regioni], newPatchi)
831 regionMeshes[regioni],
832 *newPatches[regioni][newPatchi]
840 forAll(regionMeshes, regioni)
854 forAll(regionMeshes, regioni)
856 forAll(newPatches[regioni], newPatchi)
858 if (newPatchIsCouple[regioni][newPatchi])
860 fvMeshTools::setPatchFields
862 regionMeshes[regioni],
864 newPatchFieldDicts[regioni][newPatchi]
874 forAll(regionMeshes, regioni)
878 #define EVALUATE_NON_CONFORMAL_PROCESSOR_CYCLICS(Type, nullArg) \
879 evaluateNonConformalProcessorCyclics<Type>(mesh);
881 #undef EVALUATE_NON_CONFORMAL_PROCESSOR_CYCLICS
889 const word newInstance =
overwrite ? oldInstance : runTime.name();
890 forAll(regionMeshes, regioni)
892 regionMeshes[regioni].setInstance(newInstance);
893 regionMeshes[regioni].setPolyFacesBfInstance(newInstance);
897 Info<<
"Writing mesh to " << runTime.name() <<
nl <<
endl;
898 forAll(regionMeshes, regioni)
900 regionMeshes[regioni].write();
Field reading functions for post-processing utilities.
#define forAll(list, i)
Loop across all elements in list.
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object of type.
static pointMesh & New(const word &name, const polyMesh &mesh)
Construct and return the named DemandDrivenMeshObject.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
Generic GeometricField class.
GeoMesh::template PatchField< Type > Patch
Type of the patch field of which the Boundary is composed.
An STL-conforming hash table.
bool insert(const Key &, const T &newElmt)
Insert a new hashedEntry.
bool found(const Key &) const
Return true if hashedEntry is found in table.
Hash function class for primitives. All non-primitives used to hash entries on hash tables likely nee...
List of IOobjects with searching and retrieving facilities.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
static unsigned int defaultPrecision()
Return the default precision.
static unsigned int highPrecision()
Return a high precision for writing data that is.
Input from memory buffer stream.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
void append(const T &)
Append an element at the end of the list.
void size(const label)
Override size to be inconsistent with allocated storage.
Output to memory buffer stream.
string str() const
Return the string.
static void scatterList(const List< commsStruct > &comms, List< T > &Values, const int tag, const label comm)
Scatter data. Reverse of gatherList.
static void gatherList(const List< commsStruct > &comms, List< T > &Values, const int tag, const label comm)
Gather data but keep individual values separate.
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
void append(T *)
Append an element at the end of the list.
T & first()
Return the first element of the list.
label size() const
Return the number of elements in the UList.
bool empty() const
Return true if the UList is empty (ie, size() is zero)
static label nRequests()
Get number of outstanding requests.
static label nProcs(const label communicator=0)
Number of processes in parallel run.
static void waitRequests(const label start=0)
Wait until all requests (from start onwards) have finished.
static bool & parRun()
Is this a parallel run?
static commsTypes defaultCommsType
Default commsType.
static int myProcNo(const label communicator=0)
Number of this process (starting from masterNo() = 0)
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
label size() const
Return the number of elements in the UPtrList.
bool empty() const
Return true if the UPtrList is empty (ie, size() is zero)
Extract command arguments and options from the supplied argc and argv parameters.
static label nArgs(int argc, char *argv[])
Return the number of arguments (not options)
static void addBoolOption(const word &opt, const string &usage="")
Add to a bool option to validOptions with usage information.
bool optionFound(const word &opt) const
Return true if the named option is found.
static SLList< string > validArgs
A list of valid (mandatory) arguments.
T optionLookupOrDefault(const word &opt, const T &deflt) const
Read a value from the named option if present.
const word dictName() const
Return the local dictionary name (final part of scoped name)
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
T lookupOrDefault(const word &, const T &) const
Find and return a T, if not found return the given default.
const dictionary & subOrEmptyDict(const word &, const bool mustRead=false) const
Find and return a sub-dictionary.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
const dictionary & optionalSubDict(const word &) const
Find and return a sub-dictionary if found.
const dictionary & subDict(const word &) const
Find and return a sub-dictionary.
bool found(const word &, bool recursive=false, bool patternMatch=true) const
Search dictionary for given keyword.
bool merge(const dictionary &)
Merge entries from the given dictionary.
static std::tuple< const Entries &... > entries(const Entries &...)
Construct an entries tuple from which to make a dictionary.
static const fileName null
An empty fileName.
bool connect(const bool changing, const bool geometric, const bool load)
Connect the mesh by adding faces into the nonConformalCyclics.
Mesh stitcher for stationary meshes.
Mesh data needed to do the Finite Volume discretisation.
const fvBoundaryMesh & boundary() const
Return reference to boundary mesh.
UPtrList< GeoField > fields(bool strict=false, const HashSet< word > &geometryFields=fvMesh::geometryFields) const
Return the list of fields of type GeoField.
const word & name() const
Return reference to name.
const polyMesh & poly() const
Return reference to polyMesh.
A wordList with hashed indices for faster lookup by name.
Mesh representing a set of points created from polyMesh.
static word defaultRegion
Return the default region name.
const polyBoundaryMesh & boundary() const
Return boundary mesh.
static fileName meshDirInstance(const IOobject &io)
Return the instance of the polyMesh directory. Returns.
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 a pointer to a new patch created on freestore from.
label start() const
Return start label of this patch in the polyMesh face list.
virtual autoPtr< polyPatch > clone(const polyBoundaryMesh &bm) const
Construct and return a clone, resetting the boundary mesh.
Read and return the specified dictionary from system or from path provided with the -dict option.
Template function which returns the un-mangled name of a given type. Useful for types which do not ha...
A class for handling words, derived from string.
static const word null
An empty word.
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
int main(int argc, char *argv[])
const fvPatchList & patches
Info<< "Calculating turbulent flame speed field St\n"<< endl;volScalarField St(IOobject("St", runTime.name(), mesh, IOobject::NO_READ, IOobject::AUTO_WRITE), flameWrinkling->Xi() *Su);multivariateSurfaceInterpolationScheme< scalar >::fieldTable fields
const unitSet & lookup(const word &unitName)
Lookup and return the named unit from the table.
void write(std::ostream &os, const bool binary, List< floatScalar > &fField)
Write floats ascii or binary.
errorManipArg< error, int > exit(error &err, const int errNo=1)
Ostream & decrIndent(Ostream &os)
Decrement the indent level.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Ostream & endl(Ostream &os)
Add newline and flush stream.
void transform(GeometricField< Type, GeoMesh > &rtf, const GeometricField< tensor, GeoMesh > &trf, const GeometricField< Type, GeoMesh > &tf)
String typeName(const std::type_info &info)
Return the un-mangled name given the standard type info.
const word & regionName(const solver ®ion)
FOR_ALL_FIELD_TYPES(makeDimensionedPointFieldFunctions)
Ostream & incrIndent(Ostream &os)
Increment the indent level.
labelList first(const UList< labelPair > &p)
void inv(pointPatchField< tensor > &, const pointPatchField< tensor > &)
Ostream & indent(Ostream &os)
Indent stream.
faceListList boundary(nPatches)
const Foam::wordList regionNames(args.optionFound("allRegions") ? runTime.regionNames() :wordList(1, args.optionFound("region") ? args.optionRead< word >("region") :polyMesh::defaultRegion))
Foam::argList args(argc, argv)