From 3e88587e0bee1ec37b16a27e2ab137b5140d21b8 Mon Sep 17 00:00:00 2001 From: Amirhossein Taran Date: Fri, 16 Oct 2026 18:46:56 +0100 Subject: [PATCH 1/2] Fix bubbleColumn setup: circular bubble via setAlphaField, closed box with fixedFluxPressure --- Tutorial/bubbleColumn/0.orig/U | 2 +- Tutorial/bubbleColumn/0.orig/alpha.water | 2 +- Tutorial/bubbleColumn/0.orig/p_rgh | 14 ++-------- Tutorial/bubbleColumn/Allrun | 2 +- Tutorial/bubbleColumn/system/blockMeshDict | 4 +-- Tutorial/bubbleColumn/system/fvSolution | 2 ++ .../{setFieldsDict => setAlphaFieldDict} | 28 +++++++------------ 7 files changed, 19 insertions(+), 35 deletions(-) rename Tutorial/bubbleColumn/system/{setFieldsDict => setAlphaFieldDict} (65%) mode change 100755 => 100644 diff --git a/Tutorial/bubbleColumn/0.orig/U b/Tutorial/bubbleColumn/0.orig/U index 2ce48bd..9d682a1 100755 --- a/Tutorial/bubbleColumn/0.orig/U +++ b/Tutorial/bubbleColumn/0.orig/U @@ -26,7 +26,7 @@ boundaryField type fixedValue; value uniform (0 0 0); } - outlet + top { type fixedValue; value uniform (0 0 0); diff --git a/Tutorial/bubbleColumn/0.orig/alpha.water b/Tutorial/bubbleColumn/0.orig/alpha.water index 39985d5..e015d9c 100755 --- a/Tutorial/bubbleColumn/0.orig/alpha.water +++ b/Tutorial/bubbleColumn/0.orig/alpha.water @@ -25,7 +25,7 @@ boundaryField type zeroGradient; } - outlet + top { type zeroGradient; } diff --git a/Tutorial/bubbleColumn/0.orig/p_rgh b/Tutorial/bubbleColumn/0.orig/p_rgh index 94327b2..9edd71a 100755 --- a/Tutorial/bubbleColumn/0.orig/p_rgh +++ b/Tutorial/bubbleColumn/0.orig/p_rgh @@ -20,22 +20,12 @@ internalField uniform 0; boundaryField { - bottom + "(bottom|top|walls)" { - type zeroGradient; - } - - outlet - { - type fixedValue; + type fixedFluxPressure; value uniform 0; } - walls - { - type zeroGradient; - } - defaultFaces { type empty; diff --git a/Tutorial/bubbleColumn/Allrun b/Tutorial/bubbleColumn/Allrun index bffc988..7a71a7e 100755 --- a/Tutorial/bubbleColumn/Allrun +++ b/Tutorial/bubbleColumn/Allrun @@ -7,7 +7,7 @@ cd "${0%/*}" || exit # Run from this directory restore0Dir runApplication blockMesh -runApplication setFields +runApplication setAlphaField runApplication $(getApplication) #------------------------------------------------------------------------------ diff --git a/Tutorial/bubbleColumn/system/blockMeshDict b/Tutorial/bubbleColumn/system/blockMeshDict index c0aeb56..162393a 100755 --- a/Tutorial/bubbleColumn/system/blockMeshDict +++ b/Tutorial/bubbleColumn/system/blockMeshDict @@ -47,9 +47,9 @@ boundary (1 5 4 0) ); } - outlet + top { - type patch; + type wall; faces ( (3 7 6 2) diff --git a/Tutorial/bubbleColumn/system/fvSolution b/Tutorial/bubbleColumn/system/fvSolution index b45c3f2..c916f7a 100755 --- a/Tutorial/bubbleColumn/system/fvSolution +++ b/Tutorial/bubbleColumn/system/fvSolution @@ -70,6 +70,8 @@ PIMPLE nOuterCorrectors 1; nCorrectors 3; nNonOrthogonalCorrectors 0; + pRefCell 0; + pRefValue 0; } relaxationFactors diff --git a/Tutorial/bubbleColumn/system/setFieldsDict b/Tutorial/bubbleColumn/system/setAlphaFieldDict old mode 100755 new mode 100644 similarity index 65% rename from Tutorial/bubbleColumn/system/setFieldsDict rename to Tutorial/bubbleColumn/system/setAlphaFieldDict index 0503c26..dec64fd --- a/Tutorial/bubbleColumn/system/setFieldsDict +++ b/Tutorial/bubbleColumn/system/setAlphaFieldDict @@ -11,28 +11,20 @@ FoamFile format ascii; class dictionary; location "system"; - object setFieldsDict; + object setAlphaFieldDict; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -defaultFieldValues -( - volScalarFieldValue alpha.water 1 -); +// Circular bubble of radius 0.25 centred at (0.5, 0.5), Hysing et al. (2009). +// setAlphaField integrates the volume fraction exactly in each cut cell, so +// the initial bubble area is pi*0.25^2 instead of a stair-cased cell set. -regions -( - cylinderToCell - { - p1 (0.25 0.5 -1); - p2 (0.75 0.5 1); - radius 0.25; +field alpha.water; +type cylinder; +origin (0.5 0.5 0); +direction (0 0 1); +radius 0.25; +invert true; // alpha.water = 0 inside the bubble, 1 outside - fieldValues - ( - volScalarFieldValue alpha.water 0 - ); - } -); // ************************************************************************* // From f7d11d96311b341bc1f2ee9ee80f0106e9ae7ed6 Mon Sep 17 00:00:00 2001 From: Amirhossein Taran Date: Fri, 16 Oct 2026 19:15:17 +0100 Subject: [PATCH 2/2] Update README benchmark numbers for the corrected tutorial setup --- README.md | 47 +++++++++++++++++++++++++++++------------------ 1 file changed, 29 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 63f8d35..8f454e0 100644 --- a/README.md +++ b/README.md @@ -68,32 +68,43 @@ Tested with OpenFOAM.com v2306, v2312 (CI), v2512 (CI) and v2606. ## Tutorial: 2-D rising bubble -`Tutorial/bubbleColumn` is test case 2 of Hysing et al. (2009): -ρ1/ρ2 = 1000, μ1/μ2 = 100, σ = 1.96, g = 0.98. The case writes the bubble's -centre of mass and its mean rise velocity at every time step, to -`postProcessing/bubble/0/volFieldValue.dat`. +`Tutorial/bubbleColumn` is test case 2 of Hysing et al. (2009). A circular +bubble of radius 0.25 starts at (0.5, 0.5) in a closed 1 × 2 box, with +ρ1/ρ2 = 1000, μ1/μ2 = 100, σ = 1.96 and g = 0.98. +- The bubble is set with `setAlphaField`, which integrates the volume fraction + in each cut cell. +- The top and bottom walls are no-slip, the side walls are free-slip, and + p_rgh is `fixedFluxPressure` on all walls. +- The case writes the bubble's centre of mass and mean rise velocity at every + time step, to `postProcessing/bubble/0/volFieldValue.dat`. ```bash cd Tutorial/bubbleColumn && ./Allrun ``` -Benchmark results below were run with OpenFOAM v2606 and `cAlpha 1`. The -1/h = 160 run is the tutorial as shipped, on 4 MPI ranks. The 1/h = 80 runs use -`(80 160 1)` cells and `deltaT 7.8125e-4`. The reference is TP2D from Hysing -et al. (2009), Table XIII. +The results below were run with OpenFOAM v2606. The 1/h = 160 runs are the +tutorial as shipped, on 4 MPI ranks. The 1/h = 80 runs use `(80 160 1)` cells +and `deltaT 7.8125e-4`. The reference is TP2D on its finest mesh, from Hysing +et al. (2009), Tables XIII and XVI. | Run | Vmax,1 (t) | Vmax,2 (t) | yc(t = 3) | |---|---|---|---| -| TP2D, 1/h = 80 | 0.2638 (0.725) | 0.2597 (1.969) | 1.1370 | -| TP2D, 1/h = 160 | 0.2570 (0.743) | 0.2522 (2.023) | 1.1377 | -| TP2D, 1/h = 640 | 0.2524 (0.733) | 0.2434 (2.071) | 1.1380 | -| this solver, 1/h = 80, level-set coupling (default) | 0.2450 (0.753) | 0.2274 (1.904) | 1.1085 | -| this solver, 1/h = 80, `curvatureFrom`/`propertiesFrom volumeFraction` | 0.2445 (0.750) | 0.2267 (1.910) | 1.1046 | -| this solver, 1/h = 160, level-set coupling (default) | 0.2415 (0.756) | 0.2299 (1.985) | 1.1099 | - -The phase volume is conserved to all printed digits. The first rise-velocity -peak is about 6% below TP2D, and refining from 1/h = 80 to 160 does not close -that gap. +| TP2D, 1/h = 640 (reference) | 0.2524 (0.733) | 0.2434 (2.071) | 1.1380 | +| FreeLIFE, 1/h = 160 | 0.2514 (0.728) | 0.2440 (1.984) | 1.1249 | +| MooNMD | 0.2502 (0.732) | 0.2393 (2.060) | 1.1376 | +| this solver, 1/h = 80 | 0.2491 (0.734) | 0.2287 (1.913) | 1.1140 | +| this solver, 1/h = 160 | 0.2472 (0.738) | 0.2315 (1.982) | 1.1174 | +| volume-fraction coupling, 1/h = 160 | 0.2471 (0.734) | 0.2309 (2.001) | 1.1140 | + +The phase volume is conserved to all printed digits. +- With `curvatureFrom` and `propertiesFrom` set to `volumeFraction`, the solver + reproduces `interFoam`. +- The level-set coupling follows the reference more closely than that setting + after the first maximum. + +Results published for this tutorial before the setup fix (PR #4) came from a +tilted, 3% oversized initial bubble and a top boundary that let fluid through. +They should not be used. ## References