mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: snappyHexMesh: keep orientation of baffle
This commit is contained in:
@ -369,7 +369,10 @@ int main(int argc, char *argv[])
|
|||||||
// Add all the surface regions as patches
|
// Add all the surface regions as patches
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
labelList globalToPatch;
|
//- Global surface region to patch (non faceZone surface) or patches
|
||||||
|
// (faceZone surfaces)
|
||||||
|
labelList globalToMasterPatch;
|
||||||
|
labelList globalToSlavePatch;
|
||||||
{
|
{
|
||||||
Info<< nl
|
Info<< nl
|
||||||
<< "Adding patches for surface regions" << nl
|
<< "Adding patches for surface regions" << nl
|
||||||
@ -377,7 +380,8 @@ int main(int argc, char *argv[])
|
|||||||
<< endl;
|
<< endl;
|
||||||
|
|
||||||
// From global region number to mesh patch.
|
// From global region number to mesh patch.
|
||||||
globalToPatch.setSize(surfaces.nRegions(), -1);
|
globalToMasterPatch.setSize(surfaces.nRegions(), -1);
|
||||||
|
globalToSlavePatch.setSize(surfaces.nRegions(), -1);
|
||||||
|
|
||||||
Info<< "Patch\tType\tRegion" << nl
|
Info<< "Patch\tType\tRegion" << nl
|
||||||
<< "-----\t----\t------"
|
<< "-----\t----\t------"
|
||||||
@ -394,36 +398,111 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
Info<< surfaces.names()[surfI] << ':' << nl << nl;
|
Info<< surfaces.names()[surfI] << ':' << nl << nl;
|
||||||
|
|
||||||
forAll(regNames, i)
|
if (surfaces.faceZoneNames()[surfI].empty())
|
||||||
{
|
{
|
||||||
label globalRegionI = surfaces.globalRegion(surfI, i);
|
// 'Normal' surface
|
||||||
|
forAll(regNames, i)
|
||||||
label patchI;
|
|
||||||
|
|
||||||
if (surfacePatchInfo.set(globalRegionI))
|
|
||||||
{
|
{
|
||||||
patchI = meshRefiner.addMeshedPatch
|
label globalRegionI = surfaces.globalRegion(surfI, i);
|
||||||
(
|
|
||||||
regNames[i],
|
label patchI;
|
||||||
surfacePatchInfo[globalRegionI]
|
|
||||||
);
|
if (surfacePatchInfo.set(globalRegionI))
|
||||||
|
{
|
||||||
|
patchI = meshRefiner.addMeshedPatch
|
||||||
|
(
|
||||||
|
regNames[i],
|
||||||
|
surfacePatchInfo[globalRegionI]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dictionary patchInfo;
|
||||||
|
patchInfo.set("type", wallPolyPatch::typeName);
|
||||||
|
|
||||||
|
patchI = meshRefiner.addMeshedPatch
|
||||||
|
(
|
||||||
|
regNames[i],
|
||||||
|
patchInfo
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Info<< patchI << '\t' << mesh.boundaryMesh()[patchI].type()
|
||||||
|
<< '\t' << regNames[i] << nl;
|
||||||
|
|
||||||
|
globalToMasterPatch[globalRegionI] = patchI;
|
||||||
|
globalToSlavePatch[globalRegionI] = patchI;
|
||||||
}
|
}
|
||||||
else
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Zoned surface
|
||||||
|
forAll(regNames, i)
|
||||||
{
|
{
|
||||||
dictionary patchInfo;
|
label globalRegionI = surfaces.globalRegion(surfI, i);
|
||||||
patchInfo.set("type", wallPolyPatch::typeName);
|
|
||||||
|
|
||||||
patchI = meshRefiner.addMeshedPatch
|
// Add master side patch
|
||||||
(
|
{
|
||||||
regNames[i],
|
label patchI;
|
||||||
patchInfo
|
|
||||||
);
|
if (surfacePatchInfo.set(globalRegionI))
|
||||||
|
{
|
||||||
|
patchI = meshRefiner.addMeshedPatch
|
||||||
|
(
|
||||||
|
regNames[i],
|
||||||
|
surfacePatchInfo[globalRegionI]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dictionary patchInfo;
|
||||||
|
patchInfo.set("type", wallPolyPatch::typeName);
|
||||||
|
|
||||||
|
patchI = meshRefiner.addMeshedPatch
|
||||||
|
(
|
||||||
|
regNames[i],
|
||||||
|
patchInfo
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Info<< patchI << '\t'
|
||||||
|
<< mesh.boundaryMesh()[patchI].type()
|
||||||
|
<< '\t' << regNames[i] << nl;
|
||||||
|
|
||||||
|
globalToMasterPatch[globalRegionI] = patchI;
|
||||||
|
}
|
||||||
|
// Add slave side patch
|
||||||
|
{
|
||||||
|
const word slaveName = regNames[i] + "_slave";
|
||||||
|
label patchI;
|
||||||
|
|
||||||
|
if (surfacePatchInfo.set(globalRegionI))
|
||||||
|
{
|
||||||
|
patchI = meshRefiner.addMeshedPatch
|
||||||
|
(
|
||||||
|
slaveName,
|
||||||
|
surfacePatchInfo[globalRegionI]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dictionary patchInfo;
|
||||||
|
patchInfo.set("type", wallPolyPatch::typeName);
|
||||||
|
|
||||||
|
patchI = meshRefiner.addMeshedPatch
|
||||||
|
(
|
||||||
|
slaveName,
|
||||||
|
patchInfo
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Info<< patchI << '\t'
|
||||||
|
<< mesh.boundaryMesh()[patchI].type()
|
||||||
|
<< '\t' << slaveName << nl;
|
||||||
|
|
||||||
|
globalToSlavePatch[globalRegionI] = patchI;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Info<< patchI << '\t' << mesh.boundaryMesh()[patchI].type()
|
|
||||||
<< '\t' << regNames[i] << nl;
|
|
||||||
|
|
||||||
globalToPatch[globalRegionI] = patchI;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Info<< nl;
|
Info<< nl;
|
||||||
@ -479,7 +558,8 @@ int main(int argc, char *argv[])
|
|||||||
meshRefiner,
|
meshRefiner,
|
||||||
decomposer,
|
decomposer,
|
||||||
distributor,
|
distributor,
|
||||||
globalToPatch
|
globalToMasterPatch,
|
||||||
|
globalToSlavePatch
|
||||||
);
|
);
|
||||||
|
|
||||||
// Refinement parameters
|
// Refinement parameters
|
||||||
@ -510,7 +590,8 @@ int main(int argc, char *argv[])
|
|||||||
autoSnapDriver snapDriver
|
autoSnapDriver snapDriver
|
||||||
(
|
(
|
||||||
meshRefiner,
|
meshRefiner,
|
||||||
globalToPatch
|
globalToMasterPatch,
|
||||||
|
globalToSlavePatch
|
||||||
);
|
);
|
||||||
|
|
||||||
// Snap parameters
|
// Snap parameters
|
||||||
@ -544,7 +625,12 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
cpuTime timer;
|
cpuTime timer;
|
||||||
|
|
||||||
autoLayerDriver layerDriver(meshRefiner, globalToPatch);
|
autoLayerDriver layerDriver
|
||||||
|
(
|
||||||
|
meshRefiner,
|
||||||
|
globalToMasterPatch,
|
||||||
|
globalToSlavePatch
|
||||||
|
);
|
||||||
|
|
||||||
// Layer addition parameters
|
// Layer addition parameters
|
||||||
layerParameters layerParams(layerDict, mesh.boundaryMesh());
|
layerParameters layerParams(layerDict, mesh.boundaryMesh());
|
||||||
|
|||||||
@ -2372,11 +2372,13 @@ void Foam::autoLayerDriver::getLayerCellsFaces
|
|||||||
Foam::autoLayerDriver::autoLayerDriver
|
Foam::autoLayerDriver::autoLayerDriver
|
||||||
(
|
(
|
||||||
meshRefinement& meshRefiner,
|
meshRefinement& meshRefiner,
|
||||||
const labelList& globalToPatch
|
const labelList& globalToMasterPatch,
|
||||||
|
const labelList& globalToSlavePatch
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
meshRefiner_(meshRefiner),
|
meshRefiner_(meshRefiner),
|
||||||
globalToPatch_(globalToPatch)
|
globalToMasterPatch_(globalToMasterPatch),
|
||||||
|
globalToSlavePatch_(globalToSlavePatch)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -2435,7 +2437,12 @@ void Foam::autoLayerDriver::addLayers
|
|||||||
// Create baffles (pairs of faces that share the same points)
|
// Create baffles (pairs of faces that share the same points)
|
||||||
// Baffles stored as owner and neighbour face that have been created.
|
// Baffles stored as owner and neighbour face that have been created.
|
||||||
List<labelPair> baffles;
|
List<labelPair> baffles;
|
||||||
meshRefiner_.createZoneBaffles(globalToPatch_, baffles);
|
meshRefiner_.createZoneBaffles
|
||||||
|
(
|
||||||
|
globalToMasterPatch_,
|
||||||
|
globalToSlavePatch_,
|
||||||
|
baffles
|
||||||
|
);
|
||||||
|
|
||||||
if (debug&meshRefinement::MESH)
|
if (debug&meshRefinement::MESH)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -99,7 +99,10 @@ class autoLayerDriver
|
|||||||
meshRefinement& meshRefiner_;
|
meshRefinement& meshRefiner_;
|
||||||
|
|
||||||
//- From surface region to patch
|
//- From surface region to patch
|
||||||
const labelList globalToPatch_;
|
const labelList globalToMasterPatch_;
|
||||||
|
|
||||||
|
//- From surface region to patch
|
||||||
|
const labelList globalToSlavePatch_;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -518,7 +521,8 @@ public:
|
|||||||
autoLayerDriver
|
autoLayerDriver
|
||||||
(
|
(
|
||||||
meshRefinement& meshRefiner,
|
meshRefinement& meshRefiner,
|
||||||
const labelList& globalToPatch
|
const labelList& globalToMasterPatch,
|
||||||
|
const labelList& globalToSlavePatch
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1135,6 +1135,12 @@ void Foam::autoLayerDriver::medialAxisSmoothingInfo
|
|||||||
<< " " << medialRatio.name()
|
<< " " << medialRatio.name()
|
||||||
<< " : ratio of medial distance to wall distance" << nl
|
<< " : ratio of medial distance to wall distance" << nl
|
||||||
<< endl;
|
<< endl;
|
||||||
|
meshRefiner_.mesh().setInstance(meshRefiner_.timeName());
|
||||||
|
meshRefiner_.write
|
||||||
|
(
|
||||||
|
debug,
|
||||||
|
mesh.time().path()/meshRefiner_.timeName()
|
||||||
|
);
|
||||||
dispVec.write();
|
dispVec.write();
|
||||||
medialDist.write();
|
medialDist.write();
|
||||||
medialVec.write();
|
medialVec.write();
|
||||||
@ -1409,6 +1415,94 @@ void Foam::autoLayerDriver::shrinkMeshMedialDistance
|
|||||||
*dispVec[pointI];
|
*dispVec[pointI];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//XXXXX
|
||||||
|
// // Smear displacement away from fixed values (medialRatio=0 or 1)
|
||||||
|
// {
|
||||||
|
// const edgeList& edges = mesh.edges();
|
||||||
|
// scalarField edgeWeight(edges.size(), 0.0);
|
||||||
|
// forAll(edges, edgeI)
|
||||||
|
// {
|
||||||
|
// if (isMasterEdge[edgeI])
|
||||||
|
// {
|
||||||
|
// scalar eMag = edges[edgeI].mag(mesh.points());
|
||||||
|
// if (eMag > VSMALL)
|
||||||
|
// {
|
||||||
|
// edgeWeight[edgeI] = 1.0/eMag;
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// edgeWeight[edgeI] = GREAT;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// scalarField invSumWeight(mesh.nPoints());
|
||||||
|
// sumWeights(isMasterEdge, edgeWeight, invSumWeight);
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// // Get smoothly varying patch field.
|
||||||
|
// Info<< "shrinkMeshDistance : Smoothing displacement ..." << endl;
|
||||||
|
//
|
||||||
|
// const scalar lambda = 0.33;
|
||||||
|
// const scalar mu = -0.34;
|
||||||
|
//
|
||||||
|
// pointField average(mesh.nPoints());
|
||||||
|
// for (label iter = 0; iter < 90; iter++)
|
||||||
|
// {
|
||||||
|
// // Calculate average of field
|
||||||
|
// averageNeighbours
|
||||||
|
// (
|
||||||
|
// mesh,
|
||||||
|
// edgeWeight,
|
||||||
|
// invSumWeight,
|
||||||
|
// displacement,
|
||||||
|
// average
|
||||||
|
// );
|
||||||
|
//
|
||||||
|
// forAll(displacement, i)
|
||||||
|
// {
|
||||||
|
// if (medialRatio[i] > SMALL && medialRatio[i] < 1-SMALL)
|
||||||
|
// {
|
||||||
|
// displacement[i] =
|
||||||
|
// (1-lambda)*displacement[i]
|
||||||
|
// +lambda*average[i];
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// // Calculate average of field
|
||||||
|
// averageNeighbours
|
||||||
|
// (
|
||||||
|
// mesh,
|
||||||
|
// edgeWeight,
|
||||||
|
// invSumWeight,
|
||||||
|
// displacement,
|
||||||
|
// average
|
||||||
|
// );
|
||||||
|
//
|
||||||
|
// forAll(displacement, i)
|
||||||
|
// {
|
||||||
|
// if (medialRatio[i] > SMALL && medialRatio[i] < 1-SMALL)
|
||||||
|
// {
|
||||||
|
// displacement[i] = (1-mu)*displacement[i]+mu*average[i];
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// // Do residual calculation every so often.
|
||||||
|
// if ((iter % 10) == 0)
|
||||||
|
// {
|
||||||
|
// Info<< " Iteration " << iter << " residual "
|
||||||
|
// << gSum(mag(displacement-average))
|
||||||
|
// /returnReduce(average.size(), sumOp<label>())
|
||||||
|
// << endl;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//XXXXX
|
||||||
|
|
||||||
|
|
||||||
if (debug&meshRefinement::MESH || debug&meshRefinement::LAYERINFO)
|
if (debug&meshRefinement::MESH || debug&meshRefinement::LAYERINFO)
|
||||||
{
|
{
|
||||||
const_cast<Time&>(mesh.time())++;
|
const_cast<Time&>(mesh.time())++;
|
||||||
|
|||||||
@ -57,13 +57,15 @@ Foam::autoRefineDriver::autoRefineDriver
|
|||||||
meshRefinement& meshRefiner,
|
meshRefinement& meshRefiner,
|
||||||
decompositionMethod& decomposer,
|
decompositionMethod& decomposer,
|
||||||
fvMeshDistribute& distributor,
|
fvMeshDistribute& distributor,
|
||||||
const labelList& globalToPatch
|
const labelList& globalToMasterPatch,
|
||||||
|
const labelList& globalToSlavePatch
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
meshRefiner_(meshRefiner),
|
meshRefiner_(meshRefiner),
|
||||||
decomposer_(decomposer),
|
decomposer_(decomposer),
|
||||||
distributor_(distributor),
|
distributor_(distributor),
|
||||||
globalToPatch_(globalToPatch)
|
globalToMasterPatch_(globalToMasterPatch),
|
||||||
|
globalToSlavePatch_(globalToSlavePatch)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -313,7 +315,8 @@ void Foam::autoRefineDriver::removeInsideCells
|
|||||||
meshRefiner_.splitMesh
|
meshRefiner_.splitMesh
|
||||||
(
|
(
|
||||||
nBufferLayers, // nBufferLayers
|
nBufferLayers, // nBufferLayers
|
||||||
globalToPatch_,
|
globalToMasterPatch_,
|
||||||
|
globalToSlavePatch_,
|
||||||
refineParams.keepPoints()[0]
|
refineParams.keepPoints()[0]
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -521,7 +524,8 @@ void Foam::autoRefineDriver::baffleAndSplitMesh
|
|||||||
!handleSnapProblems, // merge free standing baffles?
|
!handleSnapProblems, // merge free standing baffles?
|
||||||
motionDict,
|
motionDict,
|
||||||
const_cast<Time&>(mesh.time()),
|
const_cast<Time&>(mesh.time()),
|
||||||
globalToPatch_,
|
globalToMasterPatch_,
|
||||||
|
globalToSlavePatch_,
|
||||||
refineParams.keepPoints()[0]
|
refineParams.keepPoints()[0]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -606,7 +610,8 @@ void Foam::autoRefineDriver::splitAndMergeBaffles
|
|||||||
//true, // merge free standing baffles?
|
//true, // merge free standing baffles?
|
||||||
motionDict,
|
motionDict,
|
||||||
const_cast<Time&>(mesh.time()),
|
const_cast<Time&>(mesh.time()),
|
||||||
globalToPatch_,
|
globalToMasterPatch_,
|
||||||
|
globalToSlavePatch_,
|
||||||
refineParams.keepPoints()[0]
|
refineParams.keepPoints()[0]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -65,7 +65,10 @@ class autoRefineDriver
|
|||||||
fvMeshDistribute& distributor_;
|
fvMeshDistribute& distributor_;
|
||||||
|
|
||||||
//- From surface region to patch
|
//- From surface region to patch
|
||||||
const labelList globalToPatch_;
|
const labelList globalToMasterPatch_;
|
||||||
|
|
||||||
|
//- From surface region to patch
|
||||||
|
const labelList globalToSlavePatch_;
|
||||||
|
|
||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
@ -146,7 +149,8 @@ public:
|
|||||||
meshRefinement& meshRefiner,
|
meshRefinement& meshRefiner,
|
||||||
decompositionMethod& decomposer,
|
decompositionMethod& decomposer,
|
||||||
fvMeshDistribute& distributor,
|
fvMeshDistribute& distributor,
|
||||||
const labelList& globalToPatch
|
const labelList& globalToMasterPatch,
|
||||||
|
const labelList& globalToSlavePatch
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -573,11 +573,13 @@ bool Foam::autoSnapDriver::outwardsDisplacement
|
|||||||
Foam::autoSnapDriver::autoSnapDriver
|
Foam::autoSnapDriver::autoSnapDriver
|
||||||
(
|
(
|
||||||
meshRefinement& meshRefiner,
|
meshRefinement& meshRefiner,
|
||||||
const labelList& globalToPatch
|
const labelList& globalToMasterPatch,
|
||||||
|
const labelList& globalToSlavePatch
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
meshRefiner_(meshRefiner),
|
meshRefiner_(meshRefiner),
|
||||||
globalToPatch_(globalToPatch)
|
globalToMasterPatch_(globalToMasterPatch),
|
||||||
|
globalToSlavePatch_(globalToSlavePatch)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -1191,7 +1193,7 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::autoSnapDriver::repatchToSurface
|
|||||||
|
|
||||||
if (hitSurface[i] != -1 && !isZonedFace.get(faceI))
|
if (hitSurface[i] != -1 && !isZonedFace.get(faceI))
|
||||||
{
|
{
|
||||||
closestPatch[i] = globalToPatch_
|
closestPatch[i] = globalToMasterPatch_
|
||||||
[
|
[
|
||||||
surfaces.globalRegion
|
surfaces.globalRegion
|
||||||
(
|
(
|
||||||
@ -1265,7 +1267,12 @@ void Foam::autoSnapDriver::doSnap
|
|||||||
// Create baffles (pairs of faces that share the same points)
|
// Create baffles (pairs of faces that share the same points)
|
||||||
// Baffles stored as owner and neighbour face that have been created.
|
// Baffles stored as owner and neighbour face that have been created.
|
||||||
List<labelPair> baffles;
|
List<labelPair> baffles;
|
||||||
meshRefiner_.createZoneBaffles(globalToPatch_, baffles);
|
meshRefiner_.createZoneBaffles
|
||||||
|
(
|
||||||
|
globalToMasterPatch_,
|
||||||
|
globalToSlavePatch_,
|
||||||
|
baffles
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
// Selectively 'forget' about the baffles, i.e. not check across them
|
// Selectively 'forget' about the baffles, i.e. not check across them
|
||||||
|
|||||||
@ -59,8 +59,11 @@ class autoSnapDriver
|
|||||||
//- Mesh+surface
|
//- Mesh+surface
|
||||||
meshRefinement& meshRefiner_;
|
meshRefinement& meshRefiner_;
|
||||||
|
|
||||||
//- From surface region to patch
|
//- From global surface region to master side patch
|
||||||
const labelList globalToPatch_;
|
const labelList globalToMasterPatch_;
|
||||||
|
|
||||||
|
//- From global surface region to slave side patch
|
||||||
|
const labelList globalToSlavePatch_;
|
||||||
|
|
||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
@ -390,7 +393,8 @@ public:
|
|||||||
autoSnapDriver
|
autoSnapDriver
|
||||||
(
|
(
|
||||||
meshRefinement& meshRefiner,
|
meshRefinement& meshRefiner,
|
||||||
const labelList& globalToPatch
|
const labelList& globalToMasterPatch,
|
||||||
|
const labelList& globalToSlavePatch
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -573,7 +573,7 @@ void Foam::autoSnapDriver::calcNearestFacePointProperties
|
|||||||
pFc[i] = pp.faceCentres()[faceI];
|
pFc[i] = pp.faceCentres()[faceI];
|
||||||
//label meshFaceI = pp.addressing()[faceI];
|
//label meshFaceI = pp.addressing()[faceI];
|
||||||
//pFid[i] = mesh.boundaryMesh().whichPatch(meshFaceI);
|
//pFid[i] = mesh.boundaryMesh().whichPatch(meshFaceI);
|
||||||
pFid[i] = globalToPatch_[faceSurfaceGlobalRegion[faceI]];
|
pFid[i] = globalToMasterPatch_[faceSurfaceGlobalRegion[faceI]];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -55,6 +55,7 @@ License
|
|||||||
#include "searchableSurfaces.H"
|
#include "searchableSurfaces.H"
|
||||||
#include "treeBoundBox.H"
|
#include "treeBoundBox.H"
|
||||||
#include "zeroGradientFvPatchFields.H"
|
#include "zeroGradientFvPatchFields.H"
|
||||||
|
#include "fvMeshTools.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -1700,7 +1701,7 @@ Foam::label Foam::meshRefinement::addPatch
|
|||||||
oldToNew[addedPatchI] = insertPatchI;
|
oldToNew[addedPatchI] = insertPatchI;
|
||||||
|
|
||||||
// Shuffle into place
|
// Shuffle into place
|
||||||
polyPatches.reorder(oldToNew);
|
polyPatches.reorder(oldToNew, true);
|
||||||
fvPatches.reorder(oldToNew);
|
fvPatches.reorder(oldToNew);
|
||||||
|
|
||||||
reorderPatchFields<volScalarField>(mesh, oldToNew);
|
reorderPatchFields<volScalarField>(mesh, oldToNew);
|
||||||
@ -1736,6 +1737,28 @@ Foam::label Foam::meshRefinement::addMeshedPatch
|
|||||||
// Add patch
|
// Add patch
|
||||||
label patchI = addPatch(mesh_, name, patchInfo);
|
label patchI = addPatch(mesh_, name, patchInfo);
|
||||||
|
|
||||||
|
// dictionary patchDict(patchInfo);
|
||||||
|
// patchDict.set("nFaces", 0);
|
||||||
|
// patchDict.set("startFace", 0);
|
||||||
|
// autoPtr<polyPatch> ppPtr
|
||||||
|
// (
|
||||||
|
// polyPatch::New
|
||||||
|
// (
|
||||||
|
// name,
|
||||||
|
// patchDict,
|
||||||
|
// 0,
|
||||||
|
// mesh_.boundaryMesh()
|
||||||
|
// )
|
||||||
|
// );
|
||||||
|
// label patchI = fvMeshTools::addPatch
|
||||||
|
// (
|
||||||
|
// mesh_,
|
||||||
|
// ppPtr(),
|
||||||
|
// dictionary(), // optional field values
|
||||||
|
// calculatedFvPatchField<scalar>::typeName,
|
||||||
|
// true
|
||||||
|
// );
|
||||||
|
|
||||||
// Store
|
// Store
|
||||||
label sz = meshedPatches_.size();
|
label sz = meshedPatches_.size();
|
||||||
meshedPatches_.setSize(sz+1);
|
meshedPatches_.setSize(sz+1);
|
||||||
|
|||||||
@ -330,10 +330,11 @@ private:
|
|||||||
// Baffle handling
|
// Baffle handling
|
||||||
|
|
||||||
//- Get faces to repatch. Returns map from face to patch.
|
//- Get faces to repatch. Returns map from face to patch.
|
||||||
Map<label> getZoneBafflePatches
|
Map<labelPair> getZoneBafflePatches
|
||||||
(
|
(
|
||||||
const bool allowBoundary,
|
const bool allowBoundary,
|
||||||
const labelList& globalToPatch
|
const labelList& globalToMasterPatch,
|
||||||
|
const labelList& globalToSlavePatch
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Geometric test on see whether face needs to be baffled:
|
//- Geometric test on see whether face needs to be baffled:
|
||||||
@ -349,7 +350,7 @@ private:
|
|||||||
//- Determine patches for baffles
|
//- Determine patches for baffles
|
||||||
void getBafflePatches
|
void getBafflePatches
|
||||||
(
|
(
|
||||||
const labelList& globalToPatch,
|
const labelList& globalToMasterPatch,
|
||||||
const labelList& neiLevel,
|
const labelList& neiLevel,
|
||||||
const pointField& neiCc,
|
const pointField& neiCc,
|
||||||
labelList& ownPatch,
|
labelList& ownPatch,
|
||||||
@ -426,7 +427,7 @@ private:
|
|||||||
const dictionary& motionDict,
|
const dictionary& motionDict,
|
||||||
const bool removeEdgeConnectedCells,
|
const bool removeEdgeConnectedCells,
|
||||||
const scalarField& perpendicularAngle,
|
const scalarField& perpendicularAngle,
|
||||||
const labelList& globalToPatch
|
const labelList& globalToMasterPatch
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
|
|
||||||
@ -707,7 +708,8 @@ public:
|
|||||||
const bool mergeFreeStanding,
|
const bool mergeFreeStanding,
|
||||||
const dictionary& motionDict,
|
const dictionary& motionDict,
|
||||||
Time& runTime,
|
Time& runTime,
|
||||||
const labelList& globalToPatch,
|
const labelList& globalToMasterPatch,
|
||||||
|
const labelList& globalToSlavePatch,
|
||||||
const point& keepPoint
|
const point& keepPoint
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -716,7 +718,8 @@ public:
|
|||||||
autoPtr<mapPolyMesh> splitMesh
|
autoPtr<mapPolyMesh> splitMesh
|
||||||
(
|
(
|
||||||
const label nBufferLayers,
|
const label nBufferLayers,
|
||||||
const labelList& globalToPatch,
|
const labelList& globalToMasterPatch,
|
||||||
|
const labelList& globalToSlavePatch,
|
||||||
const point& keepPoint
|
const point& keepPoint
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -741,7 +744,8 @@ public:
|
|||||||
// baffles.
|
// baffles.
|
||||||
autoPtr<mapPolyMesh> createZoneBaffles
|
autoPtr<mapPolyMesh> createZoneBaffles
|
||||||
(
|
(
|
||||||
const labelList& globalToPatch,
|
const labelList& globalToMasterPatch,
|
||||||
|
const labelList& globalToSlavePatch,
|
||||||
List<labelPair>&
|
List<labelPair>&
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@ -259,7 +259,7 @@ bool Foam::meshRefinement::validBaffleTopology
|
|||||||
// Determine patches for baffles on all intersected unnamed faces
|
// Determine patches for baffles on all intersected unnamed faces
|
||||||
void Foam::meshRefinement::getBafflePatches
|
void Foam::meshRefinement::getBafflePatches
|
||||||
(
|
(
|
||||||
const labelList& globalToPatch,
|
const labelList& globalToMasterPatch,
|
||||||
const labelList& neiLevel,
|
const labelList& neiLevel,
|
||||||
const pointField& neiCc,
|
const pointField& neiCc,
|
||||||
|
|
||||||
@ -376,11 +376,11 @@ void Foam::meshRefinement::getBafflePatches
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Pick up the patches
|
// Pick up the patches
|
||||||
ownPatch[faceI] = globalToPatch
|
ownPatch[faceI] = globalToMasterPatch
|
||||||
[
|
[
|
||||||
surfaces_.globalRegion(surface1[i], region1[i])
|
surfaces_.globalRegion(surface1[i], region1[i])
|
||||||
];
|
];
|
||||||
neiPatch[faceI] = globalToPatch
|
neiPatch[faceI] = globalToMasterPatch
|
||||||
[
|
[
|
||||||
surfaces_.globalRegion(surface2[i], region2[i])
|
surfaces_.globalRegion(surface2[i], region2[i])
|
||||||
];
|
];
|
||||||
@ -406,14 +406,14 @@ void Foam::meshRefinement::getBafflePatches
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Get faces to repatch. Returns map from face to patch.
|
Foam::Map<Foam::labelPair> Foam::meshRefinement::getZoneBafflePatches
|
||||||
Foam::Map<Foam::label> Foam::meshRefinement::getZoneBafflePatches
|
|
||||||
(
|
(
|
||||||
const bool allowBoundary,
|
const bool allowBoundary,
|
||||||
const labelList& globalToPatch
|
const labelList& globalToMasterPatch,
|
||||||
|
const labelList& globalToSlavePatch
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
Map<label> bafflePatch(mesh_.nFaces()/1000);
|
Map<labelPair> bafflePatch(mesh_.nFaces()/1000);
|
||||||
|
|
||||||
const wordList& faceZoneNames = surfaces_.faceZoneNames();
|
const wordList& faceZoneNames = surfaces_.faceZoneNames();
|
||||||
const faceZoneMesh& fZones = mesh_.faceZones();
|
const faceZoneMesh& fZones = mesh_.faceZones();
|
||||||
@ -427,40 +427,39 @@ Foam::Map<Foam::label> Foam::meshRefinement::getZoneBafflePatches
|
|||||||
|
|
||||||
const faceZone& fZone = fZones[zoneI];
|
const faceZone& fZone = fZones[zoneI];
|
||||||
|
|
||||||
//// Get patch allocated for zone
|
// Get patch allocated for zone
|
||||||
//label patchI = surfaceToCyclicPatch_[surfI];
|
label globalRegionI = surfaces_.globalRegion(surfI, 0);
|
||||||
// Get patch of (first region) of surface
|
labelPair zPatches
|
||||||
label patchI = globalToPatch[surfaces_.globalRegion(surfI, 0)];
|
(
|
||||||
|
globalToMasterPatch[globalRegionI],
|
||||||
|
globalToSlavePatch[globalRegionI]
|
||||||
|
);
|
||||||
|
|
||||||
Info<< "For surface "
|
Info<< "For zone " << fZone.name() << " found patches "
|
||||||
<< surfaces_.names()[surfI]
|
<< mesh_.boundaryMesh()[zPatches[0]].name() << " and "
|
||||||
<< " found faceZone " << fZone.name()
|
<< mesh_.boundaryMesh()[zPatches[1]].name()
|
||||||
<< " and patch " << mesh_.boundaryMesh()[patchI].name()
|
|
||||||
<< endl;
|
<< endl;
|
||||||
|
|
||||||
|
|
||||||
forAll(fZone, i)
|
forAll(fZone, i)
|
||||||
{
|
{
|
||||||
label faceI = fZone[i];
|
label faceI = fZone[i];
|
||||||
|
|
||||||
if (allowBoundary || mesh_.isInternalFace(faceI))
|
if (allowBoundary || mesh_.isInternalFace(faceI))
|
||||||
{
|
{
|
||||||
if (!bafflePatch.insert(faceI, patchI))
|
labelPair patches = zPatches;
|
||||||
|
if (fZone.flipMap()[i])
|
||||||
{
|
{
|
||||||
label oldPatchI = bafflePatch[faceI];
|
patches = patches.reversePair();
|
||||||
|
}
|
||||||
|
|
||||||
if (oldPatchI != patchI)
|
if (!bafflePatch.insert(faceI, patches))
|
||||||
{
|
{
|
||||||
FatalErrorIn("getZoneBafflePatches(const bool)")
|
FatalErrorIn("getZoneBafflePatches(..)")
|
||||||
<< "Face " << faceI
|
<< "Face " << faceI
|
||||||
<< " fc:" << mesh_.faceCentres()[faceI]
|
<< " fc:" << mesh_.faceCentres()[faceI]
|
||||||
<< " in zone " << fZone.name()
|
<< " in zone " << fZone.name()
|
||||||
<< " is in patch "
|
<< " is in multiple zones!"
|
||||||
<< mesh_.boundaryMesh()[oldPatchI].name()
|
<< abort(FatalError);
|
||||||
<< " and in patch "
|
|
||||||
<< mesh_.boundaryMesh()[patchI].name()
|
|
||||||
<< abort(FatalError);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -698,7 +697,8 @@ Foam::List<Foam::labelPair> Foam::meshRefinement::getDuplicateFaces
|
|||||||
|
|
||||||
Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::createZoneBaffles
|
Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::createZoneBaffles
|
||||||
(
|
(
|
||||||
const labelList& globalToPatch,
|
const labelList& globalToMasterPatch,
|
||||||
|
const labelList& globalToSlavePatch,
|
||||||
List<labelPair>& baffles
|
List<labelPair>& baffles
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -714,20 +714,30 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::createZoneBaffles
|
|||||||
|
|
||||||
// Get faces (internal only) to be baffled. Map from face to patch
|
// Get faces (internal only) to be baffled. Map from face to patch
|
||||||
// label.
|
// label.
|
||||||
Map<label> faceToPatch(getZoneBafflePatches(false, globalToPatch));
|
Map<labelPair> faceToPatch
|
||||||
|
(
|
||||||
|
getZoneBafflePatches
|
||||||
|
(
|
||||||
|
false,
|
||||||
|
globalToMasterPatch,
|
||||||
|
globalToSlavePatch
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
label nZoneFaces = returnReduce(faceToPatch.size(), sumOp<label>());
|
label nZoneFaces = returnReduce(faceToPatch.size(), sumOp<label>());
|
||||||
if (nZoneFaces > 0)
|
if (nZoneFaces > 0)
|
||||||
{
|
{
|
||||||
// Convert into labelLists
|
// Convert into labelLists
|
||||||
labelList ownPatch(mesh_.nFaces(), -1);
|
labelList ownPatch(mesh_.nFaces(), -1);
|
||||||
forAllConstIter(Map<label>, faceToPatch, iter)
|
labelList neiPatch(mesh_.nFaces(), -1);
|
||||||
|
forAllConstIter(Map<labelPair>, faceToPatch, iter)
|
||||||
{
|
{
|
||||||
ownPatch[iter.key()] = iter();
|
ownPatch[iter.key()] = iter().first();
|
||||||
|
neiPatch[iter.key()] = iter().second();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create baffles. both sides same patch.
|
// Create baffles. both sides same patch.
|
||||||
map = createBaffles(ownPatch, ownPatch);
|
map = createBaffles(ownPatch, neiPatch);
|
||||||
|
|
||||||
// Get pairs of faces created.
|
// Get pairs of faces created.
|
||||||
// Just loop over faceMap and store baffle if we encounter a slave
|
// Just loop over faceMap and store baffle if we encounter a slave
|
||||||
@ -744,7 +754,10 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::createZoneBaffles
|
|||||||
label oldFaceI = faceMap[faceI];
|
label oldFaceI = faceMap[faceI];
|
||||||
|
|
||||||
// Does face originate from face-to-patch
|
// Does face originate from face-to-patch
|
||||||
Map<label>::const_iterator iter = faceToPatch.find(oldFaceI);
|
Map<labelPair>::const_iterator iter = faceToPatch.find
|
||||||
|
(
|
||||||
|
oldFaceI
|
||||||
|
);
|
||||||
|
|
||||||
if (iter != faceToPatch.end())
|
if (iter != faceToPatch.end())
|
||||||
{
|
{
|
||||||
@ -1344,7 +1357,8 @@ void Foam::meshRefinement::findCellZoneGeometric
|
|||||||
// Sync
|
// Sync
|
||||||
syncTools::syncFaceList(mesh_, namedSurfaceIndex, maxEqOp<label>());
|
syncTools::syncFaceList(mesh_, namedSurfaceIndex, maxEqOp<label>());
|
||||||
}
|
}
|
||||||
//XXXXXXXXX
|
|
||||||
|
|
||||||
void Foam::meshRefinement::findCellZoneInsideWalk
|
void Foam::meshRefinement::findCellZoneInsideWalk
|
||||||
(
|
(
|
||||||
const labelList& locationSurfaces, // indices of surfaces with inside point
|
const labelList& locationSurfaces, // indices of surfaces with inside point
|
||||||
@ -1446,7 +1460,6 @@ void Foam::meshRefinement::findCellZoneInsideWalk
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//XXXXXXXXX
|
|
||||||
|
|
||||||
|
|
||||||
bool Foam::meshRefinement::calcRegionToZone
|
bool Foam::meshRefinement::calcRegionToZone
|
||||||
@ -1827,7 +1840,8 @@ void Foam::meshRefinement::baffleAndSplitMesh
|
|||||||
const bool mergeFreeStanding,
|
const bool mergeFreeStanding,
|
||||||
const dictionary& motionDict,
|
const dictionary& motionDict,
|
||||||
Time& runTime,
|
Time& runTime,
|
||||||
const labelList& globalToPatch,
|
const labelList& globalToMasterPatch,
|
||||||
|
const labelList& globalToSlavePatch,
|
||||||
const point& keepPoint
|
const point& keepPoint
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -1849,7 +1863,7 @@ void Foam::meshRefinement::baffleAndSplitMesh
|
|||||||
labelList ownPatch, neiPatch;
|
labelList ownPatch, neiPatch;
|
||||||
getBafflePatches
|
getBafflePatches
|
||||||
(
|
(
|
||||||
globalToPatch,
|
globalToMasterPatch,
|
||||||
neiLevel,
|
neiLevel,
|
||||||
neiCc,
|
neiCc,
|
||||||
|
|
||||||
@ -1899,7 +1913,7 @@ void Foam::meshRefinement::baffleAndSplitMesh
|
|||||||
motionDict,
|
motionDict,
|
||||||
removeEdgeConnectedCells,
|
removeEdgeConnectedCells,
|
||||||
perpendicularAngle,
|
perpendicularAngle,
|
||||||
globalToPatch
|
globalToMasterPatch
|
||||||
)
|
)
|
||||||
//markFacesOnProblemCellsGeometric(motionDict)
|
//markFacesOnProblemCellsGeometric(motionDict)
|
||||||
);
|
);
|
||||||
@ -1917,7 +1931,7 @@ void Foam::meshRefinement::baffleAndSplitMesh
|
|||||||
motionDict,
|
motionDict,
|
||||||
removeEdgeConnectedCells,
|
removeEdgeConnectedCells,
|
||||||
perpendicularAngle,
|
perpendicularAngle,
|
||||||
globalToPatch
|
globalToMasterPatch
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
forAll(facePatchTopo, faceI)
|
forAll(facePatchTopo, faceI)
|
||||||
@ -2051,7 +2065,8 @@ void Foam::meshRefinement::baffleAndSplitMesh
|
|||||||
Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::splitMesh
|
Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::splitMesh
|
||||||
(
|
(
|
||||||
const label nBufferLayers,
|
const label nBufferLayers,
|
||||||
const labelList& globalToPatch,
|
const labelList& globalToMasterPatch,
|
||||||
|
const labelList& globalToSlavePatch,
|
||||||
const point& keepPoint
|
const point& keepPoint
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -2066,7 +2081,7 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::splitMesh
|
|||||||
labelList ownPatch, neiPatch;
|
labelList ownPatch, neiPatch;
|
||||||
getBafflePatches
|
getBafflePatches
|
||||||
(
|
(
|
||||||
globalToPatch,
|
globalToMasterPatch,
|
||||||
neiLevel,
|
neiLevel,
|
||||||
neiCc,
|
neiCc,
|
||||||
|
|
||||||
@ -2129,9 +2144,9 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::splitMesh
|
|||||||
|
|
||||||
// Patch for exposed faces for lack of anything sensible.
|
// Patch for exposed faces for lack of anything sensible.
|
||||||
label defaultPatch = 0;
|
label defaultPatch = 0;
|
||||||
if (globalToPatch.size())
|
if (globalToMasterPatch.size())
|
||||||
{
|
{
|
||||||
defaultPatch = globalToPatch[0];
|
defaultPatch = globalToMasterPatch[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
for (label i = 0; i < nBufferLayers; i++)
|
for (label i = 0; i < nBufferLayers; i++)
|
||||||
|
|||||||
Reference in New Issue
Block a user