From 0f1e9328a928a3763457896a6e05da45e5cafc89 Mon Sep 17 00:00:00 2001 From: andy Date: Fri, 23 May 2008 17:49:15 +0100 Subject: [PATCH 1/7] removed magGradU application - functionality now in generic magGrad utility. Also removed x permissions to the molConfig utility --- .../velocityField/magGradU/FoamX/magGradU.cfg | 27 ----- .../velocityField/magGradU/Make/files | 3 - .../velocityField/magGradU/Make/options | 6 - .../velocityField/magGradU/magGradU.C | 103 ------------------ .../molConfig/correctVelocities.H | 0 .../preProcessing/molConfig/createMolecules.C | 0 .../preProcessing/molConfig/createPositions.H | 0 .../molConfig/createVelocities.H | 0 .../preProcessing/molConfig/genMolConfig.C | 0 .../molConfig/latticeStructures/BCC.H | 0 .../molConfig/latticeStructures/FCC.H | 0 .../molConfig/latticeStructures/SC.H | 0 .../preProcessing/molConfig/molConfig.C | 0 .../preProcessing/molConfig/molConfig.H | 0 .../preProcessing/molConfig/molConfigI.H | 0 .../preProcessing/molConfig/origin.H | 0 .../preProcessing/molConfig/readZoneSubDict.H | 0 .../preProcessing/molConfig/startingPoint.H | 0 .../velocityDistributions/maxwellian.H | 0 .../molConfig/velocityDistributions/uniform.H | 0 20 files changed, 139 deletions(-) delete mode 100644 applications/utilities/postProcessing/velocityField/magGradU/FoamX/magGradU.cfg delete mode 100644 applications/utilities/postProcessing/velocityField/magGradU/Make/files delete mode 100644 applications/utilities/postProcessing/velocityField/magGradU/Make/options delete mode 100644 applications/utilities/postProcessing/velocityField/magGradU/magGradU.C mode change 100755 => 100644 applications/utilities/preProcessing/molConfig/correctVelocities.H mode change 100755 => 100644 applications/utilities/preProcessing/molConfig/createMolecules.C mode change 100755 => 100644 applications/utilities/preProcessing/molConfig/createPositions.H mode change 100755 => 100644 applications/utilities/preProcessing/molConfig/createVelocities.H mode change 100755 => 100644 applications/utilities/preProcessing/molConfig/genMolConfig.C mode change 100755 => 100644 applications/utilities/preProcessing/molConfig/latticeStructures/BCC.H mode change 100755 => 100644 applications/utilities/preProcessing/molConfig/latticeStructures/FCC.H mode change 100755 => 100644 applications/utilities/preProcessing/molConfig/latticeStructures/SC.H mode change 100755 => 100644 applications/utilities/preProcessing/molConfig/molConfig.C mode change 100755 => 100644 applications/utilities/preProcessing/molConfig/molConfig.H mode change 100755 => 100644 applications/utilities/preProcessing/molConfig/molConfigI.H mode change 100755 => 100644 applications/utilities/preProcessing/molConfig/origin.H mode change 100755 => 100644 applications/utilities/preProcessing/molConfig/readZoneSubDict.H mode change 100755 => 100644 applications/utilities/preProcessing/molConfig/startingPoint.H mode change 100755 => 100644 applications/utilities/preProcessing/molConfig/velocityDistributions/maxwellian.H mode change 100755 => 100644 applications/utilities/preProcessing/molConfig/velocityDistributions/uniform.H diff --git a/applications/utilities/postProcessing/velocityField/magGradU/FoamX/magGradU.cfg b/applications/utilities/postProcessing/velocityField/magGradU/FoamX/magGradU.cfg deleted file mode 100644 index bc1556cde3..0000000000 --- a/applications/utilities/postProcessing/velocityField/magGradU/FoamX/magGradU.cfg +++ /dev/null @@ -1,27 +0,0 @@ -/*---------------------------------------------------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: 1.0 | -| \\ / A nd | Web: http://www.openfoam.org | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ -// magGradU tool definition - -description "Magnitude of grad(U) calculation"; - -magGradUDict -{ - type dictionary; - description "magGradU control dictionary"; - dictionaryPath "system"; - - entries - { - arguments - { - type rootCaseTimeArguments; - } - } -} - -// ************************************************************************* // diff --git a/applications/utilities/postProcessing/velocityField/magGradU/Make/files b/applications/utilities/postProcessing/velocityField/magGradU/Make/files deleted file mode 100644 index fed307a4ca..0000000000 --- a/applications/utilities/postProcessing/velocityField/magGradU/Make/files +++ /dev/null @@ -1,3 +0,0 @@ -magGradU.C - -EXE = $(FOAM_APPBIN)/magGradU diff --git a/applications/utilities/postProcessing/velocityField/magGradU/Make/options b/applications/utilities/postProcessing/velocityField/magGradU/Make/options deleted file mode 100644 index be7f7d631d..0000000000 --- a/applications/utilities/postProcessing/velocityField/magGradU/Make/options +++ /dev/null @@ -1,6 +0,0 @@ -EXE_INC = \ - -I$(LIB_SRC)/finiteVolume/lnInclude - -EXE_LIBS = \ - -lfiniteVolume \ - diff --git a/applications/utilities/postProcessing/velocityField/magGradU/magGradU.C b/applications/utilities/postProcessing/velocityField/magGradU/magGradU.C deleted file mode 100644 index 78df78bcc5..0000000000 --- a/applications/utilities/postProcessing/velocityField/magGradU/magGradU.C +++ /dev/null @@ -1,103 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2007 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 - -Application - magGradU - -Description - Calculates and writes the scalar magnitude of velocity field U at each time - - -\*---------------------------------------------------------------------------*/ - -#include "fvCFD.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -// Main program: - -int main(int argc, char *argv[]) -{ - -# include "addTimeOptions.H" -# include "setRootCase.H" - -# include "createTime.H" - - // Get times list - instantList Times = runTime.times(); - - // set startTime and endTime depending on -time and -latestTime options -# include "checkTimeOptions.H" - - runTime.setTime(Times[startTime], startTime); - -# include "createMesh.H" - - for (label i=startTime; i Date: Sun, 25 May 2008 17:05:26 +0100 Subject: [PATCH 2/7] Removed #.*# --- .../Merkle/#Merkle.C# | 75 ------------------- .../execFlowFunctionObjects/Make/#options# | 20 ----- 2 files changed, 95 deletions(-) delete mode 100644 applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/Merkle/#Merkle.C# delete mode 100644 applications/utilities/postProcessing/miscellaneous/execFlowFunctionObjects/Make/#options# diff --git a/applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/Merkle/#Merkle.C# b/applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/Merkle/#Merkle.C# deleted file mode 100644 index 52ce5fe382..0000000000 --- a/applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/Merkle/#Merkle.C# +++ /dev/null @@ -1,75 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2007 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 - -\*---------------------------------------------------------------------------*/ - -#include "Merkle.H" -#include "addToRunTimeSelectionTable.H" - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -namespace Foam -{ -namespace phaseChangeTwoPhaseMixtures -{ - defineTypeNameAndDebug(Merkle, 0); - addToRunTimeSelectionTable(phaseChangeTwoPhaseMixture, Merkle, components); -} -} - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -Foam::phaseChangeTwoPhaseMixtures::Merkle::Merkle -( - const volVectorField& U, - const surfaceScalarField& phi, - const word& alpha1Name -) -: - phaseChangeTwoPhaseMixture(typeName, U, phi, alpha1Name), - - UInf_(phaseChangeTwoPhaseMixtureCoeffs_.lookup("UInf")), - tInf_(phaseChangeTwoPhaseMixtureCoeffs_.lookup("tInf")), - Cc_(phaseChangeTwoPhaseMixtureCoeffs_.lookup("Cc")), - Cv_(phaseChangeTwoPhaseMixtureCoeffs_.lookup("Cv")), - - p0_("0", pSat().dimensions(), 0.0), - - mcCoeff_(Cc_/(0.5*sqr(UInf_)*tInf_)), - mvCoeff_(Cv_*rho1()/(0.5*sqr(UInf_)*tInf_*rho2())) -{ - correct(); -} - - -// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // - -Foam::Pair > -Foam::phaseChangeTwoPhaseMixtures::Merkle::mDotAlphal() const -{ - const volScalarField& p = alpha1_.db().lookupObject("p"); - - return Pair > - ( - mcCoeff_*max(p - pSat(), p0_), diff --git a/applications/utilities/postProcessing/miscellaneous/execFlowFunctionObjects/Make/#options# b/applications/utilities/postProcessing/miscellaneous/execFlowFunctionObjects/Make/#options# deleted file mode 100644 index ae2f653666..0000000000 --- a/applications/utilities/postProcessing/miscellaneous/execFlowFunctionObjects/Make/#options# +++ /dev/null @@ -1,20 +0,0 @@ -EXE_INC = \ - -I$(FOAM_SRC)/postProcessing/postCalc \ - -I$(LIB_SRC)/finiteVolume/lnInclude \ - -I$(LIB_SRC)/transportModels \ - -I$(LIB_SRC)/turbulenceModels \ - -I$(LIB_SRC)/LESmodels/LESdeltas/lnInclude \ - -I$(LIB_SRC)/LESmodels \ - -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude - -EXE_LIBS = \ - $(FOAM_LIBBIN)/postCalc.o \ - -lfiniteVolume \ - -lincompressibleTransportModels \ - -lincompressibleTurbulenceModels \ - -lincompressibleLESmodels \ - -lbasicThermophysicalModels \ - -lspecie \ - -lcompressibleTurbulenceModels \ - -lcompressibleLESmodels - From 4a2a23a7107270a430ffe7428fd9d608c7151e09 Mon Sep 17 00:00:00 2001 From: henry Date: Sun, 25 May 2008 21:46:37 +0100 Subject: [PATCH 3/7] Lots of changes from Mark and my changes to ddtPhiCorr all mixed together because I failed to work out how to merge Mark's stuff -- HELP!!! --- applications/Allwmake | 4 +- .../incompressible/icoDyMFoam/icoDyMFoam.C | 77 +++++++--- .../multiphase/interDyMFoam/interDyMFoam.C | 8 +- .../solvers/multiphase/interDyMFoam/pEqn.H | 39 ++++-- .../mesh/conversion/ccm26ToFoam/Allwmake | 10 +- bin/foamDiffSourceList | 12 +- bin/foamPack | 9 +- bin/foamPackSource | 10 +- bin/paraFoam | 81 ++++++----- etc/apps/paraview3/bashrc | 16 ++- etc/apps/paraview3/cshrc | 9 +- etc/bashrc | 2 +- etc/settings.sh | 9 +- .../HashTables/HashTable/HashTable.C | 69 ++++++--- .../HashTables/HashTable/HashTable.H | 10 +- .../HashTables/HashTable/HashTableI.H | 15 +- .../linkTypes/DLListBase/DLListBase.C | 37 +++++ .../linkTypes/DLListBase/DLListBase.H | 6 + .../linkTypes/DLListBase/DLListBaseI.H | 10 ++ src/OpenFOAM/containers/Lists/List/List.C | 14 ++ src/OpenFOAM/containers/Lists/List/List.H | 8 +- .../Lists/SortableList/SortableList.C | 41 ++++-- .../Lists/SortableList/SortableList.H | 5 +- src/OpenFOAM/db/dictionary/dictionary.C | 26 ++++ src/OpenFOAM/meshes/meshShapes/edge/edge.H | 8 +- src/OpenFOAM/meshes/meshShapes/edge/edgeI.H | 32 ++++- src/OpenFOAM/meshes/meshShapes/face/face.C | 45 +++++- src/OpenFOAM/meshes/meshShapes/face/face.H | 8 +- .../meshes/meshShapes/triFace/triFace.H | 28 +++- .../meshes/meshShapes/triFace/triFaceI.H | 122 ++++++++++++++-- .../meshes/polyMesh/zones/ZoneMesh/ZoneMesh.C | 12 +- .../meshes/polyMesh/zones/ZoneMesh/ZoneMesh.H | 13 +- src/OpenFOAM/primitives/strings/word/word.H | 7 +- src/OpenFOAM/primitives/strings/word/wordI.H | 21 ++- src/engine/engineTime/engineTime.C | 132 ++++++++++-------- src/engine/engineTime/engineTime.H | 57 ++++++-- .../EulerDdtScheme/EulerDdtScheme.C | 4 +- src/lagrangian/basic/Make/files | 0 src/lagrangian/basic/Make/options | 0 src/lagrangian/dieselSpray/Make/files | 0 src/lagrangian/dieselSpray/Make/options | 0 src/lagrangian/dieselSpray/parcel/parcel.C | 28 ++-- src/lagrangian/dieselSpray/parcel/parcel.H | 19 +-- src/lagrangian/dieselSpray/parcel/parcelI.H | 11 +- src/lagrangian/dieselSpray/parcel/parcelIO.C | 20 ++- src/lagrangian/dieselSpray/spray/spray.C | 2 +- src/lagrangian/intermediate/Make/options | 0 src/lagrangian/solidParticle/Make/files | 0 src/lagrangian/solidParticle/Make/options | 0 .../liquidMixture/liquidMixture.C | 40 ++++-- .../liquidMixture/liquidMixture.H | 44 +++++- src/thermophysicalModels/radiation/Make/files | 0 .../radiation/Make/options | 0 .../aachenBomb/constant/chemistryProperties | 20 +-- .../aachenBomb/constant/combustionProperties | 23 +-- .../constant/environmentalProperties | 20 +-- .../aachenBomb/constant/injectorProperties | 20 +-- .../aachenBomb/constant/sprayProperties | 30 ++-- .../constant/thermophysicalProperties | 35 +++-- .../aachenBomb/constant/turbulenceProperties | 20 +-- 60 files changed, 938 insertions(+), 410 deletions(-) mode change 100755 => 100644 src/lagrangian/basic/Make/files mode change 100755 => 100644 src/lagrangian/basic/Make/options mode change 100755 => 100644 src/lagrangian/dieselSpray/Make/files mode change 100755 => 100644 src/lagrangian/dieselSpray/Make/options mode change 100755 => 100644 src/lagrangian/intermediate/Make/options mode change 100755 => 100644 src/lagrangian/solidParticle/Make/files mode change 100755 => 100644 src/lagrangian/solidParticle/Make/options mode change 100755 => 100644 src/thermophysicalModels/radiation/Make/files mode change 100755 => 100644 src/thermophysicalModels/radiation/Make/options diff --git a/applications/Allwmake b/applications/Allwmake index a734704b28..7437e4f9b0 100755 --- a/applications/Allwmake +++ b/applications/Allwmake @@ -1,5 +1,5 @@ #!/bin/sh set -x -(cd solvers ; wmake all) -(cd utilities ; wmake all) +( cd solvers && wmake all ) +( cd utilities && wmake all ) diff --git a/applications/solvers/incompressible/icoDyMFoam/icoDyMFoam.C b/applications/solvers/incompressible/icoDyMFoam/icoDyMFoam.C index 39774a3373..d76d8c9ce4 100644 --- a/applications/solvers/incompressible/icoDyMFoam/icoDyMFoam.C +++ b/applications/solvers/incompressible/icoDyMFoam/icoDyMFoam.C @@ -56,32 +56,35 @@ int main(int argc, char *argv[]) { # include "readControls.H" # include "CourantNo.H" - - p.storePrevIter(); - - // Make the fluxes absolute - fvc::makeAbsolute(phi, U); - # include "setDeltaT.H" runTime++; Info<< "Time = " << runTime.timeName() << nl << endl; - bool meshChanged = mesh.update(); + // Make the fluxes absolute + if (mesh.changing()) + { + phi = fvc::interpolate(U) & mesh.Sf(); + } - if (correctPhi && meshChanged) + mesh.update(); + + if (mesh.changing() && correctPhi) { # include "correctPhi.H" } // Keep the absolute fluxes for use in ddtPhiCorr - surfaceScalarField phiAbs("phiAbs", phi); + surfaceScalarField phiAbs0("phiAbs0", phi); // Make the fluxes relative to the mesh motion - fvc::makeRelative(phi, U); + if (mesh.changing()) + { + fvc::makeRelative(phi, U); + } - if (meshChanged && checkMeshCourantNo) + if (mesh.changing() && checkMeshCourantNo) { # include "meshCourantNo.H" } @@ -89,6 +92,8 @@ int main(int argc, char *argv[]) // --- PIMPLE loop for (int ocorr=0; ocorr/dev/null || usage "directory does not exist: '$caseDir'" - ;; - *) - usage "unknown option/argument: '$*'" - ;; - esac + case "$1" in + -h | -help) + usage + ;; + -case) + shift + caseDir=$1 + [ "$#" -ge 1 ] || usage "'-case' option requires an argument" + cd "$caseDir" 2>/dev/null || usage "directory does not exist: '$caseDir'" + ;; + *) + usage "unknown option/argument: '$*'" + ;; + esac fi # get a sensible caseName @@ -67,41 +67,38 @@ caseName=${PWD##*/} # parent directory for normal or parallel results case "$caseName" in - processor*) parentDir=".." ;; - *) parentDir="." ;; + processor*) parentDir=".." ;; + *) parentDir="." ;; esac # check existence of essential files for check in system/controlDict system/fvSchemes system/fvSolution do - [ -s "$parentDir/$check" ] || usage "file does not exist: '$parentDir/$check'" + [ -s "$parentDir/$check" ] || usage "file does not exist: '$parentDir/$check'" done -OpenFoamExt="foam" -# OpenFoamExt="OpenFOAM" +caseFile="$caseName.foam" +# caseFile="$caseName.OpenFOAM" -if [ "$ParaView_VERSION" = "3" ]; then +case "$ParaView_VERSION" in +2*) + # Clean up on termination and on Ctrl-C + trap "rm -f paraFoam.pvs $caseFile 2>/dev/null; exit 0" EXIT TERM INT + touch $caseFile - # check existence of essential files - for check in system/controlDict system/fvSchemes system/fvSolution - do - [ -s "$parentDir/$check" ] || usage "file does not exist: '$parentDir/$check'" - done + # since we are now in the cwd, %CASE% is '$PWD/$caseFile' + sed -e s@%CASE%@$PWD/$caseFile@g \ + $WM_PROJECT_DIR/bin/paraFoam.pvs > paraFoam.pvs - touch $caseName.$OpenFoamExt - paraview --data=$caseName.$OpenFoamExt - rm $caseName.$OpenFoamExt 2>/dev/null + paraview paraFoam.pvs + ;; -else - - # since we are now in the cwd, FOAM_ROOT/FOAM_CASE is '$PWD' - sed -e s%FOAM_ROOT/FOAM_CASE%$PWD%g \ - -e s%FOAM_CASE%$caseName%g $WM_PROJECT_DIR/bin/paraFoam.pvs > paraFoam.pvs - - touch $caseName.$OpenFoamExt - paraview paraFoam.pvs - rm paraFoam.pvs $caseName.$OpenFoamExt 2>/dev/null - -fi +*) + # Clean up on termination and on Ctrl-C + trap "rm -f $caseFile 2>/dev/null; exit 0" EXIT TERM INT + touch $caseFile + paraview --data=$caseFile + ;; +esac #------------------------------------------------------------------------------ diff --git a/etc/apps/paraview3/bashrc b/etc/apps/paraview3/bashrc index c02b490abb..3d197f43f3 100644 --- a/etc/apps/paraview3/bashrc +++ b/etc/apps/paraview3/bashrc @@ -41,18 +41,26 @@ export CMAKE_HOME=$WM_PROJECT_INST_DIR/$WM_ARCH/cmake-2.4.6 if [ -r $CMAKE_HOME ]; then export PATH=$CMAKE_HOME/bin:$PATH +else + unset CMAKE_HOME fi -export ParaView_VERSION=3 +# export ParaView_VERSION="3.3-cvs" +export ParaView_VERSION=3.3 -export ParaView_INST_DIR=$WM_PROJECT_INST_DIR/ParaView3.3-cvs +export ParaView_INST_DIR=$WM_PROJECT_INST_DIR/paraview-$ParaView_VERSION export ParaView_DIR=$ParaView_INST_DIR/platforms/$WM_OPTIONS -export PYTHONPATH=$PYTHONPATH:$ParaView_DIR/bin:$ParaView_DIR/Utilities/VTKPythonWrapping +if [ "$PYTHONPATH" ]; then + export PYTHONPATH=$PYTHONPATH:$ParaView_DIR/Utilities/VTKPythonWrapping +else + export PYTHONPATH=$ParaView_DIR/Utilities/VTKPythonWrapping +fi + if [ -r $ParaView_DIR ]; then export PATH=$ParaView_DIR/bin:$PATH - export LD_LIBRARY_PATH=${ParaView_DIR}/bin:${LD_LIBRARY_PATH} + export LD_LIBRARY_PATH=$ParaView_DIR/lib/paraview-$ParaView_VERSION:$LD_LIBRARY_PATH export PV_PLUGIN_PATH=$FOAM_LIBBIN fi diff --git a/etc/apps/paraview3/cshrc b/etc/apps/paraview3/cshrc index c419259279..e3d3c87ea2 100644 --- a/etc/apps/paraview3/cshrc +++ b/etc/apps/paraview3/cshrc @@ -41,11 +41,14 @@ setenv CMAKE_HOME $WM_PROJECT_INST_DIR/$WM_ARCH/cmake-2.4.6 if ( -r $CMAKE_HOME ) then set path=($CMAKE_HOME/bin $path) +else + unset CMAKE_HOME endif -setenv ParaView_VERSION 3 +# setenv ParaView_VERSION 3.3-cvs +setenv ParaView_VERSION 3.3 -setenv ParaView_INST_DIR $WM_PROJECT_INST_DIR/ParaView3.3-cvs +export ParaView_INST_DIR=$WM_PROJECT_INST_DIR/paraview-$ParaView_VERSION setenv ParaView_DIR $ParaView_INST_DIR/platforms/$WM_OPTIONS if ($?PYTHONPATH) then @@ -56,7 +59,7 @@ endif if ( -r $ParaView_INST_DIR ) then set path=($ParaView_DIR/bin $path) - setenv LD_LIBRARY_PATH ${ParaView_DIR}/bin:${LD_LIBRARY_PATH} + setenv LD_LIBRARY_PATH $ParaView_DIR/lib/paraview-$ParaView_VERSION:$LD_LIBRARY_PATH setenv PV_PLUGIN_PATH $FOAM_LIBBIN endif diff --git a/etc/bashrc b/etc/bashrc index 298849ed79..e060b264ce 100644 --- a/etc/bashrc +++ b/etc/bashrc @@ -63,7 +63,7 @@ export WM_PROJECT_USER_DIR=$HOME/$WM_PROJECT/$USER-$WM_PROJECT_VERSION # Compiler (if set to "" use the system compiler) # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -export WM_COMPILER=Gcc +export WM_COMPILER=Gcc43 export WM_COMPILER_ARCH= export WM_COMPILER_LIB_ARCH= diff --git a/etc/settings.sh b/etc/settings.sh index 8535ad64da..ebf715f0be 100644 --- a/etc/settings.sh +++ b/etc/settings.sh @@ -97,7 +97,14 @@ WM_COMPILER_INST=OpenFOAM case "$WM_COMPILER_INST" in OpenFOAM) - export WM_COMPILER_DIR=$FOAM_INST_DIR/$WM_ARCH/gcc-4.2.2$WM_COMPILER_ARCH + case "$WM_COMPILER" in + Gcc43) + export WM_COMPILER_DIR=$FOAM_INST_DIR/$WM_ARCH/gcc-4.3.0$WM_COMPILER_ARCH + ;; + Gcc) + export WM_COMPILER_DIR=$FOAM_INST_DIR/$WM_ARCH/gcc-4.2.2$WM_COMPILER_ARCH + ;; + esac # Check that the compiler directory can be found if [ ! -d "$WM_COMPILER_DIR" ] diff --git a/src/OpenFOAM/containers/HashTables/HashTable/HashTable.C b/src/OpenFOAM/containers/HashTables/HashTable/HashTable.C index 072fe7077c..0e0d7d58f9 100644 --- a/src/OpenFOAM/containers/HashTables/HashTable/HashTable.C +++ b/src/OpenFOAM/containers/HashTables/HashTable/HashTable.C @@ -202,7 +202,12 @@ List HashTable::toc() const template -bool HashTable::insert(const Key& key, const T& newEntry) +bool HashTable::set +( + const Key& key, + const T& newEntry, + const bool protect +) { if (tableSize_ == 0) { @@ -210,40 +215,70 @@ bool HashTable::insert(const Key& key, const T& newEntry) } label ii = Hash()(key, tableSize_); + hashedEntry* existing = 0; + hashedEntry* prev = 0; - for (hashedEntry* n=table_[ii]; n; n=n->next_) + for (hashedEntry* curr = table_[ii]; curr; curr = curr->next_) { - if (key == n->key_) + if (key == curr->key_) + { + existing = curr; + break; + } + prev = curr; + } + + // not found, insert it at the head + if (!existing) + { + table_[ii] = new hashedEntry(key, table_[ii], newEntry); + nElmts_++; + + if (double(nElmts_)/tableSize_ > 0.8) { # ifdef FULLDEBUG if (debug) { - Info<< "HashTable::insert" - "(const Key& key, T newEntry) : " - "Cannot insert " << key << " already in hash table\n"; + Info<< "HashTable::set" + "(const Key& key, T newEntry) : " + "Doubling table size\n"; } # endif - return false; + resize(2*tableSize_); } } - - table_[ii] = new hashedEntry(key, table_[ii], newEntry); - - nElmts_++; - - if (double(nElmts_)/tableSize_ > 0.8) + else if (protect) { + // found - but protected from overwriting + // this corresponds to the STL 'insert' convention # ifdef FULLDEBUG if (debug) { - Info<< "HashTable::insert" - "(const Key& key, T newEntry) : " - "Doubling table size\n"; + Info<< "HashTable::set" + "(const Key& key, T newEntry, false) : " + "Cannot insert " << key << " already in hash table\n"; } # endif + return false; + } + else + { + // found - overwrite existing entry + // this corresponds to the Perl convention + hashedEntry* elemPtr = new hashedEntry(key, existing->next_, newEntry); - resize(2*tableSize_); + // replace existing element - within list or insert at the head + if (prev) + { + prev->next_ = elemPtr; + } + else + { + table_[ii] = elemPtr; + } + + delete existing; } return true; diff --git a/src/OpenFOAM/containers/HashTables/HashTable/HashTable.H b/src/OpenFOAM/containers/HashTables/HashTable/HashTable.H index b74ac01d33..29dd037e54 100644 --- a/src/OpenFOAM/containers/HashTables/HashTable/HashTable.H +++ b/src/OpenFOAM/containers/HashTables/HashTable/HashTable.H @@ -123,6 +123,11 @@ class HashTable label nElmts_; + // Private Member Functions + + //- Assign a new hashedEntry to a possibly already existing key + bool set(const Key& key, const T& newElmt, bool protect); + public: //- Declare friendship with the HashPtrTable class @@ -181,7 +186,10 @@ public: // Edit //- Insert a new hashedEntry - bool insert(const Key& key, const T& newElmt); + inline bool insert(const Key& key, const T& newElmt); + + //- Assign a new hashedEntry, overwriting existing entries + inline bool set(const Key& key, const T& newElmt); //- Erase an hashedEntry specified by given iterator bool erase(const iterator& it); diff --git a/src/OpenFOAM/containers/HashTables/HashTable/HashTableI.H b/src/OpenFOAM/containers/HashTables/HashTable/HashTableI.H index e934aaa316..61c5115fa3 100644 --- a/src/OpenFOAM/containers/HashTables/HashTable/HashTableI.H +++ b/src/OpenFOAM/containers/HashTables/HashTable/HashTableI.H @@ -56,6 +56,19 @@ inline label HashTable::size() const } +template +inline bool HashTable::insert(const Key& key, const T& newEntry) +{ + return set(key, newEntry, true); +} + + +template +inline bool HashTable::set(const Key& key, const T& newEntry) +{ + return set(key, newEntry, false); +} + // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // template @@ -292,7 +305,7 @@ inline HashTable::const_iterator::const_iterator template inline HashTable::const_iterator::const_iterator -( +( const iterator& iter ) : diff --git a/src/OpenFOAM/containers/LinkedLists/linkTypes/DLListBase/DLListBase.C b/src/OpenFOAM/containers/LinkedLists/linkTypes/DLListBase/DLListBase.C index a932c788d1..077040d466 100644 --- a/src/OpenFOAM/containers/LinkedLists/linkTypes/DLListBase/DLListBase.C +++ b/src/OpenFOAM/containers/LinkedLists/linkTypes/DLListBase/DLListBase.C @@ -229,6 +229,43 @@ DLListBase::link* DLListBase::remove(DLListBase::link* l) } +DLListBase::link* DLListBase::replace +( + DLListBase::link* oldLink, + DLListBase::link* newLink +) +{ + link* ret = oldLink; + + newLink->prev_ = oldLink->prev_; + newLink->next_ = oldLink->next_; + + if (oldLink == first_ && first_ == last_) + { + first_ = newLink; + last_ = newLink; + } + else if (oldLink == first_) + { + first_ = newLink; + newLink->next_->prev_ = newLink; + } + else if (oldLink == last_) + { + last_ = newLink; + newLink->prev_->next_ = newLink; + } + else + { + newLink->prev_->next_ = newLink; + newLink->next_->prev_ = newLink; + } + + ret->deregister(); + return ret; +} + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam diff --git a/src/OpenFOAM/containers/LinkedLists/linkTypes/DLListBase/DLListBase.H b/src/OpenFOAM/containers/LinkedLists/linkTypes/DLListBase/DLListBase.H index 5c7fe6e2c3..1e51ac5c18 100644 --- a/src/OpenFOAM/containers/LinkedLists/linkTypes/DLListBase/DLListBase.H +++ b/src/OpenFOAM/containers/LinkedLists/linkTypes/DLListBase/DLListBase.H @@ -158,6 +158,12 @@ public: // Remove and return element specified by iterator inline link* remove(iterator&); + //- Replace oldLink with newLink and return element + link* replace(link* oldLink, link* newLink); + + //- Replace oldIter with newLink and return element + inline link* replace(iterator& oldIter, link* newLink); + //- Clear the list inline void clear(); diff --git a/src/OpenFOAM/containers/LinkedLists/linkTypes/DLListBase/DLListBaseI.H b/src/OpenFOAM/containers/LinkedLists/linkTypes/DLListBase/DLListBaseI.H index 84eec49d33..617253c5e3 100644 --- a/src/OpenFOAM/containers/LinkedLists/linkTypes/DLListBase/DLListBaseI.H +++ b/src/OpenFOAM/containers/LinkedLists/linkTypes/DLListBase/DLListBaseI.H @@ -148,6 +148,16 @@ inline DLListBase::link* DLListBase::remove(DLListBase::iterator& it) } +inline DLListBase::link* DLListBase::replace +( + DLListBase::iterator& oldIter, + DLListBase::link* newLink +) +{ + return replace(oldIter.curElmt_, newLink); +} + + // * * * * * * * * * * * * * * * STL iterator * * * * * * * * * * * * * * * // inline DLListBase::iterator::iterator(DLListBase& s, link* elmt) diff --git a/src/OpenFOAM/containers/Lists/List/List.C b/src/OpenFOAM/containers/Lists/List/List.C index 3eecd8c055..6884f8de40 100644 --- a/src/OpenFOAM/containers/Lists/List/List.C +++ b/src/OpenFOAM/containers/Lists/List/List.C @@ -435,6 +435,20 @@ void sort(List& a, const Cmp& cmp) } +template +void stableSort(List& a) +{ + std::stable_sort(a.begin(), a.end()); +} + + +template +void stableSort(List& a, const Cmp& cmp) +{ + std::stable_sort(a.begin(), a.end(), cmp); +} + + // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // // Assignment to UList operator. Takes linear time. diff --git a/src/OpenFOAM/containers/Lists/List/List.H b/src/OpenFOAM/containers/Lists/List/List.H index 50db82f0a3..52e285418e 100644 --- a/src/OpenFOAM/containers/Lists/List/List.H +++ b/src/OpenFOAM/containers/Lists/List/List.H @@ -28,7 +28,7 @@ Class Description A 1D array of objects of type \, where the size of the vector is known and used for subscript bounds checking, etc. - + Storage is allocated on free-store during construction. SourceFiles @@ -195,6 +195,12 @@ void sort(List& a); template void sort(List& a, const Cmp&); +template +void stableSort(List& a); + +template +void stableSort(List& a, const Cmp&); + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/containers/Lists/SortableList/SortableList.C b/src/OpenFOAM/containers/Lists/SortableList/SortableList.C index b20baf4645..78e9553d96 100644 --- a/src/OpenFOAM/containers/Lists/SortableList/SortableList.C +++ b/src/OpenFOAM/containers/Lists/SortableList/SortableList.C @@ -28,14 +28,11 @@ License // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -namespace Foam -{ - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // Construct from List template -SortableList::SortableList(const List& values) +Foam::SortableList::SortableList(const List& values) : List(values), indices_(values.size()) @@ -46,7 +43,7 @@ SortableList::SortableList(const List& values) // Construct given size. Sort later on. template -SortableList::SortableList(const label size) +Foam::SortableList::SortableList(const label size) : List(size), indices_(size) @@ -55,7 +52,7 @@ SortableList::SortableList(const label size) // Construct given size and initial value. Sort later on. template -SortableList::SortableList(const label size, const Type& val) +Foam::SortableList::SortableList(const label size, const Type& val) : List(size, val), indices_(size) @@ -64,7 +61,7 @@ SortableList::SortableList(const label size, const Type& val) // Construct as copy. template -SortableList::SortableList(const SortableList& lst) +Foam::SortableList::SortableList(const SortableList& lst) : List(lst), indices_(lst.indices()) @@ -74,7 +71,7 @@ SortableList::SortableList(const SortableList& lst) // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template -void SortableList::setSize(const label newSize) +void Foam::SortableList::setSize(const label newSize) { List::setSize(newSize); indices_.setSize(newSize); @@ -82,7 +79,7 @@ void SortableList::setSize(const label newSize) template -void SortableList::sort() +void Foam::SortableList::sort() { forAll(indices_, i) { @@ -98,7 +95,29 @@ void SortableList::sort() tmpValues[i] = this->operator[](indices_[i]); } - List::operator=(tmpValues); + List::transfer(tmpValues); +} + + + +template +void Foam::SortableList::stableSort() +{ + forAll(indices_, i) + { + indices_[i] = i; + } + + Foam::stableSort(indices_, less(*this)); + + List tmpValues(this->size()); + + forAll(indices_, i) + { + tmpValues[i] = this->operator[](indices_[i]); + } + + List::transfer(tmpValues); } @@ -114,6 +133,4 @@ void Foam::SortableList::operator=(const SortableList& rhs) // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace Foam - // ************************************************************************* // diff --git a/src/OpenFOAM/containers/Lists/SortableList/SortableList.H b/src/OpenFOAM/containers/Lists/SortableList/SortableList.H index 6a242180c2..389f98215e 100644 --- a/src/OpenFOAM/containers/Lists/SortableList/SortableList.H +++ b/src/OpenFOAM/containers/Lists/SortableList/SortableList.H @@ -100,7 +100,7 @@ public: // Member Functions - //- Return the list of sorted point indices. Updated every sort. + //- Return the list of sorted indices. Updated every sort. const labelList& indices() const { return indices_; @@ -112,6 +112,9 @@ public: //- Sort the list (if changed after construction time) void sort(); + //- Sort the list (if changed after construction time) + void stableSort(); + // Member Operators diff --git a/src/OpenFOAM/db/dictionary/dictionary.C b/src/OpenFOAM/db/dictionary/dictionary.C index aea31e72c7..df4fbd8e56 100644 --- a/src/OpenFOAM/db/dictionary/dictionary.C +++ b/src/OpenFOAM/db/dictionary/dictionary.C @@ -34,6 +34,7 @@ defineTypeNameAndDebug(Foam::dictionary, 0); const Foam::dictionary Foam::dictionary::null; +#undef DICTIONARY_INPLACE_MERGE // * * * * * * * * * * * * * Private member functions * * * * * * * * * * * // @@ -53,7 +54,27 @@ bool Foam::dictionary::add(entry* ePtr, bool mergeEntry) } else { +#ifdef DICTIONARY_INPLACE_MERGE + if (hashedEntries_.set(ePtr->keyword(), ePtr)) + { + ePtr->name() = name_ + "::" + ePtr->keyword(); + replace(iter(), ePtr); + + return true; + } + else + { + IOWarningIn("dictionary::add(entry* ePtr)", (*this)) + << "problem replacing entry in dictionary " + << name() + << endl; + + delete ePtr; + return false; + } +#else remove(ePtr->keyword()); +#endif } } @@ -517,8 +538,12 @@ bool Foam::dictionary::merge(const dictionary& dict) } else { +#ifdef DICTIONARY_INPLACE_MERGE + add(iter().clone(*this).ptr(), true); +#else remove(keyword); add(iter().clone(*this)()); +#endif changed = true; } } @@ -526,6 +551,7 @@ bool Foam::dictionary::merge(const dictionary& dict) { // not found - just add add(iter().clone(*this)()); + changed = true; } } diff --git a/src/OpenFOAM/meshes/meshShapes/edge/edge.H b/src/OpenFOAM/meshes/meshShapes/edge/edge.H index ccef92bf41..f8fb2696b6 100644 --- a/src/OpenFOAM/meshes/meshShapes/edge/edge.H +++ b/src/OpenFOAM/meshes/meshShapes/edge/edge.H @@ -119,6 +119,12 @@ public: //- Return edge line inline linePointRef line(const pointField&) const; + //- compare edges + // - 0: different + // - +1: identical + // - -1: same edge, but different orientation + static inline int compare(const edge&, const edge&); + // Friend Operators @@ -127,7 +133,7 @@ public: }; -//- Hash specialisation +//- Hash specialisation // Simple commutative hash. template<> inline label Hash::operator()(const edge& e) const diff --git a/src/OpenFOAM/meshes/meshShapes/edge/edgeI.H b/src/OpenFOAM/meshes/meshShapes/edge/edgeI.H index 8aa88ebe78..bd3bd339fd 100644 --- a/src/OpenFOAM/meshes/meshShapes/edge/edgeI.H +++ b/src/OpenFOAM/meshes/meshShapes/edge/edgeI.H @@ -26,6 +26,30 @@ License #include "IOstreams.H" +// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * // + + +// return +// - 0: different +// - +1: identical +// - -1: same edge, but different orientation +inline int Foam::edge::compare(const edge& a, const edge& b) +{ + if (a[0] == b[0] && a[1] == b[1]) + { + return 1; + } + else if (a[0] == b[1] && a[1] == b[0]) + { + return -1; + } + else + { + return 0; + } +} + + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // inline Foam::edge::edge() @@ -146,17 +170,13 @@ inline Foam::linePointRef Foam::edge::line(const pointField& p) const inline bool Foam::operator==(const edge& a, const edge& b) { - return - ( - (a[0] == b[0] && a[1] == b[1]) - || (a[0] == b[1] && a[1] == b[0]) - ); + return edge::compare(a,b) != 0; } inline bool Foam::operator!=(const edge& a, const edge& b) { - return !(a == b); + return edge::compare(a,b) == 0; } diff --git a/src/OpenFOAM/meshes/meshShapes/face/face.C b/src/OpenFOAM/meshes/meshShapes/face/face.C index dda506d789..2d06d0db28 100644 --- a/src/OpenFOAM/meshes/meshShapes/face/face.C +++ b/src/OpenFOAM/meshes/meshShapes/face/face.C @@ -438,7 +438,7 @@ int Foam::face::compare(const face& a, const face& b) // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -void Foam::face::collapse() +Foam::label Foam::face::collapse() { if (size() > 1) { @@ -458,6 +458,8 @@ void Foam::face::collapse() setSize(ci); } + + return size(); } @@ -696,6 +698,47 @@ Foam::edgeList Foam::face::edges() const } +int Foam::face::edgeDirection(const edge& e) const +{ + if (size() > 2) + { + edge found(-1,-1); + + // find start/end points - this breaks down for degenerate faces + forAll (*this, i) + { + if (operator[](i) == e.start()) + { + found.start() = i; + } + else if (operator[](i) == e.end()) + { + found.end() = i; + } + } + + label diff = found.end() - found.start(); + if (!diff || found.start() < 0 || found.end() < 0) + { + return 0; + } + + // forward direction + if (diff == 1 || diff == 1 - size()) + { + return 1; + } + // reverse direction + if (diff == -1 || diff == -1 + size()) + { + return -1; + } + } + + return 0; +} + + // Number of triangles directly known from number of vertices Foam::label Foam::face::nTriangles ( diff --git a/src/OpenFOAM/meshes/meshShapes/face/face.H b/src/OpenFOAM/meshes/meshShapes/face/face.H index f56919647a..9325801c41 100644 --- a/src/OpenFOAM/meshes/meshShapes/face/face.H +++ b/src/OpenFOAM/meshes/meshShapes/face/face.H @@ -145,7 +145,8 @@ public: // Member Functions //- Collapse face by removing duplicate point labels - void collapse(); + // return the collapsed size + label collapse(); //- Return the points corresponding to this face inline pointField points(const pointField& meshPoints) const; @@ -251,6 +252,11 @@ public: //- Return n-th face edge inline edge faceEdge(const label n) const; + //- Return the edge direction on the face + // - 0: edge not found on the face + // - +1: forward (counter-clockwise) on the face + // - -1: reverse (clockwise) on the face + int edgeDirection(const edge&) const; // Face splitting utilities diff --git a/src/OpenFOAM/meshes/meshShapes/triFace/triFace.H b/src/OpenFOAM/meshes/meshShapes/triFace/triFace.H index aad4ee455f..9672b93147 100644 --- a/src/OpenFOAM/meshes/meshShapes/triFace/triFace.H +++ b/src/OpenFOAM/meshes/meshShapes/triFace/triFace.H @@ -81,18 +81,35 @@ public: const label c ); + //- Construct from a face, discarding excess points + inline triFace(const face&); + + //- Construct from a labelList, discarding excess points + explicit inline triFace(const labelList&); + //- Construct from Istream inline triFace(Istream&); // Member Functions + //- Collapse face by removing duplicate point labels + // return the collapsed size, set collapsed point labels to -1 + inline label collapse(); + + //- Return the edge direction on the face + // - +1: forward (counter-clockwise) on the face + // - -1: reverse (clockwise) on the face + // - 0: edge not found on the face + inline int edgeDirection(const edge&) const; + + // Properties //- Return the points corresponding to this face inline pointField points(const pointField& points) const; - //- Return triagle as a face + //- Return triangle as a face inline face triFaceFace() const; //- Return number of edges @@ -128,9 +145,14 @@ public: const intersection::direction dir = intersection::VECTOR ) const; - //- Return the tetrahedron + //- Return the triangle inline triPointRef tri(const pointField&) const; + //- compare triFaces + // - 0: different + // - +1: identical + // - -1: same face, but different orientation + static inline int compare(const triFace&, const triFace&); // Friend Operators @@ -139,7 +161,7 @@ public: }; -//- Hash specialisation +//- Hash specialisation // Simple commutative hash. template<> inline label Hash::operator()(const triFace& t) const diff --git a/src/OpenFOAM/meshes/meshShapes/triFace/triFaceI.H b/src/OpenFOAM/meshes/meshShapes/triFace/triFaceI.H index c92e1e47e7..9574a06cbf 100644 --- a/src/OpenFOAM/meshes/meshShapes/triFace/triFaceI.H +++ b/src/OpenFOAM/meshes/meshShapes/triFace/triFaceI.H @@ -33,14 +33,45 @@ License namespace Foam { +// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * // + + +inline int triFace::compare(const triFace& a, const triFace& b) +{ + if + ( + (a[0] == b[0] && a[1] == b[1] && a[2] == b[2]) + || (a[0] == b[1] && a[1] == b[2] && a[2] == b[0]) + || (a[0] == b[2] && a[1] == b[0] && a[2] == b[1]) + ) + { + // identical + return 1; + } + else if + ( + (a[0] == b[2] && a[1] == b[1] && a[2] == b[0]) + || (a[0] == b[1] && a[1] == b[0] && a[2] == b[2]) + || (a[0] == b[0] && a[1] == b[2] && a[2] == b[1]) + ) + { + // same face, but reversed orientation + return -1; + } + else + { + return 0; + } +} + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -//- Construct null +// Construct null inline triFace::triFace() {} -//- Construct from components +// Construct from components inline triFace::triFace ( const label a, @@ -53,6 +84,18 @@ inline triFace::triFace operator[](2) = c; } +// Construct from a face +inline triFace::triFace(const face& f) +: + FixedList(SubList