diff --git a/run.sh b/run.sh new file mode 100755 index 0000000..d31994d --- /dev/null +++ b/run.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash + +path=build/simple-cubic/0.1 + +# python src/genmesh.py +# python src/prefoam.py + +ideasUnvFoam -case $path mesh.unv +checkMesh -case $path +foamDictionary -case $path constant/polyMesh/boundary -entry entry0.wall.type -set wall +#potentialFoam -case $path +decomposePar -case $path +mpirun -np 4 --oversubscribe simpleFoam -parallel -case $path > $path/simpleFoam.log + diff --git a/src/genmesh.py b/src/genmesh.py index f67abcd..2314b8d 100644 --- a/src/genmesh.py +++ b/src/genmesh.py @@ -10,7 +10,7 @@ if not os.path.exists(build): ### -alpha = [0.1, 0.15, 0.2] +alpha = [0.1] #, 0.15, 0.2] simpleCubic = os.path.join(src, "simple-cubic/main.py") # Body-centered cubic diff --git a/src/prefoam.py b/src/prefoam.py new file mode 100644 index 0000000..7c27f05 --- /dev/null +++ b/src/prefoam.py @@ -0,0 +1,13 @@ +import os, shutil + +src = os.getcwd() +build = os.path.join(src, "../build") + +if not os.path.exists(build): + os.makedirs(build) + +foamCase = [ "0", "constant", "system" ] + +for d in foamCase: + shutil.copytree("{}/simple-cubic/{}".format(src, d), + "{}/simple-cubic/0.1/{}".format(build, d)) diff --git a/src/simple-cubic/0/U b/src/simple-cubic/0/U index 1279edb..cde1cf0 100644 --- a/src/simple-cubic/0/U +++ b/src/simple-cubic/0/U @@ -23,7 +23,7 @@ boundaryField inlet { type pressureInletVelocity; - valut uniform (0 0 0); + value uniform (0 0 0); } outlet diff --git a/src/simple-cubic/0/p b/src/simple-cubic/0/p index b7d670d..ab26b2b 100644 --- a/src/simple-cubic/0/p +++ b/src/simple-cubic/0/p @@ -16,14 +16,14 @@ FoamFile dimensions [0 2 -2 0 0 0 0]; -internaleField uniform 0; +internalField uniform 0; boundaryField { inlet { type fixedValue; - value uniform 1; + value uniform 0.001; } outlet diff --git a/src/simple-cubic/constant/transportProperties b/src/simple-cubic/constant/transportProperties index b514dfd..ef5fb7b 100644 --- a/src/simple-cubic/constant/transportProperties +++ b/src/simple-cubic/constant/transportProperties @@ -17,6 +17,6 @@ FoamFile transportModel Newtonian; -nu 1e-05; +nu 1e-06; // ************************************************************************* // diff --git a/src/simple-cubic/constant/turbulenceProperties b/src/simple-cubic/constant/turbulenceProperties index b6bbfab..9ec63ee 100644 --- a/src/simple-cubic/constant/turbulenceProperties +++ b/src/simple-cubic/constant/turbulenceProperties @@ -15,18 +15,9 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -simulationType RAS; +simulationType laminar; -RAS -{ - // Tested with kEpsilon, realizableKE, kOmega, kOmegaSST, - // ShihQuadraticKE, LienCubicKE. - RASModel kEpsilon; - turbulence on; - - printCoeffs on; -} // ************************************************************************* // diff --git a/src/simple-cubic/mesh.py b/src/simple-cubic/mesh.py index 31b31fc..afa666e 100644 --- a/src/simple-cubic/mesh.py +++ b/src/simple-cubic/mesh.py @@ -17,7 +17,7 @@ def create(geomObj, bc): param.SetCheckChartBoundary( 0 ) param.SetMinSize( 0.01 ) param.SetMaxSize( 0.1 ) - param.SetFineness( 3 ) + param.SetFineness( 4 ) #param.SetGrowthRate( 0.1 ) #param.SetNbSegPerEdge( 5 ) #param.SetNbSegPerRadius( 10 ) diff --git a/src/simple-cubic/system/controlDict b/src/simple-cubic/system/controlDict index f7623b2..ad712c8 100644 --- a/src/simple-cubic/system/controlDict +++ b/src/simple-cubic/system/controlDict @@ -23,7 +23,7 @@ startTime 0; stopAt endTime; -endTime 500; +endTime 5000; deltaT 1; diff --git a/src/simple-cubic/system/fvSchemes b/src/simple-cubic/system/fvSchemes index 6d94655..d02dcab 100644 --- a/src/simple-cubic/system/fvSchemes +++ b/src/simple-cubic/system/fvSchemes @@ -23,17 +23,21 @@ ddtSchemes gradSchemes { default Gauss linear; +// grad(Phi) Gauss linear; } divSchemes { default none; div(phi,U) bounded Gauss linearUpwind grad(U); + div((nuEff*dev2(T(grad(U))))) Gauss linear; + div(nonlinearStress) Gauss linear; } laplacianSchemes { default Gauss linear corrected; +// laplacian(1, Phi) Gauss linear corrected; } interpolationSchemes diff --git a/src/simple-cubic/system/fvSolution b/src/simple-cubic/system/fvSolution index 891704c..c8b25d1 100644 --- a/src/simple-cubic/system/fvSolution +++ b/src/simple-cubic/system/fvSolution @@ -33,16 +33,30 @@ solvers tolerance 1e-08; relTol 0.1; } + + Phi + { + solver smoothSolver; + smoother GaussSeidel; + nSweeps 2; + tolerance 1e-08; + relTol 0.1; + } +} + +potentialFlow +{ + nNonOrthogonalCorrectors 3; } SIMPLE { - nNonOrthogonalCorrectors 0; + nNonOrthogonalCorrectors 10; residualControl { - p 1e-5; - U 1e-5; + p 1e-3; + U 1e-3; } } @@ -50,11 +64,11 @@ relaxationFactors { fields { - p 0.3; + p 0.05; } equations { - U 0.7; + U 0.2; } }