mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Added pointFile initialPointsMethod. Lots of tweaks and setting up.
This commit is contained in:
@ -1,184 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: 1.5 |
|
||||
| \\ / A nd | Web: http://www.openfoam.org |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
|
||||
root "";
|
||||
case "";
|
||||
instance "";
|
||||
local "";
|
||||
|
||||
class dictionary;
|
||||
object cvMeshDict;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
geometry
|
||||
{
|
||||
channelWalls
|
||||
{
|
||||
type searchableBox;
|
||||
min (-1 -1 -1);
|
||||
max ( 2 2 2);
|
||||
}
|
||||
|
||||
dm_baffle.obj
|
||||
{
|
||||
type triSurfaceMesh;
|
||||
}
|
||||
|
||||
dangermouse.obj
|
||||
{
|
||||
type triSurfaceMesh;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
motionControl
|
||||
{
|
||||
defaultCellSize 0.06;
|
||||
|
||||
// Assign a priority to all requests for cell sizes, the highest overrules.
|
||||
defaultPriority 0;
|
||||
|
||||
cellSizeControlGeometry
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
relaxationModel linear;
|
||||
|
||||
linearCoeffs
|
||||
{
|
||||
relaxationStart 0.8;
|
||||
relaxationEnd 0.0;
|
||||
}
|
||||
|
||||
alignmentSearchSpokes 36;
|
||||
|
||||
alignmentAcceptanceAngle 48;
|
||||
|
||||
targetCellSizeCoeff 1.0;
|
||||
|
||||
pointInsertionCriteria
|
||||
{
|
||||
cellCentreDistCoeff 1.75;
|
||||
faceAreaRatioCoeff 0.0025;
|
||||
alignmentAcceptanceAngle 21.5;
|
||||
}
|
||||
|
||||
pointRemovalCriteria
|
||||
{
|
||||
cellCentreDistCoeff 0.65;
|
||||
}
|
||||
|
||||
faceAreaWeightModel piecewiseLinearRamp;
|
||||
|
||||
piecewiseLinearRampCoeffs
|
||||
{
|
||||
lowerWeight 0;
|
||||
lowerAreaFraction 0.707;
|
||||
upperWeight 1;
|
||||
upperAreaFraction 1.0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
surfaceConformation
|
||||
{
|
||||
locationInMesh (0.1 0.1 0.2);
|
||||
|
||||
// A faction of the local target cell size
|
||||
pointPairDistanceCoeff 0.05;
|
||||
|
||||
maxQuadAngle 125;
|
||||
|
||||
geometryToConformTo
|
||||
{
|
||||
// Independently specify the featureMethod of individual parts of the
|
||||
// geometry. Allows some parts to calculate their own features
|
||||
// (including analytical surfaces), others to be read from file.
|
||||
// Optional, if ommited, assume no features.
|
||||
|
||||
channelWalls
|
||||
{
|
||||
featureMethod extractFeatures;
|
||||
|
||||
extractFeaturesDetails
|
||||
{
|
||||
// Included angle used to identify the surface's own feature
|
||||
// edges. 0 = no features, 180 = all features
|
||||
featureAngle 145;
|
||||
}
|
||||
}
|
||||
|
||||
dm_baffle.obj
|
||||
{
|
||||
// Allows surfaces to be use to generate baffles, default to no.
|
||||
baffleSurface yes;
|
||||
|
||||
featureMethod featureEdgeMesh;
|
||||
|
||||
featureEdgeMeshDetails
|
||||
{
|
||||
featureEdgeMesh "LOCATION OF FEATUREEDGEMESH"
|
||||
}
|
||||
}
|
||||
|
||||
dangermouse.obj
|
||||
{
|
||||
// Setting treatAsClosed true ignores whether or not the surface is
|
||||
// closed when asked to determine the volumeType of a point (whether
|
||||
// it is inside or outside). Intended to allow imperfect surface
|
||||
// files to be meshed. Only valid for triSurfaceMesh types, default
|
||||
// to false.
|
||||
treatAsClosed true;
|
||||
|
||||
featureMethod triSurfaceFeatureSet;
|
||||
|
||||
trisurfacefeatureSetDetails
|
||||
{
|
||||
featureSet #include "$FOAM_CASE/constant/triSurface/dangermouse.fSet"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
initialPoints
|
||||
{
|
||||
minimumSurfaceDistance 0.0075;
|
||||
|
||||
initialPointsMethod uniformGrid;
|
||||
//initialPointsMethod pointsFile;
|
||||
|
||||
uniformGridDetails
|
||||
{
|
||||
initialCellSize 0.005;
|
||||
randomiseInitialGrid yes;
|
||||
randomPerturbationCoeff 0.1;
|
||||
}
|
||||
|
||||
pointsFileDetails
|
||||
{
|
||||
pointsFile "$FOAM_CASE/40/internalDelaunayVertices"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
polyMeshFiltering
|
||||
{
|
||||
// A fraction of the local target cell size
|
||||
minimumEdgeLengthCoeff 0.2;
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -4,7 +4,10 @@ conformalVoronoiMesh/conformalVoronoiMesh.C
|
||||
|
||||
cvControls/cvControls.C
|
||||
|
||||
cvSearchableSurfaces/cvSearchableSurfaces.C
|
||||
|
||||
initialPointsMethod/initialPointsMethod/initialPointsMethod.C
|
||||
initialPointsMethod/uniformGrid/uniformGrid.C
|
||||
initialPointsMethod/pointFile/pointFile.C
|
||||
|
||||
LIB = $(FOAM_LIBBIN)/libconformalVoronoiMesh
|
||||
|
||||
@ -39,6 +39,7 @@ Foam::conformalVoronoiMesh::conformalVoronoiMesh
|
||||
:
|
||||
HTriangulation(),
|
||||
runTime_(runTime),
|
||||
cvSurfaces_(*this, cvMeshDict.subDict("geometry")),
|
||||
cvMeshControls_(*this, cvMeshDict),
|
||||
startOfInternalPoints_(0),
|
||||
startOfSurfacePointPairs_(0),
|
||||
@ -51,7 +52,15 @@ Foam::conformalVoronoiMesh::conformalVoronoiMesh
|
||||
)
|
||||
)
|
||||
{
|
||||
timeCheck();
|
||||
|
||||
insertFeaturePoints();
|
||||
|
||||
timeCheck();
|
||||
|
||||
insertInitialPoints();
|
||||
|
||||
timeCheck();
|
||||
}
|
||||
|
||||
|
||||
@ -63,14 +72,34 @@ Foam::conformalVoronoiMesh::~conformalVoronoiMesh()
|
||||
|
||||
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
||||
|
||||
void Foam::conformalVoronoiMesh::timeCheck() const
|
||||
{
|
||||
Info<< nl << "--- [ " << runTime_.elapsedCpuTime() << "s ] --- " << endl;
|
||||
}
|
||||
|
||||
|
||||
void Foam::conformalVoronoiMesh::insertFeaturePoints()
|
||||
{
|
||||
Info<< nl << "Inserting feature points" << endl;
|
||||
|
||||
Info<< " Conforming to " << "XXX" << " feature locations" << nl
|
||||
<< " Inserting " << "YYY" << " points" << endl;
|
||||
}
|
||||
|
||||
|
||||
void Foam::conformalVoronoiMesh::reinsertFeaturePoints()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
void Foam::conformalVoronoiMesh::insertInitialPoints()
|
||||
{
|
||||
startOfInternalPoints_ = number_of_vertices();
|
||||
|
||||
label nVert = startOfInternalPoints_;
|
||||
|
||||
Info<< nl << "Inserting initial points" << nl
|
||||
<< " " << nVert << " existing points" << endl;
|
||||
Info<< nl << "Inserting initial points" << endl;
|
||||
|
||||
std::vector<Point> initialPoints = initialPointsMethod_->initialPoints();
|
||||
|
||||
|
||||
@ -42,10 +42,9 @@ SourceFiles
|
||||
|
||||
#include "CGALTriangulation3Ddefs.H"
|
||||
|
||||
#include "cvSearchableSurfaces.H"
|
||||
#include "cvControls.H"
|
||||
#include "pointIOField.H"
|
||||
#include "DynamicList.H"
|
||||
#include "Switch.H"
|
||||
#include "Time.H"
|
||||
#include "polyMesh.H"
|
||||
#include "triSurfaceTools.H"
|
||||
@ -74,6 +73,9 @@ class conformalVoronoiMesh
|
||||
//- The time registry of the application
|
||||
const Time& runTime_;
|
||||
|
||||
//- The surfaces to conform to and to use for refinement
|
||||
cvSearchableSurfaces cvSurfaces_;
|
||||
|
||||
//- Controls for the conformal Voronoi meshing process
|
||||
cvControls cvMeshControls_;
|
||||
|
||||
@ -98,6 +100,9 @@ class conformalVoronoiMesh
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const conformalVoronoiMesh&);
|
||||
|
||||
//- Write the elapsedCpuTime
|
||||
void timeCheck() const;
|
||||
|
||||
//- Insert point and return it's index
|
||||
inline label insertPoint
|
||||
(
|
||||
@ -162,6 +167,9 @@ public:
|
||||
|
||||
// Access
|
||||
|
||||
//- Return the Time object
|
||||
inline const Time& time() const;
|
||||
|
||||
//- Return the cvMeshControls object
|
||||
inline const cvControls& cvMeshControls() const;
|
||||
|
||||
|
||||
@ -26,31 +26,19 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructors * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||
inline const Foam::Time& Foam::conformalVoronoiMesh::time() const
|
||||
{
|
||||
return runTime_;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Friend Functions * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
|
||||
inline const Foam::cvControls& Foam::conformalVoronoiMesh::cvMeshControls()
|
||||
const
|
||||
{
|
||||
return cvMeshControls_;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -38,7 +38,7 @@ Foam::cvControls::cvControls
|
||||
cvMesh_(cvMesh),
|
||||
cvMeshDict_(cvMeshDict)
|
||||
{
|
||||
Info<< nl << "Reading cvMeshDict" << endl;
|
||||
Info<< nl << "Reading " << cvMeshDict_.name() << endl;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -25,46 +25,33 @@ License
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "cvSearchableSurfaces.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
const dataType Foam::cvSearchableSurfaces::staticData();
|
||||
|
||||
|
||||
// * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
#include "conformalVoronoiMesh.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::cvSearchableSurfaces::cvSearchableSurfaces()
|
||||
Foam::cvSearchableSurfaces::cvSearchableSurfaces
|
||||
(
|
||||
const conformalVoronoiMesh& cvMesh,
|
||||
const dictionary& geometryDict
|
||||
)
|
||||
:
|
||||
baseClassName(),
|
||||
data_()
|
||||
searchableSurfaces
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"cvSearchableSurfacesDirectory",
|
||||
cvMesh.time().constant(),
|
||||
"triSurface",
|
||||
cvMesh.time(),
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
geometryDict
|
||||
),
|
||||
cvMesh_(cvMesh)
|
||||
{}
|
||||
|
||||
|
||||
Foam::cvSearchableSurfaces::cvSearchableSurfaces(const dataType& data)
|
||||
:
|
||||
baseClassName(),
|
||||
data_(data)
|
||||
{}
|
||||
|
||||
|
||||
Foam::cvSearchableSurfaces::cvSearchableSurfaces(const cvSearchableSurfaces&)
|
||||
:
|
||||
baseClassName(),
|
||||
data_()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::autoPtr<Foam::cvSearchableSurfaces> Foam::cvSearchableSurfaces::New()
|
||||
{
|
||||
return autoPtr<cvSearchableSurfaces>(new cvSearchableSurfaces);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::cvSearchableSurfaces::~cvSearchableSurfaces()
|
||||
@ -74,29 +61,39 @@ Foam::cvSearchableSurfaces::~cvSearchableSurfaces()
|
||||
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
||||
|
||||
|
||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::cvSearchableSurfaces::operator=(const cvSearchableSurfaces& rhs)
|
||||
bool Foam::cvSearchableSurfaces::inside(const point& pt) const
|
||||
{
|
||||
// Check for assignment to self
|
||||
if (this == &rhs)
|
||||
{
|
||||
FatalErrorIn("Foam::cvSearchableSurfaces::operator=(const Foam::cvSearchableSurfaces&)")
|
||||
<< "Attempted assignment to self"
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * Friend Functions * * * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::cvSearchableSurfaces::outside(const point& pt) const
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * * //
|
||||
bool Foam::cvSearchableSurfaces::wellInside
|
||||
(
|
||||
const point& pt,
|
||||
const scalar dist2
|
||||
) const
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
bool Foam::cvSearchableSurfaces::wellOutside
|
||||
(
|
||||
const point& pt,
|
||||
const scalar dist2
|
||||
) const
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -27,7 +27,7 @@ Class
|
||||
|
||||
Description
|
||||
The surface geometry to be meshed with a conformalVoronoiMesh, adding
|
||||
inside/outside queries and surfaceFeatures
|
||||
inside/outside queries and features of the surface
|
||||
|
||||
SourceFiles
|
||||
cvSearchableSurfaces.C
|
||||
@ -45,19 +45,21 @@ SourceFiles
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward declaration of classes
|
||||
class conformalVoronoiMesh;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class cvSearchableSurfaces Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class cvSearchableSurfaces
|
||||
:
|
||||
public baseClassName
|
||||
public searchableSurfaces
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Description of data_
|
||||
dataType data_;
|
||||
|
||||
//- Reference to the conformalVoronoiMesh holding this cvControls object
|
||||
const conformalVoronoiMesh& cvMesh_;
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
@ -70,32 +72,14 @@ class cvSearchableSurfaces
|
||||
|
||||
public:
|
||||
|
||||
// Static data members
|
||||
|
||||
//- Static data staticData
|
||||
static const dataType staticData;
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct null
|
||||
cvSearchableSurfaces();
|
||||
|
||||
//- Construct from components
|
||||
cvSearchableSurfaces(const dataType& data);
|
||||
|
||||
//- Construct from Istream
|
||||
cvSearchableSurfaces(Istream&);
|
||||
|
||||
//- Construct as copy
|
||||
cvSearchableSurfaces(const cvSearchableSurfaces&);
|
||||
|
||||
|
||||
// Selectors
|
||||
|
||||
//- Select null constructed
|
||||
static autoPtr<cvSearchableSurfaces> New();
|
||||
|
||||
cvSearchableSurfaces
|
||||
(
|
||||
const conformalVoronoiMesh& cvMesh,
|
||||
const dictionary& geometryDict
|
||||
);
|
||||
|
||||
//- Destructor
|
||||
~cvSearchableSurfaces();
|
||||
@ -105,26 +89,20 @@ public:
|
||||
|
||||
// Access
|
||||
|
||||
// Check
|
||||
// Query
|
||||
|
||||
// Edit
|
||||
//- Check if point is inside surfacesToConformTo
|
||||
bool inside(const point& pt) const;
|
||||
|
||||
// Write
|
||||
//- Check if point is outside surfacesToConformTo
|
||||
bool outside(const point& pt) const;
|
||||
|
||||
//- Check if point is inside surfacesToConformTo by at least dist2
|
||||
bool wellInside(const point& pt, const scalar dist2) const;
|
||||
|
||||
// Member Operators
|
||||
//- Check if point is outside surfacesToConformTo by at least dist2
|
||||
bool wellOutside(const point& pt, const scalar dist2) const;
|
||||
|
||||
void operator=(const cvSearchableSurfaces&);
|
||||
|
||||
|
||||
// Friend Functions
|
||||
|
||||
// Friend Operators
|
||||
|
||||
// IOstream Operators
|
||||
|
||||
friend Istream& operator>>(Istream&, cvSearchableSurfaces&);
|
||||
friend Ostream& operator<<(Ostream&, const cvSearchableSurfaces&);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,59 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
||||
\\/ 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 2 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructors * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Friend Functions * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -49,7 +49,14 @@ initialPointsMethod::initialPointsMethod
|
||||
:
|
||||
dictionary(initialPointsDict),
|
||||
cvMesh_(cvMesh),
|
||||
detailsDict_(subDict(type + "Details"))
|
||||
detailsDict_(subDict(type + "Details")),
|
||||
minimumSurfaceDistance_
|
||||
(
|
||||
readScalar
|
||||
(
|
||||
initialPointsDict.lookup("minimumSurfaceDistance")
|
||||
)
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
|
||||
@ -66,6 +66,10 @@ protected:
|
||||
//- Method details dictionary
|
||||
dictionary detailsDict_;
|
||||
|
||||
//- Only allow the placement of initial points that are within the
|
||||
// surfaces to be meshed by minimumSurfaceDistance
|
||||
scalar minimumSurfaceDistance_;
|
||||
|
||||
private:
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
@ -0,0 +1,97 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
||||
\\/ 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 2 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "pointFile.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
defineTypeNameAndDebug(pointFile, 0);
|
||||
addToRunTimeSelectionTable(initialPointsMethod, pointFile, dictionary);
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
pointFile::pointFile
|
||||
(
|
||||
const dictionary& initialPointsDict,
|
||||
const conformalVoronoiMesh& cvMesh
|
||||
)
|
||||
:
|
||||
initialPointsMethod(typeName, initialPointsDict, cvMesh),
|
||||
pointFileName_(detailsDict().lookup("pointFile"))
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
std::vector<Vb::Point> pointFile::initialPoints() const
|
||||
{
|
||||
pointIOField points
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
pointFileName_.name(),
|
||||
pointFileName_.path(),
|
||||
cvMesh_.time(),
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
);
|
||||
|
||||
std::vector<Vb::Point> initialPoints;
|
||||
|
||||
forAll(points, i)
|
||||
{
|
||||
const point& p = points[i];
|
||||
|
||||
// TODO Check if inside the surface
|
||||
|
||||
initialPoints.push_back(Vb::Point(p.x(), p.y(), p.z()));
|
||||
}
|
||||
|
||||
label nPointsRejected = points.size() - initialPoints.size();
|
||||
|
||||
if (nPointsRejected)
|
||||
{
|
||||
Info<< " " << nPointsRejected << " points rejected from "
|
||||
<< pointFileName_.name() << endl;
|
||||
}
|
||||
|
||||
|
||||
return initialPoints;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,101 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
||||
\\/ 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 2 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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
Foam::pointFile
|
||||
|
||||
Description
|
||||
Inserts points at locations specified in a pointFile into the surfaces to
|
||||
be conformed to of the conformalVoronoiMesh
|
||||
|
||||
SourceFiles
|
||||
pointFile.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef pointFile_H
|
||||
#define pointFile_H
|
||||
|
||||
#include "fileName.H"
|
||||
#include "pointIOField.H"
|
||||
#include "initialPointsMethod.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class pointFile Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class pointFile
|
||||
:
|
||||
public initialPointsMethod
|
||||
{
|
||||
|
||||
private:
|
||||
|
||||
// Private data
|
||||
|
||||
//- The initial cell spacing
|
||||
fileName pointFileName_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("pointFile");
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
pointFile
|
||||
(
|
||||
const dictionary& initialPointsDict,
|
||||
const conformalVoronoiMesh& cvMesh
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~pointFile()
|
||||
{}
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return the initial points for the conformalVoronoiMesh
|
||||
virtual std::vector<Vb::Point> initialPoints() const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -72,7 +72,7 @@ std::vector<Vb::Point> uniformGrid::initialPoints() const
|
||||
// scalar zR = qSurf_.bb().max().z() - z0;
|
||||
// int nk = int(zR/controls_.minCellSize) + 1;
|
||||
|
||||
Info<< "Is this actually uniform? or is it fitting the span with an "
|
||||
Info<< " Is this actually uniform? or is it fitting the span with an "
|
||||
<< "integer number?" << endl;
|
||||
|
||||
scalar x0 = 0.0;
|
||||
|
||||
Reference in New Issue
Block a user