diff --git a/tutorials/mesh/refineMesh/cylinder/Allclean b/tutorials/mesh/refineMesh/cylinder/Allclean new file mode 100755 index 0000000000..f963549347 --- /dev/null +++ b/tutorials/mesh/refineMesh/cylinder/Allclean @@ -0,0 +1,10 @@ +#!/bin/sh +cd "${0%/*}" || exit # Run from this directory +. ${WM_PROJECT_DIR:?}/bin/tools/CleanFunctions # Tutorial clean functions +#------------------------------------------------------------------------------ + +cleanCase + +rm -rf constant + +#------------------------------------------------------------------------------ diff --git a/tutorials/mesh/refineMesh/cylinder/Allrun b/tutorials/mesh/refineMesh/cylinder/Allrun new file mode 100755 index 0000000000..68f533f73e --- /dev/null +++ b/tutorials/mesh/refineMesh/cylinder/Allrun @@ -0,0 +1,26 @@ +#!/bin/sh +cd "${0%/*}" || exit # Run from this directory +. ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions # Tutorial run functions +#------------------------------------------------------------------------------ + +mkdir -p constant/triSurface + +cp -f \ + "$FOAM_TUTORIALS"/resources/geometry/cylinder.vtk.gz \ + constant/triSurface/ + +# Generate mesh from surface (in constant/triSurface) +runApplication extrudeMesh + +# Make front and back type empty +runApplication createPatch -overwrite + +runApplication -s "level1" topoSet -dict system/topoSetDict_level1 + +runApplication -s "level1" refineMesh + +runApplication -s "level2" topoSet -dict system/topoSetDict_level2 + +runApplication -s "level2" refineMesh + +#------------------------------------------------------------------------------ diff --git a/tutorials/mesh/refineMesh/cylinder/README.txt b/tutorials/mesh/refineMesh/cylinder/README.txt new file mode 100644 index 0000000000..8b9ae191c4 --- /dev/null +++ b/tutorials/mesh/refineMesh/cylinder/README.txt @@ -0,0 +1 @@ +Demonstrate using user-defined coordinate system to directionally refine. diff --git a/tutorials/mesh/refineMesh/cylinder/system/controlDict b/tutorials/mesh/refineMesh/cylinder/system/controlDict new file mode 100644 index 0000000000..bae8ab0749 --- /dev/null +++ b/tutorials/mesh/refineMesh/cylinder/system/controlDict @@ -0,0 +1,48 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v2412 | +| \\ / A nd | Website: www.openfoam.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object controlDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +application snappyHexMesh; + +startFrom latestTime; + +startTime 0; + +stopAt endTime; + +endTime 100; + +deltaT 1; + +writeControl runTime; + +writeInterval 1; + +purgeWrite 0; + +writeFormat ascii; + +writePrecision 6; + +writeCompression off; + +timeFormat general; + +timePrecision 6; + +runTimeModifiable true; + + +// ************************************************************************* // diff --git a/tutorials/mesh/refineMesh/cylinder/system/createPatchDict b/tutorials/mesh/refineMesh/cylinder/system/createPatchDict new file mode 100644 index 0000000000..301624dd11 --- /dev/null +++ b/tutorials/mesh/refineMesh/cylinder/system/createPatchDict @@ -0,0 +1,84 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v2412 | +| \\ / A nd | Website: www.openfoam.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object createPatchDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +pointSync false; + +// Patches to create. +patches +( + { + // Name of new patch + name oversetPatch; + + // Dictionary to construct new patch from + patchInfo + { + type overset; + } + + // How to construct: either from 'patches' or 'set' + constructFrom patches; + + // If constructFrom = patches : names of patches. Wildcards allowed. + patches (otherSide); + + // If constructFrom = set : name of faceSet + set f0; + } + + { + // Name of new patch + name walls; + + // Dictionary to construct new patch from + patchInfo + { + type wall; + } + + // How to construct: either from 'patches' or 'set' + constructFrom patches; + + // If constructFrom = patches : names of patches. Wildcards allowed. + patches (originalPatch); + + // If constructFrom = set : name of faceSet + set f0; + } + + { + // Name of new patch + name frontAndBack; + + // Dictionary to construct new patch from + patchInfo + { + type empty; + } + + // How to construct: either from 'patches' or 'set' + constructFrom patches; + + // If constructFrom = patches : names of patches. Wildcards allowed. + patches (sides); + + // If constructFrom = set : name of faceSet + set f0; + } +); + + +// ************************************************************************* // diff --git a/tutorials/mesh/refineMesh/cylinder/system/extrudeMeshDict b/tutorials/mesh/refineMesh/cylinder/system/extrudeMeshDict new file mode 100644 index 0000000000..a7609180e9 --- /dev/null +++ b/tutorials/mesh/refineMesh/cylinder/system/extrudeMeshDict @@ -0,0 +1,135 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v2412 | +| \\ / A nd | Website: 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 mesh; +//constructFrom patch; +constructFrom surface; + +// If construct from patch/mesh: +sourceCase "../cavity"; +sourcePatches (movingWall); + +// If construct from patch: patch to use for back (can be same as sourcePatch) +exposedPatchName movingWall; + +// If construct from surface: +surface "/triSurface/cylinder.vtk"; + +// Flip surface normals before usage. Valid only for extrude from surface or +// patch. +flipNormals false; + +//- Linear extrusion in point-normal direction +extrudeModel linearNormal; + +//- Single layer linear extrusion in point-normal direction +// with empty patches on front and back +//extrudeModel plane; + +//- Linear extrusion in specified direction +//extrudeModel linearDirection; + +//- Sector extrusion +//extrudeModel sector; + +//- Wedge extrusion of a single layer +// with wedge patches on front and back +//extrudeModel wedge; + +//- Extrudes into sphere around (0 0 0) +//extrudeModel linearRadial; + +//- Extrudes into sphere around (0 0 0) with specified radii +//extrudeModel radial; + +//- Extrudes into sphere with grading according to pressure (atmospherics) +//extrudeModel sigmaRadial; + +//- Extrudes by interpolating along path inbetween two (topologically identical) +// surfaces (e.g. one is an offsetted version of the other) +//extrudeModel offsetSurface; + +nLayers 10; + +expansionRatio 1.02; + +sectorCoeffs //<- Also used for wedge +{ + point (0 0.1 -0.05); + axis (-1 0 0); + angle 360; // For nLayers=1 assume symmetry so angle/2 on each side +} + +linearNormalCoeffs +{ + thickness 0.7; +} + +planeCoeffs +{ +// thickness 0.1; + nLayers 4; +} + +linearDirectionCoeffs +{ + direction (0 1 0); + thickness 0.5; +} + +linearRadialCoeffs +{ + R 0.1; + Rsurface 0.01; // Optional inner radius +} + +radialCoeffs +{ + // Radii specified through interpolation table + R table ((0 0.01)(3 0.03)(10 0.1)); +} + +sigmaRadialCoeffs +{ + RTbyg 1; + pRef 1; + pStrat 1; +} + +offsetSurfaceCoeffs +{ + // Surface that mesh has been meshed to + baseSurface "/triSurface/DTC-scaled-inflated.obj"; + + // Surface to fill in to + offsetSurface "/triSurface/DTC-scaled.obj"; +} + + +// Do front and back need to be merged? Usually only makes sense for 360 +// degree wedges. +mergeFaces false; + +// Merge small edges. Fraction of bounding box. +mergeTol 0; + + +// ************************************************************************* // diff --git a/tutorials/mesh/refineMesh/cylinder/system/fvSchemes b/tutorials/mesh/refineMesh/cylinder/system/fvSchemes new file mode 100644 index 0000000000..70717356e9 --- /dev/null +++ b/tutorials/mesh/refineMesh/cylinder/system/fvSchemes @@ -0,0 +1,42 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v2412 | +| \\ / A nd | Website: www.openfoam.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object fvSchemes; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +ddtSchemes +{ +} + +gradSchemes +{ +} + +divSchemes +{ +} + +laplacianSchemes +{ +} + +interpolationSchemes +{ +} + +snGradSchemes +{ +} + + +// ************************************************************************* // diff --git a/tutorials/mesh/refineMesh/cylinder/system/fvSolution b/tutorials/mesh/refineMesh/cylinder/system/fvSolution new file mode 100644 index 0000000000..77a0889c82 --- /dev/null +++ b/tutorials/mesh/refineMesh/cylinder/system/fvSolution @@ -0,0 +1,23 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v2412 | +| \\ / A nd | Website: www.openfoam.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object fvSolution; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +PIMPLE +{ + nOuterCorrectors 1; +} + + +// ************************************************************************* // diff --git a/tutorials/mesh/refineMesh/cylinder/system/refineMeshDict b/tutorials/mesh/refineMesh/cylinder/system/refineMeshDict new file mode 100644 index 0000000000..450636cb64 --- /dev/null +++ b/tutorials/mesh/refineMesh/cylinder/system/refineMeshDict @@ -0,0 +1,42 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v2406 | +| \\ / A nd | Website: www.openfoam.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object refineMeshDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +set cellsToRefine; + +coordinateSystem user; + +userCoeffs +{ + type cylindrical; + origin (0 0 0); + e1 (1 0 0); + e3 (0 1 0); +} + +directions +( + //normal + tan1 + //tan2 +); + +useHexTopology true; + +geometricCut false; + +writeMesh false; + +// ************************************************************************* // diff --git a/tutorials/mesh/refineMesh/cylinder/system/topoSetDict_level1 b/tutorials/mesh/refineMesh/cylinder/system/topoSetDict_level1 new file mode 100644 index 0000000000..4aa4c9e607 --- /dev/null +++ b/tutorials/mesh/refineMesh/cylinder/system/topoSetDict_level1 @@ -0,0 +1,33 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v2406 | +| \\ / A nd | Website: www.openfoam.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object topoSetDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +actions +( + { + name cellsToRefine; + type cellSet; + action new; + + // Mandatory entries + source cylinderAnnulusToCell; + p1 (0 -1 0); + p2 (0 1 0); + innerRadius 0.7; + outerRadius 1.5; + } +); + +// ************************************************************************* // diff --git a/tutorials/mesh/refineMesh/cylinder/system/topoSetDict_level2 b/tutorials/mesh/refineMesh/cylinder/system/topoSetDict_level2 new file mode 100644 index 0000000000..e569bd2464 --- /dev/null +++ b/tutorials/mesh/refineMesh/cylinder/system/topoSetDict_level2 @@ -0,0 +1,33 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: v2406 | +| \\ / A nd | Website: www.openfoam.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object topoSetDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +actions +( + { + name cellsToRefine; + type cellSet; + action new; + + // Mandatory entries + source cylinderAnnulusToCell; + p1 (0 -1 0); + p2 (0 1 0); + innerRadius 0.9; + outerRadius 1.5; + } +); + +// ************************************************************************* //