diff --git a/.gitignore b/.gitignore index e2c6f9b41f..67ac189fcc 100644 --- a/.gitignore +++ b/.gitignore @@ -60,8 +60,8 @@ doc/[Dd]oxygen/man # untracked configuration files /etc/prefs.csh /etc/prefs.sh -/etc/config/*.csh -/etc/config/*.sh +/etc/config/prefs.csh +/etc/config/prefs.sh # source packages - anywhere *.tar.bz2 diff --git a/ReleaseNotes-dev b/ReleaseNotes-dev index 5f25edc276..8daf5ef6f4 100644 --- a/ReleaseNotes-dev +++ b/ReleaseNotes-dev @@ -126,7 +126,9 @@ globalPointPatch. Moving mesh cases can now be run non-parallel and continued in parallel and reconstructed without any limitation. *** *New* compact binary I/O for faces and cells. - This speeds up reading/writing meshes in binary. + This speeds up reading/writing meshes in binary. Binary mesh reading + is backwards (but not forwards) compatible. Use ascii mesh format or + foamFormatConvert. *** *Updated* runTimeModifiable + user selectable model to use for checking run-time modifiable dictionaries (see also doc/changes/inotify.txt): @@ -139,8 +141,9 @@ + on linux optionally uses inotify instead of time stamps - more efficient for large numbers of monitored files. No more fileModificationSkew needed. + single integer reduction instead of one reduction per monitored file. - + only files that can be re-read are being checked. Drastic reduction of - number of files to check. + + only files that can be re-read are being checked by specifying + in the IOobject constructor MUST_READ_IF_MODIFIED instead of + MUST_READ. Drastic reduction of number of files to check. *** *New* #codeStream dictionary entry Uses dynamic compilation of OpenFOAM C++ code to construct dictionary. E.g. in blockMeshDict: @@ -241,9 +244,11 @@ - works in parallel + =snappyHexMesh=: + extrude across multi-processor boundaries - + preserve faceZones during layering - + combining patch faces after snapping + + preserve faceZones shape during layering + + combining coincident patch faces is now default after snapping + *Warning*: + - snapControls::tolerance setting fixed w.r.t. 17x. Is the + multiplication to calculate the local search distance for nearest. - minMedianAxisAngle angle fixed w.r.t. 17x. Set to 90 to get same behaviour as 130 in 17x. - nGrow did not work in 17x. Set to 0 @@ -308,6 +313,8 @@ + multipleBoxes, hotBoxes, panel, evaporationTest + =interDyMFoam= tutorials: + testTubeMixer: showcases =solidBodyMotionFunction= + + =snappyHexMesh= tutorials: + + flange: demonstration of feature lines in snappyHexMesh * Other + compilable with =clang= diff --git a/applications/solvers/basic/potentialFoam/potentialFoam.C b/applications/solvers/basic/potentialFoam/potentialFoam.C index c691dd06e7..808b964e4f 100644 --- a/applications/solvers/basic/potentialFoam/potentialFoam.C +++ b/applications/solvers/basic/potentialFoam/potentialFoam.C @@ -49,6 +49,10 @@ int main(int argc, char *argv[]) Info<< nl << "Calculating potential flow" << endl; + // Since solver contains no time loop it would never execute + // function objects so do it ourselves. + runTime.functionObjects().start(); + adjustPhi(phi, U, p); for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) @@ -99,6 +103,9 @@ int main(int argc, char *argv[]) p.write(); } + runTime.functionObjects().end(); + + Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" << " ClockTime = " << runTime.elapsedClockTime() << " s" << nl << endl; diff --git a/applications/solvers/lagrangian/sprayFoam/Make/files b/applications/solvers/lagrangian/sprayFoam/Make/files new file mode 100644 index 0000000000..893038ce0a --- /dev/null +++ b/applications/solvers/lagrangian/sprayFoam/Make/files @@ -0,0 +1,3 @@ +sprayFoam.C + +EXE = $(FOAM_APPBIN)/sprayFoam diff --git a/applications/solvers/lagrangian/sprayFoam/Make/options b/applications/solvers/lagrangian/sprayFoam/Make/options new file mode 100644 index 0000000000..ff504df32f --- /dev/null +++ b/applications/solvers/lagrangian/sprayFoam/Make/options @@ -0,0 +1,50 @@ +EXE_INC = \ + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I${LIB_SRC}/meshTools/lnInclude \ + -I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \ + -I$(LIB_SRC)/lagrangian/basic/lnInclude \ + -I$(LIB_SRC)/lagrangian/intermediate/lnInclude \ + -I$(LIB_SRC)/lagrangian/spray/lnInclude \ + -I$(LIB_SRC)/lagrangian/distributionModels/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/properties/liquidProperties/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/properties/liquidMixtureProperties/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/properties/solidProperties/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/properties/solidMixtureProperties/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/thermophysicalFunctions/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/SLGThermo/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/chemistryModel/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/radiationModels/lnInclude \ + -I$(LIB_SRC)/ODE/lnInclude \ + -I$(LIB_SRC)/regionModels/regionModel/lnInclude \ + -I$(LIB_SRC)/regionModels/surfaceFilmModels/lnInclude \ + -I$(LIB_SRC)/sampling/lnInclude \ + -I$(FOAM_SOLVERS)/lagrangian/reactingParcelFoam + + +EXE_LIBS = \ + -lfiniteVolume \ + -lmeshTools \ + -lcompressibleTurbulenceModel \ + -lcompressibleRASModels \ + -lcompressibleLESModels \ + -llagrangian \ + -llagrangianIntermediate \ + -llagrangianSpray \ + -lspecie \ + -lbasicThermophysicalModels \ + -lliquidProperties \ + -lliquidMixtureProperties \ + -lsolidProperties \ + -lsolidMixtureProperties \ + -lthermophysicalFunctions \ + -lreactionThermophysicalModels \ + -lSLGThermo \ + -lchemistryModel \ + -lradiationModels \ + -lODE \ + -lregionModels \ + -lsurfaceFilmModels \ + -lsampling diff --git a/applications/solvers/lagrangian/sprayFoam/chemistry.H b/applications/solvers/lagrangian/sprayFoam/chemistry.H new file mode 100644 index 0000000000..99f418af6f --- /dev/null +++ b/applications/solvers/lagrangian/sprayFoam/chemistry.H @@ -0,0 +1,44 @@ +if (chemistry.chemistry()) +{ + Info<< "Solving chemistry" << endl; + + chemistry.solve + ( + runTime.value() - runTime.deltaTValue(), + runTime.deltaTValue() + ); + + // turbulent time scale + if (turbulentReaction) + { + tmp tepsilon(turbulence->epsilon()); + const volScalarField& epsilon = tepsilon(); + tmp tmuEff(turbulence->muEff()); + const volScalarField& muEff = tmuEff(); + tmp ttc(chemistry.tc()); + const volScalarField& tc = ttc(); + + forAll(epsilon, i) + { + if (epsilon[i] > 0) + { + // Chalmers PaSR model + scalar tk = Cmix.value()*Foam::sqrt(muEff[i]/rho[i]/epsilon[i]); + kappa[i] = + (runTime.deltaTValue() + tc[i]) + /(runTime.deltaTValue() + tc[i] + tk); + } + else + { + // Return to laminar combustion + kappa[i] = 1.0; + } + } + } + else + { + kappa = 1.0; + } + + chemistrySh = kappa*chemistry.Sh()(); +} diff --git a/applications/solvers/lagrangian/sprayFoam/createClouds.H b/applications/solvers/lagrangian/sprayFoam/createClouds.H new file mode 100644 index 0000000000..ee0985ff70 --- /dev/null +++ b/applications/solvers/lagrangian/sprayFoam/createClouds.H @@ -0,0 +1,9 @@ +Info<< "\nConstructing reacting cloud" << endl; +basicSprayCloud parcels +( + "sprayCloud", + rho, + U, + g, + slgThermo +); diff --git a/applications/solvers/lagrangian/sprayFoam/sprayFoam.C b/applications/solvers/lagrangian/sprayFoam/sprayFoam.C new file mode 100644 index 0000000000..5252fd3cf3 --- /dev/null +++ b/applications/solvers/lagrangian/sprayFoam/sprayFoam.C @@ -0,0 +1,119 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 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 3 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, see . + +Application + sprayFoam + +Description + Transient PIMPLE solver for compressible, laminar or turbulent flow with + spray parcels. + +\*---------------------------------------------------------------------------*/ + +#include "fvCFD.H" +#include "hCombustionThermo.H" +#include "turbulenceModel.H" +#include "basicSprayCloud.H" +#include "psiChemistryModel.H" +#include "chemistrySolver.H" +#include "radiationModel.H" +#include "SLGThermo.H" +#include "pimpleControl.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +int main(int argc, char *argv[]) +{ + #include "setRootCase.H" + + #include "createTime.H" + #include "createMesh.H" + #include "readChemistryProperties.H" + #include "readGravitationalAcceleration.H" + #include "createFields.H" + #include "createClouds.H" + #include "createRadiationModel.H" + #include "initContinuityErrs.H" + #include "readTimeControls.H" + #include "compressibleCourantNo.H" + #include "setInitialDeltaT.H" + + pimpleControl pimple(mesh); + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + + Info<< "\nStarting time loop\n" << endl; + + while (runTime.run()) + { + #include "readTimeControls.H" + #include "compressibleCourantNo.H" + #include "setDeltaT.H" + + runTime++; + + Info<< "Time = " << runTime.timeName() << nl << endl; + + parcels.evolve(); + + #include "chemistry.H" + #include "rhoEqn.H" + + // --- Pressure-velocity PIMPLE corrector loop + for (pimple.start(); pimple.loop(); pimple++) + { + #include "UEqn.H" + #include "YEqn.H" + #include "hsEqn.H" + + // --- PISO loop + for (int corr=0; corrcorrect(); + } + } + + rho = thermo.rho(); + + if (runTime.write()) + { + chemistry.dQ()().write(); + } + + Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" + << " ClockTime = " << runTime.elapsedClockTime() << " s" + << nl << endl; + } + + Info<< "End\n" << endl; + + return(0); +} + + +// ************************************************************************* // diff --git a/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/createShellMesh.C b/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/createShellMesh.C index e57db9f9b3..c2bce48a7a 100644 --- a/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/createShellMesh.C +++ b/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/createShellMesh.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -453,6 +453,7 @@ void Foam::createShellMesh::setRefinement label region0 = pointRegions_[eFaces[0]][fp0]; label region1 = pointRegions_[eFaces[0]][fp1]; + // Pick up points with correct normal if (layerI == 0) { newF[0] = f[fp0]; @@ -468,6 +469,22 @@ void Foam::createShellMesh::setRefinement newF[3] = addedPoints[nLayers*region0+layerI]; } + // Optionally rotate so e[0] is always 0th vertex. Note that + // this normally is automatically done by coupled face ordering + // but with NOORDERING we have to do it ourselves. + if (f[fp0] != e[0]) + { + // rotate one back to get newF[1] (originating from e[0]) + // into newF[0] + label v0 = newF[0]; + for (label i = 0; i < newF.size()-1; i++) + { + newF[i] = newF[newF.fcIndex(i)]; + } + newF.last() = v0; + } + + label minCellI = addedCells[nLayers*eFaces[0]+layerI]; label maxCellI; label patchI; @@ -569,6 +586,21 @@ void Foam::createShellMesh::setRefinement newF[3] = addedPoints[nLayers*region0+layerI]; } + + // Optionally rotate so e[0] is always 0th vertex. Note that + // this normally is automatically done by coupled face + // ordering but with NOORDERING we have to do it ourselves. + if (f[fp0] != e[0]) + { + // rotate one back to get newF[1] (originating + // from e[0]) into newF[0]. + label v0 = newF[0]; + for (label i = 0; i < newF.size()-1; i++) + { + newF[i] = newF[newF.fcIndex(i)]; + } + newF.last() = v0; + } ////if (ePatches.size() == 0) //{ // Pout<< "Adding from MULTI face:" diff --git a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict index 8e8232f60f..f99b82edb7 100644 --- a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict +++ b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict @@ -220,7 +220,7 @@ snapControls //- Maximum relative distance for points to be attracted by surface. // True distance is this factor times local maximum edge length. // Note: changed(corrected) w.r.t 17x! (17x used 2* tolerance) - tolerance 2.0; + tolerance 1.0; //- Number of mesh displacement relaxation iterations. nSolveIter 30; @@ -228,6 +228,10 @@ snapControls //- Maximum number of snapping relaxation iterations. Should stop // before upon reaching a correct mesh. nRelaxIter 5; + + //- Highly experimental and wip: number of feature edge snapping + // iterations. Leave out altogether to disable. + //nFeatureSnapIter 10; } @@ -258,6 +262,9 @@ addLayersControls //- 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. // is the thickness of the layer furthest away from the wall. // See relativeSizes parameter. finalLayerThickness 0.3; @@ -410,7 +417,7 @@ 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; +mergeTolerance 1e-6; // ************************************************************************* // diff --git a/applications/utilities/miscellaneous/foamFormatConvert/foamFormatConvert.C b/applications/utilities/miscellaneous/foamFormatConvert/foamFormatConvert.C index 20e51284fc..90faf0de65 100644 --- a/applications/utilities/miscellaneous/foamFormatConvert/foamFormatConvert.C +++ b/applications/utilities/miscellaneous/foamFormatConvert/foamFormatConvert.C @@ -144,10 +144,30 @@ bool writeZones(const word& name, const fileName& meshDir, Time& runTime) int main(int argc, char *argv[]) { timeSelector::addOptions(); + argList::addBoolOption + ( + "noConstant", + "exclude the 'constant/' dir in the times list" + ); + # include "addRegionOption.H" # include "setRootCase.H" + + // enable noConstant by switching + if (!args.optionFound("noConstant")) + { + args.setOption("constant", ""); + } + else + { + args.unsetOption("constant"); + Info<< "Excluding the constant directory." << nl << endl; + } + + # include "createTime.H" + // Make sure we do not use the master-only reading since we read // fields (different per processor) as dictionaries. regIOobject::fileModificationChecking = regIOobject::timeStamp; diff --git a/applications/utilities/parallelProcessing/redistributeMeshPar/redistributeMeshPar.C b/applications/utilities/parallelProcessing/redistributeMeshPar/redistributeMeshPar.C index 674e464f2c..8812e78e64 100644 --- a/applications/utilities/parallelProcessing/redistributeMeshPar/redistributeMeshPar.C +++ b/applications/utilities/parallelProcessing/redistributeMeshPar/redistributeMeshPar.C @@ -98,6 +98,44 @@ autoPtr createMesh xferCopy(labelList()), false ); + // Add some dummy zones so upon reading it does not read them + // from the undecomposed case. Should be done as extra argument to + // regIOobject::readStream? + List pz + ( + 1, + new pointZone + ( + "dummyPointZone", + labelList(0), + 0, + dummyMesh.pointZones() + ) + ); + List fz + ( + 1, + new faceZone + ( + "dummyFaceZone", + labelList(0), + boolList(0), + 0, + dummyMesh.faceZones() + ) + ); + List cz + ( + 1, + new cellZone + ( + "dummyCellZone", + labelList(0), + 0, + dummyMesh.cellZones() + ) + ); + dummyMesh.addZones(pz, fz, cz); //Pout<< "Writing dummy mesh to " << dummyMesh.polyMesh::objectPath() // << endl; dummyMesh.write(); @@ -239,7 +277,11 @@ autoPtr createMesh if (!haveMesh) { - // Add the zones + // Add the zones. Make sure to remove the old dummy ones first + mesh.pointZones().clear(); + mesh.faceZones().clear(); + mesh.cellZones().clear(); + List pz(pointZoneNames.size()); forAll(pointZoneNames, i) { @@ -389,6 +431,12 @@ void printMeshData(const polyMesh& mesh) globalIndex globalBoundaryFaces(mesh.nFaces()-mesh.nInternalFaces()); + label maxProcCells = 0; + label totProcFaces = 0; + label maxProcPatches = 0; + label totProcPatches = 0; + label maxProcFaces = 0; + for (label procI = 0; procI < Pstream::nProcs(); procI++) { Info<< endl @@ -413,7 +461,32 @@ void printMeshData(const polyMesh& mesh) << " Number of processor faces = " << nProcFaces << nl << " Number of boundary faces = " << globalBoundaryFaces.localSize(procI) << endl; + + maxProcCells = max(maxProcCells, globalCells.localSize(procI)); + totProcFaces += nProcFaces; + totProcPatches += nei.size(); + maxProcPatches = max(maxProcPatches, nei.size()); + maxProcFaces = max(maxProcFaces, nProcFaces); } + + // Stats + + scalar avgProcCells = scalar(globalCells.size())/Pstream::nProcs(); + scalar avgProcPatches = scalar(totProcPatches)/Pstream::nProcs(); + scalar avgProcFaces = scalar(totProcFaces)/Pstream::nProcs(); + + Info<< nl + << "Number of processor faces = " << totProcFaces/2 << nl + << "Max number of cells = " << maxProcCells + << " (" << 100.0*(maxProcCells-avgProcCells)/avgProcCells + << "% above average " << avgProcCells << ")" << nl + << "Max number of processor patches = " << maxProcPatches + << " (" << 100.0*(maxProcPatches-avgProcPatches)/avgProcPatches + << "% above average " << avgProcPatches << ")" << nl + << "Max number of faces between processors = " << maxProcFaces + << " (" << 100.0*(maxProcFaces-avgProcFaces)/avgProcFaces + << "% above average " << avgProcFaces << ")" << nl + << endl; } @@ -641,6 +714,16 @@ int main(int argc, char *argv[]) ); # include "setRootCase.H" + if (env("FOAM_SIGFPE")) + { + WarningIn(args.executable()) + << "Detected floating point exception trapping (FOAM_SIGFPE)." + << " This might give" << nl + << " problems when mapping fields. Switch it off in case" + << " of problems." << endl; + } + + // Create processor directory if non-existing if (!Pstream::master() && !isDir(args.path())) { @@ -906,7 +989,7 @@ int main(int argc, char *argv[]) // Debugging: Create additional volField that will be mapped. // Used to test correctness of mapping - volVectorField mapCc("mapCc", 1*mesh.C()); + //volVectorField mapCc("mapCc", 1*mesh.C()); // Global matching tolerance const scalar tolDim = getMergeDistance @@ -948,7 +1031,7 @@ int main(int argc, char *argv[]) // Debugging: test mapped cellcentre field. - compareFields(tolDim, mesh.C(), mapCc); + //compareFields(tolDim, mesh.C(), mapCc); // Print nice message // ~~~~~~~~~~~~~~~~~~ diff --git a/applications/utilities/preProcessing/viewFactorGen/Make/files b/applications/utilities/preProcessing/viewFactorsGen/Make/files similarity index 100% rename from applications/utilities/preProcessing/viewFactorGen/Make/files rename to applications/utilities/preProcessing/viewFactorsGen/Make/files diff --git a/applications/utilities/preProcessing/viewFactorGen/Make/options b/applications/utilities/preProcessing/viewFactorsGen/Make/options similarity index 100% rename from applications/utilities/preProcessing/viewFactorGen/Make/options rename to applications/utilities/preProcessing/viewFactorsGen/Make/options diff --git a/applications/utilities/preProcessing/viewFactorGen/searchingEngine.H b/applications/utilities/preProcessing/viewFactorsGen/searchingEngine.H similarity index 100% rename from applications/utilities/preProcessing/viewFactorGen/searchingEngine.H rename to applications/utilities/preProcessing/viewFactorsGen/searchingEngine.H diff --git a/applications/utilities/preProcessing/viewFactorGen/shootRays.H b/applications/utilities/preProcessing/viewFactorsGen/shootRays.H similarity index 100% rename from applications/utilities/preProcessing/viewFactorGen/shootRays.H rename to applications/utilities/preProcessing/viewFactorsGen/shootRays.H diff --git a/applications/utilities/preProcessing/viewFactorGen/viewFactorsGen.C b/applications/utilities/preProcessing/viewFactorsGen/viewFactorsGen.C similarity index 100% rename from applications/utilities/preProcessing/viewFactorGen/viewFactorsGen.C rename to applications/utilities/preProcessing/viewFactorsGen/viewFactorsGen.C diff --git a/bin/foamRunTutorials b/bin/foamRunTutorials index 8cacbfe09f..2893be0a2c 100755 --- a/bin/foamRunTutorials +++ b/bin/foamRunTutorials @@ -3,7 +3,7 @@ # ========= | # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / O peration | -# \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. +# \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. # \\/ M anipulation | #------------------------------------------------------------------------------ # License @@ -31,6 +31,39 @@ # #------------------------------------------------------------------------------ +#------------------------------------------------------------------------------ +# Select the version of make to be used +#------------------------------------------------------------------------------ + +# normally use "make" +make="make" + +# set WM_NCOMPPROCS automatically when both WM_HOSTS and WM_SCHEDULER are set +if [ -z "$WM_NCOMPPROCS" -a -n "$WM_HOSTS" -a -n "$WM_SCHEDULER" ] +then + WM_NCOMPPROCS=$(wmakeScheduler -count) + [ $? -eq 0 ] || unset WM_NCOMPPROCS +fi + +if [ "$WM_NCOMPPROCS" ] +then + if [ "$WM_NCOMPPROCS" -gt 1 -a ! "$MAKEFLAGS" ] + then + lockDir=$HOME/.$WM_PROJECT/.wmake + + if [ -d $lockDir ] + then + rm -f $lockDir/* + else + mkdir -p $lockDir + fi + + make="make --no-print-directory -j "$WM_NCOMPPROCS + fi +fi + + + # Source tutorial functions . $WM_PROJECT_DIR/bin/tools/RunFunctions @@ -62,13 +95,15 @@ else fi done # Recurse to subdirectories - for caseName in * - do - if [ -d $caseName ] - then - ( cd $caseName && $thisScript ) - fi - done + #for caseName in * + #do + # if [ -d $caseName ] + # then + # ( cd $caseName && $thisScript ) + # fi + #done + FOAM_TARGETS=$(for d in *; do [ -d "$d" ] && echo "$d"; done | xargs) + $make -k -f $WM_PROJECT_DIR/bin/tools/MakefileDirs FOAM_TARGETS="$FOAM_TARGETS" FOAM_APP="$WM_SCHEDULER $thisScript" fi #------------------------------------------------------------------------------ diff --git a/bin/paraFoam b/bin/paraFoam index 540f90dc93..a57505f5f9 100755 --- a/bin/paraFoam +++ b/bin/paraFoam @@ -37,7 +37,7 @@ usage() { while [ "$#" -ge 1 ]; do echo "$1"; shift; done cat</dev/null; exit 0" EXIT TERM INT - touch "$caseFile" - echo "created temporary '$caseFile'" -} + # check existence of essential files + warn="WARN file does not exist:" + case $extension in + blockMesh) + for check in \ + system/controlDict \ + constant/polyMesh/blockMeshDict \ + ; + do + [ -s "$parentDir/$check" ] || { + [ -n "$warn" ] && echo "$warn" 1>&2 + echo " $parentDir/$check" 1>&2 + unset warn + } + done + ;; + + builtin | OpenFOAM) + for check in \ + system/controlDict \ + $fvControls/fvSchemes \ + $fvControls/fvSolution \ + ; + do + [ -s "$parentDir/$check" ] || { + [ -n "$warn" ] && echo "$warn" 1>&2 + echo " $parentDir/$check" 1>&2 + unset warn + } + done + ;; + esac + + # only create/remove caseFile if it didn't already exist + [ -e $caseFile ] || { + trap "rm -f $caseFile 2>/dev/null; exit 0" EXIT TERM INT + touch "$caseFile" + echo "created temporary '$caseFile'" + } + + paraview --data="$caseFile" "$@" +fi -paraview --data="$caseFile" #------------------------------------------------------------------------------ diff --git a/bin/tools/MakefileDirs b/bin/tools/MakefileDirs new file mode 100644 index 0000000000..b67656b6e8 --- /dev/null +++ b/bin/tools/MakefileDirs @@ -0,0 +1,42 @@ +#-------------------------------*- makefile -*--------------------------------- +# ========= | +# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox +# \\ / O peration | +# \\ / A nd | Copyright (C) 2004-2011 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 3 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, see . +# +# File +# MakefileDirs +# +# Description +# Makefile used by +# foamRunTutorials +# to call some script in subdirectories. +# +#------------------------------------------------------------------------------ + +.PHONY: application $(FOAM_TARGETS) + +application: $(FOAM_TARGETS) + +$(FOAM_TARGETS): + @(cd $@ && $(FOAM_APP)) + + +#------------------------------------------------------------------------------ diff --git a/bin/tools/foamConfigurePaths b/bin/tools/foamConfigurePaths index f3948c3cc2..9526748f07 100755 --- a/bin/tools/foamConfigurePaths +++ b/bin/tools/foamConfigurePaths @@ -131,7 +131,7 @@ do paraviewInstall="$2" # replace ParaView_DIR=... _inlineSed \ - etc/apps/paraview3/bashrc \ + etc/config/paraview.sh \ '/^[^#]/s@ParaView_DIR=.*@ParaView_DIR='"$paraviewInstall@" \ "Replacing ParaView_DIR setting by '$paraviewInstall'" shift 2 diff --git a/etc/bashrc b/etc/bashrc index d2539c5b50..edebe538fc 100644 --- a/etc/bashrc +++ b/etc/bashrc @@ -120,7 +120,12 @@ export WM_THIRD_PARTY_DIR=$WM_PROJECT_INST_DIR/ThirdParty-$WM_PROJECT_VERSION # Location of site-specific templates etc # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # unset is equivalent to $WM_PROJECT_INST_DIR/site -unset WM_PROJECT_SITE +if [ -d "$WM_PROJECT_SITE" ] +then + export WM_PROJECT_SITE +else + unset WM_PROJECT_SITE +fi # Location of user files # ~~~~~~~~~~~~~~~~~~~~~~ @@ -177,7 +182,7 @@ _foamEval() _foamSource `$WM_PROJECT_DIR/bin/foamEtcFile prefs.sh` # Evaluate command-line parameters and record settings for later -# these can be used to set/unset values, or specify prefs files +# these can be used to set/unset values, or specify alternative pref files export FOAM_SETTINGS="$@" _foamEval $@ @@ -200,14 +205,14 @@ export PATH LD_LIBRARY_PATH MANPATH # Source project setup files # ~~~~~~~~~~~~~~~~~~~~~~~~~~ -_foamSource $WM_PROJECT_DIR/etc/settings.sh -_foamSource $WM_PROJECT_DIR/etc/aliases.sh +_foamSource $WM_PROJECT_DIR/etc/config/settings.sh +_foamSource $WM_PROJECT_DIR/etc/config/aliases.sh # Source user setup files for optional packages # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -_foamSource `$WM_PROJECT_DIR/bin/foamEtcFile apps/paraview3/bashrc` -_foamSource `$WM_PROJECT_DIR/bin/foamEtcFile apps/ensight/bashrc` +_foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config/paraview.sh` +_foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config/ensight.sh` # Clean environment paths again. Only remove duplicates diff --git a/etc/config/README b/etc/config/README new file mode 100644 index 0000000000..2ad58dda54 --- /dev/null +++ b/etc/config/README @@ -0,0 +1,51 @@ +The main OpenFOAM settings are located in the parent etc/ directory + +* bashrc, cshrc + entry point for sourcing + +* prefs.csh, prefs.sh + these files are untracked and can be used for some site-defined + settings + + +The etc/config/ directory contains various configuration files in +sh/csh variants: + +* settings.csh, settings.sh + core settings + +* aliases.csh, aliases.sh + aliases for interactive shells + +* unset.csh, unset.sh + sourced to clear as many OpenFOAM environment settings as possible + + +* ensight.csh, ensight.sh + application settings for EnSight + +* paraview.csh, paraview.sh + application settings for ParaView + +* scotch.sh + application settings for compiling against scotch + +--- + +The config/example directory contains various example configuration files +in sh/csh variants + +* compiler.csh, compiler.sh + an example of fine tuning ThirdParty compiler settings for OpenFOAM + +* openmpi.csh, openmpi.sh + an example of fine tuning openmpi settings for OpenFOAM + +* paraview.csh, paraview.sh + an example of chaining to the standard config/paraview.sh with a + different ParaView_VERSION + +* prefs.csh, prefs.sh + an example of supplying alternative site-defined settings + +--- diff --git a/etc/aliases.csh b/etc/config/aliases.csh similarity index 92% rename from etc/aliases.csh rename to etc/config/aliases.csh index 558390b403..6573c91973 100644 --- a/etc/aliases.csh +++ b/etc/config/aliases.csh @@ -22,7 +22,7 @@ # along with OpenFOAM. If not, see . # # File -# etc/aliases.csh +# etc/config/aliases.csh # # Description # Aliases for working with OpenFOAM @@ -39,7 +39,7 @@ alias wmSP 'wmSET WM_PRECISION_OPTION=SP' alias wmDP 'wmSET WM_PRECISION_OPTION=DP' # clear env -alias wmUNSET='source $WM_PROJECT_DIR/etc/unset.csh' +alias wmUNSET='source $WM_PROJECT_DIR/etc/config/unset.csh' # Toggle wmakeScheduler on/off # - also need to set WM_HOSTS @@ -49,7 +49,7 @@ alias wmSchedOFF 'unsetenv WM_SCHEDULER' # Change ParaView version # ~~~~~~~~~~~~~~~~~~~~~~~ -alias foamPV 'source `$WM_PROJECT_DIR/etc/apps/paraview3/cshrc` ParaView_VERSION=\!*; echo paraview-$ParaView_VERSION' +alias foamPV 'source `$WM_PROJECT_DIR/etc/config/paraview.csh` ParaView_VERSION=\!*; echo paraview-$ParaView_VERSION' # Change directory aliases diff --git a/etc/aliases.sh b/etc/config/aliases.sh similarity index 94% rename from etc/aliases.sh rename to etc/config/aliases.sh index e9c1227004..188159745c 100644 --- a/etc/aliases.sh +++ b/etc/config/aliases.sh @@ -22,7 +22,7 @@ # along with OpenFOAM. If not, see . # # File -# etc/aliases.sh +# etc/config/aliases.sh # # Description # Aliases for working with OpenFOAM @@ -39,7 +39,7 @@ alias wmSP='wmSET WM_PRECISION_OPTION=SP' alias wmDP='wmSET WM_PRECISION_OPTION=DP' # clear env -alias wmUNSET='. $WM_PROJECT_DIR/etc/unset.sh' +alias wmUNSET='. $WM_PROJECT_DIR/etc/config/unset.sh' # Toggle wmakeScheduler on/off # - also need to set WM_HOSTS @@ -52,7 +52,7 @@ alias wmSchedOFF='unset WM_SCHEDULER' unset foamPV foamPV() { - . $WM_PROJECT_DIR/etc/apps/paraview3/bashrc ParaView_VERSION=$1 + . $WM_PROJECT_DIR/etc/config/paraview.sh ParaView_VERSION=$1 echo "paraview-$ParaView_VERSION (major: $ParaView_MAJOR)" } diff --git a/etc/apps/ensight/cshrc b/etc/config/ensight.csh similarity index 95% rename from etc/apps/ensight/cshrc rename to etc/config/ensight.csh index 73a00884fc..484fa0fc02 100644 --- a/etc/apps/ensight/cshrc +++ b/etc/config/ensight.csh @@ -2,7 +2,7 @@ # ========= | # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / O peration | -# \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. +# \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. # \\/ M anipulation | #------------------------------------------------------------------------------- # License @@ -22,7 +22,7 @@ # along with OpenFOAM. If not, see . # # File -# ensight/cshrc +# config/ensight.csh # # Description # Setup file for Ensight diff --git a/etc/apps/ensight/bashrc b/etc/config/ensight.sh similarity index 95% rename from etc/apps/ensight/bashrc rename to etc/config/ensight.sh index 0e6b981bc8..597c51c010 100644 --- a/etc/apps/ensight/bashrc +++ b/etc/config/ensight.sh @@ -2,7 +2,7 @@ # ========= | # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / O peration | -# \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. +# \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. # \\/ M anipulation | #------------------------------------------------------------------------------ # License @@ -22,7 +22,7 @@ # along with OpenFOAM. If not, see . # # File -# ensight/bashrc +# config/ensight.sh # # Description # Setup file for Ensight diff --git a/etc/config/compiler.csh-EXAMPLE b/etc/config/example/compiler.csh similarity index 90% rename from etc/config/compiler.csh-EXAMPLE rename to etc/config/example/compiler.csh index 6d54edbd47..a317a703c5 100644 --- a/etc/config/compiler.csh-EXAMPLE +++ b/etc/config/example/compiler.csh @@ -22,11 +22,11 @@ # along with OpenFOAM. If not, see . # # File -# config/compiler.csh +# config/example/compiler.csh # # Description -# Fine tuning of ThirdParty compiler settings for OpenFOAM -# Sourced from OpenFOAM-/etc/settings.csh +# Example of fine tuning ThirdParty compiler settings for OpenFOAM +# Sourced from OpenFOAM-/etc/config/settings.csh # #------------------------------------------------------------------------------ diff --git a/etc/config/compiler.sh-EXAMPLE b/etc/config/example/compiler.sh similarity index 90% rename from etc/config/compiler.sh-EXAMPLE rename to etc/config/example/compiler.sh index bc6aada36e..3f13b1d9ea 100644 --- a/etc/config/compiler.sh-EXAMPLE +++ b/etc/config/example/compiler.sh @@ -22,11 +22,11 @@ # along with OpenFOAM. If not, see . # # File -# config/compiler.sh +# config/example/compiler.sh # # Description -# Fine tuning of ThirdParty compiler settings for OpenFOAM -# Sourced from OpenFOAM-/etc/settings.sh +# Example of fine tuning ThirdParty compiler settings for OpenFOAM +# Sourced from OpenFOAM-/etc/config/settings.sh # #------------------------------------------------------------------------------ diff --git a/etc/config/openmpi.csh-EXAMPLE b/etc/config/example/openmpi.csh similarity index 89% rename from etc/config/openmpi.csh-EXAMPLE rename to etc/config/example/openmpi.csh index 94be702e9d..6b46e7494c 100644 --- a/etc/config/openmpi.csh-EXAMPLE +++ b/etc/config/example/openmpi.csh @@ -22,11 +22,11 @@ # along with OpenFOAM. If not, see . # # File -# config/openmpi.csh +# config/example/openmpi.csh # # Description -# Fine tuning of openmpi settings for OpenFOAM -# Sourced from OpenFOAM-/etc/settings.csh +# Example of fine tuning openmpi settings for OpenFOAM +# Sourced from OpenFOAM-/etc/config/settings.csh # #------------------------------------------------------------------------------ diff --git a/etc/config/openmpi.sh-EXAMPLE b/etc/config/example/openmpi.sh similarity index 89% rename from etc/config/openmpi.sh-EXAMPLE rename to etc/config/example/openmpi.sh index b7c5035b04..1573aadf52 100644 --- a/etc/config/openmpi.sh-EXAMPLE +++ b/etc/config/example/openmpi.sh @@ -22,11 +22,11 @@ # along with OpenFOAM. If not, see . # # File -# config/openmpi.sh +# config/example/openmpi.sh # # Description -# Fine tuning of openmpi settings for OpenFOAM -# Sourced from OpenFOAM-/etc/settings.sh +# Example of fine tuning openmpi settings for OpenFOAM +# Sourced from OpenFOAM-/etc/config/settings.sh # #------------------------------------------------------------------------------ diff --git a/etc/apps/paraview3/cshrc-EXAMPLE b/etc/config/example/paraview.csh similarity index 86% rename from etc/apps/paraview3/cshrc-EXAMPLE rename to etc/config/example/paraview.csh index 475dbffce0..8509e924e3 100644 --- a/etc/apps/paraview3/cshrc-EXAMPLE +++ b/etc/config/example/paraview.csh @@ -22,10 +22,10 @@ # along with OpenFOAM. If not, see . # # File -# paraview3/cshrc-EXAMPLE +# config/example/paraview.csh # # Description -# Example of chaining to the standard paraview3/cshrc with a +# Example of chaining to the standard config/paraview.csh with a # different ParaView_VERSION # # Note @@ -35,10 +35,10 @@ #------------------------------------------------------------------------------ # -# Use other (shipped) cshrc with a different ParaView_VERSION +# Use other (shipped) paraview.csh with a different ParaView_VERSION # -set foamFile=`$WM_PROJECT_DIR/bin/foamEtcFile -mode o apps/paraview3/cshrc` +set foamFile=`$WM_PROJECT_DIR/bin/foamEtcFile -mode o config/paraview.csh` if ( $status == 0 ) source $foamFile ParaView_VERSION=3.9.0 unset foamFile diff --git a/etc/apps/paraview3/bashrc-EXAMPLE b/etc/config/example/paraview.sh similarity index 86% rename from etc/apps/paraview3/bashrc-EXAMPLE rename to etc/config/example/paraview.sh index 8db47a9ec7..09b300f137 100644 --- a/etc/apps/paraview3/bashrc-EXAMPLE +++ b/etc/config/example/paraview.sh @@ -22,10 +22,10 @@ # along with OpenFOAM. If not, see . # # File -# paraview3/bashrc-EXAMPLE +# config/example/paraview.sh # # Description -# Example of chaining to the standard paraview3/bashrc with a +# Example of chaining to the standard config/paraview.sh with a # different ParaView_VERSION # # Note @@ -35,10 +35,10 @@ #------------------------------------------------------------------------------ # -# Use other (shipped) bashrc with a different ParaView_VERSION +# Use other (shipped) paraview.sh with a different ParaView_VERSION # -foamFile=$($WM_PROJECT_DIR/bin/foamEtcFile -mode o apps/paraview3/bashrc 2>/dev/null) +foamFile=$($WM_PROJECT_DIR/bin/foamEtcFile -mode o config/paraview.sh 2>/dev/null) [ $? -eq 0 ] && . $foamFile ParaView_VERSION=3.9.0 unset foamFile diff --git a/etc/prefs.csh-EXAMPLE b/etc/config/example/prefs.csh similarity index 98% rename from etc/prefs.csh-EXAMPLE rename to etc/config/example/prefs.csh index 56091f798e..83f7a7b7b4 100644 --- a/etc/prefs.csh-EXAMPLE +++ b/etc/config/example/prefs.csh @@ -22,7 +22,7 @@ # along with OpenFOAM. If not, see . # # File -# etc/prefs.csh +# config/example/prefs.csh # # Description # Preset variables for the OpenFOAM configuration - C-Shell shell syntax. diff --git a/etc/prefs.sh-EXAMPLE b/etc/config/example/prefs.sh similarity index 98% rename from etc/prefs.sh-EXAMPLE rename to etc/config/example/prefs.sh index f3e771d030..d2251ce63f 100644 --- a/etc/prefs.sh-EXAMPLE +++ b/etc/config/example/prefs.sh @@ -22,7 +22,7 @@ # along with OpenFOAM. If not, see . # # File -# etc/prefs.sh +# config/example/prefs.sh # # Description # Preset variables for the OpenFOAM configuration - POSIX shell syntax. diff --git a/etc/apps/paraview3/cshrc b/etc/config/paraview.csh similarity index 98% rename from etc/apps/paraview3/cshrc rename to etc/config/paraview.csh index 867353e843..9b4f9137aa 100644 --- a/etc/apps/paraview3/cshrc +++ b/etc/config/paraview.csh @@ -22,7 +22,7 @@ # along with OpenFOAM. If not, see . # # File -# paraview3/cshrc +# config/paraview.csh # # Description # Setup file for paraview-3.x @@ -49,7 +49,7 @@ foreach cmake ( cmake-2.8.4 cmake-2.8.3 cmake-2.8.1 ) end #- ParaView version, automatically determine major version: -setenv ParaView_VERSION 3.8.0 +setenv ParaView_VERSION 3.10.1 setenv ParaView_MAJOR detect diff --git a/etc/apps/paraview3/bashrc b/etc/config/paraview.sh similarity index 98% rename from etc/apps/paraview3/bashrc rename to etc/config/paraview.sh index 1dd5386829..331f3092dd 100644 --- a/etc/apps/paraview3/bashrc +++ b/etc/config/paraview.sh @@ -22,7 +22,7 @@ # along with OpenFOAM. If not, see . # # File -# paraview3/bashrc +# config/paraview.sh # # Description # Setup file for paraview-3.x @@ -51,7 +51,7 @@ done #- ParaView version, automatically determine major version -export ParaView_VERSION=3.8.0 +export ParaView_VERSION=3.10.1 export ParaView_MAJOR=detect @@ -113,7 +113,6 @@ else unset PV_PLUGIN_PATH fi - unset _foamParaviewEval unset cleaned cmake paraviewInstDir paraviewPython diff --git a/etc/apps/scotch/bashrc b/etc/config/scotch.sh similarity index 98% rename from etc/apps/scotch/bashrc rename to etc/config/scotch.sh index 0fb6952110..f32f62292c 100644 --- a/etc/apps/scotch/bashrc +++ b/etc/config/scotch.sh @@ -22,7 +22,7 @@ # along with OpenFOAM. If not, see . # # File -# scotch/bashrc +# config/scotch.sh # # Description # Setup file for scotch include/libraries. @@ -36,5 +36,4 @@ export SCOTCH_VERSION=scotch_5.1.11 export SCOTCH_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$SCOTCH_VERSION - # ----------------------------------------------------------------------------- diff --git a/etc/settings.csh b/etc/config/settings.csh similarity index 98% rename from etc/settings.csh rename to etc/config/settings.csh index b3daf1e288..986a35a1b6 100644 --- a/etc/settings.csh +++ b/etc/config/settings.csh @@ -22,7 +22,7 @@ # along with OpenFOAM. If not, see . # # File -# etc/settings.csh +# etc/config/settings.csh # # Description # Startup file for OpenFOAM @@ -193,7 +193,7 @@ unsetenv MPFR_ARCH_PATH GMP_ARCH_PATH # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ if ( ! $?foamCompiler ) then set foamCompiler=system - echo "Warning in $WM_PROJECT_DIR/etc/settings.csh:" + echo "Warning in $WM_PROJECT_DIR/etc/config/settings.csh:" echo " foamCompiler not set, using '$foamCompiler'" endif @@ -241,7 +241,7 @@ case ThirdParty: breaksw default: echo - echo "Warning in $WM_PROJECT_DIR/etc/settings.csh:" + echo "Warning in $WM_PROJECT_DIR/etc/config/settings.csh:" echo " Unknown OpenFOAM compiler type '$WM_COMPILER'" echo " Please check your settings" echo @@ -262,7 +262,7 @@ case ThirdParty: # Check that the compiler directory can be found if ( ! -d "$gccDir" ) then echo - echo "Warning in $WM_PROJECT_DIR/etc/settings.csh:" + echo "Warning in $WM_PROJECT_DIR/etc/config/settings.csh:" echo " Cannot find $gccDir installation." echo " Please install this compiler version or if you wish to use the system compiler," echo " change the 'foamCompiler' setting to 'system'" @@ -302,7 +302,7 @@ case ThirdParty: # Check that the compiler directory can be found if ( ! -d "$clangDir" ) then echo - echo "Warning in $WM_PROJECT_DIR/etc/settings.csh:" + echo "Warning in $WM_PROJECT_DIR/etc/config/settings.csh:" echo " Cannot find $clangDir installation." echo " Please install this compiler version or if you wish to use the system compiler," echo " change the 'foamCompiler' setting to 'system'" diff --git a/etc/settings.sh b/etc/config/settings.sh similarity index 97% rename from etc/settings.sh rename to etc/config/settings.sh index 954868dad1..086ab174c9 100644 --- a/etc/settings.sh +++ b/etc/config/settings.sh @@ -22,7 +22,7 @@ # along with OpenFOAM. If not, see . # # File -# etc/settings.sh +# etc/config/settings.sh # # Description # Startup file for OpenFOAM @@ -215,7 +215,7 @@ unset MPFR_ARCH_PATH GMP_ARCH_PATH if [ -z "$foamCompiler" ] then foamCompiler=system - echo "Warning in $WM_PROJECT_DIR/etc/settings.sh:" 1>&2 + echo "Warning in $WM_PROJECT_DIR/etc/config/settings.sh:" 1>&2 echo " foamCompiler not set, using '$foamCompiler'" 1>&2 fi @@ -258,7 +258,7 @@ OpenFOAM | ThirdParty) ;; *) echo - echo "Warning in $WM_PROJECT_DIR/etc/settings.sh:" + echo "Warning in $WM_PROJECT_DIR/etc/config/settings.sh:" echo " Unknown OpenFOAM compiler type '$WM_COMPILER'" echo " Please check your settings" echo @@ -278,7 +278,7 @@ OpenFOAM | ThirdParty) # Check that the compiler directory can be found [ -d "$gccDir" ] || { echo - echo "Warning in $WM_PROJECT_DIR/etc/settings.sh:" + echo "Warning in $WM_PROJECT_DIR/etc/config/settings.sh:" echo " Cannot find $gccDir installation." echo " Please install this compiler version or if you wish to use the system compiler," echo " change the 'foamCompiler' setting to 'system'" @@ -322,7 +322,7 @@ OpenFOAM | ThirdParty) # Check that the compiler directory can be found [ -d "$clangDir" ] || { echo - echo "Warning in $WM_PROJECT_DIR/etc/settings.sh:" + echo "Warning in $WM_PROJECT_DIR/etc/config/settings.sh:" echo " Cannot find $clangDir installation." echo " Please install this compiler version or if you wish to use the system compiler," echo " change the 'foamCompiler' setting to 'system'" diff --git a/etc/unset.csh b/etc/config/unset.csh similarity index 99% rename from etc/unset.csh rename to etc/config/unset.csh index 48a1637912..d9a3d69787 100644 --- a/etc/unset.csh +++ b/etc/config/unset.csh @@ -22,7 +22,7 @@ # along with OpenFOAM. If not, see . # # File -# etc/unset.csh +# etc/config/unset.csh # # Description # Clear as many OpenFOAM environment settings as possible diff --git a/etc/unset.sh b/etc/config/unset.sh similarity index 99% rename from etc/unset.sh rename to etc/config/unset.sh index 23e182aa53..66ee2e35b5 100644 --- a/etc/unset.sh +++ b/etc/config/unset.sh @@ -22,7 +22,7 @@ # along with OpenFOAM. If not, see . # # File -# etc/unset.sh +# etc/config/unset.sh # # Description # Clear as many OpenFOAM environment settings as possible diff --git a/etc/controlDict b/etc/controlDict index 5b1ee397f0..7f4a050673 100644 --- a/etc/controlDict +++ b/etc/controlDict @@ -494,6 +494,7 @@ DebugSwitches geomCellLooper 0; geometricSurfacePatch 0; global 0; + globalIndexAndTransform 0; globalMeshData 0; globalPoints 0; gnuplot 0; diff --git a/etc/cshrc b/etc/cshrc index c2c1b12a9b..658f93da69 100644 --- a/etc/cshrc +++ b/etc/cshrc @@ -107,9 +107,6 @@ if ( $?WM_PROJECT_INST_DIR ) then set foamOldDirs="$WM_PROJECT_INST_DIR $foamOldDirs" endif endif -if ( $?WM_PROJECT_SITE ) then - set foamOldDirs="$WM_PROJECT_SITE $foamOldDirs" -endif # Location of installation @@ -124,7 +121,12 @@ setenv WM_THIRD_PARTY_DIR $WM_PROJECT_INST_DIR/ThirdParty-$WM_PROJECT_VERSION # Location of site-specific templates etc # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # unset is equivalent to $WM_PROJECT_INST_DIR/site -unsetenv WM_PROJECT_SITE +if ( $?WM_PROJECT_SITE ) then + set foamOldDirs="$WM_PROJECT_SITE $foamOldDirs" + if ( ! -d "$WM_PROJECT_SITE" ) unsetenv WM_PROJECT_SITE +else + unsetenv WM_PROJECT_SITE +endif # Location of user files # ~~~~~~~~~~~~~~~~~~~~~~ @@ -138,7 +140,7 @@ alias _foamSource 'if ($?FOAM_VERBOSE && $?prompt) echo "Sourcing: \!*"; if (\!* _foamSource `$WM_PROJECT_DIR/bin/foamEtcFile prefs.csh` # Evaluate command-line parameters and record settings for later -# these can be used to set/unset values, or specify prefs files +# these can be used to set/unset values, or specify alternative pref files setenv FOAM_SETTINGS "${*}" while ( $#argv > 0 ) switch ($argv[1]) @@ -194,13 +196,13 @@ if ( $status == 0 ) setenv MANPATH $cleaned # Source project setup files # ~~~~~~~~~~~~~~~~~~~~~~~~~~ -_foamSource $WM_PROJECT_DIR/etc/settings.csh -_foamSource $WM_PROJECT_DIR/etc/aliases.csh +_foamSource $WM_PROJECT_DIR/etc/config/settings.csh +_foamSource $WM_PROJECT_DIR/etc/config/aliases.csh # Source user setup files for optional packages # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -_foamSource `$WM_PROJECT_DIR/bin/foamEtcFile apps/paraview3/cshrc` -_foamSource `$WM_PROJECT_DIR/bin/foamEtcFile apps/ensight/cshrc` +_foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config/paraview.csh` +_foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config/ensight.csh` # Clean environment paths again. Only remove duplicates diff --git a/src/OpenFOAM/db/dynamicLibrary/dynamicCode/dynamicCode.C b/src/OpenFOAM/db/dynamicLibrary/dynamicCode/dynamicCode.C index 78b696fa5a..327fd56eee 100644 --- a/src/OpenFOAM/db/dynamicLibrary/dynamicCode/dynamicCode.C +++ b/src/OpenFOAM/db/dynamicLibrary/dynamicCode/dynamicCode.C @@ -71,6 +71,27 @@ void Foam::dynamicCode::checkSecurity << "using dlopen)" << exit(FatalIOError); } + + if (!allowSystemOperations) + { + FatalIOErrorIn + ( + title, + dict + ) << "Loading a shared library using case-supplied code is not" + << " enabled by default" << nl + << "because of security issues. If you trust the code you can" + << " enable this" << nl + << "facility be adding to the InfoSwitches setting in the system" + << " controlDict:" << nl << nl + << " allowSystemOperations 1" << nl << nl + << "The system controlDict is either" << nl << nl + << " ~/.OpenFOAM/$WM_PROJECT_VERSION/controlDict" << nl << nl + << "or" << nl << nl + << " $WM_PROJECT_DIR/etc/controlDict" << nl + << endl + << exit(FatalIOError); + } } @@ -400,26 +421,6 @@ bool Foam::dynamicCode::copyOrCreateFiles(const bool verbose) const Info<< "Creating new library in " << this->libRelPath() << endl; } - if (!allowSystemOperations) - { - FatalErrorIn - ( - "dynamicCode::copyOrCreateFiles() const" - ) << "Loading a shared library using case-supplied code is not" - << " enabled by default" << nl - << "because of security issues. If you trust the code you can" - << " enable this" << nl - << "facility be adding to the InfoSwitches setting in the system" - << " controlDict:" << nl << nl - << " allowSystemOperations 1" << nl << nl - << "The system controlDict is either" << nl << nl - << " ~/.OpenFOAM/$WM_PROJECT_VERSION/controlDict" << nl << nl - << "or" << nl << nl - << " $WM_PROJECT_DIR/etc/controlDict" << nl - << endl - << exit(FatalError); - } - const label nFiles = compileFiles_.size() + copyFiles_.size(); DynamicList resolvedFiles(nFiles); diff --git a/src/OpenFOAM/global/argList/argList.C b/src/OpenFOAM/global/argList/argList.C index a020f3e5bd..fba0cefe17 100644 --- a/src/OpenFOAM/global/argList/argList.C +++ b/src/OpenFOAM/global/argList/argList.C @@ -414,11 +414,11 @@ Foam::argList::argList ( ( validOptions.found(optionName) - && validOptions[optionName] != "" + && !validOptions[optionName].empty() ) || ( validParOptions.found(optionName) - && validParOptions[optionName] != "" + && !validParOptions[optionName].empty() ) ) { @@ -833,6 +833,116 @@ Foam::argList::~argList() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // +bool Foam::argList::setOption(const word& opt, const string& param) +{ + bool changed = false; + + // only allow valid options + if (validOptions.found(opt)) + { + // some options are to be protected + if + ( + opt == "case" + || opt == "parallel" + || opt == "roots" + ) + { + FatalError + <<"used argList::setOption on a protected option: '" + << opt << "'" << endl; + FatalError.exit(); + } + + if (validOptions[opt].empty()) + { + // bool option + if (!param.empty()) + { + // disallow change of type + FatalError + <<"used argList::setOption to change bool to non-bool: '" + << opt << "'" << endl; + FatalError.exit(); + } + else + { + // did not previously exist + changed = !options_.found(opt); + } + } + else + { + // non-bool option + if (param.empty()) + { + // disallow change of type + FatalError + <<"used argList::setOption to change non-bool to bool: '" + << opt << "'" << endl; + FatalError.exit(); + } + else + { + // existing value needs changing, or did not previously exist + changed = options_.found(opt) ? options_[opt] != param : true; + } + } + } + else + { + FatalError + <<"used argList::setOption on an invalid option: '" + << opt << "'" << nl << "allowed are the following:" + << validOptions << endl; + FatalError.exit(); + } + + // set/change the option as required + if (changed) + { + options_.set(opt, param); + } + + return changed; +} + + +bool Foam::argList::unsetOption(const word& opt) +{ + // only allow valid options + if (validOptions.found(opt)) + { + // some options are to be protected + if + ( + opt == "case" + || opt == "parallel" + || opt == "roots" + ) + { + FatalError + <<"used argList::unsetOption on a protected option: '" + << opt << "'" << endl; + FatalError.exit(); + } + + // remove the option, return true if state changed + return options_.erase(opt); + } + else + { + FatalError + <<"used argList::unsetOption on an invalid option: '" + << opt << "'" << nl << "allowed are the following:" + << validOptions << endl; + FatalError.exit(); + } + + return false; +} + + void Foam::argList::printNotes() const { // output notes directly - no automatic text wrapping diff --git a/src/OpenFOAM/global/argList/argList.H b/src/OpenFOAM/global/argList/argList.H index db5c620451..4f2d236338 100644 --- a/src/OpenFOAM/global/argList/argList.H +++ b/src/OpenFOAM/global/argList/argList.H @@ -334,6 +334,19 @@ public: static void noParallel(); + //- Set option directly (use with caution) + // An option with an empty param is a bool option. + // Not all valid options can also be set: eg, -case, -roots, ... + // Return true if the existing option value needed changing, + // or if the option did not previously exist. + bool setOption(const word& opt, const string& param = ""); + + //- Unset option directly (use with caution) + // Not all valid options can also be unset: eg, -case, -roots ... + // Return true if the option existed before being unset. + bool unsetOption(const word& opt); + + // Print //- Print notes (if any) diff --git a/src/OpenFOAM/meshes/meshTools/matchPoints.C b/src/OpenFOAM/meshes/meshTools/matchPoints.C index dee8992a04..931a152aa5 100644 --- a/src/OpenFOAM/meshes/meshTools/matchPoints.C +++ b/src/OpenFOAM/meshes/meshTools/matchPoints.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -124,7 +124,7 @@ bool Foam::matchPoints { label faceI = pts1MagSqr.indices()[j]; - Pout<< "Compared coord:" << pts1[faceI] + Pout<< " Compared coord:" << pts1[faceI] << " with difference to point " << mag(pts1[faceI] - pts0[face0I]) << endl; } diff --git a/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalPoints.C b/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalPoints.C index 9a1954c507..96895ff92d 100644 --- a/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalPoints.C +++ b/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalPoints.C @@ -57,6 +57,30 @@ Foam::label Foam::globalPoints::countPatchPoints } +Foam::label Foam::globalPoints::findSamePoint +( + const labelPairList& allInfo, + const labelPair& info +) const +{ + const label procI = globalIndexAndTransform::processor(info); + const label index = globalIndexAndTransform::index(info); + + forAll(allInfo, i) + { + if + ( + globalIndexAndTransform::processor(allInfo[i]) == procI + && globalIndexAndTransform::index(allInfo[i]) == index + ) + { + return i; + } + } + return -1; +} + + Foam::labelPairList Foam::globalPoints::addSendTransform ( const label patchI, @@ -67,6 +91,15 @@ Foam::labelPairList Foam::globalPoints::addSendTransform forAll(info, i) { + //Pout<< " adding send transform to" << nl + // << " proc:" << globalIndexAndTransform::processor(info[i]) + // << nl + // << " index:" << globalIndexAndTransform::index(info[i]) << nl + // << " trafo:" + // << globalTransforms_.decodeTransformIndex + // (globalIndexAndTransform::transformIndex(info[i])) + // << endl; + sendInfo[i] = globalIndexAndTransform::encode ( globalIndexAndTransform::processor(info[i]), @@ -129,72 +162,63 @@ bool Foam::globalPoints::mergeInfo { bool anyChanged = false; + // Extend to make space for the nbrInfo (trimmed later) labelPairList newInfo(myInfo); label newI = newInfo.size(); newInfo.setSize(newI + nbrInfo.size()); forAll(nbrInfo, i) { - const labelPair& info = nbrInfo[i]; - label nbrProcI = globalIndexAndTransform::processor(info); - label nbrIndex = globalIndexAndTransform::index(info); - label nbrTransform = globalIndexAndTransform::transformIndex(info); - // Check if already have information about nbr point. There are two // possibilities: // - information found about same point but different transform. // Combine transforms // - information not found. - label myIndex = -1; - forAll(myInfo, myI) - { - if (myInfo[myI] == info) - { - // Fully identical. We already have nbrInfo. - myIndex = myI; - } - else if - ( - globalIndexAndTransform::processor(myInfo[myI]) == nbrProcI - && globalIndexAndTransform::index(myInfo[myI]) == nbrIndex - ) - { - // Only differing is the transform. - label myTransform = globalIndexAndTransform::transformIndex - ( - myInfo[myI] - ); + label index = findSamePoint(myInfo, nbrInfo[i]); - // Combine mine and nbr transform - label t = globalTransforms_.mergeTransformIndex - ( - nbrTransform, - myTransform - ); - myIndex = myI; - - if (t != myTransform) - { - // Same point but different transformation - newInfo[myI] = globalIndexAndTransform::encode - ( - nbrProcI, - nbrIndex, - t - ); - anyChanged = true; - break; - } - } - } - - if (myIndex == -1) + if (index == -1) { // New point newInfo[newI++] = nbrInfo[i]; anyChanged = true; } + else + { + // Same point. So we already have a connection between localPointI + // and the nbrIndex. Two situations: + // - same transform + // - one transform takes two steps, the other just a single. + if (myInfo[index] == nbrInfo[i]) + { + // Everything same (so also transform). Nothing changed. + } + else + { + label myTransform = globalIndexAndTransform::transformIndex + ( + myInfo[index] + ); + label nbrTransform = globalIndexAndTransform::transformIndex + ( + nbrInfo[i] + ); + + // Different transform. See which is 'simplest'. + label minTransform = globalTransforms_.minimumTransformIndex + ( + myTransform, + nbrTransform + ); + + if (minTransform != myTransform) + { + // Use nbr info. + newInfo[index] = nbrInfo[i]; + anyChanged = true; + } + } + } } newInfo.setSize(newI); @@ -327,7 +351,7 @@ void Foam::globalPoints::printProcPoints label index = globalIndexAndTransform::index(pointInfo[i]); label trafoI = globalIndexAndTransform::transformIndex(pointInfo[i]); - Pout<< "proc:" << procI; + Pout<< " proc:" << procI; Pout<< " localpoint:"; Pout<< index; Pout<< " through transform:" @@ -386,6 +410,10 @@ void Foam::globalPoints::initOwnPoints ) ); + //Pout<< "For point "<< pp.points()[meshPointI] + // << " inserting info " << knownInfo + // << endl; + // Update changedpoints info. if (storeInitialInfo(knownInfo, localPointI)) { @@ -613,80 +641,59 @@ void Foam::globalPoints::receivePatchPoints label meshPointA = meshPoints[i]; label meshPointB = coupledMeshPoints[i]; - //Pout<< "Connection between point " << meshPointA - // << " at " << mesh_.points()[meshPointA] - // << " and " << meshPointB - // << " at " << mesh_.points()[meshPointB] << endl; - - label localA = meshToLocalPoint - ( - meshToPatchPoint, - meshPointA - ); - label localB = meshToLocalPoint - ( - meshToPatchPoint, - meshPointB - ); - - - // Do we have information on pointA? - Map