From 3ef4c803cd8558a38462f427437f3d85cc713683 Mon Sep 17 00:00:00 2001 From: Will Bainbridge Date: Mon, 14 May 2018 15:20:05 +0100 Subject: [PATCH] sampledSet: Consistent renaming, documentation, and code maintenance The sampled sets have been renamed in a more explicit and consistent manner, and two new ones have also been added. The available sets are as follows: arcUniform: Uniform samples along an arc. Replaces "circle", and adds the ability to sample along only a part of the circle's circumference. Example: { type arcUniform; centre (0.95 0 0.25); normal (1 0 0); radial (0 0 0.25); startAngle -1.57079633; endAngle 0.52359878; nPoints 200; axis x; } boundaryPoints: Specified point samples associated with a subset of the boundary. Replaces "patchCloud". Example: { type boundaryPoints; patches (inlet1 inlet2); points ((0 -0.05 0.05) (0 -0.05 0.1) (0 -0.05 0.15)); maxDistance 0.01; axis x; } boundaryRandom: Random samples within a subset of the boundary. Replaces "patchSeed", but changes the behaviour to be entirely random. It does not seed the boundary face centres first. Example: { type boundaryRandom; patches (inlet1 inlet2); nPoints 1000; axis x; } boxUniform: Uniform grid of samples within a axis-aligned box. Replaces "array". Example: { type boxUniform; box (0.95 0 0.25) (1.2 0.25 0.5); nPoints (2 4 6); axis x; } circleRandom: Random samples within a circle. New. Example: { type circleRandom; centre (0.95 0 0.25); normal (1 0 0); radius 0.25; nPoints 200; axis x; } lineFace: Face-intersections along a line. Replaces "face". Example: { type lineFace; start (0.6 0.6 0.5); end (0.6 -0.3 -0.1); axis x; } lineCell: Cell-samples along a line at the mid-points in-between face-intersections. Replaces "midPoint". Example: { type lineCell; start (0.5 0.6 0.5); end (0.5 -0.3 -0.1); axis x; } lineCellFace: Combination of "lineFace" and "lineCell". Replaces "midPointAndFace". Example: { type lineCellFace; start (0.55 0.6 0.5); end (0.55 -0.3 -0.1); axis x; } lineUniform: Uniform samples along a line. Replaces "uniform". Example: { type lineUniform; start (0.65 0.3 0.3); end (0.65 -0.3 -0.1); nPoints 200; axis x; } points: Specified points. Replaces "cloud" when the ordered flag is false, and "polyLine" when the ordered flag is true. Example: { type points; points ((0 -0.05 0.05) (0 -0.05 0.1) (0 -0.05 0.15)); ordered yes; axis x; } sphereRandom: Random samples within a sphere. New. Example: { type sphereRandom; centre (0.95 0 0.25); radius 0.25; nPoints 200; axis x; } triSurfaceMesh: Samples from all the points of a triSurfaceMesh. Replaces "triSurfaceMeshPointSet". Example: { type triSurfaceMesh; surface "surface.stl"; axis x; } The headers have also had documentation added. Example usage and a description of the control parameters now exists for all sets. In addition, a number of the algorithms which generate the sets have been refactored or rewritten. This was done either to take advantage of the recent changes to random number generation, or to remove ad-hoc fixes that were made unnecessary by the barycentric tracking algorithm. --- .../postProcessing/graphs/sampleDict.cfg | 4 +- .../postProcessing/graphs/singleGraph | 2 +- .../probes/{boundaryCloud => boundaryPoints} | 4 +- .../{boundaryCloud.cfg => boundaryPoints.cfg} | 6 +- .../probes/{internalCloud => internalPoints} | 4 +- .../{internalCloud.cfg => internalPoints.cfg} | 6 +- .../probes/{cloud.cfg => points.cfg} | 0 .../visualization/streamlines.cfg | 2 +- etc/templates/axisymmetricJet/system/graph | 2 +- .../field/interfaceHeight/interfaceHeight.C | 4 +- .../field/interfaceHeight/interfaceHeight.H | 4 +- src/sampling/Make/files | 23 +- .../sampledSet/arcUniform/arcUniformSet.C | 148 ++++++ .../sampledSet/arcUniform/arcUniformSet.H | 150 ++++++ .../boundaryPointsSet.C} | 202 +++----- .../boundaryPointsSet.H} | 71 ++- .../boundaryRandom/boundaryRandomSet.C | 248 ++++++++++ .../boundaryRandomSet.H} | 64 +-- .../sampledSet/boxUniform/boxUniformSet.C | 148 ++++++ .../arraySet.H => boxUniform/boxUniformSet.H} | 63 +-- src/sampling/sampledSet/circle/circleSet.C | 243 --------- .../circleRandomSet.C} | 98 +--- .../sampledSet/circleRandom/circleRandomSet.H | 139 ++++++ src/sampling/sampledSet/face/faceOnlySet.C | 378 -------------- .../sampledSet/lineCell/lineCellSet.C | 217 +++++++++ .../faceOnlySet.H => lineCell/lineCellSet.H} | 117 ++--- .../sampledSet/lineCellFace/lineCellFaceSet.C | 199 ++++++++ .../lineCellFaceSet.H} | 105 ++-- .../sampledSet/lineFace/lineFaceSet.C | 251 ++++++++++ .../polyLineSet.H => lineFace/lineFaceSet.H} | 94 ++-- .../sampledSet/lineUniform/lineUniformSet.C | 158 ++++++ .../sampledSet/lineUniform/lineUniformSet.H | 135 +++++ .../sampledSet/midPoint/midPointSet.C | 150 ------ .../sampledSet/midPoint/midPointSet.H | 102 ---- .../midPointAndFace/midPointAndFaceSet.C | 170 ------- .../midPointAndFace/midPointAndFaceSet.H | 103 ---- .../sampledSet/patchSeed/patchSeedSet.C | 239 --------- src/sampling/sampledSet/points/pointsSet.C | 200 ++++++++ .../uniformSet.H => points/pointsSet.H} | 127 +++-- .../sampledSet/polyLine/polyLineSet.C | 387 --------------- .../sampledSet/sampledSet/sampledSet.C | 318 ------------ .../sampledSet/sampledSet/sampledSet.H | 50 +- .../sphereRandomSet.C} | 63 ++- .../sphereRandomSet.H} | 70 +-- .../triSurfaceMeshSet.C} | 73 +-- .../triSurfaceMeshSet.H} | 49 +- src/sampling/sampledSet/uniform/uniformSet.C | 460 ------------------ .../RAS/SandiaD_LTS/system/sampleDict | 162 ------ .../biconic25-55Run35/system/sample | 6 +- .../rhoCentralFoam/shockTube/system/sample | 2 +- .../sonicFoam/laminar/shockTube/system/sample | 2 +- .../mhdFoam/hartmann/system/sample | 2 +- .../buoyantCavity/system/sample | 18 +- .../laminar/planarContraction/system/graphs | 5 +- .../planarPoiseuille/system/singleGraph | 5 +- .../motorBike/motorBike/system/controlDict | 2 +- .../motorBike/motorBike/system/streamLines | 2 +- .../simpleFoam/motorBike/system/streamLines | 2 +- .../pitzDailyExptInlet/system/controlDict | 2 +- 59 files changed, 2596 insertions(+), 3464 deletions(-) rename etc/caseDicts/postProcessing/probes/{boundaryCloud => boundaryPoints} (82%) rename etc/caseDicts/postProcessing/probes/{boundaryCloud.cfg => boundaryPoints.cfg} (88%) rename etc/caseDicts/postProcessing/probes/{internalCloud => internalPoints} (80%) rename etc/caseDicts/postProcessing/probes/{internalCloud.cfg => internalPoints.cfg} (88%) rename etc/caseDicts/postProcessing/probes/{cloud.cfg => points.cfg} (100%) create mode 100644 src/sampling/sampledSet/arcUniform/arcUniformSet.C create mode 100644 src/sampling/sampledSet/arcUniform/arcUniformSet.H rename src/sampling/sampledSet/{patchCloud/patchCloudSet.C => boundaryPoints/boundaryPointsSet.C} (51%) rename src/sampling/sampledSet/{patchSeed/patchSeedSet.H => boundaryPoints/boundaryPointsSet.H} (64%) create mode 100644 src/sampling/sampledSet/boundaryRandom/boundaryRandomSet.C rename src/sampling/sampledSet/{patchCloud/patchCloudSet.H => boundaryRandom/boundaryRandomSet.H} (69%) create mode 100644 src/sampling/sampledSet/boxUniform/boxUniformSet.C rename src/sampling/sampledSet/{array/arraySet.H => boxUniform/boxUniformSet.H} (72%) delete mode 100644 src/sampling/sampledSet/circle/circleSet.C rename src/sampling/sampledSet/{array/arraySet.C => circleRandom/circleRandomSet.C} (60%) create mode 100644 src/sampling/sampledSet/circleRandom/circleRandomSet.H delete mode 100644 src/sampling/sampledSet/face/faceOnlySet.C create mode 100644 src/sampling/sampledSet/lineCell/lineCellSet.C rename src/sampling/sampledSet/{face/faceOnlySet.H => lineCell/lineCellSet.H} (60%) create mode 100644 src/sampling/sampledSet/lineCellFace/lineCellFaceSet.C rename src/sampling/sampledSet/{circle/circleSet.H => lineCellFace/lineCellFaceSet.H} (65%) create mode 100644 src/sampling/sampledSet/lineFace/lineFaceSet.C rename src/sampling/sampledSet/{polyLine/polyLineSet.H => lineFace/lineFaceSet.H} (68%) create mode 100644 src/sampling/sampledSet/lineUniform/lineUniformSet.C create mode 100644 src/sampling/sampledSet/lineUniform/lineUniformSet.H delete mode 100644 src/sampling/sampledSet/midPoint/midPointSet.C delete mode 100644 src/sampling/sampledSet/midPoint/midPointSet.H delete mode 100644 src/sampling/sampledSet/midPointAndFace/midPointAndFaceSet.C delete mode 100644 src/sampling/sampledSet/midPointAndFace/midPointAndFaceSet.H delete mode 100644 src/sampling/sampledSet/patchSeed/patchSeedSet.C create mode 100644 src/sampling/sampledSet/points/pointsSet.C rename src/sampling/sampledSet/{uniform/uniformSet.H => points/pointsSet.H} (59%) delete mode 100644 src/sampling/sampledSet/polyLine/polyLineSet.C rename src/sampling/sampledSet/{cloud/cloudSet.C => sphereRandom/sphereRandomSet.C} (72%) rename src/sampling/sampledSet/{cloud/cloudSet.H => sphereRandom/sphereRandomSet.H} (67%) rename src/sampling/sampledSet/{triSurfaceMeshPointSet/triSurfaceMeshPointSet.C => triSurfaceMesh/triSurfaceMeshSet.C} (67%) rename src/sampling/sampledSet/{triSurfaceMeshPointSet/triSurfaceMeshPointSet.H => triSurfaceMesh/triSurfaceMeshSet.H} (74%) delete mode 100644 src/sampling/sampledSet/uniform/uniformSet.C delete mode 100644 tutorials/combustion/reactingFoam/RAS/SandiaD_LTS/system/sampleDict diff --git a/etc/caseDicts/postProcessing/graphs/sampleDict.cfg b/etc/caseDicts/postProcessing/graphs/sampleDict.cfg index e1a67308b..0062a2284 100644 --- a/etc/caseDicts/postProcessing/graphs/sampleDict.cfg +++ b/etc/caseDicts/postProcessing/graphs/sampleDict.cfg @@ -12,8 +12,8 @@ setFormat raw; setConfig { - type uniform; // midPoint, midPointAndFace - axis distance; // x, y, z, xyz + type lineUniform; // lineCell, lineCellFace + axis distance; // x, y, z, xyz nPoints 100; } diff --git a/etc/caseDicts/postProcessing/graphs/singleGraph b/etc/caseDicts/postProcessing/graphs/singleGraph index 76389e688..8b8b416cc 100644 --- a/etc/caseDicts/postProcessing/graphs/singleGraph +++ b/etc/caseDicts/postProcessing/graphs/singleGraph @@ -19,7 +19,7 @@ fields (U p); #includeEtc "caseDicts/postProcessing/graphs/sampleDict.cfg" // Override settings here, e.g. -// setConfig { type midPoint; } +// setConfig { type lineCell; } // Must be last entry #includeEtc "caseDicts/postProcessing/graphs/graph.cfg" diff --git a/etc/caseDicts/postProcessing/probes/boundaryCloud b/etc/caseDicts/postProcessing/probes/boundaryPoints similarity index 82% rename from etc/caseDicts/postProcessing/probes/boundaryCloud rename to etc/caseDicts/postProcessing/probes/boundaryPoints index 5847972f1..8ca75c993 100644 --- a/etc/caseDicts/postProcessing/probes/boundaryCloud +++ b/etc/caseDicts/postProcessing/probes/boundaryPoints @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Description - Writes out values of fields at a cloud of points, interpolated to + Writes out values of fields at a specified list of points, interpolated to specified boundary patches. \*---------------------------------------------------------------------------*/ @@ -22,6 +22,6 @@ maxDistance 0.1; patches (".*"); -#includeEtc "caseDicts/postProcessing/probes/boundaryCloud.cfg" +#includeEtc "caseDicts/postProcessing/probes/boundaryPoints.cfg" // ************************************************************************* // diff --git a/etc/caseDicts/postProcessing/probes/boundaryCloud.cfg b/etc/caseDicts/postProcessing/probes/boundaryPoints.cfg similarity index 88% rename from etc/caseDicts/postProcessing/probes/boundaryCloud.cfg rename to etc/caseDicts/postProcessing/probes/boundaryPoints.cfg index d90c94122..7993a883e 100644 --- a/etc/caseDicts/postProcessing/probes/boundaryCloud.cfg +++ b/etc/caseDicts/postProcessing/probes/boundaryPoints.cfg @@ -6,13 +6,13 @@ | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ -#includeEtc "caseDicts/postProcessing/probes/cloud.cfg" +#includeEtc "caseDicts/postProcessing/probes/points.cfg" sets ( - cloud + points { - type patchCloud; + type boundaryPoints; axis xyz; points $points; maxDistance $maxDistance; diff --git a/etc/caseDicts/postProcessing/probes/internalCloud b/etc/caseDicts/postProcessing/probes/internalPoints similarity index 80% rename from etc/caseDicts/postProcessing/probes/internalCloud rename to etc/caseDicts/postProcessing/probes/internalPoints index a2f8794f4..ed2d56f6f 100644 --- a/etc/caseDicts/postProcessing/probes/internalCloud +++ b/etc/caseDicts/postProcessing/probes/internalPoints @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Description - Writes out values of fields interpolated to a specified cloud of points. + Writes out values of fields interpolated to a specified list of points. \*---------------------------------------------------------------------------*/ @@ -16,6 +16,6 @@ points (0 0 0) ); -#includeEtc "caseDicts/postProcessing/probes/internalCloud.cfg" +#includeEtc "caseDicts/postProcessing/probes/internalPoints.cfg" // ************************************************************************* // diff --git a/etc/caseDicts/postProcessing/probes/internalCloud.cfg b/etc/caseDicts/postProcessing/probes/internalPoints.cfg similarity index 88% rename from etc/caseDicts/postProcessing/probes/internalCloud.cfg rename to etc/caseDicts/postProcessing/probes/internalPoints.cfg index 19bf54f89..557dbe328 100644 --- a/etc/caseDicts/postProcessing/probes/internalCloud.cfg +++ b/etc/caseDicts/postProcessing/probes/internalPoints.cfg @@ -6,13 +6,13 @@ | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ -#includeEtc "caseDicts/postProcessing/probes/cloud.cfg" +#includeEtc "caseDicts/postProcessing/probes/points.cfg" sets ( - cloud + points { - type cloud; + type points; axis xyz; points $points; } diff --git a/etc/caseDicts/postProcessing/probes/cloud.cfg b/etc/caseDicts/postProcessing/probes/points.cfg similarity index 100% rename from etc/caseDicts/postProcessing/probes/cloud.cfg rename to etc/caseDicts/postProcessing/probes/points.cfg diff --git a/etc/caseDicts/postProcessing/visualization/streamlines.cfg b/etc/caseDicts/postProcessing/visualization/streamlines.cfg index e352ad963..94a1c149a 100644 --- a/etc/caseDicts/postProcessing/visualization/streamlines.cfg +++ b/etc/caseDicts/postProcessing/visualization/streamlines.cfg @@ -22,7 +22,7 @@ cloudName particleTracks; seedSampleSet { - type uniform; + type lineUniform; axis x; start $start; end $end; diff --git a/etc/templates/axisymmetricJet/system/graph b/etc/templates/axisymmetricJet/system/graph index 72b4d2b3c..94de0e4bc 100644 --- a/etc/templates/axisymmetricJet/system/graph +++ b/etc/templates/axisymmetricJet/system/graph @@ -28,7 +28,7 @@ graph ( centreline { - type uniform; + type lineUniform; axis x; start ( 0 1e-6 0); end (25 1e-6 0); diff --git a/src/functionObjects/field/interfaceHeight/interfaceHeight.C b/src/functionObjects/field/interfaceHeight/interfaceHeight.C index 325d47ebe..1ec9c3dc0 100644 --- a/src/functionObjects/field/interfaceHeight/interfaceHeight.C +++ b/src/functionObjects/field/interfaceHeight/interfaceHeight.C @@ -28,7 +28,7 @@ License #include "interpolation.H" #include "IOmanip.H" #include "meshSearch.H" -#include "midPointAndFaceSet.H" +#include "lineCellFaceSet.H" #include "Time.H" #include "uniformDimensionedFields.H" #include "volFields.H" @@ -72,7 +72,7 @@ void Foam::functionObjects::interfaceHeight::writePositions() forAll(locations_, li) { // Create a set along a ray projected in the direction of gravity - const midPointAndFaceSet set + const lineCellFaceSet set ( "", mesh_, diff --git a/src/functionObjects/field/interfaceHeight/interfaceHeight.H b/src/functionObjects/field/interfaceHeight/interfaceHeight.H index d443e1f03..41e35c02d 100644 --- a/src/functionObjects/field/interfaceHeight/interfaceHeight.H +++ b/src/functionObjects/field/interfaceHeight/interfaceHeight.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2017 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2017-2018 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -61,8 +61,8 @@ SourceFiles #define interfaceHeight_H #include "fvMeshFunctionObject.H" -#include "midPointAndFaceSet.H" #include "logFiles.H" +#include "point.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/sampling/Make/files b/src/sampling/Make/files index 433f17410..60c824d7c 100644 --- a/src/sampling/Make/files +++ b/src/sampling/Make/files @@ -2,20 +2,21 @@ probes/probes.C probes/patchProbes.C probes/probesGrouping.C -sampledSet/circle/circleSet.C -sampledSet/cloud/cloudSet.C -sampledSet/patchCloud/patchCloudSet.C -sampledSet/polyLine/polyLineSet.C -sampledSet/face/faceOnlySet.C -sampledSet/midPoint/midPointSet.C -sampledSet/midPointAndFace/midPointAndFaceSet.C -sampledSet/patchSeed/patchSeedSet.C sampledSet/sampledSet/sampledSet.C sampledSet/sampledSets/sampledSets.C sampledSet/sampledSets/sampledSetsGrouping.C -sampledSet/triSurfaceMeshPointSet/triSurfaceMeshPointSet.C -sampledSet/uniform/uniformSet.C -sampledSet/array/arraySet.C +sampledSet/arcUniform/arcUniformSet.C +sampledSet/boxUniform/boxUniformSet.C +sampledSet/circleRandom/circleRandomSet.C +sampledSet/lineCell/lineCellSet.C +sampledSet/lineCellFace/lineCellFaceSet.C +sampledSet/lineFace/lineFaceSet.C +sampledSet/lineUniform/lineUniformSet.C +sampledSet/boundaryPoints/boundaryPointsSet.C +sampledSet/boundaryRandom/boundaryRandomSet.C +sampledSet/points/pointsSet.C +sampledSet/sphereRandom/sphereRandomSet.C +sampledSet/triSurfaceMesh/triSurfaceMeshSet.C cuttingPlane/cuttingPlane.C diff --git a/src/sampling/sampledSet/arcUniform/arcUniformSet.C b/src/sampling/sampledSet/arcUniform/arcUniformSet.C new file mode 100644 index 000000000..0957f4f30 --- /dev/null +++ b/src/sampling/sampledSet/arcUniform/arcUniformSet.C @@ -0,0 +1,148 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "arcUniformSet.H" +#include "sampledSet.H" +#include "meshSearch.H" +#include "DynamicList.H" +#include "polyMesh.H" +#include "addToRunTimeSelectionTable.H" +#include "word.H" +#include "unitConversion.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(arcUniformSet, 0); + addToRunTimeSelectionTable(sampledSet, arcUniformSet, word); +} + + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +void Foam::arcUniformSet::calcSamples +( + DynamicList& samplingPts, + DynamicList