# from interFoam to interIsoFoam

 Register Blogs Members List Search Today's Posts Mark Forums Read

April 15, 2020, 13:05
from interFoam to interIsoFoam
#1
Member

Bram Kerkhofs1
Join Date: Oct 2016
Posts: 30
Rep Power: 9
Hi

I'm trying to experiment with interIsoFoam.
As a source for the alpha field and the other fields, I use a case which is made with interFoam.

Problem: it looks like interIsoFoam with the isoAdvection-solver diverges.

I.e.:
first iteration, first innerloop:
Code:
`isoAdvection: Before conservative bounding: min(alpha) = -1.240522232e-83, max(alpha) = 1 + 0.0005295133074`
after 12 innerloops it ends this outerloop:
Code:
`isoAdvection: Before conservative bounding: min(alpha) = 0, max(alpha) = 1 + 0.05453439826`
Second iteration, first innerloop::
Code:
`isoAdvection: Before conservative bounding: min(alpha) = 0, max(alpha) = 1 + 0.05925915669`
after 13 innerloops it ends the second outerloop.
Complete residual output:

Code:
```PIMPLE: iteration 13
AMI: Creating addressing and weights between 9100 source faces and 8832 target faces
AMI: Patch source sum(weights) min:0.9999303843 max:1.000053447 average:0.9999900626
AMI: Patch target sum(weights) min:0.9999507692 max:1.000064161 average:1.000016928
GAMG:  Solving for pcorr, Initial residual = 1, Final residual = 0.009026559663, No Iterations 4
GAMG:  Solving for pcorr, Initial residual = 0.002355974942, Final residual = 1.763078088e-05, No Iterations 9
GAMG:  Solving for pcorr, Initial residual = 8.719498349e-05, Final residual = 4.59847574e-07, No Iterations 6
time step continuity errors : sum local = 7.176612991e-15, global = -2.42387998e-15, cumulative = 3.276703364e-13
Number of isoAdvector surface cells = 186848
isoAdvection: Before conservative bounding: min(alpha) = 0, max(alpha) = 1 + 0.1004676957
isoAdvection: After conservative bounding: min(alpha) = 0, max(alpha) = 1 + 1.061161496e-07
isoAdvection: time consumption = 9%                                                                                                                                              Phase-1 volume fraction = 0.3363172403  Min(alpha.water) = 0  Max(alpha.water) = 1
Number of isoAdvector surface cells = 186451
isoAdvection: Before conservative bounding: min(alpha) = 0, max(alpha) = 1 + 0.08699985256
isoAdvection: After conservative bounding: min(alpha) = 0, max(alpha) = 1 + 6.039899377e-06
isoAdvection: time consumption = 10%                                                                                                                                             Phase-1 volume fraction = 0.33631726  Min(alpha.water) = 0
Max(alpha.water) = 1
DILUPBiCGStab:  Solving for Ux, Initial residual = 1.069829319e-05, Final residual = 5.84321495e-17, No Iterations 2
DILUPBiCGStab:  Solving for Uy, Initial residual = 5.240697493e-06, Final residual = 3.936466577e-17, No Iterations 2
DILUPBiCGStab:  Solving for Uz, Initial residual = 7.094111304e-06, Final residual = 1.364192158e-15, No Iterations 2
GAMG:  Solving for p_rgh, Initial residual = 0.005823560349, Final residual = 4.094078189e-05, No Iterations 4
GAMG:  Solving for p_rgh, Initial residual = 0.000686784676, Final residual = 5.994351588e-06, No Iterations 5
GAMG:  Solving for p_rgh, Initial residual = 0.0001680834125, Final residual = 1.503036888e-06, No Iterations 5
time step continuity errors : sum local = 2.884203884e-11, global = 3.31358195e-14, cumulative = 3.608061559e-13
GAMG:  Solving for p_rgh, Initial residual = 7.030436671e-05, Final residual = 4.803836496e-07, No Iterations 6
GAMG:  Solving for p_rgh, Initial residual = 2.313309644e-05, Final residual = 2.1642675e-07, No Iterations 5
GAMG:  Solving for p_rgh, Initial residual = 7.406384726e-06, Final residual = 9.159079788e-10, No Iterations 41
time step continuity errors : sum local = 1.803777673e-14, global = -1.83394836e-16, cumulative = 3.606227611e-13
DILUPBiCGStab:  Solving for omega, Initial residual = 8.06232745e-07, Final residual = 6.681602759e-17, No Iterations 2
DILUPBiCGStab:  Solving for k, Initial residual = 6.124043567e-06, Final residual = 1.83465517e-16, No Iterations 2
DILUPBiCGStab:  Solving for ReThetat, Initial residual = 4.492151369e-06, Final residual = 1.538420557e-15, No Iterations 2
DILUPBiCGStab:  Solving for gammaInt, Initial residual = 9.401681685e-06, Final residual = 1.569161983e-16, No Iterations 2
PIMPLE: converged in 13 iterations```
As you can see the other residuals stay more or less in check. time consumption of the isoAdvection does rise.

