From 33f2559a986b75758b62469f4a93f267be53fecf Mon Sep 17 00:00:00 2001 From: mattijs <mattijs> Date: Wed, 21 Dec 2016 13:40:32 +0000 Subject: [PATCH] ENH: relativeMotion: new tutorial demonstrating relative motion --- .../moveDynamicMesh/relativeMotion/Allclean | 19 + .../moveDynamicMesh/relativeMotion/Allrun | 28 ++ .../moveDynamicMesh/relativeMotion/README.txt | 7 + .../0.orig/cellDisplacement | 63 +++ .../0.orig/pointDisplacement | 80 ++++ .../constant/dynamicMeshDict | 80 ++++ .../constant/transportProperties | 22 + .../constant/turbulenceProperties | 30 ++ .../box2D_moveDynamicMesh/system/controlDict | 56 +++ .../system/decomposeParDict | 30 ++ .../system/extrudeMeshDict | 52 +++ .../box2D_moveDynamicMesh/system/fvSchemes | 56 +++ .../box2D_moveDynamicMesh/system/fvSolution | 40 ++ .../constant/transportProperties | 22 + .../constant/turbulenceProperties | 30 ++ .../box_snappyHexMesh/system/blockMeshDict | 87 ++++ .../box_snappyHexMesh/system/controlDict | 56 +++ .../box_snappyHexMesh/system/createPatchDict | 83 ++++ .../box_snappyHexMesh/system/decomposeParDict | 30 ++ .../box_snappyHexMesh/system/fvSchemes | 56 +++ .../box_snappyHexMesh/system/fvSolution | 93 +++++ .../system/snappyHexMeshDict | 384 ++++++++++++++++++ 22 files changed, 1404 insertions(+) create mode 100755 tutorials/mesh/moveDynamicMesh/relativeMotion/Allclean create mode 100755 tutorials/mesh/moveDynamicMesh/relativeMotion/Allrun create mode 100644 tutorials/mesh/moveDynamicMesh/relativeMotion/README.txt create mode 100644 tutorials/mesh/moveDynamicMesh/relativeMotion/box2D_moveDynamicMesh/0.orig/cellDisplacement create mode 100644 tutorials/mesh/moveDynamicMesh/relativeMotion/box2D_moveDynamicMesh/0.orig/pointDisplacement create mode 100644 tutorials/mesh/moveDynamicMesh/relativeMotion/box2D_moveDynamicMesh/constant/dynamicMeshDict create mode 100644 tutorials/mesh/moveDynamicMesh/relativeMotion/box2D_moveDynamicMesh/constant/transportProperties create mode 100644 tutorials/mesh/moveDynamicMesh/relativeMotion/box2D_moveDynamicMesh/constant/turbulenceProperties create mode 100644 tutorials/mesh/moveDynamicMesh/relativeMotion/box2D_moveDynamicMesh/system/controlDict create mode 100644 tutorials/mesh/moveDynamicMesh/relativeMotion/box2D_moveDynamicMesh/system/decomposeParDict create mode 100644 tutorials/mesh/moveDynamicMesh/relativeMotion/box2D_moveDynamicMesh/system/extrudeMeshDict create mode 100644 tutorials/mesh/moveDynamicMesh/relativeMotion/box2D_moveDynamicMesh/system/fvSchemes create mode 100644 tutorials/mesh/moveDynamicMesh/relativeMotion/box2D_moveDynamicMesh/system/fvSolution create mode 100644 tutorials/mesh/moveDynamicMesh/relativeMotion/box_snappyHexMesh/constant/transportProperties create mode 100644 tutorials/mesh/moveDynamicMesh/relativeMotion/box_snappyHexMesh/constant/turbulenceProperties create mode 100644 tutorials/mesh/moveDynamicMesh/relativeMotion/box_snappyHexMesh/system/blockMeshDict create mode 100644 tutorials/mesh/moveDynamicMesh/relativeMotion/box_snappyHexMesh/system/controlDict create mode 100644 tutorials/mesh/moveDynamicMesh/relativeMotion/box_snappyHexMesh/system/createPatchDict create mode 100644 tutorials/mesh/moveDynamicMesh/relativeMotion/box_snappyHexMesh/system/decomposeParDict create mode 100644 tutorials/mesh/moveDynamicMesh/relativeMotion/box_snappyHexMesh/system/fvSchemes create mode 100644 tutorials/mesh/moveDynamicMesh/relativeMotion/box_snappyHexMesh/system/fvSolution create mode 100644 tutorials/mesh/moveDynamicMesh/relativeMotion/box_snappyHexMesh/system/snappyHexMeshDict diff --git a/tutorials/mesh/moveDynamicMesh/relativeMotion/Allclean b/tutorials/mesh/moveDynamicMesh/relativeMotion/Allclean new file mode 100755 index 00000000000..a94a6172db5 --- /dev/null +++ b/tutorials/mesh/moveDynamicMesh/relativeMotion/Allclean @@ -0,0 +1,19 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # Run from this directory + +# Source tutorial clean functions +. $WM_PROJECT_DIR/bin/tools/CleanFunctions + +( + cd box_snappyHexMesh || exit 1 + cleanCase +) + +( + cd box2D_moveDynamicMesh || exit 1 + cleanCase + rm -rf 0 +) + + +#------------------------------------------------------------------------------ diff --git a/tutorials/mesh/moveDynamicMesh/relativeMotion/Allrun b/tutorials/mesh/moveDynamicMesh/relativeMotion/Allrun new file mode 100755 index 00000000000..456beeaab5f --- /dev/null +++ b/tutorials/mesh/moveDynamicMesh/relativeMotion/Allrun @@ -0,0 +1,28 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # Run from this directory + +# Source tutorial run functions +. $WM_PROJECT_DIR/bin/tools/RunFunctions + +# Make 3D mesh in slab of cells. +( + cd box_snappyHexMesh || exit 1 + + runApplication blockMesh + runApplication snappyHexMesh -overwrite + runApplication renumberMesh -overwrite + runApplication createPatch -overwrite + +) + +# Make a 2D mesh by extruding a patch and solve to steady state. +( + cd box2D_moveDynamicMesh || exit 1 + + runApplication extrudeMesh + restore0Dir + runApplication moveDynamicMesh -checkAMI +) + + +#------------------------------------------------------------------------------ diff --git a/tutorials/mesh/moveDynamicMesh/relativeMotion/README.txt b/tutorials/mesh/moveDynamicMesh/relativeMotion/README.txt new file mode 100644 index 00000000000..86de6aec86b --- /dev/null +++ b/tutorials/mesh/moveDynamicMesh/relativeMotion/README.txt @@ -0,0 +1,7 @@ +Testcase demonstrating combining solid body motion solver +with a Laplacian mesh distortion solver. + +There is a outer cylinder, spinning with a constant rpm. Inside +this a smaller cylinder counter-spins (so with constant but opposite +rpm). Finally inside this smaller cylinder there is relative motion +between two blocks (using boundary conditions and a mesh distortion solver). diff --git a/tutorials/mesh/moveDynamicMesh/relativeMotion/box2D_moveDynamicMesh/0.orig/cellDisplacement b/tutorials/mesh/moveDynamicMesh/relativeMotion/box2D_moveDynamicMesh/0.orig/cellDisplacement new file mode 100644 index 00000000000..c542662e7ca --- /dev/null +++ b/tutorials/mesh/moveDynamicMesh/relativeMotion/box2D_moveDynamicMesh/0.orig/cellDisplacement @@ -0,0 +1,63 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus-overset | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volVectorField; + location "0.034"; + object cellDisplacement; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 0 0 0 0 0]; + +internalField uniform (0 0 0); + +boundaryField +{ + #includeEtc "caseDicts/setConstraintTypes" + + sides + { + type uniformFixedValue; + uniformValue (0 0 0); + } + inlet + { + type uniformFixedValue; + uniformValue (0 0 0); + } + outlet + { + type uniformFixedValue; + uniformValue (0 0 0); + } + + "wing.*" + { + type cellMotion; + value uniform (0 0 0); + } + + AMI_dualWing + { + patchType cyclicAMI; + type cellMotion; + value uniform (0 0 0); + } + AMI_dualWing_slave + { + patchType cyclicAMI; + type cellMotion; + value uniform (0 0 0); + } +} + + +// ************************************************************************* // diff --git a/tutorials/mesh/moveDynamicMesh/relativeMotion/box2D_moveDynamicMesh/0.orig/pointDisplacement b/tutorials/mesh/moveDynamicMesh/relativeMotion/box2D_moveDynamicMesh/0.orig/pointDisplacement new file mode 100644 index 00000000000..0748b9df809 --- /dev/null +++ b/tutorials/mesh/moveDynamicMesh/relativeMotion/box2D_moveDynamicMesh/0.orig/pointDisplacement @@ -0,0 +1,80 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class pointVectorField; + location "0"; + object pointMotionU; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 0 0 0 0 0]; + +internalField uniform (0 0 0); + +boundaryField +{ + #includeEtc "caseDicts/setConstraintTypes" + + inlet + { + type fixedValue; + value $internalField; + } + + outlet + { + type fixedValue; + value $internalField; + } + + sides + { + type fixedValue; + value $internalField; + } + + wing1 + { + type fixedValue; + value $internalField; + } + + wing2 + { + // Make wing2 rotate around its centre + type solidBodyMotionDisplacement; + solidBodyMotionFunction oscillatingRotatingMotion; + oscillatingRotatingMotionCoeffs + { + origin (-0.41 0 0); + axis (0 0 1); + omega 10; // rad/s, 1rad/s=9.5rpm + amplitude (0 0 10); // max amplitude (degrees) + } + } + + AMI_dualWing + { + patchType cyclicAMI; + type fixedValue; + value $internalField; + } + + AMI_dualWing_slave + { + patchType cyclicAMI; + type fixedValue; + value $internalField; + } +} + + +// ************************************************************************* // diff --git a/tutorials/mesh/moveDynamicMesh/relativeMotion/box2D_moveDynamicMesh/constant/dynamicMeshDict b/tutorials/mesh/moveDynamicMesh/relativeMotion/box2D_moveDynamicMesh/constant/dynamicMeshDict new file mode 100644 index 00000000000..f49a887b0fd --- /dev/null +++ b/tutorials/mesh/moveDynamicMesh/relativeMotion/box2D_moveDynamicMesh/constant/dynamicMeshDict @@ -0,0 +1,80 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object dynamicMeshDict; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dynamicFvMesh dynamicMultiMotionSolverFvMesh; //dynamicMotionSolverFvMesh; + + +// Specification of rotation around centre +rotation1 +{ + solidBodyMotionFunction rotatingMotion; + rotatingMotionCoeffs + { + origin (0 0 0); + axis (0 0 1); + omega 10; // rad/s, 1rad/s=9.5rpm + } +} + + +dynamicMultiMotionSolverFvMeshCoeffs +{ + rotor1 + { + solver solidBody; + cellZone rotor; + solidBodyCoeffs + { + $rotation1; + } + } + + dualWing1 + { + cellZone dualWing; + + // Solve displacement on top of solid-body rotation + solver solidBodyDisplacementLaplacian; + + solidBodyDisplacementLaplacianCoeffs + { + solidBodyMotionFunction multiMotion; + multiMotionCoeffs + { + rotation_1 + { + $rotation1; + } + rotation_2 + { + // Apply counter rotation to keep dualWing aligned + solidBodyMotionFunction rotatingMotion; + rotatingMotionCoeffs + { + origin (-0.43 0 0); + axis (0 0 1); + omega -10; // rad/s, 1rad/s=9.5rpm + } + } + } + diffusivity quadratic inverseDistance (wing2); + } + } +} + +// ************************************************************************* // diff --git a/tutorials/mesh/moveDynamicMesh/relativeMotion/box2D_moveDynamicMesh/constant/transportProperties b/tutorials/mesh/moveDynamicMesh/relativeMotion/box2D_moveDynamicMesh/constant/transportProperties new file mode 100644 index 00000000000..a4159496771 --- /dev/null +++ b/tutorials/mesh/moveDynamicMesh/relativeMotion/box2D_moveDynamicMesh/constant/transportProperties @@ -0,0 +1,22 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v1606+ | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object transportProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +transportModel Newtonian; + +nu [0 2 -1 0 0 0 0] 1e-6; + +// ************************************************************************* // diff --git a/tutorials/mesh/moveDynamicMesh/relativeMotion/box2D_moveDynamicMesh/constant/turbulenceProperties b/tutorials/mesh/moveDynamicMesh/relativeMotion/box2D_moveDynamicMesh/constant/turbulenceProperties new file mode 100644 index 00000000000..4f29e1f4b4f --- /dev/null +++ b/tutorials/mesh/moveDynamicMesh/relativeMotion/box2D_moveDynamicMesh/constant/turbulenceProperties @@ -0,0 +1,30 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v1606+ | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object turbulenceProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +simulationType laminar; + +RAS +{ + RASModel kEpsilon; + + turbulence on; + + printCoeffs on; +} + + +// ************************************************************************* // diff --git a/tutorials/mesh/moveDynamicMesh/relativeMotion/box2D_moveDynamicMesh/system/controlDict b/tutorials/mesh/moveDynamicMesh/relativeMotion/box2D_moveDynamicMesh/system/controlDict new file mode 100644 index 00000000000..1b7c966f790 --- /dev/null +++ b/tutorials/mesh/moveDynamicMesh/relativeMotion/box2D_moveDynamicMesh/system/controlDict @@ -0,0 +1,56 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object controlDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +libs ("libfvMotionSolvers.so"); + +application moveDynamicMesh; + +startFrom startTime; + +startTime 0; + +stopAt endTime; + +endTime 0.5; + +deltaT 0.002; + +writeControl timeStep; + +writeInterval 5; + +purgeWrite 0; + +writeFormat binary; + +writePrecision 6; + +writeCompression uncompressed; + +timeFormat general; + +timePrecision 6; + +runTimeModifiable yes; + +adjustTimeStep yes; + +maxCo 0.4; + +maxDeltaT 1; + +// ************************************************************************* // diff --git a/tutorials/mesh/moveDynamicMesh/relativeMotion/box2D_moveDynamicMesh/system/decomposeParDict b/tutorials/mesh/moveDynamicMesh/relativeMotion/box2D_moveDynamicMesh/system/decomposeParDict new file mode 100644 index 00000000000..7fd7fba4048 --- /dev/null +++ b/tutorials/mesh/moveDynamicMesh/relativeMotion/box2D_moveDynamicMesh/system/decomposeParDict @@ -0,0 +1,30 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v1606+ | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object decomposeParDict; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +numberOfSubdomains 4; + +method hierarchical; + +hierarchicalCoeffs +{ + n (2 2 1); + delta 0.001; + order xyz; +} + + +// ************************************************************************* // diff --git a/tutorials/mesh/moveDynamicMesh/relativeMotion/box2D_moveDynamicMesh/system/extrudeMeshDict b/tutorials/mesh/moveDynamicMesh/relativeMotion/box2D_moveDynamicMesh/system/extrudeMeshDict new file mode 100644 index 00000000000..75677b93e57 --- /dev/null +++ b/tutorials/mesh/moveDynamicMesh/relativeMotion/box2D_moveDynamicMesh/system/extrudeMeshDict @@ -0,0 +1,52 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object extrudeMeshDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// What to extrude: +// patch : from patch of another case ('sourceCase') +// mesh : as above but with original case included +// surface : from externally read surface + +constructFrom patch; +sourceCase "../box_snappyHexMesh"; +sourcePatches (ZMin); + +// If construct from patch: patch to use for back (can be same as sourcePatch) +exposedPatchName ZMax; + +// Flip surface normals before usage. Valid only for extrude from surface or +// patch. +flipNormals true; + +//- Linear extrusion in point-normal direction +extrudeModel linearNormal; + +nLayers 1; + +expansionRatio 1.0; + +linearNormalCoeffs +{ + thickness 0.1; +} + +// Do front and back need to be merged? Usually only makes sense for 360 +// degree wedges. +mergeFaces false; //true; + +// Merge small edges. Fraction of bounding box. +mergeTol 0; + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/tutorials/mesh/moveDynamicMesh/relativeMotion/box2D_moveDynamicMesh/system/fvSchemes b/tutorials/mesh/moveDynamicMesh/relativeMotion/box2D_moveDynamicMesh/system/fvSchemes new file mode 100644 index 00000000000..78ac28a9b6b --- /dev/null +++ b/tutorials/mesh/moveDynamicMesh/relativeMotion/box2D_moveDynamicMesh/system/fvSchemes @@ -0,0 +1,56 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v1606+ | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object fvSchemes; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +ddtSchemes +{ + default Euler; +} + +gradSchemes +{ + default Gauss linear; + grad(p) Gauss linear; + grad(U) cellLimited Gauss linear 1; +} + +divSchemes +{ + default none; +// div(phi,U) Gauss upwind; + div(phi,U) Gauss linearUpwind grad(U); + div(phi,k) Gauss upwind; + div(phi,epsilon) Gauss upwind; + div((nuEff*dev2(T(grad(U))))) Gauss linear; +} + +laplacianSchemes +{ + default Gauss linear limited corrected 0.33; +} + +interpolationSchemes +{ + default linear; +} + +snGradSchemes +{ + default limited corrected 0.33; +} + + +// ************************************************************************* // diff --git a/tutorials/mesh/moveDynamicMesh/relativeMotion/box2D_moveDynamicMesh/system/fvSolution b/tutorials/mesh/moveDynamicMesh/relativeMotion/box2D_moveDynamicMesh/system/fvSolution new file mode 100644 index 00000000000..4af7560b058 --- /dev/null +++ b/tutorials/mesh/moveDynamicMesh/relativeMotion/box2D_moveDynamicMesh/system/fvSolution @@ -0,0 +1,40 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v1606+ | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object fvSolution; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +solvers +{ + "cellDisplacement.*" + { + solver GAMG; + tolerance 1e-8; + relTol 0; + smoother GaussSeidel; + cacheAgglomeration true; + nCellsInCoarsestLevel 10; + agglomerator faceAreaPair; + mergeLevels 1; + } +} + +PIMPLE +{ + correctPhi no; + nOuterCorrectors 1; + nCorrectors 2; + nNonOrthogonalCorrectors 0; +} + +// ************************************************************************* // diff --git a/tutorials/mesh/moveDynamicMesh/relativeMotion/box_snappyHexMesh/constant/transportProperties b/tutorials/mesh/moveDynamicMesh/relativeMotion/box_snappyHexMesh/constant/transportProperties new file mode 100644 index 00000000000..a4159496771 --- /dev/null +++ b/tutorials/mesh/moveDynamicMesh/relativeMotion/box_snappyHexMesh/constant/transportProperties @@ -0,0 +1,22 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v1606+ | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object transportProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +transportModel Newtonian; + +nu [0 2 -1 0 0 0 0] 1e-6; + +// ************************************************************************* // diff --git a/tutorials/mesh/moveDynamicMesh/relativeMotion/box_snappyHexMesh/constant/turbulenceProperties b/tutorials/mesh/moveDynamicMesh/relativeMotion/box_snappyHexMesh/constant/turbulenceProperties new file mode 100644 index 00000000000..4f29e1f4b4f --- /dev/null +++ b/tutorials/mesh/moveDynamicMesh/relativeMotion/box_snappyHexMesh/constant/turbulenceProperties @@ -0,0 +1,30 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v1606+ | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object turbulenceProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +simulationType laminar; + +RAS +{ + RASModel kEpsilon; + + turbulence on; + + printCoeffs on; +} + + +// ************************************************************************* // diff --git a/tutorials/mesh/moveDynamicMesh/relativeMotion/box_snappyHexMesh/system/blockMeshDict b/tutorials/mesh/moveDynamicMesh/relativeMotion/box_snappyHexMesh/system/blockMeshDict new file mode 100644 index 00000000000..0fa97f10eec --- /dev/null +++ b/tutorials/mesh/moveDynamicMesh/relativeMotion/box_snappyHexMesh/system/blockMeshDict @@ -0,0 +1,87 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v1606+ | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object blockMeshDict; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +convertToMeters 1; + +vertices +( + (-1 -1 0) + ( 1 -1 0) + ( 1 1 0) + (-1 1 0) + (-1 -1 0.1) + ( 1 -1 0.1) + ( 1 1 0.1) + (-1 1 0.1) +); + +blocks +( + hex (0 1 2 3 4 5 6 7) (250 250 1) simpleGrading (1 1 1) +); + +edges +( +); + +boundary +( + sides + { + type patch; + faces + ( + (0 1 4 5) + (2 3 6 7) + ); + } + inlet + { + type patch; + faces + ( + (0 3 4 7) + ); + } + outlet + { + type patch; + faces + ( + (1 2 5 6) + ); + } + ZMax + { + type empty; + faces + ( + (4 5 6 7) + ); + } + ZMin + { + type empty; + faces + ( + (0 1 2 3) + ); + + } +); + +// ************************************************************************* // diff --git a/tutorials/mesh/moveDynamicMesh/relativeMotion/box_snappyHexMesh/system/controlDict b/tutorials/mesh/moveDynamicMesh/relativeMotion/box_snappyHexMesh/system/controlDict new file mode 100644 index 00000000000..1b7c966f790 --- /dev/null +++ b/tutorials/mesh/moveDynamicMesh/relativeMotion/box_snappyHexMesh/system/controlDict @@ -0,0 +1,56 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object controlDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +libs ("libfvMotionSolvers.so"); + +application moveDynamicMesh; + +startFrom startTime; + +startTime 0; + +stopAt endTime; + +endTime 0.5; + +deltaT 0.002; + +writeControl timeStep; + +writeInterval 5; + +purgeWrite 0; + +writeFormat binary; + +writePrecision 6; + +writeCompression uncompressed; + +timeFormat general; + +timePrecision 6; + +runTimeModifiable yes; + +adjustTimeStep yes; + +maxCo 0.4; + +maxDeltaT 1; + +// ************************************************************************* // diff --git a/tutorials/mesh/moveDynamicMesh/relativeMotion/box_snappyHexMesh/system/createPatchDict b/tutorials/mesh/moveDynamicMesh/relativeMotion/box_snappyHexMesh/system/createPatchDict new file mode 100644 index 00000000000..a496616d8e7 --- /dev/null +++ b/tutorials/mesh/moveDynamicMesh/relativeMotion/box_snappyHexMesh/system/createPatchDict @@ -0,0 +1,83 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v1606+ | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object createPatchDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// Do a synchronisation of coupled points after creation of any patches. +// Note: this does not work with points that are on multiple coupled patches +// with transformations (i.e. cyclics). +pointSync false; + +// Patches to create. +patches +( + { + //- Master side patch + name AMI_rotor; + patchInfo + { + type cyclicAMI; + matchTolerance 0.0001; + neighbourPatch AMI_rotor_slave; + transform noOrdering; + } + constructFrom patches; + patches (v_rotor); + } + + { + //- Slave side patch + name AMI_rotor_slave; + patchInfo + { + type cyclicAMI; + matchTolerance 0.0001; + neighbourPatch AMI_rotor; + transform noOrdering; + } + constructFrom patches; + patches (v_rotor_slave); + } + + { + //- Master side patch + name AMI_dualWing; + patchInfo + { + type cyclicAMI; + matchTolerance 0.0001; + neighbourPatch AMI_dualWing_slave; + transform noOrdering; + } + constructFrom patches; + patches (v_dualWing); + } + + { + //- Slave side patch + name AMI_dualWing_slave; + patchInfo + { + type cyclicAMI; + matchTolerance 0.0001; + neighbourPatch AMI_dualWing; + transform noOrdering; + } + constructFrom patches; + patches (v_dualWing_slave); + } + +); + +// ************************************************************************* // diff --git a/tutorials/mesh/moveDynamicMesh/relativeMotion/box_snappyHexMesh/system/decomposeParDict b/tutorials/mesh/moveDynamicMesh/relativeMotion/box_snappyHexMesh/system/decomposeParDict new file mode 100644 index 00000000000..7fd7fba4048 --- /dev/null +++ b/tutorials/mesh/moveDynamicMesh/relativeMotion/box_snappyHexMesh/system/decomposeParDict @@ -0,0 +1,30 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v1606+ | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object decomposeParDict; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +numberOfSubdomains 4; + +method hierarchical; + +hierarchicalCoeffs +{ + n (2 2 1); + delta 0.001; + order xyz; +} + + +// ************************************************************************* // diff --git a/tutorials/mesh/moveDynamicMesh/relativeMotion/box_snappyHexMesh/system/fvSchemes b/tutorials/mesh/moveDynamicMesh/relativeMotion/box_snappyHexMesh/system/fvSchemes new file mode 100644 index 00000000000..78ac28a9b6b --- /dev/null +++ b/tutorials/mesh/moveDynamicMesh/relativeMotion/box_snappyHexMesh/system/fvSchemes @@ -0,0 +1,56 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v1606+ | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object fvSchemes; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +ddtSchemes +{ + default Euler; +} + +gradSchemes +{ + default Gauss linear; + grad(p) Gauss linear; + grad(U) cellLimited Gauss linear 1; +} + +divSchemes +{ + default none; +// div(phi,U) Gauss upwind; + div(phi,U) Gauss linearUpwind grad(U); + div(phi,k) Gauss upwind; + div(phi,epsilon) Gauss upwind; + div((nuEff*dev2(T(grad(U))))) Gauss linear; +} + +laplacianSchemes +{ + default Gauss linear limited corrected 0.33; +} + +interpolationSchemes +{ + default linear; +} + +snGradSchemes +{ + default limited corrected 0.33; +} + + +// ************************************************************************* // diff --git a/tutorials/mesh/moveDynamicMesh/relativeMotion/box_snappyHexMesh/system/fvSolution b/tutorials/mesh/moveDynamicMesh/relativeMotion/box_snappyHexMesh/system/fvSolution new file mode 100644 index 00000000000..10c5d096867 --- /dev/null +++ b/tutorials/mesh/moveDynamicMesh/relativeMotion/box_snappyHexMesh/system/fvSolution @@ -0,0 +1,93 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v1606+ | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object fvSolution; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +solvers +{ + pcorr + { + solver GAMG; + tolerance 1e-2; + relTol 0; + smoother DICGaussSeidel; + cacheAgglomeration no; + nCellsInCoarsestLevel 10; + agglomerator faceAreaPair; + mergeLevels 1; + maxIter 50; + } + + p + { + $pcorr; + tolerance 1e-5; + relTol 0.001; + } + + pFinal + { + $p; + tolerance 1e-6; + relTol 0; + } + + "(U|k|epsilon)" + { + solver smoothSolver; + smoother symGaussSeidel; + tolerance 1e-6; + relTol 0.01; + } + + "(U|k|epsilon)Final" + { + solver smoothSolver; + smoother symGaussSeidel; + tolerance 1e-6; + relTol 0; + } + + "cellDisplacement.*" + { + solver GAMG; + tolerance 1e-8; + relTol 0; + smoother GaussSeidel; + cacheAgglomeration true; + nCellsInCoarsestLevel 10; + agglomerator faceAreaPair; + mergeLevels 1; + } +} + +PIMPLE +{ + correctPhi no; + nOuterCorrectors 3; + nCorrectors 2; + nNonOrthogonalCorrectors 0; +} + +relaxationFactors +{ + "(U|k|epsilon).*" 1; +} + +cache +{ + grad(U); +} + +// ************************************************************************* // diff --git a/tutorials/mesh/moveDynamicMesh/relativeMotion/box_snappyHexMesh/system/snappyHexMeshDict b/tutorials/mesh/moveDynamicMesh/relativeMotion/box_snappyHexMesh/system/snappyHexMeshDict new file mode 100644 index 00000000000..76b03be58b6 --- /dev/null +++ b/tutorials/mesh/moveDynamicMesh/relativeMotion/box_snappyHexMesh/system/snappyHexMeshDict @@ -0,0 +1,384 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v1606+ | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object snappyHexMeshDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// Which of the steps to run +castellatedMesh true; +snap true; +addLayers false; + + +// 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 +{ + v_dualWing + { + type searchableCylinder; + name v_dualWing; + point1 (-0.43 0 -10); + point2 (-0.43 0 10); + radius 0.1; + } + + + v_rotor + { + type searchableCylinder; + name v_rotor; + point1 (0 0 -10); + point2 (0 0 10); + radius 0.75; + } + wing1 + { + type searchableBox; + name wing1; + min (-0.5 -0.01 -10); + max (-0.44 0.01 10); + } + wing2 + { + type searchableBox; + name wing2; + min (-0.42 -0.0025 -10); + max (-0.36 0.0025 10); + } +}; + + + +// 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 1000000; + + // 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 20000000; + + // 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 6; + + + + // 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 + { + v_dualWing + { + level (0 0); + faceType boundary; + cellZone dualWing; + faceZone dualWing; + cellZoneInside inside; + } + v_rotor + { + level (0 0); + faceType boundary; + cellZone rotor; + faceZone rotor; + cellZoneInside inside; + } + wing1 + { + level (3 3); + } + wing2 + { + level (3 3); + } + } + + // 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 (-0.99 -0.99 0.05); + + + // 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 false; +} + + + +// 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 4.0; // 1.0; + + //- Number of mesh displacement relaxation iterations. + nSolveIter 300; + + //- 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 true; + + // Use castellatedMeshControls::features (default = true) + explicitFeatureSnap false; + + // Detect features between multiple surfaces + // (only for explicitFeatureSnap, default = false) + multiRegionFeatureSnap true; +} + + + +// 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 + { + } + + // 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. + // 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 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 +{ + //- Maximum non-orthogonality allowed. Set to 180 to disable. + maxNonOrtho 180; + + //- Max skewness allowed. Set to <0 to disable. + maxBoundarySkewness 20; + maxInternalSkewness 4; + + //- Max concaveness allowed. Is angle (in degrees) below which concavity + // is allowed. 0 is straight face, <0 would be convex face. + // Set to 180 to disable. + maxConcave 80; + + //- Minimum pyramid volume. Is absolute volume of cell pyramid. + // Set to a sensible fraction of the smallest cell volume expected. + // Set to very negative number (e.g. -1E30) to disable. + minVol 1e-13; + + //- Minimum quality of the tet formed by the face-centre + // and variable base point minimum decomposition triangles and + // the cell centre. This has to be a positive number for tracking + // to work. Set to very negative number (e.g. -1E30) to + // disable. + // <0 = inside out tet, + // 0 = flat tet + // 1 = regular tet + minTetQuality -1; // 1e-30; + + //- Minimum face area. Set to <0 to disable. + minArea -1; + + //- Minimum face twist. Set to <-1 to disable. dot product of face normal + // and face centre triangles normal + minTwist 0.01; + + //- Minimum normalised cell determinant + // 1 = hex, <= 0 = folded or flattened illegal cell + minDeterminant 0.001; + + //- minFaceWeight (0 -> 0.5) + minFaceWeight 0.05; + + //- minVolRatio (0 -> 1) + minVolRatio 0.01; + + //must be >0 for Fluent compatibility + minTriangleTwist -1; + + + // Advanced + + //- Number of error distribution iterations + nSmoothScale 4; + //- Amount to scale back displacement at error points + errorReduction 0.75; + + // Optional : some meshing phases allow usage of relaxed rules. + // See e.g. addLayersControls::nRelaxedIter. + relaxed + { + //- Maximum non-orthogonality allowed. Set to 180 to disable. + maxNonOrtho 75; + } +} + + + +// Merge tolerance. Is fraction of overall bounding box of initial mesh. +// Note: the write tolerance needs to be higher than this. +mergeTolerance 1e-6; + + +// ************************************************************************* // -- GitLab