From e7388fefb8413e989a7fa88537fc016888a3688b Mon Sep 17 00:00:00 2001 From: laurence Date: Mon, 12 Aug 2013 11:12:16 +0100 Subject: [PATCH] REVERT: surfaceSimplify: Use background mesh to start surfaceSimplify --- .../generation/snappyHexMesh/snappyHexMesh.C | 211 +++++++++--------- 1 file changed, 106 insertions(+), 105 deletions(-) diff --git a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C index 688b4ac71e..4ecebb86d2 100644 --- a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C +++ b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C @@ -723,111 +723,112 @@ int main(int argc, char *argv[]) autoPtr meshPtr; - if (surfaceSimplify) - { - IOdictionary foamyHexMeshDict - ( - IOobject - ( - "foamyHexMeshDict", - runTime.system(), - runTime, - IOobject::MUST_READ_IF_MODIFIED, - IOobject::NO_WRITE - ) - ); - - const dictionary& motionDict = - foamyHexMeshDict.subDict("motionControl"); - - const scalar defaultCellSize = - readScalar(motionDict.lookup("defaultCellSize")); - - Info<< "Constructing single cell mesh from boundBox" << nl << endl; - - boundBox bb(args.optionRead("surfaceSimplify")); - - labelList owner(6, label(0)); - labelList neighbour(0); - - const cellModel& hexa = *(cellModeller::lookup("hex")); - faceList faces = hexa.modelFaces(); - - meshPtr.set - ( - new fvMesh - ( - IOobject - ( - fvMesh::defaultRegion, - runTime.timeName(), - runTime, - IOobject::NO_READ - ), - xferMove >(bb.points()()), - faces.xfer(), - owner.xfer(), - neighbour.xfer() - ) - ); - - List patches(1); - - patches[0] = new wallPolyPatch - ( - "boundary", - 6, - 0, - 0, - meshPtr().boundaryMesh(), - emptyPolyPatch::typeName - ); - - meshPtr().addFvPatches(patches); - - const scalar initialCellSize = ::pow(meshPtr().V()[0], 1.0/3.0); - const label initialRefLevels = - ::log(initialCellSize/defaultCellSize)/::log(2); - - Info<< "Default cell size = " << defaultCellSize << endl; - Info<< "Initial cell size = " << initialCellSize << endl; - - Info<< "Initial refinement levels = " << initialRefLevels << endl; - - Info<< "Mesh starting size = " << meshPtr().nCells() << endl; - - // meshCutter must be destroyed before writing the mesh otherwise it - // writes the cellLevel/pointLevel files - { - hexRef8 meshCutter(meshPtr(), false); - - for (label refineI = 0; refineI < initialRefLevels; ++refineI) - { - // Mesh changing engine. - polyTopoChange meshMod(meshPtr(), true); - - // Play refinement commands into mesh changer. - meshCutter.setRefinement(identity(meshPtr().nCells()), meshMod); - - // Create mesh (no inflation), return map from old to new mesh. - autoPtr map = meshMod.changeMesh(meshPtr(), false); - - // Update fields - meshPtr().updateMesh(map); - - // Delete mesh volumes. - meshPtr().clearOut(); - - Info<< "Refinement Iteration " << refineI + 1 - << ", Mesh size = " << meshPtr().nCells() << endl; - } - } - - Info<< "Mesh end size = " << meshPtr().nCells() << endl; - - meshPtr().write(); - } - else +// if (surfaceSimplify) +// { +// IOdictionary foamyHexMeshDict +// ( +// IOobject +// ( +// "foamyHexMeshDict", +// runTime.system(), +// runTime, +// IOobject::MUST_READ_IF_MODIFIED, +// IOobject::NO_WRITE +// ) +// ); +// +// const dictionary& motionDict = +// foamyHexMeshDict.subDict("motionControl"); +// +// const scalar defaultCellSize = +// readScalar(motionDict.lookup("defaultCellSize")); +// +// Info<< "Constructing single cell mesh from boundBox" << nl << endl; +// +// boundBox bb(args.optionRead("surfaceSimplify")); +// +// labelList owner(6, label(0)); +// labelList neighbour(0); +// +// const cellModel& hexa = *(cellModeller::lookup("hex")); +// faceList faces = hexa.modelFaces(); +// +// meshPtr.set +// ( +// new fvMesh +// ( +// IOobject +// ( +// fvMesh::defaultRegion, +// runTime.timeName(), +// runTime, +// IOobject::NO_READ +// ), +// xferMove >(bb.points()()), +// faces.xfer(), +// owner.xfer(), +// neighbour.xfer() +// ) +// ); +// +// List patches(1); +// +// patches[0] = new wallPolyPatch +// ( +// "boundary", +// 6, +// 0, +// 0, +// meshPtr().boundaryMesh(), +// wallPolyPatch::typeName +// ); +// +// meshPtr().addFvPatches(patches); +// +// const scalar initialCellSize = ::pow(meshPtr().V()[0], 1.0/3.0); +// const label initialRefLevels = +// ::log(initialCellSize/defaultCellSize)/::log(2); +// +// Info<< "Default cell size = " << defaultCellSize << endl; +// Info<< "Initial cell size = " << initialCellSize << endl; +// +// Info<< "Initial refinement levels = " << initialRefLevels << endl; +// +// Info<< "Mesh starting size = " << meshPtr().nCells() << endl; +// +// // meshCutter must be destroyed before writing the mesh otherwise it +// // writes the cellLevel/pointLevel files +// { +// hexRef8 meshCutter(meshPtr(), false); +// +// for (label refineI = 0; refineI < initialRefLevels; ++refineI) +// { +// // Mesh changing engine. +// polyTopoChange meshMod(meshPtr(), true); +// +// // Play refinement commands into mesh changer. +// meshCutter.setRefinement(identity(meshPtr().nCells()), meshMod); +// +// // Create mesh (no inflation), return map from old to new mesh. +// autoPtr map = meshMod.changeMesh(meshPtr(), false); +// +// // Update fields +// meshPtr().updateMesh(map); +// +// // Delete mesh volumes. +// meshPtr().clearOut(); +// +// Info<< "Refinement Iteration " << refineI + 1 +// << ", Mesh size = " << meshPtr().nCells() << endl; +// } +// } +// +// Info<< "Mesh end size = " << meshPtr().nCells() << endl; +// +// Info<< "Create mesh" << endl; +// meshPtr().write(); +// } +// else { Foam::Info << "Create mesh for time = "