So the first iteration takes 12 innerloops, the second one 13, the third one 14
and the forth one I stopped after 39 innerloops. Reason why they don't converge anymore is because the U-residuals are getting messed-up and don't get below 1e-5 anymore.
The isoAdvection residual for this 39'th innerloop was:
Code:
`isoAdvection: Before conservative bounding: min(alpha) = 0, max(alpha) = 1 + 0.1084360555`
As reference: with interFoam it takes 4 innerloops to converge.
Since the alpha-solver diverges, it's my number 1 suspect of messing up the simulation. I tried to manipulate the alpha-field in advance. So I clipped (rounded) all the alpha-values to 1, 0.5 or 0. This made some more contrast in the field. Results are shown in before_clipping.png and after_clipping.png But this didn't help.
The results of the above iterations were with the case where the values were clipped. When the values aren't clipped, the simulation derails within the first iteration: it just never converges. The isoAdvection-residual becomes something like:
Code:
`isoAdvection: Before conservative bounding: min(alpha) = -20, max(alpha) = 1 + 60`
The Courant numbers don't get really high:

Code:
`Courant Number mean: 0.0002644452277 max: 0.4862678596                                                                                                                           Interface Courant Number mean: 1.950778666e-06 max: 0.002363813456`
The case is kind of big (~1GB), so I try to solve it without the need to upload it.

The fvSolution:

Code:
```
{

//INTERFOAM
"alpha.water.*"
{
nAlphaCorr        2;
nAlphaSubCycles     2;
cAlpha              1;
MULESCorr       yes;
nLimiterIter    15;
alphaApplyPrevCorr  yes;

solver          smoothSolver;
smoother        symGaussSeidel;
tolerance       1e-10;
relTol          0;
minIter         1;
maxIter		100;

//interIsoFoam:

isofaceTol		1e-7; 	// Error tolerance on alph when cutting surface cells into sub-cells // interIsoFoam
surfCellTol		1e-6 ;	// Only cells with surfCellTol < alpha < 1- surfCellTol,  are treated as surface cells //interIsoFoam
nAlphaBounds	3;		//Number of times the ad-hoc bounding step should try to correct unboundedness.
//Strictly volume conserving (provided that sum(phi)=0 for a cell) // interIsoFoam
snapTol			1e-12; 	//Optional: cells with alpha < snaphAlphaTol are snapped to 0 and cells with 1- alpha < snaphAlphaTol are snapped to 1 // interIsoFoam
clip			true; 	//Optional: clip remaining unboudedness // interIsoFoam

//If present, the following variables can be removed from alpha.water in fvSolution:
/*
nAlphaCorr
MULESCorr
nLimiterIter
solver
smoother
tolerance
relTol
*/

}

".*(rho|rhoFinal)"
{
solver          diagonal;
}

cellDisplacement
{
solver          GAMG;
smoother        GaussSeidel;
tolerance       1e-7;
relTol          0.001;
}

"(p_rgh|pcorr.*)"
{
solver          GAMG; // GAMG PBiCGStab PCG smoothSolver
//tolerance       1e-07;

tolerance		1e-09; //interIsoFoam, the tolerance needs to be < 10 -100 times surfCellTol
relTol          0.01;
maxIter         100;
minIter         2;
cacheAgglomeration true;
agglomerator    faceAreaPair;
nCellsInCoarsestLevel 1200;
//       mergeLevels     1;

smoother        DIC;//symGaussSeidel;//GaussSeidel;
//	nSweep		1; //Voor DIC-smoother
//        nPreSweeps      0;
nPostSweeps     3; //2 B
//	postSweepsLevelMultiplier 1;
//	maxPostSweeps   4;
//	nFinestSweeps   2;
//	scaleCorrection true;

}

"(p_rgh)Final"
{
\$p_rgh;

tolerance       1e-09;
relTol          0;
maxIter 	150;
}```

