73 const bool flipFaceFlux,
74 const label newPatchi,
81 if (!modifiedFace[facei])
99 modifiedFace[facei] = 1;
130 const Type& exposedValue,
131 const word GeomVolType,
141 if (iter()->headerClassName() == GeomVolType)
143 const word fieldName = iter()->name();
145 Info<<
"Subsetting field " << fieldName <<
endl;
159 subFields[i++].boundaryFieldRef()[
patchi];
178 ].patch().patch().start();
184 if (oldFacei < oldStart || oldFacei >= oldStart+oldSize)
186 fld[j] = exposedValue;
197 void subsetSurfaceFields
202 const Type& exposedValue,
203 const word GeomSurfType,
213 if (iter()->headerClassName() == GeomSurfType)
215 const word& fieldName = iter.key();
217 Info<<
"Subsetting field " << fieldName <<
endl;
232 subFields[i++].boundaryFieldRef()[
patchi];
251 ].patch().patch().start();
257 if (oldFacei < oldStart || oldFacei >= oldStart+oldSize)
259 fld[j] = exposedValue;
271 template<
class GeoField>
272 void initCreatedPatches
276 const typename GeoField::value_type initValue
281 mesh.objectRegistry::lookupClass<GeoField>()
287 iterator fieldIter =
fields.begin();
288 fieldIter !=
fields.end();
292 GeoField& field =
const_cast<GeoField&
>(*fieldIter());
294 typename GeoField::Boundary& fieldBf =
295 field.boundaryFieldRef();
302 fieldBf[
patchi] = initValue;
304 if (fieldBf[patchi].fixesValue())
306 fieldBf[
patchi] == initValue;
314 void createCoupledBaffles
324 forAll(coupledWantedPatch, facei)
326 if (coupledWantedPatch[facei] != -1)
330 bool zoneFlip =
false;
334 const faceZone& fZone = faceZones[zoneID];
346 coupledWantedPatch[facei],
355 bool zoneFlip =
false;
359 const faceZone& fZone = faceZones[zoneID];
370 coupledWantedPatch[facei],
381 void createCyclicCoupledBaffles
392 forAll(cyclicMasterPatch, facei)
394 if (cyclicMasterPatch[facei] != -1)
399 bool zoneFlip =
false;
403 const faceZone& fZone = faceZones[zoneID];
414 cyclicMasterPatch[facei],
422 forAll(cyclicSlavePatch, facei)
424 if (cyclicSlavePatch[facei] != -1)
430 bool zoneFlip =
false;
434 const faceZone& fZone = faceZones[zoneID];
445 cyclicSlavePatch[facei],
464 Info <<
"faceZone:createBaffle " << faceZones <<
endl;
465 forAll(wantedPatch, facei)
467 if (wantedPatch[facei] != -1)
472 bool zoneFlip =
false;
476 const faceZone& fZone = faceZones[zoneID];
499 bool zoneFlip =
false;
503 const faceZone& fZone = faceZones[zoneID];
537 <<
"Illegal patch " << patchName
538 <<
nl <<
"Valid patches are " << patches.
names()
547 if (newPatch != patchi)
550 <<
"Patch " << patchName
551 <<
" should have the same patch index on all processors." <<
nl 552 <<
"On my processor it has index " << patchi
553 <<
" ; on some other processor it has index " << newPatch
562 int main(
int argc,
char *argv[])
567 runTime.functionObjects().off();
594 if (!iter().isDict())
598 const word& key = iter().keyword();
601 const word cyclicName = dict.
lookup(
"cyclicMasterPatchName");
602 const word wallName = dict.
lookup(
"wallPatchName");
604 nameAndType[0] = key;
605 nameAndType[1] = wallName;
606 nameAndType[2] = cyclicName;
607 coupledAndPatches.append(nameAndType);
610 forAll(setsAndPatches, setI)
612 Info<<
"Faces in faceSet " << setsAndPatches[setI][0]
613 <<
" become baffles in patch " << setsAndPatches[setI][1]
617 forAll(coupledAndPatches, setI)
619 Info<<
"Faces in faceSet " << coupledAndPatches[setI][0]
620 <<
" become coupled baffles in patch " << coupledAndPatches[setI][1]
625 const word defaultPatch(dict.
lookup(
"defaultPatch"));
627 Info<<
"Faces that get exposed become boundary faces in patch " 628 << defaultPatch <<
endl;
630 const word blockedSetName(dict.
lookup(
"blockedCells"));
632 Info<<
"Reading blocked cells from cellSet " << blockedSetName
643 forAll(setsAndPatches, setI)
645 faceSet fSet(mesh, setsAndPatches[setI][0]);
647 label patchi = findPatch
650 setsAndPatches[setI][1]
655 if (wantedPatch[iter.key()] != -1)
658 <<
"Face " << iter.key()
659 <<
" is in faceSet " << setsAndPatches[setI][0]
660 <<
" destined for patch " << setsAndPatches[setI][1]
661 <<
" but also in patch " << wantedPatch[iter.key()]
664 wantedPatch[iter.key()] =
patchi;
673 forAll(coupledAndPatches, setI)
676 const label cyclicId =
677 findPatch(patches, coupledAndPatches[setI][2]);
679 const label cyclicSlaveId = findPatch
682 refCast<const cyclicFvPatch>
685 ).neighbFvPatch().
name()
688 faceSet fSet(mesh, coupledAndPatches[setI][0]);
689 label patchi = findPatch(patches, coupledAndPatches[setI][1]);
693 if (coupledWantedPatch[iter.key()] != -1)
696 <<
"Face " << iter.key()
697 <<
" is in faceSet " << coupledAndPatches[setI][0]
698 <<
" destined for patch " << coupledAndPatches[setI][1]
699 <<
" but also in patch " << coupledWantedPatch[iter.key()]
702 coupledWantedPatch[iter.key()] =
patchi;
703 cyclicWantedPatch_half0[iter.key()] = cyclicId;
704 cyclicWantedPatch_half1[iter.key()] = cyclicSlaveId;
722 cellSet blockedCells(mesh, blockedSetName);
725 blockedCells.invert(mesh.
nCells());
744 cyclicWantedPatch_half0,
750 cyclicWantedPatch_half1,
768 || iter()->headerClassName()
810 sphericalTensorNames.size()
878 surfSphericalTensorNames.size()
887 surfSphericalTensorFlds
897 surfSymmTensorNames.size()
927 Info<<
"Writing mesh without blockedCells to time " 928 << runTime.userTimeName() <<
endl;
933 scalarFlds[i].rename(scalarNames[i]);
935 scalarFlds[i].checkIn();
939 vectorFlds[i].rename(vectorNames[i]);
941 vectorFlds[i].checkIn();
943 forAll(sphericalTensorFlds, i)
945 sphericalTensorFlds[i].rename(sphericalTensorNames[i]);
947 sphericalTensorFlds[i].checkIn();
951 symmTensorFlds[i].rename(symmTensorNames[i]);
953 symmTensorFlds[i].checkIn();
957 tensorFlds[i].rename(tensorNames[i]);
959 tensorFlds[i].checkIn();
965 surfScalarFlds[i].rename(surfScalarNames[i]);
967 surfScalarFlds[i].checkIn();
971 surfVectorFlds[i].rename(surfVectorNames[i]);
973 surfVectorFlds[i].checkIn();
975 forAll(surfSphericalTensorFlds, i)
977 surfSphericalTensorFlds[i].rename(surfSphericalTensorNames[i]);
979 surfSphericalTensorFlds[i].checkIn();
981 forAll(surfSymmTensorFlds, i)
983 surfSymmTensorFlds[i].rename(surfSymmTensorNames[i]);
985 surfSymmTensorFlds[i].checkIn();
987 forAll(surfTensorNames, i)
989 surfTensorFlds[i].rename(surfTensorNames[i]);
991 surfTensorFlds[i].checkIn();
1022 cyclicWantedPatch_half0,
1030 cyclicWantedPatch_half1,
1042 createCoupledBaffles
1051 createCyclicCoupledBaffles
1054 cyclicWantedPatch_half0,
1055 cyclicWantedPatch_half1,
1075 meshMod.changeMesh(subsetter.
subMesh(),
false);
1082 initCreatedPatches<volScalarField>
1088 initCreatedPatches<volVectorField>
1094 initCreatedPatches<volSphericalTensorField>
1100 initCreatedPatches<volSymmTensorField>
1106 initCreatedPatches<volTensorField>
1113 initCreatedPatches<surfaceScalarField>
1119 initCreatedPatches<surfaceVectorField>
1125 initCreatedPatches<surfaceSphericalTensorField>
1131 initCreatedPatches<surfaceSymmTensorField>
1137 initCreatedPatches<surfaceTensorField>
1146 if (map().hasMotionPoints())
1151 Info<<
"Writing mesh with split blockedFaces to time " 1152 << runTime.userTimeName() <<
endl;
1166 if (cellRegion.nRegions() > 1)
1169 <<
"Removing blocked faces and cells created " 1170 << cellRegion.nRegions()
1171 <<
" regions that are not connected via a face." <<
nl 1172 <<
" This is not supported in solvers." <<
nl 1173 <<
" Use" <<
nl <<
nl 1174 <<
" splitMeshRegions <root> <case> -largestOnly" <<
nl <<
nl 1175 <<
" to extract a single region of the mesh." <<
nl 1176 <<
" This mesh will be written to a new timedirectory" 1177 <<
" so might have to be moved back to constant/" <<
nl 1180 word startFrom(runTime.controlDict().lookup(
"startFrom"));
1182 if (startFrom !=
"latestTime")
1185 <<
"To run splitMeshRegions please set your" 1186 <<
" startFrom entry to latestTime" <<
endl;
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
This class separates the mesh into distinct unconnected regions, each of which is then given a label ...
#define forAll(list, i)
Loop across all elements in list.
const word & name() const
Return name.
List of IOobjects with searching and retrieving facilities.
errorManipArg< error, int > exit(error &err, const int errNo=1)
Class describing modification of a face.
const fileName & facesInstance() const
Return the current instance directory for faces.
A face is a list of labels corresponding to mesh vertices.
A 1D vector of objects of type <T> with a fixed size <Size>.
A list of keyword definitions, which are a keyword followed by any number of values (e...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object of type.
virtual const labelList & faceNeighbour() const
Return face neighbour.
static const char *const typeName
Foam::tmp< Foam::GeometricField< Type, Foam::fvPatchField, Foam::volMesh > > volField(const Foam::fvMeshSubset &, const Foam::GeometricField< Type, Foam::fvPatchField, Foam::volMesh > &vf)
Wrapper to get hold of the field or the subsetted field.
const boolList & flipMap() const
Return face flip map.
Ostream & endl(Ostream &os)
Add newline and flush stream.
bool optionFound(const word &opt) const
Return true if the named option is found.
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
label findPatchID(const word &patchName) const
Find patch index given a name.
Generic GeometricField class.
label whichFace(const label globalCellID) const
Helper function to re-direct to zone::localID(...)
Vector< scalar > vector
A scalar version of the templated Vector.
virtual bool write(const bool write=true) const
Write mesh using IO settings from time.
virtual void topoChange(const polyTopoChangeMap &map)
Update mesh corresponding to the given map.
A face addition data class. A face can be inflated either from a point or from another face and can e...
const labelList & faceMap() const
Return face map.
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
const dictionary & subDict(const word &) const
Find and return a sub-dictionary.
const fvMesh & subMesh() const
Return reference to subset mesh.
const labelList & patchMap() const
Return patch map.
face reverseFace() const
Return face with reverse direction.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects...
SymmTensor< scalar > symmTensor
SymmTensor of scalars.
A class for handling words, derived from string.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
const polyPatch & patch() const
Return the polyPatch.
wordList names() const
Return a list of patch names.
virtual const labelList & faceOwner() const
Return face owner.
virtual void setPoints(const pointField &)
Reset the points.
virtual const faceList & faces() const
Return raw faces.
An STL-conforming hash table.
const fvPatch & patch() const
Return patch.
bool isInternalFace(const label faceIndex) const
Return true if given face label is internal to the mesh.
Post-processing mesh subset tool. Given the original mesh and the list of selected cells...
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
const fvPatch & patch() const
Return patch.
label whichZone(const label objectIndex) const
Given a global object index, return the zone it is in.
static tmp< GeometricField< Type, fvPatchField, volMesh > > interpolate(const GeometricField< Type, fvPatchField, volMesh > &, const fvMesh &sMesh, const labelList &patchMap, const labelList &cellMap, const labelList &faceMap)
Map volume field.
Info<< "Reading field p_rgh\"<< endl;volScalarField p_rgh(IOobject("p_rgh", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE), mesh);pressureReference pressureReference(p, p_rgh, pimple.dict(), thermo.incompressible());mesh.schemes().setFluxRequired(p_rgh.name());hydrostaticInitialisation(p_rgh, p, rho, U, gh, ghf, pRef, thermo, pimple.dict());Info<< "Creating field dpdt\"<< endl;volScalarField dpdt(IOobject("dpdt", runTime.timeName(), mesh), mesh, dimensionedScalar(p.dimensions()/dimTime, 0));Info<< "Creating field kinetic energy K\"<< endl;volScalarField K("K", 0.5 *magSqr(U));dimensionedScalar initialMass=fvc::domainIntegrate(rho);multivariateSurfaceInterpolationScheme< scalar >::fieldTable fields
#define WarningInFunction
Report a warning using Foam::Warning.
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
A collection of cell labels.
const meshFaceZones & faceZones() const
Return face zones.
Mesh data needed to do the Finite Volume discretisation.
Direct mesh changes based on v1.3 polyTopoChange syntax.
label start() const
Return start label of this patch in the polyMesh face list.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
A subset of mesh faces organised as a primitive patch.
SphericalTensor< scalar > sphericalTensor
SphericalTensor of scalars.
const labelList & oldPatchSizes() const
Return list of the old patch sizes.
Foam::argList args(argc, argv)
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
A List with indirect addressing.
An abstract base class with a fat-interface to all derived classes covering all possible ways in whic...
Tensor< scalar > tensor
Tensor of scalars.
void setLargeCellSubset(const labelList ®ion, const label currentRegion, const label patchID=-1, const bool syncCouples=true)
Set the subset from all cells with region == currentRegion.
const fvMesh & baseMesh() const
Original mesh.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
label setAction(const topoAction &action)
For compatibility with polyTopoChange: set topological action.
const fvBoundaryMesh & boundary() const
Return reference to boundary mesh.