mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: Update cellShapeControl to work with 2D mesher and remove dependency on the Triangulation
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -174,12 +174,7 @@ Foam::tmp<Foam::triadField> buildAlignmentField(const T& mesh)
|
||||
continue;
|
||||
}
|
||||
|
||||
alignments[vit->index()] = triad
|
||||
(
|
||||
vit->alignment().x(),
|
||||
vit->alignment().y(),
|
||||
vit->alignment().z()
|
||||
);
|
||||
alignments[vit->index()] = vit->alignment();
|
||||
}
|
||||
|
||||
return tAlignments;
|
||||
@ -214,6 +209,61 @@ Foam::tmp<Foam::pointField> buildPointField(const T& mesh)
|
||||
}
|
||||
|
||||
|
||||
void refine
|
||||
(
|
||||
cellShapeControlMesh& mesh,
|
||||
const conformationSurfaces& geometryToConformTo,
|
||||
const label maxRefinementIterations,
|
||||
const scalar defaultCellSize
|
||||
)
|
||||
{
|
||||
for (label iter = 0; iter < maxRefinementIterations; ++iter)
|
||||
{
|
||||
DynamicList<point> ptsToInsert;
|
||||
|
||||
for
|
||||
(
|
||||
CellSizeDelaunay::Finite_cells_iterator cit =
|
||||
mesh.finite_cells_begin();
|
||||
cit != mesh.finite_cells_end();
|
||||
++cit
|
||||
)
|
||||
{
|
||||
const point newPoint =
|
||||
topoint
|
||||
(
|
||||
CGAL::centroid
|
||||
(
|
||||
cit->vertex(0)->point(),
|
||||
cit->vertex(1)->point(),
|
||||
cit->vertex(2)->point(),
|
||||
cit->vertex(3)->point()
|
||||
)
|
||||
);
|
||||
|
||||
if (geometryToConformTo.inside(newPoint))
|
||||
{
|
||||
ptsToInsert.append(newPoint);
|
||||
}
|
||||
}
|
||||
|
||||
Info<< " Adding " << returnReduce(ptsToInsert.size(), sumOp<label>())
|
||||
<< endl;
|
||||
|
||||
forAll(ptsToInsert, ptI)
|
||||
{
|
||||
mesh.insert
|
||||
(
|
||||
ptsToInsert[ptI],
|
||||
defaultCellSize,
|
||||
triad::unset,
|
||||
Vb::vtInternal
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
#include "setRootCase.H"
|
||||
@ -221,10 +271,10 @@ int main(int argc, char *argv[])
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
label maxRefinementIterations = 0;
|
||||
label maxRefinementIterations = 2;
|
||||
label maxSmoothingIterations = 200;
|
||||
scalar minResidual = 0;
|
||||
scalar defaultCellSize = 0.0004;
|
||||
scalar defaultCellSize = 0.001;
|
||||
scalar nearFeatDistSqrCoeff = 1e-8;
|
||||
|
||||
|
||||
@ -305,7 +355,7 @@ int main(int argc, char *argv[])
|
||||
Info<< nl << "Inserting points from surface " << surface.name()
|
||||
<< " (" << surface.type() << ")" << endl;
|
||||
|
||||
const tmp<pointField> tpoints = surface.points();
|
||||
const tmp<pointField> tpoints(surface.points());
|
||||
const pointField& points = tpoints();
|
||||
|
||||
Info<< " Number of points = " << points.size() << endl;
|
||||
@ -396,7 +446,8 @@ int main(int argc, char *argv[])
|
||||
(
|
||||
points[pI],
|
||||
defaultCellSize,
|
||||
pointAlignment()
|
||||
pointAlignment(),
|
||||
Vb::vtInternalNearBoundary
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -406,56 +457,22 @@ int main(int argc, char *argv[])
|
||||
(
|
||||
points[pI],
|
||||
defaultCellSize,
|
||||
pointAlignment()
|
||||
pointAlignment(),
|
||||
Vb::vtInternalNearBoundary
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (label iter = 0; iter < maxRefinementIterations; ++iter)
|
||||
{
|
||||
DynamicList<point> ptsToInsert;
|
||||
|
||||
for
|
||||
(
|
||||
CellSizeDelaunay::Finite_cells_iterator cit =
|
||||
mesh.finite_cells_begin();
|
||||
cit != mesh.finite_cells_end();
|
||||
++cit
|
||||
)
|
||||
{
|
||||
const point newPoint =
|
||||
topoint
|
||||
(
|
||||
CGAL::centroid
|
||||
(
|
||||
cit->vertex(0)->point(),
|
||||
cit->vertex(1)->point(),
|
||||
cit->vertex(2)->point(),
|
||||
cit->vertex(3)->point()
|
||||
)
|
||||
);
|
||||
|
||||
if (geometryToConformTo.inside(newPoint))
|
||||
{
|
||||
ptsToInsert.append(newPoint);
|
||||
}
|
||||
}
|
||||
|
||||
Info<< " Adding " << returnReduce(ptsToInsert.size(), sumOp<label>())
|
||||
<< endl;
|
||||
|
||||
forAll(ptsToInsert, ptI)
|
||||
{
|
||||
mesh.insert
|
||||
(
|
||||
ptsToInsert[ptI],
|
||||
defaultCellSize,
|
||||
triad::unset
|
||||
);
|
||||
}
|
||||
}
|
||||
// Refine the mesh
|
||||
refine
|
||||
(
|
||||
mesh,
|
||||
geometryToConformTo,
|
||||
maxRefinementIterations,
|
||||
defaultCellSize
|
||||
);
|
||||
|
||||
|
||||
if (Pstream::parRun())
|
||||
@ -463,9 +480,11 @@ int main(int argc, char *argv[])
|
||||
mesh.distribute(bMesh);
|
||||
}
|
||||
|
||||
|
||||
labelListList pointPoints;
|
||||
autoPtr<mapDistribute> meshDistributor = buildMap(mesh, pointPoints);
|
||||
|
||||
|
||||
triadField alignments(buildAlignmentField(mesh));
|
||||
pointField points(buildPointField(mesh));
|
||||
|
||||
@ -483,20 +502,12 @@ int main(int argc, char *argv[])
|
||||
++vit
|
||||
)
|
||||
{
|
||||
if (vit->real())
|
||||
if (vit->nearBoundary())
|
||||
{
|
||||
const tensor& alignment = vit->alignment();
|
||||
|
||||
fixedAlignments[vit->index()] = triad
|
||||
(
|
||||
alignment.x(),
|
||||
alignment.y(),
|
||||
alignment.z()
|
||||
);
|
||||
fixedAlignments[vit->index()] = vit->alignment();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Info<< nl << "Smoothing alignments" << endl;
|
||||
|
||||
for (label iter = 0; iter < maxSmoothingIterations; iter++)
|
||||
@ -522,13 +533,16 @@ int main(int argc, char *argv[])
|
||||
const triad& oldTriad = alignments[pI];
|
||||
triad& newTriad = triadAv[pI];
|
||||
|
||||
// Enforce the boundary conditions
|
||||
const triad& fixedAlignment = fixedAlignments[pI];
|
||||
|
||||
forAll(pPoints, adjPointI)
|
||||
{
|
||||
const label adjPointIndex = pPoints[adjPointI];
|
||||
|
||||
scalar dist = mag(points[pI] - points[adjPointIndex]);
|
||||
|
||||
dist = max(dist, SMALL);
|
||||
// dist = max(dist, SMALL);
|
||||
|
||||
triad tmpTriad = alignments[adjPointIndex];
|
||||
|
||||
@ -545,16 +559,13 @@ int main(int argc, char *argv[])
|
||||
|
||||
newTriad.normalize();
|
||||
newTriad.orthogonalize();
|
||||
newTriad = newTriad.sortxyz();
|
||||
|
||||
// Enforce the boundary conditions
|
||||
const triad& fixedAlignment = fixedAlignments[pI];
|
||||
// newTriad = newTriad.sortxyz();
|
||||
|
||||
label nFixed = 0;
|
||||
|
||||
forAll(fixedAlignment, dirI)
|
||||
{
|
||||
if (fixedAlignment[dirI] != triad::unset[dirI])
|
||||
if (fixedAlignment.set(dirI))
|
||||
{
|
||||
nFixed++;
|
||||
}
|
||||
@ -597,26 +608,20 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
if (newTriad.set(vector::X) && oldTriad.set(vector::X))
|
||||
for (direction dir = 0; dir < 3; ++dir)
|
||||
{
|
||||
scalar dotProd = (oldTriad.x() & newTriad.x());
|
||||
if
|
||||
(
|
||||
newTriad.set(dir)
|
||||
&& oldTriad.set(dir)
|
||||
//&& !fixedAlignment.set(dir)
|
||||
)
|
||||
{
|
||||
scalar dotProd = (oldTriad[dir] & newTriad[dir]);
|
||||
scalar diff = mag(dotProd) - 1.0;
|
||||
|
||||
scalar diff = mag(dotProd) - 1.0;
|
||||
residual += mag(diff);
|
||||
}
|
||||
if (newTriad.set(vector::Y) && oldTriad.set(vector::Y))
|
||||
{
|
||||
scalar dotProd = (oldTriad.y() & newTriad.y());
|
||||
|
||||
scalar diff = mag(dotProd) - 1.0;
|
||||
residual += mag(diff);
|
||||
}
|
||||
if (newTriad.set(vector::Z) && oldTriad.set(vector::Z))
|
||||
{
|
||||
scalar dotProd = (oldTriad.z() & newTriad.z());
|
||||
|
||||
scalar diff = mag(dotProd) - 1.0;
|
||||
residual += mag(diff);
|
||||
residual += mag(diff);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -26,10 +26,10 @@ License
|
||||
#include "cellShapeControl.H"
|
||||
#include "pointField.H"
|
||||
#include "scalarField.H"
|
||||
#include "triadField.H"
|
||||
#include "cellSizeAndAlignmentControl.H"
|
||||
#include "searchableSurfaceControl.H"
|
||||
#include "cellSizeFunction.H"
|
||||
#include "triad.H"
|
||||
|
||||
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
||||
|
||||
@ -200,12 +200,7 @@ Foam::tmp<Foam::triadField> Foam::cellShapeControl::buildAlignmentField
|
||||
continue;
|
||||
}
|
||||
|
||||
alignments[vit->index()] = triad
|
||||
(
|
||||
vit->alignment().x(),
|
||||
vit->alignment().y(),
|
||||
vit->alignment().z()
|
||||
);
|
||||
alignments[vit->index()] = vit->alignment();
|
||||
}
|
||||
|
||||
return tAlignments;
|
||||
@ -259,13 +254,15 @@ Foam::cellShapeControl::cellShapeControl
|
||||
allGeometry_(allGeometry),
|
||||
geometryToConformTo_(geometryToConformTo),
|
||||
defaultCellSize_(readScalar(lookup("defaultCellSize"))),
|
||||
minimumCellSize_(readScalar(lookup("minimumCellSize"))),
|
||||
shapeControlMesh_(runTime),
|
||||
aspectRatio_(motionDict),
|
||||
sizeAndAlignment_
|
||||
(
|
||||
runTime,
|
||||
motionDict.subDict("shapeControlFunctions"),
|
||||
geometryToConformTo
|
||||
geometryToConformTo,
|
||||
defaultCellSize_
|
||||
)
|
||||
{}
|
||||
|
||||
@ -489,30 +486,29 @@ void Foam::cellShapeControl::cellSizeAndAlignment
|
||||
}
|
||||
else
|
||||
{
|
||||
triad tri;
|
||||
// triad tri;
|
||||
|
||||
forAll(bary, pI)
|
||||
{
|
||||
size += bary[pI]*ch->vertex(pI)->targetCellSize();
|
||||
|
||||
triad triTmp2
|
||||
(
|
||||
ch->vertex(pI)->alignment().x(),
|
||||
ch->vertex(pI)->alignment().y(),
|
||||
ch->vertex(pI)->alignment().z()
|
||||
);
|
||||
|
||||
tri += triTmp2*bary[pI];
|
||||
// triad triTmp2 = ch->vertex(pI)->alignment();
|
||||
// tri += triTmp2*bary[pI];
|
||||
}
|
||||
|
||||
tri.normalize();
|
||||
tri.orthogonalize();
|
||||
tri = tri.sortxyz();
|
||||
// tri.normalize();
|
||||
// tri.orthogonalize();
|
||||
// tri = tri.sortxyz();
|
||||
//
|
||||
// alignment = tri;
|
||||
|
||||
alignment = tensor
|
||||
(
|
||||
tri.x(), tri.y(), tri.z()
|
||||
);
|
||||
cellShapeControlMesh::Vertex_handle nearV =
|
||||
shapeControlMesh_.nearest_vertex
|
||||
(
|
||||
toPoint<cellShapeControlMesh::Point>(pt)
|
||||
);
|
||||
|
||||
alignment = nearV->alignment();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -545,36 +541,59 @@ void Foam::cellShapeControl::initialMeshPopulation
|
||||
Info<< "Inserting points from " << controlFunction.name()
|
||||
<< " (" << controlFunction.type() << ")" << endl;
|
||||
|
||||
pointField pts(1);
|
||||
scalarField sizes(1);
|
||||
Field<triad> alignments(1);
|
||||
pointField pts;
|
||||
scalarField sizes;
|
||||
triadField alignments;
|
||||
|
||||
controlFunction.initialVertices(pts, sizes, alignments);
|
||||
|
||||
label nRejected = 0;
|
||||
List<Vb> vertices(pts.size());
|
||||
|
||||
forAll(pts, pI)
|
||||
// Clip the minimum size
|
||||
forAll(vertices, vI)
|
||||
{
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
if (!decomposition().positionOnThisProcessor(pts[pI]))
|
||||
{
|
||||
nRejected++;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
shapeControlMesh_.insert
|
||||
(
|
||||
pts[pI],
|
||||
sizes[pI],
|
||||
alignments[pI]
|
||||
);
|
||||
vertices[vI] = Vb(pts[vI], Vb::vtInternal);
|
||||
vertices[vI].targetCellSize() = max(sizes[vI], minimumCellSize_);
|
||||
vertices[vI].alignment() = alignments[vI];
|
||||
}
|
||||
|
||||
pts.clear();
|
||||
sizes.clear();
|
||||
alignments.clear();
|
||||
|
||||
label nRejected = 0;
|
||||
|
||||
PackedBoolList keepVertex(vertices.size(), true);
|
||||
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
forAll(vertices, vI)
|
||||
{
|
||||
const bool onProc = decomposition().positionOnThisProcessor
|
||||
(
|
||||
topoint(vertices[vI].point())
|
||||
);
|
||||
|
||||
if (!onProc)
|
||||
{
|
||||
keepVertex[vI] = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
inplaceSubset(keepVertex, vertices);
|
||||
|
||||
const label preInsertedSize = shapeControlMesh_.number_of_vertices();
|
||||
|
||||
shapeControlMesh_.rangeInsertWithInfo(vertices.begin(), vertices.end());
|
||||
|
||||
Info<< " Inserted "
|
||||
<< returnReduce(pts.size() - nRejected, sumOp<label>())
|
||||
<< "/" << pts.size()
|
||||
<< returnReduce
|
||||
(
|
||||
shapeControlMesh_.number_of_vertices()
|
||||
- preInsertedSize, sumOp<label>()
|
||||
)
|
||||
<< "/" << vertices.size()
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
@ -662,7 +681,7 @@ Foam::label Foam::cellShapeControl::refineMesh
|
||||
if
|
||||
(
|
||||
lastCellSize < GREAT
|
||||
&& mag(interpolatedSize - lastCellSize)/lastCellSize > 0.2
|
||||
//&& mag(interpolatedSize - lastCellSize)/lastCellSize > 0.2
|
||||
)
|
||||
{
|
||||
if (Pstream::parRun())
|
||||
@ -694,7 +713,7 @@ Foam::label Foam::cellShapeControl::refineMesh
|
||||
|
||||
void Foam::cellShapeControl::smoothMesh()
|
||||
{
|
||||
label maxSmoothingIterations = 200;
|
||||
label maxSmoothingIterations = readLabel(lookup("maxSmoothingIterations"));
|
||||
scalar minResidual = 0;
|
||||
|
||||
labelListList pointPoints;
|
||||
@ -719,9 +738,7 @@ void Foam::cellShapeControl::smoothMesh()
|
||||
{
|
||||
if (vit->real())
|
||||
{
|
||||
const tensor& alignment = vit->alignment();
|
||||
|
||||
fixedAlignments[vit->index()] = alignment;
|
||||
fixedAlignments[vit->index()] = vit->alignment();
|
||||
}
|
||||
}
|
||||
|
||||
@ -755,8 +772,6 @@ void Foam::cellShapeControl::smoothMesh()
|
||||
|
||||
scalar dist = mag(points[pI] - points[adjPointIndex]);
|
||||
|
||||
dist = max(dist, SMALL);
|
||||
|
||||
triad tmpTriad = alignments[adjPointIndex];
|
||||
|
||||
for (direction dir = 0; dir < 3; dir++)
|
||||
@ -781,7 +796,7 @@ void Foam::cellShapeControl::smoothMesh()
|
||||
|
||||
forAll(fixedAlignment, dirI)
|
||||
{
|
||||
if (fixedAlignment[dirI] != triad::unset[dirI])
|
||||
if (fixedAlignment.set(dirI))
|
||||
{
|
||||
nFixed++;
|
||||
}
|
||||
@ -826,27 +841,32 @@ void Foam::cellShapeControl::smoothMesh()
|
||||
|
||||
const triad& oldTriad = alignments[pI];
|
||||
|
||||
if (newTriad.set(vector::X) && oldTriad.set(vector::X))
|
||||
for (direction dir = 0; dir < 3; ++dir)
|
||||
{
|
||||
scalar dotProd = (oldTriad.x() & newTriad.x());
|
||||
if
|
||||
(
|
||||
newTriad.set(dir)
|
||||
&& oldTriad.set(dir)
|
||||
//&& !fixedAlignment.set(dir)
|
||||
)
|
||||
{
|
||||
scalar dotProd = (oldTriad[dir] & newTriad[dir]);
|
||||
scalar diff = mag(dotProd) - 1.0;
|
||||
|
||||
scalar diff = mag(dotProd) - 1.0;
|
||||
residual += mag(diff);
|
||||
residual += mag(diff);
|
||||
}
|
||||
}
|
||||
if (newTriad.set(vector::Y) && oldTriad.set(vector::Y))
|
||||
{
|
||||
scalar dotProd = (oldTriad.y() & newTriad.y());
|
||||
|
||||
scalar diff = mag(dotProd) - 1.0;
|
||||
residual += mag(diff);
|
||||
}
|
||||
if (newTriad.set(vector::Z) && oldTriad.set(vector::Z))
|
||||
{
|
||||
scalar dotProd = (oldTriad.z() & newTriad.z());
|
||||
|
||||
scalar diff = mag(dotProd) - 1.0;
|
||||
residual += mag(diff);
|
||||
}
|
||||
// if (iter == 198 || iter == 199)
|
||||
// {
|
||||
// Info<< "Triad" << nl
|
||||
// << " Fixed (" << nFixed << ") = " << fixedAlignment
|
||||
// << nl
|
||||
// << " Old = " << oldTriad << nl
|
||||
// << " Pre-Align= " << triadAv[pI] << nl
|
||||
// << " New = " << newTriad << nl
|
||||
// << " Residual = " << residual << endl;
|
||||
// }
|
||||
}
|
||||
|
||||
forAll(alignments, pI)
|
||||
@ -858,7 +878,7 @@ void Foam::cellShapeControl::smoothMesh()
|
||||
|
||||
Info<< ", Residual = " << residual << endl;
|
||||
|
||||
if (residual <= minResidual)
|
||||
if (iter > 0 && residual <= minResidual)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -41,7 +41,6 @@ SourceFiles
|
||||
#include "point.H"
|
||||
#include "primitiveFieldsFwd.H"
|
||||
#include "pointFieldFwd.H"
|
||||
#include "triadField.H"
|
||||
#include "Time.H"
|
||||
#include "searchableSurfaces.H"
|
||||
#include "conformationSurfaces.H"
|
||||
@ -74,6 +73,8 @@ class cellShapeControl
|
||||
|
||||
const scalar defaultCellSize_;
|
||||
|
||||
const scalar minimumCellSize_;
|
||||
|
||||
cellShapeControlMesh shapeControlMesh_;
|
||||
|
||||
cellAspectRatioControl aspectRatio_;
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -52,8 +52,7 @@ Foam::cellSizeAndAlignmentControl::cellSizeAndAlignmentControl
|
||||
)
|
||||
:
|
||||
runTime_(runTime),
|
||||
name_(name),
|
||||
priority_(readLabel(controlFunctionDict.lookup("priority")))
|
||||
name_(name)
|
||||
{}
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -39,7 +39,7 @@ SourceFiles
|
||||
#include "conformationSurfaces.H"
|
||||
#include "Time.H"
|
||||
#include "quaternion.H"
|
||||
#include "triad.H"
|
||||
#include "triadField.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -64,9 +64,6 @@ private:
|
||||
|
||||
const word name_;
|
||||
|
||||
//- Priority of this cellSizeFunction
|
||||
label priority_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
@ -138,10 +135,7 @@ public:
|
||||
return name_;
|
||||
}
|
||||
|
||||
inline label priority() const
|
||||
{
|
||||
return priority_;
|
||||
}
|
||||
virtual label priority() const = 0;
|
||||
|
||||
|
||||
// Query
|
||||
@ -150,7 +144,7 @@ public:
|
||||
(
|
||||
pointField& pts,
|
||||
scalarField& sizes,
|
||||
Field<triad>& alignments
|
||||
triadField& alignments
|
||||
) const = 0;
|
||||
};
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -24,6 +24,91 @@ License
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "cellSizeAndAlignmentControls.H"
|
||||
#include "searchableSurfaceControl.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
defineTypeNameAndDebug(cellSizeAndAlignmentControls, 0);
|
||||
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::cellSizeAndAlignmentControls::evalCellSizeFunctions
|
||||
(
|
||||
const point& pt,
|
||||
scalar& minSize
|
||||
) const
|
||||
{
|
||||
bool anyFunctionFound = false;
|
||||
|
||||
// Regions requesting with the same priority take the smallest
|
||||
|
||||
if (controlFunctions_.size())
|
||||
{
|
||||
// Maintain priority of current hit. Initialise so it always goes
|
||||
// through at least once.
|
||||
label previousPriority = -1;
|
||||
|
||||
forAll(controlFunctions_, i)
|
||||
{
|
||||
const cellSizeAndAlignmentControl& cSF = controlFunctions_[i];
|
||||
|
||||
if (isA<searchableSurfaceControl>(cSF))
|
||||
{
|
||||
const searchableSurfaceControl& sSC =
|
||||
refCast<const searchableSurfaceControl>(cSF);
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Info<< "size function "
|
||||
<< sSC.name()
|
||||
<< " priority " << sSC.priority()
|
||||
<< endl;
|
||||
}
|
||||
|
||||
if (sSC.priority() < previousPriority)
|
||||
{
|
||||
return minSize;
|
||||
}
|
||||
|
||||
scalar sizeI;
|
||||
|
||||
if (sSC.sizeFunction().cellSize(pt, sizeI))
|
||||
{
|
||||
anyFunctionFound = true;
|
||||
|
||||
if (sSC.priority() == previousPriority)
|
||||
{
|
||||
if (sizeI < minSize)
|
||||
{
|
||||
minSize = sizeI;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
minSize = sizeI;
|
||||
}
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Info<< "sizeI " << sizeI
|
||||
<<" minSize " << minSize << endl;
|
||||
}
|
||||
|
||||
previousPriority = sSC.priority();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return anyFunctionFound;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
@ -31,12 +116,14 @@ Foam::cellSizeAndAlignmentControls::cellSizeAndAlignmentControls
|
||||
(
|
||||
const Time& runTime,
|
||||
const dictionary& shapeControlDict,
|
||||
const conformationSurfaces& allGeometry
|
||||
const conformationSurfaces& allGeometry,
|
||||
const scalar defaultCellSize
|
||||
)
|
||||
:
|
||||
shapeControlDict_(shapeControlDict),
|
||||
allGeometry_(allGeometry),
|
||||
controlFunctions_(shapeControlDict_.size())
|
||||
controlFunctions_(shapeControlDict_.size()),
|
||||
defaultCellSize_(defaultCellSize)
|
||||
{
|
||||
label functionI = 0;
|
||||
|
||||
@ -74,5 +161,17 @@ Foam::cellSizeAndAlignmentControls::~cellSizeAndAlignmentControls()
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::scalar Foam::cellSizeAndAlignmentControls::cellSize
|
||||
(
|
||||
const point& pt
|
||||
) const
|
||||
{
|
||||
scalar size = defaultCellSize_;
|
||||
|
||||
evalCellSizeFunctions(pt, size);
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -35,7 +35,6 @@ SourceFiles
|
||||
#define cellSizeAndAlignmentControls_H
|
||||
|
||||
#include "dictionary.H"
|
||||
#include "cellShapeControlMesh.H"
|
||||
#include "cellSizeAndAlignmentControl.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -43,7 +42,6 @@ SourceFiles
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class cellSizeAndAlignmentControls Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
@ -58,9 +56,13 @@ class cellSizeAndAlignmentControls
|
||||
|
||||
PtrList<cellSizeAndAlignmentControl> controlFunctions_;
|
||||
|
||||
const scalar defaultCellSize_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
bool evalCellSizeFunctions(const point& pt, scalar& minSize) const;
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
cellSizeAndAlignmentControls(const cellSizeAndAlignmentControls&);
|
||||
|
||||
@ -70,6 +72,10 @@ class cellSizeAndAlignmentControls
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
ClassName("cellSizeAndAlignmentControls");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from dictionary
|
||||
@ -77,7 +83,8 @@ public:
|
||||
(
|
||||
const Time& runTime,
|
||||
const dictionary& shapeControlDict,
|
||||
const conformationSurfaces& allGeometry
|
||||
const conformationSurfaces& allGeometry,
|
||||
const scalar defaultCellSize
|
||||
);
|
||||
|
||||
|
||||
@ -96,6 +103,8 @@ public:
|
||||
|
||||
|
||||
// Query
|
||||
|
||||
scalar cellSize(const point& pt) const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -70,7 +70,8 @@ Foam::fileControl::fileControl
|
||||
),
|
||||
pointsFile_(controlFunctionDict.lookup("pointsFile")),
|
||||
sizesFile_(controlFunctionDict.lookup("sizesFile")),
|
||||
alignmentsFile_(controlFunctionDict.lookup("alignmentsFile"))
|
||||
alignmentsFile_(controlFunctionDict.lookup("alignmentsFile")),
|
||||
priority_(readLabel(controlFunctionDict.lookup("priority")))
|
||||
{
|
||||
Info<< indent << "Loading from file... " << nl
|
||||
<< indent << " points : " << pointsFile_ << nl
|
||||
@ -160,12 +161,11 @@ Foam::fileControl::~fileControl()
|
||||
// alignment = cellAlignment(pt);
|
||||
//}
|
||||
|
||||
|
||||
void Foam::fileControl::initialVertices
|
||||
(
|
||||
pointField& pts,
|
||||
scalarField& sizes,
|
||||
Field<triad>& alignments
|
||||
triadField& alignments
|
||||
) const
|
||||
{
|
||||
Info<< " Reading points from file : " << pointsFile_ << endl;
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -58,6 +58,8 @@ class fileControl
|
||||
|
||||
const fileName alignmentsFile_;
|
||||
|
||||
label priority_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
@ -117,9 +119,13 @@ public:
|
||||
(
|
||||
pointField& pts,
|
||||
scalarField& sizes,
|
||||
Field<triad>& alignments
|
||||
triadField& alignments
|
||||
) const;
|
||||
|
||||
virtual label priority() const
|
||||
{
|
||||
return priority_;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -168,7 +168,8 @@ Foam::searchableSurfaceControl::searchableSurfaceControl
|
||||
controlFunctionDict,
|
||||
allGeometry
|
||||
),
|
||||
searchableSurface_(allGeometry.geometry()[name]),
|
||||
surfaceName_(controlFunctionDict.lookupOrDefault<word>("surface", name)),
|
||||
searchableSurface_(allGeometry.geometry()[surfaceName_]),
|
||||
allGeometry_(allGeometry),
|
||||
cellSizeFunction_
|
||||
(
|
||||
@ -557,21 +558,17 @@ Foam::searchableSurfaceControl::~searchableSurfaceControl()
|
||||
// alignment = cellAlignment(pt);
|
||||
//}
|
||||
|
||||
|
||||
void Foam::searchableSurfaceControl::initialVertices
|
||||
(
|
||||
pointField& pts,
|
||||
scalarField& sizes,
|
||||
Field<triad>& alignments
|
||||
triadField& alignments
|
||||
) const
|
||||
{
|
||||
pts = searchableSurface_.points();
|
||||
|
||||
const scalar nearFeatDistSqrCoeff = 1e-8;
|
||||
|
||||
sizes.setSize(pts.size());
|
||||
alignments.setSize(pts.size());
|
||||
|
||||
forAll(pts, pI)
|
||||
{
|
||||
// Is the point in the extendedFeatureEdgeMesh? If so get the
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -34,7 +34,6 @@ SourceFiles
|
||||
#ifndef searchableSurfaceControl_H
|
||||
#define searchableSurfaceControl_H
|
||||
|
||||
#include "cellShapeControl.H"
|
||||
#include "cellSizeFunction.H"
|
||||
#include "triad.H"
|
||||
|
||||
@ -54,13 +53,15 @@ class searchableSurfaceControl
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Reference to the searchableSurface object holding the geometry
|
||||
// data
|
||||
const searchableSurface& searchableSurface_;
|
||||
//- Name of the surface
|
||||
const word surfaceName_;
|
||||
|
||||
const conformationSurfaces& allGeometry_;
|
||||
//- Reference to the searchableSurface object holding the geometry data
|
||||
const searchableSurface& searchableSurface_;
|
||||
|
||||
autoPtr<cellSizeFunction> cellSizeFunction_;
|
||||
const conformationSurfaces& allGeometry_;
|
||||
|
||||
autoPtr<cellSizeFunction> cellSizeFunction_;
|
||||
|
||||
|
||||
// const conformationSurfaces& geometryToConformTo_;
|
||||
@ -143,7 +144,7 @@ public:
|
||||
(
|
||||
pointField& pts,
|
||||
scalarField& sizes,
|
||||
Field<triad>& alignments
|
||||
triadField& alignments
|
||||
) const;
|
||||
|
||||
const cellSizeFunction& sizeFunction() const
|
||||
@ -151,6 +152,11 @@ public:
|
||||
return cellSizeFunction_();
|
||||
}
|
||||
|
||||
virtual label priority() const
|
||||
{
|
||||
return cellSizeFunction_().priority();
|
||||
}
|
||||
|
||||
// Edit
|
||||
|
||||
};
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -56,7 +56,8 @@ Foam::cellSizeFunction::cellSizeFunction
|
||||
)
|
||||
),
|
||||
coeffsDict_(subDict(type + "Coeffs")),
|
||||
sideMode_()
|
||||
sideMode_(),
|
||||
priority_(readLabel(cellSizeFunctionDict.lookup("priority")))
|
||||
{
|
||||
word mode = cellSizeFunctionDict.lookup("mode");
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -97,6 +97,8 @@ protected:
|
||||
//- Mode of size specification, i.e. inside, outside or bothSides
|
||||
sideMode sideMode_;
|
||||
|
||||
label priority_;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
@ -180,6 +182,11 @@ public:
|
||||
<< endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
label priority() const
|
||||
{
|
||||
return priority_;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -880,11 +880,24 @@ void Foam::conformalVoronoiMesh::buildCellSizeAndAlignmentMesh()
|
||||
cellSizeMesh.distribute(decomposition_);
|
||||
}
|
||||
|
||||
label nMaxIter = 2;
|
||||
label nMaxIter = readLabel
|
||||
(
|
||||
cvMeshControls().cvMeshDict().subDict("motionControl").lookup
|
||||
(
|
||||
"maxRefinementIterations"
|
||||
)
|
||||
);
|
||||
|
||||
Info<< "Maximum number of refinement iterations : " << nMaxIter << endl;
|
||||
|
||||
for (label i = 0; i < nMaxIter; ++i)
|
||||
{
|
||||
// label nRemoved = cellSizeMesh.removePoints();
|
||||
label nRemoved = 0;
|
||||
reduce(nRemoved, sumOp<label>());
|
||||
|
||||
label nAdded = cellShapeControl_.refineMesh(decomposition_);
|
||||
// label nAdded = 0;
|
||||
reduce(nAdded, sumOp<label>());
|
||||
|
||||
if (Pstream::parRun())
|
||||
@ -892,12 +905,14 @@ void Foam::conformalVoronoiMesh::buildCellSizeAndAlignmentMesh()
|
||||
cellSizeMesh.distribute(decomposition_);
|
||||
}
|
||||
|
||||
if (nAdded == 0)
|
||||
if (nRemoved + nAdded == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
Info<< " Iteration " << i << ": Added = " << nAdded << " points"
|
||||
Info<< " Iteration " << i
|
||||
<< " Added = " << nAdded << " points"
|
||||
<< ", Removed = " << nRemoved << " points"
|
||||
<< endl;
|
||||
}
|
||||
|
||||
@ -906,7 +921,11 @@ void Foam::conformalVoronoiMesh::buildCellSizeAndAlignmentMesh()
|
||||
Info<< "Background cell size and alignment mesh:" << endl;
|
||||
cellSizeMesh.printInfo(Info);
|
||||
|
||||
// cellSizeMesh.write();
|
||||
if (cvMeshControls().objOutput())
|
||||
{
|
||||
cellSizeMesh.writeTriangulation();
|
||||
cellSizeMesh.write();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -345,6 +345,12 @@ private:
|
||||
DynamicList<Vb>& pts
|
||||
);
|
||||
|
||||
inline bool isPointPair
|
||||
(
|
||||
const Vertex_handle& vA,
|
||||
const Vertex_handle& vB
|
||||
) const;
|
||||
|
||||
//- Insert pairs of points on the surface with the given normals, at the
|
||||
// specified spacing
|
||||
void insertSurfacePointPairs
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -2106,7 +2106,7 @@ void Foam::conformalVoronoiMesh::createFacesOwnerNeighbourAndPatches
|
||||
|
||||
// If the two vertices are a pair, then the patch face is
|
||||
// a desired one.
|
||||
if (vA->type() == vB->index())
|
||||
if (!isPointPair(vA, vB))
|
||||
{
|
||||
indirectPatchFace[patchIndex].append(true);
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -27,13 +27,7 @@ License
|
||||
|
||||
inline Foam::scalar Foam::conformalVoronoiMesh::defaultCellSize() const
|
||||
{
|
||||
return readScalar
|
||||
(
|
||||
cvMeshControls().cvMeshDict().subDict("motionControl").lookup
|
||||
(
|
||||
"defaultCellSize"
|
||||
)
|
||||
);
|
||||
return cvMeshControls().defaultCellSize();
|
||||
}
|
||||
|
||||
|
||||
@ -336,12 +330,20 @@ inline void Foam::conformalVoronoiMesh::createPointPair
|
||||
|
||||
pts.append
|
||||
(
|
||||
Vb(surfPt - ppDistn, Vb::vtInternalSurface)
|
||||
Vb
|
||||
(
|
||||
surfPt - ppDistn,
|
||||
Vb::vtInternalSurface
|
||||
)
|
||||
);
|
||||
|
||||
pts.append
|
||||
(
|
||||
Vb(surfPt + ppDistn, Vb::vtExternalSurface)
|
||||
Vb
|
||||
(
|
||||
surfPt + ppDistn,
|
||||
Vb::vtExternalSurface
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@ -388,6 +390,76 @@ inline void Foam::conformalVoronoiMesh::createBafflePointPair
|
||||
}
|
||||
|
||||
|
||||
inline bool Foam::conformalVoronoiMesh::isPointPair
|
||||
(
|
||||
const Vertex_handle& vA,
|
||||
const Vertex_handle& vB
|
||||
) const
|
||||
{
|
||||
// Want to do this topologically, but problem if vertices are redistributed
|
||||
// so that one of the point pair is one processor and the other is on
|
||||
// another.
|
||||
|
||||
const Foam::point& ptA = topoint(vA->point());
|
||||
const Foam::point& ptB = topoint(vB->point());
|
||||
|
||||
if
|
||||
(
|
||||
(
|
||||
vA->type() == Vb::vtInternalSurface
|
||||
&& vB->type() == Vb::vtExternalSurface
|
||||
)
|
||||
||
|
||||
(
|
||||
vB->type() == Vb::vtInternalSurface
|
||||
&& vA->type() == Vb::vtExternalSurface
|
||||
)
|
||||
||
|
||||
(
|
||||
vA->type() == Vb::vtInternalFeatureEdge
|
||||
&& vB->type() == Vb::vtExternalFeatureEdge
|
||||
)
|
||||
||
|
||||
(
|
||||
vB->type() == Vb::vtInternalFeatureEdge
|
||||
&& vA->type() == Vb::vtExternalFeatureEdge
|
||||
)
|
||||
||
|
||||
(
|
||||
vA->type() == Vb::vtInternalSurface
|
||||
&& vB->type() == Vb::vtExternalFeatureEdge
|
||||
)
|
||||
||
|
||||
(
|
||||
vB->type() == Vb::vtInternalSurface
|
||||
&& vA->type() == Vb::vtExternalFeatureEdge
|
||||
)
|
||||
||
|
||||
(
|
||||
vA->type() == Vb::vtExternalSurface
|
||||
&& vB->type() == Vb::vtInternalFeatureEdge
|
||||
)
|
||||
||
|
||||
(
|
||||
vB->type() == Vb::vtExternalSurface
|
||||
&& vA->type() == Vb::vtInternalFeatureEdge
|
||||
)
|
||||
)
|
||||
{
|
||||
const scalar distSqr = magSqr(ptA - ptB);
|
||||
|
||||
const scalar ppDistSqr = sqr(2*pointPairDistance(0.5*(ptA + ptB)));
|
||||
|
||||
if (distSqr > 1.001*ppDistSqr)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
inline bool Foam::conformalVoronoiMesh::isBoundaryDualFace
|
||||
(
|
||||
const Delaunay::Finite_edges_iterator& eit
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -125,6 +125,10 @@ Foam::cvControls::cvControls
|
||||
|
||||
const dictionary& motionDict(cvMeshDict_.subDict("motionControl"));
|
||||
|
||||
defaultCellSize_ = readScalar(motionDict.lookup("defaultCellSize"));
|
||||
|
||||
minimumCellSize_ = readScalar(motionDict.lookup("minimumCellSize"));
|
||||
|
||||
objOutput_ = Switch(motionDict.lookupOrDefault<Switch>("objOutput", false));
|
||||
|
||||
timeChecks_ = Switch
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -126,6 +126,16 @@ class cvControls
|
||||
|
||||
// Motion control controls
|
||||
|
||||
|
||||
// Cell size criteria
|
||||
|
||||
//- Default cell size
|
||||
scalar defaultCellSize_;
|
||||
|
||||
//- Minimum cell size
|
||||
scalar minimumCellSize_;
|
||||
|
||||
|
||||
//- Switch to control the output of obj files for debug
|
||||
Switch objOutput_;
|
||||
|
||||
@ -255,6 +265,12 @@ public:
|
||||
//- Return the iterationToInitialHitRatioLimit
|
||||
scalar iterationToInitialHitRatioLimit() const;
|
||||
|
||||
//- Return the defaultCellSize
|
||||
inline scalar defaultCellSize() const;
|
||||
|
||||
//- Return the minimumCellSize
|
||||
inline scalar minimumCellSize() const;
|
||||
|
||||
//- Return the objOutput Switch
|
||||
inline Switch objOutput() const;
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -112,6 +112,18 @@ inline Foam::scalar Foam::cvControls::iterationToInitialHitRatioLimit() const
|
||||
}
|
||||
|
||||
|
||||
inline Foam::scalar Foam::cvControls::defaultCellSize() const
|
||||
{
|
||||
return defaultCellSize_;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::scalar Foam::cvControls::minimumCellSize() const
|
||||
{
|
||||
return minimumCellSize_;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::Switch Foam::cvControls::objOutput() const
|
||||
{
|
||||
return objOutput_;
|
||||
|
||||
@ -271,6 +271,9 @@ motionControl
|
||||
// Absolute cell size of back ground mesh. This is the maximum cell size.
|
||||
defaultCellSize 0.00075;
|
||||
|
||||
// Absolute cell size of back ground mesh. This is the minimum cell size.
|
||||
minimumCellSize 0;
|
||||
|
||||
//cellShapeControl constantControl;
|
||||
//cellShapeControl fileControl;
|
||||
cellShapeControl surfaceControl;
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -114,6 +114,8 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
argList::validArgs.append("surfaceFormat");
|
||||
|
||||
#include "addOverwriteOption.H"
|
||||
|
||||
#include "setRootCase.H"
|
||||
|
||||
Info<< "Create time\n" << endl;
|
||||
@ -128,6 +130,7 @@ int main(int argc, char *argv[])
|
||||
runTimeExtruded.functionObjects().off();
|
||||
|
||||
const ExtrudeMode surfaceFormat = ExtrudeModeNames[args[1]];
|
||||
const bool overwrite = args.optionFound("overwrite");
|
||||
|
||||
Info<< "Extruding from " << ExtrudeModeNames[surfaceFormat]
|
||||
<< " at time " << runTimeExtruded.timeName() << endl;
|
||||
@ -304,6 +307,15 @@ int main(int argc, char *argv[])
|
||||
mesh().updateMesh(morphMap);
|
||||
}
|
||||
|
||||
if (!overwrite)
|
||||
{
|
||||
runTimeExtruded++;
|
||||
}
|
||||
else
|
||||
{
|
||||
mesh().setInstance("constant");
|
||||
}
|
||||
|
||||
// Take over refinement levels and write to new time directory.
|
||||
Pout<< "\nWriting extruded mesh to time = " << runTimeExtruded.timeName()
|
||||
<< nl << endl;
|
||||
|
||||
@ -45,7 +45,7 @@ collapseFacesCoeffs
|
||||
meshQualityCoeffs
|
||||
{
|
||||
#include "meshQualityDict";
|
||||
maximumIterations 30;
|
||||
maximumIterations 10;
|
||||
maximumSmoothingIterations 1;
|
||||
maxPointErrorCount 5;
|
||||
}
|
||||
|
||||
@ -22,7 +22,7 @@ FoamFile
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
startFrom latestTime;
|
||||
startFrom startTime;
|
||||
|
||||
startTime 0;
|
||||
|
||||
|
||||
@ -43,7 +43,7 @@ collapseFacesCoeffs
|
||||
meshQualityCoeffs
|
||||
{
|
||||
#include "meshQualityDict";
|
||||
maximumIterations 30;
|
||||
maximumIterations 10;
|
||||
maximumSmoothingIterations 1;
|
||||
maxPointErrorCount 5;
|
||||
}
|
||||
|
||||
@ -36,7 +36,7 @@ deltaT 1;
|
||||
|
||||
writeControl timeStep;
|
||||
|
||||
writeInterval 10;
|
||||
writeInterval 100;
|
||||
|
||||
purgeWrite 0;
|
||||
|
||||
|
||||
@ -80,8 +80,8 @@ surfaceConformation
|
||||
{
|
||||
flange.obj
|
||||
{
|
||||
featureMethod extendedFeatureEdgeMesh;
|
||||
extendedFeatureEdgeMesh "flange.extendedFeatureEdgeMesh";
|
||||
featureMethod extendedFeatureEdgeMesh;
|
||||
extendedFeatureEdgeMesh "flange.extendedFeatureEdgeMesh";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user