From c5b6e666c2780cfd3950db4c691497e8802c1eab Mon Sep 17 00:00:00 2001 From: Jakub Knir Date: Fri, 5 Feb 2021 16:25:49 +0000 Subject: [PATCH] sloshingTank: Removed blockMeshDict.m4 and replaced by sloshingTank2D and sloshingTank3D dictionary. Vertices are generated using run time compilation functionality. File duplication avoided by placement in: tutorials/resources/blockMesh/sloshingTank2D tutorials/resources/blockMesh/sloshingTank3D --- .../laminar/sloshingTank2D/Allrun | 3 +- .../sloshingTank2D/system/blockMeshDict.m4 | 145 ------------------ .../interFoam/laminar/sloshingTank2D/Allrun | 4 +- .../sloshingTank2D/system/blockMeshDict.m4 | 145 ------------------ .../laminar/sloshingTank2D3DoF/Allrun | 3 +- .../system/blockMeshDict.m4 | 145 ------------------ .../interFoam/laminar/sloshingTank3D/Allrun | 3 +- .../sloshingTank3D/system/blockMeshDict.m4 | 137 ----------------- .../laminar/sloshingTank3D3DoF/Allrun | 3 +- .../system/blockMeshDict.m4 | 137 ----------------- .../laminar/sloshingTank3D6DoF/Allrun | 3 +- .../system/blockMeshDict.m4 | 137 ----------------- tutorials/resources/blockMesh/sloshingTank2D | 125 +++++++++++++++ tutorials/resources/blockMesh/sloshingTank3D | 109 +++++++++++++ 14 files changed, 241 insertions(+), 858 deletions(-) delete mode 100644 tutorials/multiphase/compressibleInterFoam/laminar/sloshingTank2D/system/blockMeshDict.m4 delete mode 100644 tutorials/multiphase/interFoam/laminar/sloshingTank2D/system/blockMeshDict.m4 delete mode 100644 tutorials/multiphase/interFoam/laminar/sloshingTank2D3DoF/system/blockMeshDict.m4 delete mode 100644 tutorials/multiphase/interFoam/laminar/sloshingTank3D/system/blockMeshDict.m4 delete mode 100644 tutorials/multiphase/interFoam/laminar/sloshingTank3D3DoF/system/blockMeshDict.m4 delete mode 100644 tutorials/multiphase/interFoam/laminar/sloshingTank3D6DoF/system/blockMeshDict.m4 create mode 100644 tutorials/resources/blockMesh/sloshingTank2D create mode 100644 tutorials/resources/blockMesh/sloshingTank3D diff --git a/tutorials/multiphase/compressibleInterFoam/laminar/sloshingTank2D/Allrun b/tutorials/multiphase/compressibleInterFoam/laminar/sloshingTank2D/Allrun index 855177f8b6..41ed0b90f9 100755 --- a/tutorials/multiphase/compressibleInterFoam/laminar/sloshingTank2D/Allrun +++ b/tutorials/multiphase/compressibleInterFoam/laminar/sloshingTank2D/Allrun @@ -4,8 +4,7 @@ cd ${0%/*} || exit 1 # Run from this directory # Source tutorial run functions . $WM_PROJECT_DIR/bin/tools/RunFunctions -m4 system/blockMeshDict.m4 > system/blockMeshDict -runApplication blockMesh +runApplication blockMesh -dict $FOAM_TUTORIALS/resources/blockMesh/sloshingTank2D runApplication setFields runApplication $(getApplication) diff --git a/tutorials/multiphase/compressibleInterFoam/laminar/sloshingTank2D/system/blockMeshDict.m4 b/tutorials/multiphase/compressibleInterFoam/laminar/sloshingTank2D/system/blockMeshDict.m4 deleted file mode 100644 index 240869ec9f..0000000000 --- a/tutorials/multiphase/compressibleInterFoam/laminar/sloshingTank2D/system/blockMeshDict.m4 +++ /dev/null @@ -1,145 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | Website: https://openfoam.org - \\ / A nd | Version: dev - \\/ M anipulation | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - `format' ascii; - class dictionary; - object blockMeshDict; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -// General m4 macros - -changecom(//)changequote([,]) dnl> -define(calc, [esyscmd(perl -e 'use Math::Trig; print ($1)')]) dnl> -define(VCOUNT, 0) -define(vlabel, [[// ]Vertex $1 = VCOUNT define($1, VCOUNT)define([VCOUNT], incr(VCOUNT))]) - -define(hex2D, hex (b$1 b$2 b$3 b$4 f$1 f$2 f$3 f$4)) -define(quad2D, (b$1 b$2 f$2 f$1)) -define(frontQuad, (f$1 f$2 f$3 f$4)) -define(backQuad, (b$1 b$4 b$3 b$2)) - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -// User-defined parameters - -convertToMeters 1; - -define(l, 1.0) // Length of tank (x-direction) -define(b, 40) // Breadth of tank (y-direction) -define(h, 30) // Depth of tank (z-direction) - -define(hlc, 5) // Depth to the top (height) of lower chamfer -define(huc, 10) // Height of upper chamfer - -define(thetalc, 45) // Angle of lower chamfer to the horizontal -define(thetauc, 45) // Angle of upper chamfer to the horizontal - -define(CofGy, calc(b/2.0)) // Centre of gravity in y-direction -define(CofGz, 10.0) // Centre of gravity in z-direction - -define(Nl, 1) // Number of cells in the length (1 for 2D) -define(Nb, 40) // Number of cells in the breadth -define(Nhlc, 6) // Number of cells in the height of the lower champfer -define(Nh, 16) // Number of cells in the height between the chamfers -define(Nhuc, 12) // Number of cells in the height of the upper champfer - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -// Derived parameters - -define(blc, calc(hlc/tan(deg2rad(thetalc)))) // Breadth to the top (height) of lower chamfer -define(buc, calc(huc/tan(deg2rad(thetauc)))) // Breadth of upper chamfer - -define(Yl, -CofGy) -define(Yllc, calc(Yl + blc)) -define(Yluc, calc(Yl + buc)) - -define(Yr, calc(Yl + b)) -define(Yrlc, calc(Yr - blc)) -define(Yruc, calc(Yr - buc)) - -define(Zb, -CofGz) -define(Zlc, calc(Zb + hlc)) -define(Zt, calc(Zb + h)) -define(Zuc, calc(Zt - huc)) - -define(Xf, calc(l/2.0)) -define(Xb, calc(Xf - l)) - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -// Parametric description - -vertices -( - (Xb Yllc Zb) vlabel(bllcb) - (Xb Yl Zlc) vlabel(bllc) - (Xb Yl Zuc) vlabel(bluc) - (Xb Yluc Zt) vlabel(bluct) - (Xb Yrlc Zb) vlabel(brlcb) - (Xb Yr Zlc) vlabel(brlc) - (Xb Yr Zuc) vlabel(bruc) - (Xb Yruc Zt) vlabel(bruct) - - (Xf Yllc Zb) vlabel(fllcb) - (Xf Yl Zlc) vlabel(fllc) - (Xf Yl Zuc) vlabel(fluc) - (Xf Yluc Zt) vlabel(fluct) - (Xf Yrlc Zb) vlabel(frlcb) - (Xf Yr Zlc) vlabel(frlc) - (Xf Yr Zuc) vlabel(fruc) - (Xf Yruc Zt) vlabel(fruct) -); - -blocks -( - // block0 - hex2D(llcb, rlcb, rlc, llc) - (Nb Nhlc Nl) - simpleGrading (1 1 1) - - // block1 - hex2D(llc, rlc, ruc, luc) - (Nb Nh Nl) - simpleGrading (1 1 1) - - // block2 - hex2D(luc, ruc, ruct, luct) - (Nb Nhuc Nl) - simpleGrading (1 1 1) -); - -patches -( - patch walls - ( - quad2D(llcb, rlcb) - quad2D(rlcb, rlc) - quad2D(rlc, ruc) - quad2D(ruc, ruct) - quad2D(ruct, luct) - quad2D(luct, luc) - quad2D(luc, llc) - quad2D(llc, llcb) - ) - - empty front - ( - frontQuad(llcb, rlcb, rlc, llc) - frontQuad(llc, rlc, ruc, luc) - frontQuad(luc, ruc, ruct, luct) - ) - - empty back - ( - backQuad(llcb, rlcb, rlc, llc) - backQuad(llc, rlc, ruc, luc) - backQuad(luc, ruc, ruct, luct) - ) -); - -// ************************************************************************* // diff --git a/tutorials/multiphase/interFoam/laminar/sloshingTank2D/Allrun b/tutorials/multiphase/interFoam/laminar/sloshingTank2D/Allrun index 855177f8b6..464d6bf890 100755 --- a/tutorials/multiphase/interFoam/laminar/sloshingTank2D/Allrun +++ b/tutorials/multiphase/interFoam/laminar/sloshingTank2D/Allrun @@ -4,8 +4,8 @@ cd ${0%/*} || exit 1 # Run from this directory # Source tutorial run functions . $WM_PROJECT_DIR/bin/tools/RunFunctions -m4 system/blockMeshDict.m4 > system/blockMeshDict -runApplication blockMesh +runApplication blockMesh -dict $FOAM_TUTORIALS/resources/blockMesh/sloshingTank2D + runApplication setFields runApplication $(getApplication) diff --git a/tutorials/multiphase/interFoam/laminar/sloshingTank2D/system/blockMeshDict.m4 b/tutorials/multiphase/interFoam/laminar/sloshingTank2D/system/blockMeshDict.m4 deleted file mode 100644 index 240869ec9f..0000000000 --- a/tutorials/multiphase/interFoam/laminar/sloshingTank2D/system/blockMeshDict.m4 +++ /dev/null @@ -1,145 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | Website: https://openfoam.org - \\ / A nd | Version: dev - \\/ M anipulation | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - `format' ascii; - class dictionary; - object blockMeshDict; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -// General m4 macros - -changecom(//)changequote([,]) dnl> -define(calc, [esyscmd(perl -e 'use Math::Trig; print ($1)')]) dnl> -define(VCOUNT, 0) -define(vlabel, [[// ]Vertex $1 = VCOUNT define($1, VCOUNT)define([VCOUNT], incr(VCOUNT))]) - -define(hex2D, hex (b$1 b$2 b$3 b$4 f$1 f$2 f$3 f$4)) -define(quad2D, (b$1 b$2 f$2 f$1)) -define(frontQuad, (f$1 f$2 f$3 f$4)) -define(backQuad, (b$1 b$4 b$3 b$2)) - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -// User-defined parameters - -convertToMeters 1; - -define(l, 1.0) // Length of tank (x-direction) -define(b, 40) // Breadth of tank (y-direction) -define(h, 30) // Depth of tank (z-direction) - -define(hlc, 5) // Depth to the top (height) of lower chamfer -define(huc, 10) // Height of upper chamfer - -define(thetalc, 45) // Angle of lower chamfer to the horizontal -define(thetauc, 45) // Angle of upper chamfer to the horizontal - -define(CofGy, calc(b/2.0)) // Centre of gravity in y-direction -define(CofGz, 10.0) // Centre of gravity in z-direction - -define(Nl, 1) // Number of cells in the length (1 for 2D) -define(Nb, 40) // Number of cells in the breadth -define(Nhlc, 6) // Number of cells in the height of the lower champfer -define(Nh, 16) // Number of cells in the height between the chamfers -define(Nhuc, 12) // Number of cells in the height of the upper champfer - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -// Derived parameters - -define(blc, calc(hlc/tan(deg2rad(thetalc)))) // Breadth to the top (height) of lower chamfer -define(buc, calc(huc/tan(deg2rad(thetauc)))) // Breadth of upper chamfer - -define(Yl, -CofGy) -define(Yllc, calc(Yl + blc)) -define(Yluc, calc(Yl + buc)) - -define(Yr, calc(Yl + b)) -define(Yrlc, calc(Yr - blc)) -define(Yruc, calc(Yr - buc)) - -define(Zb, -CofGz) -define(Zlc, calc(Zb + hlc)) -define(Zt, calc(Zb + h)) -define(Zuc, calc(Zt - huc)) - -define(Xf, calc(l/2.0)) -define(Xb, calc(Xf - l)) - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -// Parametric description - -vertices -( - (Xb Yllc Zb) vlabel(bllcb) - (Xb Yl Zlc) vlabel(bllc) - (Xb Yl Zuc) vlabel(bluc) - (Xb Yluc Zt) vlabel(bluct) - (Xb Yrlc Zb) vlabel(brlcb) - (Xb Yr Zlc) vlabel(brlc) - (Xb Yr Zuc) vlabel(bruc) - (Xb Yruc Zt) vlabel(bruct) - - (Xf Yllc Zb) vlabel(fllcb) - (Xf Yl Zlc) vlabel(fllc) - (Xf Yl Zuc) vlabel(fluc) - (Xf Yluc Zt) vlabel(fluct) - (Xf Yrlc Zb) vlabel(frlcb) - (Xf Yr Zlc) vlabel(frlc) - (Xf Yr Zuc) vlabel(fruc) - (Xf Yruc Zt) vlabel(fruct) -); - -blocks -( - // block0 - hex2D(llcb, rlcb, rlc, llc) - (Nb Nhlc Nl) - simpleGrading (1 1 1) - - // block1 - hex2D(llc, rlc, ruc, luc) - (Nb Nh Nl) - simpleGrading (1 1 1) - - // block2 - hex2D(luc, ruc, ruct, luct) - (Nb Nhuc Nl) - simpleGrading (1 1 1) -); - -patches -( - patch walls - ( - quad2D(llcb, rlcb) - quad2D(rlcb, rlc) - quad2D(rlc, ruc) - quad2D(ruc, ruct) - quad2D(ruct, luct) - quad2D(luct, luc) - quad2D(luc, llc) - quad2D(llc, llcb) - ) - - empty front - ( - frontQuad(llcb, rlcb, rlc, llc) - frontQuad(llc, rlc, ruc, luc) - frontQuad(luc, ruc, ruct, luct) - ) - - empty back - ( - backQuad(llcb, rlcb, rlc, llc) - backQuad(llc, rlc, ruc, luc) - backQuad(luc, ruc, ruct, luct) - ) -); - -// ************************************************************************* // diff --git a/tutorials/multiphase/interFoam/laminar/sloshingTank2D3DoF/Allrun b/tutorials/multiphase/interFoam/laminar/sloshingTank2D3DoF/Allrun index 855177f8b6..41ed0b90f9 100755 --- a/tutorials/multiphase/interFoam/laminar/sloshingTank2D3DoF/Allrun +++ b/tutorials/multiphase/interFoam/laminar/sloshingTank2D3DoF/Allrun @@ -4,8 +4,7 @@ cd ${0%/*} || exit 1 # Run from this directory # Source tutorial run functions . $WM_PROJECT_DIR/bin/tools/RunFunctions -m4 system/blockMeshDict.m4 > system/blockMeshDict -runApplication blockMesh +runApplication blockMesh -dict $FOAM_TUTORIALS/resources/blockMesh/sloshingTank2D runApplication setFields runApplication $(getApplication) diff --git a/tutorials/multiphase/interFoam/laminar/sloshingTank2D3DoF/system/blockMeshDict.m4 b/tutorials/multiphase/interFoam/laminar/sloshingTank2D3DoF/system/blockMeshDict.m4 deleted file mode 100644 index 240869ec9f..0000000000 --- a/tutorials/multiphase/interFoam/laminar/sloshingTank2D3DoF/system/blockMeshDict.m4 +++ /dev/null @@ -1,145 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | Website: https://openfoam.org - \\ / A nd | Version: dev - \\/ M anipulation | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - `format' ascii; - class dictionary; - object blockMeshDict; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -// General m4 macros - -changecom(//)changequote([,]) dnl> -define(calc, [esyscmd(perl -e 'use Math::Trig; print ($1)')]) dnl> -define(VCOUNT, 0) -define(vlabel, [[// ]Vertex $1 = VCOUNT define($1, VCOUNT)define([VCOUNT], incr(VCOUNT))]) - -define(hex2D, hex (b$1 b$2 b$3 b$4 f$1 f$2 f$3 f$4)) -define(quad2D, (b$1 b$2 f$2 f$1)) -define(frontQuad, (f$1 f$2 f$3 f$4)) -define(backQuad, (b$1 b$4 b$3 b$2)) - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -// User-defined parameters - -convertToMeters 1; - -define(l, 1.0) // Length of tank (x-direction) -define(b, 40) // Breadth of tank (y-direction) -define(h, 30) // Depth of tank (z-direction) - -define(hlc, 5) // Depth to the top (height) of lower chamfer -define(huc, 10) // Height of upper chamfer - -define(thetalc, 45) // Angle of lower chamfer to the horizontal -define(thetauc, 45) // Angle of upper chamfer to the horizontal - -define(CofGy, calc(b/2.0)) // Centre of gravity in y-direction -define(CofGz, 10.0) // Centre of gravity in z-direction - -define(Nl, 1) // Number of cells in the length (1 for 2D) -define(Nb, 40) // Number of cells in the breadth -define(Nhlc, 6) // Number of cells in the height of the lower champfer -define(Nh, 16) // Number of cells in the height between the chamfers -define(Nhuc, 12) // Number of cells in the height of the upper champfer - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -// Derived parameters - -define(blc, calc(hlc/tan(deg2rad(thetalc)))) // Breadth to the top (height) of lower chamfer -define(buc, calc(huc/tan(deg2rad(thetauc)))) // Breadth of upper chamfer - -define(Yl, -CofGy) -define(Yllc, calc(Yl + blc)) -define(Yluc, calc(Yl + buc)) - -define(Yr, calc(Yl + b)) -define(Yrlc, calc(Yr - blc)) -define(Yruc, calc(Yr - buc)) - -define(Zb, -CofGz) -define(Zlc, calc(Zb + hlc)) -define(Zt, calc(Zb + h)) -define(Zuc, calc(Zt - huc)) - -define(Xf, calc(l/2.0)) -define(Xb, calc(Xf - l)) - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -// Parametric description - -vertices -( - (Xb Yllc Zb) vlabel(bllcb) - (Xb Yl Zlc) vlabel(bllc) - (Xb Yl Zuc) vlabel(bluc) - (Xb Yluc Zt) vlabel(bluct) - (Xb Yrlc Zb) vlabel(brlcb) - (Xb Yr Zlc) vlabel(brlc) - (Xb Yr Zuc) vlabel(bruc) - (Xb Yruc Zt) vlabel(bruct) - - (Xf Yllc Zb) vlabel(fllcb) - (Xf Yl Zlc) vlabel(fllc) - (Xf Yl Zuc) vlabel(fluc) - (Xf Yluc Zt) vlabel(fluct) - (Xf Yrlc Zb) vlabel(frlcb) - (Xf Yr Zlc) vlabel(frlc) - (Xf Yr Zuc) vlabel(fruc) - (Xf Yruc Zt) vlabel(fruct) -); - -blocks -( - // block0 - hex2D(llcb, rlcb, rlc, llc) - (Nb Nhlc Nl) - simpleGrading (1 1 1) - - // block1 - hex2D(llc, rlc, ruc, luc) - (Nb Nh Nl) - simpleGrading (1 1 1) - - // block2 - hex2D(luc, ruc, ruct, luct) - (Nb Nhuc Nl) - simpleGrading (1 1 1) -); - -patches -( - patch walls - ( - quad2D(llcb, rlcb) - quad2D(rlcb, rlc) - quad2D(rlc, ruc) - quad2D(ruc, ruct) - quad2D(ruct, luct) - quad2D(luct, luc) - quad2D(luc, llc) - quad2D(llc, llcb) - ) - - empty front - ( - frontQuad(llcb, rlcb, rlc, llc) - frontQuad(llc, rlc, ruc, luc) - frontQuad(luc, ruc, ruct, luct) - ) - - empty back - ( - backQuad(llcb, rlcb, rlc, llc) - backQuad(llc, rlc, ruc, luc) - backQuad(luc, ruc, ruct, luct) - ) -); - -// ************************************************************************* // diff --git a/tutorials/multiphase/interFoam/laminar/sloshingTank3D/Allrun b/tutorials/multiphase/interFoam/laminar/sloshingTank3D/Allrun index 855177f8b6..d7a2a8a76c 100755 --- a/tutorials/multiphase/interFoam/laminar/sloshingTank3D/Allrun +++ b/tutorials/multiphase/interFoam/laminar/sloshingTank3D/Allrun @@ -4,8 +4,7 @@ cd ${0%/*} || exit 1 # Run from this directory # Source tutorial run functions . $WM_PROJECT_DIR/bin/tools/RunFunctions -m4 system/blockMeshDict.m4 > system/blockMeshDict -runApplication blockMesh +runApplication blockMesh -dict $FOAM_TUTORIALS/resources/blockMesh/sloshingTank3D runApplication setFields runApplication $(getApplication) diff --git a/tutorials/multiphase/interFoam/laminar/sloshingTank3D/system/blockMeshDict.m4 b/tutorials/multiphase/interFoam/laminar/sloshingTank3D/system/blockMeshDict.m4 deleted file mode 100644 index 07e5c49572..0000000000 --- a/tutorials/multiphase/interFoam/laminar/sloshingTank3D/system/blockMeshDict.m4 +++ /dev/null @@ -1,137 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | Website: https://openfoam.org - \\ / A nd | Version: dev - \\/ M anipulation | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - `format' ascii; - class dictionary; - object blockMeshDict; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -// General m4 macros - -changecom(//)changequote([,]) dnl> -define(calc, [esyscmd(perl -e 'use Math::Trig; print ($1)')]) dnl> -define(VCOUNT, 0) -define(vlabel, [[// ]Vertex $1 = VCOUNT define($1, VCOUNT)define([VCOUNT], incr(VCOUNT))]) - -define(hex2D, hex (b$1 b$2 b$3 b$4 f$1 f$2 f$3 f$4)) -define(quad2D, (b$1 b$2 f$2 f$1)) -define(frontQuad, (f$1 f$2 f$3 f$4)) -define(backQuad, (b$1 b$4 b$3 b$2)) - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -// User-defined parameters - -convertToMeters 1; - -define(l, 20) // Length of tank (x-direction) -define(b, 40) // Breadth of tank (y-direction) -define(h, 30) // Depth of tank (z-direction) - -define(hlc, 5) // Depth to the top (height) of lower chamfer -define(huc, 10) // Height of upper chamfer - -define(thetalc, 45) // Angle of lower chamfer to the horizontal -define(thetauc, 45) // Angle of upper chamfer to the horizontal - -define(CofGy, calc(b/2.0)) // Centre of gravity in y-direction -define(CofGz, 10.0) // Centre of gravity in z-direction - -define(Nl, 19) // Number of cells in the length (1 for 2D) -define(Nb, 40) // Number of cells in the breadth -define(Nhlc, 6) // Number of cells in the height of the lower champfer -define(Nh, 16) // Number of cells in the height between the chamfers -define(Nhuc, 12) // Number of cells in the height of the upper champfer - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -// Derived parameters - -define(blc, calc(hlc/tan(deg2rad(thetalc)))) // Breadth to the top (height) of lower chamfer -define(buc, calc(huc/tan(deg2rad(thetauc)))) // Breadth of upper chamfer - -define(Yl, -CofGy) -define(Yllc, calc(Yl + blc)) -define(Yluc, calc(Yl + buc)) - -define(Yr, calc(Yl + b)) -define(Yrlc, calc(Yr - blc)) -define(Yruc, calc(Yr - buc)) - -define(Zb, -CofGz) -define(Zlc, calc(Zb + hlc)) -define(Zt, calc(Zb + h)) -define(Zuc, calc(Zt - huc)) - -define(Xf, calc(l/2.0)) -define(Xb, calc(Xf - l)) - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -// Parametric description - -vertices -( - (Xb Yllc Zb) vlabel(bllcb) - (Xb Yl Zlc) vlabel(bllc) - (Xb Yl Zuc) vlabel(bluc) - (Xb Yluc Zt) vlabel(bluct) - (Xb Yrlc Zb) vlabel(brlcb) - (Xb Yr Zlc) vlabel(brlc) - (Xb Yr Zuc) vlabel(bruc) - (Xb Yruc Zt) vlabel(bruct) - - (Xf Yllc Zb) vlabel(fllcb) - (Xf Yl Zlc) vlabel(fllc) - (Xf Yl Zuc) vlabel(fluc) - (Xf Yluc Zt) vlabel(fluct) - (Xf Yrlc Zb) vlabel(frlcb) - (Xf Yr Zlc) vlabel(frlc) - (Xf Yr Zuc) vlabel(fruc) - (Xf Yruc Zt) vlabel(fruct) -); - -blocks -( - // block0 - hex2D(llcb, rlcb, rlc, llc) - (Nb Nhlc Nl) - simpleGrading (1 1 1) - - // block1 - hex2D(llc, rlc, ruc, luc) - (Nb Nh Nl) - simpleGrading (1 1 1) - - // block2 - hex2D(luc, ruc, ruct, luct) - (Nb Nhuc Nl) - simpleGrading (1 1 1) -); - -patches -( - patch walls - ( - quad2D(llcb, rlcb) - quad2D(rlcb, rlc) - quad2D(rlc, ruc) - quad2D(ruc, ruct) - quad2D(ruct, luct) - quad2D(luct, luc) - quad2D(luc, llc) - quad2D(llc, llcb) - frontQuad(llcb, rlcb, rlc, llc) - frontQuad(llc, rlc, ruc, luc) - frontQuad(luc, ruc, ruct, luct) - backQuad(llcb, rlcb, rlc, llc) - backQuad(llc, rlc, ruc, luc) - backQuad(luc, ruc, ruct, luct) - ) -); - -// ************************************************************************* // diff --git a/tutorials/multiphase/interFoam/laminar/sloshingTank3D3DoF/Allrun b/tutorials/multiphase/interFoam/laminar/sloshingTank3D3DoF/Allrun index 855177f8b6..d7a2a8a76c 100755 --- a/tutorials/multiphase/interFoam/laminar/sloshingTank3D3DoF/Allrun +++ b/tutorials/multiphase/interFoam/laminar/sloshingTank3D3DoF/Allrun @@ -4,8 +4,7 @@ cd ${0%/*} || exit 1 # Run from this directory # Source tutorial run functions . $WM_PROJECT_DIR/bin/tools/RunFunctions -m4 system/blockMeshDict.m4 > system/blockMeshDict -runApplication blockMesh +runApplication blockMesh -dict $FOAM_TUTORIALS/resources/blockMesh/sloshingTank3D runApplication setFields runApplication $(getApplication) diff --git a/tutorials/multiphase/interFoam/laminar/sloshingTank3D3DoF/system/blockMeshDict.m4 b/tutorials/multiphase/interFoam/laminar/sloshingTank3D3DoF/system/blockMeshDict.m4 deleted file mode 100644 index 07e5c49572..0000000000 --- a/tutorials/multiphase/interFoam/laminar/sloshingTank3D3DoF/system/blockMeshDict.m4 +++ /dev/null @@ -1,137 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | Website: https://openfoam.org - \\ / A nd | Version: dev - \\/ M anipulation | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - `format' ascii; - class dictionary; - object blockMeshDict; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -// General m4 macros - -changecom(//)changequote([,]) dnl> -define(calc, [esyscmd(perl -e 'use Math::Trig; print ($1)')]) dnl> -define(VCOUNT, 0) -define(vlabel, [[// ]Vertex $1 = VCOUNT define($1, VCOUNT)define([VCOUNT], incr(VCOUNT))]) - -define(hex2D, hex (b$1 b$2 b$3 b$4 f$1 f$2 f$3 f$4)) -define(quad2D, (b$1 b$2 f$2 f$1)) -define(frontQuad, (f$1 f$2 f$3 f$4)) -define(backQuad, (b$1 b$4 b$3 b$2)) - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -// User-defined parameters - -convertToMeters 1; - -define(l, 20) // Length of tank (x-direction) -define(b, 40) // Breadth of tank (y-direction) -define(h, 30) // Depth of tank (z-direction) - -define(hlc, 5) // Depth to the top (height) of lower chamfer -define(huc, 10) // Height of upper chamfer - -define(thetalc, 45) // Angle of lower chamfer to the horizontal -define(thetauc, 45) // Angle of upper chamfer to the horizontal - -define(CofGy, calc(b/2.0)) // Centre of gravity in y-direction -define(CofGz, 10.0) // Centre of gravity in z-direction - -define(Nl, 19) // Number of cells in the length (1 for 2D) -define(Nb, 40) // Number of cells in the breadth -define(Nhlc, 6) // Number of cells in the height of the lower champfer -define(Nh, 16) // Number of cells in the height between the chamfers -define(Nhuc, 12) // Number of cells in the height of the upper champfer - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -// Derived parameters - -define(blc, calc(hlc/tan(deg2rad(thetalc)))) // Breadth to the top (height) of lower chamfer -define(buc, calc(huc/tan(deg2rad(thetauc)))) // Breadth of upper chamfer - -define(Yl, -CofGy) -define(Yllc, calc(Yl + blc)) -define(Yluc, calc(Yl + buc)) - -define(Yr, calc(Yl + b)) -define(Yrlc, calc(Yr - blc)) -define(Yruc, calc(Yr - buc)) - -define(Zb, -CofGz) -define(Zlc, calc(Zb + hlc)) -define(Zt, calc(Zb + h)) -define(Zuc, calc(Zt - huc)) - -define(Xf, calc(l/2.0)) -define(Xb, calc(Xf - l)) - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -// Parametric description - -vertices -( - (Xb Yllc Zb) vlabel(bllcb) - (Xb Yl Zlc) vlabel(bllc) - (Xb Yl Zuc) vlabel(bluc) - (Xb Yluc Zt) vlabel(bluct) - (Xb Yrlc Zb) vlabel(brlcb) - (Xb Yr Zlc) vlabel(brlc) - (Xb Yr Zuc) vlabel(bruc) - (Xb Yruc Zt) vlabel(bruct) - - (Xf Yllc Zb) vlabel(fllcb) - (Xf Yl Zlc) vlabel(fllc) - (Xf Yl Zuc) vlabel(fluc) - (Xf Yluc Zt) vlabel(fluct) - (Xf Yrlc Zb) vlabel(frlcb) - (Xf Yr Zlc) vlabel(frlc) - (Xf Yr Zuc) vlabel(fruc) - (Xf Yruc Zt) vlabel(fruct) -); - -blocks -( - // block0 - hex2D(llcb, rlcb, rlc, llc) - (Nb Nhlc Nl) - simpleGrading (1 1 1) - - // block1 - hex2D(llc, rlc, ruc, luc) - (Nb Nh Nl) - simpleGrading (1 1 1) - - // block2 - hex2D(luc, ruc, ruct, luct) - (Nb Nhuc Nl) - simpleGrading (1 1 1) -); - -patches -( - patch walls - ( - quad2D(llcb, rlcb) - quad2D(rlcb, rlc) - quad2D(rlc, ruc) - quad2D(ruc, ruct) - quad2D(ruct, luct) - quad2D(luct, luc) - quad2D(luc, llc) - quad2D(llc, llcb) - frontQuad(llcb, rlcb, rlc, llc) - frontQuad(llc, rlc, ruc, luc) - frontQuad(luc, ruc, ruct, luct) - backQuad(llcb, rlcb, rlc, llc) - backQuad(llc, rlc, ruc, luc) - backQuad(luc, ruc, ruct, luct) - ) -); - -// ************************************************************************* // diff --git a/tutorials/multiphase/interFoam/laminar/sloshingTank3D6DoF/Allrun b/tutorials/multiphase/interFoam/laminar/sloshingTank3D6DoF/Allrun index 855177f8b6..d7a2a8a76c 100755 --- a/tutorials/multiphase/interFoam/laminar/sloshingTank3D6DoF/Allrun +++ b/tutorials/multiphase/interFoam/laminar/sloshingTank3D6DoF/Allrun @@ -4,8 +4,7 @@ cd ${0%/*} || exit 1 # Run from this directory # Source tutorial run functions . $WM_PROJECT_DIR/bin/tools/RunFunctions -m4 system/blockMeshDict.m4 > system/blockMeshDict -runApplication blockMesh +runApplication blockMesh -dict $FOAM_TUTORIALS/resources/blockMesh/sloshingTank3D runApplication setFields runApplication $(getApplication) diff --git a/tutorials/multiphase/interFoam/laminar/sloshingTank3D6DoF/system/blockMeshDict.m4 b/tutorials/multiphase/interFoam/laminar/sloshingTank3D6DoF/system/blockMeshDict.m4 deleted file mode 100644 index 07e5c49572..0000000000 --- a/tutorials/multiphase/interFoam/laminar/sloshingTank3D6DoF/system/blockMeshDict.m4 +++ /dev/null @@ -1,137 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | Website: https://openfoam.org - \\ / A nd | Version: dev - \\/ M anipulation | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - `format' ascii; - class dictionary; - object blockMeshDict; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -// General m4 macros - -changecom(//)changequote([,]) dnl> -define(calc, [esyscmd(perl -e 'use Math::Trig; print ($1)')]) dnl> -define(VCOUNT, 0) -define(vlabel, [[// ]Vertex $1 = VCOUNT define($1, VCOUNT)define([VCOUNT], incr(VCOUNT))]) - -define(hex2D, hex (b$1 b$2 b$3 b$4 f$1 f$2 f$3 f$4)) -define(quad2D, (b$1 b$2 f$2 f$1)) -define(frontQuad, (f$1 f$2 f$3 f$4)) -define(backQuad, (b$1 b$4 b$3 b$2)) - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -// User-defined parameters - -convertToMeters 1; - -define(l, 20) // Length of tank (x-direction) -define(b, 40) // Breadth of tank (y-direction) -define(h, 30) // Depth of tank (z-direction) - -define(hlc, 5) // Depth to the top (height) of lower chamfer -define(huc, 10) // Height of upper chamfer - -define(thetalc, 45) // Angle of lower chamfer to the horizontal -define(thetauc, 45) // Angle of upper chamfer to the horizontal - -define(CofGy, calc(b/2.0)) // Centre of gravity in y-direction -define(CofGz, 10.0) // Centre of gravity in z-direction - -define(Nl, 19) // Number of cells in the length (1 for 2D) -define(Nb, 40) // Number of cells in the breadth -define(Nhlc, 6) // Number of cells in the height of the lower champfer -define(Nh, 16) // Number of cells in the height between the chamfers -define(Nhuc, 12) // Number of cells in the height of the upper champfer - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -// Derived parameters - -define(blc, calc(hlc/tan(deg2rad(thetalc)))) // Breadth to the top (height) of lower chamfer -define(buc, calc(huc/tan(deg2rad(thetauc)))) // Breadth of upper chamfer - -define(Yl, -CofGy) -define(Yllc, calc(Yl + blc)) -define(Yluc, calc(Yl + buc)) - -define(Yr, calc(Yl + b)) -define(Yrlc, calc(Yr - blc)) -define(Yruc, calc(Yr - buc)) - -define(Zb, -CofGz) -define(Zlc, calc(Zb + hlc)) -define(Zt, calc(Zb + h)) -define(Zuc, calc(Zt - huc)) - -define(Xf, calc(l/2.0)) -define(Xb, calc(Xf - l)) - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -// Parametric description - -vertices -( - (Xb Yllc Zb) vlabel(bllcb) - (Xb Yl Zlc) vlabel(bllc) - (Xb Yl Zuc) vlabel(bluc) - (Xb Yluc Zt) vlabel(bluct) - (Xb Yrlc Zb) vlabel(brlcb) - (Xb Yr Zlc) vlabel(brlc) - (Xb Yr Zuc) vlabel(bruc) - (Xb Yruc Zt) vlabel(bruct) - - (Xf Yllc Zb) vlabel(fllcb) - (Xf Yl Zlc) vlabel(fllc) - (Xf Yl Zuc) vlabel(fluc) - (Xf Yluc Zt) vlabel(fluct) - (Xf Yrlc Zb) vlabel(frlcb) - (Xf Yr Zlc) vlabel(frlc) - (Xf Yr Zuc) vlabel(fruc) - (Xf Yruc Zt) vlabel(fruct) -); - -blocks -( - // block0 - hex2D(llcb, rlcb, rlc, llc) - (Nb Nhlc Nl) - simpleGrading (1 1 1) - - // block1 - hex2D(llc, rlc, ruc, luc) - (Nb Nh Nl) - simpleGrading (1 1 1) - - // block2 - hex2D(luc, ruc, ruct, luct) - (Nb Nhuc Nl) - simpleGrading (1 1 1) -); - -patches -( - patch walls - ( - quad2D(llcb, rlcb) - quad2D(rlcb, rlc) - quad2D(rlc, ruc) - quad2D(ruc, ruct) - quad2D(ruct, luct) - quad2D(luct, luc) - quad2D(luc, llc) - quad2D(llc, llcb) - frontQuad(llcb, rlcb, rlc, llc) - frontQuad(llc, rlc, ruc, luc) - frontQuad(luc, ruc, ruct, luct) - backQuad(llcb, rlcb, rlc, llc) - backQuad(llc, rlc, ruc, luc) - backQuad(luc, ruc, ruct, luct) - ) -); - -// ************************************************************************* // diff --git a/tutorials/resources/blockMesh/sloshingTank2D b/tutorials/resources/blockMesh/sloshingTank2D new file mode 100644 index 0000000000..54c5482f77 --- /dev/null +++ b/tutorials/resources/blockMesh/sloshingTank2D @@ -0,0 +1,125 @@ +/*--------------------------------*- C++ -*----------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Version: dev + \\/ M anipulation | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object blockMeshDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +convertToMeters 1; + +depth 1; // Depth of tank (x-direction) +width 40; // Width of tank (y-direction) +height 30; // Depth of tank (z-direction) + +lowerHeight 5; // Height to the top of lower chamfer +upperHeight 10; // Height of upper chamfer + +angleLower 45; // Angle of lower chamfer to the horizontal +angleUpper 45; // Angle of upper chamfer to the horizontal +moveZ -10; // Moving tank in z direction + +xCells 1; // Number of cells in the depth +yCells 40; // Number of cells in the width +zLowCells 6; // Number of cells in the height of the lower champfer +zMidCells 16; // Number of cells in the height between the chamfers +zUpCells 12; // Number of cells in the height of the upper champfer + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +vertices #codeStream +{ + codeInclude + #{ + #include "pointField.H" + #}; + + code + #{ + const scalar halfDepth = ($depth)/2.0; + const scalar halfWidth = ($width)/2.0; + + const scalar yBottom = + halfWidth - ($lowerHeight)/tan(degToRad($angleLower)); + const scalar yTop = + halfWidth - ($upperHeight)/tan(degToRad($angleUpper)); + + const scalar zMid = $height - $upperHeight; + + pointField points + ({ + point(-halfDepth, -yBottom, 0), // pt 0 + point(-halfDepth, -halfWidth, $lowerHeight), // pt 1 + point(-halfDepth, -halfWidth, zMid), // pt 2 + point(-halfDepth, -yTop, $height), // pt 3 + }); + + // Move points in z direction + points += vector(0, 0, $moveZ); + + // Duplicate y points + points.append(cmptMultiply(points, vector(1, -1, 1))); + + // Duplicate x points + points.append(cmptMultiply(points, vector(-1, 1, 1))); + + os << points; + #}; +}; + +blocks +( + hex (0 8 12 4 1 9 13 5) ($xCells $yCells $zLowCells) simpleGrading (1 1 1) + hex (1 9 13 5 2 10 14 6) ($xCells $yCells $zMidCells) simpleGrading (1 1 1) + hex (2 10 14 6 3 11 15 7) ($xCells $yCells $zUpCells) simpleGrading (1 1 1) +); + +boundary +( + walls + { + type wall; + faces + ( + (0 4 12 8) + (4 5 13 12) + (5 6 14 13) + (6 7 15 14) + (7 3 11 15) + (3 2 10 11) + (2 1 9 10) + (1 0 8 9) + ); + } + + front + { + type empty; + faces + ( + (8 12 13 9) + (9 13 14 10) + (10 14 15 11) + ); + } + + back + { + type empty; + faces + ( + (0 1 5 4) + (1 2 6 5) + (2 3 7 6) + ); + } +); + +// ************************************************************************* // diff --git a/tutorials/resources/blockMesh/sloshingTank3D b/tutorials/resources/blockMesh/sloshingTank3D new file mode 100644 index 0000000000..522957da36 --- /dev/null +++ b/tutorials/resources/blockMesh/sloshingTank3D @@ -0,0 +1,109 @@ +/*--------------------------------*- C++ -*----------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Version: dev + \\/ M anipulation | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object blockMeshDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +convertToMeters 1; + +depth 20; // Depth of tank (x-direction) +width 40; // Width of tank (y-direction) +height 30; // Depth of tank (z-direction) + +lowerHeight 5; // Height to the top of lower chamfer +upperHeight 10; // Height of upper chamfer + +angleLower 45; // Angle of lower chamfer to the horizontal +angleUpper 45; // Angle of upper chamfer to the horizontal +moveZ -10; // Moving tank in z direction + +xCells 19; // Number of cells in the depth +yCells 40; // Number of cells in the width +zLowCells 6; // Number of cells in the height of the lower champfer +zMidCells 16; // Number of cells in the height between the chamfers +zUpCells 12; // Number of cells in the height of the upper champfer + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +vertices #codeStream +{ + codeInclude + #{ + #include "pointField.H" + #}; + + code + #{ + const scalar halfDepth = ($depth)/2.0; + const scalar halfWidth = ($width)/2.0; + + const scalar yBottom = + halfWidth - ($lowerHeight)/tan(degToRad($angleLower)); + const scalar yTop = + halfWidth - ($upperHeight)/tan(degToRad($angleUpper)); + + const scalar zMid = $height - $upperHeight; + + pointField points + ({ + point(-halfDepth, -yBottom, 0), // pt 0 + point(-halfDepth, -halfWidth, $lowerHeight), // pt 1 + point(-halfDepth, -halfWidth, zMid), // pt 2 + point(-halfDepth, -yTop, $height), // pt 3 + }); + + // Move points in z direction + points += vector(0, 0, $moveZ); + + // Duplicate y points + points.append(cmptMultiply(points, vector(1, -1, 1))); + + // Duplicate x points + points.append(cmptMultiply(points, vector(-1, 1, 1))); + + os << points; + #}; +}; + +blocks +( + hex (0 8 12 4 1 9 13 5) ($xCells $yCells $zLowCells) simpleGrading (1 1 1) + hex (1 9 13 5 2 10 14 6) ($xCells $yCells $zMidCells) simpleGrading (1 1 1) + hex (2 10 14 6 3 11 15 7) ($xCells $yCells $zUpCells) simpleGrading (1 1 1) +); + +boundary +( + walls + { + type wall; + faces + ( + (0 4 12 8) + (4 5 13 12) + (5 6 14 13) + (6 7 15 14) + (7 3 11 15) + (3 2 10 11) + (2 1 9 10) + (1 0 8 9) + (8 12 13 9) + (9 13 14 10) + (10 14 15 11) + (0 1 5 4) + (1 2 6 5) + (2 3 7 6) + ); + } +); + +// ************************************************************************* //