From 31891a38b2c2e90cf6d7963848bf3779568de921 Mon Sep 17 00:00:00 2001 From: Henry Weller Date: Tue, 29 Sep 2020 15:09:58 +0100 Subject: [PATCH] coordinateSystems: Corrected, updated and tested It is now possible to define coordinate systems in a central location and selected them by name for any model requiring one, e.g. the explicitPorositySource. Description Provides a centralized coordinateSystem collection. For example with the porous region specified in \c constant/fvOptions as \verbatim porosity { type explicitPorositySource; explicitPorositySourceCoeffs { selectionMode cellZone; cellZone porousBlockage; type DarcyForchheimer; // D 100; // Very little blockage // D 200; // Some blockage but steady flow // D 500; // Slight waviness in the far wake D 1000; // Fully shedding behavior d ($D $D $D); f (0 0 0); coordinateSystem porousBlockage; } } \endverbatim the corresponding coordinate system \c porousBlockage is looked-up automatically from the \c constant/coordinateSystems dictionary: \verbatim porousBlockage { type cartesian; origin (0 0 0); coordinateRotation { type axesRotation; e1 (1 0 0); e2 (0 1 0); } } \endverbatim See \c tutorials/incompressible/pisoFoam/laminar/porousBlockage --- .../db/objectRegistry/objectRegistry.H | 8 +- .../derived/rotorDiskSource/rotorDiskSource.C | 9 +- .../derived/rotorDiskSource/rotorDiskSource.H | 4 +- .../rotorDiskSource/rotorDiskSourceI.H | 5 +- .../ParticleCollector/ParticleCollector.C | 9 +- .../ParticleCollector/ParticleCollector.H | 2 +- .../ParticleTracks/ParticleTracks.C | 1 - src/meshTools/coordinateSystems/cartesianCS.C | 26 ++-- src/meshTools/coordinateSystems/cartesianCS.H | 20 +-- .../coordinateSystems/coordinateSystem.H | 9 +- .../coordinateSystems/coordinateSystemNew.C | 48 +++--- .../coordinateSystems/coordinateSystems.C | 142 ++++-------------- .../coordinateSystems/coordinateSystems.H | 102 ++++++++----- .../coordinateSystems/cylindricalCS.C | 25 +-- .../coordinateSystems/cylindricalCS.H | 19 ++- .../porousBlockage/constant/coordinateSystems | 31 ++++ .../laminar/porousBlockage/constant/fvOptions | 14 +- 17 files changed, 229 insertions(+), 245 deletions(-) create mode 100644 tutorials/incompressible/pisoFoam/laminar/porousBlockage/constant/coordinateSystems diff --git a/src/OpenFOAM/db/objectRegistry/objectRegistry.H b/src/OpenFOAM/db/objectRegistry/objectRegistry.H index bf42608f84..cadf3b027e 100644 --- a/src/OpenFOAM/db/objectRegistry/objectRegistry.H +++ b/src/OpenFOAM/db/objectRegistry/objectRegistry.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -203,6 +203,12 @@ public: //- Return new event number. label getEvent() const; + //- Return the object registry + const objectRegistry& thisDb() const + { + return *this; + } + // Edit diff --git a/src/fvOptions/sources/derived/rotorDiskSource/rotorDiskSource.C b/src/fvOptions/sources/derived/rotorDiskSource/rotorDiskSource.C index 2c02ad227e..e219506309 100644 --- a/src/fvOptions/sources/derived/rotorDiskSource/rotorDiskSource.C +++ b/src/fvOptions/sources/derived/rotorDiskSource/rotorDiskSource.C @@ -377,7 +377,14 @@ void Foam::fv::rotorDiskSource::createCoordinateSystem() } } - coordSys_ = cylindricalCS("rotorCoordSys", origin, axis, refDir, false); + coordSys_ = coordinateSystems::cylindrical + ( + "rotorCoordSys", + origin, + axis, + refDir, + false + ); const scalar sumArea = gSum(area_); const scalar diameter = Foam::sqrt(4.0*sumArea/mathematical::pi); diff --git a/src/fvOptions/sources/derived/rotorDiskSource/rotorDiskSource.H b/src/fvOptions/sources/derived/rotorDiskSource/rotorDiskSource.H index c217e612c9..dc46f69902 100644 --- a/src/fvOptions/sources/derived/rotorDiskSource/rotorDiskSource.H +++ b/src/fvOptions/sources/derived/rotorDiskSource/rotorDiskSource.H @@ -194,7 +194,7 @@ protected: List area_; //- Rotor local cylindrical co-ordinate system (r, theta, z) - cylindricalCS coordSys_; + coordinateSystems::cylindrical coordSys_; //- Rotor transformation co-ordinate system autoPtr cylindrical_; @@ -278,7 +278,7 @@ public: inline const List& x() const; //- Return the rotor co-ordinate system (r, theta, z) - inline const cylindricalCS& coordSys() const; + inline const coordinateSystems::cylindrical& coordSys() const; // Evaluation diff --git a/src/fvOptions/sources/derived/rotorDiskSource/rotorDiskSourceI.H b/src/fvOptions/sources/derived/rotorDiskSource/rotorDiskSourceI.H index 033da9dda5..4c19e8e30d 100644 --- a/src/fvOptions/sources/derived/rotorDiskSource/rotorDiskSourceI.H +++ b/src/fvOptions/sources/derived/rotorDiskSource/rotorDiskSourceI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2012-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -45,7 +45,8 @@ const Foam::List& Foam::fv::rotorDiskSource::x() const } -const Foam::cylindricalCS& Foam::fv::rotorDiskSource::coordSys() const +const Foam::coordinateSystems::cylindrical& +Foam::fv::rotorDiskSource::coordSys() const { return coordSys_; } diff --git a/src/lagrangian/parcel/submodels/CloudFunctionObjects/ParticleCollector/ParticleCollector.C b/src/lagrangian/parcel/submodels/CloudFunctionObjects/ParticleCollector/ParticleCollector.C index 8380df27a2..348695cc7e 100644 --- a/src/lagrangian/parcel/submodels/CloudFunctionObjects/ParticleCollector/ParticleCollector.C +++ b/src/lagrangian/parcel/submodels/CloudFunctionObjects/ParticleCollector/ParticleCollector.C @@ -195,7 +195,14 @@ void Foam::ParticleCollector::initConcentricCircles() faces_.setSize(nFace); area_.setSize(nFace); - coordSys_ = cylindricalCS("coordSys", origin, normal_[0], refDir, false); + coordSys_ = coordinateSystems::cylindrical + ( + "coordSys", + origin, + normal_[0], + refDir, + false + ); List