From ac0eea9610fe40afa806ae49e32d9b15c115e18f Mon Sep 17 00:00:00 2001 From: Henry Weller Date: Sat, 13 Aug 2022 16:32:19 +0100 Subject: [PATCH] polyCellSet: General cell set selection class Description General cell set selection class for models that apply to sub-sets of the mesh. Currently supports cell selection from a set of points, a specified cellSet or cellZone or all of the cells. The selection method can either be specified explicitly using the \c selectionMode entry or inferred from the presence of either a \c cellSet, \c cellZone or \c points entry. The \c selectionMode entry is required to select \c all cells. Usage Examples: \verbatim // Apply everywhere selectionMode all; // Apply within a given cellSet selectionMode cellSet; // Optional cellSet rotor; // Apply within a given cellZone selectionMode cellZone; // Optional cellSet rotor; // Apply in cells containing a list of points selectionMode points; // Optional points ( (2.25 0.5 0) (2.75 0.5 0) ); \endverbatim Also used as the base-class for fvCellSet which additionally provides and maintains the volume of the cell set. --- .../solidBodyMotionSolver.C | 60 +---- src/finiteVolume/fvMesh/fvCellSet/fvCellSet.C | 183 ++----------- src/finiteVolume/fvMesh/fvCellSet/fvCellSet.H | 57 +---- .../fvMesh/fvCellSet/fvCellSetI.H | 21 +- .../actuationDiskSource/actuationDiskSource.C | 63 ++--- .../effectivenessHeatExchangerSource.C | 2 +- .../radialActuationDiskSource.C | 40 ++- src/meshTools/Make/files | 2 + src/meshTools/sets/polyCellSet/polyCellSet.C | 242 ++++++++++++++++++ src/meshTools/sets/polyCellSet/polyCellSet.H | 193 ++++++++++++++ src/meshTools/sets/polyCellSet/polyCellSetI.H | 47 ++++ .../rotor2DRotating/constant/dynamicMeshDict | 2 + .../sloshingTank2D/constant/dynamicMeshDict | 2 + .../sloshingCylinder/constant/dynamicMeshDict | 2 + .../sloshingTank2D/constant/dynamicMeshDict | 2 + .../constant/dynamicMeshDict | 2 + .../sloshingTank3D/constant/dynamicMeshDict | 2 + .../constant/dynamicMeshDict | 2 + .../constant/dynamicMeshDict | 2 + .../testTubeMixer/constant/dynamicMeshDict | 2 + 20 files changed, 577 insertions(+), 351 deletions(-) create mode 100644 src/meshTools/sets/polyCellSet/polyCellSet.C create mode 100644 src/meshTools/sets/polyCellSet/polyCellSet.H create mode 100644 src/meshTools/sets/polyCellSet/polyCellSetI.H diff --git a/src/dynamicMesh/motionSolvers/displacement/solidBody/solidBodyMotionSolver/solidBodyMotionSolver.C b/src/dynamicMesh/motionSolvers/displacement/solidBody/solidBodyMotionSolver/solidBodyMotionSolver.C index d753558dfa..1751a8a0dd 100644 --- a/src/dynamicMesh/motionSolvers/displacement/solidBody/solidBodyMotionSolver/solidBodyMotionSolver.C +++ b/src/dynamicMesh/motionSolvers/displacement/solidBody/solidBodyMotionSolver/solidBodyMotionSolver.C @@ -24,13 +24,11 @@ License \*---------------------------------------------------------------------------*/ #include "solidBodyMotionSolver.H" -#include "addToRunTimeSelectionTable.H" +#include "polyCellSet.H" #include "transformField.H" -#include "meshCellZones.H" -#include "cellSet.H" -#include "boolList.H" #include "syncTools.H" #include "polyTopoChangeMap.H" +#include "addToRunTimeSelectionTable.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -61,52 +59,10 @@ Foam::solidBodyMotionSolver::solidBodyMotionSolver moveAllCells_(false), transform_(SBMFPtr_().transformation()) { - const word cellZoneName = - coeffDict().lookupOrDefault("cellZone", "none"); + const labelList cellIDs(polyCellSet(mesh, dict).cells()); - const word cellSetName = - coeffDict().lookupOrDefault("cellSet", "none"); - - if ((cellZoneName != "none") && (cellSetName != "none")) - { - FatalIOErrorInFunction(coeffDict()) - << "Either cellZone OR cellSet can be supplied, but not both. " - << "If neither is supplied, all cells will be included" - << exit(FatalIOError); - } - - labelList cellIDs; - if (cellZoneName != "none") - { - Info<< "Applying solid body motion to cellZone " << cellZoneName - << endl; - - label zoneID = mesh.cellZones().findZoneID(cellZoneName); - - if (zoneID == -1) - { - FatalErrorInFunction - << "Unable to find cellZone " << cellZoneName - << ". Valid cellZones are:" - << mesh.cellZones().names() - << exit(FatalError); - } - - cellIDs = mesh.cellZones()[zoneID]; - } - - if (cellSetName != "none") - { - Info<< "Applying solid body motion to cellSet " << cellSetName - << endl; - - cellSet set(mesh, cellSetName); - - cellIDs = set.toc(); - } - - const label nCells = returnReduce(cellIDs.size(), sumOp