Guided Tutorials Split
Guided Tutorials Split
• Guided tutorial 4. Surface tension driven flow – Bubble in zero gravity. VOF
Small scale.
• This case is ready to run.
• The case is located in the directory:
$TM/multiphase/guided_tutorials/GT4/
• In the case directory, you will find a few scripts with the extension .sh, namely, run_all.sh, run_mesh.sh,
run_sampling.sh, run_solver.sh, and so on.
• These scripts can be used to run the case automatically by typing in the terminal, for example,
• $> sh run_solver
• These scripts are human-readable, and we highly recommend you open them, get familiar with the steps, and type the
commands in the terminal. In this way, you will get used with the command line interface and OpenFOAM commands.
• If you are already comfortable with OpenFOAM, run the cases automatically using these scripts.
• In the case directory, you will also find the README.FIRST file. In this file, you will find some additional comments.
GT-60
Guided tutorials
Guided tutorial 4
• According to you, what will happen to a perfect circular bubble, in perfect equilibrium, in zero
gravity, with no perturbations and with given surface tension?
GT-61
Guided tutorials
Guided tutorial 4
http://www.wolfdynamics.com/training/mphase/image36.gif
• In reality, nothing should happen but due to the mesh, numerical diffusion, and discretization
errors the bubble wobbles a little bit.
GT-62
Guided tutorials
Guided tutorial 4
• According to you, what will happen to this elliptical bubble in zero gravity, with no perturbations
and no surface tension?
GT-63
Guided tutorials
Guided tutorial 4
• According to you, what will happen to this elliptical bubble in zero gravity, with no perturbations
and with given surface tension?
GT-64
Guided tutorials
Guided tutorial 4
http://www.wolfdynamics.com/training/mphase/image37.gif
GT-66
Guided tutorials
Guided tutorial 4
GT-67
Guided tutorials
Guided tutorial 4
• We set the boundary and initial conditions for the alpha scalar field (volume of fraction) in the
dictionary alpha.water.
• The dictionary alpha.water.org is a backup of the original dictionary as it will be overwritten
when we initialize the fields.
• Remember, the name of the base type boundary condition (dictionary
constant/polyMesh/boundary) and the name of the numerical type boundary condition
(dictionaries located in the directory 0) need to be the same, if not, OpenFOAM will complain.
• Also, the base type and numerical type boundary conditions need to be consistent.
GT-68
Guided tutorials
Guided tutorial 4
• Finally, we set the run-time parameter, numerical method and linear solvers.
• Go to the directory system and open the following dictionaries:
• controlDict: in this dictionary we set general run-time parameters and function
objects.
• fvSchemes: in this dictionary we set the discretization method.
• fvSolution: in this dictionary we set the linear solvers and parameters specific of
the pressure-velocity coupling method.
• Do not worry, later on we are going to study in more details the dictionaries fvSchemes and
fvSolution.
GT-69
Guided tutorials
Guided tutorial 4
• Before proceeding to the simulation stage, we need to do a custom initialization of the fields.
• Go to the directory system and open the following dictionary:
• setFieldsDict.ellipse we use this dictionary for custom initialization of the
fields using a STL file
GT-70
Guided tutorials
Guided tutorial 4
1. $> run_all.sh
• Feel free to open the file run_all.sh to see all the commands used.
• If you prefer to run the case manually, type the commands in the terminal window.
GT-71
Guided tutorials
$TM/multiphase/guided_tutorials/GT5/
• In the case directory, you will find a few scripts with the extension .sh, namely, run_all.sh, run_mesh.sh,
run_sampling.sh, run_solver.sh, and so on.
• These scripts can be used to run the case automatically by typing in the terminal, for example,
• $> sh run_solver
• These scripts are human-readable, and we highly recommend you open them, get familiar with the steps, and type the
commands in the terminal. In this way, you will get used with the command line interface and OpenFOAM commands.
• If you are already comfortable with OpenFOAM, run the cases automatically using these scripts.
• In the case directory, you will also find the README.FIRST file. In this file, you will find some additional comments.
GT-72
Guided tutorials
Guided tutorial 5
References:
• http://www.featflow.de/en/benchmarks/cfdbenchmarking/bubble.html
• Klostermann, J.; Schaake, K.; Schwarze, R.: Numerical simulation of a single rising bubble by VOF with
surface compression, International Journal for Numerical Methods in Fluids, DOI: 10.1002/fld.3692
GT-73
Guided tutorials
Guided tutorial 5
http://www.wolfdynamics.com/training/mphase/image38.gif
References:
• http://www.featflow.de/en/benchmarks/cfdbenchmarking/bubble.html
• Klostermann, J.; Schaake, K.; Schwarze, R.: Numerical simulation of a single rising bubble by VOF with
surface compression, International Journal for Numerical Methods in Fluids, DOI: 10.1002/fld.3692
GT-74
Guided tutorials
Guided tutorial 5
References:
• http://www.featflow.de/en/benchmarks/cfdbenchmarking/bubble.html
• Klostermann, J.; Schaake, K.; Schwarze, R.: Numerical simulation of a single rising bubble by VOF with surface compression,
International Journal for Numerical Methods in Fluids, DOI: 10.1002/fld.3692 GT-75
Guided tutorials
Guided tutorial 5
• In the folder system/default, you will find the case default setup.
• All the cases were run in parallel using 4 processors.
GT-76
Guided tutorials
Guided tutorial 5
ddtSchemes
{
default CrankNicolson 0;
}
GT-77
Guided tutorials
Guided tutorial 5
ddtSchemes
{
default none;
ddt(alpha) CrankNicolson 0.8;
ddt(rho,U) CrankNicolson 0.8;
ddt(U) CrankNicolson 0.8;
}
GT-78
Guided tutorials
Guided tutorial 5
gradSchemes
{
default Gauss linear;
}
GT-79
Guided tutorials
Guided tutorial 5
gradSchemes
{
default Gauss linear;
grad(U) cellMDLimited Gauss linear 0.5;
grad(alpha.phase1) cellLimited Gauss linear 1
grad(alpha.phase2) faceLimited Gauss linear 1
}
GT-80
Guided tutorials
Guided tutorial 5
• If you set all the grad terms using the default option, you might get strange interface resolution.
• The difference in the results, is related to the term nHat (face unit interface normal), which should be
discretize with no slope limiters.
gradSchemes
{
default cellLimited Gauss linear 1;
}
gradSchemes
{
default cellLimited Gauss linear 1;
nHat Gauss linear;
}
GT-81
Guided tutorials
Guided tutorial 5
• The difference in the results is related to the term nHat (face unit interface normal), which
should be discretize with no slope limiters if you want to get a smooth interface.
GT-82
Guided tutorials
Guided tutorial 5
divSchemes
{
div(rhoPhi,U) Gauss linearUpwind grad(U);
div(phi,alpha) Gauss interfaceCompression vanLeer 1;
div(((rho*nuEff)*dev2(T(grad(U))))) Gauss linear;
}
GT-83
Guided tutorials
Guided tutorial 5
laplacianSchemes
{
default Gauss linear limited 1;
}
GT-84
Guided tutorials
Guided tutorial 5
GT-85
Guided tutorials
Guided tutorial 5
GT-86
Guided tutorials
Guided tutorial 5
“alpha.phase1.*”
{
nAlphaCorr 2;
nAlphaSubCycles 1;
cAlpha 1;
MULESCorr yes;
nLimiterIter 3;
solver smoothSolver;
smoother symGaussSeidel;
tolerance 1e-8;
relTol 0;
}
GT-87
Guided tutorials
Guided tutorial 5
GT-88
Guided tutorials
Guided tutorial 5
cAlpha 1; cAlpha 1;
MULESCorr yes; (semi-implicit formulation) MULESCorr no; (explicit formulation)
Execution time = 75 seconds Execution time = 65 seconds
GT-89
Guided tutorials
Guided tutorial 5
p_rghFinal
{
solver PCG;
preconditioner DIC;
tolerance 1e-08;
relTol 0.05;
}
• The entry p_rghFinal is related to the last iteration of p_rgh. Remember, is a good idea to put
more computational effort on this iteration, and advance fast the inner iterations.
GT-90
Guided tutorials
Guided tutorial 5
unbounded bounded
• Comparison of multigrid vs. Newton-Krylov solvers and preconditioners for p_rgh and p_rghFinal
solver PCG; (p_rgh and p_rghFinal) solver GAMG; (p_rgh and p_rghFinal)
preconditioner DIC; (p_rgh and p_rghFinal) Execution time = 73 seconds
Execution time = 72 seconds
GT-92
Guided tutorials
Guided tutorial 5
• Comparison of multigrid vs. Newton-Krylov solvers and preconditioners for p_rgh and p_rghFinal
solver PCG; (p_rgh and p_rghFinal) solver PCG; (p_rgh and p_rghFinal)
preconditioner DIC; (p_rgh and p_rghFinal) preconditioner GAMG; (p_rgh)
Execution time = 72 seconds preconditioner GAMG; (p_rghFinal)
Execution time = 75 seconds
GT-93
Guided tutorials
Guided tutorial 5
• Let us study some additional entries that appears in the dictionary files fvSolution,
fvSchemes and controlDict.
• We will see the influence of many other parameters, such as:
• momentumPredictor
• maxCo
• maxAlphaCo
• maxDeltaT
• writeControl
• adjustTimeStep
• deltaT
GT-94
Guided tutorials
Guided tutorial 5
• Parameter → momentumPredictor
• Dictionary file → fvSolution
GT-95
Guided tutorials
Guided tutorial 5
• Parameter → writeControl
• Dictionary file → controlDict Note: this behavior is stronger at
CFL numbers larger than one.
maxCo 2; maxCo 2;
maxAlphaCo 2; maxAlphaCo 2;
maxDeltaT 0.1; maxDeltaT 0.1;
writeControl adjustableRunTime; writeControl runTime;
writeInterval 0.01; writeInterval 0.01;
MULESCorr yes; MULESCorr yes;
GT-97
Guided tutorials
Guided tutorial 5
• Parameter → writeControl
• Dictionary file → controlDict Note: for some reason, the left case
diverges but the main problem here
is the use of the explicit scheme.
DIVERGES
• Remember MULESCorr set to no
is equivalent to use an explicit
scheme.
maxCo 2; maxCo 2;
maxAlphaCo 2; maxAlphaCo 2;
maxDeltaT 0.1; maxDeltaT 0.1;
writeControl runTime; writeControl adjustableRunTime;
writeInterval 0.01; writeInterval 0.01;
MULESCorr no; MULESCorr no;
Execution time = 25 seconds Execution time = 25 seconds GT-98
Guided tutorials
Guided tutorial 5
• Parameter → MULESCorr
• Dictionary file → fvSolution
maxCo 2; maxCo 2;
maxAlphaCo 2; maxAlphaCo 2;
maxDeltaT 0.1; maxDeltaT 0.1;
MULESCorr yes; MULESCorr no;
Execution time = 31 seconds Execution time = 25 seconds
GT-99
Guided tutorials
Guided tutorial 5
• Parameter → adjustTimeStep
• Dictionary file → controlDict
GT-101
Guided tutorials
Guided tutorial 5
• The following modified convective equation (alpha) is used to track the interface between the
phases,
GT-102
Guided tutorials
Guided tutorial 5
GT-103
Guided tutorials
Guided tutorial 5
or
GT-104
Guided tutorials
Guided tutorial 5
“alpha.*”
{
MULESCorr yes; Turn on/off semi-implicit MULES
nAlphaSubCycles 1; For semi-implicit MULES use 1. Use 2 or more for
explicit MULES.
nAlphaCorr 2; Number of corrections.
Use 2-3 for slowly varying flows.
Use 3 or more for highly transient, high Reynolds,
high CFL number flows.
• The semi-implicit MULES offers significant speed-up and stability over the explicit MULES GT-105
Guided tutorials
Guided tutorial 5
NOTE:
If you are planning to use large time-steps (CFL number
larger than 1), it is recommended to do at least 2
nCorrector and 2 nOuterCorrectors correctors.
PIMPLE
{
momentumPredictor yes; Set to yes for high Reynolds flows, where
convection dominates
PIMPLE
{ For extra stability and robustness, it is
consistent yes; recommended to use the consistent formulation
… of the SIMPLE P-V.
}
relaxationFactors
{
fields • Add implicit (equations) and explicit (fields)
{ under-relaxation factors to get extra
".*" 0.9; stability.
} • Do not use too low values as you might
equations lose time accuracy.
{ • Instead of reducing the URF to values
".*" 0.9; below 0.5, it is better to reduce the time
} step.
}
GT-107
Guided tutorials
Guided tutorial 5
1. $> run_all.sh
• Feel free to open the file run_all.sh to see all the commands used.
• If you prefer to run the case manually, type the commands in the terminal window.
GT-108