From 64f13eb9db646c997ee6fa8391b9531f6b1a8bc0 Mon Sep 17 00:00:00 2001 From: mattijs Date: Wed, 26 Feb 2014 15:25:48 +0000 Subject: [PATCH] ENH: motorBike: tutorial with dynamic refinement across snappyHexMesh mesh --- .../interDyMFoam/ras/motorBike/0.org/U | 40 +++ .../ras/motorBike/0.org/alpha.water | 38 +++ .../interDyMFoam/ras/motorBike/0.org/p_rgh | 46 +++ .../interDyMFoam/ras/motorBike/Allclean | 15 + .../interDyMFoam/ras/motorBike/Allrun | 15 + .../interDyMFoam/ras/motorBike/Allrun.pre | 27 ++ .../ras/motorBike/constant/RASProperties | 24 ++ .../ras/motorBike/constant/dynamicMeshDict | 50 +++ .../interDyMFoam/ras/motorBike/constant/g | 22 ++ .../motorBike/constant/polyMesh/blockMeshDict | 89 +++++ .../motorBike/constant/transportProperties | 67 ++++ .../ras/motorBike/constant/triSurface/README | 4 + .../motorBike/constant/turbulenceProperties | 21 ++ .../ras/motorBike/system/controlDict | 60 ++++ .../ras/motorBike/system/decomposeParDict | 42 +++ .../ras/motorBike/system/fvSchemes | 59 ++++ .../ras/motorBike/system/fvSolution | 83 +++++ .../ras/motorBike/system/meshQualityDict | 24 ++ .../ras/motorBike/system/setFieldsDict | 38 +++ .../ras/motorBike/system/snappyHexMeshDict | 314 ++++++++++++++++++ .../system/surfaceFeatureExtractDict | 48 +++ 21 files changed, 1126 insertions(+) create mode 100644 tutorials/multiphase/interDyMFoam/ras/motorBike/0.org/U create mode 100644 tutorials/multiphase/interDyMFoam/ras/motorBike/0.org/alpha.water create mode 100644 tutorials/multiphase/interDyMFoam/ras/motorBike/0.org/p_rgh create mode 100755 tutorials/multiphase/interDyMFoam/ras/motorBike/Allclean create mode 100755 tutorials/multiphase/interDyMFoam/ras/motorBike/Allrun create mode 100755 tutorials/multiphase/interDyMFoam/ras/motorBike/Allrun.pre create mode 100644 tutorials/multiphase/interDyMFoam/ras/motorBike/constant/RASProperties create mode 100644 tutorials/multiphase/interDyMFoam/ras/motorBike/constant/dynamicMeshDict create mode 100644 tutorials/multiphase/interDyMFoam/ras/motorBike/constant/g create mode 100644 tutorials/multiphase/interDyMFoam/ras/motorBike/constant/polyMesh/blockMeshDict create mode 100644 tutorials/multiphase/interDyMFoam/ras/motorBike/constant/transportProperties create mode 100644 tutorials/multiphase/interDyMFoam/ras/motorBike/constant/triSurface/README create mode 100644 tutorials/multiphase/interDyMFoam/ras/motorBike/constant/turbulenceProperties create mode 100644 tutorials/multiphase/interDyMFoam/ras/motorBike/system/controlDict create mode 100644 tutorials/multiphase/interDyMFoam/ras/motorBike/system/decomposeParDict create mode 100644 tutorials/multiphase/interDyMFoam/ras/motorBike/system/fvSchemes create mode 100644 tutorials/multiphase/interDyMFoam/ras/motorBike/system/fvSolution create mode 100644 tutorials/multiphase/interDyMFoam/ras/motorBike/system/meshQualityDict create mode 100644 tutorials/multiphase/interDyMFoam/ras/motorBike/system/setFieldsDict create mode 100644 tutorials/multiphase/interDyMFoam/ras/motorBike/system/snappyHexMeshDict create mode 100644 tutorials/multiphase/interDyMFoam/ras/motorBike/system/surfaceFeatureExtractDict diff --git a/tutorials/multiphase/interDyMFoam/ras/motorBike/0.org/U b/tutorials/multiphase/interDyMFoam/ras/motorBike/0.org/U new file mode 100644 index 0000000000..77100e9c9b --- /dev/null +++ b/tutorials/multiphase/interDyMFoam/ras/motorBike/0.org/U @@ -0,0 +1,40 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volVectorField; + location "0"; + object U; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 -1 0 0 0 0]; + +internalField uniform (0 0 0); + +boundaryField +{ + //- Set patchGroups for constraint patches + #include "${WM_PROJECT_DIR}/etc/caseDicts/setConstraintTypes" + + wall + { + type uniformFixedValue; + uniformValue (0 0 0); + } + upperWall + { + type pressureInletOutletVelocity; + value uniform (0 0 0); + } +} + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interDyMFoam/ras/motorBike/0.org/alpha.water b/tutorials/multiphase/interDyMFoam/ras/motorBike/0.org/alpha.water new file mode 100644 index 0000000000..f48a5159cf --- /dev/null +++ b/tutorials/multiphase/interDyMFoam/ras/motorBike/0.org/alpha.water @@ -0,0 +1,38 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + object alpha.water; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 0 0 0 0 0 0]; + +internalField uniform 0; + +boundaryField +{ + //- Set patchGroups for constraint patches + #include "${WM_PROJECT_DIR}/etc/caseDicts/setConstraintTypes" + + wall + { + type zeroGradient; + } + upperWall + { + type inletOutlet; + inletValue uniform 0; + value uniform 0; + } +} + +// ************************************************************************* // diff --git a/tutorials/multiphase/interDyMFoam/ras/motorBike/0.org/p_rgh b/tutorials/multiphase/interDyMFoam/ras/motorBike/0.org/p_rgh new file mode 100644 index 0000000000..153f206474 --- /dev/null +++ b/tutorials/multiphase/interDyMFoam/ras/motorBike/0.org/p_rgh @@ -0,0 +1,46 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + object p_rgh; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [1 -1 -2 0 0 0 0]; + +internalField uniform 0; + +boundaryField +{ + //- Set patchGroups for constraint patches + #include "${WM_PROJECT_DIR}/etc/caseDicts/setConstraintTypes" + + wall + { + type fixedFluxPressure; + phi phiAbs; + value uniform 0; + } + + upperWall + { + type totalPressure; + p0 uniform 0; + U U; + phi phi; + rho rho; + psi none; + gamma 1; + value uniform 0; + } +} + +// ************************************************************************* // diff --git a/tutorials/multiphase/interDyMFoam/ras/motorBike/Allclean b/tutorials/multiphase/interDyMFoam/ras/motorBike/Allclean new file mode 100755 index 0000000000..0ce70bfacc --- /dev/null +++ b/tutorials/multiphase/interDyMFoam/ras/motorBike/Allclean @@ -0,0 +1,15 @@ +#!/bin/sh + +# Source tutorial clean functions +. $WM_PROJECT_DIR/bin/tools/CleanFunctions + +# remove surface and features +\rm -f constant/triSurface/motorBike.obj.gz > /dev/null 2>&1 +\rm -rf constant/extendedFeatureEdgeMesh > /dev/null 2>&1 +\rm -f constant/triSurface/motorBike.eMesh > /dev/null 2>&1 + +rm -rf 0 > /dev/null 2>&1 + +cleanCase + +\rm -f constant/polyMesh/boundary diff --git a/tutorials/multiphase/interDyMFoam/ras/motorBike/Allrun b/tutorials/multiphase/interDyMFoam/ras/motorBike/Allrun new file mode 100755 index 0000000000..a3eae2016b --- /dev/null +++ b/tutorials/multiphase/interDyMFoam/ras/motorBike/Allrun @@ -0,0 +1,15 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # run from this directory + +# Source tutorial run functions +. $WM_PROJECT_DIR/bin/tools/RunFunctions + +./Allrun.pre + +#runApplication `getApplication` +runParallel `getApplication` 5 +runApplication reconstructParMesh -latestTime +runApplication reconstructPar -latestTime + + +# ----------------------------------------------------------------- end-of-file diff --git a/tutorials/multiphase/interDyMFoam/ras/motorBike/Allrun.pre b/tutorials/multiphase/interDyMFoam/ras/motorBike/Allrun.pre new file mode 100755 index 0000000000..a42231557c --- /dev/null +++ b/tutorials/multiphase/interDyMFoam/ras/motorBike/Allrun.pre @@ -0,0 +1,27 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # run from this directory + +# Source tutorial run functions +. $WM_PROJECT_DIR/bin/tools/RunFunctions + +# copy motorbike surface from resources directory +cp $FOAM_TUTORIALS/resources/geometry/motorBike.obj.gz constant/triSurface/ + +runApplication surfaceFeatureExtract + +runApplication blockMesh + +#runApplication snappyHexMesh -overwrite +#\rm -f constant/polyMesh/refinementHistory* +# - set the initial fields +#cp -rf 0.org 0 +#runApplication setFields + +runApplication decomposePar -force -cellDist +runParallel snappyHexMesh 5 -overwrite +ls -d processor* | xargs -i rm -f ./{}/constant/polyMesh/refinementHistory $1 + +# - set the initial fields +ls -d processor* | xargs -i rm -rf ./{}/0 $1 +ls -d processor* | xargs -i cp -r 0.org ./{}/0 $1 +runParallel setFields 5 diff --git a/tutorials/multiphase/interDyMFoam/ras/motorBike/constant/RASProperties b/tutorials/multiphase/interDyMFoam/ras/motorBike/constant/RASProperties new file mode 100644 index 0000000000..3b7dcacf86 --- /dev/null +++ b/tutorials/multiphase/interDyMFoam/ras/motorBike/constant/RASProperties @@ -0,0 +1,24 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object RASProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +RASModel kOmegaSST; + +turbulence on; + +printCoeffs on; + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interDyMFoam/ras/motorBike/constant/dynamicMeshDict b/tutorials/multiphase/interDyMFoam/ras/motorBike/constant/dynamicMeshDict new file mode 100644 index 0000000000..9b42c7daa9 --- /dev/null +++ b/tutorials/multiphase/interDyMFoam/ras/motorBike/constant/dynamicMeshDict @@ -0,0 +1,50 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object dynamicMeshDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dynamicFvMesh dynamicRefineFvMesh; + +dynamicRefineFvMeshCoeffs +{ + // How often to refine + refineInterval 1; + // Field to be refinement on + field alpha.water; + // Refine field inbetween lower..upper + lowerRefineLevel 0.001; + upperRefineLevel 0.999; + // Have slower than 2:1 refinement + nBufferLayers 1; + // Refine cells only up to maxRefinement levels + maxRefinement 3; + // Stop refinement if maxCells reached + maxCells 2000000; + // Flux field and corresponding velocity field. Fluxes on changed + // faces get recalculated by interpolating the velocity. Use 'none' + // on surfaceScalarFields that do not need to be reinterpolated. + correctFluxes + ( + (phi none) + (nHatf none) + (rhoPhi none) + (ghf none) + ); + // Write the refinement level as a volScalarField + dumpLevel true; +} + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interDyMFoam/ras/motorBike/constant/g b/tutorials/multiphase/interDyMFoam/ras/motorBike/constant/g new file mode 100644 index 0000000000..897615a50d --- /dev/null +++ b/tutorials/multiphase/interDyMFoam/ras/motorBike/constant/g @@ -0,0 +1,22 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class uniformDimensionedVectorField; + location "constant"; + object g; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 -2 0 0 0 0]; +value ( 0 0 -9.81 ); + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interDyMFoam/ras/motorBike/constant/polyMesh/blockMeshDict b/tutorials/multiphase/interDyMFoam/ras/motorBike/constant/polyMesh/blockMeshDict new file mode 100644 index 0000000000..38149564a1 --- /dev/null +++ b/tutorials/multiphase/interDyMFoam/ras/motorBike/constant/polyMesh/blockMeshDict @@ -0,0 +1,89 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object blockMeshDict; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +convertToMeters 1; + +vertices +( + (-1 -0.5 0) + ( 3 -0.5 0) + ( 3 0.5 0) + (-1 0.5 0) + (-1 -0.5 2) + ( 3 -0.5 2) + ( 3 0.5 2) + (-1 0.5 2) +); + +blocks +( + hex (0 1 2 3 4 5 6 7) (8 2 4) simpleGrading (1 1 1) +); + +edges +( +); + +boundary +( + walls + { + type wall; + faces + ( + (3 7 6 2) + (1 5 4 0) + (0 4 7 3) + (2 6 5 1) + (0 3 2 1) + ); + } +// inlet +// { +// type patch; +// faces +// ( +// (0 4 7 3) +// ); +// } +// outlet +// { +// type patch; +// faces +// ( +// (2 6 5 1) +// ); +// } +// lowerWall +// { +// type wall; +// faces +// ( +// (0 3 2 1) +// ); +// } + upperWall + { + type patch; + faces + ( + (4 5 6 7) + ); + } +); + +// ************************************************************************* // diff --git a/tutorials/multiphase/interDyMFoam/ras/motorBike/constant/transportProperties b/tutorials/multiphase/interDyMFoam/ras/motorBike/constant/transportProperties new file mode 100644 index 0000000000..81106f5ea4 --- /dev/null +++ b/tutorials/multiphase/interDyMFoam/ras/motorBike/constant/transportProperties @@ -0,0 +1,67 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object transportProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +phases (water air); + +water +{ + transportModel Newtonian; + nu nu [ 0 2 -1 0 0 0 0 ] 1e-06; + rho rho [ 1 -3 0 0 0 0 0 ] 1000; + CrossPowerLawCoeffs + { + nu0 nu0 [ 0 2 -1 0 0 0 0 ] 1e-06; + nuInf nuInf [ 0 2 -1 0 0 0 0 ] 1e-06; + m m [ 0 0 1 0 0 0 0 ] 1; + n n [ 0 0 0 0 0 0 0 ] 0; + } + + BirdCarreauCoeffs + { + nu0 nu0 [ 0 2 -1 0 0 0 0 ] 0.0142515; + nuInf nuInf [ 0 2 -1 0 0 0 0 ] 1e-06; + k k [ 0 0 1 0 0 0 0 ] 99.6; + n n [ 0 0 0 0 0 0 0 ] 0.1003; + } +} + +air +{ + transportModel Newtonian; + nu nu [ 0 2 -1 0 0 0 0 ] 1.48e-05; + rho rho [ 1 -3 0 0 0 0 0 ] 1; + CrossPowerLawCoeffs + { + nu0 nu0 [ 0 2 -1 0 0 0 0 ] 1e-06; + nuInf nuInf [ 0 2 -1 0 0 0 0 ] 1e-06; + m m [ 0 0 1 0 0 0 0 ] 1; + n n [ 0 0 0 0 0 0 0 ] 0; + } + + BirdCarreauCoeffs + { + nu0 nu0 [ 0 2 -1 0 0 0 0 ] 0.0142515; + nuInf nuInf [ 0 2 -1 0 0 0 0 ] 1e-06; + k k [ 0 0 1 0 0 0 0 ] 99.6; + n n [ 0 0 0 0 0 0 0 ] 0.1003; + } +} + +sigma sigma [ 1 0 -2 0 0 0 0 ] 0.07; + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interDyMFoam/ras/motorBike/constant/triSurface/README b/tutorials/multiphase/interDyMFoam/ras/motorBike/constant/triSurface/README new file mode 100644 index 0000000000..de3f29cc01 --- /dev/null +++ b/tutorials/multiphase/interDyMFoam/ras/motorBike/constant/triSurface/README @@ -0,0 +1,4 @@ +Directory to house tri-surfaces + +The Allrun script copies the surface from the $FOAM_TUTORIALS/resources/geometry +directory diff --git a/tutorials/multiphase/interDyMFoam/ras/motorBike/constant/turbulenceProperties b/tutorials/multiphase/interDyMFoam/ras/motorBike/constant/turbulenceProperties new file mode 100644 index 0000000000..c2c3b28a1b --- /dev/null +++ b/tutorials/multiphase/interDyMFoam/ras/motorBike/constant/turbulenceProperties @@ -0,0 +1,21 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object turbulenceProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +simulationType laminar; + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interDyMFoam/ras/motorBike/system/controlDict b/tutorials/multiphase/interDyMFoam/ras/motorBike/system/controlDict new file mode 100644 index 0000000000..72964e844d --- /dev/null +++ b/tutorials/multiphase/interDyMFoam/ras/motorBike/system/controlDict @@ -0,0 +1,60 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object controlDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +//DebugSwitches +//{ +// dynamicRefineFvMesh 1; +//} + +application interDyMFoam; + +startFrom startTime; + +startTime 0; + +stopAt endTime; + +endTime 2; + +deltaT 0.001; + +writeControl adjustableRunTime; +writeInterval 0.02; + +purgeWrite 0; + + +writeFormat binary; + +writePrecision 6; + +writeCompression uncompressed; + +timeFormat general; + +timePrecision 6; + +runTimeModifiable yes; + +adjustTimeStep yes; + +maxCo 0.5; +maxAlphaCo 0.5; +maxDeltaT 1; + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interDyMFoam/ras/motorBike/system/decomposeParDict b/tutorials/multiphase/interDyMFoam/ras/motorBike/system/decomposeParDict new file mode 100644 index 0000000000..a4296cf289 --- /dev/null +++ b/tutorials/multiphase/interDyMFoam/ras/motorBike/system/decomposeParDict @@ -0,0 +1,42 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object decomposeParDict; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +numberOfSubdomains 5; + +method hierarchical; +// method ptscotch; + +simpleCoeffs +{ + n (4 1 1); + delta 0.001; +} + +hierarchicalCoeffs +{ + n (5 1 1); + delta 0.001; + order xyz; +} + +manualCoeffs +{ + dataFile "cellDecomposition"; +} + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interDyMFoam/ras/motorBike/system/fvSchemes b/tutorials/multiphase/interDyMFoam/ras/motorBike/system/fvSchemes new file mode 100644 index 0000000000..5055a179c6 --- /dev/null +++ b/tutorials/multiphase/interDyMFoam/ras/motorBike/system/fvSchemes @@ -0,0 +1,59 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object fvSchemes; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +ddtSchemes +{ + default Euler; +} + +gradSchemes +{ + default Gauss linear; +} + +divSchemes +{ + div(rhoPhi,U) Gauss upwind; + div(phi,alpha) Gauss vanLeer; + div(phirb,alpha) Gauss linear; + div((muEff*dev(T(grad(U))))) Gauss linear; +} + +laplacianSchemes +{ + default Gauss linear corrected; +} + +interpolationSchemes +{ + default linear; +} + +snGradSchemes +{ + default corrected; +} + +fluxRequired +{ + default no; + p_rgh; + pcorr; +} + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interDyMFoam/ras/motorBike/system/fvSolution b/tutorials/multiphase/interDyMFoam/ras/motorBike/system/fvSolution new file mode 100644 index 0000000000..946f2c0215 --- /dev/null +++ b/tutorials/multiphase/interDyMFoam/ras/motorBike/system/fvSolution @@ -0,0 +1,83 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object fvSolution; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +solvers +{ + "alpha.water.*" + { + nAlphaCorr 1; + nAlphaSubCycles 3; + cAlpha 1; + } + + p_rgh + { + solver GAMG; + tolerance 1e-7; + relTol 0.01; + smoother DIC; + nPreSweeps 0; + nPostSweeps 2; + nFinestSweeps 2; + cacheAgglomeration false; + nCellsInCoarsestLevel 10; + agglomerator faceAreaPair; + mergeLevels 1; + } + + p_rghFinal + { + $p_rgh; + relTol 0; + } + + "pcorr.*" + { + $p_rghFinal; + tolerance 0.001; + } + + U + { + solver smoothSolver; + smoother GaussSeidel; + tolerance 1e-06; + relTol 0; + nSweeps 1; + } + + "(k|B|nuTilda)" + { + solver smoothSolver; + smoother symGaussSeidel; + tolerance 1e-08; + relTol 0; + } +} + +PIMPLE +{ + momentumPredictor no; + nCorrectors 3; + nNonOrthogonalCorrectors 0; + + pRefPoint (0.51 0.51 0.51); + pRefValue 0; +} + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interDyMFoam/ras/motorBike/system/meshQualityDict b/tutorials/multiphase/interDyMFoam/ras/motorBike/system/meshQualityDict new file mode 100644 index 0000000000..2dbd166629 --- /dev/null +++ b/tutorials/multiphase/interDyMFoam/ras/motorBike/system/meshQualityDict @@ -0,0 +1,24 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object meshQualityDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// Include defaults parameters from master dictionary +#include "$WM_PROJECT_DIR/etc/caseDicts/meshQualityDict" + +//- minFaceWeight (0 -> 0.5) +minFaceWeight 0.02; + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interDyMFoam/ras/motorBike/system/setFieldsDict b/tutorials/multiphase/interDyMFoam/ras/motorBike/system/setFieldsDict new file mode 100644 index 0000000000..c7cd093635 --- /dev/null +++ b/tutorials/multiphase/interDyMFoam/ras/motorBike/system/setFieldsDict @@ -0,0 +1,38 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object setFieldsDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +defaultFieldValues +( + volScalarFieldValue alpha.water 0 + volVectorFieldValue U ( 0 0 0 ) +); + +regions +( + boxToCell + { + //box ( -1 -0.5 0 ) ( -0.5 0.5 2 ); + box ( -1 -0.5 1.5 ) ( 3 0.5 2 ); + fieldValues + ( + volScalarFieldValue alpha.water 1 + ); + } + ); + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interDyMFoam/ras/motorBike/system/snappyHexMeshDict b/tutorials/multiphase/interDyMFoam/ras/motorBike/system/snappyHexMeshDict new file mode 100644 index 0000000000..2870897db1 --- /dev/null +++ b/tutorials/multiphase/interDyMFoam/ras/motorBike/system/snappyHexMeshDict @@ -0,0 +1,314 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object snappyHexMeshDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// Which of the steps to run +castellatedMesh true; +snap true; +addLayers true; + + +// Geometry. Definition of all surfaces. All surfaces are of class +// searchableSurface. +// Surfaces are used +// - to specify refinement for any mesh cell intersecting it +// - to specify refinement for any mesh cell inside/outside/near +// - to 'snap' the mesh boundary to the surface +geometry +{ + motorBike.obj + { + type triSurfaceMesh; + name motorBike; + } +}; + + +// Optional: avoid patch-face merging. Allows mesh to be used for +// refinement/unrefinement +keepHex true; + + + +// Settings for the castellatedMesh generation. +castellatedMeshControls +{ + + // Refinement parameters + // ~~~~~~~~~~~~~~~~~~~~~ + + // If local number of cells is >= maxLocalCells on any processor + // switches from from refinement followed by balancing + // (current method) to (weighted) balancing before refinement. + maxLocalCells 100000; + + // Overall cell limit (approximately). Refinement will stop immediately + // upon reaching this number so a refinement level might not complete. + // Note that this is the number of cells before removing the part which + // is not 'visible' from the keepPoint. The final number of cells might + // actually be a lot less. + maxGlobalCells 2000000; + + // The surface refinement loop might spend lots of iterations refining just a + // few cells. This setting will cause refinement to stop if <= minimumRefine + // are selected for refinement. Note: it will at least do one iteration + // (unless the number of cells to refine is 0) + minRefinementCells 10; + + // Allow a certain level of imbalance during refining + // (since balancing is quite expensive) + // Expressed as fraction of perfect balance (= overall number of cells / + // nProcs). 0=balance always. + maxLoadUnbalance 0.10; + + + // Number of buffer layers between different levels. + // 1 means normal 2:1 refinement restriction, larger means slower + // refinement. + nCellsBetweenLevels 3; + + + + // Explicit feature edge refinement + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + // Specifies a level for any cell intersected by its edges. + // This is a featureEdgeMesh, read from constant/triSurface for now. + features + (); + + + + // Surface based refinement + // ~~~~~~~~~~~~~~~~~~~~~~~~ + + // Specifies two levels for every surface. The first is the minimum level, + // every cell intersecting a surface gets refined up to the minimum level. + // The second level is the maximum level. Cells that 'see' multiple + // intersections where the intersections make an + // angle > resolveFeatureAngle get refined up to the maximum level. + + refinementSurfaces + { + motorBike + { + // Surface-wise min and max refinement level + level (3 3); + + // Optional specification of patch type (default is wall). No + // constraint types (cyclic, symmetry) etc. are allowed. + patchInfo + { + type wall; + inGroups (motorBikeGroup); + } + } + } + + // Resolve sharp angles + resolveFeatureAngle 30; + + + // Region-wise refinement + // ~~~~~~~~~~~~~~~~~~~~~~ + + // Specifies refinement level for cells in relation to a surface. One of + // three modes + // - distance. 'levels' specifies per distance to the surface the + // wanted refinement level. The distances need to be specified in + // descending order. + // - inside. 'levels' is only one entry and only the level is used. All + // cells inside the surface get refined up to the level. The surface + // needs to be closed for this to be possible. + // - outside. Same but cells outside. + + refinementRegions + { + } + + + // Mesh selection + // ~~~~~~~~~~~~~~ + + // After refinement patches get added for all refinementSurfaces and + // all cells intersecting the surfaces get put into these patches. The + // section reachable from the locationInMesh is kept. + // NOTE: This point should never be on a face, always inside a cell, even + // after refinement. + locationInMesh (2.991 0.4991 1.991); + + + // Whether any faceZones (as specified in the refinementSurfaces) + // are only on the boundary of corresponding cellZones or also allow + // free-standing zone faces. Not used if there are no faceZones. + allowFreeStandingZoneFaces true; +} + + + +// Settings for the snapping. +snapControls +{ + //- Number of patch smoothing iterations before finding correspondence + // to surface + nSmoothPatch 3; + + //- Relative distance for points to be attracted by surface feature point + // or edge. True distance is this factor times local + // maximum edge length. + tolerance 2.0; + + //- Number of mesh displacement relaxation iterations. + nSolveIter 30; + + //- Maximum number of snapping relaxation iterations. Should stop + // before upon reaching a correct mesh. + nRelaxIter 5; + + // Feature snapping + +// //- Number of feature edge snapping iterations. +// // Leave out altogether to disable. +// nFeatureSnapIter 10; +// +// //- Detect (geometric only) features by sampling the surface +// // (default=false). +// implicitFeatureSnap false; +// +// //- Use castellatedMeshControls::features (default = true) +// explicitFeatureSnap true; +// +// //- Detect points on multiple surfaces (only for explicitFeatureSnap) +// multiRegionFeatureSnap false; +} + + + +// Settings for the layer addition. +addLayersControls +{ + // Are the thickness parameters below relative to the undistorted + // size of the refined cell outside layer (true) or absolute sizes (false). + relativeSizes true; + + // Per final patch (so not geometry!) the layer information + layers + { + "motorBike.*" + { + nSurfaceLayers 1; + } + } + + // Expansion factor for layer mesh + expansionRatio 1.0; + + // Wanted thickness of final added cell layer. If multiple layers + // is the + // thickness of the layer furthest away from the wall. + // Relative to undistorted size of cell outside layer. + // is the thickness of the layer furthest away from the wall. + // See relativeSizes parameter. + finalLayerThickness 0.3; + + // Minimum thickness of cell layer. If for any reason layer + // cannot be above minThickness do not add layer. + // Relative to undistorted size of cell outside layer. + minThickness 0.1; + + // If points get not extruded do nGrow layers of connected faces that are + // also not grown. This helps convergence of the layer addition process + // close to features. + // Note: changed(corrected) w.r.t 17x! (didn't do anything in 17x) + nGrow 0; + + // Advanced settings + + // When not to extrude surface. 0 is flat surface, 90 is when two faces + // are perpendicular + featureAngle 60; + + // At non-patched sides allow mesh to slip if extrusion direction makes + // angle larger than slipFeatureAngle. + slipFeatureAngle 30; + + // Maximum number of snapping relaxation iterations. Should stop + // before upon reaching a correct mesh. + nRelaxIter 3; + + // Number of smoothing iterations of surface normals + nSmoothSurfaceNormals 1; + + // Number of smoothing iterations of interior mesh movement direction + nSmoothNormals 3; + + // Smooth layer thickness over surface patches + nSmoothThickness 10; + + // Stop layer growth on highly warped cells + maxFaceThicknessRatio 0.5; + + // Reduce layer growth where ratio thickness to medial + // distance is large + maxThicknessToMedialRatio 0.3; + + // Angle used to pick up medial axis points + // Note: changed(corrected) w.r.t 17x! 90 degrees corresponds to 130 in 17x. + minMedianAxisAngle 90; + + + // Create buffer region for new layer terminations + nBufferCellsNoExtrude 0; + + + // Overall max number of layer addition iterations. The mesher will exit + // if it reaches this number of iterations; possibly with an illegal + // mesh. + nLayerIter 50; +} + + + +// Generic mesh quality settings. At any undoable phase these determine +// where to undo. +meshQualityControls +{ + #include "meshQualityDict" + + + // Advanced + + //- Number of error distribution iterations + nSmoothScale 4; + //- amount to scale back displacement at error points + errorReduction 0.75; +} + + +// Advanced + +// Write flags +writeFlags +( + layerFields // write volScalarField for layer coverage +); + + +// Merge tolerance. Is fraction of overall bounding box of initial mesh. +// Note: the write tolerance needs to be higher than this. +mergeTolerance 1e-6; + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interDyMFoam/ras/motorBike/system/surfaceFeatureExtractDict b/tutorials/multiphase/interDyMFoam/ras/motorBike/system/surfaceFeatureExtractDict new file mode 100644 index 0000000000..fa00f86001 --- /dev/null +++ b/tutorials/multiphase/interDyMFoam/ras/motorBike/system/surfaceFeatureExtractDict @@ -0,0 +1,48 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object surfaceFeatureExtractDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +motorBike.obj +{ + // How to obtain raw features (extractFromFile || extractFromSurface) + extractionMethod extractFromSurface; + + extractFromSurfaceCoeffs + { + // Mark edges whose adjacent surface normals are at an angle less + // than includedAngle as features + // - 0 : selects no edges + // - 180: selects all edges + includedAngle 150; + } + + subsetFeatures + { + // Keep nonManifold edges (edges with >2 connected faces) + nonManifoldEdges no; + + // Keep open edges (edges with 1 connected face) + openEdges yes; + } + + + // Write options + + // Write features to obj format for postprocessing + writeObj yes; +} + + +// ************************************************************************* //