REVERT: surfaceSimplify: Use background mesh to start surfaceSimplify

This commit is contained in:
laurence
2013-08-12 11:12:16 +01:00
parent 967b042197
commit e7388fefb8

View File

@ -723,111 +723,112 @@ int main(int argc, char *argv[])
autoPtr<fvMesh> meshPtr; autoPtr<fvMesh> meshPtr;
if (surfaceSimplify) // if (surfaceSimplify)
{ // {
IOdictionary foamyHexMeshDict // IOdictionary foamyHexMeshDict
( // (
IOobject // IOobject
( // (
"foamyHexMeshDict", // "foamyHexMeshDict",
runTime.system(), // runTime.system(),
runTime, // runTime,
IOobject::MUST_READ_IF_MODIFIED, // IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE // IOobject::NO_WRITE
) // )
); // );
//
const dictionary& motionDict = // const dictionary& motionDict =
foamyHexMeshDict.subDict("motionControl"); // foamyHexMeshDict.subDict("motionControl");
//
const scalar defaultCellSize = // const scalar defaultCellSize =
readScalar(motionDict.lookup("defaultCellSize")); // readScalar(motionDict.lookup("defaultCellSize"));
//
Info<< "Constructing single cell mesh from boundBox" << nl << endl; // Info<< "Constructing single cell mesh from boundBox" << nl << endl;
//
boundBox bb(args.optionRead<boundBox>("surfaceSimplify")); // boundBox bb(args.optionRead<boundBox>("surfaceSimplify"));
//
labelList owner(6, label(0)); // labelList owner(6, label(0));
labelList neighbour(0); // labelList neighbour(0);
//
const cellModel& hexa = *(cellModeller::lookup("hex")); // const cellModel& hexa = *(cellModeller::lookup("hex"));
faceList faces = hexa.modelFaces(); // faceList faces = hexa.modelFaces();
//
meshPtr.set // meshPtr.set
( // (
new fvMesh // new fvMesh
( // (
IOobject // IOobject
( // (
fvMesh::defaultRegion, // fvMesh::defaultRegion,
runTime.timeName(), // runTime.timeName(),
runTime, // runTime,
IOobject::NO_READ // IOobject::NO_READ
), // ),
xferMove<Field<vector> >(bb.points()()), // xferMove<Field<vector> >(bb.points()()),
faces.xfer(), // faces.xfer(),
owner.xfer(), // owner.xfer(),
neighbour.xfer() // neighbour.xfer()
) // )
); // );
//
List<polyPatch*> patches(1); // List<polyPatch*> patches(1);
//
patches[0] = new wallPolyPatch // patches[0] = new wallPolyPatch
( // (
"boundary", // "boundary",
6, // 6,
0, // 0,
0, // 0,
meshPtr().boundaryMesh(), // meshPtr().boundaryMesh(),
emptyPolyPatch::typeName // wallPolyPatch::typeName
); // );
//
meshPtr().addFvPatches(patches); // meshPtr().addFvPatches(patches);
//
const scalar initialCellSize = ::pow(meshPtr().V()[0], 1.0/3.0); // const scalar initialCellSize = ::pow(meshPtr().V()[0], 1.0/3.0);
const label initialRefLevels = // const label initialRefLevels =
::log(initialCellSize/defaultCellSize)/::log(2); // ::log(initialCellSize/defaultCellSize)/::log(2);
//
Info<< "Default cell size = " << defaultCellSize << endl; // Info<< "Default cell size = " << defaultCellSize << endl;
Info<< "Initial cell size = " << initialCellSize << endl; // Info<< "Initial cell size = " << initialCellSize << endl;
//
Info<< "Initial refinement levels = " << initialRefLevels << endl; // Info<< "Initial refinement levels = " << initialRefLevels << endl;
//
Info<< "Mesh starting size = " << meshPtr().nCells() << endl; // Info<< "Mesh starting size = " << meshPtr().nCells() << endl;
//
// meshCutter must be destroyed before writing the mesh otherwise it // // meshCutter must be destroyed before writing the mesh otherwise it
// writes the cellLevel/pointLevel files // // writes the cellLevel/pointLevel files
{ // {
hexRef8 meshCutter(meshPtr(), false); // hexRef8 meshCutter(meshPtr(), false);
//
for (label refineI = 0; refineI < initialRefLevels; ++refineI) // for (label refineI = 0; refineI < initialRefLevels; ++refineI)
{ // {
// Mesh changing engine. // // Mesh changing engine.
polyTopoChange meshMod(meshPtr(), true); // polyTopoChange meshMod(meshPtr(), true);
//
// Play refinement commands into mesh changer. // // Play refinement commands into mesh changer.
meshCutter.setRefinement(identity(meshPtr().nCells()), meshMod); // meshCutter.setRefinement(identity(meshPtr().nCells()), meshMod);
//
// Create mesh (no inflation), return map from old to new mesh. // // Create mesh (no inflation), return map from old to new mesh.
autoPtr<mapPolyMesh> map = meshMod.changeMesh(meshPtr(), false); // autoPtr<mapPolyMesh> map = meshMod.changeMesh(meshPtr(), false);
//
// Update fields // // Update fields
meshPtr().updateMesh(map); // meshPtr().updateMesh(map);
//
// Delete mesh volumes. // // Delete mesh volumes.
meshPtr().clearOut(); // meshPtr().clearOut();
//
Info<< "Refinement Iteration " << refineI + 1 // Info<< "Refinement Iteration " << refineI + 1
<< ", Mesh size = " << meshPtr().nCells() << endl; // << ", Mesh size = " << meshPtr().nCells() << endl;
} // }
} // }
//
Info<< "Mesh end size = " << meshPtr().nCells() << endl; // Info<< "Mesh end size = " << meshPtr().nCells() << endl;
//
meshPtr().write(); // Info<< "Create mesh" << endl;
} // meshPtr().write();
else // }
// else
{ {
Foam::Info Foam::Info
<< "Create mesh for time = " << "Create mesh for time = "