mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'master' of /home/dm4/OpenFOAM/OpenFOAM-dev
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2007-2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2007-2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -32,9 +32,7 @@ License
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
defineTypeNameAndDebug(CV2D, 0);
|
||||
|
||||
defineTypeNameAndDebug(CV2D, 0);
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
@ -67,6 +65,7 @@ void Foam::CV2D::fast_restore_Delaunay(Vertex_handle vh)
|
||||
} while (f != start);
|
||||
}
|
||||
|
||||
|
||||
void Foam::CV2D::external_flip(Face_handle& f, int i)
|
||||
{
|
||||
Face_handle n = f->neighbor(i);
|
||||
@ -82,6 +81,7 @@ void Foam::CV2D::external_flip(Face_handle& f, int i)
|
||||
external_flip(n, i);
|
||||
}
|
||||
|
||||
|
||||
bool Foam::CV2D::internal_flip(Face_handle& f, int i)
|
||||
{
|
||||
Face_handle n = f->neighbor(i);
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2007-2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -321,18 +321,14 @@ private:
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
ClassName("CV2D");
|
||||
//- Runtime type information
|
||||
ClassName("CV2D");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct for given surface
|
||||
CV2D
|
||||
(
|
||||
const Time& runTime,
|
||||
const dictionary& controlDict
|
||||
);
|
||||
CV2D(const Time& runTime, const dictionary& controlDict);
|
||||
|
||||
|
||||
//- Destructor
|
||||
@ -420,6 +416,7 @@ public:
|
||||
EdgeMap<label>& mapEdgesRegion
|
||||
) const;
|
||||
|
||||
|
||||
// Write
|
||||
|
||||
//- Write internal points to .obj file
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2007-2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -120,11 +120,13 @@ inline const Foam::cv2DControls& Foam::CV2D::meshControls() const
|
||||
return controls_;
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::point2D& Foam::CV2D::toPoint2D(const point& p) const
|
||||
{
|
||||
return reinterpret_cast<const point2D&>(p);
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::point2DField Foam::CV2D::toPoint2D(const pointField& p) const
|
||||
{
|
||||
point2DField temp(p.size());
|
||||
@ -135,6 +137,7 @@ inline const Foam::point2DField Foam::CV2D::toPoint2D(const pointField& p) const
|
||||
return temp;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::point Foam::CV2D::toPoint3D(const point2D& p) const
|
||||
{
|
||||
return point(p.x(), p.y(), z_);
|
||||
@ -148,6 +151,7 @@ inline Foam::CV2D::point2DFromPoint Foam::CV2D::toPoint2D(const Point& P) const
|
||||
return reinterpret_cast<point2DFromPoint>(P);
|
||||
}
|
||||
|
||||
|
||||
inline Foam::CV2D::PointFromPoint2D Foam::CV2D::toPoint(const point2D& p) const
|
||||
{
|
||||
return reinterpret_cast<PointFromPoint2D>(p);
|
||||
@ -160,6 +164,7 @@ inline Foam::CV2D::point2DFromPoint Foam::CV2D::toPoint2D(const Point& P) const
|
||||
return point2D(CGAL::to_double(P.x()), CGAL::to_double(P.y()));
|
||||
}
|
||||
|
||||
|
||||
inline Foam::CV2D::PointFromPoint2D Foam::CV2D::toPoint(const point2D& p) const
|
||||
{
|
||||
return Point(p.x(), p.y());
|
||||
@ -207,6 +212,7 @@ inline bool Foam::boundaryTriangle(const CV2D::Face_handle fc)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
inline bool Foam::outsideTriangle(const CV2D::Face_handle fc)
|
||||
{
|
||||
return outsideTriangle
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2007-2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2007-2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2007-2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -47,7 +47,6 @@ Description
|
||||
using namespace Foam;
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
// Main program:
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
@ -62,9 +61,23 @@ int main(int argc, char *argv[])
|
||||
|
||||
// Read control dictionary
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~
|
||||
dictionary controlDict(IFstream("system/" + args.executable() + "Dict")());
|
||||
dictionary shortEdgeFilterDict(controlDict.subDict("shortEdgeFilter"));
|
||||
dictionary extrusionDict(controlDict.subDict("extrusion"));
|
||||
IOdictionary controlDict
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
args.executable() + "Dict",
|
||||
runTime.system(),
|
||||
runTime,
|
||||
IOobject::MUST_READ_IF_MODIFIED,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
);
|
||||
|
||||
const dictionary& shortEdgeFilterDict
|
||||
(
|
||||
controlDict.subDict("shortEdgeFilter")
|
||||
);
|
||||
const dictionary& extrusionDict(controlDict.subDict("extrusion"));
|
||||
|
||||
Switch extrude(extrusionDict.lookup("extrude"));
|
||||
const bool overwrite = args.optionFound("overwrite");
|
||||
@ -97,17 +110,16 @@ int main(int argc, char *argv[])
|
||||
|
||||
while (runTime.loop())
|
||||
{
|
||||
Info<< nl << "Time = " << runTime.timeName() << endl;
|
||||
|
||||
Info<< "Relaxation = " << relax->relaxation() << endl;
|
||||
Info<< nl << "Time = " << runTime.timeName() << nl
|
||||
<< "Relaxation = " << relax->relaxation() << endl;
|
||||
|
||||
mesh.newPoints(relax->relaxation());
|
||||
}
|
||||
|
||||
mesh.write();
|
||||
|
||||
Info<< "Finished Delaunay in = "
|
||||
<< runTime.cpuTimeIncrement() << " s." << endl;
|
||||
Info<< "Finished Delaunay in = " << runTime.cpuTimeIncrement() << " s."
|
||||
<< endl;
|
||||
|
||||
Info<< "Begin filtering short edges:" << endl;
|
||||
shortEdgeFilter2D sef(mesh, shortEdgeFilterDict);
|
||||
@ -120,8 +132,8 @@ int main(int argc, char *argv[])
|
||||
Info<< "Write .obj file of the 2D mesh: MeshedSurface.obj" << endl;
|
||||
sef.fMesh().write("MeshedSurface.obj");
|
||||
|
||||
Info<< "Finished filtering in = "
|
||||
<< runTime.cpuTimeIncrement() << " s." << endl;
|
||||
Info<< "Finished filtering in = " << runTime.cpuTimeIncrement() << " s."
|
||||
<< endl;
|
||||
|
||||
Info<< "Begin constructing a polyMesh:" << endl;
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2007-2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -46,7 +46,7 @@ namespace CGAL
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class Gt, class Fb=CGAL::Triangulation_face_base_2<Gt> >
|
||||
class indexedFace
|
||||
class indexedFace
|
||||
:
|
||||
public Fb
|
||||
{
|
||||
@ -78,61 +78,45 @@ public:
|
||||
};
|
||||
|
||||
|
||||
indexedFace()
|
||||
:
|
||||
Fb(),
|
||||
index_(CHANGED)
|
||||
{}
|
||||
// Constructors
|
||||
|
||||
indexedFace(Vertex_handle v0, Vertex_handle v1, Vertex_handle v2)
|
||||
:
|
||||
Fb(v0, v1, v2),
|
||||
index_(CHANGED)
|
||||
{}
|
||||
inline indexedFace();
|
||||
|
||||
indexedFace
|
||||
(
|
||||
Vertex_handle v0,
|
||||
Vertex_handle v1,
|
||||
Vertex_handle v2,
|
||||
Face_handle n0,
|
||||
Face_handle n1,
|
||||
Face_handle n2
|
||||
)
|
||||
:
|
||||
Fb(v0, v1, v2, n0, n1, n2),
|
||||
index_(CHANGED)
|
||||
{}
|
||||
inline indexedFace
|
||||
(
|
||||
Vertex_handle v0,
|
||||
Vertex_handle v1,
|
||||
Vertex_handle v2
|
||||
);
|
||||
|
||||
inline indexedFace
|
||||
(
|
||||
Vertex_handle v0,
|
||||
Vertex_handle v1,
|
||||
Vertex_handle v2,
|
||||
Face_handle n0,
|
||||
Face_handle n1,
|
||||
Face_handle n2
|
||||
);
|
||||
|
||||
|
||||
void set_vertex(int i, Vertex_handle v)
|
||||
{
|
||||
index_ = CHANGED;
|
||||
Fb::set_vertex(i, v);
|
||||
}
|
||||
// Member Functions
|
||||
|
||||
void set_vertices()
|
||||
{
|
||||
index_ = CHANGED;
|
||||
Fb::set_vertices();
|
||||
}
|
||||
inline void set_vertex(int i, Vertex_handle v);
|
||||
|
||||
void set_vertices(Vertex_handle v0, Vertex_handle v1, Vertex_handle v2)
|
||||
{
|
||||
index_ = CHANGED;
|
||||
Fb::set_vertices(v0, v1, v2);
|
||||
}
|
||||
inline void set_vertices();
|
||||
|
||||
inline void set_vertices
|
||||
(
|
||||
Vertex_handle v0,
|
||||
Vertex_handle v1,
|
||||
Vertex_handle v2
|
||||
);
|
||||
|
||||
int& faceIndex()
|
||||
{
|
||||
return index_;
|
||||
}
|
||||
inline int& faceIndex();
|
||||
|
||||
inline int faceIndex() const;
|
||||
|
||||
int faceIndex() const
|
||||
{
|
||||
return index_;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -142,6 +126,10 @@ public:
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "indexedFaceI.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
108
applications/utilities/mesh/generation/cv2DMesh/indexedFaceI.H
Normal file
108
applications/utilities/mesh/generation/cv2DMesh/indexedFaceI.H
Normal file
@ -0,0 +1,108 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 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/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Gt, class Fb>
|
||||
inline CGAL::indexedFace<Gt, Fb>::indexedFace()
|
||||
:
|
||||
Fb(),
|
||||
index_(CHANGED)
|
||||
{}
|
||||
|
||||
|
||||
template<class Gt, class Fb>
|
||||
inline CGAL::indexedFace<Gt, Fb>::indexedFace
|
||||
(
|
||||
Vertex_handle v0,
|
||||
Vertex_handle v1,
|
||||
Vertex_handle v2
|
||||
)
|
||||
:
|
||||
Fb(v0, v1, v2),
|
||||
index_(CHANGED)
|
||||
{}
|
||||
|
||||
|
||||
template<class Gt, class Fb>
|
||||
inline CGAL::indexedFace<Gt, Fb>::indexedFace
|
||||
(
|
||||
Vertex_handle v0,
|
||||
Vertex_handle v1,
|
||||
Vertex_handle v2,
|
||||
Face_handle n0,
|
||||
Face_handle n1,
|
||||
Face_handle n2
|
||||
)
|
||||
:
|
||||
Fb(v0, v1, v2, n0, n1, n2),
|
||||
index_(CHANGED)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class Gt, class Fb>
|
||||
inline void CGAL::indexedFace<Gt, Fb>::set_vertex(int i, Vertex_handle v)
|
||||
{
|
||||
index_ = CHANGED;
|
||||
Fb::set_vertex(i, v);
|
||||
}
|
||||
|
||||
|
||||
template<class Gt, class Fb>
|
||||
inline void CGAL::indexedFace<Gt, Fb>::set_vertices()
|
||||
{
|
||||
index_ = CHANGED;
|
||||
Fb::set_vertices();
|
||||
}
|
||||
|
||||
|
||||
template<class Gt, class Fb>
|
||||
inline void CGAL::indexedFace<Gt, Fb>::set_vertices
|
||||
(
|
||||
Vertex_handle v0,
|
||||
Vertex_handle v1,
|
||||
Vertex_handle v2
|
||||
)
|
||||
{
|
||||
index_ = CHANGED;
|
||||
Fb::set_vertices(v0, v1, v2);
|
||||
}
|
||||
|
||||
|
||||
template<class Gt, class Fb>
|
||||
inline int& CGAL::indexedFace<Gt, Fb>::faceIndex()
|
||||
{
|
||||
return index_;
|
||||
}
|
||||
|
||||
|
||||
template<class Gt, class Fb>
|
||||
inline int CGAL::indexedFace<Gt, Fb>::faceIndex() const
|
||||
{
|
||||
return index_;
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2007-2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -40,6 +40,34 @@ Description
|
||||
namespace CGAL
|
||||
{
|
||||
|
||||
// Forward declaration of friend functions and operators
|
||||
|
||||
template<class Gt, class Vb>
|
||||
class indexedVertex;
|
||||
|
||||
template<class Gt, class Vb>
|
||||
bool pointPair
|
||||
(
|
||||
const indexedVertex<Gt, Vb>& v0,
|
||||
const indexedVertex<Gt, Vb>& v1
|
||||
);
|
||||
|
||||
template<class Gt, class Vb>
|
||||
bool boundaryTriangle
|
||||
(
|
||||
const indexedVertex<Gt, Vb>& v0,
|
||||
const indexedVertex<Gt, Vb>& v1,
|
||||
const indexedVertex<Gt, Vb>& v2
|
||||
);
|
||||
|
||||
template<class Gt, class Vb>
|
||||
bool outsideTriangle
|
||||
(
|
||||
const indexedVertex<Gt, Vb>& v0,
|
||||
const indexedVertex<Gt, Vb>& v1,
|
||||
const indexedVertex<Gt, Vb>& v2
|
||||
);
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class indexedVertex Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
@ -85,173 +113,84 @@ public:
|
||||
};
|
||||
|
||||
|
||||
indexedVertex()
|
||||
:
|
||||
Vb(),
|
||||
index_(INTERNAL_POINT),
|
||||
type_(INTERNAL_POINT)
|
||||
{}
|
||||
// Constructors
|
||||
|
||||
indexedVertex(const Point& p)
|
||||
:
|
||||
Vb(p),
|
||||
index_(INTERNAL_POINT),
|
||||
type_(INTERNAL_POINT)
|
||||
{}
|
||||
inline indexedVertex();
|
||||
|
||||
indexedVertex(const Point& p, const int index, const int& type)
|
||||
:
|
||||
Vb(p),
|
||||
index_(index),
|
||||
type_(type)
|
||||
{}
|
||||
inline indexedVertex(const Point& p);
|
||||
|
||||
indexedVertex(const Point& p, Face_handle f)
|
||||
:
|
||||
Vb(f, p),
|
||||
index_(INTERNAL_POINT),
|
||||
type_(INTERNAL_POINT)
|
||||
{}
|
||||
inline indexedVertex(const Point& p, const int index, const int& type);
|
||||
|
||||
indexedVertex(Face_handle f)
|
||||
:
|
||||
Vb(f),
|
||||
index_(INTERNAL_POINT),
|
||||
type_(INTERNAL_POINT)
|
||||
{}
|
||||
inline indexedVertex(const Point& p, Face_handle f);
|
||||
|
||||
inline indexedVertex(Face_handle f);
|
||||
|
||||
|
||||
int& index()
|
||||
{
|
||||
return index_;
|
||||
}
|
||||
// Member Functions
|
||||
|
||||
int index() const
|
||||
{
|
||||
return index_;
|
||||
}
|
||||
inline int& index();
|
||||
|
||||
inline int index() const;
|
||||
|
||||
inline int& type();
|
||||
|
||||
inline int type() const;
|
||||
|
||||
//- Is point a far-point
|
||||
inline bool farPoint() const;
|
||||
|
||||
//- Is point internal, i.e. not on boundary
|
||||
inline bool internalPoint() const;
|
||||
|
||||
//- Is point internal and near the boundary
|
||||
inline bool nearBoundary() const;
|
||||
|
||||
//- Set the point to be near the boundary
|
||||
inline void setNearBoundary();
|
||||
|
||||
//- Is point a mirror point
|
||||
inline bool mirrorPoint() const;
|
||||
|
||||
//- Either master or slave of pointPair.
|
||||
inline bool pairPoint() const;
|
||||
|
||||
//- Master of a pointPair is the lowest numbered one.
|
||||
inline bool ppMaster() const;
|
||||
|
||||
//- Slave of a pointPair is the highest numbered one.
|
||||
inline bool ppSlave() const;
|
||||
|
||||
//- Either original internal point or master of pointPair.
|
||||
inline bool internalOrBoundaryPoint() const;
|
||||
|
||||
//- Is point near the boundary or part of the boundary definition
|
||||
inline bool nearOrOnBoundary() const;
|
||||
|
||||
|
||||
int& type()
|
||||
{
|
||||
return type_;
|
||||
}
|
||||
// Friend Functions
|
||||
|
||||
int type() const
|
||||
{
|
||||
return type_;
|
||||
}
|
||||
//- Do the two given vertices consitute a boundary point-pair
|
||||
friend bool pointPair <Gt, Vb>
|
||||
(
|
||||
const indexedVertex<Gt, Vb>& v0,
|
||||
const indexedVertex<Gt, Vb>& v1
|
||||
);
|
||||
|
||||
//- Do the three given vertices consitute a boundary triangle
|
||||
friend bool boundaryTriangle <Gt, Vb>
|
||||
(
|
||||
const indexedVertex<Gt, Vb>& v0,
|
||||
const indexedVertex<Gt, Vb>& v1,
|
||||
const indexedVertex<Gt, Vb>& v2
|
||||
);
|
||||
|
||||
//- Is point a far-point
|
||||
inline bool farPoint() const
|
||||
{
|
||||
return type_ == FAR_POINT;
|
||||
}
|
||||
|
||||
//- Is point internal, i.e. not on boundary
|
||||
inline bool internalPoint() const
|
||||
{
|
||||
return type_ <= INTERNAL_POINT;
|
||||
}
|
||||
|
||||
//- Is point internal and near the boundary
|
||||
inline bool nearBoundary() const
|
||||
{
|
||||
return type_ == NEAR_BOUNDARY_POINT;
|
||||
}
|
||||
|
||||
//- Set the point to be near the boundary
|
||||
inline void setNearBoundary()
|
||||
{
|
||||
type_ = NEAR_BOUNDARY_POINT;
|
||||
}
|
||||
|
||||
//- Is point a mirror point
|
||||
inline bool mirrorPoint() const
|
||||
{
|
||||
return type_ == MIRROR_POINT;
|
||||
}
|
||||
|
||||
//- Either master or slave of pointPair.
|
||||
inline bool pairPoint() const
|
||||
{
|
||||
return type_ >= 0;
|
||||
}
|
||||
|
||||
//- Master of a pointPair is the lowest numbered one.
|
||||
inline bool ppMaster() const
|
||||
{
|
||||
if (type_ > index_)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
//- Slave of a pointPair is the highest numbered one.
|
||||
inline bool ppSlave() const
|
||||
{
|
||||
if (type_ >= 0 && type_ < index_)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
//- Either original internal point or master of pointPair.
|
||||
inline bool internalOrBoundaryPoint() const
|
||||
{
|
||||
return internalPoint() || ppMaster();
|
||||
}
|
||||
|
||||
//- Is point near the boundary or part of the boundary definition
|
||||
inline bool nearOrOnBoundary() const
|
||||
{
|
||||
return pairPoint() || mirrorPoint() || nearBoundary();
|
||||
}
|
||||
|
||||
//- Do the two given vertices consitute a boundary point-pair
|
||||
inline friend bool pointPair
|
||||
(
|
||||
const indexedVertex& v0,
|
||||
const indexedVertex& v1
|
||||
)
|
||||
{
|
||||
return v0.index_ == v1.type_ || v1.index_ == v0.type_;
|
||||
}
|
||||
|
||||
//- Do the three given vertices consitute a boundary triangle
|
||||
inline friend bool boundaryTriangle
|
||||
(
|
||||
const indexedVertex& v0,
|
||||
const indexedVertex& v1,
|
||||
const indexedVertex& v2
|
||||
)
|
||||
{
|
||||
return (v0.pairPoint() && pointPair(v1, v2))
|
||||
|| (v1.pairPoint() && pointPair(v2, v0))
|
||||
|| (v2.pairPoint() && pointPair(v0, v1));
|
||||
}
|
||||
|
||||
//- Do the three given vertices consitute an outside triangle
|
||||
inline friend bool outsideTriangle
|
||||
(
|
||||
const indexedVertex& v0,
|
||||
const indexedVertex& v1,
|
||||
const indexedVertex& v2
|
||||
)
|
||||
{
|
||||
return (v0.farPoint() || v0.ppSlave())
|
||||
|| (v1.farPoint() || v1.ppSlave())
|
||||
|| (v2.farPoint() || v2.ppSlave());
|
||||
}
|
||||
//- Do the three given vertices consitute an outside triangle
|
||||
friend bool outsideTriangle <Gt, Vb>
|
||||
(
|
||||
const indexedVertex<Gt, Vb>& v0,
|
||||
const indexedVertex<Gt, Vb>& v1,
|
||||
const indexedVertex<Gt, Vb>& v2
|
||||
);
|
||||
|
||||
};
|
||||
|
||||
@ -260,6 +199,9 @@ public:
|
||||
|
||||
} // End namespace CGAL
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "indexedVertexI.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
230
applications/utilities/mesh/generation/cv2DMesh/indexedVertexI.H
Normal file
230
applications/utilities/mesh/generation/cv2DMesh/indexedVertexI.H
Normal file
@ -0,0 +1,230 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 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/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Gt, class Vb>
|
||||
inline CGAL::indexedVertex<Gt, Vb>::indexedVertex()
|
||||
:
|
||||
Vb(),
|
||||
index_(INTERNAL_POINT),
|
||||
type_(INTERNAL_POINT)
|
||||
{}
|
||||
|
||||
|
||||
template<class Gt, class Vb>
|
||||
inline CGAL::indexedVertex<Gt, Vb>::indexedVertex(const Point& p)
|
||||
:
|
||||
Vb(p),
|
||||
index_(INTERNAL_POINT),
|
||||
type_(INTERNAL_POINT)
|
||||
{}
|
||||
|
||||
|
||||
template<class Gt, class Vb>
|
||||
inline CGAL::indexedVertex<Gt, Vb>::indexedVertex
|
||||
(
|
||||
const Point& p,
|
||||
const int index,
|
||||
const int& type
|
||||
)
|
||||
:
|
||||
Vb(p),
|
||||
index_(index),
|
||||
type_(type)
|
||||
{}
|
||||
|
||||
|
||||
template<class Gt, class Vb>
|
||||
inline CGAL::indexedVertex<Gt, Vb>::indexedVertex(const Point& p, Face_handle f)
|
||||
:
|
||||
Vb(f, p),
|
||||
index_(INTERNAL_POINT),
|
||||
type_(INTERNAL_POINT)
|
||||
{}
|
||||
|
||||
|
||||
template<class Gt, class Vb>
|
||||
inline CGAL::indexedVertex<Gt, Vb>::indexedVertex(Face_handle f)
|
||||
:
|
||||
Vb(f),
|
||||
index_(INTERNAL_POINT),
|
||||
type_(INTERNAL_POINT)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class Gt, class Vb>
|
||||
inline int& CGAL::indexedVertex<Gt, Vb>::index()
|
||||
{
|
||||
return index_;
|
||||
}
|
||||
|
||||
|
||||
template<class Gt, class Vb>
|
||||
inline int CGAL::indexedVertex<Gt, Vb>::index() const
|
||||
{
|
||||
return index_;
|
||||
}
|
||||
|
||||
|
||||
template<class Gt, class Vb>
|
||||
inline int& CGAL::indexedVertex<Gt, Vb>::type()
|
||||
{
|
||||
return type_;
|
||||
}
|
||||
|
||||
|
||||
template<class Gt, class Vb>
|
||||
inline int CGAL::indexedVertex<Gt, Vb>::type() const
|
||||
{
|
||||
return type_;
|
||||
}
|
||||
|
||||
|
||||
template<class Gt, class Vb>
|
||||
inline bool CGAL::indexedVertex<Gt, Vb>::farPoint() const
|
||||
{
|
||||
return type_ == FAR_POINT;
|
||||
}
|
||||
|
||||
|
||||
template<class Gt, class Vb>
|
||||
inline bool CGAL::indexedVertex<Gt, Vb>::internalPoint() const
|
||||
{
|
||||
return type_ <= INTERNAL_POINT;
|
||||
}
|
||||
|
||||
|
||||
template<class Gt, class Vb>
|
||||
inline bool CGAL::indexedVertex<Gt, Vb>::nearBoundary() const
|
||||
{
|
||||
return type_ == NEAR_BOUNDARY_POINT;
|
||||
}
|
||||
|
||||
|
||||
template<class Gt, class Vb>
|
||||
inline void CGAL::indexedVertex<Gt, Vb>::setNearBoundary()
|
||||
{
|
||||
type_ = NEAR_BOUNDARY_POINT;
|
||||
}
|
||||
|
||||
|
||||
template<class Gt, class Vb>
|
||||
inline bool CGAL::indexedVertex<Gt, Vb>::mirrorPoint() const
|
||||
{
|
||||
return type_ == MIRROR_POINT;
|
||||
}
|
||||
|
||||
|
||||
template<class Gt, class Vb>
|
||||
inline bool CGAL::indexedVertex<Gt, Vb>::pairPoint() const
|
||||
{
|
||||
return type_ >= 0;
|
||||
}
|
||||
|
||||
|
||||
template<class Gt, class Vb>
|
||||
inline bool CGAL::indexedVertex<Gt, Vb>::ppMaster() const
|
||||
{
|
||||
if (type_ > index_)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class Gt, class Vb>
|
||||
inline bool CGAL::indexedVertex<Gt, Vb>::ppSlave() const
|
||||
{
|
||||
if (type_ >= 0 && type_ < index_)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class Gt, class Vb>
|
||||
inline bool CGAL::indexedVertex<Gt, Vb>::internalOrBoundaryPoint() const
|
||||
{
|
||||
return internalPoint() || ppMaster();
|
||||
}
|
||||
|
||||
|
||||
template<class Gt, class Vb>
|
||||
inline bool CGAL::indexedVertex<Gt, Vb>::nearOrOnBoundary() const
|
||||
{
|
||||
return pairPoint() || mirrorPoint() || nearBoundary();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Friend Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class Gt, class Vb>
|
||||
bool CGAL::pointPair
|
||||
(
|
||||
const indexedVertex<Gt, Vb>& v0,
|
||||
const indexedVertex<Gt, Vb>& v1
|
||||
)
|
||||
{
|
||||
return v0.index_ == v1.type_ || v1.index_ == v0.type_;
|
||||
}
|
||||
|
||||
|
||||
template<class Gt, class Vb>
|
||||
bool CGAL::boundaryTriangle
|
||||
(
|
||||
const indexedVertex<Gt, Vb>& v0,
|
||||
const indexedVertex<Gt, Vb>& v1,
|
||||
const indexedVertex<Gt, Vb>& v2
|
||||
)
|
||||
{
|
||||
return (v0.pairPoint() && pointPair(v1, v2))
|
||||
|| (v1.pairPoint() && pointPair(v2, v0))
|
||||
|| (v2.pairPoint() && pointPair(v0, v1));
|
||||
}
|
||||
|
||||
|
||||
template<class Gt, class Vb>
|
||||
bool CGAL::outsideTriangle
|
||||
(
|
||||
const indexedVertex<Gt, Vb>& v0,
|
||||
const indexedVertex<Gt, Vb>& v1,
|
||||
const indexedVertex<Gt, Vb>& v2
|
||||
)
|
||||
{
|
||||
return (v0.farPoint() || v0.ppSlave())
|
||||
|| (v1.farPoint() || v1.ppSlave())
|
||||
|| (v2.farPoint() || v2.ppSlave());
|
||||
}
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2007-2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2007-2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -25,13 +25,10 @@ License
|
||||
|
||||
#include "CV2D.H"
|
||||
#include "plane.H"
|
||||
#include "triSurfaceTools.H"
|
||||
#include "unitConversion.H"
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
|
||||
bool Foam::CV2D::on2DLine(const point2D& p, const linePointRef& line)
|
||||
{
|
||||
const point2D& a = toPoint2D(line.start());
|
||||
@ -52,8 +49,6 @@ bool Foam::CV2D::on2DLine(const point2D& p, const linePointRef& line)
|
||||
}
|
||||
|
||||
|
||||
// Create feature points/edges by creating a triplet in the corner.
|
||||
// (this triplet will have as its circumcentre the feature)
|
||||
void Foam::CV2D::insertFeaturePoints()
|
||||
{
|
||||
featurePoints_.clear();
|
||||
@ -394,4 +389,6 @@ void Foam::CV2D::reinsertFeaturePoints()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2007-2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2007-2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
|
||||
@ -27,13 +27,9 @@ License
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
defineTypeNameAndDebug(shortEdgeFilter2D, 0);
|
||||
|
||||
defineTypeNameAndDebug(shortEdgeFilter2D, 0);
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -51,7 +51,6 @@ class shortEdgeFilter2D
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Description of data_
|
||||
const CV2D& cv2Dmesh_;
|
||||
|
||||
MeshedSurface<face> ms_;
|
||||
@ -83,11 +82,7 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
shortEdgeFilter2D
|
||||
(
|
||||
const CV2D& cv2Dmesh,
|
||||
const dictionary& dict
|
||||
);
|
||||
shortEdgeFilter2D(const CV2D& cv2Dmesh, const dictionary& dict);
|
||||
|
||||
|
||||
//- Destructor
|
||||
@ -116,12 +111,12 @@ public:
|
||||
return ms_;
|
||||
}
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
void filter();
|
||||
|
||||
void writeInfo(Ostream& os);
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -281,7 +281,8 @@ Foam::scalar Foam::cellSizeControlSurfaces::cellSize
|
||||
{
|
||||
scalar size = defaultCellSize_;
|
||||
|
||||
bool anyFunctionFound = evalCellSizeFunctions(pt, size);
|
||||
// bool anyFunctionFound = evalCellSizeFunctions(pt, size);
|
||||
evalCellSizeFunctions(pt, size);
|
||||
|
||||
//if (!anyFunctionFound)
|
||||
//{
|
||||
|
||||
@ -31,9 +31,7 @@ License
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
defineTypeNameAndDebug(extrude2DMesh, 0);
|
||||
|
||||
defineTypeNameAndDebug(extrude2DMesh, 0);
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
@ -45,10 +43,10 @@ void Foam::extrude2DMesh::check2D() const
|
||||
{
|
||||
if (faces[faceI].size() != 2)
|
||||
{
|
||||
FatalErrorIn("extrude2DMesh.C")
|
||||
FatalErrorIn("void Foam::extrude2DMesh::check2D() const")
|
||||
<< "Face " << faceI << " size " << faces[faceI].size()
|
||||
<< " is not of size 2 so mesh is not proper two-dimensional."
|
||||
<< exit(FatalError);
|
||||
<< " is not of size 2: mesh is not a valid two-dimensional "
|
||||
<< "mesh" << exit(FatalError);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -537,7 +535,7 @@ void Foam::extrude2DMesh::setRefinement
|
||||
-1, // nei
|
||||
-1, // masterPointID
|
||||
-1, // masterEdgeID
|
||||
nFaces++, // masterFaceID
|
||||
nFaces++, // masterFaceID
|
||||
false, // flipFaceFlux
|
||||
backPatchI_, // patchID
|
||||
-1, // zoneID
|
||||
@ -567,7 +565,7 @@ void Foam::extrude2DMesh::setRefinement
|
||||
-1, // nei
|
||||
-1, // masterPointID
|
||||
-1, // masterEdgeID
|
||||
nFaces++, // masterFaceID
|
||||
nFaces++, // masterFaceID
|
||||
false, // flipFaceFlux
|
||||
frontPatchI_, // patchID
|
||||
-1, // zoneID
|
||||
|
||||
@ -111,8 +111,6 @@ static const NamedEnum<ExtrudeMode, 2> ExtrudeModeNames;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
#include "addOverwriteOption.H"
|
||||
|
||||
argList::validArgs.append("surfaceFormat");
|
||||
|
||||
#include "setRootCase.H"
|
||||
@ -128,11 +126,10 @@ int main(int argc, char *argv[])
|
||||
|
||||
runTimeExtruded.functionObjects().off();
|
||||
|
||||
const bool overwrite = args.optionFound("overwrite");
|
||||
|
||||
const ExtrudeMode surfaceFormat = ExtrudeModeNames[args[1]];
|
||||
|
||||
Info<< "Extruding from " << ExtrudeModeNames[surfaceFormat] << endl;
|
||||
Info<< "Extruding from " << ExtrudeModeNames[surfaceFormat]
|
||||
<< " at time " << runTimeExtruded.timeName() << endl;
|
||||
|
||||
IOdictionary extrude2DMeshDict
|
||||
(
|
||||
@ -164,12 +161,12 @@ int main(int argc, char *argv[])
|
||||
|
||||
EdgeMap<label> edgeRegionMap;
|
||||
wordList patchNames(1, "default");
|
||||
labelList patchSizes(1, fMesh->nEdges() - fMesh->nInternalEdges());
|
||||
labelList patchSizes(1, fMesh().nEdges() - fMesh().nInternalEdges());
|
||||
|
||||
const edgeList& edges = fMesh->edges();
|
||||
const edgeList& edges = fMesh().edges();
|
||||
forAll(edges, edgeI)
|
||||
{
|
||||
if (!fMesh->isInternalEdge(edgeI))
|
||||
if (!fMesh().isInternalEdge(edgeI))
|
||||
{
|
||||
edgeRegionMap.insert(edges[edgeI], 0);
|
||||
}
|
||||
@ -216,11 +213,11 @@ int main(int argc, char *argv[])
|
||||
poly2DMesh.patchSizes()[patchI],
|
||||
poly2DMesh.patchStarts()[patchI],
|
||||
patchI,
|
||||
mesh->boundaryMesh()
|
||||
mesh().boundaryMesh()
|
||||
);
|
||||
}
|
||||
|
||||
mesh->addPatches(patches);
|
||||
mesh().addPatches(patches);
|
||||
}
|
||||
else if (surfaceFormat == POLYMESH2D)
|
||||
{
|
||||
@ -249,17 +246,17 @@ int main(int argc, char *argv[])
|
||||
extruder.setRefinement(meshMod());
|
||||
|
||||
// Create a mesh from topo changes.
|
||||
autoPtr<mapPolyMesh> morphMap = meshMod->changeMesh(mesh(), false);
|
||||
autoPtr<mapPolyMesh> morphMap = meshMod().changeMesh(mesh(), false);
|
||||
|
||||
mesh->updateMesh(morphMap);
|
||||
mesh().updateMesh(morphMap);
|
||||
|
||||
{
|
||||
edgeCollapser collapser(mesh());
|
||||
|
||||
const edgeList& edges = mesh->edges();
|
||||
const pointField& points = mesh->points();
|
||||
const edgeList& edges = mesh().edges();
|
||||
const pointField& points = mesh().points();
|
||||
|
||||
const boundBox& bb = mesh->bounds();
|
||||
const boundBox& bb = mesh().bounds();
|
||||
const scalar mergeDim = 1E-4 * bb.minDim();
|
||||
|
||||
forAll(edges, edgeI)
|
||||
@ -286,14 +283,11 @@ int main(int argc, char *argv[])
|
||||
autoPtr<mapPolyMesh> morphMap
|
||||
= meshModCollapse.changeMesh(mesh(), false);
|
||||
|
||||
mesh->updateMesh(morphMap);
|
||||
mesh().updateMesh(morphMap);
|
||||
}
|
||||
|
||||
|
||||
mesh->setInstance(runTimeExtruded.constant());
|
||||
|
||||
// Take over refinement levels and write to new time directory.
|
||||
Pout<< "Writing extruded mesh to time = " << runTimeExtruded.timeName()
|
||||
Pout<< "\nWriting extruded mesh to time = " << runTimeExtruded.timeName()
|
||||
<< nl << endl;
|
||||
|
||||
mesh().write();
|
||||
|
||||
@ -354,25 +354,33 @@ void Foam::rotorDiskSource::constructGeometry()
|
||||
{
|
||||
const label cellI = cells_[i];
|
||||
|
||||
// position in rotor co-ordinate system
|
||||
// position in (planar) rotor co-ordinate system
|
||||
x_[i] = coordSys_.localPosition(C[cellI]);
|
||||
|
||||
// cache max radius
|
||||
rMax_ = max(rMax_, x_[i].x());
|
||||
|
||||
// determine swept angle relative to rDir axis
|
||||
scalar psi = x_[i].y() - rDir.y();
|
||||
// swept angle relative to rDir axis [radians] in range 0 -> 2*pi
|
||||
scalar psi = x_[i].y();
|
||||
if (psi < 0)
|
||||
{
|
||||
psi += mathematical::twoPi;
|
||||
}
|
||||
|
||||
// blade flap angle
|
||||
// blade flap angle [radians]
|
||||
scalar beta = flap_.beta0 - flap_.beta1*cos(psi) - flap_.beta2*sin(psi);
|
||||
|
||||
// determine rotation tensor to convert into the rotor cone plane
|
||||
scalar c = cos(-beta);
|
||||
scalar s = sin(-beta);
|
||||
R_[i] = tensor(1, 0, 0, 0, c, s, 0, -s, c);
|
||||
// determine rotation tensor to convert from planar system into the
|
||||
// rotor cone system
|
||||
scalar cNeg = cos(-beta);
|
||||
scalar sNeg = sin(-beta);
|
||||
R_[i] = tensor(cNeg, 0.0, -sNeg, 0.0, 1.0, 0.0, sNeg, 0.0, cNeg);
|
||||
scalar cPos = cos(beta);
|
||||
scalar sPos = sin(beta);
|
||||
invR_[i] = tensor(cPos, 0.0, -sPos, 0.0, 1.0, 0.0, sPos, 0.0, cPos);
|
||||
|
||||
// geometric angle of attack - not including twist
|
||||
alphag_[i] = trim_.alphaC - trim_.A*cos(psi) - trim_.B*sin(psi);
|
||||
// geometric angle of attack - not including twist [radians]
|
||||
alphag_[i] = trim_.alphaC + trim_.A*cos(psi) + trim_.B*sin(psi);
|
||||
}
|
||||
}
|
||||
|
||||
@ -439,6 +447,7 @@ Foam::rotorDiskSource::rotorDiskSource
|
||||
profiles_(coeffs_.subDict("profiles")),
|
||||
x_(cells_.size(), vector::zero),
|
||||
R_(cells_.size(), I),
|
||||
invR_(cells_.size(), I),
|
||||
alphag_(cells_.size(), 0.0),
|
||||
area_(cells_.size(), 0.0),
|
||||
coordSys_(false),
|
||||
|
||||
@ -131,17 +131,18 @@ public:
|
||||
protected:
|
||||
|
||||
// Helper structures to encapsulate flap and trim data
|
||||
// Note: all input in degrees (converted to radians internally)
|
||||
|
||||
struct flapData
|
||||
{
|
||||
scalar beta0; // coning angle [deg]
|
||||
scalar beta0; // coning angle
|
||||
scalar beta1; // lateral flapping coeff
|
||||
scalar beta2; // longitudinal flapping coeff
|
||||
};
|
||||
|
||||
struct trimData
|
||||
{
|
||||
scalar alphaC; // collective pitch angle [deg]
|
||||
scalar alphaC; // collective pitch angle
|
||||
scalar A; // lateral cyclic coeff
|
||||
scalar B; // longitudinal cyclic coeff
|
||||
};
|
||||
@ -186,6 +187,9 @@ protected:
|
||||
//- Rotation tensor for flap angle
|
||||
List<tensor> R_;
|
||||
|
||||
//- Inverse rotation tensor for flap angle
|
||||
List<tensor> invR_;
|
||||
|
||||
//- Geometric angle of attack [deg]
|
||||
List<scalar> alphag_;
|
||||
|
||||
|
||||
@ -29,7 +29,7 @@ License
|
||||
#include "unitConversion.H"
|
||||
#include "volFields.H"
|
||||
|
||||
using namespace Foam::constant;
|
||||
using namespace Foam::constant::mathematical;
|
||||
|
||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||
|
||||
@ -124,11 +124,11 @@ Foam::tmp<Foam::volVectorField> Foam::rotorDiskSource::calculateForces
|
||||
|
||||
const scalar radius = x_[i].x();
|
||||
|
||||
// apply correction due to flap in cartesian frame
|
||||
vector Uc = R_[i] & U[cellI];
|
||||
// velocity in local cylindrical reference frame
|
||||
vector Uc = coordSys_.localVector(U[cellI]);
|
||||
|
||||
// velocity in local reference frame
|
||||
Uc = coordSys_.localVector(Uc);
|
||||
// apply correction in local system due to coning
|
||||
Uc = R_[i] & Uc;
|
||||
|
||||
// set radial component of velocity to zero
|
||||
Uc.x() = 0.0;
|
||||
@ -149,7 +149,16 @@ Foam::tmp<Foam::volVectorField> Foam::rotorDiskSource::calculateForces
|
||||
blade_.interpolate(radius, twist, chord, i1, i2, invDr);
|
||||
|
||||
// effective angle of attack
|
||||
scalar alphaEff = alphag_[i] + twist - atan(Uc.z()/Uc.y());
|
||||
scalar alphaEff = pi + atan2(Uc.z(), Uc.y()) - (alphag_[i] + twist);
|
||||
if (alphaEff > pi)
|
||||
{
|
||||
alphaEff -= twoPi;
|
||||
}
|
||||
if (alphaEff < -pi)
|
||||
{
|
||||
alphaEff += twoPi;
|
||||
}
|
||||
|
||||
AOAmin = min(AOAmin, alphaEff);
|
||||
AOAmax = max(AOAmax, alphaEff);
|
||||
|
||||
@ -175,10 +184,13 @@ Foam::tmp<Foam::volVectorField> Foam::rotorDiskSource::calculateForces
|
||||
tipFactor = 0.0;
|
||||
}
|
||||
|
||||
// calculate forces
|
||||
const scalar pDyn = 0.5*rho[cellI]*sqr(magUc);
|
||||
const scalar f = pDyn*chord*nBlades_*area_[i]/(mathematical::twoPi);
|
||||
const vector localForce(0.0, f*Cd, tipFactor*f*Cl);
|
||||
// calculate forces perpendicular to blade
|
||||
scalar pDyn = 0.5*rho[cellI]*sqr(magUc);
|
||||
scalar f = pDyn*chord*nBlades_*area_[i]/twoPi;
|
||||
vector localForce = vector(0.0, f*Cd, tipFactor*f*Cl);
|
||||
|
||||
// convert force from local coning system into rotor cylindrical
|
||||
localForce = invR_[i] & localForce;
|
||||
|
||||
// accumulate forces
|
||||
dragEff += localForce.y();
|
||||
|
||||
@ -33,8 +33,7 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::
|
||||
cylindricalInletVelocityFvPatchVectorField::
|
||||
Foam::cylindricalInletVelocityFvPatchVectorField::
|
||||
cylindricalInletVelocityFvPatchVectorField
|
||||
(
|
||||
const fvPatch& p,
|
||||
@ -42,16 +41,15 @@ cylindricalInletVelocityFvPatchVectorField
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<vector>(p, iF),
|
||||
axialVelocity_(0),
|
||||
centre_(pTraits<vector>::zero),
|
||||
axis_(pTraits<vector>::zero),
|
||||
rpm_(0),
|
||||
radialVelocity_(0)
|
||||
axialVelocity_(),
|
||||
radialVelocity_(),
|
||||
rpm_()
|
||||
{}
|
||||
|
||||
|
||||
Foam::
|
||||
cylindricalInletVelocityFvPatchVectorField::
|
||||
Foam::cylindricalInletVelocityFvPatchVectorField::
|
||||
cylindricalInletVelocityFvPatchVectorField
|
||||
(
|
||||
const cylindricalInletVelocityFvPatchVectorField& ptf,
|
||||
@ -61,16 +59,15 @@ cylindricalInletVelocityFvPatchVectorField
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<vector>(ptf, p, iF, mapper),
|
||||
axialVelocity_(ptf.axialVelocity_),
|
||||
centre_(ptf.centre_),
|
||||
axis_(ptf.axis_),
|
||||
rpm_(ptf.rpm_),
|
||||
radialVelocity_(ptf.radialVelocity_)
|
||||
axialVelocity_(ptf.axialVelocity_().clone().ptr()),
|
||||
radialVelocity_(ptf.radialVelocity_().clone().ptr()),
|
||||
rpm_(ptf.rpm_().clone().ptr())
|
||||
{}
|
||||
|
||||
|
||||
Foam::
|
||||
cylindricalInletVelocityFvPatchVectorField::
|
||||
Foam::cylindricalInletVelocityFvPatchVectorField::
|
||||
cylindricalInletVelocityFvPatchVectorField
|
||||
(
|
||||
const fvPatch& p,
|
||||
@ -79,32 +76,30 @@ cylindricalInletVelocityFvPatchVectorField
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<vector>(p, iF, dict),
|
||||
axialVelocity_(readScalar(dict.lookup("axialVelocity"))),
|
||||
centre_(dict.lookup("centre")),
|
||||
axis_(dict.lookup("axis")),
|
||||
rpm_(readScalar(dict.lookup("rpm"))),
|
||||
radialVelocity_(readScalar(dict.lookup("radialVelocity")))
|
||||
axialVelocity_(DataEntry<scalar>::New("axialVelocity", dict)),
|
||||
radialVelocity_(DataEntry<scalar>::New("radialVelocity", dict)),
|
||||
rpm_(DataEntry<scalar>::New("rpm", dict))
|
||||
{}
|
||||
|
||||
|
||||
Foam::
|
||||
cylindricalInletVelocityFvPatchVectorField::
|
||||
Foam::cylindricalInletVelocityFvPatchVectorField::
|
||||
cylindricalInletVelocityFvPatchVectorField
|
||||
(
|
||||
const cylindricalInletVelocityFvPatchVectorField& ptf
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<vector>(ptf),
|
||||
axialVelocity_(ptf.axialVelocity_),
|
||||
centre_(ptf.centre_),
|
||||
axis_(ptf.axis_),
|
||||
rpm_(ptf.rpm_),
|
||||
radialVelocity_(ptf.radialVelocity_)
|
||||
axialVelocity_(ptf.axialVelocity_().clone().ptr()),
|
||||
radialVelocity_(ptf.radialVelocity_().clone().ptr()),
|
||||
rpm_(ptf.rpm_().clone().ptr())
|
||||
{}
|
||||
|
||||
|
||||
Foam::
|
||||
cylindricalInletVelocityFvPatchVectorField::
|
||||
Foam::cylindricalInletVelocityFvPatchVectorField::
|
||||
cylindricalInletVelocityFvPatchVectorField
|
||||
(
|
||||
const cylindricalInletVelocityFvPatchVectorField& ptf,
|
||||
@ -112,11 +107,11 @@ cylindricalInletVelocityFvPatchVectorField
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<vector>(ptf, iF),
|
||||
axialVelocity_(ptf.axialVelocity_),
|
||||
centre_(ptf.centre_),
|
||||
axis_(ptf.axis_),
|
||||
rpm_(ptf.rpm_),
|
||||
radialVelocity_(ptf.radialVelocity_)
|
||||
axialVelocity_(ptf.axialVelocity_().clone().ptr()),
|
||||
radialVelocity_(ptf.radialVelocity_().clone().ptr()),
|
||||
rpm_(ptf.rpm_().clone().ptr())
|
||||
{}
|
||||
|
||||
|
||||
@ -129,15 +124,22 @@ void Foam::cylindricalInletVelocityFvPatchVectorField::updateCoeffs()
|
||||
return;
|
||||
}
|
||||
|
||||
const scalar t = this->db().time().timeOutputValue();
|
||||
const scalar axialVelocity = axialVelocity_->value(t);
|
||||
const scalar radialVelocity = radialVelocity_->value(t);
|
||||
const scalar rpm = rpm_->value(t);
|
||||
|
||||
vector hatAxis = axis_/mag(axis_);
|
||||
|
||||
const vectorField r(patch().Cf() - centre_);
|
||||
tmp<vectorField> d = r - (hatAxis & r)*hatAxis;
|
||||
|
||||
tmp<vectorField> tangVel =
|
||||
(rpm_*constant::mathematical::pi/30.0)*(hatAxis) ^ d;
|
||||
tmp<vectorField> tangVel
|
||||
(
|
||||
(rpm*constant::mathematical::pi/30.0)*(hatAxis) ^ d
|
||||
);
|
||||
|
||||
operator==(tangVel + axis_*axialVelocity_ + radialVelocity_*d);
|
||||
operator==(tangVel + axis_*axialVelocity + radialVelocity*d);
|
||||
|
||||
fixedValueFvPatchField<vector>::updateCoeffs();
|
||||
}
|
||||
@ -146,13 +148,11 @@ void Foam::cylindricalInletVelocityFvPatchVectorField::updateCoeffs()
|
||||
void Foam::cylindricalInletVelocityFvPatchVectorField::write(Ostream& os) const
|
||||
{
|
||||
fvPatchField<vector>::write(os);
|
||||
os.writeKeyword("axialVelocity") << axialVelocity_ <<
|
||||
token::END_STATEMENT << nl;
|
||||
os.writeKeyword("centre") << centre_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("axis") << axis_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("rpm") << rpm_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("radialVelocity") << radialVelocity_ <<
|
||||
token::END_STATEMENT << nl;
|
||||
axialVelocity_->writeData(os);
|
||||
radialVelocity_->writeData(os);
|
||||
rpm_->writeData(os);
|
||||
writeEntry("value", os);
|
||||
}
|
||||
|
||||
|
||||
@ -36,12 +36,15 @@ Description
|
||||
type cylindricalInletVelocity;
|
||||
axis (0 0 1);
|
||||
centre (0 0 0);
|
||||
axialVelocity 30;
|
||||
rpm 100;
|
||||
radialVelocity -10;
|
||||
axialVelocity constant 30;
|
||||
radialVelocity constant -10;
|
||||
rpm constant 100;
|
||||
}
|
||||
\endverbatim
|
||||
|
||||
The axialVelocity, radialVelocity and rpm entries are DataEntry types, able
|
||||
to describe time varying functions. The example above gives the usage for
|
||||
supplying constant values.
|
||||
|
||||
SourceFiles
|
||||
cylindricalInletVelocityFvPatchVectorField.C
|
||||
@ -52,6 +55,7 @@ SourceFiles
|
||||
#define cylindricalInletVelocityFvPatchVectorField_H
|
||||
|
||||
#include "fixedValueFvPatchFields.H"
|
||||
#include "DataEntry.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -67,20 +71,20 @@ class cylindricalInletVelocityFvPatchVectorField
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Axial velocity
|
||||
const scalar axialVelocity_;
|
||||
|
||||
//- Central point
|
||||
const vector centre_;
|
||||
|
||||
//- Axis
|
||||
const vector axis_;
|
||||
|
||||
//- RPM
|
||||
const scalar rpm_;
|
||||
//- Axial velocity
|
||||
autoPtr<DataEntry<scalar> > axialVelocity_;
|
||||
|
||||
//- Radial velocity
|
||||
const scalar radialVelocity_;
|
||||
autoPtr<DataEntry<scalar> > radialVelocity_;
|
||||
|
||||
//- RPM
|
||||
autoPtr<DataEntry<scalar> > rpm_;
|
||||
|
||||
|
||||
public:
|
||||
@ -154,13 +158,11 @@ public:
|
||||
|
||||
// Member functions
|
||||
|
||||
|
||||
//- Update the coefficients associated with the patch field
|
||||
virtual void updateCoeffs();
|
||||
|
||||
//- Write
|
||||
virtual void write(Ostream&) const;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -25,7 +25,24 @@ Class
|
||||
Foam::oscillatingFixedValueFvPatchField
|
||||
|
||||
Description
|
||||
Foam::oscillatingFixedValueFvPatchField
|
||||
Describes an oscillating boundary condition in terms of amplitude and
|
||||
frequency.
|
||||
|
||||
Example of the boundary condition specification:
|
||||
\verbatim
|
||||
inlet
|
||||
{
|
||||
type oscillatingFixedValue;
|
||||
refValue uniform 5.0;
|
||||
offset 0.0; // optional
|
||||
amplitude constant 0.5;
|
||||
frequency constant 10;
|
||||
}
|
||||
\endverbatim
|
||||
|
||||
The amplitude and frequency entries are DataEntry types, able to describe
|
||||
time varying functions. The example above gives the usage for supplying
|
||||
constant values.
|
||||
|
||||
SourceFiles
|
||||
oscillatingFixedValueFvPatchField.C
|
||||
|
||||
@ -32,8 +32,7 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::
|
||||
swirlFlowRateInletVelocityFvPatchVectorField::
|
||||
Foam::swirlFlowRateInletVelocityFvPatchVectorField::
|
||||
swirlFlowRateInletVelocityFvPatchVectorField
|
||||
(
|
||||
const fvPatch& p,
|
||||
@ -41,15 +40,14 @@ swirlFlowRateInletVelocityFvPatchVectorField
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<vector>(p, iF),
|
||||
flowRate_(0),
|
||||
phiName_("phi"),
|
||||
rhoName_("rho"),
|
||||
rpm_(0)
|
||||
flowRate_(),
|
||||
rpm_()
|
||||
{}
|
||||
|
||||
|
||||
Foam::
|
||||
swirlFlowRateInletVelocityFvPatchVectorField::
|
||||
Foam::swirlFlowRateInletVelocityFvPatchVectorField::
|
||||
swirlFlowRateInletVelocityFvPatchVectorField
|
||||
(
|
||||
const swirlFlowRateInletVelocityFvPatchVectorField& ptf,
|
||||
@ -59,15 +57,14 @@ swirlFlowRateInletVelocityFvPatchVectorField
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<vector>(ptf, p, iF, mapper),
|
||||
flowRate_(ptf.flowRate_),
|
||||
phiName_(ptf.phiName_),
|
||||
rhoName_(ptf.rhoName_),
|
||||
rpm_(ptf.rpm_)
|
||||
flowRate_(ptf.flowRate_().clone().ptr()),
|
||||
rpm_(ptf.rpm_().clone().ptr())
|
||||
{}
|
||||
|
||||
|
||||
Foam::
|
||||
swirlFlowRateInletVelocityFvPatchVectorField::
|
||||
Foam::swirlFlowRateInletVelocityFvPatchVectorField::
|
||||
swirlFlowRateInletVelocityFvPatchVectorField
|
||||
(
|
||||
const fvPatch& p,
|
||||
@ -76,30 +73,28 @@ swirlFlowRateInletVelocityFvPatchVectorField
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<vector>(p, iF, dict),
|
||||
flowRate_(readScalar(dict.lookup("flowRate"))),
|
||||
phiName_(dict.lookupOrDefault<word>("phi", "phi")),
|
||||
rhoName_(dict.lookupOrDefault<word>("rho", "rho")),
|
||||
rpm_(readScalar(dict.lookup("rpm")))
|
||||
flowRate_(DataEntry<scalar>::New("flowRate", dict)),
|
||||
rpm_(DataEntry<scalar>::New("rpm", dict))
|
||||
{}
|
||||
|
||||
|
||||
Foam::
|
||||
swirlFlowRateInletVelocityFvPatchVectorField::
|
||||
Foam::swirlFlowRateInletVelocityFvPatchVectorField::
|
||||
swirlFlowRateInletVelocityFvPatchVectorField
|
||||
(
|
||||
const swirlFlowRateInletVelocityFvPatchVectorField& ptf
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<vector>(ptf),
|
||||
flowRate_(ptf.flowRate_),
|
||||
phiName_(ptf.phiName_),
|
||||
rhoName_(ptf.rhoName_),
|
||||
rpm_(ptf.rpm_)
|
||||
flowRate_(ptf.flowRate_().clone().ptr()),
|
||||
rpm_(ptf.rpm_().clone().ptr())
|
||||
{}
|
||||
|
||||
|
||||
Foam::
|
||||
swirlFlowRateInletVelocityFvPatchVectorField::
|
||||
Foam::swirlFlowRateInletVelocityFvPatchVectorField::
|
||||
swirlFlowRateInletVelocityFvPatchVectorField
|
||||
(
|
||||
const swirlFlowRateInletVelocityFvPatchVectorField& ptf,
|
||||
@ -107,10 +102,10 @@ swirlFlowRateInletVelocityFvPatchVectorField
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<vector>(ptf, iF),
|
||||
flowRate_(ptf.flowRate_),
|
||||
phiName_(ptf.phiName_),
|
||||
rhoName_(ptf.rhoName_),
|
||||
rpm_(ptf.rpm_)
|
||||
flowRate_(ptf.flowRate_().clone().ptr()),
|
||||
rpm_(ptf.rpm_().clone().ptr())
|
||||
{}
|
||||
|
||||
|
||||
@ -123,19 +118,22 @@ void Foam::swirlFlowRateInletVelocityFvPatchVectorField::updateCoeffs()
|
||||
return;
|
||||
}
|
||||
|
||||
const scalar t = this->db().time().timeOutputValue();
|
||||
const scalar flowRate = flowRate_->value(t);
|
||||
const scalar rpm = rpm_->value(t);
|
||||
|
||||
const scalar totArea = gSum(patch().magSf());
|
||||
// a simpler way of doing this would be nice
|
||||
const scalar avgU = -flowRate_/totArea;
|
||||
const scalar avgU = -flowRate/totArea;
|
||||
|
||||
const vector avgCenter = gSum(patch().Cf()*patch().magSf())/totArea;
|
||||
const vector avgNormal = gSum(patch().Sf())/totArea;
|
||||
|
||||
// Update angular velocity - convert [rpm] to [rad/s]
|
||||
tmp<vectorField> tangentialVelocity =
|
||||
(
|
||||
(rpm_*constant::mathematical::pi/30.0)
|
||||
* (patch().Cf() - avgCenter) ^ avgNormal
|
||||
);
|
||||
tmp<vectorField> tangentialVelocity
|
||||
(
|
||||
(rpm*constant::mathematical::pi/30.0)
|
||||
* (patch().Cf() - avgCenter) ^ avgNormal
|
||||
);
|
||||
|
||||
tmp<vectorField> n = patch().nf();
|
||||
|
||||
@ -177,10 +175,10 @@ void Foam::swirlFlowRateInletVelocityFvPatchVectorField::write
|
||||
) const
|
||||
{
|
||||
fvPatchField<vector>::write(os);
|
||||
os.writeKeyword("flowRate") << flowRate_ << token::END_STATEMENT << nl;
|
||||
writeEntryIfDifferent<word>(os, "phi", "phi", phiName_);
|
||||
writeEntryIfDifferent<word>(os, "rho", "rho", rhoName_);
|
||||
os.writeKeyword("rpm") << rpm_ << token::END_STATEMENT << nl;
|
||||
flowRate_->writeData(os);
|
||||
rpm_->writeData(os);
|
||||
writeEntry("value", os);
|
||||
}
|
||||
|
||||
|
||||
@ -39,11 +39,15 @@ Description
|
||||
inlet
|
||||
{
|
||||
type swirlFlowRateInletVelocity;
|
||||
flowRate 0.2; // Volumetric/mass flow rate [m3/s or kg/s]
|
||||
rpm 100;
|
||||
flowRate constant 0.2; // Vol/mass flow rate [m3/s or kg/s]
|
||||
rpm constant 100;
|
||||
}
|
||||
\endverbatim
|
||||
|
||||
The flowRate and rpm entries are DataEntry types, able to describe time
|
||||
varying functions. The example above gives the usage for supplying
|
||||
constant values.
|
||||
|
||||
Note
|
||||
- The value is positive inwards
|
||||
|
||||
@ -56,6 +60,7 @@ SourceFiles
|
||||
#define swirlFlowRateInletVelocityFvPatchVectorField_H
|
||||
|
||||
#include "fixedValueFvPatchFields.H"
|
||||
#include "DataEntry.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -71,17 +76,17 @@ class swirlFlowRateInletVelocityFvPatchVectorField
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Inlet integral flow rate
|
||||
const scalar flowRate_;
|
||||
|
||||
//- Name of the flux transporting the field
|
||||
const word phiName_;
|
||||
|
||||
//- Name of the density field used to normalize the mass flux
|
||||
const word rhoName_;
|
||||
|
||||
//- Inlet integral flow rate
|
||||
autoPtr<DataEntry<scalar> > flowRate_;
|
||||
|
||||
//- RPM
|
||||
const scalar rpm_;
|
||||
autoPtr<DataEntry<scalar> > rpm_;
|
||||
|
||||
|
||||
public:
|
||||
@ -157,18 +162,11 @@ public:
|
||||
|
||||
// Access
|
||||
|
||||
//- Return the flux
|
||||
scalar flowRate() const
|
||||
{
|
||||
return flowRate_;
|
||||
}
|
||||
//- Update the coefficients associated with the patch field
|
||||
virtual void updateCoeffs();
|
||||
|
||||
|
||||
//- Update the coefficients associated with the patch field
|
||||
virtual void updateCoeffs();
|
||||
|
||||
//- Write
|
||||
virtual void write(Ostream&) const;
|
||||
//- Write
|
||||
virtual void write(Ostream&) const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -25,7 +25,21 @@ Class
|
||||
Foam::uniformFixedValueFvPatchField
|
||||
|
||||
Description
|
||||
Foam::uniformFixedValueFvPatchField
|
||||
Enables the specification of a uniform fixed value boundary condition.
|
||||
|
||||
Example of the boundary condition specification:
|
||||
\verbatim
|
||||
inlet
|
||||
{
|
||||
type uniformFixedValue;
|
||||
uniformValue constant 0.2;
|
||||
}
|
||||
\endverbatim
|
||||
|
||||
The uniformValue entry is a DataEntry type, able to describe time
|
||||
varying functions. The example above gives the usage for supplying a
|
||||
constant value.
|
||||
|
||||
|
||||
SourceFiles
|
||||
uniformFixedValueFvPatchField.C
|
||||
|
||||
@ -693,7 +693,7 @@ Foam::label Foam::AMIInterpolation<SourcePatch, TargetPatch>::findTargetFace
|
||||
const pointField& srcPts = srcPatch.points();
|
||||
const face& srcFace = srcPatch[srcFaceI];
|
||||
const point& srcPt = srcFace.centre(srcPts);
|
||||
const scalar srcFaceArea = srcFace.mag(srcPts);
|
||||
const scalar srcFaceArea = srcMagSf_[srcFaceI];
|
||||
|
||||
// pointIndexHit sample = treePtr_->findNearest(srcPt, sqr(0.1*bb.mag()));
|
||||
pointIndexHit sample = treePtr_->findNearest(srcPt, 10.0*srcFaceArea);
|
||||
@ -889,21 +889,22 @@ Foam::scalar Foam::AMIInterpolation<SourcePatch, TargetPatch>::interArea
|
||||
const primitivePatch& tgtPatch
|
||||
) const
|
||||
{
|
||||
const pointField& srcPoints = srcPatch.points();
|
||||
const pointField& tgtPoints = tgtPatch.points();
|
||||
|
||||
const face& src = srcPatch[srcFaceI];
|
||||
const face& tgt = tgtPatch[tgtFaceI];
|
||||
|
||||
// quick reject if either face has zero area
|
||||
if ((src.mag(srcPoints) < ROOTVSMALL) || (tgt.mag(tgtPoints) < ROOTVSMALL))
|
||||
if (srcMagSf_[srcFaceI] < ROOTVSMALL || tgtMagSf_[tgtFaceI] < ROOTVSMALL)
|
||||
{
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
const pointField& srcPoints = srcPatch.points();
|
||||
const pointField& tgtPoints = tgtPatch.points();
|
||||
|
||||
// create intersection object
|
||||
faceAreaIntersect inter(srcPoints, tgtPoints, reverseTarget_);
|
||||
|
||||
// references to candidate faces
|
||||
const face& src = srcPatch[srcFaceI];
|
||||
const face& tgt = tgtPatch[tgtFaceI];
|
||||
|
||||
// crude resultant norm
|
||||
vector n(-src.normal(srcPoints));
|
||||
if (reverseTarget_)
|
||||
@ -1610,11 +1611,11 @@ Foam::AMIInterpolation<SourcePatch, TargetPatch>::AMIInterpolation
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"AMIInterpolation<SourcePatch, TargetPatch>::AMIInterpolation\n"
|
||||
"(\n"
|
||||
" const AMIInterpolation<SourcePatch, TargetPatch>&,\n"
|
||||
" const label,\n"
|
||||
" const labelList&\n"
|
||||
"AMIInterpolation<SourcePatch, TargetPatch>::AMIInterpolation"
|
||||
"("
|
||||
" const AMIInterpolation<SourcePatch, TargetPatch>&, "
|
||||
" const label, "
|
||||
" const labelList&"
|
||||
")"
|
||||
) << "Size mismatch." << nl
|
||||
<< "Source patch size:" << fineAMI.srcAddress().size() << nl
|
||||
@ -1867,7 +1868,12 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::interpolateToTarget
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"AMIInterpolation::interpolateToTarget(const Field<Type>&) const"
|
||||
"AMIInterpolation::interpolateToTarget"
|
||||
"("
|
||||
"const UList<Type>&, "
|
||||
"const CombineOp&, "
|
||||
"List<Type>&"
|
||||
") const"
|
||||
) << "Supplied field size is not equal to source patch size" << nl
|
||||
<< " source patch = " << srcAddress_.size() << nl
|
||||
<< " target patch = " << tgtAddress_.size() << nl
|
||||
@ -1924,7 +1930,12 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::interpolateToSource
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"AMIInterpolation::interpolateToSource(const Field<Type>) const"
|
||||
"AMIInterpolation::interpolateToSource"
|
||||
"("
|
||||
"const UList<Type>&, "
|
||||
"const CombineOp&, "
|
||||
"List<Type>&"
|
||||
") const"
|
||||
) << "Supplied field size is not equal to target patch size" << nl
|
||||
<< " source patch = " << srcAddress_.size() << nl
|
||||
<< " target patch = " << tgtAddress_.size() << nl
|
||||
|
||||
@ -148,20 +148,7 @@ Foam::autoPtr<Foam::liquidProperties> Foam::liquidProperties::New(Istream& is)
|
||||
}
|
||||
else if (coeffs == "coeffs")
|
||||
{
|
||||
IstreamConstructorTable::iterator cstrIter =
|
||||
IstreamConstructorTablePtr_->find(liquidPropertiesType);
|
||||
|
||||
if (cstrIter == IstreamConstructorTablePtr_->end())
|
||||
{
|
||||
FatalErrorIn("liquidProperties::New(Istream&)")
|
||||
<< "Unknown liquidProperties type "
|
||||
<< liquidPropertiesType << nl << nl
|
||||
<< "Valid liquidProperties types are:" << nl
|
||||
<< IstreamConstructorTablePtr_->sortedToc()
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
return autoPtr<liquidProperties>(cstrIter()(is));
|
||||
return autoPtr<liquidProperties>(new liquidProperties(is));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -212,24 +199,12 @@ Foam::autoPtr<Foam::liquidProperties> Foam::liquidProperties::New
|
||||
}
|
||||
else
|
||||
{
|
||||
dictionaryConstructorTable::iterator cstrIter =
|
||||
dictionaryConstructorTablePtr_->find(liquidPropertiesTypeName);
|
||||
|
||||
if (cstrIter == dictionaryConstructorTablePtr_->end())
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"liquidProperties::New(const dictionary&, const word&)"
|
||||
) << "Unknown liquidProperties type "
|
||||
<< liquidPropertiesTypeName << nl << nl
|
||||
<< "Valid liquidProperties types are:" << nl
|
||||
<< dictionaryConstructorTablePtr_->sortedToc()
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
return autoPtr<liquidProperties>
|
||||
(
|
||||
cstrIter()(dict.subDict(liquidPropertiesTypeName + "Coeffs"))
|
||||
new liquidProperties
|
||||
(
|
||||
dict.subDict(liquidPropertiesTypeName + "Coeffs")
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user