64 Info<<
"Subsetting field " << fieldName <<
endl;
85 void subsetSurfaceFields
98 Info<<
"Subsetting field " << fieldName <<
endl;
119 void subsetPointFields
133 Info<<
"Subsetting field " << fieldName <<
endl;
154 void subsetDimensionedFields
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"
228 word meshInstance = mesh.pointsInstance();
229 word fieldsInstance = runTime.name();
237 if (specifiedInstance)
240 meshInstance = fieldsInstance;
245 Info<<
"Reading cell set from " << setName <<
endl <<
endl;
254 const word patchName =
args[
"patch"];
256 patchi = mesh.boundaryMesh().findIndex(patchName);
261 <<
nl <<
"Valid patches are " << mesh.boundaryMesh().names()
265 Info<<
"Adding exposed internal faces to patch " << patchName <<
endl
270 Info<<
"Adding exposed internal faces to a patch called"
271 <<
" \"oldInternalFaces\" (created if necessary)" <<
endl
276 cellSet currentSet(mesh, setName);
289 subsetVolFields(subsetter, scalarNames, scalarFlds);
293 subsetVolFields(subsetter, vectorNames, vectorFlds);
301 sphericalTensorNames.size()
303 subsetVolFields(subsetter, sphericalTensorNames, sphericalTensorFlds);
307 subsetVolFields(subsetter, symmTensorNames, symmTensorFlds);
311 subsetVolFields(subsetter, tensorNames, tensorFlds);
319 subsetSurfaceFields(subsetter, surfScalarNames, surfScalarFlds);
323 subsetSurfaceFields(subsetter, surfVectorNames, surfVectorFlds);
331 surfSphericalTensorNames.size()
336 surfSphericalTensorNames,
337 surfSphericalTensorFlds
346 surfSymmTensorNames.size()
348 subsetSurfaceFields(subsetter, surfSymmTensorNames, surfSymmTensorFlds);
352 subsetSurfaceFields(subsetter, surfTensorNames, surfTensorFlds);
362 subsetPointFields(subsetter, pMesh, pointScalarNames, pointScalarFlds);
366 subsetPointFields(subsetter, pMesh, pointVectorNames, pointVectorFlds);
374 pointSphericalTensorNames.size()
380 pointSphericalTensorNames,
381 pointSphericalTensorFlds
390 pointSymmTensorNames.size()
396 pointSymmTensorNames,
402 subsetPointFields(subsetter, pMesh, pointTensorNames, pointTensorFlds);
411 subsetDimensionedFields(subsetter, scalarDimNames, scalarDimFlds);
416 subsetDimensionedFields(subsetter, vectorDimNames, vectorDimFlds);
421 objects.names(dimSphereType::typeName)
425 sphericalTensorDimNames.size()
427 subsetDimensionedFields
430 sphericalTensorDimNames,
431 sphericalTensorDimFlds
435 wordList symmTensorDimNames(
objects.names(dimSymmTensorType::typeName));
437 subsetDimensionedFields
447 subsetDimensionedFields(subsetter, tensorDimNames, tensorDimFlds);
453 if (overwrite || specifiedInstance)
455 runTime.setTime(
instant(fieldsInstance), 0);
463 Info<<
"Writing subsetted mesh and fields to time "
464 << runTime.name() <<
endl;
471 scalarFlds[i].rename(scalarNames[i]);
472 scalarFlds[i].write();
476 vectorFlds[i].rename(vectorNames[i]);
477 vectorFlds[i].write();
479 forAll(sphericalTensorFlds, i)
481 sphericalTensorFlds[i].rename(sphericalTensorNames[i]);
482 sphericalTensorFlds[i].write();
486 symmTensorFlds[i].rename(symmTensorNames[i]);
487 symmTensorFlds[i].write();
491 tensorFlds[i].rename(tensorNames[i]);
492 tensorFlds[i].write();
498 surfScalarFlds[i].rename(surfScalarNames[i]);
499 surfScalarFlds[i].write();
503 surfVectorFlds[i].rename(surfVectorNames[i]);
504 surfVectorFlds[i].write();
506 forAll(surfSphericalTensorFlds, i)
508 surfSphericalTensorFlds[i].rename(surfSphericalTensorNames[i]);
509 surfSphericalTensorFlds[i].write();
511 forAll(surfSymmTensorFlds, i)
513 surfSymmTensorFlds[i].rename(surfSymmTensorNames[i]);
514 surfSymmTensorFlds[i].write();
516 forAll(surfTensorNames, i)
518 surfTensorFlds[i].rename(surfTensorNames[i]);
519 surfTensorFlds[i].write();
523 forAll(pointScalarFlds, i)
525 pointScalarFlds[i].rename(pointScalarNames[i]);
526 pointScalarFlds[i].write();
528 forAll(pointVectorFlds, i)
530 pointVectorFlds[i].rename(pointVectorNames[i]);
531 pointVectorFlds[i].write();
533 forAll(pointSphericalTensorFlds, i)
535 pointSphericalTensorFlds[i].rename(pointSphericalTensorNames[i]);
536 pointSphericalTensorFlds[i].write();
538 forAll(pointSymmTensorFlds, i)
540 pointSymmTensorFlds[i].rename(pointSymmTensorNames[i]);
541 pointSymmTensorFlds[i].write();
543 forAll(pointTensorNames, i)
545 pointTensorFlds[i].rename(pointTensorNames[i]);
546 pointTensorFlds[i].write();
552 scalarDimFlds[i].rename(scalarDimNames[i]);
553 scalarDimFlds[i].write();
557 vectorDimFlds[i].rename(vectorDimNames[i]);
558 vectorDimFlds[i].write();
560 forAll(sphericalTensorDimFlds, i)
562 sphericalTensorDimFlds[i].rename(sphericalTensorDimNames[i]);
563 sphericalTensorDimFlds[i].write();
565 forAll(symmTensorDimFlds, i)
567 symmTensorDimFlds[i].rename(symmTensorDimNames[i]);
568 symmTensorDimFlds[i].write();
572 tensorDimFlds[i].rename(tensorDimNames[i]);
573 tensorDimFlds[i].write();
581 if (overwrite || specifiedInstance)
583 runTime.setTime(
instant(fieldsInstance), 0);
591 Info<<
"Writing subsetted mesh to time "
592 << runTime.name() <<
endl;
#define forAll(list, i)
Loop across all elements in list.
static pointMesh & New(const word &name, const polyMesh &mesh)
Construct and return the named DemandDrivenMeshObject.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
static const char *const typeName
Generic GeometricField class.
List of IOobjects with searching and retrieving facilities.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
static void addOption(const word &opt, const string ¶m="", const string &usage="")
Add to an option to validOptions with usage information.
static void addNote(const string &)
Add extra notes for the usage information.
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.
bool optionReadIfPresent(const word &opt, T &) const
Read a value from the named option if present.
static SLList< string > validArgs
A list of valid (mandatory) arguments.
A collection of cell labels.
const word & name() const
Return const reference to name.
Post-processing mesh subset tool. Given the original mesh and the list of selected cells,...
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.
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 Time & time() const
Return the top-level database.
virtual bool write(const bool write=true) const
Write mesh using IO settings from time.
An instant of time. Contains the time value and name.
Mesh representing a set of points created from polyMesh.
static word defaultRegion
Return the default region name.
void setInstance(const fileName &)
Set the instance for mesh files.
A class for handling words, derived from string.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
int main(int argc, char *argv[])
static List< word > fieldNames
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))
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
errorManipArg< error, int > exit(error &err, const int errNo=1)
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.
Foam::argList args(argc, argv)