mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: Add automatic feature extraction to foamyHexMesh
This commit is contained in:
@ -0,0 +1,192 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "searchableBoxFeatures.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
#include "treeBoundBox.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
defineTypeNameAndDebug(searchableBoxFeatures, 0);
|
||||||
|
addToRunTimeSelectionTable
|
||||||
|
(
|
||||||
|
searchableSurfaceFeatures,
|
||||||
|
searchableBoxFeatures,
|
||||||
|
dict
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::searchableBoxFeatures::searchableBoxFeatures
|
||||||
|
(
|
||||||
|
const searchableSurface& surface,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
searchableSurfaceFeatures(surface, dict),
|
||||||
|
mode_(extendedFeatureEdgeMesh::sideVolumeTypeNames_[dict.lookup("mode")])
|
||||||
|
{
|
||||||
|
Info<< indent
|
||||||
|
<< " Mesh mode = "
|
||||||
|
<< extendedFeatureEdgeMesh::sideVolumeTypeNames_[mode_]
|
||||||
|
<< endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::searchableBoxFeatures::~searchableBoxFeatures()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::autoPtr<Foam::extendedFeatureEdgeMesh>
|
||||||
|
Foam::searchableBoxFeatures::features() const
|
||||||
|
{
|
||||||
|
autoPtr<extendedFeatureEdgeMesh> features;
|
||||||
|
|
||||||
|
vectorField faceNormals(List<vector>(treeBoundBox::faceNormals));
|
||||||
|
|
||||||
|
vectorField edgeDirections(12);
|
||||||
|
labelListList normalDirections(12);
|
||||||
|
|
||||||
|
labelListList edgeNormals(12);
|
||||||
|
forAll(edgeNormals, eI)
|
||||||
|
{
|
||||||
|
edgeNormals[eI].setSize(2, 0);
|
||||||
|
}
|
||||||
|
edgeNormals[0][0] = 2; edgeNormals[0][1] = 4;
|
||||||
|
edgeNormals[1][0] = 1; edgeNormals[1][1] = 4;
|
||||||
|
edgeNormals[2][0] = 3; edgeNormals[2][1] = 4;
|
||||||
|
edgeNormals[3][0] = 0; edgeNormals[3][1] = 4;
|
||||||
|
edgeNormals[4][0] = 2; edgeNormals[4][1] = 5;
|
||||||
|
edgeNormals[5][0] = 1; edgeNormals[5][1] = 5;
|
||||||
|
edgeNormals[6][0] = 3; edgeNormals[6][1] = 5;
|
||||||
|
edgeNormals[7][0] = 0; edgeNormals[7][1] = 5;
|
||||||
|
edgeNormals[8][0] = 0; edgeNormals[8][1] = 2;
|
||||||
|
edgeNormals[9][0] = 2; edgeNormals[9][1] = 1;
|
||||||
|
edgeNormals[10][0] = 1; edgeNormals[10][1] = 3;
|
||||||
|
edgeNormals[11][0] = 3; edgeNormals[11][1] = 0;
|
||||||
|
|
||||||
|
forAll(edgeDirections, eI)
|
||||||
|
{
|
||||||
|
edgeDirections[eI] =
|
||||||
|
surface().points()()[treeBoundBox::edges[eI].end()]
|
||||||
|
- surface().points()()[treeBoundBox::edges[eI].start()];
|
||||||
|
|
||||||
|
normalDirections[eI] = labelList(2, 0);
|
||||||
|
for (label j = 0; j < 2; ++j)
|
||||||
|
{
|
||||||
|
const vector cross =
|
||||||
|
(faceNormals[edgeNormals[eI][j]] ^ edgeDirections[eI]);
|
||||||
|
const vector fC0tofE0 =
|
||||||
|
0.5*(max(surface().points()() + min(surface().points()())))
|
||||||
|
- surface().points()()[treeBoundBox::edges[eI].start()];
|
||||||
|
|
||||||
|
normalDirections[eI][j] =
|
||||||
|
(
|
||||||
|
(
|
||||||
|
(cross/(mag(cross) + VSMALL))
|
||||||
|
& (fC0tofE0/(mag(fC0tofE0)+ VSMALL))
|
||||||
|
)
|
||||||
|
> 0.0
|
||||||
|
? 1
|
||||||
|
: -1
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
labelListList featurePointNormals(8);
|
||||||
|
labelListList featurePointEdges(8);
|
||||||
|
forAll(featurePointNormals, pI)
|
||||||
|
{
|
||||||
|
labelList& ftPtEdges = featurePointEdges[pI];
|
||||||
|
ftPtEdges.setSize(3, 0);
|
||||||
|
|
||||||
|
label edgeI = 0;
|
||||||
|
forAll(treeBoundBox::edges, eI)
|
||||||
|
{
|
||||||
|
const edge& e = treeBoundBox::edges[eI];
|
||||||
|
|
||||||
|
if (e.start() == pI)
|
||||||
|
{
|
||||||
|
ftPtEdges[edgeI++] = eI;
|
||||||
|
}
|
||||||
|
else if (e.end() == pI)
|
||||||
|
{
|
||||||
|
ftPtEdges[edgeI++] = eI;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
labelList& ftPtNormals = featurePointNormals[pI];
|
||||||
|
ftPtNormals.setSize(3, 0);
|
||||||
|
|
||||||
|
ftPtNormals[0] = edgeNormals[ftPtEdges[0]][0];
|
||||||
|
ftPtNormals[1] = edgeNormals[ftPtEdges[0]][1];
|
||||||
|
ftPtNormals[2] = edgeNormals[ftPtEdges[1]][0];
|
||||||
|
}
|
||||||
|
|
||||||
|
labelList regionEdges;
|
||||||
|
|
||||||
|
features.set
|
||||||
|
(
|
||||||
|
new extendedFeatureEdgeMesh
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
surface().name(),
|
||||||
|
surface().instance(),
|
||||||
|
"extendedFeatureEdgeMesh",
|
||||||
|
surface().db(),
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
surface().points(),
|
||||||
|
treeBoundBox::edges,
|
||||||
|
8, 8, 8,
|
||||||
|
12, 12, 12, 12,
|
||||||
|
faceNormals,
|
||||||
|
PackedList<2>(12, mode_), // Need to be input by user
|
||||||
|
edgeDirections,
|
||||||
|
normalDirections,
|
||||||
|
edgeNormals,
|
||||||
|
featurePointNormals,
|
||||||
|
featurePointEdges,
|
||||||
|
regionEdges
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
return features;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,110 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::searchableBoxFeatures
|
||||||
|
|
||||||
|
Description
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
searchableBoxFeatures.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef searchableBoxFeatures_H
|
||||||
|
#define searchableBoxFeatures_H
|
||||||
|
|
||||||
|
#include "searchableSurfaceFeatures.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class searchableBoxFeatures Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class searchableBoxFeatures
|
||||||
|
:
|
||||||
|
public searchableSurfaceFeatures
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
|
||||||
|
// Private Member Data
|
||||||
|
|
||||||
|
//- Which side of the box to mesh
|
||||||
|
const extendedFeatureEdgeMesh::sideVolumeType mode_;
|
||||||
|
|
||||||
|
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Disallow default bitwise copy construct
|
||||||
|
searchableBoxFeatures(const searchableBoxFeatures&);
|
||||||
|
|
||||||
|
//- Disallow default bitwise assignment
|
||||||
|
void operator=(const searchableBoxFeatures&);
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("searchableBoxFeatures");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from searchable surface and dictionary
|
||||||
|
searchableBoxFeatures
|
||||||
|
(
|
||||||
|
const searchableSurface& surface,
|
||||||
|
const dictionary& dict
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~searchableBoxFeatures();
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
//- Return true for a searchable box having features
|
||||||
|
virtual bool hasFeatures() const
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Return an extendedFeatureEdgeMesh containing the features
|
||||||
|
virtual autoPtr<extendedFeatureEdgeMesh> features() const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,90 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "searchableSurfaceFeatures.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
defineTypeNameAndDebug(searchableSurfaceFeatures, 0);
|
||||||
|
defineRunTimeSelectionTable(searchableSurfaceFeatures, dict);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::autoPtr<Foam::searchableSurfaceFeatures>
|
||||||
|
Foam::searchableSurfaceFeatures::New
|
||||||
|
(
|
||||||
|
const searchableSurface& surface,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
{
|
||||||
|
word searchableSurfaceFeaturesType = surface.type() + "Features";
|
||||||
|
|
||||||
|
dictConstructorTable::iterator cstrIter =
|
||||||
|
dictConstructorTablePtr_->find(searchableSurfaceFeaturesType);
|
||||||
|
|
||||||
|
if (cstrIter == dictConstructorTablePtr_->end())
|
||||||
|
{
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"searchableSurfaceFeatures::New(const word&,"
|
||||||
|
" const searchableSurface&, const dictionary&)"
|
||||||
|
) << "Unknown searchableSurfaceFeatures type "
|
||||||
|
<< searchableSurfaceFeaturesType << endl << endl
|
||||||
|
<< "Valid searchableSurfaceFeatures types : " << endl
|
||||||
|
<< dictConstructorTablePtr_->sortedToc()
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
return autoPtr<searchableSurfaceFeatures>(cstrIter()(surface, dict));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::searchableSurfaceFeatures::searchableSurfaceFeatures
|
||||||
|
(
|
||||||
|
const searchableSurface& surface,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
surface_(surface),
|
||||||
|
dict_(dict)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::searchableSurfaceFeatures::~searchableSurfaceFeatures()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,155 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::searchableSurfaceFeatures
|
||||||
|
|
||||||
|
Description
|
||||||
|
Decorator that returns the features of a searchable surface.
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
searchableSurfaceFeatures.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef searchableSurfaceFeatures_H
|
||||||
|
#define searchableSurfaceFeatures_H
|
||||||
|
|
||||||
|
#include "typeInfo.H"
|
||||||
|
#include "runTimeSelectionTables.H"
|
||||||
|
#include "searchableSurface.H"
|
||||||
|
#include "extendedFeatureEdgeMesh.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class searchableSurfaceFeatures Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class searchableSurfaceFeatures
|
||||||
|
{
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
const searchableSurface& surface_;
|
||||||
|
|
||||||
|
const dictionary& dict_;
|
||||||
|
|
||||||
|
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Disallow default bitwise copy construct
|
||||||
|
searchableSurfaceFeatures(const searchableSurfaceFeatures&);
|
||||||
|
|
||||||
|
//- Disallow default bitwise assignment
|
||||||
|
void operator=(const searchableSurfaceFeatures&);
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("searchableSurfaceFeatures");
|
||||||
|
|
||||||
|
// Declare run-time constructor selection table
|
||||||
|
|
||||||
|
// For the dictionary constructor
|
||||||
|
declareRunTimeSelectionTable
|
||||||
|
(
|
||||||
|
autoPtr,
|
||||||
|
searchableSurfaceFeatures,
|
||||||
|
dict,
|
||||||
|
(
|
||||||
|
const searchableSurface& surface,
|
||||||
|
const dictionary& dict
|
||||||
|
),
|
||||||
|
(surface, dict)
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from components
|
||||||
|
searchableSurfaceFeatures
|
||||||
|
(
|
||||||
|
const searchableSurface& surface,
|
||||||
|
const dictionary& dict
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Clone
|
||||||
|
virtual autoPtr<searchableSurfaceFeatures> clone() const
|
||||||
|
{
|
||||||
|
notImplemented("autoPtr<searchableSurfaceFeatures> clone() const");
|
||||||
|
return autoPtr<searchableSurfaceFeatures>(NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Selectors
|
||||||
|
|
||||||
|
//- Return a reference to the selected searchableSurfaceFeatures
|
||||||
|
static autoPtr<searchableSurfaceFeatures> New
|
||||||
|
(
|
||||||
|
const searchableSurface& surface,
|
||||||
|
const dictionary& dict
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~searchableSurfaceFeatures();
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
//- Return a reference to the searchable surface
|
||||||
|
const searchableSurface& surface() const
|
||||||
|
{
|
||||||
|
return surface_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Return a reference to the dictionary
|
||||||
|
const dictionary& dict() const
|
||||||
|
{
|
||||||
|
return dict_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Return whether this searchable surface has features
|
||||||
|
virtual bool hasFeatures() const = 0;
|
||||||
|
|
||||||
|
//- Return an extendedFeatureEdgeMesh containing the features
|
||||||
|
virtual autoPtr<extendedFeatureEdgeMesh> features() const
|
||||||
|
{
|
||||||
|
return autoPtr<extendedFeatureEdgeMesh>();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,102 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "triSurfaceMeshFeatures.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
#include "triSurfaceMesh.H"
|
||||||
|
#include "surfaceFeatures.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
defineTypeNameAndDebug(triSurfaceMeshFeatures, 0);
|
||||||
|
addToRunTimeSelectionTable
|
||||||
|
(
|
||||||
|
searchableSurfaceFeatures,
|
||||||
|
triSurfaceMeshFeatures,
|
||||||
|
dict
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::triSurfaceMeshFeatures::triSurfaceMeshFeatures
|
||||||
|
(
|
||||||
|
const searchableSurface& surface,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
searchableSurfaceFeatures(surface, dict),
|
||||||
|
includedAngle_(readScalar(dict.lookup("includedAngle")))
|
||||||
|
{
|
||||||
|
Info<< indent
|
||||||
|
<< " Included angle = " << includedAngle_
|
||||||
|
<< endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::triSurfaceMeshFeatures::~triSurfaceMeshFeatures()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::autoPtr<Foam::extendedFeatureEdgeMesh>
|
||||||
|
Foam::triSurfaceMeshFeatures::features() const
|
||||||
|
{
|
||||||
|
autoPtr<extendedFeatureEdgeMesh> features;
|
||||||
|
|
||||||
|
const triSurfaceMesh& surfMesh = refCast<const triSurfaceMesh>(surface());
|
||||||
|
|
||||||
|
surfaceFeatures sFeat(surfMesh, includedAngle_);
|
||||||
|
|
||||||
|
boolList surfBaffleRegions(surfMesh.patches().size(), false);
|
||||||
|
|
||||||
|
features.set
|
||||||
|
(
|
||||||
|
new extendedFeatureEdgeMesh
|
||||||
|
(
|
||||||
|
sFeat,
|
||||||
|
surface().db(),
|
||||||
|
surface().name() + ".extendedFeatureEdgeMesh",
|
||||||
|
surfBaffleRegions
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
return features;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,109 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::triSurfaceMeshFeatures
|
||||||
|
|
||||||
|
Description
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
triSurfaceMeshFeatures.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef triSurfaceMeshFeatures_H
|
||||||
|
#define triSurfaceMeshFeatures_H
|
||||||
|
|
||||||
|
#include "searchableSurfaceFeatures.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class triSurfaceMeshFeatures Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class triSurfaceMeshFeatures
|
||||||
|
:
|
||||||
|
public searchableSurfaceFeatures
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
|
||||||
|
// Private Member Data
|
||||||
|
|
||||||
|
const scalar includedAngle_;
|
||||||
|
|
||||||
|
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Disallow default bitwise copy construct
|
||||||
|
triSurfaceMeshFeatures(const triSurfaceMeshFeatures&);
|
||||||
|
|
||||||
|
//- Disallow default bitwise assignment
|
||||||
|
void operator=(const triSurfaceMeshFeatures&);
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("triSurfaceMeshFeatures");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from dictionary (used by searchableSurface)
|
||||||
|
triSurfaceMeshFeatures
|
||||||
|
(
|
||||||
|
const searchableSurface& surface,
|
||||||
|
const dictionary& dict
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~triSurfaceMeshFeatures();
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
//- Return true for a triSurfaceMesh having features
|
||||||
|
virtual bool hasFeatures() const
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Return an extendedFeatureEdgeMesh containing the features
|
||||||
|
virtual autoPtr<extendedFeatureEdgeMesh> features() const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
124
etc/caseDicts/foamyHexMeshDict
Normal file
124
etc/caseDicts/foamyHexMeshDict
Normal file
@ -0,0 +1,124 @@
|
|||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
| ========= | |
|
||||||
|
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||||
|
| \\ / O peration | Version: dev |
|
||||||
|
| \\ / A nd | Web: www.OpenFOAM.org |
|
||||||
|
| \\/ M anipulation | |
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#inputMode merge;
|
||||||
|
|
||||||
|
surfaceConformation
|
||||||
|
{
|
||||||
|
locationInMesh (0 0 0);
|
||||||
|
pointPairDistanceCoeff 0.1;
|
||||||
|
mixedFeaturePointPPDistanceCoeff 5.0;
|
||||||
|
featurePointExclusionDistanceCoeff 0.65;
|
||||||
|
featureEdgeExclusionDistanceCoeff 0.65;
|
||||||
|
surfaceSearchDistanceCoeff 5;
|
||||||
|
maxSurfaceProtrusionCoeff 0.1;
|
||||||
|
maxQuadAngle 125;
|
||||||
|
surfaceConformationRebuildFrequency 10;
|
||||||
|
specialiseFeaturePoints on;
|
||||||
|
|
||||||
|
conformationControls
|
||||||
|
{
|
||||||
|
edgeSearchDistCoeff 5;
|
||||||
|
surfacePtReplaceDistCoeff 0.5;
|
||||||
|
surfacePtExclusionDistanceCoeff 0.5;
|
||||||
|
maxIterations 15;
|
||||||
|
iterationToInitialHitRatioLimit 0.001;
|
||||||
|
}
|
||||||
|
|
||||||
|
additionalFeatures
|
||||||
|
{}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
initialPoints
|
||||||
|
{
|
||||||
|
minimumSurfaceDistanceCoeff 0.55;
|
||||||
|
fixInitialPoints false;
|
||||||
|
|
||||||
|
initialPointsMethod autoDensity;
|
||||||
|
autoDensityCoeffs
|
||||||
|
{
|
||||||
|
minLevels 4;
|
||||||
|
maxSizeRatio 5.0;
|
||||||
|
sampleResolution 5;
|
||||||
|
surfaceSampleResolution 5;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
motionControl
|
||||||
|
{
|
||||||
|
maxSmoothingIterations 100;
|
||||||
|
|
||||||
|
cellAspectRatioControl
|
||||||
|
{
|
||||||
|
aspectRatio 1.0;
|
||||||
|
aspectRatioDirection (1 0 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
relaxationModel adaptiveLinear;
|
||||||
|
adaptiveLinearCoeffs
|
||||||
|
{
|
||||||
|
relaxationStart 1.0;
|
||||||
|
relaxationEnd 0.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
objOutput no;
|
||||||
|
timeChecks no;
|
||||||
|
|
||||||
|
maxLoadUnbalance 0.2;
|
||||||
|
|
||||||
|
alignmentAcceptanceAngle 48;
|
||||||
|
|
||||||
|
pointInsertionCriteria
|
||||||
|
{
|
||||||
|
cellCentreDistCoeff 1.75;
|
||||||
|
faceAreaRatioCoeff 0.0025;
|
||||||
|
acceptanceAngle 21.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
pointRemovalCriteria
|
||||||
|
{
|
||||||
|
cellCentreDistCoeff 0.65;
|
||||||
|
}
|
||||||
|
|
||||||
|
faceAreaWeightModel piecewiseLinearRamp;
|
||||||
|
piecewiseLinearRampCoeffs
|
||||||
|
{
|
||||||
|
lowerAreaFraction 0.5;
|
||||||
|
upperAreaFraction 1.0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
polyMeshFiltering
|
||||||
|
{
|
||||||
|
filterEdges on;
|
||||||
|
filterFaces off;
|
||||||
|
writeTetDualMesh false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
meshQualityControls
|
||||||
|
{
|
||||||
|
maxNonOrtho 65;
|
||||||
|
maxBoundarySkewness 50;
|
||||||
|
maxInternalSkewness 10;
|
||||||
|
maxConcave 80;
|
||||||
|
minVol -1E30;
|
||||||
|
minTetQuality 1e-30;
|
||||||
|
minArea -1;
|
||||||
|
minTwist 0.02;
|
||||||
|
minDeterminant 0.001;
|
||||||
|
minFaceWeight 0.02;
|
||||||
|
minVolRatio 0.01;
|
||||||
|
minTriangleTwist -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -47,8 +47,8 @@ surfaceConformation
|
|||||||
{
|
{
|
||||||
flange
|
flange
|
||||||
{
|
{
|
||||||
featureMethod extendedFeatureEdgeMesh;
|
featureMethod extractFeatures;
|
||||||
extendedFeatureEdgeMesh "flange.extendedFeatureEdgeMesh";
|
includedAngle 140;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,38 +0,0 @@
|
|||||||
/*--------------------------------*- C++ -*----------------------------------*\
|
|
||||||
| ========= | |
|
|
||||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
|
||||||
| \\ / O peration | Version: dev |
|
|
||||||
| \\ / A nd | Web: www.OpenFOAM.org |
|
|
||||||
| \\/ M anipulation | |
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
FoamFile
|
|
||||||
{
|
|
||||||
version 2.0;
|
|
||||||
format ascii;
|
|
||||||
class dictionary;
|
|
||||||
object surfaceFeatureExtractDict;
|
|
||||||
}
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
flange.obj
|
|
||||||
{
|
|
||||||
extractionMethod extractFromSurface;
|
|
||||||
|
|
||||||
extractFromSurfaceCoeffs
|
|
||||||
{
|
|
||||||
// Mark edges whose adjacent surface normals are at an angle less
|
|
||||||
// than includedAngle as features
|
|
||||||
// - 0 : selects no edges
|
|
||||||
// - 180: selects all edges
|
|
||||||
includedAngle 100;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Write options
|
|
||||||
|
|
||||||
// Write features to obj format for postprocessing
|
|
||||||
writeObj yes;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -35,7 +35,7 @@ runApplication surfaceFeatureExtract
|
|||||||
|
|
||||||
# Generate aligned points (in constant/internalDelaunayVertices) and a
|
# Generate aligned points (in constant/internalDelaunayVertices) and a
|
||||||
# mesh from that.
|
# mesh from that.
|
||||||
runApplication cvMesh
|
runApplication foamyHexMesh
|
||||||
|
|
||||||
# Generate some sets for a bit of mesh inspection
|
# Generate some sets for a bit of mesh inspection
|
||||||
runApplication topoSet -time 0:100
|
runApplication topoSet -time 0:100
|
||||||
|
|||||||
@ -1,368 +0,0 @@
|
|||||||
/*--------------------------------*- C++ -*----------------------------------*\
|
|
||||||
| ========= | |
|
|
||||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
|
||||||
| \\ / O peration | Version: dev |
|
|
||||||
| \\ / A nd | Web: www.OpenFOAM.org |
|
|
||||||
| \\/ M anipulation | |
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
FoamFile
|
|
||||||
{
|
|
||||||
version 2.0;
|
|
||||||
format ascii;
|
|
||||||
class dictionary;
|
|
||||||
object cvMeshDict;
|
|
||||||
}
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
Control dictionary for cvMesh - polyhedral mesh generator.
|
|
||||||
|
|
||||||
cvMesh phases:
|
|
||||||
1. fill volume with initial points (initialPoints subdictionary). An option
|
|
||||||
is to reread from previous set of points.
|
|
||||||
|
|
||||||
2. internal point motion (motionControl subdictionary)
|
|
||||||
|
|
||||||
3. every once in a while add point duplets/triplets to conform to
|
|
||||||
surfaces and features (surfaceConformation subdictionary)
|
|
||||||
|
|
||||||
4. back to 2
|
|
||||||
|
|
||||||
5. construct polyMesh.
|
|
||||||
- filter (polyMeshFiltering subdictionary)
|
|
||||||
- check (meshQualityControls subdictionary) and undo filtering
|
|
||||||
|
|
||||||
|
|
||||||
See also cvControls.H in the conformalVoronoiMesh library
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
// Important:
|
|
||||||
// ----------
|
|
||||||
// Any scalar with a name <name>Coeff specifies a value that will be implemented
|
|
||||||
// as a faction of the target cell size
|
|
||||||
// Any scalar with a name <name>Size specifies an absolute size.
|
|
||||||
|
|
||||||
|
|
||||||
// Geometry. Definition of all surfaces. All surfaces are of class
|
|
||||||
// searchableSurface.
|
|
||||||
// Surfaces need to be (almost) closed - use closedTriSurfaceMesh
|
|
||||||
// if they are not topologically closed. Surfaces need to be oriented so
|
|
||||||
// the space to be meshed is always on the inside of all surfaces. Use e.g.
|
|
||||||
// surfaceOrient.
|
|
||||||
geometry
|
|
||||||
{
|
|
||||||
// Internal shape
|
|
||||||
coneAndSphere_clean_orient.obj
|
|
||||||
{
|
|
||||||
name coneAndSphere;
|
|
||||||
type triSurfaceMesh;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Outside of domain
|
|
||||||
domain_clean_orient.stl
|
|
||||||
{
|
|
||||||
name domain;
|
|
||||||
type triSurfaceMesh;
|
|
||||||
regions
|
|
||||||
{
|
|
||||||
ascii{ name domain_patch0; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Controls for conforming to the surfaces.
|
|
||||||
surfaceConformation
|
|
||||||
{
|
|
||||||
// A point inside surfaces that is inside mesh.
|
|
||||||
locationInMesh (0 -0.5 0);
|
|
||||||
|
|
||||||
// How far apart are point-duplets generated. Balance this between
|
|
||||||
// - very low distance: little chance of interference from other
|
|
||||||
// surfaces
|
|
||||||
// - largish distance: less non-orthogonality in final cell
|
|
||||||
// (circumcentre far away from centroid)
|
|
||||||
pointPairDistanceCoeff 0.1;
|
|
||||||
|
|
||||||
// Mixed feature edges - both inside and outside edges. Recreated
|
|
||||||
// by inserting triplets of points to recreate a single edge. Done for
|
|
||||||
// all edges emanating from point. triplets of points get inserted
|
|
||||||
// mixedFeaturePointPPDistanceCoeff distance away from feature point.
|
|
||||||
mixedFeaturePointPPDistanceCoeff 5.0;
|
|
||||||
|
|
||||||
// Distance to a feature point within which surface and edge
|
|
||||||
// conformation points are excluded - fraction of the local target
|
|
||||||
// cell size
|
|
||||||
featurePointExclusionDistanceCoeff 0.6;
|
|
||||||
|
|
||||||
// Distance to an existing feature edge conformation location
|
|
||||||
// within which other edge conformation location are excluded -
|
|
||||||
// fraction of the local target cell size
|
|
||||||
featureEdgeExclusionDistanceCoeff 0.6;
|
|
||||||
|
|
||||||
// Optimisation: do not check for surface intersection (of dual edges)
|
|
||||||
// for points near to surface.
|
|
||||||
surfaceSearchDistanceCoeff 2.5;
|
|
||||||
|
|
||||||
// Maximum allowable protrusion through the surface before
|
|
||||||
// conformation points are added - fraction of the local target
|
|
||||||
// cell size. These small protusions are (hopefully) done by mesh filtering
|
|
||||||
// instead.
|
|
||||||
maxSurfaceProtrusionCoeff 0.1;
|
|
||||||
|
|
||||||
// If feature edge with large angle (so more than 125 degrees) introduce
|
|
||||||
// additional points to create two half angled cells (= mitering).
|
|
||||||
maxQuadAngle 125;
|
|
||||||
|
|
||||||
// Frequency to redo surface conformation (expensive).
|
|
||||||
surfaceConformationRebuildFrequency 10;
|
|
||||||
|
|
||||||
// Specialised feature point handling
|
|
||||||
specialiseFeaturePoints on;
|
|
||||||
|
|
||||||
// Initial and intermediate controls
|
|
||||||
conformationControls
|
|
||||||
{
|
|
||||||
// We've got a point poking through the surface. Don't do any
|
|
||||||
// surface conformation if near feature edge (since feature edge
|
|
||||||
// conformation should have priority)
|
|
||||||
|
|
||||||
// distance to search for near feature edges
|
|
||||||
edgeSearchDistCoeff 2;
|
|
||||||
|
|
||||||
// Proximity to a feature edge where a surface hit is
|
|
||||||
// not created, only the edge conformation is created
|
|
||||||
// - fraction of the local target cell size. Coarse
|
|
||||||
// conformation, initial protrusion tests.
|
|
||||||
surfacePtReplaceDistCoeff 0.5;
|
|
||||||
|
|
||||||
|
|
||||||
surfacePtExclusionDistanceCoeff 0.5;
|
|
||||||
|
|
||||||
// Stop either at maxIterations or if the number of surface pokes
|
|
||||||
// is very small (iterationToInitialHitRatioLimit * initial number)
|
|
||||||
// Note: perhaps iterationToInitialHitRatioLimit should be absolute
|
|
||||||
// count?
|
|
||||||
maxIterations 15;
|
|
||||||
|
|
||||||
iterationToInitialHitRatioLimit 0.001;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Geometry to mesh to
|
|
||||||
geometryToConformTo
|
|
||||||
{
|
|
||||||
coneAndSphere
|
|
||||||
{
|
|
||||||
featureMethod extendedFeatureEdgeMesh;
|
|
||||||
extendedFeatureEdgeMesh "coneAndSphere_clean_orient.extendedFeatureEdgeMesh";
|
|
||||||
}
|
|
||||||
|
|
||||||
domain
|
|
||||||
{
|
|
||||||
featureMethod extendedFeatureEdgeMesh;
|
|
||||||
extendedFeatureEdgeMesh "domain_clean_orient.extendedFeatureEdgeMesh";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
additionalFeatures
|
|
||||||
{}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Controls for seeding initial points and general control of the target
|
|
||||||
// cell size (used everywhere)
|
|
||||||
initialPoints
|
|
||||||
{
|
|
||||||
// Do not place point closer than minimumSurfaceDistanceCoeff
|
|
||||||
// to the surface. Is fraction of local target cell size (see below)
|
|
||||||
minimumSurfaceDistanceCoeff 0.55;
|
|
||||||
|
|
||||||
initialPointsMethod autoDensity;
|
|
||||||
// initialPointsMethod uniformGrid;
|
|
||||||
// initialPointsMethod bodyCentredCubic;
|
|
||||||
// initialPointsMethod pointFile;
|
|
||||||
|
|
||||||
// Take boundbox of all geometry. Samples with this box. If too much
|
|
||||||
// samples (due to target cell size) in box split box.
|
|
||||||
autoDensityCoeffs
|
|
||||||
{
|
|
||||||
minCellSizeLimit 0.1;
|
|
||||||
// Initial number of refinement levels. Needs to be enough to pick
|
|
||||||
// up features due to size ratio. If not enough it will take longer
|
|
||||||
// to determine point seeding.
|
|
||||||
minLevels 4;
|
|
||||||
// Split box if ratio of min to max cell size larger than maxSizeRatio
|
|
||||||
maxSizeRatio 5.0;
|
|
||||||
// Per box sample 3x3x3 internally
|
|
||||||
sampleResolution 3;
|
|
||||||
// Additionally per face of the box sample 3
|
|
||||||
surfaceSampleResolution 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
uniformGridCoeffs
|
|
||||||
{
|
|
||||||
// Absolute cell size.
|
|
||||||
initialCellSize 0.0015;
|
|
||||||
randomiseInitialGrid yes;
|
|
||||||
randomPerturbationCoeff 0.02;
|
|
||||||
}
|
|
||||||
|
|
||||||
bodyCentredCubicCoeffs
|
|
||||||
{
|
|
||||||
initialCellSize 0.0015;
|
|
||||||
randomiseInitialGrid no;
|
|
||||||
randomPerturbationCoeff 0.1;
|
|
||||||
}
|
|
||||||
|
|
||||||
pointFileCoeffs
|
|
||||||
{
|
|
||||||
// Reads points from file. Still rejects points that are too
|
|
||||||
// close to the surface (minimumSurfaceDistanceCoeff) or on the
|
|
||||||
// wrong side of the surfaces.
|
|
||||||
pointFile "constant/internalDelaunayVertices";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Control size of voronoi cells i.e. distance between points. This
|
|
||||||
// determines the target cell size which is used everywhere.
|
|
||||||
// It determines the cell size given a location. It then uses all
|
|
||||||
// the rules
|
|
||||||
// - defaultCellSize
|
|
||||||
// - cellSizeControlGeometry
|
|
||||||
// to determine target cell size. Rule with highest priority wins. If same
|
|
||||||
// priority smallest cell size wins.
|
|
||||||
motionControl
|
|
||||||
{
|
|
||||||
// Absolute cell size of back ground mesh. This is the maximum cell size.
|
|
||||||
defaultCellSize 0.1;
|
|
||||||
|
|
||||||
minimumCellSizeCoeff 0;
|
|
||||||
|
|
||||||
// For background cell size and alignment grid
|
|
||||||
maxSmoothingIterations 100;
|
|
||||||
|
|
||||||
maxRefinementIterations 0;
|
|
||||||
|
|
||||||
shapeControlFunctions
|
|
||||||
{
|
|
||||||
coneAndSphere
|
|
||||||
{
|
|
||||||
type searchableSurfaceControl;
|
|
||||||
priority 1;
|
|
||||||
mode bothSides;
|
|
||||||
|
|
||||||
surfaceCellSizeFunction uniformValue;
|
|
||||||
uniformValueCoeffs
|
|
||||||
{
|
|
||||||
surfaceCellSizeCoeff 0.75;
|
|
||||||
}
|
|
||||||
|
|
||||||
cellSizeFunction uniform;
|
|
||||||
uniformCoeffs
|
|
||||||
{}
|
|
||||||
}
|
|
||||||
|
|
||||||
domain
|
|
||||||
{
|
|
||||||
type searchableSurfaceControl;
|
|
||||||
priority 1;
|
|
||||||
mode bothSides;
|
|
||||||
|
|
||||||
surfaceCellSizeFunction uniformValue;
|
|
||||||
uniformValueCoeffs
|
|
||||||
{
|
|
||||||
surfaceCellSizeCoeff 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
cellSizeFunction uniform;
|
|
||||||
uniformCoeffs
|
|
||||||
{}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
cellAspectRatioControl
|
|
||||||
{
|
|
||||||
aspectRatio 1.0;
|
|
||||||
aspectRatioDirection (0 0 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Underrelaxation for point motion. Simulated annealing: starts off at 1
|
|
||||||
// and lowers to 0 (at simulation endTime) to converge points.
|
|
||||||
// adaptiveLinear is preferred choice.
|
|
||||||
// Points move by e.g. 10% of tet size.
|
|
||||||
relaxationModel adaptiveLinear; //rampHoldFall
|
|
||||||
|
|
||||||
adaptiveLinearCoeffs
|
|
||||||
{
|
|
||||||
relaxationStart 1.0;
|
|
||||||
relaxationEnd 0.0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Output lots and lots of .obj files
|
|
||||||
objOutput no;
|
|
||||||
|
|
||||||
// Timing and memory usage.
|
|
||||||
timeChecks no;
|
|
||||||
|
|
||||||
// For each delaunay edge (between two vertices, becomes
|
|
||||||
// the Voronoi face normal) snap to the alignment direction if within
|
|
||||||
// alignmentAcceptanceAngle. Slightly > 45 is a good choice - prevents
|
|
||||||
// flipping.
|
|
||||||
alignmentAcceptanceAngle 48;
|
|
||||||
|
|
||||||
// When to insert points. Not advisable change to
|
|
||||||
// these settings.
|
|
||||||
pointInsertionCriteria
|
|
||||||
{
|
|
||||||
// If edge larger than 1.75 target cell size
|
|
||||||
// (so tets too large/stretched) insert point
|
|
||||||
cellCentreDistCoeff 1.75;
|
|
||||||
// Do not insert point if voronoi face (on edge) very small.
|
|
||||||
faceAreaRatioCoeff 0.0025;
|
|
||||||
// Insert point only if edge closely aligned to local alignment
|
|
||||||
// direction.
|
|
||||||
acceptanceAngle 21.5;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Opposite: remove point if mesh too compressed. Do not change these
|
|
||||||
// settings.
|
|
||||||
pointRemovalCriteria
|
|
||||||
{
|
|
||||||
cellCentreDistCoeff 0.65;
|
|
||||||
}
|
|
||||||
|
|
||||||
// How to determine the point motion. All edges got some direction.
|
|
||||||
// Sum all edge contributions to determine point motion. Weigh by
|
|
||||||
// face area so motion is preferentially determined by large faces
|
|
||||||
// (or more importantly ignore contribution from small faces).
|
|
||||||
// Do not change these settings.
|
|
||||||
faceAreaWeightModel piecewiseLinearRamp;
|
|
||||||
|
|
||||||
piecewiseLinearRampCoeffs
|
|
||||||
{
|
|
||||||
lowerAreaFraction 0.5;
|
|
||||||
upperAreaFraction 1.0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// After simulation, when converting to polyMesh, filter out small faces/edges.
|
|
||||||
// Do not change. See cvControls.H
|
|
||||||
polyMeshFiltering
|
|
||||||
{
|
|
||||||
filterEdges on;
|
|
||||||
filterFaces on;
|
|
||||||
writeTetDualMesh false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#include "meshQualityDict";
|
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
203
tutorials/mesh/foamyHexMesh/simpleShapes/system/foamyHexMeshDict
Normal file
203
tutorials/mesh/foamyHexMesh/simpleShapes/system/foamyHexMeshDict
Normal file
@ -0,0 +1,203 @@
|
|||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
| ========= | |
|
||||||
|
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||||
|
| \\ / O peration | Version: dev |
|
||||||
|
| \\ / A nd | Web: www.OpenFOAM.org |
|
||||||
|
| \\/ M anipulation | |
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
FoamFile
|
||||||
|
{
|
||||||
|
version 2.0;
|
||||||
|
format ascii;
|
||||||
|
class dictionary;
|
||||||
|
object foamyHexMeshDict;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
// Include defaults parameters from master dictionary
|
||||||
|
#include "$WM_PROJECT_DIR/etc/caseDicts/foamyHexMeshDict"
|
||||||
|
|
||||||
|
geometry
|
||||||
|
{
|
||||||
|
// Internal shape
|
||||||
|
coneAndSphere_clean_orient.obj
|
||||||
|
{
|
||||||
|
name coneAndSphere;
|
||||||
|
type triSurfaceMesh;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Outside of domain
|
||||||
|
domain_clean_orient.stl
|
||||||
|
{
|
||||||
|
name domain;
|
||||||
|
type triSurfaceMesh;
|
||||||
|
regions
|
||||||
|
{
|
||||||
|
ascii{ name domain_patch0; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Controls for conforming to the surfaces.
|
||||||
|
surfaceConformation
|
||||||
|
{
|
||||||
|
// A point inside surfaces that is inside mesh.
|
||||||
|
locationInMesh (0 -0.5 0);
|
||||||
|
|
||||||
|
// Geometry to mesh to
|
||||||
|
geometryToConformTo
|
||||||
|
{
|
||||||
|
coneAndSphere
|
||||||
|
{
|
||||||
|
featureMethod extractFeatures;
|
||||||
|
includedAngle 140;
|
||||||
|
featureMethod extendedFeatureEdgeMesh;
|
||||||
|
extendedFeatureEdgeMesh "coneAndSphere_clean_orient.extendedFeatureEdgeMesh";
|
||||||
|
}
|
||||||
|
|
||||||
|
domain
|
||||||
|
{
|
||||||
|
featureMethod extractFeatures;
|
||||||
|
includedAngle 125;
|
||||||
|
featureMethod extendedFeatureEdgeMesh;
|
||||||
|
extendedFeatureEdgeMesh "domain_clean_orient.extendedFeatureEdgeMesh";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
additionalFeatures
|
||||||
|
{}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Controls for seeding initial points and general control of the target
|
||||||
|
// cell size (used everywhere)
|
||||||
|
initialPoints
|
||||||
|
{
|
||||||
|
initialPointsMethod autoDensity;
|
||||||
|
// initialPointsMethod uniformGrid;
|
||||||
|
// initialPointsMethod bodyCentredCubic;
|
||||||
|
// initialPointsMethod pointFile;
|
||||||
|
|
||||||
|
// Take boundbox of all geometry. Samples with this box. If too much
|
||||||
|
// samples (due to target cell size) in box split box.
|
||||||
|
autoDensityCoeffs
|
||||||
|
{
|
||||||
|
minCellSizeLimit 0.1;
|
||||||
|
// Initial number of refinement levels. Needs to be enough to pick
|
||||||
|
// up features due to size ratio. If not enough it will take longer
|
||||||
|
// to determine point seeding.
|
||||||
|
minLevels 4;
|
||||||
|
// Split box if ratio of min to max cell size larger than maxSizeRatio
|
||||||
|
maxSizeRatio 5.0;
|
||||||
|
// Per box sample 3x3x3 internally
|
||||||
|
sampleResolution 3;
|
||||||
|
// Additionally per face of the box sample 3
|
||||||
|
surfaceSampleResolution 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
uniformGridCoeffs
|
||||||
|
{
|
||||||
|
// Absolute cell size.
|
||||||
|
initialCellSize 0.0015;
|
||||||
|
randomiseInitialGrid yes;
|
||||||
|
randomPerturbationCoeff 0.02;
|
||||||
|
}
|
||||||
|
|
||||||
|
bodyCentredCubicCoeffs
|
||||||
|
{
|
||||||
|
initialCellSize 0.0015;
|
||||||
|
randomiseInitialGrid no;
|
||||||
|
randomPerturbationCoeff 0.1;
|
||||||
|
}
|
||||||
|
|
||||||
|
pointFileCoeffs
|
||||||
|
{
|
||||||
|
// Reads points from file. Still rejects points that are too
|
||||||
|
// close to the surface (minimumSurfaceDistanceCoeff) or on the
|
||||||
|
// wrong side of the surfaces.
|
||||||
|
pointFile "constant/internalDelaunayVertices";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Control size of voronoi cells i.e. distance between points. This
|
||||||
|
// determines the target cell size which is used everywhere.
|
||||||
|
// It determines the cell size given a location. It then uses all
|
||||||
|
// the rules
|
||||||
|
// - defaultCellSize
|
||||||
|
// - cellSizeControlGeometry
|
||||||
|
// to determine target cell size. Rule with highest priority wins. If same
|
||||||
|
// priority smallest cell size wins.
|
||||||
|
motionControl
|
||||||
|
{
|
||||||
|
// Absolute cell size of back ground mesh. This is the maximum cell size.
|
||||||
|
defaultCellSize 0.1;
|
||||||
|
|
||||||
|
minimumCellSizeCoeff 0;
|
||||||
|
|
||||||
|
// For background cell size and alignment grid
|
||||||
|
maxSmoothingIterations 100;
|
||||||
|
|
||||||
|
maxRefinementIterations 0;
|
||||||
|
|
||||||
|
shapeControlFunctions
|
||||||
|
{
|
||||||
|
coneAndSphere
|
||||||
|
{
|
||||||
|
type searchableSurfaceControl;
|
||||||
|
priority 1;
|
||||||
|
mode bothSides;
|
||||||
|
|
||||||
|
surfaceCellSizeFunction uniformValue;
|
||||||
|
uniformValueCoeffs
|
||||||
|
{
|
||||||
|
surfaceCellSizeCoeff 0.75;
|
||||||
|
}
|
||||||
|
|
||||||
|
cellSizeFunction uniform;
|
||||||
|
uniformCoeffs
|
||||||
|
{}
|
||||||
|
}
|
||||||
|
|
||||||
|
domain
|
||||||
|
{
|
||||||
|
type searchableSurfaceControl;
|
||||||
|
priority 1;
|
||||||
|
mode bothSides;
|
||||||
|
|
||||||
|
surfaceCellSizeFunction uniformValue;
|
||||||
|
uniformValueCoeffs
|
||||||
|
{
|
||||||
|
surfaceCellSizeCoeff 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
cellSizeFunction uniform;
|
||||||
|
uniformCoeffs
|
||||||
|
{}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Output lots and lots of .obj files
|
||||||
|
objOutput no;
|
||||||
|
|
||||||
|
// Timing and memory usage.
|
||||||
|
timeChecks no;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// After simulation, when converting to polyMesh, filter out small faces/edges.
|
||||||
|
// Do not change. See cvControls.H
|
||||||
|
polyMeshFiltering
|
||||||
|
{
|
||||||
|
filterEdges on;
|
||||||
|
filterFaces on;
|
||||||
|
writeTetDualMesh false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#include "meshQualityDict";
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
Reference in New Issue
Block a user