extrudeModels::cylindricalRadial: New cylindrical radial extrusion model

Renamed extrudeModels::radial -> extrudeModels::sphericalRadial as this
specifically extrudes spherically.
This commit is contained in:
Henry Weller
2023-11-02 14:54:48 +00:00
parent cf4149f42f
commit e880ec1c4f
8 changed files with 238 additions and 28 deletions

View File

@ -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));

View File

@ -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));

View File

@ -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));
}

View File

@ -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

View File

@ -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 <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#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<scalar>::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
// ************************************************************************* //

View File

@ -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 <http://www.gnu.org/licenses/>.
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<Function1<scalar>> 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
// ************************************************************************* //

View File

@ -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<scalar>::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;
}

View File

@ -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 <http://www.gnu.org/licenses/>.
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<Function1<scalar>> 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,