coordinateSystems: Corrected, updated and tested
It is now possible to define coordinate systems in a central location and
selected them by name for any model requiring one, e.g. the
explicitPorositySource.
Description
Provides a centralized coordinateSystem collection.
For example with the porous region specified in \c constant/fvOptions as
\verbatim
porosity
{
type explicitPorositySource;
explicitPorositySourceCoeffs
{
selectionMode cellZone;
cellZone porousBlockage;
type DarcyForchheimer;
// D 100; // Very little blockage
// D 200; // Some blockage but steady flow
// D 500; // Slight waviness in the far wake
D 1000; // Fully shedding behavior
d ($D $D $D);
f (0 0 0);
coordinateSystem porousBlockage;
}
}
\endverbatim
the corresponding coordinate system \c porousBlockage is looked-up
automatically from the \c constant/coordinateSystems dictionary:
\verbatim
porousBlockage
{
type cartesian;
origin (0 0 0);
coordinateRotation
{
type axesRotation;
e1 (1 0 0);
e2 (0 1 0);
}
}
\endverbatim
See \c tutorials/incompressible/pisoFoam/laminar/porousBlockage
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -203,6 +203,12 @@ public:
|
||||
//- Return new event number.
|
||||
label getEvent() const;
|
||||
|
||||
//- Return the object registry
|
||||
const objectRegistry& thisDb() const
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
// Edit
|
||||
|
||||
|
||||
@ -377,7 +377,14 @@ void Foam::fv::rotorDiskSource::createCoordinateSystem()
|
||||
}
|
||||
}
|
||||
|
||||
coordSys_ = cylindricalCS("rotorCoordSys", origin, axis, refDir, false);
|
||||
coordSys_ = coordinateSystems::cylindrical
|
||||
(
|
||||
"rotorCoordSys",
|
||||
origin,
|
||||
axis,
|
||||
refDir,
|
||||
false
|
||||
);
|
||||
|
||||
const scalar sumArea = gSum(area_);
|
||||
const scalar diameter = Foam::sqrt(4.0*sumArea/mathematical::pi);
|
||||
|
||||
@ -194,7 +194,7 @@ protected:
|
||||
List<scalar> area_;
|
||||
|
||||
//- Rotor local cylindrical co-ordinate system (r, theta, z)
|
||||
cylindricalCS coordSys_;
|
||||
coordinateSystems::cylindrical coordSys_;
|
||||
|
||||
//- Rotor transformation co-ordinate system
|
||||
autoPtr<cylindrical> cylindrical_;
|
||||
@ -278,7 +278,7 @@ public:
|
||||
inline const List<point>& x() const;
|
||||
|
||||
//- Return the rotor co-ordinate system (r, theta, z)
|
||||
inline const cylindricalCS& coordSys() const;
|
||||
inline const coordinateSystems::cylindrical& coordSys() const;
|
||||
|
||||
|
||||
// Evaluation
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2012-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012-2020 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -45,7 +45,8 @@ const Foam::List<Foam::point>& Foam::fv::rotorDiskSource::x() const
|
||||
}
|
||||
|
||||
|
||||
const Foam::cylindricalCS& Foam::fv::rotorDiskSource::coordSys() const
|
||||
const Foam::coordinateSystems::cylindrical&
|
||||
Foam::fv::rotorDiskSource::coordSys() const
|
||||
{
|
||||
return coordSys_;
|
||||
}
|
||||
|
||||
@ -195,7 +195,14 @@ void Foam::ParticleCollector<CloudType>::initConcentricCircles()
|
||||
faces_.setSize(nFace);
|
||||
area_.setSize(nFace);
|
||||
|
||||
coordSys_ = cylindricalCS("coordSys", origin, normal_[0], refDir, false);
|
||||
coordSys_ = coordinateSystems::cylindrical
|
||||
(
|
||||
"coordSys",
|
||||
origin,
|
||||
normal_[0],
|
||||
refDir,
|
||||
false
|
||||
);
|
||||
|
||||
List<label> ptIDs(identity(nPointPerRadius));
|
||||
|
||||
|
||||
@ -158,7 +158,7 @@ private:
|
||||
List<scalar> radius_;
|
||||
|
||||
//- Cylindrical co-ordinate system
|
||||
cylindricalCS coordSys_;
|
||||
coordinateSystems::cylindrical coordSys_;
|
||||
|
||||
|
||||
//- Face areas
|
||||
|
||||
@ -26,7 +26,6 @@ License
|
||||
#include "ParticleTracks.H"
|
||||
#include "Pstream.H"
|
||||
#include "ListListOps.H"
|
||||
#include "IOPtrList.H"
|
||||
|
||||
// * * * * * * * * * * * * * protected Member Functions * * * * * * * * * * //
|
||||
|
||||
|
||||
@ -24,23 +24,23 @@ License
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "cartesianCS.H"
|
||||
|
||||
#include "one.H"
|
||||
#include "mathematicalConstants.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(cartesianCS, 0);
|
||||
addToRunTimeSelectionTable(coordinateSystem, cartesianCS, dictionary);
|
||||
namespace coordinateSystems
|
||||
{
|
||||
defineTypeNameAndDebug(cartesian, 0);
|
||||
addToRunTimeSelectionTable(coordinateSystem, cartesian, dictionary);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
Foam::vector Foam::cartesianCS::localToGlobal
|
||||
Foam::vector Foam::coordinateSystems::cartesian::localToGlobal
|
||||
(
|
||||
const vector& local,
|
||||
bool translate
|
||||
@ -50,7 +50,7 @@ Foam::vector Foam::cartesianCS::localToGlobal
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::vectorField> Foam::cartesianCS::localToGlobal
|
||||
Foam::tmp<Foam::vectorField> Foam::coordinateSystems::cartesian::localToGlobal
|
||||
(
|
||||
const vectorField& local,
|
||||
bool translate
|
||||
@ -60,7 +60,7 @@ Foam::tmp<Foam::vectorField> Foam::cartesianCS::localToGlobal
|
||||
}
|
||||
|
||||
|
||||
Foam::vector Foam::cartesianCS::globalToLocal
|
||||
Foam::vector Foam::coordinateSystems::cartesian::globalToLocal
|
||||
(
|
||||
const vector& global,
|
||||
bool translate
|
||||
@ -70,7 +70,7 @@ Foam::vector Foam::cartesianCS::globalToLocal
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::vectorField> Foam::cartesianCS::globalToLocal
|
||||
Foam::tmp<Foam::vectorField> Foam::coordinateSystems::cartesian::globalToLocal
|
||||
(
|
||||
const vectorField& global,
|
||||
bool translate
|
||||
@ -82,7 +82,7 @@ Foam::tmp<Foam::vectorField> Foam::cartesianCS::globalToLocal
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::cartesianCS::cartesianCS
|
||||
Foam::coordinateSystems::cartesian::cartesian
|
||||
(
|
||||
const word& name,
|
||||
const point& origin,
|
||||
@ -93,7 +93,7 @@ Foam::cartesianCS::cartesianCS
|
||||
{}
|
||||
|
||||
|
||||
Foam::cartesianCS::cartesianCS
|
||||
Foam::coordinateSystems::cartesian::cartesian
|
||||
(
|
||||
const word& name,
|
||||
const point& origin,
|
||||
@ -105,7 +105,7 @@ Foam::cartesianCS::cartesianCS
|
||||
{}
|
||||
|
||||
|
||||
Foam::cartesianCS::cartesianCS
|
||||
Foam::coordinateSystems::cartesian::cartesian
|
||||
(
|
||||
const word& name,
|
||||
const dictionary& dict
|
||||
@ -117,7 +117,7 @@ Foam::cartesianCS::cartesianCS
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::cartesianCS::~cartesianCS()
|
||||
Foam::coordinateSystems::cartesian::~cartesian()
|
||||
{}
|
||||
|
||||
|
||||
|
||||
@ -22,7 +22,7 @@ License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::cartesianCS
|
||||
Foam::coordinateSystems::cartesian
|
||||
|
||||
Description
|
||||
Cylindrical coordinate system
|
||||
@ -36,18 +36,19 @@ SourceFiles
|
||||
#define cartesianCS_H
|
||||
|
||||
#include "coordinateSystem.H"
|
||||
#include "typeInfo.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace coordinateSystems
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class cartesianCS Declaration
|
||||
Class cartesian Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class cartesianCS
|
||||
class cartesian
|
||||
:
|
||||
public coordinateSystem
|
||||
{
|
||||
@ -87,7 +88,7 @@ public:
|
||||
// Constructors
|
||||
|
||||
//- Construct from origin and rotation
|
||||
cartesianCS
|
||||
cartesian
|
||||
(
|
||||
const word& name,
|
||||
const point& origin,
|
||||
@ -95,7 +96,7 @@ public:
|
||||
);
|
||||
|
||||
//- Construct from origin and 2 axes
|
||||
cartesianCS
|
||||
cartesian
|
||||
(
|
||||
const word& name,
|
||||
const point& origin,
|
||||
@ -104,23 +105,24 @@ public:
|
||||
);
|
||||
|
||||
//- Construct from dictionary
|
||||
cartesianCS(const word&, const dictionary&);
|
||||
cartesian(const word&, const dictionary&);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual autoPtr<coordinateSystem> clone() const
|
||||
{
|
||||
return autoPtr<coordinateSystem>(new cartesianCS(*this));
|
||||
return autoPtr<coordinateSystem>(new cartesian(*this));
|
||||
}
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~cartesianCS();
|
||||
virtual ~cartesian();
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
} // End namespace coordinateSystems
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
@ -197,9 +197,6 @@ public:
|
||||
const dictionary& dict
|
||||
);
|
||||
|
||||
//- Select constructed from Istream
|
||||
static autoPtr<coordinateSystem> New(Istream& is);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~coordinateSystem();
|
||||
@ -215,6 +212,12 @@ public:
|
||||
return name_;
|
||||
}
|
||||
|
||||
//- Return keyword
|
||||
const word& keyword() const
|
||||
{
|
||||
return name_;
|
||||
}
|
||||
|
||||
//- Return origin
|
||||
const point& origin() const
|
||||
{
|
||||
|
||||
@ -33,37 +33,39 @@ Foam::autoPtr<Foam::coordinateSystem> Foam::coordinateSystem::New
|
||||
const dictionary& dict
|
||||
)
|
||||
{
|
||||
const dictionary& coordDict = dict.subDict(typeName_());
|
||||
const entry* entryPtr = dict.lookupEntryPtr(typeName_(), false, false);
|
||||
|
||||
const entry* entryPtr = coordDict.lookupEntryPtr(typeName_(), false, false);
|
||||
|
||||
// non-dictionary entry is a lookup into global coordinateSystems
|
||||
// Non-dictionary entry is a lookup into global coordinateSystems
|
||||
if (entryPtr && !entryPtr->isDict())
|
||||
{
|
||||
keyType key(entryPtr->stream());
|
||||
const word name(entryPtr->stream());
|
||||
|
||||
const coordinateSystems& lst = coordinateSystems::New(obr);
|
||||
const label index = lst.findIndex(key);
|
||||
const coordinateSystems::coordinateSystems& css =
|
||||
coordinateSystems::coordinateSystems::New(obr);
|
||||
|
||||
if (debug)
|
||||
if (css.found(name))
|
||||
{
|
||||
InfoInFunction
|
||||
<< "Using global coordinate system: "
|
||||
<< key << "=" << index << endl;
|
||||
}
|
||||
if (debug)
|
||||
{
|
||||
InfoInFunction
|
||||
<< "Using global coordinate system: " << name << endl;
|
||||
}
|
||||
|
||||
if (index < 0)
|
||||
return css[name].clone();
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "could not find coordinate system: " << key << nl
|
||||
<< "available coordinate systems: " << lst.toc() << nl << nl
|
||||
<< "could not find coordinate system: " << name << nl
|
||||
<< "available coordinate systems: " << css.toc() << nl << nl
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
return lst[index].clone();
|
||||
return autoPtr<coordinateSystem>(nullptr);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
const dictionary& coordDict = dict.subDict(typeName_());
|
||||
const word coordType = coordDict.lookup("type");
|
||||
|
||||
dictionaryConstructorTable::iterator cstrIter =
|
||||
@ -113,16 +115,4 @@ Foam::autoPtr<Foam::coordinateSystem> Foam::coordinateSystem::New
|
||||
}
|
||||
|
||||
|
||||
Foam::autoPtr<Foam::coordinateSystem> Foam::coordinateSystem::New
|
||||
(
|
||||
Istream& is
|
||||
)
|
||||
{
|
||||
const word name(is);
|
||||
const dictionary dict(is);
|
||||
|
||||
return autoPtr<coordinateSystem>(coordinateSystem::New(name, dict));
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -26,140 +26,64 @@ License
|
||||
#include "coordinateSystems.H"
|
||||
#include "Time.H"
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace coordinateSystems
|
||||
{
|
||||
defineTypeNameAndDebug(coordinateSystems, 0);
|
||||
defineTemplateTypeNameAndDebug(IOPtrList<coordinateSystem>, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::coordinateSystems::coordinateSystems(const IOobject& io)
|
||||
:
|
||||
IOPtrList<coordinateSystem>(io)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
|
||||
|
||||
const Foam::coordinateSystems& Foam::coordinateSystems::New
|
||||
Foam::coordinateSystems::coordinateSystems::coordinateSystems
|
||||
(
|
||||
const objectRegistry& obr
|
||||
)
|
||||
{
|
||||
if (obr.foundObject<coordinateSystems>(typeName))
|
||||
{
|
||||
return obr.lookupObject<coordinateSystems>(typeName);
|
||||
}
|
||||
else
|
||||
{
|
||||
return obr.store
|
||||
:
|
||||
MeshObject<objectRegistry, GeometricMeshObject, coordinateSystems>
|
||||
(
|
||||
obr,
|
||||
IOobject
|
||||
(
|
||||
new coordinateSystems
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
typeName,
|
||||
obr.time().constant(),
|
||||
obr,
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
typeName,
|
||||
obr.time().constant(),
|
||||
obr,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
),
|
||||
PtrDictionary<coordinateSystem>()
|
||||
{
|
||||
readHeaderOk(IOstream::ASCII, typeName);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
Foam::labelList Foam::coordinateSystems::findIndices(const keyType& key) const
|
||||
bool Foam::coordinateSystems::coordinateSystems::readData(Istream& is)
|
||||
{
|
||||
labelList indices;
|
||||
if (key.isPattern())
|
||||
const dictionary coordinateSystemsDict(is);
|
||||
|
||||
forAllConstIter(dictionary, coordinateSystemsDict, iter)
|
||||
{
|
||||
indices = findStrings(key, toc());
|
||||
}
|
||||
else
|
||||
{
|
||||
indices.setSize(size());
|
||||
label nFound = 0;
|
||||
forAll(*this, i)
|
||||
if (iter().isDict())
|
||||
{
|
||||
if (key == operator[](i).name())
|
||||
{
|
||||
indices[nFound++] = i;
|
||||
}
|
||||
}
|
||||
indices.setSize(nFound);
|
||||
}
|
||||
const word& name = iter().keyword();
|
||||
const dictionary& dict = iter().dict();
|
||||
|
||||
return indices;
|
||||
}
|
||||
|
||||
|
||||
Foam::label Foam::coordinateSystems::findIndex(const keyType& key) const
|
||||
{
|
||||
if (key.isPattern())
|
||||
{
|
||||
const labelList indices = findIndices(key);
|
||||
|
||||
// Return first element
|
||||
if (!indices.empty())
|
||||
{
|
||||
return indices[0];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
forAll(*this, i)
|
||||
{
|
||||
if (key == operator[](i).name())
|
||||
{
|
||||
return i;
|
||||
}
|
||||
this->insert
|
||||
(
|
||||
name,
|
||||
coordinateSystem::New(name, dict).ptr()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
bool Foam::coordinateSystems::found(const keyType& key) const
|
||||
{
|
||||
return findIndex(key) != -1;
|
||||
}
|
||||
|
||||
|
||||
Foam::wordList Foam::coordinateSystems::toc() const
|
||||
{
|
||||
wordList keywords(size());
|
||||
|
||||
forAll(*this, i)
|
||||
{
|
||||
keywords[i] = operator[](i).name();
|
||||
}
|
||||
|
||||
return keywords;
|
||||
}
|
||||
|
||||
|
||||
bool Foam::coordinateSystems::writeData(Ostream& os) const
|
||||
{
|
||||
os << nl << size() << nl << token::BEGIN_LIST;
|
||||
|
||||
forAll(*this, i)
|
||||
{
|
||||
os << nl;
|
||||
operator[](i).writeDict(os, true);
|
||||
}
|
||||
|
||||
os << token::END_LIST << nl;
|
||||
|
||||
return os.good();
|
||||
return !is.bad();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -22,33 +22,56 @@ License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::coordinateSystems
|
||||
Foam::coordinateSystems::coordinateSystems
|
||||
|
||||
Description
|
||||
Provides a centralized coordinateSystem collection.
|
||||
|
||||
Note
|
||||
Mixing normal constructors and the coordinateSystems::New constructor
|
||||
may yield unexpected results.
|
||||
For example with the porous region specified in \c constant/fvOptions as
|
||||
|
||||
\verbatim
|
||||
1
|
||||
(
|
||||
cat1
|
||||
porosity
|
||||
{
|
||||
type explicitPorositySource;
|
||||
|
||||
explicitPorositySourceCoeffs
|
||||
{
|
||||
coordinateSystem system_10;
|
||||
porosity 0.781;
|
||||
Darcy
|
||||
{
|
||||
d d [0 -2 0 0 0] (-1000 -1000 0.50753e+08);
|
||||
f f [0 -1 0 0 0] (-1000 -1000 12.83);
|
||||
}
|
||||
selectionMode cellZone;
|
||||
cellZone porousBlockage;
|
||||
|
||||
type DarcyForchheimer;
|
||||
|
||||
// D 100; // Very little blockage
|
||||
// D 200; // Some blockage but steady flow
|
||||
// D 500; // Slight waviness in the far wake
|
||||
D 1000; // Fully shedding behavior
|
||||
|
||||
d ($D $D $D);
|
||||
f (0 0 0);
|
||||
|
||||
coordinateSystem porousBlockage;
|
||||
}
|
||||
)
|
||||
}
|
||||
\endverbatim
|
||||
|
||||
For this to work correctly, the coordinateSystem constructor must be
|
||||
supplied with both a dictionary and an objectRegistry.
|
||||
the corresponding coordinate system \c porousBlockage is looked-up
|
||||
automatically from the \c constant/coordinateSystems dictionary:
|
||||
|
||||
\verbatim
|
||||
porousBlockage
|
||||
{
|
||||
type cartesian;
|
||||
origin (0 0 0);
|
||||
coordinateRotation
|
||||
{
|
||||
type axesRotation;
|
||||
e1 (1 0 0);
|
||||
e2 (0 1 0);
|
||||
}
|
||||
}
|
||||
\endverbatim
|
||||
|
||||
See \c tutorials/incompressible/pisoFoam/laminar/porousBlockage
|
||||
|
||||
SourceFiles
|
||||
coordinateSystems.C
|
||||
@ -58,12 +81,15 @@ SourceFiles
|
||||
#define coordinateSystems_H
|
||||
|
||||
#include "coordinateSystem.H"
|
||||
#include "IOPtrList.H"
|
||||
#include "PtrDictionary.H"
|
||||
#include "MeshObject.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace coordinateSystems
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class coordinateSystems Declaration
|
||||
@ -71,47 +97,40 @@ namespace Foam
|
||||
|
||||
class coordinateSystems
|
||||
:
|
||||
public IOPtrList<coordinateSystem>
|
||||
public MeshObject<objectRegistry, GeometricMeshObject, coordinateSystems>,
|
||||
public PtrDictionary<coordinateSystem>
|
||||
{
|
||||
// Private member functions
|
||||
|
||||
//- Find and return indices for all matches
|
||||
labelList findIndices(const keyType& key) const;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("coordinateSystems");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Read construct from IOobject
|
||||
explicit coordinateSystems(const IOobject&);
|
||||
//- Read construct from objectRegistry
|
||||
explicit coordinateSystems(const objectRegistry& obr);
|
||||
|
||||
//- Disallow default bitwise copy construction
|
||||
coordinateSystems(const coordinateSystems&) = delete;
|
||||
|
||||
using MeshObject
|
||||
<
|
||||
objectRegistry,
|
||||
GeometricMeshObject,
|
||||
coordinateSystems
|
||||
>::New;
|
||||
|
||||
// Selectors
|
||||
|
||||
//- Return previously registered or read construct from "constant"
|
||||
static const coordinateSystems& New(const objectRegistry&);
|
||||
//- Destructor
|
||||
virtual ~coordinateSystems()
|
||||
{}
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Find and return index for the first match, return -1 if not found
|
||||
label findIndex(const keyType& key) const;
|
||||
|
||||
//- Search for given key
|
||||
bool found(const keyType& key) const;
|
||||
|
||||
//- Return the table of contents (list of all keywords)
|
||||
wordList toc() const;
|
||||
|
||||
//- Write data
|
||||
bool writeData(Ostream&) const;
|
||||
//- ReadData function required for regIOobject read operation
|
||||
virtual bool readData(Istream&);
|
||||
|
||||
|
||||
// Member Operators
|
||||
@ -124,6 +143,7 @@ public:
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
} // End namespace coordinateSystems
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
@ -24,8 +24,6 @@ License
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "cylindricalCS.H"
|
||||
|
||||
#include "one.H"
|
||||
#include "mathematicalConstants.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
@ -33,14 +31,17 @@ License
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(cylindricalCS, 0);
|
||||
addToRunTimeSelectionTable(coordinateSystem, cylindricalCS, dictionary);
|
||||
namespace coordinateSystems
|
||||
{
|
||||
defineTypeNameAndDebug(cylindrical, 0);
|
||||
addToRunTimeSelectionTable(coordinateSystem, cylindrical, dictionary);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
Foam::vector Foam::cylindricalCS::localToGlobal
|
||||
Foam::vector Foam::coordinateSystems::cylindrical::localToGlobal
|
||||
(
|
||||
const vector& local,
|
||||
bool translate
|
||||
@ -59,7 +60,7 @@ Foam::vector Foam::cylindricalCS::localToGlobal
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::vectorField> Foam::cylindricalCS::localToGlobal
|
||||
Foam::tmp<Foam::vectorField> Foam::coordinateSystems::cylindrical::localToGlobal
|
||||
(
|
||||
const vectorField& local,
|
||||
bool translate
|
||||
@ -80,7 +81,7 @@ Foam::tmp<Foam::vectorField> Foam::cylindricalCS::localToGlobal
|
||||
}
|
||||
|
||||
|
||||
Foam::vector Foam::cylindricalCS::globalToLocal
|
||||
Foam::vector Foam::coordinateSystems::cylindrical::globalToLocal
|
||||
(
|
||||
const vector& global,
|
||||
bool translate
|
||||
@ -104,7 +105,7 @@ Foam::vector Foam::cylindricalCS::globalToLocal
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::vectorField> Foam::cylindricalCS::globalToLocal
|
||||
Foam::tmp<Foam::vectorField> Foam::coordinateSystems::cylindrical::globalToLocal
|
||||
(
|
||||
const vectorField& global,
|
||||
bool translate
|
||||
@ -142,7 +143,7 @@ Foam::tmp<Foam::vectorField> Foam::cylindricalCS::globalToLocal
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::cylindricalCS::cylindricalCS
|
||||
Foam::coordinateSystems::cylindrical::cylindrical
|
||||
(
|
||||
const word& name,
|
||||
const point& origin,
|
||||
@ -155,7 +156,7 @@ Foam::cylindricalCS::cylindricalCS
|
||||
{}
|
||||
|
||||
|
||||
Foam::cylindricalCS::cylindricalCS
|
||||
Foam::coordinateSystems::cylindrical::cylindrical
|
||||
(
|
||||
const word& name,
|
||||
const point& origin,
|
||||
@ -169,7 +170,7 @@ Foam::cylindricalCS::cylindricalCS
|
||||
{}
|
||||
|
||||
|
||||
Foam::cylindricalCS::cylindricalCS
|
||||
Foam::coordinateSystems::cylindrical::cylindrical
|
||||
(
|
||||
const word& name,
|
||||
const dictionary& dict
|
||||
@ -182,7 +183,7 @@ Foam::cylindricalCS::cylindricalCS
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::cylindricalCS::~cylindricalCS()
|
||||
Foam::coordinateSystems::cylindrical::~cylindrical()
|
||||
{}
|
||||
|
||||
|
||||
|
||||
@ -22,7 +22,7 @@ License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::cylindricalCS
|
||||
Foam::coordinateSystems::cylindrical
|
||||
|
||||
Description
|
||||
Cylindrical coordinate system
|
||||
@ -41,12 +41,14 @@ SourceFiles
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace coordinateSystems
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class cylindricalCS Declaration
|
||||
Class cylindrical Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class cylindricalCS
|
||||
class cylindrical
|
||||
:
|
||||
public coordinateSystem
|
||||
{
|
||||
@ -93,7 +95,7 @@ public:
|
||||
// Constructors
|
||||
|
||||
//- Construct from origin and rotation
|
||||
cylindricalCS
|
||||
cylindrical
|
||||
(
|
||||
const word& name,
|
||||
const point& origin,
|
||||
@ -102,7 +104,7 @@ public:
|
||||
);
|
||||
|
||||
//- Construct from origin and 2 axes
|
||||
cylindricalCS
|
||||
cylindrical
|
||||
(
|
||||
const word& name,
|
||||
const point& origin,
|
||||
@ -112,23 +114,24 @@ public:
|
||||
);
|
||||
|
||||
//- Construct from dictionary and name
|
||||
cylindricalCS(const word&, const dictionary&);
|
||||
cylindrical(const word&, const dictionary&);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual autoPtr<coordinateSystem> clone() const
|
||||
{
|
||||
return autoPtr<coordinateSystem>(new cylindricalCS(*this));
|
||||
return autoPtr<coordinateSystem>(new cylindrical(*this));
|
||||
}
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~cylindricalCS();
|
||||
virtual ~cylindrical();
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
} // End namespace coordinateSystems
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
@ -0,0 +1,31 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Version: dev
|
||||
\\/ M anipulation |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
location "constant";
|
||||
object coordinateSystems;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
porousBlockage
|
||||
{
|
||||
type cartesian;
|
||||
origin (0 0 0);
|
||||
coordinateRotation
|
||||
{
|
||||
type axesRotation;
|
||||
e1 (1 0 0);
|
||||
e2 (0 1 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -15,7 +15,7 @@ FoamFile
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
porosity1
|
||||
porosity
|
||||
{
|
||||
type explicitPorositySource;
|
||||
|
||||
@ -34,17 +34,7 @@ porosity1
|
||||
d ($D $D $D);
|
||||
f (0 0 0);
|
||||
|
||||
coordinateSystem
|
||||
{
|
||||
type cartesian;
|
||||
origin (0 0 0);
|
||||
coordinateRotation
|
||||
{
|
||||
type axesRotation;
|
||||
e1 (1 0 0);
|
||||
e2 (0 1 0);
|
||||
}
|
||||
}
|
||||
coordinateSystem porousBlockage;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user