My current OF-version is V1906.

Anyone any idea how I get this working? Are there any other suspects I'm not getting?

Cheers!

Bram
Attached Images
 after_clipping.PNG (14.3 KB, 160 views) before_clipping.PNG (30.6 KB, 137 views)

April 17, 2020, 10:28
#2
Senior Member

Santiago Lopez Castano
Join Date: Nov 2012
Posts: 354
Rep Power: 15
Quote:
 Originally Posted by brammekeuh987 Hi I'm trying to experiment with interIsoFoam. As a source for the alpha field and the other fields, I use a case which is made with interFoam. Problem: it looks like interIsoFoam with the isoAdvection-solver diverges. I.e.: first iteration, first innerloop: Code: `isoAdvection: Before conservative bounding: min(alpha) = -1.240522232e-83, max(alpha) = 1 + 0.0005295133074` after 12 innerloops it ends this outerloop: Code: `isoAdvection: Before conservative bounding: min(alpha) = 0, max(alpha) = 1 + 0.05453439826` Second iteration, first innerloop:: Code: `isoAdvection: Before conservative bounding: min(alpha) = 0, max(alpha) = 1 + 0.05925915669` after 13 innerloops it ends the second outerloop. Complete residual output: Code: ```PIMPLE: iteration 13 AMI: Creating addressing and weights between 9100 source faces and 8832 target faces AMI: Patch source sum(weights) min:0.9999303843 max:1.000053447 average:0.9999900626 AMI: Patch target sum(weights) min:0.9999507692 max:1.000064161 average:1.000016928 GAMG: Solving for pcorr, Initial residual = 1, Final residual = 0.009026559663, No Iterations 4 GAMG: Solving for pcorr, Initial residual = 0.002355974942, Final residual = 1.763078088e-05, No Iterations 9 GAMG: Solving for pcorr, Initial residual = 8.719498349e-05, Final residual = 4.59847574e-07, No Iterations 6 time step continuity errors : sum local = 7.176612991e-15, global = -2.42387998e-15, cumulative = 3.276703364e-13 Number of isoAdvector surface cells = 186848 isoAdvection: Before conservative bounding: min(alpha) = 0, max(alpha) = 1 + 0.1004676957 isoAdvection: After conservative bounding: min(alpha) = 0, max(alpha) = 1 + 1.061161496e-07 isoAdvection: time consumption = 9% Phase-1 volume fraction = 0.3363172403 Min(alpha.water) = 0 Max(alpha.water) = 1 Number of isoAdvector surface cells = 186451 isoAdvection: Before conservative bounding: min(alpha) = 0, max(alpha) = 1 + 0.08699985256 isoAdvection: After conservative bounding: min(alpha) = 0, max(alpha) = 1 + 6.039899377e-06 isoAdvection: time consumption = 10% Phase-1 volume fraction = 0.33631726 Min(alpha.water) = 0 Max(alpha.water) = 1 DILUPBiCGStab: Solving for Ux, Initial residual = 1.069829319e-05, Final residual = 5.84321495e-17, No Iterations 2 DILUPBiCGStab: Solving for Uy, Initial residual = 5.240697493e-06, Final residual = 3.936466577e-17, No Iterations 2 DILUPBiCGStab: Solving for Uz, Initial residual = 7.094111304e-06, Final residual = 1.364192158e-15, No Iterations 2 GAMG: Solving for p_rgh, Initial residual = 0.005823560349, Final residual = 4.094078189e-05, No Iterations 4 GAMG: Solving for p_rgh, Initial residual = 0.000686784676, Final residual = 5.994351588e-06, No Iterations 5 GAMG: Solving for p_rgh, Initial residual = 0.0001680834125, Final residual = 1.503036888e-06, No Iterations 5 time step continuity errors : sum local = 2.884203884e-11, global = 3.31358195e-14, cumulative = 3.608061559e-13 GAMG: Solving for p_rgh, Initial residual = 7.030436671e-05, Final residual = 4.803836496e-07, No Iterations 6 GAMG: Solving for p_rgh, Initial residual = 2.313309644e-05, Final residual = 2.1642675e-07, No Iterations 5 GAMG: Solving for p_rgh, Initial residual = 7.406384726e-06, Final residual = 9.159079788e-10, No Iterations 41 time step continuity errors : sum local = 1.803777673e-14, global = -1.83394836e-16, cumulative = 3.606227611e-13 DILUPBiCGStab: Solving for omega, Initial residual = 8.06232745e-07, Final residual = 6.681602759e-17, No Iterations 2 DILUPBiCGStab: Solving for k, Initial residual = 6.124043567e-06, Final residual = 1.83465517e-16, No Iterations 2 DILUPBiCGStab: Solving for ReThetat, Initial residual = 4.492151369e-06, Final residual = 1.538420557e-15, No Iterations 2 DILUPBiCGStab: Solving for gammaInt, Initial residual = 9.401681685e-06, Final residual = 1.569161983e-16, No Iterations 2 PIMPLE: converged in 13 iterations``` As you can see the other residuals stay more or less in check. time consumption of the isoAdvection does rise. So the first iteration takes 12 innerloops, the second one 13, the third one 14 and the forth one I stopped after 39 innerloops. Reason why they don't converge anymore is because the U-residuals are getting messed-up and don't get below 1e-5 anymore. The isoAdvection residual for this 39'th innerloop was: Code: `isoAdvection: Before conservative bounding: min(alpha) = 0, max(alpha) = 1 + 0.1084360555` As reference: with interFoam it takes 4 innerloops to converge. Since the alpha-solver diverges, it's my number 1 suspect of messing up the simulation. I tried to manipulate the alpha-field in advance. So I clipped (rounded) all the alpha-values to 1, 0.5 or 0. This made some more contrast in the field. Results are shown in before_clipping.png and after_clipping.png But this didn't help. The results of the above iterations were with the case where the values were clipped. When the values aren't clipped, the simulation derails within the first iteration: it just never converges. The isoAdvection-residual becomes something like: Code: `isoAdvection: Before conservative bounding: min(alpha) = -20, max(alpha) = 1 + 60` The Courant numbers don't get really high: Code: `Courant Number mean: 0.0002644452277 max: 0.4862678596 Interface Courant Number mean: 1.950778666e-06 max: 0.002363813456` The case is kind of big (~1GB), so I try to solve it without the need to upload it. The fvSolution: Code: ``` { //INTERFOAM "alpha.water.*" { nAlphaCorr 2; nAlphaSubCycles 2; cAlpha 1; //interfaceMethod "isoAdvector"; // interIsoFoam MULESCorr yes; nLimiterIter 15; alphaApplyPrevCorr yes; solver smoothSolver; smoother symGaussSeidel; tolerance 1e-10; relTol 0; minIter 1; maxIter 100; //interIsoFoam: isofaceTol 1e-7; // Error tolerance on alph when cutting surface cells into sub-cells // interIsoFoam surfCellTol 1e-6 ; // Only cells with surfCellTol < alpha < 1- surfCellTol, are treated as surface cells //interIsoFoam nAlphaBounds 3; //Number of times the ad-hoc bounding step should try to correct unboundedness. //Strictly volume conserving (provided that sum(phi)=0 for a cell) // interIsoFoam snapTol 1e-12; //Optional: cells with alpha < snaphAlphaTol are snapped to 0 and cells with 1- alpha < snaphAlphaTol are snapped to 1 // interIsoFoam clip true; //Optional: clip remaining unboudedness // interIsoFoam //If present, the following variables can be removed from alpha.water in fvSolution: /* nAlphaCorr MULESCorr nLimiterIter solver smoother tolerance relTol */ } ".*(rho|rhoFinal)" { solver diagonal; } cellDisplacement { solver GAMG; smoother GaussSeidel; tolerance 1e-7; relTol 0.001; } "(p_rgh|pcorr.*)" { solver GAMG; // GAMG PBiCGStab PCG smoothSolver //tolerance 1e-07; tolerance 1e-09; //interIsoFoam, the tolerance needs to be < 10 -100 times surfCellTol relTol 0.01; maxIter 100; minIter 2; cacheAgglomeration true; agglomerator faceAreaPair; nCellsInCoarsestLevel 1200; // mergeLevels 1; smoother DIC;//symGaussSeidel;//GaussSeidel; // nSweep 1; //Voor DIC-smoother // nPreSweeps 0; nPostSweeps 3; //2 B // postSweepsLevelMultiplier 1; // maxPostSweeps 4; // nFinestSweeps 2; // scaleCorrection true; } "(p_rgh)Final" { \$p_rgh; tolerance 1e-09; relTol 0; maxIter 150; }``` My current OF-version is V1906. Anyone any idea how I get this working? Are there any other suspects I'm not getting? Cheers! Bram
