diff --git a/applications/solvers/incompressible/boundaryFoam/evaluateNearWall.H b/applications/solvers/incompressible/boundaryFoam/evaluateNearWall.H index b9683b9e68..8844f21e6e 100644 --- a/applications/solvers/incompressible/boundaryFoam/evaluateNearWall.H +++ b/applications/solvers/incompressible/boundaryFoam/evaluateNearWall.H @@ -7,8 +7,7 @@ scalar epsilon = turbulence->epsilon()()[cellId]; // scalar omega = turbulence->omega()()[cellId]; scalar k = turbulence->k()()[cellId]; - scalar Up = - flowDirection & (U[cellId] - U.boundaryField()[patchId][faceId]); + scalar magUp = mag(U[cellId] - U.boundaryField()[patchId][faceId]); scalar tauw = flowDirection & R & wallNormal; @@ -16,7 +15,7 @@ scalar yPlus = uTau*y[cellId]/(nu + ROOTVSMALL); - scalar uPlus = Up/(uTau + ROOTVSMALL); + scalar uPlus = magUp/(uTau + ROOTVSMALL); scalar nutPlus = nut/nu; @@ -26,7 +25,7 @@ // scalar omegaPlus = omega*nu/(sqr(uTau) + ROOTVSMALL); - scalar Rey = Up*y[cellId]/nu; + scalar Rey = magUp*y[cellId]/nu; Info<< "Rey = " << Rey << ", uTau = " << uTau << ", nut+ = " << nutPlus << ", y+ = " << yPlus << ", u+ = " << uPlus diff --git a/applications/solvers/multiphase/settlingFoam/createFields.H b/applications/solvers/multiphase/settlingFoam/createFields.H index 6acb19994a..a085aebb37 100644 --- a/applications/solvers/multiphase/settlingFoam/createFields.H +++ b/applications/solvers/multiphase/settlingFoam/createFields.H @@ -56,20 +56,11 @@ ); - dimensionedScalar rhoc - ( - transportProperties.lookup("rhoc") - ); + dimensionedScalar rhoc(transportProperties.lookup("rhoc")); - dimensionedScalar rhod - ( - transportProperties.lookup("rhod") - ); + dimensionedScalar rhod(transportProperties.lookup("rhod")); - dimensionedScalar muc - ( - transportProperties.lookup("muc") - ); + dimensionedScalar muc(transportProperties.lookup("muc")); dimensionedScalar plasticViscosityCoeff ( @@ -96,10 +87,7 @@ transportProperties.lookup("yieldStressOffset") ); - Switch BinghamPlastic - ( - transportProperties.lookup("BinghamPlastic") - ); + Switch BinghamPlastic(transportProperties.lookup("BinghamPlastic")); volScalarField rho ( @@ -147,8 +135,8 @@ IOobject::NO_READ, IOobject::AUTO_WRITE ), - muc + - plasticViscosity + muc + + plasticViscosity ( plasticViscosityCoeff, plasticViscosityExponent, @@ -176,10 +164,7 @@ Info<< "Selecting Drift-Flux model " << endl; - word VdjModel - ( - transportProperties.lookup("VdjModel") - ); + word VdjModel(transportProperties.lookup("VdjModel")); Info<< tab << VdjModel << " selected\n" << endl; @@ -188,26 +173,13 @@ transportProperties.subDict(VdjModel + "Coeffs") ); - dimensionedVector V0 - ( - VdjModelCoeffs.lookup("V0") - ); + dimensionedVector V0(VdjModelCoeffs.lookup("V0")); - dimensionedScalar a - ( - VdjModelCoeffs.lookup("a") - ); + dimensionedScalar a(VdjModelCoeffs.lookup("a")); - dimensionedScalar a1 - ( - VdjModelCoeffs.lookup("a1") - ); - - dimensionedScalar alphaMin - ( - VdjModelCoeffs.lookup("alphaMin") - ); + dimensionedScalar a1(VdjModelCoeffs.lookup("a1")); + dimensionedScalar alphaMin(VdjModelCoeffs.lookup("alphaMin")); IOdictionary RASProperties @@ -223,15 +195,9 @@ ); - Switch turbulence - ( - RASProperties.lookup("turbulence") - ); + Switch turbulence(RASProperties.lookup("turbulence")); - dictionary kEpsilonDict - ( - RASProperties.subDictPtr("kEpsilonCoeffs") - ); + dictionary kEpsilonDict(RASProperties.subDictPtr("kEpsilonCoeffs")); dimensionedScalar Cmu ( @@ -273,30 +239,27 @@ ) ); - dimensionedScalar alphak + dimensionedScalar sigmak ( dimensionedScalar::lookupOrAddToDict ( - "alphaEps", + "sigmak", kEpsilonDict, 1.0 ) ); - dimensionedScalar alphaEps + dimensionedScalar sigmaEps ( dimensionedScalar::lookupOrAddToDict ( - "alphaEps", + "sigmaEps", kEpsilonDict, - 0.76923 + 1.3 ) ); - dictionary wallFunctionDict - ( - RASProperties.subDictPtr("wallFunctionCoeffs") - ); + dictionary wallFunctionDict(RASProperties.subDictPtr("wallFunctionCoeffs")); dimensionedScalar kappa ( diff --git a/applications/solvers/multiphase/settlingFoam/kEpsilon.H b/applications/solvers/multiphase/settlingFoam/kEpsilon.H index 742fcde708..522a9afac7 100644 --- a/applications/solvers/multiphase/settlingFoam/kEpsilon.H +++ b/applications/solvers/multiphase/settlingFoam/kEpsilon.H @@ -1,4 +1,4 @@ -if(turbulence) +if (turbulence) { if (mesh.changing()) { @@ -15,9 +15,9 @@ if(turbulence) tgradU.clear(); volScalarField Gcoef = - alphak*Cmu*k*(g & fvc::grad(rho))/(epsilon + epsilon0); + Cmu*k/sigmak*(g & fvc::grad(rho))/(epsilon + epsilon0); -# include "wallFunctions.H" + #include "wallFunctions.H" // Dissipation equation fvScalarMatrix epsEqn @@ -26,7 +26,7 @@ if(turbulence) + fvm::div(phi, epsilon) - fvm::laplacian ( - alphaEps*mut + mul, epsilon, + mut/sigmaEps + mul, epsilon, "laplacian(DepsilonEff,epsilon)" ) == @@ -35,7 +35,7 @@ if(turbulence) - fvm::Sp(C2*rho*epsilon/k, epsilon) ); -# include "wallDissipation.H" + #include "wallDissipation.H" epsEqn.relax(); epsEqn.solve(); @@ -51,7 +51,7 @@ if(turbulence) + fvm::div(phi, k) - fvm::laplacian ( - alphak*mut + mul, k, + mut/sigmak + mul, k, "laplacian(DkEff,k)" ) == @@ -66,7 +66,7 @@ if(turbulence) //- Re-calculate viscosity mut = rho*Cmu*sqr(k)/(epsilon + epsilon0); -# include "wallViscosity.H" + #include "wallViscosity.H" } mu = mut + mul; diff --git a/applications/utilities/preProcessing/changeDictionary/changeDictionary.C b/applications/utilities/preProcessing/changeDictionary/changeDictionary.C index 6ff9bbce18..e8e441b165 100644 --- a/applications/utilities/preProcessing/changeDictionary/changeDictionary.C +++ b/applications/utilities/preProcessing/changeDictionary/changeDictionary.C @@ -72,10 +72,12 @@ namespace Foam int main(int argc, char *argv[]) { -# include "addRegionOption.H" -# include "setRootCase.H" -# include "createTime.H" -# include "createNamedMesh.H" + argList::validOptions.insert("instance", "instance"); + #include "addRegionOption.H" + + #include "setRootCase.H" + #include "createTime.H" + #include "createNamedMesh.H" fileName regionPrefix = ""; if (regionName != fvMesh::defaultRegion) @@ -83,6 +85,12 @@ int main(int argc, char *argv[]) regionPrefix = regionName; } + word instance = runTime.timeName(); + if (args.options().found("instance")) + { + instance = args.options()["instance"]; + } + // Get the replacement rules from a dictionary IOdictionary dict ( @@ -196,12 +204,13 @@ int main(int argc, char *argv[]) Info<< "Loading dictionary " << fieldName << endl; const word oldTypeName = IOdictionary::typeName; const_cast(IOdictionary::typeName) = word::null; + IOdictionary fieldDict ( IOobject ( fieldName, - runTime.timeName(), + instance, mesh, IOobject::MUST_READ, IOobject::NO_WRITE, diff --git a/bin/foamLog b/bin/foamLog index 7490978c6e..47968aa120 100755 --- a/bin/foamLog +++ b/bin/foamLog @@ -58,9 +58,9 @@ cat <_, for every specified, for every occurrence inside @@ -69,7 +69,7 @@ a time step. For variables that are 'Solved for', the initial residual name will be , the final residual receive the name FinalRes, -The files are a simple xy format with the first column Time (default) +The files are output in a simple xy format with the first column Time (default) and the second the extracted values. Option -n creates single column files with the extracted data only. @@ -82,6 +82,7 @@ separated with '/' : The value taken will be the first (non-space)word after this column. The database ($PROGNAME.db) will taken from these locations: + . $HOME/.OpenFOAM/$WM_PROJECT_VERSION $HOME/.OpenFOAM $WM_PROJECT_INST_DIR/site/$WM_PROJECT_VERSION @@ -98,6 +99,7 @@ LABHELP # The various places to be searched: for i in \ + . \ $HOME/.OpenFOAM/$WM_PROJECT_VERSION \ $HOME/.OpenFOAM \ $WM_PROJECT_INST_DIR/site/$WM_PROJECT_VERSION \ @@ -114,7 +116,6 @@ do done - myEcho() { if [ "$VERBOSE" ] then @@ -171,6 +172,7 @@ getSolveQueryList() { done } + # getAllQueries dbFile logFile # Gets all queries from database and from logfile getAllQueries() { @@ -202,6 +204,7 @@ getAllQueries() { done | sort -u } + #----------------------------- # Main #----------------------------- @@ -314,8 +317,6 @@ myEcho "" # Generate Awk program #----------------------------- - - #-- header rm -f $AWKFILE; touch $AWKFILE @@ -355,9 +356,6 @@ function extract(inLine,columnSel,outVar, LABEL - - - #-- Generate code for iteration separator (increments 'Iteration') getQueries $DBFILE 'Separator' cat <> $AWKFILE @@ -418,6 +416,7 @@ cat <> $AWKFILE LABSOLVE + #-- generate code to process queries for queryName in $QUERYNAMES do @@ -438,7 +437,6 @@ do done - #----------------------------- # Run awk program on log #----------------------------- diff --git a/tutorials/heatTransfer/buoyantSimpleFoam/buoyantCavity/README b/tutorials/heatTransfer/buoyantSimpleFoam/buoyantCavity/README new file mode 100644 index 0000000000..c8952e9c42 --- /dev/null +++ b/tutorials/heatTransfer/buoyantSimpleFoam/buoyantCavity/README @@ -0,0 +1,12 @@ +* Buoyancy driven, natural convection + + +* Reference: Betts, P.L. and Bokhari, I.H.; "Experiments in turbulent natural convection in an enclosed tall cavity"; International Journal of Heat and Fluid Flow; volume 21; 2000; pp 675-683. + + +* Test case considers the lower of the two plate temperature differences, 19.6 degC. + + +* Experimental data publicly available from (13/08/2009): + +http://cfd.mace.manchester.ac.uk/cgi-bin/cfddb/prpage.cgi?79&EXP&database/cases/case79/Case_data&database/cases/case79&cas79_head.html&cas79_desc.html&cas79_meth.html&cas79_data.html&cas79_refs.html&cas79_rsol.html&1&0&0&0&0&unknown diff --git a/tutorials/incompressible/boundaryFoam/boundaryWallFunctionsProfile/0/U b/tutorials/incompressible/boundaryFoam/boundaryWallFunctionsProfile/0/U new file mode 100644 index 0000000000..b75d124cdc --- /dev/null +++ b/tutorials/incompressible/boundaryFoam/boundaryWallFunctionsProfile/0/U @@ -0,0 +1,46 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6 | +| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volVectorField; + object U; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 -1 0 0 0 0]; + +internalField uniform (1 0 0); + +boundaryField +{ + lowerWall + { + type fixedValue; + value uniform (0 0 0); + } + + upperWall + { + type fixedValue; + value uniform (0 0 0); + } + + frontBack + { + type cyclic; + } + + defaultFaces + { + type empty; + } +} + +// ************************************************************************* // diff --git a/tutorials/incompressible/boundaryFoam/boundaryWallFunctionsProfile/0/epsilon b/tutorials/incompressible/boundaryFoam/boundaryWallFunctionsProfile/0/epsilon new file mode 100644 index 0000000000..5b6d7f698f --- /dev/null +++ b/tutorials/incompressible/boundaryFoam/boundaryWallFunctionsProfile/0/epsilon @@ -0,0 +1,46 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + location "0"; + object epsilon; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 2 -3 0 0 0 0]; + +internalField uniform 1e-08; + +boundaryField +{ + lowerWall + { + type epsilonWallFunction; + value uniform 1e-08; + } + upperWall + { + type epsilonWallFunction; + value uniform 1e-08; + } + frontBack + { + type cyclic; + value uniform 1e-08; + } + defaultFaces + { + type empty; + } +} + + +// ************************************************************************* // diff --git a/tutorials/incompressible/boundaryFoam/boundaryWallFunctionsProfile/0/k b/tutorials/incompressible/boundaryFoam/boundaryWallFunctionsProfile/0/k new file mode 100644 index 0000000000..d278c05cef --- /dev/null +++ b/tutorials/incompressible/boundaryFoam/boundaryWallFunctionsProfile/0/k @@ -0,0 +1,46 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + location "0"; + object k; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 2 -2 0 0 0 0]; + +internalField uniform 0.000000001; + +boundaryField +{ + lowerWall + { + type kqRWallFunction; + internalField uniform 0.1; + } + upperWall + { + type kqRWallFunction; + internalField uniform 0.1; + } + frontBack + { + type cyclic; + internalField uniform 0.1; + } + defaultFaces + { + type empty; + } +} + + +// ************************************************************************* // diff --git a/tutorials/incompressible/boundaryFoam/boundaryWallFunctionsProfile/0/nuTilda b/tutorials/incompressible/boundaryFoam/boundaryWallFunctionsProfile/0/nuTilda new file mode 100644 index 0000000000..38a021b100 --- /dev/null +++ b/tutorials/incompressible/boundaryFoam/boundaryWallFunctionsProfile/0/nuTilda @@ -0,0 +1,44 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6 | +| \\ / A nd | Web: http://www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + object nuTilda; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 2 -1 0 0 0 0]; + +internalField uniform 0; + +boundaryField +{ + lowerWall + { + type zeroGradient; + } + + upperWall + { + type zeroGradient; + } + + frontBack + { + type cyclic; + } + + defaultFaces + { + type empty; + } +} + +// ************************************************************************* // diff --git a/tutorials/incompressible/boundaryFoam/boundaryWallFunctionsProfile/0/nut b/tutorials/incompressible/boundaryFoam/boundaryWallFunctionsProfile/0/nut new file mode 100644 index 0000000000..5bcd4c4a1d --- /dev/null +++ b/tutorials/incompressible/boundaryFoam/boundaryWallFunctionsProfile/0/nut @@ -0,0 +1,46 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + location "0"; + object nut; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 2 -1 0 0 0 0]; + +internalField uniform 0; + +boundaryField +{ + lowerWall + { + type nutkWallFunction; + value uniform 0; + } + upperWall + { + type nutkWallFunction; + value uniform 0; + } + frontBack + { + type cyclic; + value uniform 0; + } + defaultFaces + { + type empty; + } +} + + +// ************************************************************************* // diff --git a/tutorials/incompressible/boundaryFoam/boundaryWallFunctionsProfile/0/nut.k b/tutorials/incompressible/boundaryFoam/boundaryWallFunctionsProfile/0/nut.k new file mode 100644 index 0000000000..5bcd4c4a1d --- /dev/null +++ b/tutorials/incompressible/boundaryFoam/boundaryWallFunctionsProfile/0/nut.k @@ -0,0 +1,46 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + location "0"; + object nut; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 2 -1 0 0 0 0]; + +internalField uniform 0; + +boundaryField +{ + lowerWall + { + type nutkWallFunction; + value uniform 0; + } + upperWall + { + type nutkWallFunction; + value uniform 0; + } + frontBack + { + type cyclic; + value uniform 0; + } + defaultFaces + { + type empty; + } +} + + +// ************************************************************************* // diff --git a/tutorials/incompressible/boundaryFoam/boundaryWallFunctionsProfile/0/nut.spalding b/tutorials/incompressible/boundaryFoam/boundaryWallFunctionsProfile/0/nut.spalding new file mode 100644 index 0000000000..21cc8ebc19 --- /dev/null +++ b/tutorials/incompressible/boundaryFoam/boundaryWallFunctionsProfile/0/nut.spalding @@ -0,0 +1,46 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + location "0"; + object nut; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 2 -1 0 0 0 0]; + +internalField uniform 0; + +boundaryField +{ + lowerWall + { + type nutUSpaldingWallFunction; + value uniform 0; + } + upperWall + { + type nutUSpaldingWallFunction; + value uniform 0; + } + frontBack + { + type cyclic; + value uniform 0; + } + defaultFaces + { + type empty; + } +} + + +// ************************************************************************* // diff --git a/tutorials/incompressible/boundaryFoam/boundaryWallFunctionsProfile/0/omega b/tutorials/incompressible/boundaryFoam/boundaryWallFunctionsProfile/0/omega new file mode 100644 index 0000000000..75b8cd335b --- /dev/null +++ b/tutorials/incompressible/boundaryFoam/boundaryWallFunctionsProfile/0/omega @@ -0,0 +1,46 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: 1.6 | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + location "0"; + object omega; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 0 -1 0 0 0 0]; + +internalField uniform 1111.11; + +boundaryField +{ + lowerWall + { + type omegaWallFunction; + value uniform 1111.11; + } + upperWall + { + type omegaWallFunction; + value uniform 1111.11; + } + frontBack + { + type cyclic; + value uniform 1111.11; + } + defaultFaces + { + type empty; + } +} + + +// ************************************************************************* // diff --git a/tutorials/incompressible/boundaryFoam/boundaryWallFunctionsProfile/Allclean b/tutorials/incompressible/boundaryFoam/boundaryWallFunctionsProfile/Allclean new file mode 100755 index 0000000000..0d6bac1543 --- /dev/null +++ b/tutorials/incompressible/boundaryFoam/boundaryWallFunctionsProfile/Allclean @@ -0,0 +1,11 @@ +#!/bin/sh + +# Source tutorial clean functions +. $WM_PROJECT_DIR/bin/tools/CleanFunctions + +cleanCase + +rm -rf logs +rm -f *.eps yPlus_vs_uPlus + +echo "done" diff --git a/tutorials/incompressible/boundaryFoam/boundaryWallFunctionsProfile/Allrun b/tutorials/incompressible/boundaryFoam/boundaryWallFunctionsProfile/Allrun new file mode 100755 index 0000000000..6f45774974 --- /dev/null +++ b/tutorials/incompressible/boundaryFoam/boundaryWallFunctionsProfile/Allrun @@ -0,0 +1,69 @@ +#!/bin/sh + +# Source tutorial run functions +. $WM_PROJECT_DIR/bin/tools/RunFunctions + +runApplication blockMesh + +exponents="2 3 4 5 6 7 8" + +echo "# yPlus vs uPlus" > yPlus_vs_uPlus + +for e in $exponents; do + echo " Setting nu to 1e-$e" + + sed "s/XXX/$e/g" constant/transportProperties.template \ + > constant/transportProperties + + runApplication boundaryFoam + + mv log.boundaryFoam log.boundaryFoam_$e + + # extract y+, U+ + # note: both must be added to foamLog.db + runApplication foamLog log.boundaryFoam_$e + + mv log.foamLog log.foamLog_$e + + if [ -e logs/yPlus_0 ]; then + yPlus=`awk < logs/yPlus_0 'END{print $2}'` + uPlus=`awk < logs/uPlus_0 'END{print $2}'` + + echo "$yPlus $uPlus" >> yPlus_vs_uPlus + fi + + rm -rf logs +done + + +# create validation plot +# test if gnuplot exists on the system +type -P gnuplot &>/dev/null || { + echo "gnuplot not found - skipping graph creation" >&2; exit 1; +} +graphName="OF_vs_ANAYTICAL.eps" + +echo "Creating graph of u+ vs y+ to $graphName" +gnuplot<