diff --git a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C index c5ebc807cc..e1f9707cd4 100644 --- a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C +++ b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C @@ -1082,7 +1082,7 @@ int main(int argc, char *argv[]) if (!limitDict.empty()) { - Info<< "Read refinement shells in = " + Info<< "Read limit shells in = " << mesh.time().cpuTimeIncrement() << " s" << nl << endl; } diff --git a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict index d2c3a1a690..ef6b70f424 100644 --- a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict +++ b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict @@ -49,6 +49,14 @@ geometry max (3.5 2 0.5); } + // Shell for directional refinement + wakeBox + { + type searchableBox; + min (1.5 1 -0.5); + max (3.5 2 0.5); + } + sphere.stl { type triSurfaceMesh; @@ -257,8 +265,8 @@ castellatedMeshControls // mode inside; // levels ((1.0 4)); // // Optional override of uniform refinement level such - // // that in small gaps we're getting more cells. - // // The specification is + // // that in small gaps we're getting more cells. + // // The specification is // // - numGapCells : minimum number of cells in the gap // // (usually >3; lower than this might not // // resolve correctly) @@ -275,9 +283,33 @@ castellatedMeshControls // // whilst doing the gap-level refinement. // //gapMode inside; // inside/outside/mixed //} + + //wakeBox + //{ + // mode inside; + // // Dummy base level + // levels ((10000 0)); + // + // // Optional directional refinement (after all other refinement) + // // Directional refinement + // // for all cells according to 'mode' ('inside' or 'outside'; + // // 'distance' not supported) and within certain range. E.g. + // // - for all cells with level 2-5 + // // - do one split in x direction + // levelIncrement (2 5 (1 0 0)); + // + // // Note + // // - ignores 'levels' and gap* settings. + // // - the cellLevel/pointLevels files are no longer consistent + // // with the mesh, the resulting mesh is no longer compatible + // // with e.g. dynamic refinement/unrefinement. + // // - cellLevel will include any directional refinement + // // (i.e. it will be the maximum of all three directions) + //} } + // Optionally limit refinement in geometric region. This limits all // refinement (from features, refinementSurfaces, refinementRegions) // in a given geometric region. The syntax is exactly the same as for the diff --git a/src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8/hexRef8.C b/src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8/hexRef8.C index 74dcafca1d..79c7e7446a 100644 --- a/src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8/hexRef8.C +++ b/src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8/hexRef8.C @@ -1564,6 +1564,7 @@ void Foam::hexRef8::walkFaceFromMid Foam::label Foam::hexRef8::faceConsistentRefinement ( const bool maxSet, + const labelUList& cellLevel, bitSet& refineCell ) const { @@ -1573,10 +1574,10 @@ Foam::label Foam::hexRef8::faceConsistentRefinement for (label facei = 0; facei < mesh_.nInternalFaces(); facei++) { label own = mesh_.faceOwner()[facei]; - label nei = mesh_.faceNeighbour()[facei]; + label ownLevel = cellLevel[own] + refineCell.get(own); - label ownLevel = cellLevel_[own] + refineCell.get(own); - label neiLevel = cellLevel_[nei] + refineCell.get(nei); + label nei = mesh_.faceNeighbour()[facei]; + label neiLevel = cellLevel[nei] + refineCell.get(nei); if (ownLevel > (neiLevel+1)) { @@ -1613,7 +1614,7 @@ Foam::label Foam::hexRef8::faceConsistentRefinement { label own = mesh_.faceOwner()[i+mesh_.nInternalFaces()]; - neiLevel[i] = cellLevel_[own] + refineCell.get(own); + neiLevel[i] = cellLevel[own] + refineCell.get(own); } // Swap to neighbour @@ -1623,7 +1624,7 @@ Foam::label Foam::hexRef8::faceConsistentRefinement forAll(neiLevel, i) { label own = mesh_.faceOwner()[i+mesh_.nInternalFaces()]; - label ownLevel = cellLevel_[own] + refineCell.get(own); + label ownLevel = cellLevel[own] + refineCell.get(own); if (ownLevel > (neiLevel[i]+1)) { @@ -1650,6 +1651,7 @@ Foam::label Foam::hexRef8::faceConsistentRefinement // Debug: check if wanted refinement is compatible with 2:1 void Foam::hexRef8::checkWantedRefinementLevels ( + const labelUList& cellLevel, const labelList& cellsToRefine ) const { @@ -1658,10 +1660,10 @@ void Foam::hexRef8::checkWantedRefinementLevels for (label facei = 0; facei < mesh_.nInternalFaces(); facei++) { label own = mesh_.faceOwner()[facei]; - label nei = mesh_.faceNeighbour()[facei]; + label ownLevel = cellLevel[own] + refineCell.get(own); - label ownLevel = cellLevel_[own] + refineCell.get(own); - label neiLevel = cellLevel_[nei] + refineCell.get(nei); + label nei = mesh_.faceNeighbour()[facei]; + label neiLevel = cellLevel[nei] + refineCell.get(nei); if (mag(ownLevel-neiLevel) > 1) { @@ -1669,11 +1671,11 @@ void Foam::hexRef8::checkWantedRefinementLevels dumpCell(nei); FatalErrorInFunction << "cell:" << own - << " current level:" << cellLevel_[own] + << " current level:" << cellLevel[own] << " level after refinement:" << ownLevel << nl << "neighbour cell:" << nei - << " current level:" << cellLevel_[nei] + << " current level:" << cellLevel[nei] << " level after refinement:" << neiLevel << nl << "which does not satisfy 2:1 constraints anymore." @@ -1689,7 +1691,7 @@ void Foam::hexRef8::checkWantedRefinementLevels { label own = mesh_.faceOwner()[i+mesh_.nInternalFaces()]; - neiLevel[i] = cellLevel_[own] + refineCell.get(own); + neiLevel[i] = cellLevel[own] + refineCell.get(own); } // Swap to neighbour @@ -1701,7 +1703,7 @@ void Foam::hexRef8::checkWantedRefinementLevels label facei = i + mesh_.nInternalFaces(); label own = mesh_.faceOwner()[facei]; - label ownLevel = cellLevel_[own] + refineCell.get(own); + label ownLevel = cellLevel[own] + refineCell.get(own); if (mag(ownLevel - neiLevel[i]) > 1) { @@ -1715,7 +1717,7 @@ void Foam::hexRef8::checkWantedRefinementLevels << " on patch " << patchi << " " << mesh_.boundaryMesh()[patchi].name() << " owner cell " << own - << " current level:" << cellLevel_[own] + << " current level:" << cellLevel[own] << " level after refinement:" << ownLevel << nl << " (coupled) neighbour cell will get refinement " @@ -2251,6 +2253,7 @@ Foam::hexRef8::hexRef8 Foam::labelList Foam::hexRef8::consistentRefinement ( + const labelUList& cellLevel, const labelList& cellsToRefine, const bool maxSet ) const @@ -2264,7 +2267,12 @@ Foam::labelList Foam::hexRef8::consistentRefinement while (true) { - label nChanged = faceConsistentRefinement(maxSet, refineCell); + label nChanged = faceConsistentRefinement + ( + maxSet, + cellLevel, + refineCell + ); reduce(nChanged, sumOp