diff --git a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C index bd655dc251..15be3f9c1d 100644 --- a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C +++ b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd. + \\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -33,12 +33,86 @@ Description #include "argList.H" #include "Time.H" #include "fvMesh.H" -#include "autoHexMeshDriver.H" +#include "autoRefineDriver.H" +#include "autoSnapDriver.H" +#include "autoLayerDriver.H" +#include "searchableSurfaces.H" +#include "refinementSurfaces.H" +#include "shellSurfaces.H" +#include "decompositionMethod.H" +#include "fvMeshDistribute.H" +#include "wallPolyPatch.H" +#include "refinementParameters.H" +#include "snapParameters.H" +#include "layerParameters.H" + using namespace Foam; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// Check writing tolerance before doing any serious work +scalar getMergeDistance(const polyMesh& mesh, const scalar mergeTol) +{ + const boundBox& meshBb = mesh.bounds(); + scalar mergeDist = mergeTol*mag(meshBb.max() - meshBb.min()); + scalar writeTol = std::pow + ( + scalar(10.0), + -scalar(IOstream::defaultPrecision()) + ); + + Info<< nl + << "Overall mesh bounding box : " << meshBb << nl + << "Relative tolerance : " << mergeTol << nl + << "Absolute matching distance : " << mergeDist << nl + << endl; + + if (mesh.time().writeFormat() == IOstream::ASCII && mergeTol < writeTol) + { + FatalErrorIn("getMergeDistance(const polyMesh&, const scalar)") + << "Your current settings specify ASCII writing with " + << IOstream::defaultPrecision() << " digits precision." << endl + << "Your merging tolerance (" << mergeTol << ") is finer than this." + << endl + << "Please change your writeFormat to binary" + << " or increase the writePrecision" << endl + << "or adjust the merge tolerance (-mergeTol)." + << exit(FatalError); + } + + return mergeDist; +} + + +// Write mesh and additional information +void writeMesh +( + const string& msg, + const meshRefinement& meshRefiner, + const label debug +) +{ + const fvMesh& mesh = meshRefiner.mesh(); + + meshRefiner.printMeshInfo(debug, msg); + Info<< "Writing mesh to time " << mesh.time().timeName() << endl; + + meshRefiner.write(meshRefinement::MESH|meshRefinement::SCALARLEVELS, ""); + if (debug & meshRefinement::OBJINTERSECTIONS) + { + meshRefiner.write + ( + meshRefinement::OBJINTERSECTIONS, + mesh.time().path()/mesh.time().timeName() + ); + } + Info<< "Written mesh in = " + << mesh.time().cpuTimeIncrement() << " s." << endl; +} + + + int main(int argc, char *argv[]) { # include "setRootCase.H" @@ -49,6 +123,11 @@ int main(int argc, char *argv[]) Info<< "Read mesh in = " << runTime.cpuTimeIncrement() << " s" << endl; + // Check patches and faceZones are synchronised + mesh.boundaryMesh().checkParallelSync(true); + meshRefinement::checkCoupledFaceZones(mesh); + + // Read decomposePar dictionary IOdictionary decomposeDict ( @@ -75,47 +154,282 @@ int main(int argc, char *argv[]) ) ); - // refinement parameters - const dictionary& refineDict = meshDict.subDict("refineDict"); + // all surface geometry + const dictionary& geometryDict = meshDict.subDict("geometry"); - // snap-to-surface parameters - const dictionary& snapDict = meshDict.subDict("snapDict"); + // refinement parameters + const dictionary& refineDict = meshDict.subDict("castellatedMeshControls"); // mesh motion and mesh quality parameters - const dictionary& motionDict = meshDict.subDict("motionDict"); + const dictionary& motionDict = meshDict.subDict("meshQualityControls"); + + // snap-to-surface parameters + const dictionary& snapDict = meshDict.subDict("snapControls"); // layer addition parameters - const dictionary& layerDict = meshDict.subDict("layerDict"); + const dictionary& layerDict = meshDict.subDict("addLayersControls"); - // Main meshing driver. Read surfaces. Determine initial intersections. - autoHexMeshDriver meshEngine + + // Debug + // ~~~~~ + + const label debug(readLabel(meshDict.lookup("debug"))); + if (debug > 0) + { + meshRefinement::debug = debug; + autoRefineDriver::debug = debug; + autoSnapDriver::debug = debug; + autoLayerDriver::debug = debug; + } + + + // Read geometry + // ~~~~~~~~~~~~~ + + searchableSurfaces allGeometry ( - mesh, - meshDict, // global control parameters - refineDict, // refinement parameters - decomposeDict + IOobject + ( + "abc", // dummy name + mesh.time().constant(), // directory + "triSurface", // instance + mesh.time(), // registry + IOobject::MUST_READ, + IOobject::NO_WRITE + ), + geometryDict ); - Switch wantRefine(meshDict.lookup("doRefine")); - Switch wantSnap(meshDict.lookup("doSnap")); - Switch wantLayers(meshDict.lookup("doLayers")); + + // Read refinement surfaces + // ~~~~~~~~~~~~~~~~~~~~~~~~ + + Info<< "Reading refinement surfaces." << endl; + refinementSurfaces surfaces + ( + allGeometry, + refineDict.subDict("refinementSurfaces") + ); + Info<< "Read refinement surfaces in = " + << mesh.time().cpuTimeIncrement() << " s" << nl << endl; + + + // Read refinement shells + // ~~~~~~~~~~~~~~~~~~~~~~ + + Info<< "Reading refinement shells." << endl; + shellSurfaces shells + ( + allGeometry, + refineDict.subDict("refinementRegions") + ); + Info<< "Read refinement shells in = " + << mesh.time().cpuTimeIncrement() << " s" << nl << endl; + + + Info<< "Setting refinement level of surface to be consistent" + << " with shells." << endl; + surfaces.setMinLevelFields(shells); + Info<< "Checked shell refinement in = " + << mesh.time().cpuTimeIncrement() << " s" << nl << endl; + + + + + // Add all the surface regions as patches + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + labelList globalToPatch; + { + Info<< nl + << "Adding patches for surface regions" << nl + << "----------------------------------" << nl + << endl; + + // From global region number to mesh patch. + globalToPatch.setSize(surfaces.nRegions(), -1); + + Info<< "Patch\tRegion" << nl + << "-----\t------" + << endl; + + const labelList& surfaceGeometry = surfaces.surfaces(); + forAll(surfaceGeometry, surfI) + { + label geomI = surfaceGeometry[surfI]; + + const wordList& regNames = allGeometry.regionNames()[geomI]; + + Info<< surfaces.names()[surfI] << ':' << nl << nl; + + forAll(regNames, i) + { + label patchI = meshRefinement::addPatch + ( + mesh, + regNames[i], + wallPolyPatch::typeName + ); + + Info<< patchI << '\t' << regNames[i] << nl; + + globalToPatch[surfaces.globalRegion(surfI, i)] = patchI; + } + + Info<< nl; + } + Info<< "Added patches in = " + << mesh.time().cpuTimeIncrement() << " s" << nl << endl; + } + + + // Parallel + // ~~~~~~~~ + + // Decomposition + autoPtr decomposerPtr + ( + decompositionMethod::New + ( + decomposeDict, + mesh + ) + ); + decompositionMethod& decomposer = decomposerPtr(); + + if (Pstream::parRun() && !decomposer.parallelAware()) + { + FatalErrorIn(args.executable()) + << "You have selected decomposition method " + << decomposer.typeName + << " which is not parallel aware." << endl + << "Please select one that is (hierarchical, parMetis)" + << exit(FatalError); + } + + const scalar mergeDist = getMergeDistance + ( + mesh, + readScalar(meshDict.lookup("mergeTolerance")) + ); + + + // Mesh distribution engine (uses tolerance to reconstruct meshes) + fvMeshDistribute distributor(mesh, mergeDist); + + + // Refinement engine + // ~~~~~~~~~~~~~~~~~ + + Info<< nl + << "Determining initial surface intersections" << nl + << "-----------------------------------------" << nl + << endl; + + // Main refinement engine + meshRefinement meshRefiner + ( + mesh, + mergeDist, // tolerance used in sorting coordinates + surfaces, // for surface intersection refinement + shells // for volume (inside/outside) refinement + ); + Info<< "Calculated surface intersections in = " + << mesh.time().cpuTimeIncrement() << " s" << nl << endl; + + // Some stats + meshRefiner.printMeshInfo(debug, "Initial mesh"); + + meshRefiner.write + ( + debug&meshRefinement::OBJINTERSECTIONS, + mesh.time().path()/mesh.time().timeName() + ); + + + + + // Now do the real work -refinement -snapping -layers + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + Switch wantRefine(meshDict.lookup("castellatedMesh")); + Switch wantSnap(meshDict.lookup("snap")); + Switch wantLayers(meshDict.lookup("addLayers")); if (wantRefine) { - meshEngine.doRefine(refineDict, wantSnap); + autoRefineDriver refineDriver + ( + meshRefiner, + decomposer, + distributor, + globalToPatch + ); + + // Refinement parameters + refinementParameters refineParams(refineDict); + + refineDriver.doRefine(refineDict, refineParams, wantSnap); + + writeMesh + ( + "Refined mesh", + meshRefiner, + debug + ); } if (wantSnap) { - meshEngine.doSnap(snapDict, motionDict); + autoSnapDriver snapDriver + ( + meshRefiner, + globalToPatch + ); + + // Snap parameters + snapParameters snapParams(snapDict); + + snapDriver.doSnap(snapDict, motionDict, snapParams); + + writeMesh + ( + "Snapped mesh", + meshRefiner, + debug + ); } if (wantLayers) { - meshEngine.doLayers(layerDict, motionDict); + autoLayerDriver layerDriver + ( + meshRefiner, + globalToPatch + ); + + // Layer addition parameters + layerParameters layerParams(layerDict, mesh.boundaryMesh()); + + layerDriver.doLayers + ( + layerDict, + motionDict, + layerParams, + decomposer, + distributor + ); + + writeMesh + ( + "Layer mesh", + meshRefiner, + debug + ); } + Info<< "Finished meshing in = " << runTime.elapsedCpuTime() << " s." << endl; diff --git a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict index e9aa8f189d..e97b1ee9a7 100644 --- a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict +++ b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict @@ -22,161 +22,171 @@ FoamFile // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -// Which phases to run. -doRefine true; -doSnap true; -doLayers true; // includes autoMergeFaces +// Which of the steps to run +castellatedMesh true; +snap true; +addLayers false; -// Whether to dump intermediate meshes and print lots -// 1 : write mesh -// 2 : write volScalarField with cellLevel for postprocessing -// 4 : write current intersections as .obj files -debug 0; - -refineDict +// Geometry. Definition of all surfaces. All surfaces are of class +// searchableSurface. +// Surfaces are used +// - to specify refinement for any mesh cell intersecting it +// - to specify refinement for any mesh cell inside/outside/near +// - to 'snap' the mesh boundary to the surface +geometry { - // Which part to keep. - // NOTE: This point should never be on a face, always inside a cell, even - // after refinement. - keepPoints ((3 0.28 0.43)); + box1x1x1 + { + type searchableBox; + min (1.5 1 -0.5); + max (3.5 2 0.5); + } - // Whether to remove/split cells likely to give problems when snapping - handleSnapProblems on; + sphere.stl + { + type triSurfaceMesh; - // Merge tolerance. Is fraction of overall bounding box of initial mesh - mergeTolerance 1E-6; + // Per region the patchname. If not provided will be _. + regions + { + secondSolid + { + name mySecondPatch; + } + } + } + + sphere2 + { + type searchableSphere; + centre (1.5 1.5 1.5); + radius 1.03; + } +}; + + + +// Settings for the castellatedMesh generation. +castellatedMeshControls +{ + + // Refinement parameters + // ~~~~~~~~~~~~~~~~~~~~~ // While refining maximum number of cells per processor. This is basically // the number of cells that fit on a processor. If you choose this too small // it will do just more refinement iterations to obtain a similar mesh. - procCellLimit 1000000; - + maxLocalCells 1000000; // Overall cell limit (approximately). Refinement will stop immediately // upon reaching this number so a refinement level might not complete. // Note that this is the number of cells before removing the part which - // is not 'visible' from the keepPoint. The final number of cells might actually - // be a lot less. - cellLimit 2000000; - + // is not 'visible' from the keepPoint. The final number of cells might + // actually be a lot less. + maxGlobalCells 2000000; // The surface refinement loop might spend lots of iterations refining just a // few cells. This setting will cause refinement to stop if <= minimumRefine // are selected for refinement. Note: it will at least do one iteration // (unless the number of cells to refine is 0) - minimumRefine 0; - - - + minRefinementCells 0; // Number of buffer layers between different levels. // 1 means normal 2:1 refinement restriction, larger means slower // refinement. - nBufferLayers 1; + nCellsBetweenLevels 1; - // Feature Edge Refinement - // ~~~~~~~~~~~~~~~~~~~~~~~ - // External feature file. Read from constant/triSurface for now. - // Limitations: - // - either start or edge of any feature line has to be inside domain - // and be visible from keepPoint on starting mesh. - // - refining cells containing features is separate phase before refining - // based on surface. - // - no load balancing, no check for cellLimit is done while doing this. + // Explicit feature edge refinement + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + // Specifies a level for any cell intersected by its edges. + // This is a featureEdgeMesh, read from constant/triSurface for now. features ( - // { - // file "someLine.eMesh"; - // level 2; - // } + //{ + // file "someLine.eMesh"; + // level 2; + //} ); - // Internal Mesh Refinement - // ~~~~~~~~~~~~~~~~~~~~~~~~ - - // Specifies the areas where the refinement has to be a certain level. - // These surfaces have to be closed. Refinement is either inside - // (refineInside = true) or outside. (note:insideness or outsideness - // is with respect to far away) - // Note:that even using these the transition can never be faster than - // nBufferLayers! - // Note:the refinement level can never be higher than any of the surfaces - // they overlap with. See below for the surface refinement level specification. - refinementShells - ( - { - //type triSurfaceMesh; - //name cube1x1x1.stl; - type searchableBox; - name box1x1x1; - min (2.5 -0.5 -0.5); - max (3.5 0.5 0.5); - - level 4; - refineInside true; - } - ); - // Surface based refinement // ~~~~~~~~~~~~~~~~~~~~~~~~ - // Curvature. Cosine of angle between two neighbouring surface intersections. - // Only used if cell level > minLevel and < maxLevel. - curvature 0.5; + // Specifies two levels for every surface. The first is the minimum level, + // every cell intersecting a surface gets refined up to the minimum level. + // The second level is the maximum level. Cells that 'see' multiple + // intersections where the intersections make an + // angle > resolveFeatureAngle get refined up to the maximum level. - - // Overall the refinement is according to the following rules: - // - if the cell-cell vector intersects a surface any cell that - // is less refined than the minRefinementLevel of the surface gets refined. - // - else if the refinement level of the cell is between the - // minRefinementLevel and maxRefinementLevel the cell gets refined if - // - the normal of neighbouring surface intersections differ by more - // than above curvature - // - or if neighbouring surface intersections are on different surfaces or - // different surface regions. - - - // surfaces - surfaces - ( + refinementSurfaces + { + sphere.stl { - name sphere; - file "sphere.stl"; - - // Surface wide refinement level - minRefinementLevel 1; - maxRefinementLevel 1; - - // Layers - surfaceLayers 1; - - // Region specific refinement level + // Surface-wise min and max refinement level + level (2 2); + + // Optional region-wise level specification regions - ( + { + secondSolid { - name firstSolid; - minRefinementLevel 3; - maxRefinementLevel 3; - surfaceLayers 2; + level (3 3); } - { - name secondSolid; - minRefinementLevel 1; - maxRefinementLevel 1; - surfaceLayers 1; - } - ); + } } - ); + } + + resolveFeatureAngle 30; + + + // Region-wise refinement + // ~~~~~~~~~~~~~~~~~~~~~~ + + // Specifies refinement level for cells in relation to a surface. One of + // three modes + // - distance. 'levels' specifies per distance to the surface the + // wanted refinement level. The distances need to be specified in + // descending order. + // - inside. 'levels' is only one entry and only the level is used. All + // cells inside the surface get refined up to the level. The surface + // needs to be closed for this to be possible. + // - outside. Same but cells outside. + + refinementRegions + { + box1x1x1 + { + mode inside; + levels ((1.0 4)); + } + //sphere.stl + //{ + // mode distance; + // levels ((1.0 5) (2.0 3)); + //} + } + + + // Mesh selection + // ~~~~~~~~~~~~~~ + + // After refinement patches get added for all refinementSurfaces and + // all cells intersecting the surfaces get put into these patches. The + // section reachable from the locationInMesh is kept. + // NOTE: This point should never be on a face, always inside a cell, even + // after refinement. + locationInMesh (5 0.28 0.43); } -// For snapping -snapDict + + +// Settings for the snapping. +snapControls { //- Number of patch smoothing iterations before finding correspondence // to surface @@ -185,47 +195,64 @@ snapDict //- Relative distance for points to be attracted by surface feature point // or edge. True distance is this factor times local // maximum edge length. - snapTol 4.0; + tolerance 4.0; - //- Whether to move internal mesh as well as boundary - smoothMesh true; - - //- Number of mesh displacement smoothing iterations. - nSmoothDispl 30; + //- Number of mesh displacement relaxation iterations. + nSolveIter 30; //- Maximum number of snapping relaxation iterations. Should stop // before upon reaching a correct mesh. - nSnap 5; + nRelaxIter 5; } -// For cell layers -layerDict + +// Settings for the layer addition. +addLayersControls { + // Per final patch (so not geometry!) the layer information + layers + { + sphere.stl_firstSolid + { + nSurfaceLayers 1; + + } + maxY + { + nSurfaceLayers 1; + } + } + + // Expansion factor for layer mesh + expansionRatio 1.0; + + //- Wanted thickness of final added cell layer. If multiple layers + // is the + // thickness of the layer furthest away from the wall. + // Relative to undistorted size of cell outside layer. + finalLayerRatio 0.3; + + //- Minimum thickness of cell layer. If for any reason layer + // cannot be above minThickness do not add layer. + // Relative to undistorted size of cell outside layer. + minThickness 0.25; + + //- If points get not extruded do nGrow layers of connected faces that are + // also not grown. This helps convergence of the layer addition process + // close to features. + nGrow 1; + + + // Advanced settings + //- When not to extrude surface. 0 is flat surface, 90 is when two faces // make straight angle. featureAngle 60; //- Maximum number of snapping relaxation iterations. Should stop // before upon reaching a correct mesh. - nSnap 5; - - - //- Minimum thickness of cell layer. If for any reason layer cannot be - // above minThickness do not add layer if thickness below minThickNess. - // Relative to undistorted cell size - minThickness 0.25; - - //- If points get not extruded do nGrow layers of connected faces that are - // not grown. Is used to not do layers at all close to features. - nGrow 1; - - // Expansion factor for layer mesh - expansionRatio 1.3; - - // Ratio of cell size in final added cell layer to cell size - // outside layer - finalLayerRatio 0.3; + nRelaxIter 5; // Number of smoothing iterations of surface normals nSmoothSurfaceNormals 1; @@ -248,20 +275,14 @@ layerDict // Create buffer region for new layer terminations nBufferCellsNoExtrude 0; - - thickness 0.5; - nSmoothDispl 4; } -// For mesh motion -motionDict -{ - // - // Mesh Quality Parameters. Decide when mesh is good enough to stop - // smoothing. - // +// Generic mesh quality settings. At any undoable phase these determine +// where to undo. +meshQualityControls +{ //- Maximum non-orthogonality allowed. Set to 180 to disable. maxNonOrtho 65; @@ -298,10 +319,10 @@ motionDict //- minVolRatio (0 -> 1) minVolRatio 0.01; - //must be >0 for Fluent compatibility minTriangleTwist -1; + // Advanced //- Number of error distribution iterations @@ -311,4 +332,19 @@ motionDict } +// Advanced + +// Flags for optional output +// 0 : only write final meshes +// 1 : write intermediate meshes +// 2 : write volScalarField with cellLevel for postprocessing +// 4 : write current intersections as .obj files +debug 0; + + +// Merge tolerance. Is fraction of overall bounding box of initial mesh. +// Note: the write tolerance needs to be higher than this. +mergeTolerance 1E-6; + + // ************************************************************************* // diff --git a/bin/foamPackSource b/bin/foamPackSource index 30e52c72da..519d18929d 100755 --- a/bin/foamPackSource +++ b/bin/foamPackSource @@ -73,13 +73,16 @@ find -H $packDir \ -a ! -name "core" \ -a ! -name "core.[1-9]*" \ -a ! -name "log[0-9]*" \ + -a ! -name "libccmio*" \ -a ! -name "\.ebrowse" \ | sed \ -e "\@$packDir/.git/@d" \ -e "\@$packDir/lib/@d" \ - -e '\@applications/bin/@d' \ - -e '\@/t/@d' \ - -e '\@Make[.A-Za-z]*/[^/]*/@d' \ + -e "\@libccmio.*/@d" \ + -e '\@applications/bin/@d' \ + -e '\@/t/@d' \ + -e '\@Make[.A-Za-z]*/[^/]*/@d'\ + -e '\@/platforms/@d' \ > $tmpFile tar czpf $packFile --files-from $tmpFile diff --git a/bin/foamPackThirdPartyBin b/bin/foamPackThirdPartyBin new file mode 100755 index 0000000000..484c0c1e4b --- /dev/null +++ b/bin/foamPackThirdPartyBin @@ -0,0 +1,78 @@ +#!/bin/sh +#------------------------------------------------------------------------------ +# ========= | +# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox +# \\ / O peration | +# \\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd. +# \\/ M anipulation | +#------------------------------------------------------------------------------- +# License +# This file is part of OpenFOAM. +# +# OpenFOAM is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation; either version 2 of the License, or (at your +# option) any later version. +# +# OpenFOAM is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License +# along with OpenFOAM; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# +# Script +# foamPackThirdPartyBin [outputDir] +# +# Description +# Packs and compresses binary version of OpenFOAM ThirdParty for release +# +#------------------------------------------------------------------------------ + +if [ $# = 0 ] +then + echo "Error: archOptionsitecture type expected, exiting" + echo + echo "Usage : ${0##*/} [outputDir]" + echo + exit 1 +fi +archOptions=$1 +arch=${archOptions%%G*} +arch3264=$(echo "$arch" | sed 's@64@-64@') + +timeStamp=$(date +%Y-%m-%d) +packDir=ThirdParty +packFile=${packDir}.${archOptions}_${timeStamp}.gtgz + +# add optional output directory +if [ -d "$2" ] +then + packFile="$2/$packFile" +fi + +if [ -f $packFile ] +then + echo "Error: $packFile already exists" + exit 1 +fi + +# get list of directories +dirList=`find $packDir -type d -name $arch -o -type d -name $archOptions -o -type l -name $arch3264` +echo +echo "Packing $archOptions port of $packDir into $packFile" +echo + +tar czpf $packFile $dirList + +if [ $? = 0 ] +then + echo "Finished packing and compressing file $packFile" +else + echo "Error: failure packing $packFile" + rm -f $packFile 2>/dev/null +fi + +#------------------------------------------------------------------------------ diff --git a/bin/foamPackThirdPartyGeneral b/bin/foamPackThirdPartyGeneral new file mode 100755 index 0000000000..b874e4a0bd --- /dev/null +++ b/bin/foamPackThirdPartyGeneral @@ -0,0 +1,70 @@ +#!/bin/sh +#------------------------------------------------------------------------------ +# ========= | +# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox +# \\ / O peration | +# \\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd. +# \\/ M anipulation | +#------------------------------------------------------------------------------- +# License +# This file is part of OpenFOAM. +# +# OpenFOAM is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation; either version 2 of the License, or (at your +# option) any later version. +# +# OpenFOAM is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License +# along with OpenFOAM; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# +# Script +# foamPackThirdPartyGeneral [outputDir] +# +# Description +# Packs and compresses the OpenFOAM ThirdParty directory for release +# +#------------------------------------------------------------------------------ + +timeStamp=$(date +%Y-%m-%d) +packDir=ThirdParty +packFile=${packDir}.General_${timeStamp}.gtgz + +if [ ! -d $packDir ] +then + echo "Error: directory $packDir does not exist" + exit 1 +fi + +# add optional output directory +if [ -d "$1" ] +then + packFile="$1/$packFile" +fi + +if [ -f $packFile ] +then + echo "Error: $packFile already exists" + exit 1 +fi + +# Create time stamp file +# ~~~~~~~~~~~~~~~~~~~~~~ + +echo $timeStamp 2>/dev/null > $packDir/.timeStamp + +# Pack and compress the packFile +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +echo +echo "Packing $packDir into $packFile" +echo + +foamPackSource $packDir $packFile + +#------------------------------------------------------------------------------ diff --git a/src/OpenFOAM/interpolations/interpolationTable/interpolationTable.C b/src/OpenFOAM/interpolations/interpolationTable/interpolationTable.C index e2f1f92e77..bfb0ce9f12 100644 --- a/src/OpenFOAM/interpolations/interpolationTable/interpolationTable.C +++ b/src/OpenFOAM/interpolations/interpolationTable/interpolationTable.C @@ -26,40 +26,14 @@ License #include "interpolationTable.H" #include "IFstream.H" -#include "objectRegistry.H" -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // +// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // template -Foam::interpolationTable::interpolationTable() -: - List >(), - dict_(dictionary::null), - boundAction_(interpolationTable::WARN), - fileName_("undefined_fileName") -{} - - -template -Foam::interpolationTable::interpolationTable -( - const objectRegistry& obr, - const dictionary& dict -) -: - List >(), - dict_(dict), - boundAction_(wordToBoundAction(dict.lookup("boundAction"))), - fileName_(dict.lookup("fileName")) +void Foam::interpolationTable::readTable() { fileName_.expand(); - // Correct for relative path - if (fileName_[0] != '/') - { - fileName_ = obr.db().path()/fileName_; - } - // Read data from file IFstream(fileName_)() >> *this; @@ -78,6 +52,39 @@ Foam::interpolationTable::interpolationTable } +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +Foam::interpolationTable::interpolationTable() +: + List >(), + boundAction_(interpolationTable::WARN), + fileName_("undefined_fileName") +{} + + +template +Foam::interpolationTable::interpolationTable(const fileName& fn) +: + List >(), + boundAction_(interpolationTable::WARN), + fileName_(fn) +{ + readTable(); +} + + +template +Foam::interpolationTable::interpolationTable(const dictionary& dict) +: + List >(), + boundAction_(wordToBoundAction(dict.lookup("boundAction"))), + fileName_(dict.lookup("fileName")) +{ + readTable(); +} + + template Foam::interpolationTable::interpolationTable ( @@ -85,18 +92,11 @@ Foam::interpolationTable::interpolationTable ) : List >(interpTable), - dict_(interpTable.dict_), boundAction_(interpTable.boundAction_), fileName_(interpTable.fileName_) {} -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -template -Foam::interpolationTable::~interpolationTable() -{} - // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // @@ -174,7 +174,7 @@ Foam::interpolationTable::wordToBoundAction template void Foam::interpolationTable::check() const { - label n = size(); + label n = this->size(); scalar prevValue = List >::operator[](0).first(); for (label i=1; i& Foam::interpolationTable::operator[](const label i) const { label ii = i; - label n = size(); + label n = this->size(); if (n <= 1) { @@ -321,7 +321,7 @@ Foam::interpolationTable::operator[](const label i) const template Type Foam::interpolationTable::operator()(const scalar value) const { - label n = size(); + label n = this->size(); if (n <= 1) { diff --git a/src/OpenFOAM/interpolations/interpolationTable/interpolationTable.H b/src/OpenFOAM/interpolations/interpolationTable/interpolationTable.H index 207e19f91c..77b944cda0 100644 --- a/src/OpenFOAM/interpolations/interpolationTable/interpolationTable.H +++ b/src/OpenFOAM/interpolations/interpolationTable/interpolationTable.H @@ -84,9 +84,6 @@ private: // Private data - //- Parent dictionary - const dictionary& dict_; - //- Enumeration for handling out-of-bound values boundActions boundAction_; @@ -94,6 +91,12 @@ private: fileName fileName_; + // Private Member Functions + + //- Read the table of data from file + void readTable(); + + public: // Constructors @@ -101,61 +104,45 @@ public: //- Construct null interpolationTable(); - //- Construct from objectRegistry and dictionary - interpolationTable(const objectRegistry& obr, const dictionary& dict); + //- Construct given the name of the file containing the table of data + interpolationTable(const fileName& fn); + + //- Construct by reading the fileName and boundAction from dictionary + // and read the table from that file. + // This is a specialised constructor used by patchFields + interpolationTable(const dictionary& dict); //- Construct copy interpolationTable(const interpolationTable& interpTable); - //- Destructor - ~interpolationTable(); - - // Member Functions - // Access + //- Return the out-of-bounds treatment as a word + word boundActionToWord(const boundActions& bound) const; - //- Return the size - label size() const - { - return List >::size(); - } + //- Return the out-of-bounds treatment as an enumeration + boundActions wordToBoundAction(const word& bound) const; - //- Return the out-of-bounds treatment as a word - word boundActionToWord(const boundActions& bound) const; + //- Check that list is monotonically increasing + // Exit with a FatalError if there is a problem + void check() const; - //- Return the out-of-bounds treatment as an enumeration - boundActions wordToBoundAction(const word& bound) const; + //- Set the out-of-bounds treatment from enum, return previous + // setting + boundActions boundAction(const boundActions& bound); + + //- Write + void write(Ostream& os) const; - // Check + // Member Operators - //- Check that list is monotonically increasing - // Exit with a FatalError if there is a problem - void check() const; + //- Return an element of constant Tuple2 + const Tuple2& operator[](const label) const; - - // Edit - - //- Set the out-of-bounds treatment from enum, return previous - // setting - boundActions boundAction(const boundActions& bound); - - - // Member Operators - - //- Return an element of constant Tuple2 - const Tuple2& operator[](const label) const; - - //- Return an interpolated value - Type operator()(const scalar) const; - - - // I-O - - //- Write - void write(Ostream& os) const; + //- Return an interpolated value + Type operator()(const scalar) const; }; @@ -169,6 +156,8 @@ public: # include "interpolationTable.C" #endif +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + #endif // ************************************************************************* // diff --git a/src/autoMesh/Make/files b/src/autoMesh/Make/files index c562ee5c6d..96141445be 100644 --- a/src/autoMesh/Make/files +++ b/src/autoMesh/Make/files @@ -1,15 +1,23 @@ autoHexMesh = autoHexMesh +autoHexMeshDriver = $(autoHexMesh)/autoHexMeshDriver + +$(autoHexMeshDriver)/autoLayerDriver.C +$(autoHexMeshDriver)/autoLayerDriverShrink.C +$(autoHexMeshDriver)/autoSnapDriver.C +$(autoHexMeshDriver)/autoRefineDriver.C +$(autoHexMeshDriver)/autoHexMeshDriver.C + +$(autoHexMeshDriver)/layerParameters/layerParameters.C +$(autoHexMeshDriver)/refinementParameters/refinementParameters.C +$(autoHexMeshDriver)/snapParameters/snapParameters.C +$(autoHexMeshDriver)/pointData/pointData.C -$(autoHexMesh)/autoHexMeshDriver/autoHexMeshDriver.C -$(autoHexMesh)/autoHexMeshDriver/autoHexMeshDriverLayers.C -$(autoHexMesh)/autoHexMeshDriver/autoHexMeshDriverShrink.C -$(autoHexMesh)/autoHexMeshDriver/autoHexMeshDriverSnap.C -$(autoHexMesh)/autoHexMeshDriver/pointData/pointData.C $(autoHexMesh)/meshRefinement/meshRefinementBaffles.C $(autoHexMesh)/meshRefinement/meshRefinement.C $(autoHexMesh)/meshRefinement/meshRefinementMerge.C $(autoHexMesh)/meshRefinement/meshRefinementRefine.C $(autoHexMesh)/refinementSurfaces/refinementSurfaces.C +$(autoHexMesh)/shellSurfaces/shellSurfaces.C $(autoHexMesh)/trackedParticle/trackedParticle.C $(autoHexMesh)/trackedParticle/trackedParticleCloud.C diff --git a/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoHexMeshDriver.C b/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoHexMeshDriver.C index a15b422032..48f52d7880 100644 --- a/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoHexMeshDriver.C +++ b/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoHexMeshDriver.C @@ -35,6 +35,13 @@ License #include "syncTools.H" #include "motionSmoother.H" #include "pointMesh.H" +#include "refinementParameters.H" +#include "snapParameters.H" +#include "layerParameters.H" +#include "autoRefineDriver.H" +#include "autoSnapDriver.H" +#include "autoLayerDriver.H" +#include "triSurfaceMesh.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -60,7 +67,8 @@ Foam::scalar Foam::autoHexMeshDriver::getMergeDistance(const scalar mergeTol) -scalar(IOstream::defaultPrecision()) ); - Info<< "Overall mesh bounding box : " << meshBb << nl + Info<< nl + << "Overall mesh bounding box : " << meshBb << nl << "Relative tolerance : " << mergeTol << nl << "Absolute matching distance : " << mergeDist << nl << endl; @@ -82,206 +90,63 @@ Foam::scalar Foam::autoHexMeshDriver::getMergeDistance(const scalar mergeTol) } -// Return per keeppoint -1 or the local cell label the point is in. Guaranteed -// to be only on one processor. -Foam::labelList Foam::autoHexMeshDriver::findCells(const pointField& keepPoints) - const -{ - // Global calculation engine - globalIndex globalCells(mesh_.nCells()); - - // Cell label per point - labelList cellLabels(keepPoints.size()); - - forAll(keepPoints, i) - { - const point& keepPoint = keepPoints[i]; - - label localCellI = mesh_.findCell(keepPoint); - - label globalCellI = -1; - - if (localCellI != -1) - { - Pout<< "Found point " << keepPoint << " in cell " << localCellI - << " on processor " << Pstream::myProcNo() << endl; - globalCellI = globalCells.toGlobal(localCellI); - } - - reduce(globalCellI, maxOp