diff --git a/etc/caseDicts/annotated/extrudeMeshDict b/etc/caseDicts/annotated/extrudeMeshDict index 1acb2ca611..50bd77c28f 100644 --- a/etc/caseDicts/annotated/extrudeMeshDict +++ b/etc/caseDicts/annotated/extrudeMeshDict @@ -57,7 +57,7 @@ extrudeModel wedge; //extrudeModel linearRadial; //- Extrudes into sphere around (0 0 0) with specified radii -//extrudeModel radial; +//extrudeModel sphericalRadial; //- Extrudes into sphere with grading according to pressure (atmospherics) //extrudeModel sigmaRadial; @@ -91,7 +91,7 @@ linearRadialCoeffs Rsurface 0.01; } -radialCoeffs +sphericalRadialCoeffs { // Radii specified through interpolation table R table ((0 0.01)(3 0.03)(10 0.1)); diff --git a/etc/caseDicts/annotated/extrudeToRegionMeshDict b/etc/caseDicts/annotated/extrudeToRegionMeshDict index 0c6496e372..e6211fcf6f 100644 --- a/etc/caseDicts/annotated/extrudeToRegionMeshDict +++ b/etc/caseDicts/annotated/extrudeToRegionMeshDict @@ -47,7 +47,7 @@ extrudeModel linearNormal; // extrudeModel linearDirection; // extrudeModel wedge; // extrudeModel linearRadial; -// extrudeModel radial; +// extrudeModel sphericalRadial; // extrudeModel sigmaRadial; nLayers 10; @@ -79,7 +79,7 @@ linearRadialCoeffs Rsurface 0.01; } -radialCoeffs +sphericalRadialCoeffs { // Radii specified through interpolation table R table ((0 0.01)(3 0.03)(10 0.1)); diff --git a/etc/caseDicts/mesh/generation/extrudeMeshDict b/etc/caseDicts/mesh/generation/extrudeMeshDict index efa9cd34ed..bec5658874 100644 --- a/etc/caseDicts/mesh/generation/extrudeMeshDict +++ b/etc/caseDicts/mesh/generation/extrudeMeshDict @@ -37,7 +37,7 @@ linearDirection: linear extrusion in specified direction wedge: single-layer, wedge extrusion with wedge type (axisymmetric) sector: sector extrusion about specified axis linearRadial: linear extrusion in radial direction -radial: linear extrusion in radial direction with multiple radii +sphericalRadial: spherical radial extrusion with radii function */ thickness 0.5; // used by plane extrusion @@ -73,7 +73,7 @@ linearRadialCoeffs Rsurface 0.1; } -radialCoeffs +sphericalRadialCoeffs { R table ((0 0.01) (3 0.03) (10 0.1)); } diff --git a/src/mesh/extrudeModel/Make/files b/src/mesh/extrudeModel/Make/files index f6c2f50b04..e3cff247a4 100644 --- a/src/mesh/extrudeModel/Make/files +++ b/src/mesh/extrudeModel/Make/files @@ -4,7 +4,8 @@ linearNormal/linearNormal.C planeExtrusion/planeExtrusion.C linearDirection/linearDirection.C linearRadial/linearRadial.C -radial/radial.C +sphericalRadial/sphericalRadial.C +cylindricalRadial/cylindricalRadial.C sigmaRadial/sigmaRadial.C sector/sector.C cyclicSector/cyclicSector.C diff --git a/src/mesh/extrudeModel/cylindricalRadial/cylindricalRadial.C b/src/mesh/extrudeModel/cylindricalRadial/cylindricalRadial.C new file mode 100644 index 0000000000..3990bd6b21 --- /dev/null +++ b/src/mesh/extrudeModel/cylindricalRadial/cylindricalRadial.C @@ -0,0 +1,93 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2013-2023 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 "cylindricalRadial.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace extrudeModels +{ + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +defineTypeNameAndDebug(cylindricalRadial, 0); + +addToRunTimeSelectionTable(extrudeModel, cylindricalRadial, dictionary); + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +cylindricalRadial::cylindricalRadial(const dictionary& dict) +: + extrudeModel(typeName, dict), + axisPt_(coeffDict_.lookup("axisPt")), + axis_(coeffDict_.lookup("axis")), + R_(Function1::New("R", coeffDict_)) +{ + axis_ /= mag(axis_); +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +cylindricalRadial::~cylindricalRadial() +{} + + +// * * * * * * * * * * * * * * * * Operators * * * * * * * * * * * * * * * * // + +point cylindricalRadial::operator() +( + const point& surfacePoint, + const vector& surfaceNormal, + const label layer +) const +{ + // Axial offset of surfacePoint + const vector axisOffset = axis_*(axis_ & (surfacePoint - axisPt_)); + + // Radial offset of surfacePoint + const vector rs = (surfacePoint - axisPt_) - axisOffset; + + // Radial direction of surfacePoint + const vector rsHat = rs/mag(rs); + + // Radius of layer + const scalar r = R_->value(layer); + + // Return new point + return axisPt_ + axisOffset + r*rsHat; +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace extrudeModels +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/mesh/extrudeModel/cylindricalRadial/cylindricalRadial.H b/src/mesh/extrudeModel/cylindricalRadial/cylindricalRadial.H new file mode 100644 index 0000000000..891285464f --- /dev/null +++ b/src/mesh/extrudeModel/cylindricalRadial/cylindricalRadial.H @@ -0,0 +1,106 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2013-2023 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 . + +Class + Foam::extrudeModels::cylindricalRadial + +Description + Extrudes by transforming points in the cylindrical radial direction + + Generates layers at radii specified by a Foam::Function1 + of the layer index. + +\*---------------------------------------------------------------------------*/ + +#ifndef cylindricalRadial_H +#define cylindricalRadial_H + +#include "extrudeModel.H" +#include "Function1.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace extrudeModels +{ + +/*---------------------------------------------------------------------------*\ + Class cylindricalRadial Declaration +\*---------------------------------------------------------------------------*/ + +class cylindricalRadial +: + public extrudeModel +{ + // Private Data + + //- Point on axis + const point axisPt_; + + //- Normalised axis + vector axis_; + + //- Radial distribution of layers + autoPtr> R_; + + +public: + + //- Runtime type information + TypeName("cylindricalRadial"); + + // Constructors + + //- Construct from dictionary + cylindricalRadial(const dictionary& dict); + + + //-Destructor + virtual ~cylindricalRadial(); + + + // Member Operators + + //- Return the new point corresponding to the surfacePoint + // on the specified layer. + // The surfaceNormal is not used. + point operator() + ( + const point& surfacePoint, + const vector& surfaceNormal, + const label layer + ) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace extrudeModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/mesh/extrudeModel/radial/radial.C b/src/mesh/extrudeModel/sphericalRadial/sphericalRadial.C similarity index 78% rename from src/mesh/extrudeModel/radial/radial.C rename to src/mesh/extrudeModel/sphericalRadial/sphericalRadial.C index 288b6cdbaa..0124c0a447 100644 --- a/src/mesh/extrudeModel/radial/radial.C +++ b/src/mesh/extrudeModel/sphericalRadial/sphericalRadial.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2013-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2013-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -23,7 +23,7 @@ License \*---------------------------------------------------------------------------*/ -#include "radial.H" +#include "sphericalRadial.H" #include "addToRunTimeSelectionTable.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -35,14 +35,14 @@ namespace extrudeModels // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -defineTypeNameAndDebug(radial, 0); +defineTypeNameAndDebug(sphericalRadial, 0); -addToRunTimeSelectionTable(extrudeModel, radial, dictionary); +addToRunTimeSelectionTable(extrudeModel, sphericalRadial, dictionary); // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -radial::radial(const dictionary& dict) +sphericalRadial::sphericalRadial(const dictionary& dict) : extrudeModel(typeName, dict), R_(Function1::New("R", coeffDict_)) @@ -51,27 +51,29 @@ radial::radial(const dictionary& dict) // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // -radial::~radial() +sphericalRadial::~sphericalRadial() {} // * * * * * * * * * * * * * * * * Operators * * * * * * * * * * * * * * * * // -point radial::operator() +point sphericalRadial::operator() ( const point& surfacePoint, const vector& surfaceNormal, const label layer ) const { - // radius of the surface - scalar rs = mag(surfacePoint); - vector rsHat = surfacePoint/rs; + // Radius of the surface + const scalar rs = mag(surfacePoint); - scalar r = R_->value(layer); + // Radial direction of surfacePoint + const vector rsHat = surfacePoint/rs; -Pout<< "** for layer " << layer << " r:" << r << endl; + // Radius of layer + const scalar r = R_->value(layer); + // Return new point return r*rsHat; } diff --git a/src/mesh/extrudeModel/radial/radial.H b/src/mesh/extrudeModel/sphericalRadial/sphericalRadial.H similarity index 75% rename from src/mesh/extrudeModel/radial/radial.H rename to src/mesh/extrudeModel/sphericalRadial/sphericalRadial.H index c635d36b75..6f05ee71d8 100644 --- a/src/mesh/extrudeModel/radial/radial.H +++ b/src/mesh/extrudeModel/sphericalRadial/sphericalRadial.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2013-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2013-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -22,14 +22,18 @@ License along with OpenFOAM. If not, see . Class - Foam::extrudeModels::radial + Foam::extrudeModels::sphericalRadial Description + Extrudes by transforming points in the spherical radial direction + + Generates layers at radii specified by a Foam::Function1 + of the layer index. \*---------------------------------------------------------------------------*/ -#ifndef radial_H -#define radial_H +#ifndef sphericalRadial_H +#define sphericalRadial_H #include "extrudeModel.H" #include "Function1.H" @@ -42,35 +46,39 @@ namespace extrudeModels { /*---------------------------------------------------------------------------*\ - Class radial Declaration + Class sphericalRadial Declaration \*---------------------------------------------------------------------------*/ -class radial +class sphericalRadial : public extrudeModel { // Private Data + //- Radial distribution of layers autoPtr> R_; public: //- Runtime type information - TypeName("radial"); + TypeName("sphericalRadial"); // Constructors //- Construct from dictionary - radial(const dictionary& dict); + sphericalRadial(const dictionary& dict); //-Destructor - virtual ~radial(); + virtual ~sphericalRadial(); // Member Operators + //- Return the new point corresponding to the surfacePoint + // on the specified layer. + // The surfaceNormal is not used. point operator() ( const point& surfacePoint,