You shouldn't be reconstructing the free-furface for each inner pimple loop, because there is no real time-advance in said inner loops! If the free surface doesn't stay put then how do you expect the inner SIMPLE cycles to converge?

Adjust the free-surface once, at the first PIMPLE loop, and then go on with the rest of the pimple loops WITHOUT updating the free surface.

MY TWO CENTS....

 April 18, 2020, 07:52 #3 Member   Bram Kerkhofs1 Join Date: Oct 2016 Posts: 30 Rep Power: 9 Hi Santiago Thanks for your input! So I looked at the tutorials and indeed: they run in 'PISO'-mode, no additional internal pimple loops! This looks kind of a big thing to mention, since this ain't the real 'pimple'-philosophy where you can get larger timesteps, residual parameters on convergence, .... . So I guess there is no other way to make the solver only do the alpha calculation once, than setting the nOuterCorrectors to 0 (PISO-mode)? I tried the simulation in PISO-mode. at the first time step: Code: `isoAdvection: Before conservative bounding: min(alpha) = -1.240522232e-83, max(alpha) = 1 + 0.0005295133074` second time step: Code: `isoAdvection: Before conservative bounding: min(alpha) = 0, max(alpha) = 1 + 0.01646964113` third time step: Code: `isoAdvection: Before conservative bounding: min(alpha) = 0, max(alpha) = 1 + 0.06370722414` the last step before I stopped the simulation: Code: `isoAdvection: Before conservative bounding: min(alpha) = -2.179964275, max(alpha) = 1 + 6.860999516` So it looks like it didn't really change the outcome