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" 214 "do not update fields" 219 runTime.functionObjects().off();
230 word fieldsInstance = runTime.timeName();
238 if (specifiedInstance)
241 meshInstance = fieldsInstance;
246 Info<<
"Reading cell set from " << setName << endl <<
endl;
255 const word patchName =
args[
"patch"];
266 Info<<
"Adding exposed internal faces to patch " << patchName << endl
271 Info<<
"Adding exposed internal faces to a patch called" 272 <<
" \"oldInternalFaces\" (created if necessary)" << endl
290 subsetVolFields(subsetter, scalarNames, scalarFlds);
294 subsetVolFields(subsetter, vectorNames, vectorFlds);
302 sphericalTensorNames.size()
304 subsetVolFields(subsetter, sphericalTensorNames, sphericalTensorFlds);
308 subsetVolFields(subsetter, symmTensorNames, symmTensorFlds);
312 subsetVolFields(subsetter, tensorNames, tensorFlds);
320 subsetSurfaceFields(subsetter, surfScalarNames, surfScalarFlds);
324 subsetSurfaceFields(subsetter, surfVectorNames, surfVectorFlds);
332 surfSphericalTensorNames.size()
337 surfSphericalTensorNames,
338 surfSphericalTensorFlds
347 surfSymmTensorNames.size()
349 subsetSurfaceFields(subsetter, surfSymmTensorNames, surfSymmTensorFlds);
353 subsetSurfaceFields(subsetter, surfTensorNames, surfTensorFlds);
363 subsetPointFields(subsetter, pMesh, pointScalarNames, pointScalarFlds);
367 subsetPointFields(subsetter, pMesh, pointVectorNames, pointVectorFlds);
375 pointSphericalTensorNames.size()
381 pointSphericalTensorNames,
382 pointSphericalTensorFlds
391 pointSymmTensorNames.size()
397 pointSymmTensorNames,
403 subsetPointFields(subsetter, pMesh, pointTensorNames, pointTensorFlds);
412 subsetDimensionedFields(subsetter, scalarDimNames, scalarDimFlds);
417 subsetDimensionedFields(subsetter, vectorDimNames, vectorDimFlds);
422 objects.names(dimSphereType::typeName)
426 sphericalTensorDimNames.size()
428 subsetDimensionedFields
431 sphericalTensorDimNames,
432 sphericalTensorDimFlds
436 wordList symmTensorDimNames(
objects.names(dimSymmTensorType::typeName));
438 subsetDimensionedFields
448 subsetDimensionedFields(subsetter, tensorDimNames, tensorDimFlds);
454 if (overwrite || specifiedInstance)
456 runTime.setTime(
instant(fieldsInstance), 0);
464 Info<<
"Writing subsetted mesh and fields to time " 465 << runTime.timeName() <<
endl;
472 scalarFlds[i].rename(scalarNames[i]);
473 scalarFlds[i].write();
477 vectorFlds[i].rename(vectorNames[i]);
478 vectorFlds[i].write();
480 forAll(sphericalTensorFlds, i)
482 sphericalTensorFlds[i].rename(sphericalTensorNames[i]);
483 sphericalTensorFlds[i].write();
487 symmTensorFlds[i].rename(symmTensorNames[i]);
488 symmTensorFlds[i].write();
492 tensorFlds[i].rename(tensorNames[i]);
493 tensorFlds[i].write();
499 surfScalarFlds[i].rename(surfScalarNames[i]);
500 surfScalarFlds[i].write();
504 surfVectorFlds[i].rename(surfVectorNames[i]);
505 surfVectorFlds[i].write();
507 forAll(surfSphericalTensorFlds, i)
509 surfSphericalTensorFlds[i].rename(surfSphericalTensorNames[i]);
510 surfSphericalTensorFlds[i].write();
512 forAll(surfSymmTensorFlds, i)
514 surfSymmTensorFlds[i].rename(surfSymmTensorNames[i]);
515 surfSymmTensorFlds[i].write();
517 forAll(surfTensorNames, i)
519 surfTensorFlds[i].rename(surfTensorNames[i]);
520 surfTensorFlds[i].write();
524 forAll(pointScalarFlds, i)
526 pointScalarFlds[i].rename(pointScalarNames[i]);
527 pointScalarFlds[i].write();
529 forAll(pointVectorFlds, i)
531 pointVectorFlds[i].rename(pointVectorNames[i]);
532 pointVectorFlds[i].write();
534 forAll(pointSphericalTensorFlds, i)
536 pointSphericalTensorFlds[i].rename(pointSphericalTensorNames[i]);
537 pointSphericalTensorFlds[i].write();
539 forAll(pointSymmTensorFlds, i)
541 pointSymmTensorFlds[i].rename(pointSymmTensorNames[i]);
542 pointSymmTensorFlds[i].write();
544 forAll(pointTensorNames, i)
546 pointTensorFlds[i].rename(pointTensorNames[i]);
547 pointTensorFlds[i].write();
553 scalarDimFlds[i].rename(scalarDimNames[i]);
554 scalarDimFlds[i].write();
558 vectorDimFlds[i].rename(vectorDimNames[i]);
559 vectorDimFlds[i].write();
561 forAll(sphericalTensorDimFlds, i)
563 sphericalTensorDimFlds[i].rename(sphericalTensorDimNames[i]);
564 sphericalTensorDimFlds[i].write();
566 forAll(symmTensorDimFlds, i)
568 symmTensorDimFlds[i].rename(symmTensorDimNames[i]);
569 symmTensorDimFlds[i].write();
573 tensorDimFlds[i].rename(tensorDimNames[i]);
574 tensorDimFlds[i].write();
582 if (overwrite || specifiedInstance)
584 runTime.setTime(
instant(fieldsInstance), 0);
592 Info<<
"Writing subsetted mesh to time " 593 << runTime.timeName() <<
endl;
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
#define forAll(list, i)
Loop across all elements in list.
List of IOobjects with searching and retrieving facilities.
errorManipArg< error, int > exit(error &err, const int errNo=1)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
static const char *const typeName
static word defaultRegion
Return the default region name.
Ostream & endl(Ostream &os)
Add newline and flush stream.
bool optionFound(const word &opt) const
Return true if the named option is found.
label findPatchID(const word &patchName) const
Find patch index given a name.
static SLList< string > validArgs
A list of valid (mandatory) arguments.
Generic GeometricField class.
const Time & time() const
Return the top-level database.
virtual bool write(const bool write=true) const
Write mesh using IO settings from time.
bool optionReadIfPresent(const word &opt, T &) const
Read a value from the named option if present.
Mesh representing a set of points created from polyMesh.
const fvMesh & subMesh() const
Return reference to subset mesh.
const fileName & pointsInstance() const
Return the current instance directory for points.
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))
static word timeName(const scalar, const int precision=curPrecision_)
Return time name of given scalar time.
A class for handling words, derived from string.
wordList names() const
Return a list of patch names.
static void addOption(const word &opt, const string ¶m="", const string &usage="")
Add to an option to validOptions with usage information.
static pointMesh & New(polyMesh &mesh)
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.
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.
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.
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...
static void addBoolOption(const word &opt, const string &usage="")
Add to a bool option to validOptions with usage information.
static void addNote(const string &)
Add extra notes for the usage information.
Foam::argList args(argc, argv)
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
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.