diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/createSolidFields.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/createSolidFields.H index 2cc60f7b9b..fa5966905b 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/createSolidFields.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/createSolidFields.H @@ -31,7 +31,12 @@ coordinates.set ( i, - coordinateSystem::New(solidRegions[i], thermos[i]) + coordinateSystem::New + ( + solidRegions[i], + thermos[i], + coordinateSystem::typeName_() + ) ); tmp tkappaByCp = @@ -57,7 +62,11 @@ ); aniAlphas[i].primitiveFieldRef() = - coordinates[i].R().transformVector(tkappaByCp()); + coordinates[i].transformPrincipal + ( + solidRegions[i].cellCentres(), + tkappaByCp() + ); aniAlphas[i].correctBoundaryConditions(); } diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/setRegionSolidFields.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/setRegionSolidFields.H index 98b081952c..7790ac9659 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/setRegionSolidFields.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/setRegionSolidFields.H @@ -15,7 +15,12 @@ if (!thermo.isotropic()) const coordinateSystem& coodSys = coordinates[i]; aniAlpha.primitiveFieldRef() = - coodSys.R().transformVector(tkappaByCp()); + coodSys.transformPrincipal + ( + mesh.cellCentres(), + tkappaByCp() + ); + aniAlpha.correctBoundaryConditions(); taniAlpha = tmp diff --git a/applications/test/coordinateSystem/Test-coordinateSystem.C b/applications/test/coordinateSystem/Test-coordinateSystem.C index 3f68919a52..d8ea6c3e0e 100644 --- a/applications/test/coordinateSystem/Test-coordinateSystem.C +++ b/applications/test/coordinateSystem/Test-coordinateSystem.C @@ -30,12 +30,68 @@ Description \*---------------------------------------------------------------------------*/ #include "argList.H" -#include "coordinateSystem.H" +#include "Time.H" +#include "coordinateSystems.H" +#include "identityRotation.H" +#include "indirectCS.H" #include "Fstream.H" #include "IOstreams.H" +#include "transform.H" using namespace Foam; + +template +void testTransform(const coordinateSystem& cs, const point& p, const T& val) +{ + Info<< " " << pTraits::typeName << ": " << val + << " transform: " << cs.transform(p, val) + << " invTransform: " << cs.invTransform(p, val) << nl; + + // Info<< " both: " << cs.invTransform(p, cs.transform(p, val)) << nl; +} + + +void basicTests(const coordinateSystem& cs) +{ + cs.writeEntry(cs.name(), Info); + + if (isA(cs)) + { + Info<< "indirect from:" << nl; + dynamicCast(cs).cs() + .writeEntry(cs.name(), Info); + } + + + Info<< "rotation: " << cs.R() << nl; + + List testPoints + ({ + {1,0,0}, {0,1,0}, {0,0,1}, {1,1,1}, + }); + + + for (const point& p : testPoints) + { + Info<< nl + << " test point: " << p + << " = local point " << cs.transformPoint(p) + << " = local coord " << cs.localPosition(p) << nl; + + const vector v1(1, 1, 1); + const tensor t1(tensor::I); + const tensor t2(1, 2, 3, 4, 5, 6, 7, 8, 9); + + testTransform(cs, p, v1); + testTransform(cs, p, t1); + testTransform(cs, p, t2); + } + + Info<< nl; +} + + void doTest(const dictionary& dict) { Info<< dict.dictName() << dict << nl; @@ -43,18 +99,42 @@ void doTest(const dictionary& dict) // Could fail? const bool throwingIOError = FatalIOError.throwExceptions(); const bool throwingError = FatalError.throwExceptions(); + try { - coordinateSystem cs1(dict.dictName(), dict); + auto cs1ptr = coordinateSystem::New(dict, ""); + coordinateSystem& cs1 = *cs1ptr; + cs1.rename(dict.dictName()); - coordinateSystem cs2; + basicTests(cs1); + } + catch (Foam::IOerror& err) + { + Info<< "Caught FatalIOError " << err << nl << endl; + } + catch (Foam::error& err) + { + Info<< "Caught FatalError " << err << nl << endl; + } + FatalError.throwExceptions(throwingError); + FatalIOError.throwExceptions(throwingIOError); +} - // Move assign - cs2 = std::move(cs1); - // Info<; //<-- Older name + object coordinateSystems; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +( +cs1 +{ + type cartesian; + origin (1 2 3); + coordinateRotation + { + type axes; + e1 (0 0 1); + e2 (0 1 0); + } +} + +) + +// ************************************************************************* // diff --git a/applications/test/coordinateSystem/testCase0/system/controlDict b/applications/test/coordinateSystem/testCase0/system/controlDict new file mode 100644 index 0000000000..4173430aa1 --- /dev/null +++ b/applications/test/coordinateSystem/testCase0/system/controlDict @@ -0,0 +1,48 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v1806 | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object controlDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +application simpleFoam; + +startFrom latestTime; + +startTime 0; + +stopAt endTime; + +endTime 4; + +deltaT 1; + +writeControl timeStep; + +writeInterval 100; + +purgeWrite 0; + +writeFormat binary; + +writePrecision 6; + +writeCompression off; + +timeFormat general; + +timePrecision 6; + +runTimeModifiable true; + + +// ************************************************************************* // diff --git a/applications/test/coordinateSystem/testCase1/constant/coordinateSystems b/applications/test/coordinateSystem/testCase1/constant/coordinateSystems new file mode 100644 index 0000000000..7facad08d3 --- /dev/null +++ b/applications/test/coordinateSystem/testCase1/constant/coordinateSystems @@ -0,0 +1,86 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v1806 | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; +//OLD class IOPtrList; + class coordinateSystems; + object coordinateSystems; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +( +cs1 +{ + type cartesian; + origin (1 2 3); + rotation + { + type axes; + e1 (0 0 1); + e2 (0 1 0); + } +} + +cs2 +{ + type cartesian; + origin (0 3 5); + e1 (1 2 0); + e2 (2 0 2); +} + +cs3 +{ + type cartesian; + origin (0 3 5); + coordinateRotation // older name + { + type euler; + angles (90 0 0); + } +} + +cs4 +{ + type cylindrical; + origin (0 3 5); + rotation + { + type euler; + angles (90 0 0); + } +} + +cyl +{ + type cylindrical; + origin (0 0 0); + degrees false; + + rotation + { + type axisAngle; + axis (0 0 1); + angle 90; + } +} + +ident +{ + origin (0 0 0); + rotation + { + type none; + } +} + +) + +// ************************************************************************* // diff --git a/applications/test/coordinateSystem/testCase1/system/controlDict b/applications/test/coordinateSystem/testCase1/system/controlDict new file mode 100644 index 0000000000..4173430aa1 --- /dev/null +++ b/applications/test/coordinateSystem/testCase1/system/controlDict @@ -0,0 +1,48 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v1806 | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object controlDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +application simpleFoam; + +startFrom latestTime; + +startTime 0; + +stopAt endTime; + +endTime 4; + +deltaT 1; + +writeControl timeStep; + +writeInterval 100; + +purgeWrite 0; + +writeFormat binary; + +writePrecision 6; + +writeCompression off; + +timeFormat general; + +timePrecision 6; + +runTimeModifiable true; + + +// ************************************************************************* // diff --git a/applications/test/coordinateSystem/testDict1 b/applications/test/coordinateSystem/testCsys1 similarity index 58% rename from applications/test/coordinateSystem/testDict1 rename to applications/test/coordinateSystem/testCsys1 index 2fa9cdb21b..320fb21b7a 100644 --- a/applications/test/coordinateSystem/testDict1 +++ b/applications/test/coordinateSystem/testCsys1 @@ -10,12 +10,19 @@ FoamFile version 2.0; format ascii; class dictionary; - object testDict; + object testCsys1; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // Rotate 90 deg around x: y -> z, z -> -y +rot_x90 +{ + origin (0 0 0); + e1 (1 0 0); + e3 (0 -1 0); +} + rot_x90_axesRotation { origin (0 0 0); @@ -27,13 +34,24 @@ rot_x90_axesRotation } } +rot_x90_axisAngle +{ + origin (0 0 0); + coordinateRotation + { + type axisAngle; + axis (1 0 0); // non-unit also OK + angle 90; + } +} + rot_x90_euler { origin (0 0 0); coordinateRotation { - type EulerRotation; - rotation (0 90 0); // z-x'-z'' + type euler; + angles (0 90 0); // z-x'-z'' } } @@ -51,18 +69,40 @@ rot_z45_axesRotation } } +rot_z45_axisAngle +{ + origin (0 0 0); + coordinateRotation + { + type axisAngle; + axis (0 0 10); // non-unit also OK + angle 45; + } +} + rot_z45_euler { origin (0 0 0); coordinateRotation { - type EulerRotation; - rotation (45 0 0); // z-x'-z'' + type euler; + angles (45 0 0); // z-x'-z'' + } +} + +rot_z45_starcd +{ + origin (0 0 0); + coordinateRotation + { + type starcd; + angles (45 0 0); // z-x'-y'' } } // Rotate -45 deg around z: x -> (1 -1 0), y = (1 1 0) + rot_zm45_axesRotation { origin (0 0 0); @@ -74,13 +114,24 @@ rot_zm45_axesRotation } } +rot_zm45_axisAngle +{ + origin (0 0 0); + coordinateRotation + { + type axisAngle; + axis (0 0 10); // non-unit also OK + angle -45; + } +} + rot_zm45_euler { origin (0 0 0); coordinateRotation { - type EulerRotation; - rotation (-45 0 0); // z-x'-z'' + type euler; + angles (-45 0 0); // z-x'-z'' } } @@ -98,13 +149,35 @@ null_axesRotation } } +null_axisAngle0 +{ + origin (0 0 0); + coordinateRotation + { + type axisAngle; + axis (0 0 0); // non-unit also OK + angle 0; + } +} + +null_axisAngle1 +{ + origin (0 0 0); + coordinateRotation + { + type axisAngle; + axis (1 1 1); // non-unit also OK + angle 0; + } +} + null_euler { origin (0 0 0); coordinateRotation { - type EulerRotation; - rotation (0 0 0); // z-x'-z'' + type euler; + angles (0 0 0); // z-x'-z'' } } diff --git a/applications/test/coordinateSystem/testCsys2 b/applications/test/coordinateSystem/testCsys2 new file mode 100644 index 0000000000..13caeacd5a --- /dev/null +++ b/applications/test/coordinateSystem/testCsys2 @@ -0,0 +1,59 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v1806 | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object testCsys1; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// This dictionary only works in combination with constant/coordinateSystems + +mycs1 +{ + type indirect; + name cs1; +} + +mycs2 +{ + type indirect; + name cs2; +} + +mycs3 +{ + type indirect; + name cs3; +} + +mycyl +{ + type indirect; + name cyl; +} + + +mycy2 +{ + coordinateSystem + { + type indirect; + name cyl; + } +} + +mycy3 +{ + coordinateSystem cyl; +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/etc/caseDicts/general/coordinateSystem/cartesianXY b/etc/caseDicts/general/coordinateSystem/cartesianXY index 2fe0d38a5e..ffea8c2b9c 100644 --- a/etc/caseDicts/general/coordinateSystem/cartesianXY +++ b/etc/caseDicts/general/coordinateSystem/cartesianXY @@ -15,10 +15,12 @@ FoamFile // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // type cartesian; + origin (0 0 0); -coordinateRotation + +rotation { - type axesRotation; + type axes; e1 $x; e2 $y; } diff --git a/etc/caseDicts/general/coordinateSystem/cartesianXZ b/etc/caseDicts/general/coordinateSystem/cartesianXZ index 4915e791bd..dc26fd49fc 100644 --- a/etc/caseDicts/general/coordinateSystem/cartesianXZ +++ b/etc/caseDicts/general/coordinateSystem/cartesianXZ @@ -15,10 +15,12 @@ FoamFile // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // type cartesian; + origin (0 0 0); -coordinateRotation + +rotation { - type axesRotation; + type axes; e1 $x; e3 $z; } diff --git a/etc/caseDicts/general/coordinateSystem/cartesianYZ b/etc/caseDicts/general/coordinateSystem/cartesianYZ index 0452b239c1..b531dcf4d6 100644 --- a/etc/caseDicts/general/coordinateSystem/cartesianYZ +++ b/etc/caseDicts/general/coordinateSystem/cartesianYZ @@ -15,12 +15,14 @@ FoamFile // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // type cartesian; + origin (0 0 0); -coordinateRotation + +rotation { - type axesRotation; + type axes; e2 $y; - e3 $z + e3 $z; } //************************************************************************* // diff --git a/etc/caseDicts/general/coordinateSystem/cylindrical b/etc/caseDicts/general/coordinateSystem/cylindrical index 332e0f4a8f..1f20c75654 100644 --- a/etc/caseDicts/general/coordinateSystem/cylindrical +++ b/etc/caseDicts/general/coordinateSystem/cylindrical @@ -14,8 +14,9 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -type cartesian; -coordinateRotation +type cylindrical; + +rotation { type cylindrical; e3 $axis; diff --git a/etc/controlDict b/etc/controlDict index 918ac112ca..950e5adc2b 100644 --- a/etc/controlDict +++ b/etc/controlDict @@ -208,7 +208,6 @@ DebugSwitches Ergun 0; Euler 0; EulerImplicit 0; - EulerRotation 0; extendedCellToFaceStencil 0; FDIC 0; FaceCellWave 0; @@ -239,7 +238,6 @@ DebugSwitches IFstream 0; IOMap 0; IOPtrList 0; - IOPtrList 0; IOPtrList 0; IOPtrList 0; IOobject 0; @@ -336,7 +334,6 @@ DebugSwitches SLTS 0; SRFModel 0; SRFVelocity 0; - STARCDRotation 0; Schaeffer 0; SchillerNaumann 0; SinclairJackson 0; @@ -456,9 +453,7 @@ DebugSwitches constantAbsorptionEmission 0; constantAlphaContactAngle 0; constantScatter 0; - coordinateRotation 0; coordinateSystem 0; - coordinateSystems 0; corrected 0; coupled 0; cubeRootVol 0; @@ -478,9 +473,9 @@ DebugSwitches diagonal 0; dictionary 0; dimensionSet 1; - mappedBase 0; - mappedPatch 0; - mappedVelocityFlux 0; + mappedBase 0; + mappedPatch 0; + mappedVelocityFlux 0; directionMixed 0; directional 0; disallowGenericFvPatchField 0; @@ -745,7 +740,6 @@ DebugSwitches outletInlet 0; outletStabilised 0; pair 0; - parabolicCylindrical 0; parcel 0; partialSlip 0; passiveParticle 0; @@ -1101,5 +1095,4 @@ DimensionSets } - // ************************************************************************* // diff --git a/src/OpenFOAM/primitives/Tensor/Tensor.H b/src/OpenFOAM/primitives/Tensor/Tensor.H index d39f8b10e1..d3d635391d 100644 --- a/src/OpenFOAM/primitives/Tensor/Tensor.H +++ b/src/OpenFOAM/primitives/Tensor/Tensor.H @@ -242,11 +242,6 @@ public: //- Inner-product of this with another Tensor. inline Tensor inner(const Tensor& t2) const; - //- Inner-product of this with transpose of another Tensor. - // Primarily useful for coordinate transformations - // (where transpose is the same as the inverse). - inline Tensor innerT(const Tensor& t2) const; - //- Schur-product of this with another Tensor. inline Tensor schur(const Tensor& t2) const; diff --git a/src/OpenFOAM/primitives/Tensor/TensorI.H b/src/OpenFOAM/primitives/Tensor/TensorI.H index 933b39a5c2..78c59a0c37 100644 --- a/src/OpenFOAM/primitives/Tensor/TensorI.H +++ b/src/OpenFOAM/primitives/Tensor/TensorI.H @@ -504,29 +504,6 @@ Foam::Tensor::inner(const Tensor& t2) const } -template -inline Foam::Tensor -Foam::Tensor::innerT(const Tensor& t2) const -{ - const Tensor& t1 = *this; - - return Tensor - ( - t1.xx()*t2.xx() + t1.xy()*t2.xy() + t1.xz()*t2.xz(), - t1.xx()*t2.yx() + t1.xy()*t2.yy() + t1.xz()*t2.yz(), - t1.xx()*t2.zx() + t1.xy()*t2.zy() + t1.xz()*t2.zz(), - - t1.yx()*t2.xx() + t1.yy()*t2.xy() + t1.yz()*t2.xz(), - t1.yx()*t2.yx() + t1.yy()*t2.yy() + t1.yz()*t2.yz(), - t1.yx()*t2.zx() + t1.yy()*t2.zy() + t1.yz()*t2.zz(), - - t1.zx()*t2.xx() + t1.zy()*t2.xy() + t1.zz()*t2.xz(), - t1.zx()*t2.yx() + t1.zy()*t2.yy() + t1.zz()*t2.yz(), - t1.zx()*t2.zx() + t1.zy()*t2.zy() + t1.zz()*t2.zz() - ); -} - - template inline Foam::Tensor Foam::Tensor::schur(const Tensor& t2) const diff --git a/src/OpenFOAM/primitives/Tensor2D/Tensor2D.H b/src/OpenFOAM/primitives/Tensor2D/Tensor2D.H index 38de0da433..8de4754acb 100644 --- a/src/OpenFOAM/primitives/Tensor2D/Tensor2D.H +++ b/src/OpenFOAM/primitives/Tensor2D/Tensor2D.H @@ -156,11 +156,6 @@ public: //- Inner-product of this with another Tensor2D. inline Tensor2D inner(const Tensor2D& t2) const; - //- Inner-product of this with transpose of another Tensor2D. - // Primarily useful for coordinate transformations - // (where transpose is the same as the inverse). - inline Tensor2D innerT(const Tensor2D& t2) const; - //- Schur-product of this with another Tensor2D. inline Tensor2D schur(const Tensor2D& t2) const; diff --git a/src/OpenFOAM/primitives/Tensor2D/Tensor2DI.H b/src/OpenFOAM/primitives/Tensor2D/Tensor2DI.H index 147155035f..fd253dd7ac 100644 --- a/src/OpenFOAM/primitives/Tensor2D/Tensor2DI.H +++ b/src/OpenFOAM/primitives/Tensor2D/Tensor2DI.H @@ -202,23 +202,6 @@ Foam::Tensor2D::inner(const Tensor2D& t2) const } -template -inline Foam::Tensor2D -Foam::Tensor2D::innerT(const Tensor2D& t2) const -{ - const Tensor2D& t1 = *this; - - return Tensor2D - ( - t1.xx()*t2.xx() + t1.xy()*t2.xy(), - t1.xx()*t2.yx() + t1.xy()*t2.yy(), - - t1.yx()*t2.xx() + t1.yy()*t2.xy(), - t1.yx()*t2.yx() + t1.yy()*t2.yy() - ); -} - - template inline Foam::Tensor2D Foam::Tensor2D::schur(const Tensor2D& t2) const diff --git a/src/atmosphericModels/derivedFvPatchFields/nutkAtmRoughWallFunction/nutkAtmRoughWallFunctionFvPatchScalarField.H b/src/atmosphericModels/derivedFvPatchFields/nutkAtmRoughWallFunction/nutkAtmRoughWallFunctionFvPatchScalarField.H index 858ab1fd91..955fa72d7e 100644 --- a/src/atmosphericModels/derivedFvPatchFields/nutkAtmRoughWallFunction/nutkAtmRoughWallFunctionFvPatchScalarField.H +++ b/src/atmosphericModels/derivedFvPatchFields/nutkAtmRoughWallFunction/nutkAtmRoughWallFunctionFvPatchScalarField.H @@ -43,7 +43,7 @@ Description U_f | frictional velocity K | Von Karman's constant z_0 | surface roughness length - z | vertical co-ordinate + z | vertical coordinate \endvartable Usage diff --git a/src/dynamicMesh/meshCut/directions/directions.C b/src/dynamicMesh/meshCut/directions/directions.C index 68deece254..b6a4db66e5 100644 --- a/src/dynamicMesh/meshCut/directions/directions.C +++ b/src/dynamicMesh/meshCut/directions/directions.C @@ -276,7 +276,7 @@ Foam::directions::directions List(wordList(dict.lookup("directions")).size()) { const wordList wantedDirs(dict.lookup("directions")); - const word coordSystem(dict.lookup("coordinateSystem")); + const word coordSystem(dict.get("coordinateSystem")); bool wantNormal = false; bool wantTan1 = false; diff --git a/src/dynamicMesh/motionSolvers/displacement/points0/points0MotionSolver.C b/src/dynamicMesh/motionSolvers/displacement/points0/points0MotionSolver.C index 1a204d67a5..8af0c320c1 100644 --- a/src/dynamicMesh/motionSolvers/displacement/points0/points0MotionSolver.C +++ b/src/dynamicMesh/motionSolvers/displacement/points0/points0MotionSolver.C @@ -230,8 +230,8 @@ void Foam::points0MotionSolver::updateMesh(const mapPolyMesh& mpm) else { FatalErrorInFunction - << "Cannot determine co-ordinates of introduced vertices." - << " New vertex " << pointi << " at co-ordinate " + << "Cannot determine coordinates of introduced vertices." + << " New vertex " << pointi << " at coordinate " << points[pointi] << exit(FatalError); } } diff --git a/src/engine/enginePiston/enginePiston.C b/src/engine/enginePiston/enginePiston.C index 68be48ec08..3314e566a5 100644 --- a/src/engine/enginePiston/enginePiston.C +++ b/src/engine/enginePiston/enginePiston.C @@ -30,7 +30,6 @@ License // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -// Construct from components Foam::enginePiston::enginePiston ( const polyMesh& mesh, @@ -43,13 +42,12 @@ Foam::enginePiston::enginePiston mesh_(mesh), engineDB_(refCast(mesh.time())), patchID_(pistonPatchName, mesh.boundaryMesh()), - csPtr_(pistonCS), + csysPtr_(pistonCS), minLayer_(minLayer), maxLayer_(maxLayer) {} -// Construct from dictionary Foam::enginePiston::enginePiston ( const polyMesh& mesh, @@ -59,22 +57,15 @@ Foam::enginePiston::enginePiston mesh_(mesh), engineDB_(refCast(mesh_.time())), patchID_(dict.lookup("patch"), mesh.boundaryMesh()), - csPtr_ + csysPtr_ ( - coordinateSystem::New - ( - mesh_, - dict.subDict("coordinateSystem") - ) + coordinateSystem::New(mesh_, dict, coordinateSystem::typeName_()) ), - minLayer_(readScalar(dict.lookup("minLayer"))), - maxLayer_(readScalar(dict.lookup("maxLayer"))) + minLayer_(dict.get("minLayer")), + maxLayer_(dict.get("maxLayer")) {} -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - - // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // void Foam::enginePiston::writeDict(Ostream& os) const diff --git a/src/engine/enginePiston/enginePiston.H b/src/engine/enginePiston/enginePiston.H index 03c2291216..470b437411 100644 --- a/src/engine/enginePiston/enginePiston.H +++ b/src/engine/enginePiston/enginePiston.H @@ -65,7 +65,7 @@ class enginePiston polyPatchID patchID_; //- Coordinate system - autoPtr csPtr_; + autoPtr csysPtr_; // Piston layering data @@ -112,7 +112,8 @@ public: ); - // Destructor - default + //- Destructor + ~enginePiston() = default; // Member Functions @@ -120,7 +121,7 @@ public: //- Return coordinate system const coordinateSystem& cs() const { - return *csPtr_; + return *csysPtr_; } //- Return ID of piston patch diff --git a/src/engine/engineValve/engineValve.C b/src/engine/engineValve/engineValve.C index 0be19c39f2..28b8572ab5 100644 --- a/src/engine/engineValve/engineValve.C +++ b/src/engine/engineValve/engineValve.C @@ -63,7 +63,6 @@ Foam::scalar Foam::engineValve::adjustCrankAngle(const scalar theta) const // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -// Construct from components Foam::engineValve::engineValve ( const word& name, @@ -89,7 +88,7 @@ Foam::engineValve::engineValve name_(name), mesh_(mesh), engineDB_(refCast(mesh.time())), - csPtr_(valveCS), + csysPtr_(valveCS.clone()), bottomPatch_(bottomPatchName, mesh.boundaryMesh()), poppetPatch_(poppetPatchName, mesh.boundaryMesh()), stemPatch_(stemPatchName, mesh.boundaryMesh()), @@ -110,7 +109,6 @@ Foam::engineValve::engineValve {} -// Construct from dictionary Foam::engineValve::engineValve ( const word& name, @@ -121,13 +119,9 @@ Foam::engineValve::engineValve name_(name), mesh_(mesh), engineDB_(refCast(mesh_.time())), - csPtr_ + csysPtr_ ( - coordinateSystem::New - ( - mesh_, - dict.subDict("coordinateSystem") - ) + coordinateSystem::New(mesh_, dict, coordinateSystem::typeName_()) ), bottomPatch_(dict.lookup("bottomPatch"), mesh.boundaryMesh()), poppetPatch_(dict.lookup("poppetPatch"), mesh.boundaryMesh()), @@ -156,18 +150,15 @@ Foam::engineValve::engineValve liftProfile_("theta", "lift", name_, dict.lookup("liftProfile")), liftProfileStart_(min(liftProfile_.x())), liftProfileEnd_(max(liftProfile_.x())), - minLift_(readScalar(dict.lookup("minLift"))), - minTopLayer_(readScalar(dict.lookup("minTopLayer"))), - maxTopLayer_(readScalar(dict.lookup("maxTopLayer"))), - minBottomLayer_(readScalar(dict.lookup("minBottomLayer"))), - maxBottomLayer_(readScalar(dict.lookup("maxBottomLayer"))), - diameter_(readScalar(dict.lookup("diameter"))) + minLift_(dict.get("minLift")), + minTopLayer_(dict.get("minTopLayer")), + maxTopLayer_(dict.get("maxTopLayer")), + minBottomLayer_(dict.get("minBottomLayer")), + maxBottomLayer_(dict.get("maxBottomLayer")), + diameter_(dict.get("diameter")) {} -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - - // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // Foam::scalar Foam::engineValve::lift(const scalar theta) const @@ -238,7 +229,7 @@ void Foam::engineValve::writeDict(Ostream& os) const { os << nl << name() << nl << token::BEGIN_BLOCK; - cs().writeDict(os); + cs().writeEntry(coordinateSystem::typeName_(), os); os << "bottomPatch " << bottomPatch_.name() << token::END_STATEMENT << nl << "poppetPatch " << poppetPatch_.name() << token::END_STATEMENT << nl diff --git a/src/engine/engineValve/engineValve.H b/src/engine/engineValve/engineValve.H index e34b88f65f..9121ae45ea 100644 --- a/src/engine/engineValve/engineValve.H +++ b/src/engine/engineValve/engineValve.H @@ -45,7 +45,7 @@ SourceFiles namespace Foam { -// Forward declaration of classes +// Forward declarations class polyMesh; class engineTime; @@ -67,7 +67,7 @@ class engineValve const engineTime& engineDB_; //- Coordinate system - autoPtr csPtr_; + autoPtr csysPtr_; // Patch and zone names @@ -145,9 +145,6 @@ class engineValve public: - // Static data members - - // Constructors //- Construct from components @@ -171,7 +168,6 @@ public: const scalar minBottomLayer, const scalar maxBottomLayer, const scalar diameter - ); //- Construct from dictionary @@ -183,7 +179,8 @@ public: ); - // Destructor - default + //- Destructor + ~engineValve() = default; // Member Functions @@ -197,7 +194,7 @@ public: //- Return coordinate system const coordinateSystem& cs() const { - return *csPtr_; + return *csysPtr_; } //- Return lift profile @@ -308,7 +305,7 @@ public: //- Write dictionary - void writeDict(Ostream&) const; + void writeDict(Ostream& os) const; }; diff --git a/src/finiteArea/faMesh/faMeshDemandDrivenData.C b/src/finiteArea/faMesh/faMeshDemandDrivenData.C index e4050c7610..a2c0dc14be 100644 --- a/src/finiteArea/faMesh/faMeshDemandDrivenData.C +++ b/src/finiteArea/faMesh/faMeshDemandDrivenData.C @@ -34,7 +34,7 @@ License #include "processorFaPatch.H" #include "wedgeFaPatch.H" #include "PstreamCombineReduceOps.H" -#include "coordinateSystem.H" +#include "cartesianCS.H" #include "scalarMatrices.H" #include "processorFaPatchFields.H" #include "emptyFaPatchFields.H" @@ -1271,7 +1271,7 @@ void Foam::faMesh::calcPointAreaNormalsByQuadricsFit() const curPoints = pointSet.toc(); } - vectorField allPoints(curPoints.size()); + pointField allPoints(curPoints.size()); scalarField W(curPoints.size(), 1.0); for (label i=0; i(Dout, mesh_.cellZones()[cellZoneIDs_[0]]) = D_[0]; - UIndirectList(Fout, mesh_.cellZones()[cellZoneIDs_[0]]) = F_[0]; + + forAll(cellZoneIDs_, zonei) + { + const labelList& cells = mesh_.cellZones()[cellZoneIDs_[zonei]]; + + if (csys().uniform()) + { + UIndirectList(Dout, cells) = D_[zonei].first(); + UIndirectList(Fout, cells) = F_[zonei].first(); + } + else + { + UIndirectList(Dout, cells) = D_[zonei]; + UIndirectList(Fout, cells) = F_[zonei]; + } + } Dout.write(); Fout.write(); @@ -176,7 +172,7 @@ void Foam::porosityModels::DarcyForchheimer::calcForce vectorField& force ) const { - scalarField Udiag(U.size(), 0.0); + scalarField Udiag(U.size(), Zero); vectorField Usource(U.size(), Zero); const scalarField& V = mesh_.V(); @@ -202,19 +198,17 @@ void Foam::porosityModels::DarcyForchheimer::correct if (UEqn.dimensions() == dimForce) { - const volScalarField& rho = mesh_.lookupObject(rhoName); + const auto& rho = mesh_.lookupObject(rhoName); if (mesh_.foundObject(muName)) { - const volScalarField& mu = - mesh_.lookupObject(muName); + const auto& mu = mesh_.lookupObject(muName); apply(Udiag, Usource, V, rho, mu, U); } else { - const volScalarField& nu = - mesh_.lookupObject(nuName); + const auto& nu = mesh_.lookupObject(nuName); apply(Udiag, Usource, V, rho, rho*nu, U); } @@ -223,17 +217,14 @@ void Foam::porosityModels::DarcyForchheimer::correct { if (mesh_.foundObject(nuName)) { - const volScalarField& nu = - mesh_.lookupObject(nuName); + const auto& nu = mesh_.lookupObject(nuName); apply(Udiag, Usource, V, geometricOneField(), nu, U); } else { - const volScalarField& rho = - mesh_.lookupObject(rhoName); - const volScalarField& mu = - mesh_.lookupObject(muName); + const auto& rho = mesh_.lookupObject(rhoName); + const auto& mu = mesh_.lookupObject(muName); apply(Udiag, Usource, V, geometricOneField(), mu/rho, U); } @@ -271,8 +262,8 @@ void Foam::porosityModels::DarcyForchheimer::correct if (UEqn.dimensions() == dimForce) { - const volScalarField& rho = mesh_.lookupObject(rhoName); - const volScalarField& mu = mesh_.lookupObject(muName); + const auto& rho = mesh_.lookupObject(rhoName); + const auto& mu = mesh_.lookupObject(muName); apply(AU, rho, mu, U); } @@ -280,17 +271,14 @@ void Foam::porosityModels::DarcyForchheimer::correct { if (mesh_.foundObject(nuName)) { - const volScalarField& nu = - mesh_.lookupObject(nuName); + const auto& nu = mesh_.lookupObject(nuName); apply(AU, geometricOneField(), nu, U); } else { - const volScalarField& rho = - mesh_.lookupObject(rhoName); - const volScalarField& mu = - mesh_.lookupObject(muName); + const auto& rho = mesh_.lookupObject(rhoName); + const auto& mu = mesh_.lookupObject(muName); apply(AU, geometricOneField(), mu/rho, U); } diff --git a/src/finiteVolume/cfdTools/general/porosityModel/DarcyForchheimer/DarcyForchheimer.H b/src/finiteVolume/cfdTools/general/porosityModel/DarcyForchheimer/DarcyForchheimer.H index 96bcd160c6..038d951098 100644 --- a/src/finiteVolume/cfdTools/general/porosityModel/DarcyForchheimer/DarcyForchheimer.H +++ b/src/finiteVolume/cfdTools/general/porosityModel/DarcyForchheimer/DarcyForchheimer.H @@ -41,7 +41,7 @@ Description to specify a multiplier (of the max component). The orientation of the porous region is defined with the same notation as - a co-ordinate system, but only a Cartesian co-ordinate system is valid. + a coordinate system, but only a Cartesian coordinate system is valid. SourceFiles DarcyForchheimer.C @@ -141,7 +141,7 @@ public: ); //- Destructor - virtual ~DarcyForchheimer(); + virtual ~DarcyForchheimer() = default; // Member Functions diff --git a/src/finiteVolume/cfdTools/general/porosityModel/fixedCoeff/fixedCoeff.C b/src/finiteVolume/cfdTools/general/porosityModel/fixedCoeff/fixedCoeff.C index b94fbde938..bdea960dfe 100644 --- a/src/finiteVolume/cfdTools/general/porosityModel/fixedCoeff/fixedCoeff.C +++ b/src/finiteVolume/cfdTools/general/porosityModel/fixedCoeff/fixedCoeff.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -26,6 +26,7 @@ License #include "addToRunTimeSelectionTable.H" #include "fixedCoeff.H" #include "fvMatrices.H" +#include "pointIndList.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -78,7 +79,6 @@ void Foam::porosityModels::fixedCoeff::apply const scalar rho ) const { - forAll(cellZoneIDs_, zoneI) { const tensorField& alphaZones = alpha_[zoneI]; @@ -123,62 +123,45 @@ Foam::porosityModels::fixedCoeff::fixedCoeff } -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -Foam::porosityModels::fixedCoeff::~fixedCoeff() -{} - - // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // void Foam::porosityModels::fixedCoeff::calcTransformModelData() { - if (coordSys_.R().uniform()) + // The alpha coefficient as a tensor + tensor alphaCoeff(Zero); + alphaCoeff.xx() = alphaXYZ_.value().x(); + alphaCoeff.yy() = alphaXYZ_.value().y(); + alphaCoeff.zz() = alphaXYZ_.value().z(); + + // The beta coefficient as a tensor + tensor betaCoeff(Zero); + betaCoeff.xx() = betaXYZ_.value().x(); + betaCoeff.yy() = betaXYZ_.value().y(); + betaCoeff.zz() = betaXYZ_.value().z(); + + if (csys().uniform()) { - forAll(cellZoneIDs_, zoneI) + forAll(cellZoneIDs_, zonei) { - alpha_[zoneI].setSize(1); - beta_[zoneI].setSize(1); + alpha_[zonei].resize(1); + beta_[zonei].resize(1); - alpha_[zoneI][0] = Zero; - alpha_[zoneI][0].xx() = alphaXYZ_.value().x(); - alpha_[zoneI][0].yy() = alphaXYZ_.value().y(); - alpha_[zoneI][0].zz() = alphaXYZ_.value().z(); - alpha_[zoneI][0] = coordSys_.R().transformTensor(alpha_[zoneI][0]); - - beta_[zoneI][0] = Zero; - beta_[zoneI][0].xx() = betaXYZ_.value().x(); - beta_[zoneI][0].yy() = betaXYZ_.value().y(); - beta_[zoneI][0].zz() = betaXYZ_.value().z(); - beta_[zoneI][0] = coordSys_.R().transformTensor(beta_[zoneI][0]); + alpha_[zonei] = csys().transform(alphaCoeff); + beta_[zonei] = csys().transform(betaCoeff); } } else { - forAll(cellZoneIDs_, zoneI) + forAll(cellZoneIDs_, zonei) { - const labelList& cells = mesh_.cellZones()[cellZoneIDs_[zoneI]]; + const pointUIndList cc + ( + mesh_.cellCentres(), + mesh_.cellZones()[cellZoneIDs_[zonei]] + ); - alpha_[zoneI].setSize(cells.size()); - beta_[zoneI].setSize(cells.size()); - - forAll(cells, i) - { - alpha_[zoneI][i] = Zero; - alpha_[zoneI][i].xx() = alphaXYZ_.value().x(); - alpha_[zoneI][i].yy() = alphaXYZ_.value().y(); - alpha_[zoneI][i].zz() = alphaXYZ_.value().z(); - - beta_[zoneI][i] = Zero; - beta_[zoneI][i].xx() = betaXYZ_.value().x(); - beta_[zoneI][i].yy() = betaXYZ_.value().y(); - beta_[zoneI][i].zz() = betaXYZ_.value().z(); - } - - const coordinateRotation& R = coordSys_.R(mesh_, cells); - - alpha_[zoneI] = R.transformTensor(alpha_[zoneI], cells); - beta_[zoneI] = R.transformTensor(beta_[zoneI], cells); + alpha_[zonei] = csys().transform(cc, alphaCoeff); + beta_[zonei] = csys().transform(cc, betaCoeff); } } } @@ -195,7 +178,7 @@ void Foam::porosityModels::fixedCoeff::calcForce scalarField Udiag(U.size(), 0.0); vectorField Usource(U.size(), Zero); const scalarField& V = mesh_.V(); - scalar rhoRef = readScalar(coeffs_.lookup("rhoRef")); + const scalar rhoRef = coeffs_.get("rhoRef"); apply(Udiag, Usource, V, U, rhoRef); diff --git a/src/finiteVolume/cfdTools/general/porosityModel/fixedCoeff/fixedCoeff.H b/src/finiteVolume/cfdTools/general/porosityModel/fixedCoeff/fixedCoeff.H index af67f523d4..1090eb5c8e 100644 --- a/src/finiteVolume/cfdTools/general/porosityModel/fixedCoeff/fixedCoeff.H +++ b/src/finiteVolume/cfdTools/general/porosityModel/fixedCoeff/fixedCoeff.H @@ -118,7 +118,7 @@ public: ); //- Destructor - virtual ~fixedCoeff(); + virtual ~fixedCoeff() = default; // Member Functions diff --git a/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/IOporosityModelList.C b/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/IOporosityModelList.C index 0ed573c356..f6cab47ee1 100644 --- a/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/IOporosityModelList.C +++ b/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/IOporosityModelList.C @@ -48,15 +48,15 @@ Foam::IOobject Foam::IOporosityModelList::createIOobject Info<< "Creating porosity model list from " << io.name() << nl << endl; io.readOpt() = IOobject::MUST_READ_IF_MODIFIED; - return io; } else { Info<< "No porosity models present" << nl << endl; io.readOpt() = IOobject::NO_READ; - return io; } + + return io; } @@ -79,10 +79,8 @@ bool Foam::IOporosityModelList::read() porosityModelList::read(*this); return true; } - else - { - return false; - } + + return false; } diff --git a/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/IOporosityModelList.H b/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/IOporosityModelList.H index 62502570d1..8509897429 100644 --- a/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/IOporosityModelList.H +++ b/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/IOporosityModelList.H @@ -71,12 +71,11 @@ public: // Constructors //- Construct from mesh - IOporosityModelList(const fvMesh& mesh); + explicit IOporosityModelList(const fvMesh& mesh); //- Destructor - virtual ~IOporosityModelList() - {} + virtual ~IOporosityModelList() = default; // Member Functions diff --git a/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/porosityModel.C b/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/porosityModel.C index 19f9bbb3d4..781d53daa3 100644 --- a/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/porosityModel.C +++ b/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/porosityModel.C @@ -61,17 +61,6 @@ void Foam::porosityModel::adjustNegativeResistance(dimensionedVector& resist) } -Foam::label Foam::porosityModel::fieldIndex(const label i) const -{ - label index = 0; - if (!coordSys_.R().uniform()) - { - index = i; - } - return index; -} - - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // Foam::porosityModel::porosityModel @@ -101,7 +90,10 @@ Foam::porosityModel::porosityModel active_(true), zoneName_(cellZoneName), cellZoneIDs_(), - coordSys_(*(coordinateSystem::New(mesh, coeffs_))) + csysPtr_ + ( + coordinateSystem::New(mesh, coeffs_, coordinateSystem::typeName_()) + ) { if (zoneName_ == word::null) { @@ -123,45 +115,36 @@ Foam::porosityModel::porosityModel << exit(FatalError); } - Info<< incrIndent << indent << coordSys_ << decrIndent << endl; + Info<< incrIndent << indent << csys() << decrIndent << endl; const pointField& points = mesh_.points(); const cellList& cells = mesh_.cells(); const faceList& faces = mesh_.faces(); - forAll(cellZoneIDs_, zoneI) - { - const cellZone& cZone = mesh_.cellZones()[cellZoneIDs_[zoneI]]; - point bbMin = point::max; - point bbMax = point::min; - forAll(cZone, i) + for (const label zonei : cellZoneIDs_) + { + const cellZone& cZone = mesh_.cellZones()[zonei]; + + boundBox bb; + + for (const label celli : cZone) { - const label cellI = cZone[i]; - const cell& c = cells[cellI]; + const cell& c = cells[celli]; const pointField cellPoints(c.points(faces, points)); - forAll(cellPoints, pointI) + for (const point& pt : cellPoints) { - const point pt = coordSys_.localPosition(cellPoints[pointI]); - bbMin = min(bbMin, pt); - bbMax = max(bbMax, pt); + bb.add(csys().localPosition(pt)); } } - reduce(bbMin, minOp()); - reduce(bbMax, maxOp()); + bb.reduce(); - Info<< " local bounds: " << (bbMax - bbMin) << nl << endl; + Info<< " local bounds: " << bb.span() << nl << endl; } } -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -Foam::porosityModel::~porosityModel() -{} - - // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // void Foam::porosityModel::transformModelData() diff --git a/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/porosityModel.H b/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/porosityModel.H index f8dd0a31fb..8be1e311a1 100644 --- a/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/porosityModel.H +++ b/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/porosityModel.H @@ -91,13 +91,12 @@ protected: //- Cell zone IDs labelList cellZoneIDs_; - //- Local co-ordinate system - coordinateSystem coordSys_; + //- Local coordinate system + autoPtr csysPtr_; // Protected Member Functions - //- Transform the model data wrt mesh changes virtual void calcTransformModelData() = 0; @@ -128,8 +127,12 @@ protected: volTensorField& AU ) const = 0; + + //- Local coordinate system + inline const coordinateSystem& csys() const; + //- Return label index - label fieldIndex(const label index) const; + inline label fieldIndex(const label index) const; public: @@ -209,7 +212,7 @@ public: ); //- Destructor - virtual ~porosityModel(); + virtual ~porosityModel() = default; // Member Functions diff --git a/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/porosityModelI.H b/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/porosityModelI.H index ecf384a274..26d3472744 100644 --- a/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/porosityModelI.H +++ b/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/porosityModelI.H @@ -23,6 +23,22 @@ License \*---------------------------------------------------------------------------*/ +// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // + +inline const Foam::coordinateSystem& Foam::porosityModel::csys() const +{ + return *csysPtr_; +} + + +inline Foam::label Foam::porosityModel::fieldIndex(const label i) const +{ + return (csysPtr_->uniform() ? 0 : i); +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + inline const Foam::word& Foam::porosityModel::name() const { return name_; diff --git a/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/porosityModelList.C b/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/porosityModelList.C index bb39e24138..588624f71b 100644 --- a/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/porosityModelList.C +++ b/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/porosityModelList.C @@ -38,33 +38,26 @@ Foam::porosityModelList::porosityModelList mesh_(mesh) { reset(dict); - active(true); } -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -Foam::porosityModelList::~porosityModelList() -{} - - // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // bool Foam::porosityModelList::active(const bool warn) const { - bool a = false; + bool anyOk = false; forAll(*this, i) { - a = a || this->operator[](i).active(); + anyOk = anyOk || this->operator[](i).active(); } - if (warn && this->size() && !a) + if (warn && this->size() && !anyOk) { Info<< "No porosity models active" << endl; } - return a; + return anyOk; } diff --git a/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/porosityModelList.H b/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/porosityModelList.H index fb48794662..4674865685 100644 --- a/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/porosityModelList.H +++ b/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/porosityModelList.H @@ -45,7 +45,7 @@ SourceFiles namespace Foam { -// Forward declaration of friend functions and operators +// Forward declarations class porosityModelList; Ostream& operator<<(Ostream& os, const porosityModelList& models); @@ -82,13 +82,13 @@ public: porosityModelList(const fvMesh& mesh, const dictionary& dict); //- Destructor - ~porosityModelList(); + ~porosityModelList() = default; // Member Functions //- Return active status - bool active(const bool active = false) const; + bool active(const bool warn = false) const; //- Reset the source list void reset(const dictionary& dict); diff --git a/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/porosityModelNew.C b/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/porosityModelNew.C index 811023faaa..b1e05ae088 100644 --- a/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/porosityModelNew.C +++ b/src/finiteVolume/cfdTools/general/porosityModel/porosityModel/porosityModelNew.C @@ -35,7 +35,7 @@ Foam::autoPtr Foam::porosityModel::New const word& cellZoneName ) { - const word modelType(dict.lookup("type")); + const word modelType(dict.get("type")); Info<< "Porosity region " << name << ":" << nl << " selecting model: " << modelType << endl; @@ -46,7 +46,7 @@ Foam::autoPtr Foam::porosityModel::New { FatalErrorInFunction << "Unknown " << typeName << " type " << modelType << nl << nl - << "Valid " << typeName << " types are:" << nl + << "Valid types are:" << nl << meshConstructorTablePtr_->sortedToc() << exit(FatalError); } diff --git a/src/finiteVolume/cfdTools/general/porosityModel/powerLaw/powerLaw.C b/src/finiteVolume/cfdTools/general/porosityModel/powerLaw/powerLaw.C index 280b0e4ba2..aca0860bbc 100644 --- a/src/finiteVolume/cfdTools/general/porosityModel/powerLaw/powerLaw.C +++ b/src/finiteVolume/cfdTools/general/porosityModel/powerLaw/powerLaw.C @@ -52,18 +52,12 @@ Foam::porosityModels::powerLaw::powerLaw ) : porosityModel(name, modelType, mesh, dict, cellZoneName), - C0_(readScalar(coeffs_.lookup("C0"))), - C1_(readScalar(coeffs_.lookup("C1"))), + C0_(coeffs_.get("C0")), + C1_(coeffs_.get("C1")), rhoName_(coeffs_.lookupOrDefault("rho", "rho")) {} -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -Foam::porosityModels::powerLaw::~powerLaw() -{} - - // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // void Foam::porosityModels::powerLaw::calcTransformModelData() @@ -100,7 +94,7 @@ void Foam::porosityModels::powerLaw::correct if (UEqn.dimensions() == dimForce) { - const volScalarField& rho = mesh_.lookupObject + const auto& rho = mesh_.lookupObject ( IOobject::groupName(rhoName_, U.group()) ); @@ -139,7 +133,7 @@ void Foam::porosityModels::powerLaw::correct if (UEqn.dimensions() == dimForce) { - const volScalarField& rho = mesh_.lookupObject + const auto& rho = mesh_.lookupObject ( IOobject::groupName(rhoName_, U.group()) ); diff --git a/src/finiteVolume/cfdTools/general/porosityModel/powerLaw/powerLaw.H b/src/finiteVolume/cfdTools/general/porosityModel/powerLaw/powerLaw.H index 3d97f2786f..305e60e5e3 100644 --- a/src/finiteVolume/cfdTools/general/porosityModel/powerLaw/powerLaw.H +++ b/src/finiteVolume/cfdTools/general/porosityModel/powerLaw/powerLaw.H @@ -119,7 +119,7 @@ public: ); //- Destructor - virtual ~powerLaw(); + virtual ~powerLaw() = default; // Member Functions diff --git a/src/finiteVolume/cfdTools/general/porosityModel/powerLaw/powerLawTemplates.C b/src/finiteVolume/cfdTools/general/porosityModel/powerLaw/powerLawTemplates.C index 7ed3d2ead7..30df618f66 100644 --- a/src/finiteVolume/cfdTools/general/porosityModel/powerLaw/powerLawTemplates.C +++ b/src/finiteVolume/cfdTools/general/porosityModel/powerLaw/powerLawTemplates.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -37,14 +37,12 @@ void Foam::porosityModels::powerLaw::apply const scalar C0 = C0_; const scalar C1m1b2 = (C1_ - 1.0)/2.0; - forAll(cellZoneIDs_, zoneI) + for (const label zonei : cellZoneIDs_) { - const labelList& cells = mesh_.cellZones()[cellZoneIDs_[zoneI]]; + const labelList& cells = mesh_.cellZones()[zonei]; - forAll(cells, i) + for (const label celli : cells) { - const label celli = cells[i]; - Udiag[celli] += V[celli]*rho[celli]*C0*pow(magSqr(U[celli]), C1m1b2); } @@ -63,14 +61,12 @@ void Foam::porosityModels::powerLaw::apply const scalar C0 = C0_; const scalar C1m1b2 = (C1_ - 1.0)/2.0; - forAll(cellZoneIDs_, zoneI) + for (const label zonei : cellZoneIDs_) { - const labelList& cells = mesh_.cellZones()[cellZoneIDs_[zoneI]]; + const labelList& cells = mesh_.cellZones()[zonei]; - forAll(cells, i) + for (const label celli : cells) { - const label celli = cells[i]; - AU[celli] = AU[celli] + I*(rho[celli]*C0*pow(magSqr(U[celli]), C1m1b2)); } diff --git a/src/finiteVolume/cfdTools/general/porosityModel/solidification/solidification.C b/src/finiteVolume/cfdTools/general/porosityModel/solidification/solidification.C index 68d3edcf77..50276c115b 100644 --- a/src/finiteVolume/cfdTools/general/porosityModel/solidification/solidification.C +++ b/src/finiteVolume/cfdTools/general/porosityModel/solidification/solidification.C @@ -99,7 +99,7 @@ void Foam::porosityModels::solidification::correct if (UEqn.dimensions() == dimForce) { - const volScalarField& rho = mesh_.lookupObject + const auto& rho = mesh_.lookupObject ( IOobject::groupName(rhoName_, U.group()) ); @@ -138,7 +138,7 @@ void Foam::porosityModels::solidification::correct if (UEqn.dimensions() == dimForce) { - const volScalarField& rho = mesh_.lookupObject + const auto& rho = mesh_.lookupObject ( IOobject::groupName(rhoName_, U.group()) ); diff --git a/src/finiteVolume/cfdTools/general/porosityModel/solidification/solidification.H b/src/finiteVolume/cfdTools/general/porosityModel/solidification/solidification.H index 3922d54775..ee83b6ee7e 100644 --- a/src/finiteVolume/cfdTools/general/porosityModel/solidification/solidification.H +++ b/src/finiteVolume/cfdTools/general/porosityModel/solidification/solidification.H @@ -63,14 +63,9 @@ Description // use the global coordinate system coordinateSystem { - type cartesian; origin (0 0 0); - coordinateRotation - { - type axesRotation; - e1 (1 0 0); - e2 (0 1 0); - } + e1 (1 0 0); + e2 (0 1 0); } } \endverbatim diff --git a/src/finiteVolume/cfdTools/general/porosityModel/solidification/solidificationTemplates.C b/src/finiteVolume/cfdTools/general/porosityModel/solidification/solidificationTemplates.C index d9ea04d59e..9abd56a62f 100644 --- a/src/finiteVolume/cfdTools/general/porosityModel/solidification/solidificationTemplates.C +++ b/src/finiteVolume/cfdTools/general/porosityModel/solidification/solidificationTemplates.C @@ -38,18 +38,17 @@ void Foam::porosityModels::solidification::apply const volVectorField& U ) const { - const volScalarField& T = mesh_.lookupObject + const auto& T = mesh_.lookupObject ( IOobject::groupName(TName_, U.group()) ); - forAll(cellZoneIDs_, zoneI) + for (const label zonei : cellZoneIDs_) { - const labelList& cells = mesh_.cellZones()[cellZoneIDs_[zoneI]]; + const labelList& cells = mesh_.cellZones()[zonei]; - forAll(cells, i) + for (const label celli : cells) { - const label celli = cells[i]; Udiag[celli] += V[celli]*alpha[celli]*rho[celli]*D_->value(T[celli]); } @@ -66,18 +65,17 @@ void Foam::porosityModels::solidification::apply const volVectorField& U ) const { - const volScalarField& T = mesh_.lookupObject + const auto& T = mesh_.lookupObject ( IOobject::groupName(TName_, U.group()) ); - forAll(cellZoneIDs_, zoneI) + for (const label zonei : cellZoneIDs_) { - const labelList& cells = mesh_.cellZones()[cellZoneIDs_[zoneI]]; + const labelList& cells = mesh_.cellZones()[zonei]; - forAll(cells, i) + for (const label celli : cells) { - const label celli = cells[i]; AU[celli] += tensor::I*alpha[celli]*rho[celli]*D_->value(T[celli]); } @@ -100,7 +98,7 @@ void Foam::porosityModels::solidification::apply } else { - const volScalarField& alpha = mesh_.lookupObject + const auto& alpha = mesh_.lookupObject ( IOobject::groupName(alphaName_, U.group()) ); @@ -124,7 +122,7 @@ void Foam::porosityModels::solidification::apply } else { - const volScalarField& alpha = mesh_.lookupObject + const auto& alpha = mesh_.lookupObject ( IOobject::groupName(alphaName_, U.group()) ); diff --git a/src/finiteVolume/fields/fvPatchFields/derived/cylindricalInletVelocity/cylindricalInletVelocityFvPatchVectorField.H b/src/finiteVolume/fields/fvPatchFields/derived/cylindricalInletVelocity/cylindricalInletVelocityFvPatchVectorField.H index 833714cce1..f97698335d 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/cylindricalInletVelocity/cylindricalInletVelocityFvPatchVectorField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/cylindricalInletVelocity/cylindricalInletVelocityFvPatchVectorField.H @@ -29,7 +29,7 @@ Group Description This boundary condition describes an inlet vector boundary condition in - cylindrical co-ordinates given a central axis, central point, rpm, axial + cylindrical coordinates given a central axis, central point, rpm, axial and radial velocity. Usage diff --git a/src/finiteVolume/fields/fvPatchFields/derived/phaseHydrostaticPressure/phaseHydrostaticPressureFvPatchScalarField.H b/src/finiteVolume/fields/fvPatchFields/derived/phaseHydrostaticPressure/phaseHydrostaticPressureFvPatchScalarField.H index 94b71defce..94ae12a9fd 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/phaseHydrostaticPressure/phaseHydrostaticPressureFvPatchScalarField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/phaseHydrostaticPressure/phaseHydrostaticPressureFvPatchScalarField.H @@ -39,7 +39,7 @@ Description \vartable p_{hyd} | hyrostatic pressure [Pa] p_{ref} | reference pressure [Pa] - x_{ref} | reference point in Cartesian co-ordinates + x_{ref} | reference point in Cartesian coordinates \rho | density (assumed uniform) g | acceleration due to gravity [m/s2] \endtable diff --git a/src/finiteVolume/fields/fvPatchFields/derived/rotatingWallVelocity/rotatingWallVelocityFvPatchVectorField.H b/src/finiteVolume/fields/fvPatchFields/derived/rotatingWallVelocity/rotatingWallVelocityFvPatchVectorField.H index 485a417bda..19e8508485 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/rotatingWallVelocity/rotatingWallVelocityFvPatchVectorField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/rotatingWallVelocity/rotatingWallVelocityFvPatchVectorField.H @@ -33,7 +33,7 @@ Description Usage \table Property | Description | Required | Default value - origin | origin of rotation in Cartesian co-ordinates | yes| + origin | origin of rotation in Cartesian coordinates | yes| axis | axis of rotation | yes | omega | angular velocty of the frame [rad/s] | yes | \endtable diff --git a/src/finiteVolume/fields/fvPatchFields/derived/swirlInletVelocity/swirlInletVelocityFvPatchVectorField.H b/src/finiteVolume/fields/fvPatchFields/derived/swirlInletVelocity/swirlInletVelocityFvPatchVectorField.H index d56fcc8f2e..5b22c192b4 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/swirlInletVelocity/swirlInletVelocityFvPatchVectorField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/swirlInletVelocity/swirlInletVelocityFvPatchVectorField.H @@ -29,7 +29,7 @@ Group Description This boundary condition describes an inlet vector boundary condition in - swirl co-ordinates given a central axis, central point, axial, radial and + swirl coordinates given a central axis, central point, axial, radial and tangential velocity profiles. Usage diff --git a/src/finiteVolume/fields/fvPatchFields/derived/turbulentDFSEMInlet/eddy/eddy.H b/src/finiteVolume/fields/fvPatchFields/derived/turbulentDFSEMInlet/eddy/eddy.H index be527caa2f..c1c91145b7 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/turbulentDFSEMInlet/eddy/eddy.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/turbulentDFSEMInlet/eddy/eddy.H @@ -42,19 +42,18 @@ SourceFiles #include "point.H" #include "tensor.H" #include "Random.H" -#include "coordinateSystem.H" +#include "boundBox.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { -// Forward declaration of classes +// Forward declarations +class eddy; class Istream; class Ostream; -// Forward declaration of friend functions and operators -class eddy; bool operator==(const eddy& a, const eddy& b); bool operator!=(const eddy& a, const eddy& b); Istream& operator>>(Istream& is, eddy& e); @@ -87,7 +86,7 @@ class eddy //- Time-averaged intensity vector alpha_; - //- Co-ordinate system transformation from local to global axes + //- Coordinate system transformation from local to global axes // X-direction aligned with max stress eigenvalue tensor Rpg_; @@ -161,7 +160,7 @@ public: //- Return the time-averaged intensity inline const vector& alpha() const; - //- Return the co-ordinate system transformation from local + //- Return the coordinate system transformation from local // principal to global axes inline const tensor& Rpg() const; diff --git a/src/finiteVolume/fields/fvPatchFields/derived/uniformDensityHydrostaticPressure/uniformDensityHydrostaticPressureFvPatchScalarField.H b/src/finiteVolume/fields/fvPatchFields/derived/uniformDensityHydrostaticPressure/uniformDensityHydrostaticPressureFvPatchScalarField.H index fb61f2f014..7497873c39 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/uniformDensityHydrostaticPressure/uniformDensityHydrostaticPressureFvPatchScalarField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/uniformDensityHydrostaticPressure/uniformDensityHydrostaticPressureFvPatchScalarField.H @@ -39,7 +39,7 @@ Description \vartable p_{hyd} | hyrostatic pressure [Pa] p_{ref} | reference pressure [Pa] - x_{ref} | reference point in Cartesian co-ordinates + x_{ref} | reference point in Cartesian coordinates \rho | density (assumed uniform) g | acceleration due to gravity [m/s2] \endtable diff --git a/src/finiteVolume/interpolation/interpolation/interpolationCellPoint/cellPointWeight/cellPointWeight.H b/src/finiteVolume/interpolation/interpolation/interpolationCellPoint/cellPointWeight/cellPointWeight.H index ed064281c1..80b2e5a835 100644 --- a/src/finiteVolume/interpolation/interpolation/interpolationCellPoint/cellPointWeight/cellPointWeight.H +++ b/src/finiteVolume/interpolation/interpolation/interpolationCellPoint/cellPointWeight/cellPointWeight.H @@ -89,7 +89,7 @@ public: //- Debug switch static int debug; - //- Tolerance used in calculating barycentric co-ordinates + //- Tolerance used in calculating barycentric coordinates // (applied to normalised values) static scalar tol; diff --git a/src/finiteVolume/interpolation/interpolation/interpolationPointMVC/pointMVCWeight.H b/src/finiteVolume/interpolation/interpolation/interpolationPointMVC/pointMVCWeight.H index a76fc7f951..2228f1a5b3 100644 --- a/src/finiteVolume/interpolation/interpolation/interpolationPointMVC/pointMVCWeight.H +++ b/src/finiteVolume/interpolation/interpolation/interpolationPointMVC/pointMVCWeight.H @@ -107,7 +107,7 @@ public: //- Debug switch static int debug; - //- Tolerance used in calculating barycentric co-ordinates + //- Tolerance used in calculating barycentric coordinates // (applied to normalised values) static scalar tol; diff --git a/src/functionObjects/field/fieldCoordinateSystemTransform/fieldCoordinateSystemTransform.C b/src/functionObjects/field/fieldCoordinateSystemTransform/fieldCoordinateSystemTransform.C index 2c4ea97f34..eefc9ca268 100644 --- a/src/functionObjects/field/fieldCoordinateSystemTransform/fieldCoordinateSystemTransform.C +++ b/src/functionObjects/field/fieldCoordinateSystemTransform/fieldCoordinateSystemTransform.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation - \\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2017-2018 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -56,23 +56,19 @@ fieldCoordinateSystemTransform : fvMeshFunctionObject(name, runTime, dict), fieldSet_(mesh_), - coordSys_(mesh_, dict.subDict("coordinateSystem")) + csysPtr_ + ( + coordinateSystem::New(mesh_, dict, coordinateSystem::typeName_()) + ) { read(dict); Info<< type() << " " << name << ":" << nl << " Applying transformation from global Cartesian to local " - << coordSys_ << nl << endl; + << *csysPtr_ << nl << endl; } -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -Foam::functionObjects::fieldCoordinateSystemTransform:: -~fieldCoordinateSystemTransform() -{} - - // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // Foam::word diff --git a/src/functionObjects/field/fieldCoordinateSystemTransform/fieldCoordinateSystemTransform.H b/src/functionObjects/field/fieldCoordinateSystemTransform/fieldCoordinateSystemTransform.H index dbc0446cb7..5f68d09f8b 100644 --- a/src/functionObjects/field/fieldCoordinateSystemTransform/fieldCoordinateSystemTransform.H +++ b/src/functionObjects/field/fieldCoordinateSystemTransform/fieldCoordinateSystemTransform.H @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation - \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2015-2018 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -29,7 +29,7 @@ Group Description Transforms a user-specified selection of fields from global Cartesian - co-ordinates to a local co-ordinate system. The fields are run-time + coordinates to a local coordinate system. The fields are run-time modifiable. Usage @@ -50,11 +50,11 @@ Usage coordinateSystem { origin (0.001 0 0); - coordinateRotation + rotation { - type axesRotation; - e1 (1 0.15 0); - e3 (0 0 -1); + type axes; + e1 (1 0.15 0); + e3 (0 0 -1); } } } @@ -65,7 +65,7 @@ Usage Property | Description | Required | Default value type | type name: fieldCoordinateSystemTransform | yes | fields | list of fields to be transformed |yes | - coordinateSystem | local co-ordinate system | yes | + coordinateSystem | local coordinate system | yes | \endtable See also @@ -107,8 +107,8 @@ protected: //- Fields to transform volFieldSelection fieldSet_; - //- Co-ordinate system to transform to - coordinateSystem coordSys_; + //- Coordinate system to transform to + autoPtr csysPtr_; // Protected Member Functions @@ -143,7 +143,7 @@ public: //- Destructor - virtual ~fieldCoordinateSystemTransform(); + virtual ~fieldCoordinateSystemTransform() = default; // Member Functions diff --git a/src/functionObjects/field/fieldCoordinateSystemTransform/fieldCoordinateSystemTransformTemplates.C b/src/functionObjects/field/fieldCoordinateSystemTransform/fieldCoordinateSystemTransformTemplates.C index 2e26c96343..2cf380522b 100644 --- a/src/functionObjects/field/fieldCoordinateSystemTransform/fieldCoordinateSystemTransformTemplates.C +++ b/src/functionObjects/field/fieldCoordinateSystemTransform/fieldCoordinateSystemTransformTemplates.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation - \\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -41,7 +41,7 @@ void Foam::functionObjects::fieldCoordinateSystemTransform::transformField store ( transFieldName, - Foam::transform(dimensionedTensor(coordSys_.R().R()), field) + Foam::transform(dimensionedTensor(csysPtr_->R()), field) ); } @@ -61,7 +61,10 @@ void Foam::functionObjects::fieldCoordinateSystemTransform::transform << type() << ": Field " << fieldName << " already in database" << endl; - transformField(lookupObject(fieldName)); + transformField + ( + lookupObject(fieldName) + ); } else if (foundObject(fieldName)) { diff --git a/src/functionObjects/field/fieldCoordinateSystemTransform/postProcessingDict b/src/functionObjects/field/fieldCoordinateSystemTransform/postProcessingDict index c1ffcfcb73..d2604fe002 100644 --- a/src/functionObjects/field/fieldCoordinateSystemTransform/postProcessingDict +++ b/src/functionObjects/field/fieldCoordinateSystemTransform/postProcessingDict @@ -41,12 +41,8 @@ functions coordinateSystem { origin (0 0 0); - coordinateRotation - { - type axesRotation; - e1 (1 0.15 0); - e3 (0 0 -1); - } + e1 (1 0.15 0); + e3 (0 0 -1); } } } diff --git a/src/functionObjects/field/regionSizeDistribution/regionSizeDistribution.C b/src/functionObjects/field/regionSizeDistribution/regionSizeDistribution.C index 98aa128897..ef509267b8 100644 --- a/src/functionObjects/field/regionSizeDistribution/regionSizeDistribution.C +++ b/src/functionObjects/field/regionSizeDistribution/regionSizeDistribution.C @@ -350,12 +350,19 @@ bool Foam::functionObjects::regionSizeDistribution::read(const dictionary& dict) const word format(dict.get("setFormat")); formatterPtr_ = writer::New(format); - if (dict.found("coordinateSystem")) + if (dict.found(coordinateSystem::typeName_())) { - coordSysPtr_.reset(new coordinateSystem(obr_, dict)); + csysPtr_.reset + ( + coordinateSystem::New(obr_, dict, coordinateSystem::typeName_()) + ); Info<< "Transforming all vectorFields with coordinate system " - << coordSysPtr_().name() << endl; + << csysPtr_->name() << endl; + } + else + { + csysPtr_.clear(); } if (isoPlanes_) @@ -897,14 +904,14 @@ bool Foam::functionObjects::regionSizeDistribution::write() volVectorField >(fldName).primitiveField(); - if (coordSysPtr_.valid()) + if (csysPtr_.valid()) { Log << "Transforming vector field " << fldName << " with coordinate system " - << coordSysPtr_().name() + << csysPtr_->name() << endl; - fld = coordSysPtr_().localVector(fld); + fld = csysPtr_->localVector(fld); } diff --git a/src/functionObjects/field/regionSizeDistribution/regionSizeDistribution.H b/src/functionObjects/field/regionSizeDistribution/regionSizeDistribution.H index 1ab6800d10..6110888cab 100644 --- a/src/functionObjects/field/regionSizeDistribution/regionSizeDistribution.H +++ b/src/functionObjects/field/regionSizeDistribution/regionSizeDistribution.H @@ -113,8 +113,8 @@ Usage maxDiameter | maximum region equivalent diameter | yes | minDiameter | minimum region equivalent diameter | no | 0 setFormat | writing format | yes | - origin | origin of local co-ordinate system | yes | - coordinateRoation | orientation of local co-ordinate system | no + origin | origin of local coordinate system | yes | + coordinateRoation | orientation of local coordinate system | no log | Log to standard output | no | yes isoPlanes | switch for isoPlanes | no | false origin | origin of the plane when isoPlanes is used | no | none @@ -198,7 +198,7 @@ class regionSizeDistribution autoPtr> formatterPtr_; //- Optional coordinate system - autoPtr coordSysPtr_; + autoPtr csysPtr_; // Optional extra definition of bins on planes downstream to the origin // point and maximum diameter diff --git a/src/functionObjects/forces/forces/forces.C b/src/functionObjects/forces/forces/forces.C index cc166499ea..ece9acc17d 100644 --- a/src/functionObjects/forces/forces/forces.C +++ b/src/functionObjects/forces/forces/forces.C @@ -29,6 +29,7 @@ License #include "turbulentTransportModel.H" #include "turbulentFluidThermoModel.H" #include "addToRunTimeSelectionTable.H" +#include "cartesianCS.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -37,7 +38,6 @@ namespace Foam namespace functionObjects { defineTypeNameAndDebug(forces, 0); - addToRunTimeSelectionTable(functionObject, forces, dictionary); } } @@ -857,7 +857,23 @@ bool Foam::functionObjects::forces::read(const dictionary& dict) // specified directly, from coordinate system, or implicitly (0 0 0) if (!dict.readIfPresent("CofR", coordSys_.origin())) { - coordSys_ = coordinateSystem(obr_, dict); + // The 'coordinateSystem' sub-dictionary is optional, + // but enforce use of a cartesian system. + + if (dict.found(coordinateSystem::typeName_())) + { + // New() for access to indirect (global) coordinate system + coordSys_ = + coordinateSystem::New + ( + obr_, dict, coordinateSystem::typeName_() + ); + } + else + { + coordSys_ = coordSystem::cartesian(dict); + } + localSystem_ = true; } diff --git a/src/functionObjects/forces/forces/forces.H b/src/functionObjects/forces/forces/forces.H index 4a27514c6a..94b89a5635 100644 --- a/src/functionObjects/forces/forces/forces.H +++ b/src/functionObjects/forces/forces/forces.H @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2015-2018 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -32,21 +32,21 @@ Description skin-friction forces over a given list of patches, and the resistance from porous zones. - Forces and moments are calculated, with optional co-ordinate system and + Forces and moments are calculated, with optional coordinate system and writing of binned data, where force and moment contributions are collected into a user-defined number of bins that span the input geometries for a user-defined direction vector. Data is written into multiple files in the postProcessing/\ directory: - - force.dat : forces in global Cartesian co-ordinate system - - moment.dat : moments in global Cartesian co-ordinate system - - forceBin.dat : force bins in global Cartesian co-ordinate system - - momentBin.dat : moment bins in global Cartesian co-ordinate system - - localForce.dat : forces in local co-ordinate system - - localMoment.dat : moments in local co-ordinate system - - localForceBin.dat : force bins in local co-ordinate system - - localMomentBin.dat : moment bins in local co-ordinate system + - force.dat : forces in global Cartesian coordinate system + - moment.dat : moments in global Cartesian coordinate system + - forceBin.dat : force bins in global Cartesian coordinate system + - momentBin.dat : moment bins in global Cartesian coordinate system + - localForce.dat : forces in local Cartesian coordinate system + - localMoment.dat : moments in local Cartesian coordinate system + - localForceBin.dat : force bins in local Cartesian coordinate system + - localMomentBin.dat : moment bins in local Cartesian coordinate system Usage Example of function object specification: @@ -107,13 +107,19 @@ Note CofR (0 0 0); \endverbatim or + \verbatim + origin (0 0 0); + e1 (0 1 0); + e3 (0 0 1); + \endverbatim + or \verbatim coordinateSystem { origin (0 0 0); - coordinateRotation + rotation { - type axesRotation; + type axes; e3 (0 0 1); e1 (1 0 0); } @@ -136,7 +142,7 @@ SourceFiles #include "fvMeshFunctionObject.H" #include "writeFile.H" -#include "coordinateSystem.H" +#include "cartesianCS.H" #include "volFieldsFwd.H" #include "HashSet.H" #include "Tuple2.H" @@ -224,9 +230,9 @@ protected: scalar pRef_; //- Coordinate system used when evaluting forces/moments - coordinateSystem coordSys_; + coordSystem::cartesian coordSys_; - //- Flag to indicate whether we are using a local co-ordinate sys + //- Flag to indicate whether we are using a local coordinates bool localSystem_; //- Flag to include porosity effects diff --git a/src/fvOptions/sources/derived/explicitPorositySource/explicitPorositySource.H b/src/fvOptions/sources/derived/explicitPorositySource/explicitPorositySource.H index 4b17b17174..74afb15cbc 100644 --- a/src/fvOptions/sources/derived/explicitPorositySource/explicitPorositySource.H +++ b/src/fvOptions/sources/derived/explicitPorositySource/explicitPorositySource.H @@ -44,14 +44,9 @@ Usage coordinateSystem { - type cartesian; origin (0 0 0); - coordinateRotation - { - type axesRotation; - e1 (0.70710678 0.70710678 0); - e2 (0 0 1); - } + e1 (0.70710678 0.70710678 0); + e2 (0 0 1); } } } diff --git a/src/fvOptions/sources/derived/jouleHeatingSource/jouleHeatingSource.C b/src/fvOptions/sources/derived/jouleHeatingSource/jouleHeatingSource.C index 0ecc8d31dd..b2f4df5343 100644 --- a/src/fvOptions/sources/derived/jouleHeatingSource/jouleHeatingSource.C +++ b/src/fvOptions/sources/derived/jouleHeatingSource/jouleHeatingSource.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2016-2018 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -53,16 +53,16 @@ const Foam::word Foam::fv::jouleHeatingSource::sigmaName(typeName + ":sigma"); // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -const Foam::coordinateSystem& Foam::fv::jouleHeatingSource::coordSys() const +const Foam::coordinateSystem& Foam::fv::jouleHeatingSource::csys() const { - if (!coordSysPtr_.valid()) + if (!csysPtr_ || !csysPtr_.valid()) { FatalErrorInFunction - << "Co-ordinate system invalid" + << "Coordinate system invalid" << abort(FatalError); } - return *coordSysPtr_; + return *csysPtr_; } @@ -87,10 +87,18 @@ Foam::fv::jouleHeatingSource::transformSigma dimensionedSymmTensor(sigmaLocal.dimensions(), Zero), zeroGradientFvPatchField::typeName ); - auto& sigma = tsigma.ref(); - sigma.primitiveFieldRef() = coordSys().R().transformVector(sigmaLocal); + if (csys().uniform()) + { + sigma.primitiveFieldRef() = + csys().transformPrincipal(sigmaLocal); + } + else + { + sigma.primitiveFieldRef() = + csys().transformPrincipal(mesh_.cellCentres(), sigmaLocal); + } sigma.correctBoundaryConditions(); @@ -125,7 +133,7 @@ Foam::fv::jouleHeatingSource::jouleHeatingSource anisotropicElectricalConductivity_(false), scalarSigmaVsTPtr_(nullptr), vectorSigmaVsTPtr_(nullptr), - coordSysPtr_(nullptr), + csysPtr_(nullptr), curTimeIndex_(-1) { // Set the field name to that of the energy field from which the temperature @@ -223,7 +231,14 @@ bool Foam::fv::jouleHeatingSource::read(const dictionary& dict) Info<< " Using vector electrical conductivity" << endl; initialiseSigma(coeffs_, vectorSigmaVsTPtr_); - coordSysPtr_ = coordinateSystem::New(mesh_, coeffs_); + + csysPtr_ = + coordinateSystem::New + ( + mesh_, + coeffs_, + coordinateSystem::typeName_() + ); } else { diff --git a/src/fvOptions/sources/derived/jouleHeatingSource/jouleHeatingSource.H b/src/fvOptions/sources/derived/jouleHeatingSource/jouleHeatingSource.H index 4842cfa1ed..02e003975f 100644 --- a/src/fvOptions/sources/derived/jouleHeatingSource/jouleHeatingSource.H +++ b/src/fvOptions/sources/derived/jouleHeatingSource/jouleHeatingSource.H @@ -91,15 +91,9 @@ Usage coordinateSystem { - type cartesian; - origin (0 0 0); - - coordinateRotation - { - type axesRotation; - e1 (1 0 0); - e3 (0 0 1); - } + origin (0 0 0); + e1 (1 0 0); + e3 (0 0 1); } // Optionally specify sigma as a function of temperature @@ -179,8 +173,8 @@ class jouleHeatingSource //- Electrical conductivity as a vector function of temperature autoPtr> vectorSigmaVsTPtr_; - //- Co-ordinate system - used for vectorial electrical conductivity - autoPtr coordSysPtr_; + //- Coordinate system - used for vectorial electrical conductivity + autoPtr csysPtr_; //- Current time index (used for updating) label curTimeIndex_; @@ -194,9 +188,8 @@ class jouleHeatingSource //- No copy assignment void operator=(const jouleHeatingSource&) = delete; - //- Return the co-ordinate system for anisotropic electrical - // conductivity - const coordinateSystem& coordSys() const; + //- The coordinate system for anisotropic electrical conductivity + const coordinateSystem& csys() const; //- Transform the anisotropic electrical conductivity into global system tmp transformSigma diff --git a/src/fvOptions/sources/derived/rotorDiskSource/rotorDiskSource.C b/src/fvOptions/sources/derived/rotorDiskSource/rotorDiskSource.C index 0d518f551b..77c13c70d9 100644 --- a/src/fvOptions/sources/derived/rotorDiskSource/rotorDiskSource.C +++ b/src/fvOptions/sources/derived/rotorDiskSource/rotorDiskSource.C @@ -91,7 +91,7 @@ void Foam::fv::rotorDiskSource::checkData() case ifSurfaceNormal: { scalar UIn(coeffs_.get("inletNormalVelocity")); - inletVelocity_ = -coordSys_.R().e3()*UIn; + inletVelocity_ = -coordSys_.e3()*UIn; break; } case ifLocal: @@ -333,17 +333,6 @@ void Foam::fv::rotorDiskSource::createCoordinateSystem() coeffs_.readEntry("refDirection", refDir); - cylindrical_.reset - ( - new cylindrical - ( - mesh_, - axis, - origin, - cells_ - ) - ); - // Set the face areas and apply correction to calculated axis // e.g. if cellZone is more than a single layer in thickness setFaceArea(axis, true); @@ -356,17 +345,6 @@ void Foam::fv::rotorDiskSource::createCoordinateSystem() coeffs_.readEntry("axis", axis); coeffs_.readEntry("refDirection", refDir); - cylindrical_.reset - ( - new cylindrical - ( - mesh_, - axis, - origin, - cells_ - ) - ); - setFaceArea(axis, false); break; @@ -381,7 +359,7 @@ void Foam::fv::rotorDiskSource::createCoordinateSystem() } } - coordSys_ = cylindricalCS("rotorCS", origin, axis, refDir); + coordSys_ = coordSystem::cylindrical(origin, axis, refDir); const scalar sumArea = gSum(area_); const scalar diameter = Foam::sqrt(4.0*sumArea/mathematical::pi); @@ -389,24 +367,25 @@ void Foam::fv::rotorDiskSource::createCoordinateSystem() << " - disk diameter = " << diameter << nl << " - disk area = " << sumArea << nl << " - origin = " << coordSys_.origin() << nl - << " - r-axis = " << coordSys_.R().e1() << nl - << " - psi-axis = " << coordSys_.R().e2() << nl - << " - z-axis = " << coordSys_.R().e3() << endl; + << " - r-axis = " << coordSys_.e1() << nl + << " - psi-axis = " << coordSys_.e2() << nl + << " - z-axis = " << coordSys_.e3() << endl; } void Foam::fv::rotorDiskSource::constructGeometry() { - const vectorField& C = mesh_.C(); + const pointUIndList cc(mesh_.C(), cells_); + + // Optional: for later transform(), invTransform() + /// Rcyl_.reset(coordSys_.R(cc).ptr()); forAll(cells_, i) { if (area_[i] > ROOTVSMALL) { - const label celli = cells_[i]; - // Position in (planar) rotor coordinate system - x_[i] = coordSys_.localPosition(C[celli]); + x_[i] = coordSys_.localPosition(cc[i]); // Cache max radius rMax_ = max(rMax_, x_[i].x()); @@ -482,7 +461,6 @@ Foam::fv::rotorDiskSource::rotorDiskSource Rcone_(cells_.size(), I), area_(cells_.size(), Zero), coordSys_(), - cylindrical_(), rMax_(0.0), trim_(trimModel::New(*this, coeffs_)), blade_(coeffs_.subDict("blade")), diff --git a/src/fvOptions/sources/derived/rotorDiskSource/rotorDiskSource.H b/src/fvOptions/sources/derived/rotorDiskSource/rotorDiskSource.H index ec293d7eda..9a607d7c04 100644 --- a/src/fvOptions/sources/derived/rotorDiskSource/rotorDiskSource.H +++ b/src/fvOptions/sources/derived/rotorDiskSource/rotorDiskSource.H @@ -102,7 +102,6 @@ SourceFiles #include "cellSetOption.H" #include "cylindricalCS.H" -#include "cylindrical.H" #include "Enum.H" #include "bladeModel.H" #include "profileModelList.H" @@ -184,7 +183,7 @@ protected: flapData flap_; //- Cell centre positions in local rotor frame - // (Cylindrical r, theta, z) + // (Cylindrical r-theta-z) List x_; //- Rotation tensor for flap angle @@ -194,10 +193,10 @@ protected: List area_; //- Rotor local cylindrical coordinate system (r-theta-z) - cylindricalCS coordSys_; + coordSystem::cylindrical coordSys_; - //- Rotor transformation coordinate system - autoPtr cylindrical_; + //- Cached rotation tensors for cylindrical coordinates + autoPtr Rcyl_; //- Maximum radius scalar rMax_; @@ -273,11 +272,11 @@ public: inline scalar omega() const; //- Return the cell centre positions in local rotor frame - // (Cylindrical r, theta, z) + // (Cylindrical r-theta-z) inline const List& x() const; //- Return the rotor coordinate system (r-theta-z) - inline const cylindricalCS& coordSys() const; + inline const coordSystem::cylindrical& coordSys() const; // Evaluation diff --git a/src/fvOptions/sources/derived/rotorDiskSource/rotorDiskSourceI.H b/src/fvOptions/sources/derived/rotorDiskSource/rotorDiskSourceI.H index e923790514..2e8a4581b4 100644 --- a/src/fvOptions/sources/derived/rotorDiskSource/rotorDiskSourceI.H +++ b/src/fvOptions/sources/derived/rotorDiskSource/rotorDiskSourceI.H @@ -27,25 +27,26 @@ License // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -Foam::scalar Foam::fv::rotorDiskSource::rhoRef() const +inline Foam::scalar Foam::fv::rotorDiskSource::rhoRef() const { return rhoRef_; } -Foam::scalar Foam::fv::rotorDiskSource::omega() const +inline Foam::scalar Foam::fv::rotorDiskSource::omega() const { return omega_; } -const Foam::List& Foam::fv::rotorDiskSource::x() const +inline const Foam::List& Foam::fv::rotorDiskSource::x() const { return x_; } -const Foam::cylindricalCS& Foam::fv::rotorDiskSource::coordSys() const +inline const Foam::coordSystem::cylindrical& +Foam::fv::rotorDiskSource::coordSys() const { return coordSys_; } diff --git a/src/fvOptions/sources/derived/rotorDiskSource/rotorDiskSourceTemplates.C b/src/fvOptions/sources/derived/rotorDiskSource/rotorDiskSourceTemplates.C index c5cab4d847..89eabc7fa6 100644 --- a/src/fvOptions/sources/derived/rotorDiskSource/rotorDiskSourceTemplates.C +++ b/src/fvOptions/sources/derived/rotorDiskSource/rotorDiskSourceTemplates.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -26,7 +26,6 @@ License #include "rotorDiskSource.H" #include "volFields.H" #include "unitConversion.H" -#include "transform.H" using namespace Foam::constant; @@ -51,6 +50,9 @@ void Foam::fv::rotorDiskSource::calculate scalar AOAmin = GREAT; scalar AOAmax = -GREAT; + // Cached position-dependent rotations available? + const bool hasCache = Rcyl_.valid(); + forAll(cells_, i) { if (area_[i] > ROOTVSMALL) @@ -59,8 +61,15 @@ void Foam::fv::rotorDiskSource::calculate const scalar radius = x_[i].x(); + const tensor Rcyl = + ( + hasCache + ? (*Rcyl_)[i] + : coordSys_.R(mesh_.C()[celli]) + ); + // Transform velocity into local cylindrical reference frame - vector Uc = cylindrical_->invTransform(U[celli], i); + vector Uc = invTransform(Rcyl, U[celli]); // Transform velocity into local coning system Uc = transform(Rcone_[i], Uc); @@ -132,8 +141,8 @@ void Foam::fv::rotorDiskSource::calculate // Transform force from local coning system into rotor cylindrical localForce = invTransform(Rcone_[i], localForce); - // Transform force into global Cartesian co-ordinate system - force[celli] = cylindrical_->transform(localForce, i); + // Transform force into global Cartesian coordinate system + force[celli] = transform(Rcyl, localForce); if (divideVolume) { diff --git a/src/fvOptions/sources/derived/rotorDiskSource/trimModel/targetCoeff/targetCoeffTrim.C b/src/fvOptions/sources/derived/rotorDiskSource/trimModel/targetCoeff/targetCoeffTrim.C index bfc457b95f..fd2d7a82ed 100644 --- a/src/fvOptions/sources/derived/rotorDiskSource/trimModel/targetCoeff/targetCoeffTrim.C +++ b/src/fvOptions/sources/derived/rotorDiskSource/trimModel/targetCoeff/targetCoeffTrim.C @@ -57,9 +57,9 @@ Foam::vector Foam::targetCoeffTrim::calcCoeffs const List& x = rotor_.x(); const vector& origin = rotor_.coordSys().origin(); - const vector& rollAxis = rotor_.coordSys().R().e1(); - const vector& pitchAxis = rotor_.coordSys().R().e2(); - const vector& yawAxis = rotor_.coordSys().R().e3(); + const vector& rollAxis = rotor_.coordSys().e1(); + const vector& pitchAxis = rotor_.coordSys().e2(); + const vector& yawAxis = rotor_.coordSys().e3(); scalar coeff1 = alpha_*sqr(rotor_.omega())*mathematical::pi; diff --git a/src/fvOptions/sources/interRegion/interRegionExplicitPorositySource/interRegionExplicitPorositySource.H b/src/fvOptions/sources/interRegion/interRegionExplicitPorositySource/interRegionExplicitPorositySource.H index c8d7602a7f..2946c9801f 100644 --- a/src/fvOptions/sources/interRegion/interRegionExplicitPorositySource/interRegionExplicitPorositySource.H +++ b/src/fvOptions/sources/interRegion/interRegionExplicitPorositySource/interRegionExplicitPorositySource.H @@ -43,13 +43,9 @@ Description coordinateSystem { - origin (0 0 0); - coordinateRotation - { - type axesRotation; - e1 (0.70710678 0.70710678 0); - e2 (0 0 1); - } + origin (0 0 0); + e1 (0.70710678 0.70710678 0); + e2 (0 0 1); } } } diff --git a/src/lagrangian/basic/injectedParticle/injectedParticleIO.C b/src/lagrangian/basic/injectedParticle/injectedParticleIO.C index 9c5842682b..4fa325b9e4 100644 --- a/src/lagrangian/basic/injectedParticle/injectedParticleIO.C +++ b/src/lagrangian/basic/injectedParticle/injectedParticleIO.C @@ -63,7 +63,7 @@ Foam::injectedParticle::injectedParticle if (readFields) { // After the base particle class has read the fields from file and - // constructed the necessary barycentric co-ordinates we can update the + // constructed the necessary barycentric coordinates we can update the // particle position on this mesh position_ = particle::position(); diff --git a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleCollector/ParticleCollector.C b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleCollector/ParticleCollector.C index 42613d5e8b..593da83866 100644 --- a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleCollector/ParticleCollector.C +++ b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/ParticleCollector/ParticleCollector.C @@ -207,7 +207,7 @@ void Foam::ParticleCollector::initConcentricCircles() faces_.setSize(nFace); area_.setSize(nFace); - coordSys_ = cylindricalCS("collector", origin, normal_[0], refDir); + coordSys_ = coordSystem::cylindrical(origin, normal_[0], refDir); List