mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: snappyHexMesh: snap region edges to region feature edges
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -42,6 +42,7 @@ Description
|
||||
#include "refinementSurfaces.H"
|
||||
#include "unitConversion.H"
|
||||
#include "localPointRegion.H"
|
||||
#include "PatchTools.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
@ -415,6 +416,66 @@ Foam::pointField Foam::autoSnapDriver::smoothPatchDisplacement
|
||||
|
||||
return patchDisp;
|
||||
}
|
||||
//XXXXXXX
|
||||
Foam::tmp<Foam::pointField> Foam::autoSnapDriver::avg
|
||||
(
|
||||
const indirectPrimitivePatch& pp,
|
||||
const pointField& localPoints
|
||||
)
|
||||
{
|
||||
const labelListList& pointEdges = pp.pointEdges();
|
||||
const edgeList& edges = pp.edges();
|
||||
|
||||
tmp<pointField> tavg(new pointField(pointEdges.size(), vector::zero));
|
||||
pointField& avg = tavg();
|
||||
|
||||
forAll(pointEdges, vertI)
|
||||
{
|
||||
vector& avgPos = avg[vertI];
|
||||
|
||||
const labelList& pEdges = pointEdges[vertI];
|
||||
|
||||
forAll(pEdges, myEdgeI)
|
||||
{
|
||||
const edge& e = edges[pEdges[myEdgeI]];
|
||||
|
||||
label otherVertI = e.otherVertex(vertI);
|
||||
|
||||
avgPos += localPoints[otherVertI];
|
||||
}
|
||||
|
||||
avgPos /= pEdges.size();
|
||||
}
|
||||
return tavg;
|
||||
}
|
||||
Foam::pointField Foam::autoSnapDriver::smoothLambdaMuPatchDisplacement
|
||||
(
|
||||
const motionSmoother& meshMover,
|
||||
const List<labelPair>& baffles
|
||||
)
|
||||
{
|
||||
const indirectPrimitivePatch& pp = meshMover.patch();
|
||||
pointField newLocalPoints(pp.localPoints());
|
||||
|
||||
const label iters = 90;
|
||||
const scalar lambda = 0.33;
|
||||
const scalar mu = 0.34;
|
||||
|
||||
for (label iter = 0; iter < iters; iter++)
|
||||
{
|
||||
// Lambda
|
||||
newLocalPoints =
|
||||
(1 - lambda)*newLocalPoints
|
||||
+ lambda*avg(pp, newLocalPoints);
|
||||
|
||||
// Mu
|
||||
newLocalPoints =
|
||||
(1 + mu)*newLocalPoints
|
||||
- mu*avg(pp, newLocalPoints);
|
||||
}
|
||||
return newLocalPoints-pp.localPoints();
|
||||
}
|
||||
//XXXXXXX
|
||||
|
||||
|
||||
Foam::tmp<Foam::scalarField> Foam::autoSnapDriver::edgePatchDist
|
||||
@ -684,6 +745,10 @@ void Foam::autoSnapDriver::preSmoothPatch
|
||||
}
|
||||
|
||||
pointField patchDisp(smoothPatchDisplacement(meshMover, baffles));
|
||||
//pointField patchDisp
|
||||
//(
|
||||
// smoothLambdaMuPatchDisplacement(meshMover, baffles)
|
||||
//);
|
||||
|
||||
// The current mesh is the starting mesh to smooth from.
|
||||
meshMover.setDisplacement(patchDisp);
|
||||
@ -2294,6 +2359,100 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::autoSnapDriver::repatchToSurface
|
||||
}
|
||||
|
||||
|
||||
void Foam::autoSnapDriver::detectWarpedFaces
|
||||
(
|
||||
const scalar featureCos,
|
||||
const indirectPrimitivePatch& pp,
|
||||
|
||||
DynamicList<label>& splitFaces,
|
||||
DynamicList<labelPair>& splits
|
||||
) const
|
||||
{
|
||||
const fvMesh& mesh = meshRefiner_.mesh();
|
||||
const faceList& localFaces = pp.localFaces();
|
||||
const pointField& localPoints = pp.localPoints();
|
||||
const labelList& bFaces = pp.addressing();
|
||||
|
||||
splitFaces.clear();
|
||||
splitFaces.setCapacity(bFaces.size());
|
||||
splits.clear();
|
||||
splits.setCapacity(bFaces.size());
|
||||
|
||||
// Determine parallel consistent normals on points
|
||||
const vectorField pointNormals(PatchTools::pointNormals(mesh, pp));
|
||||
|
||||
face f0(4);
|
||||
face f1(4);
|
||||
|
||||
forAll(localFaces, faceI)
|
||||
{
|
||||
const face& f = localFaces[faceI];
|
||||
|
||||
if (f.size() >= 4)
|
||||
{
|
||||
// See if splitting face across diagonal would make two faces with
|
||||
// biggish normal angle
|
||||
|
||||
labelPair minDiag(-1, -1);
|
||||
scalar minCos(GREAT);
|
||||
|
||||
for (label startFp = 0; startFp < f.size()-2; startFp++)
|
||||
{
|
||||
label minFp = f.rcIndex(startFp);
|
||||
|
||||
for
|
||||
(
|
||||
label endFp = f.fcIndex(f.fcIndex(startFp));
|
||||
endFp < f.size() && endFp != minFp;
|
||||
endFp++
|
||||
)
|
||||
{
|
||||
// Form two faces
|
||||
f0.setSize(endFp-startFp+1);
|
||||
label i0 = 0;
|
||||
for (label fp = startFp; fp <= endFp; fp++)
|
||||
{
|
||||
f0[i0++] = f[fp];
|
||||
}
|
||||
f1.setSize(f.size()+2-f0.size());
|
||||
label i1 = 0;
|
||||
for (label fp = endFp; fp != startFp; fp = f.fcIndex(fp))
|
||||
{
|
||||
f1[i1++] = f[fp];
|
||||
}
|
||||
f1[i1++] = f[startFp];
|
||||
|
||||
//Info<< "Splitting face:" << f << " into f0:" << f0
|
||||
// << " f1:" << f1 << endl;
|
||||
|
||||
vector n0 = f0.normal(localPoints);
|
||||
scalar n0Mag = mag(n0);
|
||||
vector n1 = f1.normal(localPoints);
|
||||
scalar n1Mag = mag(n1);
|
||||
|
||||
if (n0Mag > ROOTVSMALL && n1Mag > ROOTVSMALL)
|
||||
{
|
||||
scalar cosAngle = (n0/n0Mag) & (n1/n1Mag);
|
||||
if (cosAngle < minCos)
|
||||
{
|
||||
minCos = cosAngle;
|
||||
minDiag = labelPair(startFp, endFp);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (minCos < featureCos)
|
||||
{
|
||||
splitFaces.append(bFaces[faceI]);
|
||||
splits.append(minDiag);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::autoSnapDriver::doSnap
|
||||
(
|
||||
const dictionary& snapDict,
|
||||
@ -2635,16 +2794,67 @@ void Foam::autoSnapDriver::doSnap
|
||||
|
||||
for (label iter = 0; iter < nFeatIter; iter++)
|
||||
{
|
||||
Info<< nl
|
||||
<< "Morph iteration " << iter << nl
|
||||
<< "-----------------" << endl;
|
||||
|
||||
|
||||
//if (iter > 0 && iter == nFeatIter/2)
|
||||
//if (doFeatures && (iter == 0 || iter == nFeatIter/2))
|
||||
//{
|
||||
// Info<< "Splitting diagonal attractions" << endl;
|
||||
// const labelList& bFaces = ppPtr().addressing();
|
||||
//
|
||||
// indirectPrimitivePatch& pp = ppPtr();
|
||||
// motionSmoother& meshMover = meshMoverPtr();
|
||||
//
|
||||
// // Calculate displacement at every patch point. Insert into
|
||||
// // meshMover.
|
||||
// // Calculate displacement at every patch point
|
||||
// pointField nearestPoint;
|
||||
// vectorField nearestNormal;
|
||||
//
|
||||
// if (snapParams.detectNearSurfacesSnap())
|
||||
// {
|
||||
// nearestPoint.setSize(pp.nPoints(), vector::max);
|
||||
// nearestNormal.setSize(pp.nPoints(), vector::zero);
|
||||
// }
|
||||
//
|
||||
// vectorField disp = calcNearestSurface
|
||||
// (
|
||||
// meshRefiner_,
|
||||
// snapDist,
|
||||
// pp,
|
||||
// nearestPoint,
|
||||
// nearestNormal
|
||||
// );
|
||||
//
|
||||
//
|
||||
// // Override displacement at thin gaps
|
||||
// if (snapParams.detectNearSurfacesSnap())
|
||||
// {
|
||||
// detectNearSurfaces
|
||||
// (
|
||||
// Foam::cos(degToRad(planarAngle)),// planar gaps
|
||||
// pp,
|
||||
// nearestPoint, // surfacepoint from nearest test
|
||||
// nearestNormal, // surfacenormal from nearest test
|
||||
//
|
||||
// disp
|
||||
// );
|
||||
// }
|
||||
//
|
||||
// // Override displacement with feature edge attempt
|
||||
// const label iter = 0;
|
||||
// calcNearestSurfaceFeature
|
||||
// (
|
||||
// snapParams,
|
||||
// false, // avoidSnapProblems
|
||||
// iter,
|
||||
// featureCos,
|
||||
// scalar(iter+1)/nFeatIter,
|
||||
// snapDist,
|
||||
// disp,
|
||||
// meshMover,
|
||||
// patchAttraction,
|
||||
// patchConstraints
|
||||
// );
|
||||
//
|
||||
//
|
||||
// const labelList& bFaces = ppPtr().addressing();
|
||||
// DynamicList<label> splitFaces(bFaces.size());
|
||||
// DynamicList<labelPair> splits(bFaces.size());
|
||||
//
|
||||
@ -2668,6 +2878,10 @@ void Foam::autoSnapDriver::doSnap
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// Info<< "Splitting "
|
||||
// << returnReduce(splitFaces.size(), sumOp<label>())
|
||||
// << " faces along diagonal attractions" << endl;
|
||||
//
|
||||
// autoPtr<mapPolyMesh> mapPtr = meshRefiner_.splitFaces
|
||||
// (
|
||||
// splitFaces,
|
||||
@ -2703,9 +2917,110 @@ void Foam::autoSnapDriver::doSnap
|
||||
// motionDict
|
||||
// )
|
||||
// );
|
||||
//
|
||||
// if (debug&meshRefinement::MESH)
|
||||
// {
|
||||
// const_cast<Time&>(mesh.time())++;
|
||||
// Info<< "Writing split diagonal mesh to time "
|
||||
// << meshRefiner_.timeName() << endl;
|
||||
// meshRefiner_.write
|
||||
// (
|
||||
// meshRefinement::debugType(debug),
|
||||
// meshRefinement::writeType
|
||||
// (
|
||||
// meshRefinement::writeLevel()
|
||||
// | meshRefinement::WRITEMESH
|
||||
// ),
|
||||
// mesh.time().path()/meshRefiner_.timeName()
|
||||
// );
|
||||
// }
|
||||
//}
|
||||
//else
|
||||
//if
|
||||
//(
|
||||
// doFeatures
|
||||
// && (iter == 1 || iter == nFeatIter/2+1 || iter == nFeatIter-1)
|
||||
//)
|
||||
//{
|
||||
// Info<< "Splitting warped faces" << endl;
|
||||
//
|
||||
// const labelList& bFaces = ppPtr().addressing();
|
||||
// DynamicList<label> splitFaces(bFaces.size());
|
||||
// DynamicList<labelPair> splits(bFaces.size());
|
||||
//
|
||||
// detectWarpedFaces
|
||||
// (
|
||||
// featureCos,
|
||||
// ppPtr(),
|
||||
//
|
||||
// splitFaces,
|
||||
// splits
|
||||
// );
|
||||
//
|
||||
// Info<< "Splitting "
|
||||
// << returnReduce(splitFaces.size(), sumOp<label>())
|
||||
// << " faces along diagonal to avoid warpage" << endl;
|
||||
//
|
||||
// autoPtr<mapPolyMesh> mapPtr = meshRefiner_.splitFaces
|
||||
// (
|
||||
// splitFaces,
|
||||
// splits
|
||||
// );
|
||||
//
|
||||
// const labelList& faceMap = mapPtr().faceMap();
|
||||
// meshRefinement::updateList(faceMap, -1, duplicateFace);
|
||||
// const labelList& reverseFaceMap = mapPtr().reverseFaceMap();
|
||||
// forAll(baffles, i)
|
||||
// {
|
||||
// labelPair& baffle = baffles[i];
|
||||
// baffle.first() = reverseFaceMap[baffle.first()];
|
||||
// baffle.second() = reverseFaceMap[baffle.second()];
|
||||
// }
|
||||
//
|
||||
// meshMoverPtr.clear();
|
||||
// ppPtr.clear();
|
||||
//
|
||||
// ppPtr = meshRefinement::makePatch(mesh, adaptPatchIDs);
|
||||
// meshMoverPtr.reset
|
||||
// (
|
||||
// new motionSmoother
|
||||
// (
|
||||
// mesh,
|
||||
// ppPtr(),
|
||||
// adaptPatchIDs,
|
||||
// meshRefinement::makeDisplacementField
|
||||
// (
|
||||
// pointMesh::New(mesh),
|
||||
// adaptPatchIDs
|
||||
// ),
|
||||
// motionDict
|
||||
// )
|
||||
// );
|
||||
//
|
||||
// if (debug&meshRefinement::MESH)
|
||||
// {
|
||||
// const_cast<Time&>(mesh.time())++;
|
||||
// Info<< "Writing split warped mesh to time "
|
||||
// << meshRefiner_.timeName() << endl;
|
||||
// meshRefiner_.write
|
||||
// (
|
||||
// meshRefinement::debugType(debug),
|
||||
// meshRefinement::writeType
|
||||
// (
|
||||
// meshRefinement::writeLevel()
|
||||
// | meshRefinement::WRITEMESH
|
||||
// ),
|
||||
// mesh.time().path()/meshRefiner_.timeName()
|
||||
// );
|
||||
// }
|
||||
//}
|
||||
|
||||
|
||||
|
||||
Info<< nl
|
||||
<< "Morph iteration " << iter << nl
|
||||
<< "-----------------" << endl;
|
||||
|
||||
indirectPrimitivePatch& pp = ppPtr();
|
||||
motionSmoother& meshMover = meshMoverPtr();
|
||||
|
||||
@ -2752,6 +3067,7 @@ void Foam::autoSnapDriver::doSnap
|
||||
disp = calcNearestSurfaceFeature
|
||||
(
|
||||
snapParams,
|
||||
true, // avoidSnapProblems
|
||||
iter,
|
||||
featureCos,
|
||||
scalar(iter+1)/nFeatIter,
|
||||
@ -2829,7 +3145,10 @@ void Foam::autoSnapDriver::doSnap
|
||||
);
|
||||
Info<< "Writing displacement field ..." << endl;
|
||||
meshMover.displacement().write();
|
||||
tmp<pointScalarField> magDisp(mag(meshMover.displacement()));
|
||||
tmp<pointScalarField> magDisp
|
||||
(
|
||||
mag(meshMover.displacement())
|
||||
);
|
||||
magDisp().write();
|
||||
}
|
||||
|
||||
@ -2838,6 +3157,7 @@ void Foam::autoSnapDriver::doSnap
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Merge any introduced baffles (from faceZones of faceType 'internal')
|
||||
{
|
||||
autoPtr<mapPolyMesh> mapPtr = mergeZoneBaffles(baffles);
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -87,6 +87,20 @@ class autoSnapDriver
|
||||
const List<labelPair>&
|
||||
);
|
||||
|
||||
static tmp<pointField> avg
|
||||
(
|
||||
const indirectPrimitivePatch&,
|
||||
const pointField&
|
||||
);
|
||||
|
||||
//- Calculate displacement per patch point. Wip.
|
||||
static pointField smoothLambdaMuPatchDisplacement
|
||||
(
|
||||
const motionSmoother& meshMover,
|
||||
const List<labelPair>& baffles
|
||||
);
|
||||
|
||||
|
||||
//- Check that face zones are synced
|
||||
void checkCoupledFaceZones() const;
|
||||
|
||||
@ -112,6 +126,16 @@ class autoSnapDriver
|
||||
const vectorField&
|
||||
);
|
||||
|
||||
//- Detect warpage
|
||||
void detectWarpedFaces
|
||||
(
|
||||
const scalar featureCos,
|
||||
const indirectPrimitivePatch& pp,
|
||||
|
||||
DynamicList<label>& splitFaces,
|
||||
DynamicList<labelPair>& splits
|
||||
) const;
|
||||
|
||||
// Feature line snapping
|
||||
|
||||
//- Is point on two feature edges that make a largish angle?
|
||||
@ -198,6 +222,27 @@ class autoSnapDriver
|
||||
List<pointConstraint>& patchConstraints
|
||||
) const;
|
||||
|
||||
//- Remove constraints of points next to multi-patch points
|
||||
// to give a bit more freedom of the mesh to conform to the
|
||||
// multi-patch points. Bit dodgy for simple cases.
|
||||
void releasePointsNextToMultiPatch
|
||||
(
|
||||
const label iter,
|
||||
const scalar featureCos,
|
||||
|
||||
const indirectPrimitivePatch& pp,
|
||||
const scalarField& snapDist,
|
||||
|
||||
const List<List<point> >& pointFaceCentres,
|
||||
const labelListList& pointFacePatchID,
|
||||
|
||||
const vectorField& rawPatchAttraction,
|
||||
const List<pointConstraint>& rawPatchConstraints,
|
||||
|
||||
vectorField& patchAttraction,
|
||||
List<pointConstraint>& patchConstraints
|
||||
) const;
|
||||
|
||||
//- Detect any diagonal attraction. Returns indices in face
|
||||
// or (-1, -1) if none
|
||||
labelPair findDiagonalAttraction
|
||||
@ -208,6 +253,17 @@ class autoSnapDriver
|
||||
const label faceI
|
||||
) const;
|
||||
|
||||
//- Avoid attraction across face diagonal since would
|
||||
// cause face squeeze
|
||||
void avoidDiagonalAttraction
|
||||
(
|
||||
const label iter,
|
||||
const scalar featureCos,
|
||||
const indirectPrimitivePatch& pp,
|
||||
vectorField& patchAttraction,
|
||||
List<pointConstraint>& patchConstraints
|
||||
) const;
|
||||
|
||||
//- Return hit if on multiple points
|
||||
pointIndexHit findMultiPatchPoint
|
||||
(
|
||||
@ -215,41 +271,27 @@ class autoSnapDriver
|
||||
const labelList& patchIDs,
|
||||
const List<point>& faceCentres
|
||||
) const;
|
||||
void binFeatureFace
|
||||
|
||||
//- Return hit if faces-on-the-same-normalplane are on multiple
|
||||
// patches
|
||||
pointIndexHit findMultiPatchPoint
|
||||
(
|
||||
const point& pt,
|
||||
const labelList& pfPatchID,
|
||||
const DynamicList<vector>& surfaceNormals,
|
||||
const labelList& faceToNormalBin
|
||||
) const;
|
||||
|
||||
//- Return index of similar normal
|
||||
label findNormal
|
||||
(
|
||||
const label iter,
|
||||
const scalar featureCos,
|
||||
|
||||
const indirectPrimitivePatch& pp,
|
||||
const scalar snapDist,
|
||||
|
||||
const point& fc,
|
||||
const vector& faceSurfaceNormal,
|
||||
const vector& faceDisp,
|
||||
|
||||
DynamicList<point>& surfacePoints,
|
||||
DynamicList<vector>& surfaceNormals,
|
||||
DynamicList<label>& surfaceCounts
|
||||
) const;
|
||||
void binFeatureFaces
|
||||
(
|
||||
const label iter,
|
||||
const scalar featureCos,
|
||||
|
||||
const indirectPrimitivePatch& pp,
|
||||
const scalarField& snapDist,
|
||||
const label pointI,
|
||||
|
||||
const List<List<point> >& pointFaceSurfNormals,
|
||||
const List<List<point> >& pointFaceDisp,
|
||||
const List<List<point> >& pointFaceCentres,
|
||||
|
||||
DynamicList<point>& surfacePoints,
|
||||
DynamicList<vector>& surfaceNormals,
|
||||
DynamicList<label>& surfaceCounts
|
||||
const DynamicList<vector>& surfaceNormals
|
||||
) const;
|
||||
|
||||
|
||||
//- Determine attraction and constraints for single point
|
||||
// using sampled surrounding of the point
|
||||
void featureAttractionUsingReconstruction
|
||||
(
|
||||
const label iter,
|
||||
@ -257,6 +299,7 @@ class autoSnapDriver
|
||||
|
||||
const indirectPrimitivePatch& pp,
|
||||
const scalarField& snapDist,
|
||||
const vectorField& nearestDisp,
|
||||
const label pointI,
|
||||
|
||||
const List<List<point> >& pointFaceSurfNormals,
|
||||
@ -264,16 +307,24 @@ class autoSnapDriver
|
||||
const List<List<point> >& pointFaceCentres,
|
||||
const labelListList& pointFacePatchID,
|
||||
|
||||
DynamicList<point>& surfacePoints,
|
||||
DynamicList<vector>& surfaceNormals,
|
||||
labelList& faceToNormalBin,
|
||||
|
||||
vector& patchAttraction,
|
||||
pointConstraint& patchConstraint
|
||||
) const;
|
||||
|
||||
//- Determine attraction and constraints for all points
|
||||
// using sampled surrounding of the point
|
||||
void featureAttractionUsingReconstruction
|
||||
(
|
||||
const label iter,
|
||||
const bool avoidSnapProblems,
|
||||
const scalar featureCos,
|
||||
const indirectPrimitivePatch& pp,
|
||||
const scalarField& snapDist,
|
||||
const vectorField& nearestDisp,
|
||||
|
||||
const List<List<point> >& pointFaceSurfNormals,
|
||||
const List<List<point> >& pointFaceDisp,
|
||||
@ -284,6 +335,8 @@ class autoSnapDriver
|
||||
List<pointConstraint>& patchConstraints
|
||||
) const;
|
||||
|
||||
//- Determine geometric features and attraction to equivalent
|
||||
// surface features
|
||||
void determineFeatures
|
||||
(
|
||||
const label iter,
|
||||
@ -291,7 +344,8 @@ class autoSnapDriver
|
||||
const bool multiRegionFeatureSnap,
|
||||
|
||||
const indirectPrimitivePatch&,
|
||||
const scalarField&,
|
||||
const scalarField& snapDist,
|
||||
const vectorField& nearestDisp,
|
||||
|
||||
const List<List<point> >& pointFaceSurfNormals,
|
||||
const List<List<point> >& pointFaceDisp,
|
||||
@ -307,11 +361,55 @@ class autoSnapDriver
|
||||
List<pointConstraint>& patchConstraints
|
||||
) const;
|
||||
|
||||
//- Determine features originating from bafles and
|
||||
// and add attraction to equivalent surface features
|
||||
void determineBaffleFeatures
|
||||
(
|
||||
const label iter,
|
||||
const scalar featureCos,
|
||||
|
||||
const indirectPrimitivePatch& pp,
|
||||
const scalarField& snapDist,
|
||||
|
||||
// Feature-point to pp point
|
||||
List<labelList>& pointAttractor,
|
||||
List<List<pointConstraint> >& pointConstraints,
|
||||
// Feature-edge to pp point
|
||||
List<List<DynamicList<point> > >& edgeAttractors,
|
||||
List<List<DynamicList<pointConstraint> > >& edgeConstraints,
|
||||
// pp point to nearest feature
|
||||
vectorField& patchAttraction,
|
||||
List<pointConstraint>& patchConstraints
|
||||
) const;
|
||||
void reverseAttractMeshPoints
|
||||
(
|
||||
const label iter,
|
||||
|
||||
const indirectPrimitivePatch& pp,
|
||||
const scalarField& snapDist,
|
||||
|
||||
// Feature-point to pp point
|
||||
const List<labelList>& pointAttractor,
|
||||
const List<List<pointConstraint> >& pointConstraints,
|
||||
// Feature-edge to pp point
|
||||
const List<List<DynamicList<point> > >& edgeAttractors,
|
||||
const List<List<DynamicList<pointConstraint> > >&
|
||||
|
||||
const vectorField& rawPatchAttraction,
|
||||
const List<pointConstraint>& rawPatchConstraints,
|
||||
|
||||
// pp point to nearest feature
|
||||
vectorField& patchAttraction,
|
||||
List<pointConstraint>& patchConstraints
|
||||
) const;
|
||||
|
||||
//- Find point on nearest feature edge (within searchDist).
|
||||
// Return point and feature
|
||||
// and store feature-edge to mesh-point and vice versa
|
||||
Tuple2<label, pointIndexHit> findNearFeatureEdge
|
||||
(
|
||||
const bool isRegionEdge,
|
||||
|
||||
const indirectPrimitivePatch& pp,
|
||||
const scalarField& snapDist,
|
||||
const label pointI,
|
||||
@ -331,6 +429,8 @@ class autoSnapDriver
|
||||
// edge (using findNearFeatureEdge above)
|
||||
Tuple2<label, pointIndexHit> findNearFeaturePoint
|
||||
(
|
||||
const bool isRegionEdge,
|
||||
|
||||
const indirectPrimitivePatch& pp,
|
||||
const scalarField& snapDist,
|
||||
const label pointI,
|
||||
@ -350,10 +450,12 @@ class autoSnapDriver
|
||||
void featureAttractionUsingFeatureEdges
|
||||
(
|
||||
const label iter,
|
||||
const bool avoidSnapProblems,
|
||||
const scalar featureCos,
|
||||
const bool multiRegionFeatureSnap,
|
||||
const indirectPrimitivePatch& pp,
|
||||
const scalarField& snapDist,
|
||||
const vectorField& nearestDisp,
|
||||
|
||||
const List<List<point> >& pointFaceSurfNormals,
|
||||
const List<List<point> >& pointFaceDisp,
|
||||
@ -374,9 +476,14 @@ class autoSnapDriver
|
||||
List<pointConstraint>& patchConstraints
|
||||
) const;
|
||||
|
||||
//- Top level feature attraction routine. Gets given
|
||||
// displacement to nearest surface in nearestDisp
|
||||
// and calculates new displacement taking into account
|
||||
// features
|
||||
vectorField calcNearestSurfaceFeature
|
||||
(
|
||||
const snapParameters& snapParams,
|
||||
const bool avoidSnapProblems,
|
||||
const label iter,
|
||||
const scalar featureCos,
|
||||
const scalar featureAttract,
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -124,41 +124,19 @@ Foam::layerParameters::layerParameters
|
||||
readScalar(dict.lookup("minThickness"))
|
||||
),
|
||||
featureAngle_(readScalar(dict.lookup("featureAngle"))),
|
||||
slipFeatureAngle_
|
||||
(
|
||||
dict.found("slipFeatureAngle")
|
||||
? readScalar(dict.lookup("slipFeatureAngle"))
|
||||
: 0.5*featureAngle_
|
||||
),
|
||||
concaveAngle_
|
||||
(
|
||||
dict.lookupOrDefault("concaveAngle", defaultConcaveAngle)
|
||||
),
|
||||
nGrow_(readLabel(dict.lookup("nGrow"))),
|
||||
nSmoothSurfaceNormals_
|
||||
(
|
||||
readLabel(dict.lookup("nSmoothSurfaceNormals"))
|
||||
),
|
||||
nSmoothNormals_(readLabel(dict.lookup("nSmoothNormals"))),
|
||||
nSmoothDisplacement_(dict.lookupOrDefault("nSmoothDisplacement", 0)),
|
||||
nSmoothThickness_(readLabel(dict.lookup("nSmoothThickness"))),
|
||||
maxFaceThicknessRatio_
|
||||
(
|
||||
readScalar(dict.lookup("maxFaceThicknessRatio"))
|
||||
),
|
||||
layerTerminationCos_
|
||||
(
|
||||
Foam::cos(degToRad(0.5*featureAngle_))
|
||||
),
|
||||
maxThicknessToMedialRatio_
|
||||
(
|
||||
readScalar(dict.lookup("maxThicknessToMedialRatio"))
|
||||
),
|
||||
nBufferCellsNoExtrude_
|
||||
(
|
||||
readLabel(dict.lookup("nBufferCellsNoExtrude"))
|
||||
),
|
||||
nSnap_(readLabel(dict.lookup("nRelaxIter"))),
|
||||
nLayerIter_(readLabel(dict.lookup("nLayerIter"))),
|
||||
nRelaxedIter_(labelMax),
|
||||
additionalReporting_(dict.lookupOrDefault("additionalReporting", false)),
|
||||
@ -171,18 +149,6 @@ Foam::layerParameters::layerParameters
|
||||
)
|
||||
)
|
||||
{
|
||||
word angleKey = "minMedialAxisAngle";
|
||||
if (!dict.found(angleKey))
|
||||
{
|
||||
// Backwards compatibility
|
||||
angleKey = "minMedianAxisAngle";
|
||||
}
|
||||
minMedialAxisAngleCos_ = Foam::cos
|
||||
(
|
||||
degToRad(readScalar(dict.lookup(angleKey)))
|
||||
);
|
||||
|
||||
|
||||
// Detect layer specification mode
|
||||
|
||||
label nSpec = 0;
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -114,32 +114,14 @@ private:
|
||||
|
||||
scalar featureAngle_;
|
||||
|
||||
scalar slipFeatureAngle_;
|
||||
|
||||
scalar concaveAngle_;
|
||||
|
||||
label nGrow_;
|
||||
|
||||
label nSmoothSurfaceNormals_;
|
||||
|
||||
label nSmoothNormals_;
|
||||
|
||||
label nSmoothDisplacement_;
|
||||
|
||||
label nSmoothThickness_;
|
||||
|
||||
scalar maxFaceThicknessRatio_;
|
||||
|
||||
scalar layerTerminationCos_;
|
||||
|
||||
scalar maxThicknessToMedialRatio_;
|
||||
|
||||
scalar minMedialAxisAngleCos_;
|
||||
|
||||
label nBufferCellsNoExtrude_;
|
||||
|
||||
label nSnap_;
|
||||
|
||||
label nLayerIter_;
|
||||
|
||||
label nRelaxedIter_;
|
||||
@ -148,6 +130,7 @@ private:
|
||||
|
||||
word meshShrinker_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Calculate expansion ratio from overall size v.s. thickness of
|
||||
@ -301,65 +284,6 @@ public:
|
||||
}
|
||||
|
||||
|
||||
// Specific to medial axis mesh shrinking
|
||||
|
||||
//- At non-patched sides allow mesh to slip if extrusion
|
||||
// direction makes angle larger than slipFeatureAngle.
|
||||
scalar slipFeatureAngle() const
|
||||
{
|
||||
return slipFeatureAngle_;
|
||||
}
|
||||
|
||||
//- Number of smoothing iterations of surface normals
|
||||
label nSmoothSurfaceNormals() const
|
||||
{
|
||||
return nSmoothSurfaceNormals_;
|
||||
}
|
||||
|
||||
//- Number of smoothing iterations of interior mesh movement
|
||||
// direction
|
||||
label nSmoothNormals() const
|
||||
{
|
||||
return nSmoothNormals_;
|
||||
}
|
||||
|
||||
scalar layerTerminationCos() const
|
||||
{
|
||||
return layerTerminationCos_;
|
||||
}
|
||||
|
||||
//- Smooth internal displacement
|
||||
label nSmoothDisplacement() const
|
||||
{
|
||||
return nSmoothDisplacement_;
|
||||
}
|
||||
|
||||
//- Smooth layer thickness over surface patches
|
||||
label nSmoothThickness() const
|
||||
{
|
||||
return nSmoothThickness_;
|
||||
}
|
||||
|
||||
//- Reduce layer growth where ratio thickness to medial
|
||||
// distance is large
|
||||
scalar maxThicknessToMedialRatio() const
|
||||
{
|
||||
return maxThicknessToMedialRatio_;
|
||||
}
|
||||
|
||||
//- Angle used to pick up medial axis points
|
||||
scalar minMedialAxisAngleCos() const
|
||||
{
|
||||
return minMedialAxisAngleCos_;
|
||||
}
|
||||
|
||||
label nSnap() const
|
||||
{
|
||||
return nSnap_;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Helper
|
||||
|
||||
//- Determine overall thickness. Uses two of the four parameters
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2014 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -1721,7 +1721,7 @@ void Foam::medialAxisMeshMover::calculateDisplacement
|
||||
const Switch detectExtrusionIsland = coeffDict.lookupOrDefault<Switch>
|
||||
(
|
||||
"detectExtrusionIsland",
|
||||
true
|
||||
false
|
||||
);
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2014 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -224,10 +224,7 @@ class medialAxisMeshMover
|
||||
);
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
medialAxisMeshMover
|
||||
(
|
||||
const medialAxisMeshMover&
|
||||
);
|
||||
medialAxisMeshMover(const medialAxisMeshMover&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const medialAxisMeshMover&);
|
||||
|
||||
@ -176,20 +176,16 @@ void Foam::refinementFeatures::read
|
||||
identity(newEdges.size()) // regionEdges
|
||||
);
|
||||
|
||||
|
||||
Info<< "Constructed extendedFeatureEdgeMesh " << featObj.name()
|
||||
<< nl << incrIndent;
|
||||
eeMesh.writeStats(Info);
|
||||
Info<< decrIndent << endl;
|
||||
|
||||
//Info<< "Constructed extendedFeatureEdgeMesh " << featObj.name()
|
||||
// << nl << incrIndent;
|
||||
//eeMesh.writeStats(Info);
|
||||
//Info<< decrIndent << endl;
|
||||
|
||||
set(featI, new extendedFeatureEdgeMesh(featObj, eeMesh));
|
||||
}
|
||||
|
||||
const extendedEdgeMesh& eMesh = operator[](featI);
|
||||
|
||||
//eMesh.mergePoints(meshRefiner_.mergeDistance());
|
||||
|
||||
if (dict.found("levels"))
|
||||
{
|
||||
List<Tuple2<scalar, label> > distLevels(dict["levels"]);
|
||||
|
||||
Reference in New Issue
Block a user