81 struct nonConformalCouple
107 const word& primaryRegionName,
116 ncPatchType +
"_on_" +
args[1],
117 ncPatchType +
"_on_" +
args[2]
126 const word& primaryRegionName,
130 const bool haveRegion =
dict.
found(
"region");
131 const bool haveRegions =
dict.
found(
"regions");
133 if (haveRegion && haveRegions)
136 <<
"Regions should be specified either by a \"region\" "
137 <<
"entry with a single region name (for in-region "
138 <<
"cyclics), or by a \"regions\" entry with a pair of "
139 <<
"names (for inter-region mapped walls)"
143 const bool havePatches =
dict.
found(
"patches");
144 const bool haveOwnerNeighbour =
147 if (havePatches == haveOwnerNeighbour)
150 <<
"Patches should be specified with either a single "
151 <<
"\"patches\" entry with a pair of patch names, "
152 <<
"or with two sub-dictionaries named \"owner\" and "
158 const word thisRegionName =
162 haveRegion ?
Pair<word>(thisRegionName, thisRegionName)
164 :
Pair<
word>(primaryRegionName, primaryRegionName);
172 ? nonConformalCyclicPolyPatch::typeName
173 : nonConformalMappedWallPolyPatch::typeName
214 ? nonConformalCyclicPolyPatch::typeName
215 : nonConformalMappedWallPolyPatch::typeName
246 void evaluateNonConformalProcessorCyclics(
const fvMesh& mesh)
259 if (isA<nonConformalProcessorCyclicPolyPatch>(pf.patch().patch()))
279 if (isA<nonConformalProcessorCyclicPolyPatch>(pf.patch().patch()))
290 int main(
int argc,
char *argv[])
304 "add non-conformal boundary conditions to the fields"
323 couples.
append(nonConformalCouple(primaryRegionName,
args));
331 "createNonConformalCouplesDict",
345 if (!iter().isDict())
continue;
349 const bool havePatches = subDict.
found(
"patches");
350 const bool haveOwnerNeighbour =
351 subDict.
found(
"owner") || subDict.
found(
"neighbour");
353 if (havePatches == haveOwnerNeighbour)
356 <<
"Patches should be specified with either a single "
357 <<
"\"patches\" entry with a pair of patch names, "
358 <<
"or with two sub-dictionaries named \"owner\" and "
362 couples.
append(nonConformalCouple(primaryRegionName, subDict));
397 const word oldInstance = regionMeshes[0].pointsInstance();
402 #define DeclareRegionGeoTypeFields(Type, Geo) \
403 PtrList<PtrList<Geo##Field<Type>>> \
404 CAT4(region, Geo, CAPITALIZE(Type), Fields)(regionMeshes.size()); \
405 forAll(regionMeshes, regioni) \
407 CAT4(region, Geo, CAPITALIZE(Type), Fields).set \
410 new PtrList<Geo##Field<Type>> \
416 #undef DeclareRegionGeoTypeFields
422 forAll(regionMeshes, regioni)
428 #define ReadRegionGeoTypeFields(Type, Geo, mesh) \
433 CAT4(region, Geo, CAPITALIZE(Type), Fields)[regioni] \
439 #undef ReadRegionGeoTypeFields
451 forAll(regionMeshes, regioni)
453 regionMeshes[regioni].conform();
459 forAll(regionMeshes, regioni)
461 const fvMesh& mesh = regionMeshes[regioni];
463 label& firstProcPatchi = regionFirstProcPatchis[regioni];
464 label& firstProcFacei = regionFirstProcFaceis[regioni];
467 firstProcFacei = mesh.
nFaces();
473 const bool isProcPp = isA<processorPolyPatch>(pp);
478 firstProcFacei = pp.
start();
481 if (!isProcPp && firstProcPatchi !=
patches.
size())
484 <<
"Processor patches of region " <<
regionNames[regioni]
485 <<
" do not follow boundary patches"
497 forAll(regionMeshes, regioni)
499 const fvMesh& mesh = regionMeshes[regioni];
501 const label firstProcPatchi = regionFirstProcPatchis[regioni];
507 newPatches[regioni].
append
517 newPatchIsCouple[regioni].append(
false);
518 newPatchFieldDicts[regioni].append(
dictionary());
525 const nonConformalCouple& couple = couples[couplei];
527 Info<<
indent <<
"Adding " << couple.ncPatchType
535 couple.transform.write(
Info);
538 auto appendPatch = [&](
const bool owner)
540 const label regioni =
545 "type", couple.ncPatchType,
547 "startFace", regionFirstProcFaceis[regioni],
548 "originalPatch", couple.origPatchNames[!owner],
549 "neighbourRegion", couple.regionNames[owner],
550 "neighbourPatch", couple.ncPatchNames[owner]
555 (owner ? couple.transform :
inv(couple.transform)).
write(oss);
559 newPatches[regioni].append
563 couple.ncPatchNames[!owner],
565 newPatches[regioni].size(),
566 regionMeshes[regioni].boundaryMesh()
569 newPatchIsCouple[regioni].append(
true);
570 newPatchFieldDicts[regioni].append
572 couple.ncPatchFieldDicts[!owner]
587 const nonConformalCouple& couple = couples[couplei];
588 forAll(couple.regionNames, i)
592 couple.regionNames[i],
593 couple.origPatchNames[i]
596 if (!regionOrigPatchToIndex.
found(regionOrigPatch))
598 regionOrigPatchToIndex.
insert
601 regionOrigPatches.
size()
603 regionOrigPatches.
append(regionOrigPatch);
609 forAll(regionOrigPatches, i)
613 const word& origPatchName = regionOrigPatches[i].second();
615 newPatches[regioni].
append
619 nonConformalErrorPolyPatch::typeName
623 regionFirstProcFaceis[regioni],
624 newPatches[regioni].size(),
625 regionMeshes[regioni].boundaryMesh(),
626 nonConformalErrorPolyPatch::typeName,
630 newPatchIsCouple[regioni].append(
false);
631 newPatchFieldDicts[regioni].append(
dictionary());
636 forAll(regionMeshes, regioni)
638 const fvMesh& mesh = regionMeshes[regioni];
640 const label firstProcPatchi = regionFirstProcPatchis[regioni];
646 newPatches[regioni].
append
651 newPatches[regioni].
size(),
656 newPatchIsCouple[regioni].append(
false);
657 newPatchFieldDicts[regioni].append(
dictionary());
666 const nonConformalCouple& couple = couples[couplei];
668 if (couple.ncPatchType != nonConformalCyclicPolyPatch::typeName)
672 const fvMesh& mesh = regionMeshes[regioni];
700 auto appendProcPatches = [&](
const bool owner,
const bool first)
703 owner ? procHasPatch1 : procHasPatch2;
705 owner ? procHasPatch2 : procHasPatch1;
709 forAll(procHasPatchB, proci)
717 && procHasPatchB[proci]
720 newPatches[regioni].append
730 couple.ncPatchNames[!owner],
731 couple.origPatchNames[!owner]
734 newPatchIsCouple[regioni].append(
true);
735 newPatchFieldDicts[regioni].append
737 couple.ncPatchFieldDicts[!owner]
744 appendProcPatches(
true,
true);
745 appendProcPatches(
false,
true);
746 appendProcPatches(
false,
false);
747 appendProcPatches(
true,
false);
756 forAll(regionMeshes, regioni)
758 forAll(newPatches[regioni], newPatchi)
762 regionMeshes[regioni],
763 *newPatches[regioni][newPatchi],
774 forAll(regionMeshes, regioni)
786 forAll(regionMeshes, regioni)
788 forAll(newPatches[regioni], newPatchi)
790 if (newPatchIsCouple[regioni][newPatchi])
792 fvMeshTools::setPatchFields
794 regionMeshes[regioni],
796 newPatchFieldDicts[regioni][newPatchi]
806 forAll(regionMeshes, regioni)
808 const fvMesh& mesh = regionMeshes[regioni];
810 #define EVALUATE_NON_CONFORMAL_PROCESSOR_CYCLICS(Type, nullArg) \
811 evaluateNonConformalProcessorCyclics<Type>(mesh);
813 #undef EVALUATE_NON_CONFORMAL_PROCESSOR_CYCLICS
821 const word newInstance = overwrite ? oldInstance : runTime.name();
822 forAll(regionMeshes, regioni)
824 regionMeshes[regioni].setInstance(newInstance);
825 regionMeshes[regioni].setPolyFacesBfInstance(newInstance);
829 Info<<
nl <<
"Writing mesh to " << runTime.name() <<
nl <<
endl;
830 forAll(regionMeshes, regioni)
832 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.
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.
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.
This boundary condition is not designed to be evaluated; it is assumed that the value is assigned via...
const word dictName() const
Return the local dictionary name (final part of scoped name)
A list of keyword definitions, which are a keyword followed by any number of values (e....
dictionary subOrEmptyDict(const word &, const bool mustRead=false) const
Find and return a sub-dictionary as a copy, or.
T lookupOrDefault(const word &, const T &, bool recursive=false, bool patternMatch=true) const
Find and return a T, if not found return the given default.
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 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(const bool strict=false) const
Return the list of fields of type GeoField.
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 & 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.
#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)
dimensionedSphericalTensor inv(const dimensionedSphericalTensor &dt)
FOR_ALL_FIELD_TYPES(makeFieldSourceTypedef)
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)