subsetMesh: Added -noFields option
With the -noFields option the mesh is subset but the fields are not changed. This is useful when the field fields have been created to correspond to the mesh after the mesh subset.
This commit is contained in:
@ -208,6 +208,12 @@ int main(int argc, char *argv[])
|
||||
"time",
|
||||
"specify a time for the resulting mesh"
|
||||
);
|
||||
argList::addBoolOption
|
||||
(
|
||||
"noFields",
|
||||
"do not update fields"
|
||||
);
|
||||
|
||||
#include "setRootCase.H"
|
||||
#include "createTime.H"
|
||||
runTime.functionObjects().off();
|
||||
@ -234,6 +240,7 @@ int main(int argc, char *argv[])
|
||||
// Set both mesh and field to this time
|
||||
meshInstance = fieldsInstance;
|
||||
}
|
||||
const bool fields = !args.optionFound("noFields");
|
||||
|
||||
|
||||
Info<< "Reading cell set from " << setName << endl << endl;
|
||||
@ -268,11 +275,12 @@ int main(int argc, char *argv[])
|
||||
|
||||
|
||||
cellSet currentSet(mesh, setName);
|
||||
|
||||
subsetter.setLargeCellSubset(currentSet, patchi, true);
|
||||
|
||||
IOobjectList objects(mesh, runTime.timeName());
|
||||
|
||||
if (fields)
|
||||
{
|
||||
IOobjectList objects(mesh, runTime.timeName());
|
||||
|
||||
// Read vol fields and subset
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
@ -409,7 +417,10 @@ int main(int argc, char *argv[])
|
||||
subsetDimensionedFields(subsetter, vectorDimNames, vectorDimFlds);
|
||||
|
||||
typedef volSphericalTensorField::Internal dimSphereType;
|
||||
wordList sphericalTensorDimNames(objects.names(dimSphereType::typeName));
|
||||
wordList sphericalTensorDimNames
|
||||
(
|
||||
objects.names(dimSphereType::typeName)
|
||||
);
|
||||
PtrList<dimSphereType> sphericalTensorDimFlds
|
||||
(
|
||||
sphericalTensorDimNames.size()
|
||||
@ -424,7 +435,12 @@ int main(int argc, char *argv[])
|
||||
typedef volSymmTensorField::Internal dimSymmTensorType;
|
||||
wordList symmTensorDimNames(objects.names(dimSymmTensorType::typeName));
|
||||
PtrList<dimSymmTensorType> symmTensorDimFlds(symmTensorDimNames.size());
|
||||
subsetDimensionedFields(subsetter, symmTensorDimNames, symmTensorDimFlds);
|
||||
subsetDimensionedFields
|
||||
(
|
||||
subsetter,
|
||||
symmTensorDimNames,
|
||||
symmTensorDimFlds
|
||||
);
|
||||
|
||||
typedef volTensorField::Internal dimTensorType;
|
||||
wordList tensorDimNames(objects.names(dimTensorType::typeName));
|
||||
@ -445,10 +461,10 @@ int main(int argc, char *argv[])
|
||||
runTime++;
|
||||
}
|
||||
|
||||
Info<< "Writing subsetted mesh and fields to time " << runTime.timeName()
|
||||
<< endl;
|
||||
subsetter.subMesh().write();
|
||||
Info<< "Writing subsetted mesh and fields to time "
|
||||
<< runTime.timeName() << endl;
|
||||
|
||||
subsetter.subMesh().write();
|
||||
|
||||
// Subsetting adds 'subset' prefix. Rename field to be like original.
|
||||
forAll(scalarFlds, i)
|
||||
@ -557,7 +573,27 @@ int main(int argc, char *argv[])
|
||||
tensorDimFlds[i].rename(tensorDimNames[i]);
|
||||
tensorDimFlds[i].write();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Write mesh to new time
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
if (overwrite || specifiedInstance)
|
||||
{
|
||||
runTime.setTime(instant(fieldsInstance), 0);
|
||||
subsetter.subMesh().setInstance(meshInstance);
|
||||
}
|
||||
else
|
||||
{
|
||||
runTime++;
|
||||
}
|
||||
|
||||
Info<< "Writing subsetted mesh to time "
|
||||
<< runTime.timeName() << endl;
|
||||
|
||||
subsetter.subMesh().write();
|
||||
}
|
||||
|
||||
Info<< "End\n" << endl;
|
||||
|
||||
|
||||
@ -6,16 +6,16 @@ cd ${0%/*} || exit 1 # Run from this directory
|
||||
|
||||
rm -rf 0
|
||||
|
||||
# create the underlying block mesh
|
||||
# Create the underlying block mesh
|
||||
runApplication blockMesh
|
||||
|
||||
# create the set for the obstacles
|
||||
# Create the set for the obstacles
|
||||
runApplication topoSet
|
||||
|
||||
# create the obstacles - add obstacle patches to wallFilm patch
|
||||
runApplication subsetMesh c0 -patch wallFilm -overwrite
|
||||
# Create the obstacles - add obstacle patches to wallFilm patch
|
||||
runApplication subsetMesh c0 -patch wallFilm -overwrite -noFields
|
||||
|
||||
# split the obstacle patches into cube[1-6]_patch[1-6]
|
||||
# Split the obstacle patches into cube[1-6]_patch[1-6]
|
||||
runApplication ./patchifyObstacles
|
||||
|
||||
# Create the wall film region via extrusion
|
||||
@ -25,9 +25,6 @@ runApplication extrudeToRegionMesh -overwrite
|
||||
rm -rf system/wallFilmRegion
|
||||
cp -r system/wallFilmRegion.orig system/wallFilmRegion
|
||||
|
||||
find ./0 -maxdepth 1 -type f -exec \
|
||||
sed -i -e "s/wallFilm/\"(region0_to.*)\"/g" {} \;
|
||||
|
||||
paraFoam -touch
|
||||
paraFoam -touch -region wallFilmRegion
|
||||
|
||||
|
||||
@ -9,7 +9,7 @@ application=$(getApplication)
|
||||
|
||||
runApplication blockMesh
|
||||
runApplication topoSet
|
||||
runApplication subsetMesh -overwrite c0 -patch floatingObject
|
||||
runApplication subsetMesh -overwrite c0 -patch floatingObject -noFields
|
||||
runApplication setFields
|
||||
runApplication $application
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ cd ${0%/*} || exit 1 # Run from this directory
|
||||
|
||||
runApplication blockMesh
|
||||
runApplication topoSet
|
||||
runApplication subsetMesh -overwrite c0 -patch walls
|
||||
runApplication subsetMesh -overwrite c0 -patch walls -noFields
|
||||
runApplication setFields
|
||||
runApplication $(getApplication)
|
||||
|
||||
|
||||
@ -11,7 +11,7 @@ runApplication blockMesh
|
||||
|
||||
runApplication -s 1 topoSet
|
||||
|
||||
runApplication subsetMesh -overwrite c0 -patch floatingObject
|
||||
runApplication subsetMesh -overwrite c0 -patch floatingObject -noFields
|
||||
|
||||
runApplication -s selectBottom \
|
||||
topoSet -dict system/topoSetDict-selectBottom
|
||||
|
||||
@ -9,7 +9,7 @@ application=$(getApplication)
|
||||
|
||||
runApplication blockMesh
|
||||
runApplication topoSet
|
||||
runApplication subsetMesh -overwrite c0 -patch floatingObject
|
||||
runApplication subsetMesh -overwrite c0 -patch floatingObject -noFields
|
||||
|
||||
runApplication $application
|
||||
|
||||
|
||||
Reference in New Issue
Block a user