62 const word& fieldName = fieldNames[i];
64 Info<<
"Subsetting field " << fieldName <<
endl;
85 void subsetSurfaceFields
96 const word& fieldName = fieldNames[i];
98 Info<<
"Subsetting field " << fieldName <<
endl;
119 void subsetPointFields
131 const word& fieldName = fieldNames[i];
133 Info<<
"Subsetting field " << fieldName <<
endl;
154 void subsetDimensionedFields
165 const word& fieldName = fieldNames[i];
167 Info<<
"Subsetting field " << fieldName <<
endl;
188 int main(
int argc,
char *argv[])
192 "select a mesh subset based on a cellSet" 202 "add exposed internal faces to specified patch instead of to " 209 "specify a time for the resulting mesh" 213 runTime.functionObjects().off();
224 word fieldsInstance = runTime.timeName();
232 if (specifiedInstance)
235 meshInstance = fieldsInstance;
239 Info<<
"Reading cell set from " << setName << endl <<
endl;
248 const word patchName =
args[
"patch"];
259 Info<<
"Adding exposed internal faces to patch " << patchName << endl
264 Info<<
"Adding exposed internal faces to a patch called" 265 <<
" \"oldInternalFaces\" (created if necessary)" << endl
282 subsetVolFields(subsetter, scalarNames, scalarFlds);
286 subsetVolFields(subsetter, vectorNames, vectorFlds);
294 sphericalTensorNames.size()
296 subsetVolFields(subsetter, sphericalTensorNames, sphericalTensorFlds);
300 subsetVolFields(subsetter, symmTensorNames, symmTensorFlds);
304 subsetVolFields(subsetter, tensorNames, tensorFlds);
312 subsetSurfaceFields(subsetter, surfScalarNames, surfScalarFlds);
316 subsetSurfaceFields(subsetter, surfVectorNames, surfVectorFlds);
324 surfSphericalTensorNames.size()
329 surfSphericalTensorNames,
330 surfSphericalTensorFlds
339 surfSymmTensorNames.size()
341 subsetSurfaceFields(subsetter, surfSymmTensorNames, surfSymmTensorFlds);
345 subsetSurfaceFields(subsetter, surfTensorNames, surfTensorFlds);
355 subsetPointFields(subsetter, pMesh, pointScalarNames, pointScalarFlds);
359 subsetPointFields(subsetter, pMesh, pointVectorNames, pointVectorFlds);
367 pointSphericalTensorNames.size()
373 pointSphericalTensorNames,
374 pointSphericalTensorFlds
383 pointSymmTensorNames.size()
389 pointSymmTensorNames,
395 subsetPointFields(subsetter, pMesh, pointTensorNames, pointTensorFlds);
402 wordList scalarDimNames(objects.names(dimScalType::typeName));
404 subsetDimensionedFields(subsetter, scalarDimNames, scalarDimFlds);
407 wordList vectorDimNames(objects.names(dimVecType::typeName));
409 subsetDimensionedFields(subsetter, vectorDimNames, vectorDimFlds);
412 wordList sphericalTensorDimNames(objects.names(dimSphereType::typeName));
415 sphericalTensorDimNames.size()
417 subsetDimensionedFields
420 sphericalTensorDimNames,
421 sphericalTensorDimFlds
425 wordList symmTensorDimNames(objects.names(dimSymmTensorType::typeName));
427 subsetDimensionedFields(subsetter, symmTensorDimNames, symmTensorDimFlds);
430 wordList tensorDimNames(objects.names(dimTensorType::typeName));
432 subsetDimensionedFields(subsetter, tensorDimNames, tensorDimFlds);
438 if (overwrite || specifiedInstance)
440 runTime.setTime(
instant(fieldsInstance), 0);
448 Info<<
"Writing subsetted mesh and fields to time " << runTime.timeName()
456 scalarFlds[i].rename(scalarNames[i]);
457 scalarFlds[i].write();
461 vectorFlds[i].rename(vectorNames[i]);
462 vectorFlds[i].write();
464 forAll(sphericalTensorFlds, i)
466 sphericalTensorFlds[i].rename(sphericalTensorNames[i]);
467 sphericalTensorFlds[i].write();
471 symmTensorFlds[i].rename(symmTensorNames[i]);
472 symmTensorFlds[i].write();
476 tensorFlds[i].rename(tensorNames[i]);
477 tensorFlds[i].write();
483 surfScalarFlds[i].rename(surfScalarNames[i]);
484 surfScalarFlds[i].write();
488 surfVectorFlds[i].rename(surfVectorNames[i]);
489 surfVectorFlds[i].write();
491 forAll(surfSphericalTensorFlds, i)
493 surfSphericalTensorFlds[i].rename(surfSphericalTensorNames[i]);
494 surfSphericalTensorFlds[i].write();
496 forAll(surfSymmTensorFlds, i)
498 surfSymmTensorFlds[i].rename(surfSymmTensorNames[i]);
499 surfSymmTensorFlds[i].write();
501 forAll(surfTensorNames, i)
503 surfTensorFlds[i].rename(surfTensorNames[i]);
504 surfTensorFlds[i].write();
508 forAll(pointScalarFlds, i)
510 pointScalarFlds[i].rename(pointScalarNames[i]);
511 pointScalarFlds[i].write();
513 forAll(pointVectorFlds, i)
515 pointVectorFlds[i].rename(pointVectorNames[i]);
516 pointVectorFlds[i].write();
518 forAll(pointSphericalTensorFlds, i)
520 pointSphericalTensorFlds[i].rename(pointSphericalTensorNames[i]);
521 pointSphericalTensorFlds[i].write();
523 forAll(pointSymmTensorFlds, i)
525 pointSymmTensorFlds[i].rename(pointSymmTensorNames[i]);
526 pointSymmTensorFlds[i].write();
528 forAll(pointTensorNames, i)
530 pointTensorFlds[i].rename(pointTensorNames[i]);
531 pointTensorFlds[i].write();
537 scalarDimFlds[i].rename(scalarDimNames[i]);
538 scalarDimFlds[i].write();
542 vectorDimFlds[i].rename(vectorDimNames[i]);
543 vectorDimFlds[i].write();
545 forAll(sphericalTensorDimFlds, i)
547 sphericalTensorDimFlds[i].rename(sphericalTensorDimNames[i]);
548 sphericalTensorDimFlds[i].write();
550 forAll(symmTensorDimFlds, i)
552 symmTensorDimFlds[i].rename(symmTensorDimNames[i]);
553 symmTensorDimFlds[i].write();
557 tensorDimFlds[i].rename(tensorDimNames[i]);
558 tensorDimFlds[i].write();
#define forAll(list, i)
Loop across all elements in list.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
List of IOobjects with searching and retrieving facilities.
errorManipArg< error, int > exit(error &err, const int errNo=1)
wordList names() const
Return a list of patch names.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
static const char *const typeName
bool optionReadIfPresent(const word &opt, T &) const
Read a value from the named option if present.
static word defaultRegion
Return the default region name.
Ostream & endl(Ostream &os)
Add newline and flush stream.
static SLList< string > validArgs
A list of valid (mandatory) arguments.
Generic GeometricField class.
static word timeName(const scalar, const int precision=precision_)
Return time name of given scalar time.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
const fvMesh & subMesh() const
Return reference to subset mesh.
static const pointMesh & New(const polyMesh &mesh)
Mesh representing a set of points created from polyMesh.
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){gmvFile<< iter().position().x()<< ' ';}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){gmvFile<< iter().position().y()<< ' ';}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){gmvFile<< iter().position().z()<< ' ';}gmvFile<< nl;forAll(lagrangianScalarNames, i){const word &name=lagrangianScalarNames[i];IOField< scalar > fld(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
bool optionFound(const word &opt) const
Return true if the named option is found.
A class for handling words, derived from string.
static void addOption(const word &opt, const string ¶m="", const string &usage="")
Add to an option to validOptions with usage information.
Post-processing mesh subset tool. Given the original mesh and the list of selected cells...
void setInstance(const fileName &)
Set the instance for mesh files.
An instant of time. Contains the time value and name.
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
const fileName & pointsInstance() const
Return the current instance directory for points.
A collection of cell labels.
Mesh data needed to do the Finite Volume discretisation.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
const fvMesh & baseMesh() const
Original mesh.
static void addNote(const string &)
Add extra notes for the usage information.
Foam::argList args(argc, argv)
label findPatchID(const word &patchName) const
Find patch index given a name.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
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.
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.
virtual bool write() const
Write mesh using IO settings from time.
const Time & time() const
Return the top-level database.