81 struct nonConformalCouple
109 const word& primaryRegionName,
118 ncPatchType +
"_on_" +
args[1],
119 ncPatchType +
"_on_" +
args[2]
129 const word& primaryRegionName,
133 const bool haveRegion =
dict.
found(
"region");
134 const bool haveRegions =
dict.
found(
"regions");
136 if (haveRegion && haveRegions)
139 <<
"Regions should be specified either by a \"region\" "
140 <<
"entry with a single region name (for in-region "
141 <<
"cyclics), or by a \"regions\" entry with a pair of "
142 <<
"names (for inter-region mapped walls)"
146 const bool havePatches =
dict.
found(
"patches");
147 const bool haveOwnerNeighbour =
150 if (havePatches == haveOwnerNeighbour)
153 <<
"Patches should be specified with either a single "
154 <<
"\"patches\" entry with a pair of patch names, "
155 <<
"or with two sub-dictionaries named \"owner\" and "
161 const word thisRegionName =
165 haveRegion ?
Pair<word>(thisRegionName, thisRegionName)
167 :
Pair<
word>(primaryRegionName, primaryRegionName);
175 ? nonConformalCyclicPolyPatch::typeName
176 : nonConformalMappedWallPolyPatch::typeName
190 ncPatchDicts[i] =
dict;
191 ncPatchDicts[i].remove(
"region");
192 ncPatchDicts[i].remove(
"regions");
193 ncPatchDicts[i].remove(
"patches");
194 ncPatchDicts[i].remove(
"type");
195 ncPatchDicts[i].remove(
"names");
231 ? nonConformalCyclicPolyPatch::typeName
232 : nonConformalMappedWallPolyPatch::typeName
248 ncPatchDicts[0] = ownerDict;
249 ncPatchDicts[1] = neighbourDict;
252 ncPatchDicts[i].remove(
"region");
253 ncPatchDicts[i].remove(
"patch");
254 ncPatchDicts[i].remove(
"name");
255 ncPatchDicts[i].remove(
"patchFields");
272 void evaluateNonConformalProcessorCyclics(
const fvMesh&
mesh)
285 if (isA<nonConformalProcessorCyclicPolyPatch>(pf.patch().patch()))
305 if (isA<nonConformalProcessorCyclicPolyPatch>(pf.patch().patch()))
316 int main(
int argc,
char *argv[])
331 "add non-conformal boundary conditions to the fields"
351 couples.
append(nonConformalCouple(primaryRegionName,
args));
359 "createNonConformalCouplesDict",
373 if (!iter().isDict())
continue;
377 const bool havePatches = subDict.
found(
"patches");
378 const bool haveOwnerNeighbour =
379 subDict.
found(
"owner") || subDict.
found(
"neighbour");
381 if (havePatches == haveOwnerNeighbour)
384 <<
"Patches should be specified with either a single "
385 <<
"\"patches\" entry with a pair of patch names, "
386 <<
"or with two sub-dictionaries named \"owner\" and "
390 couples.
append(nonConformalCouple(primaryRegionName, subDict));
428 if (regionMeshes.
empty())
438 const word oldInstance = regionMeshes[0].pointsInstance();
443 #define DeclareRegionGeoTypeFields(Type, Geo) \
444 PtrList<PtrList<Geo##Field<Type>>> \
445 CAT4(region, Geo, CAPITALIZE(Type), Fields)(regionMeshes.size()); \
446 forAll(regionMeshes, regioni) \
448 CAT4(region, Geo, CAPITALIZE(Type), Fields).set \
451 new PtrList<Geo##Field<Type>> \
457 #undef DeclareRegionGeoTypeFields
463 forAll(regionMeshes, regioni)
469 #define ReadRegionGeoTypeFields(Type, Geo, mesh) \
474 CAT4(region, Geo, CAPITALIZE(Type), Fields)[regioni] \
480 #undef ReadRegionGeoTypeFields
492 forAll(regionMeshes, regioni)
494 regionMeshes[regioni].conform();
500 forAll(regionMeshes, regioni)
504 label& firstProcPatchi = regionFirstProcPatchis[regioni];
505 label& firstProcFacei = regionFirstProcFaceis[regioni];
514 const bool isProcPp = isA<processorPolyPatch>(pp);
519 firstProcFacei = pp.
start();
522 if (!isProcPp && firstProcPatchi !=
patches.
size())
525 <<
"Processor patches of region " <<
regionNames[regioni]
526 <<
" do not follow boundary patches"
538 forAll(regionMeshes, regioni)
542 const label firstProcPatchi = regionFirstProcPatchis[regioni];
548 newPatches[regioni].
append
558 newPatchIsCouple[regioni].append(
false);
559 newPatchFieldDicts[regioni].append(
dictionary());
566 const nonConformalCouple& couple = couples[couplei];
568 Info<<
indent <<
"Adding " << couple.ncPatchType
576 couple.transform.write(
Info);
579 auto appendPatch = [&](
const bool owner)
581 if (!
regionNames.found(couple.regionNames[!owner]))
return;
583 const label regioni =
588 "type", couple.ncPatchType,
590 "startFace", regionFirstProcFaceis[regioni],
591 "originalPatch", couple.origPatchNames[!owner],
592 "neighbourRegion", couple.regionNames[owner],
593 "neighbourPatch", couple.ncPatchNames[owner],
599 (owner ? couple.transform :
inv(couple.transform)).
write(oss);
603 patchDict.
merge(couple.ncPatchDicts[!owner]);
605 newPatches[regioni].append
609 couple.ncPatchNames[!owner],
611 newPatches[regioni].size(),
612 regionMeshes[regioni].boundaryMesh()
615 newPatchIsCouple[regioni].append(
true);
616 newPatchFieldDicts[regioni].append
618 couple.ncPatchFieldDicts[!owner]
633 const nonConformalCouple& couple = couples[couplei];
634 forAll(couple.regionNames, i)
638 couple.regionNames[i],
639 couple.origPatchNames[i]
642 if (!regionOrigPatchToIndex.
found(regionOrigPatch))
644 regionOrigPatchToIndex.
insert
647 regionOrigPatches.
size()
649 regionOrigPatches.
append(regionOrigPatch);
655 forAll(regionOrigPatches, i)
662 const word& origPatchName = regionOrigPatches[i].second();
664 newPatches[regioni].
append
668 nonConformalErrorPolyPatch::typeName
672 regionFirstProcFaceis[regioni],
673 newPatches[regioni].size(),
674 regionMeshes[regioni].boundaryMesh(),
675 nonConformalErrorPolyPatch::typeName,
679 newPatchIsCouple[regioni].append(
false);
680 newPatchFieldDicts[regioni].append(
dictionary());
685 forAll(regionMeshes, regioni)
689 const label firstProcPatchi = regionFirstProcPatchis[regioni];
695 newPatches[regioni].
append
700 newPatches[regioni].
size(),
705 newPatchIsCouple[regioni].append(
false);
706 newPatchFieldDicts[regioni].append(
dictionary());
715 const nonConformalCouple& couple = couples[couplei];
717 if (couple.ncPatchType != nonConformalCyclicPolyPatch::typeName)
720 if (!
regionNames.found(couples[couplei].regionNames[0]))
752 auto appendProcPatches = [&](
const bool owner,
const bool first)
755 owner ? procHasPatch1 : procHasPatch2;
757 owner ? procHasPatch2 : procHasPatch1;
761 forAll(procHasPatchB, proci)
769 && procHasPatchB[proci]
772 newPatches[regioni].append
782 couple.ncPatchNames[!owner],
783 couple.origPatchNames[!owner]
786 newPatchIsCouple[regioni].append(
true);
787 newPatchFieldDicts[regioni].append
789 couple.ncPatchFieldDicts[!owner]
796 appendProcPatches(
true,
true);
797 appendProcPatches(
false,
true);
798 appendProcPatches(
false,
false);
799 appendProcPatches(
true,
false);
808 forAll(regionMeshes, regioni)
810 forAll(newPatches[regioni], newPatchi)
814 regionMeshes[regioni],
815 *newPatches[regioni][newPatchi]
823 forAll(regionMeshes, regioni)
837 forAll(regionMeshes, regioni)
839 forAll(newPatches[regioni], newPatchi)
841 if (newPatchIsCouple[regioni][newPatchi])
843 fvMeshTools::setPatchFields
845 regionMeshes[regioni],
847 newPatchFieldDicts[regioni][newPatchi]
857 forAll(regionMeshes, regioni)
861 #define EVALUATE_NON_CONFORMAL_PROCESSOR_CYCLICS(Type, nullArg) \
862 evaluateNonConformalProcessorCyclics<Type>(mesh);
864 #undef EVALUATE_NON_CONFORMAL_PROCESSOR_CYCLICS
872 const word newInstance =
overwrite ? oldInstance : runTime.name();
873 forAll(regionMeshes, regioni)
875 regionMeshes[regioni].setInstance(newInstance);
876 regionMeshes[regioni].setPolyFacesBfInstance(newInstance);
880 Info<<
"Writing mesh to " << runTime.name() <<
nl <<
endl;
881 forAll(regionMeshes, regioni)
883 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.
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 bool hasArgs(int argc, char *argv[])
Return true if there are arguments.
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.
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.
T lookupOrDefault(const word &, const T &, const bool writeDefault=writeOptionalEntries > 0) const
Find and return a T, if not found return the given default.
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.
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.
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.
static bool found(const IOobject &io)
Return whether the given IOobject relates to a mesh on disk.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
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.
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
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.
const word & regionName(const solver ®ion)
Ostream & incrIndent(Ostream &os)
Increment the indent level.
labelList first(const UList< labelPair > &p)
dimensionSet transform(const dimensionSet &)
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
FOR_ALL_FIELD_TYPES(makeFieldSourceTypedef)
void inv(LagrangianPatchField< tensor > &f, const LagrangianPatchField< tensor > &f1)
Ostream & indent(Ostream &os)
Indent stream.
const Foam::wordList regionNames(args.optionFound("allRegions") ? runTime .controlDict().subDict("regionSolvers").toc() :wordList(1, args.optionFound("region") ? args.optionRead< word >("region") :polyMesh::defaultRegion))
Foam::argList args(argc, argv)