71 const bool flipFaceFlux,
72 const label newPatchi,
77 if (!modifiedFace[facei])
89 modifiedFace[facei] = 1;
113 const Type& exposedValue,
114 const word GeomVolType,
124 if (iter()->headerClassName() == GeomVolType)
126 const word fieldName = iter()->name();
128 Info<<
"Subsetting field " << fieldName <<
endl;
142 subFields[i++].boundaryFieldRef()[
patchi];
144 label newStart =
fld.patch().patch().start();
161 ].patch().patch().start();
167 if (oldFacei < oldStart || oldFacei >= oldStart+oldSize)
169 fld[j] = exposedValue;
180 void subsetSurfaceFields
185 const Type& exposedValue,
186 const word GeomSurfType,
196 if (iter()->headerClassName() == GeomSurfType)
198 const word& fieldName = iter.key();
200 Info<<
"Subsetting field " << fieldName <<
endl;
215 subFields[i++].boundaryFieldRef()[
patchi];
217 label newStart =
fld.patch().patch().start();
234 ].patch().patch().start();
240 if (oldFacei < oldStart || oldFacei >= oldStart+oldSize)
242 fld[j] = exposedValue;
254 template<
class GeoField>
255 void initCreatedPatches
259 const typename GeoField::value_type initValue
264 mesh.objectRegistry::lookupClass<GeoField>()
270 iterator fieldIter =
fields.begin();
271 fieldIter !=
fields.end();
275 GeoField& field =
const_cast<GeoField&
>(*fieldIter());
277 typename GeoField::Boundary& fieldBf =
278 field.boundaryFieldRef();
285 fieldBf[
patchi] = initValue;
287 if (fieldBf[
patchi].fixesValue())
289 fieldBf[
patchi] == initValue;
297 void createCoupledBaffles
305 forAll(coupledWantedPatch, facei)
307 if (coupledWantedPatch[facei] != -1)
319 coupledWantedPatch[facei],
333 coupledWantedPatch[facei],
342 void createCyclicCoupledBaffles
351 forAll(cyclicMasterPatch, facei)
353 if (cyclicMasterPatch[facei] != -1)
364 cyclicMasterPatch[facei],
370 forAll(cyclicSlavePatch, facei)
372 if (cyclicSlavePatch[facei] != -1)
385 cyclicSlavePatch[facei],
401 forAll(wantedPatch, facei)
403 if (wantedPatch[facei] != -1)
442 <<
"Illegal patch " << patchName
443 <<
nl <<
"Valid patches are " <<
patches.names()
455 <<
"Patch " << patchName
456 <<
" should have the same patch index on all processors." <<
nl
457 <<
"On my processor it has index " <<
patchi
458 <<
" ; on some other processor it has index " << newPatch
467 int main(
int argc,
char *argv[])
498 if (!iter().isDict())
502 const word& key = iter().keyword();
508 nameAndType[0] = key;
509 nameAndType[1] = wallName;
510 nameAndType[2] = cyclicName;
511 coupledAndPatches.append(nameAndType);
514 forAll(setsAndPatches, setI)
516 Info<<
"Faces in faceSet " << setsAndPatches[setI][0]
517 <<
" become baffles in patch " << setsAndPatches[setI][1]
521 forAll(coupledAndPatches, setI)
523 Info<<
"Faces in faceSet " << coupledAndPatches[setI][0]
524 <<
" become coupled baffles in patch " << coupledAndPatches[setI][1]
531 Info<<
"Faces that get exposed become boundary faces in patch "
532 << defaultPatch <<
endl;
536 Info<<
"Reading blocked cells from cellSet " << blockedSetName
547 forAll(setsAndPatches, setI)
549 faceSet fSet(mesh, setsAndPatches[setI][0]);
554 setsAndPatches[setI][1]
559 if (wantedPatch[iter.key()] != -1)
562 <<
"Face " << iter.key()
563 <<
" is in faceSet " << setsAndPatches[setI][0]
564 <<
" destined for patch " << setsAndPatches[setI][1]
565 <<
" but also in patch " << wantedPatch[iter.key()]
568 wantedPatch[iter.key()] =
patchi;
577 forAll(coupledAndPatches, setI)
580 const label cyclicId =
581 findPatch(
patches, coupledAndPatches[setI][2]);
583 const label cyclicSlaveId = findPatch
586 refCast<const cyclicFvPatch>
589 ).neighbFvPatch().name()
592 faceSet fSet(mesh, coupledAndPatches[setI][0]);
597 if (coupledWantedPatch[iter.key()] != -1)
600 <<
"Face " << iter.key()
601 <<
" is in faceSet " << coupledAndPatches[setI][0]
602 <<
" destined for patch " << coupledAndPatches[setI][1]
603 <<
" but also in patch " << coupledWantedPatch[iter.key()]
606 coupledWantedPatch[iter.key()] =
patchi;
607 cyclicWantedPatch_half0[iter.key()] = cyclicId;
608 cyclicWantedPatch_half1[iter.key()] = cyclicSlaveId;
626 cellSet blockedCells(mesh, blockedSetName);
629 blockedCells.invert(mesh.
nCells());
648 cyclicWantedPatch_half0,
654 cyclicWantedPatch_half1,
672 || iter()->headerClassName()
714 sphericalTensorNames.size()
782 surfSphericalTensorNames.size()
791 surfSphericalTensorFlds
801 surfSymmTensorNames.size()
831 Info<<
"Writing mesh without blockedCells to time "
832 << runTime.userTimeName() <<
endl;
837 scalarFlds[i].rename(scalarNames[i]);
839 scalarFlds[i].checkIn();
843 vectorFlds[i].rename(vectorNames[i]);
845 vectorFlds[i].checkIn();
847 forAll(sphericalTensorFlds, i)
849 sphericalTensorFlds[i].rename(sphericalTensorNames[i]);
851 sphericalTensorFlds[i].checkIn();
855 symmTensorFlds[i].rename(symmTensorNames[i]);
857 symmTensorFlds[i].checkIn();
861 tensorFlds[i].rename(tensorNames[i]);
863 tensorFlds[i].checkIn();
869 surfScalarFlds[i].rename(surfScalarNames[i]);
871 surfScalarFlds[i].checkIn();
875 surfVectorFlds[i].rename(surfVectorNames[i]);
877 surfVectorFlds[i].checkIn();
879 forAll(surfSphericalTensorFlds, i)
881 surfSphericalTensorFlds[i].rename(surfSphericalTensorNames[i]);
883 surfSphericalTensorFlds[i].checkIn();
885 forAll(surfSymmTensorFlds, i)
887 surfSymmTensorFlds[i].rename(surfSymmTensorNames[i]);
889 surfSymmTensorFlds[i].checkIn();
891 forAll(surfTensorNames, i)
893 surfTensorFlds[i].rename(surfTensorNames[i]);
895 surfTensorFlds[i].checkIn();
926 cyclicWantedPatch_half0,
934 cyclicWantedPatch_half1,
955 createCyclicCoupledBaffles
958 cyclicWantedPatch_half0,
959 cyclicWantedPatch_half1,
985 initCreatedPatches<volScalarField>
991 initCreatedPatches<volVectorField>
997 initCreatedPatches<volSphericalTensorField>
1003 initCreatedPatches<volSymmTensorField>
1009 initCreatedPatches<volTensorField>
1016 initCreatedPatches<surfaceScalarField>
1022 initCreatedPatches<surfaceVectorField>
1028 initCreatedPatches<surfaceSphericalTensorField>
1034 initCreatedPatches<surfaceSymmTensorField>
1040 initCreatedPatches<surfaceTensorField>
1047 Info<<
"Writing mesh with split blockedFaces to time "
1048 << runTime.userTimeName() <<
endl;
1062 if (cellRegion.nRegions() > 1)
1065 <<
"Removing blocked faces and cells created "
1066 << cellRegion.nRegions()
1067 <<
" regions that are not connected via a face." <<
nl
1068 <<
" This is not supported in solvers." <<
nl
1069 <<
" Use" <<
nl <<
nl
1070 <<
" splitMeshRegions <root> <case> -largestOnly" <<
nl <<
nl
1071 <<
" to extract a single region of the mesh." <<
nl
1072 <<
" This mesh will be written to a new timedirectory"
1073 <<
" so might have to be moved back to constant/" <<
nl
1076 word startFrom(runTime.controlDict().lookup(
"startFrom"));
1078 if (startFrom !=
"latestTime")
1081 <<
"To run splitMeshRegions please set your"
1082 <<
" startFrom entry to latestTime" <<
endl;
#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.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
static const char *const typeName
A 1D vector of objects of type <T> with a fixed size <Size>.
Generic GeometricField class.
An STL-conforming hash table.
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
List of IOobjects with searching and retrieving facilities.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
A List with indirect addressing.
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
bool optionFound(const word &opt) const
Return true if the named option is found.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
A collection of cell labels.
A list of keyword definitions, which are a keyword followed by any number of values (e....
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
const dictionary & subDict(const word &) const
Find and return a sub-dictionary.
A face is a list of labels corresponding to mesh vertices.
Post-processing mesh subset tool. Given the original mesh and the list of selected cells,...
const labelList & faceMap() const
Return face map.
const fvMesh & baseMesh() const
Original mesh.
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 & subMesh() const
Return reference to subset mesh.
const labelList & patchMap() const
Return patch map.
static tmp< VolField< Type > > interpolate(const VolField< Type > &, const fvMesh &sMesh, const labelList &patchMap, const labelList &cellMap, const labelList &faceMap)
Map volume field.
Mesh data needed to do the Finite Volume discretisation.
const fvBoundaryMesh & boundary() const
Return reference to boundary mesh.
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.
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
An abstract base class with a fat-interface to all derived classes covering all possible ways in whic...
const fileName & facesInstance() const
Return the current instance directory for faces.
virtual const faceList & faces() const
Return raw faces.
virtual const labelList & faceOwner() const
Return face owner.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
virtual const labelList & faceNeighbour() const
Return face neighbour.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
const labelList & oldPatchSizes() const
Return list of the old patch sizes.
Direct mesh changes based on v1.3 polyTopoChange syntax.
autoPtr< polyTopoChangeMap > changeMesh(polyMesh &mesh, const bool syncParallel=true, const bool orderCells=false, const bool orderPoints=false)
Inplace changes mesh without change of patches.
void modifyFace(const face &f, const label facei, const label own, const label nei, const bool flipFaceFlux, const label patchID)
Modify vertices or cell of face.
label addFace(const face &f, const label own, const label nei, const label masterFaceID, const bool flipFaceFlux, const label patchID)
Add face to cells and return new face index.
bool isInternalFace(const label faceIndex) const
Return true if given face label is internal to the mesh.
This class separates the mesh into distinct unconnected regions, each of which is then given a label ...
A class for handling words, derived from string.
Foam::tmp< Foam::VolField< Type > > volField(const Foam::fvMeshSubset &, const Foam::VolField< Type > &vf)
Wrapper to get hold of the field or the subsetted field.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
int main(int argc, char *argv[])
gmvFile<< "tracers "<< particles.size()<< nl;{ pointField positions(particles.size());label particlei=0;forAllConstIter(Cloud< passiveParticle >, particles, iter) { positions[particlei++]=iter().position(mesh);} for(i=0;i< pTraits< point >::nComponents;i++) { forAll(positions, particlei) { gmvFile<< component(positions[particlei], i)<< ' ';} gmvFile<< nl;}}forAll(lagrangianScalarNames, i){ const word &name=lagrangianScalarNames[i];IOField< scalar > fld(IOobject(name, runTime.name(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
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
#define WarningInFunction
Report a warning using Foam::Warning.
errorManipArg< error, int > exit(error &err, const int errNo=1)
SphericalTensor< scalar > sphericalTensor
SphericalTensor of scalars.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Tensor< scalar > tensor
Tensor of scalars.
Ostream & endl(Ostream &os)
Add newline and flush stream.
SymmTensor< scalar > symmTensor
SymmTensor of scalars.
Vector< scalar > vector
A scalar version of the templated Vector.
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
Foam::argList args(argc, argv)