CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   How to avoid checkerboard? (https://www.cfd-online.com/Forums/openfoam-programming-development/104670-how-avoid-checkerboard.html)

dohnie July 12, 2012 12:17

How to avoid checkerboard?
 
Dear Foamers,
I created a density based (no PISO loop !) combustion solver which works fine as long as I use adiabatic walls. However, if I set the temperature on the walls to a fixed value, a checkerboard pattern in the pressure develops (not immediately, but after a few hundred timesteps).

In short, the code looks like this (similar to rhoCentralFoam):
Code:

#include "rhoEqn.H"

// solve all other transport equations

thermo.correct();
p.dimensionedInternalField() = rho.dimensionedInternalField() / thermo.psi().dimensionedInternalField();
p.correctBoundaryConditions();
rho.boundaryField() = psi.boundaryField()*p.boundaryField();

I know that this is not enough information to find a bug, but I've been stuck on this for a while and just wanted to ask for some general advice on the checkerboard problem in a density based code.

The p boundary condition on the walls is zeroGradient.
Changing the grad scheme in fvSchemes from Gauss linear to fourth did not yield any improvement.

Any suggestions are appreciated!

dohnie July 12, 2012 12:25

1 Attachment(s)
Screenshot:

Attachment 14404

Bernhard July 13, 2012 02:55

Can you post your complete fvSchemes and fvSolution? Also, did you arefully check if your solution converges?

dohnie July 13, 2012 06:14

Bernhard, I checked convergence, the residuals are nice.
Here are my schemes:

Code:

FoamFile
{
    version    2.0;
    format      ascii;
    class      dictionary;
    location    "system";
    object      fvSchemes;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

ddtSchemes
{
    default        Euler;
}

gradSchemes
{
    default                        Gauss linear;
    grad(scalarSlope)        cellMDLimited Gauss linear 1;
    grad(USlope)                cellMDLimited Gauss linear 1;
}

divSchemes
{
    default        none;

    div(tauShear)              Gauss linear;
    div(tauMC)                        Gauss linear;
    div((tauShear&U))          Gauss linear;
    div((p*U))                        Gauss linear;
    div((U+((sL*Xi)*-grad(c)))) Gauss linear;
    div((sL*grad(b)))                Gauss linear;
    div(U)                            Gauss linear;
    div((sL*-grad(c)))                Gauss linear;
 
   
    div(phiSt,c)            Gauss vanLeer01;       
    div(phiXi,Xi)        Gauss vanLeer;
   
    div(phi,k)                      Gauss upwind;
    div(phi,omega)        Gauss upwind;
}

laplacianSchemes
{
    default        Gauss linear corrected;
}

interpolationSchemes
{
    default none;
 
    interpolate(tauMC)        Gamma phi 1.0;
    interpolate(mu)        Gamma phi 1.0;
    interpolate(muEff)        Gamma phi 1.0;

    reconstruct(rho) limitedLinear 1.0;
    reconstruct(U)  limitedLinearV 1.0;
    reconstruct(T)  limitedLinear 1.0;

    interpolate(rho) linear;                // for CFL
    reconstruct(cSound) linear;        // for CFL
 
    // combustion stuff:
    interpolate(-grad(c)) linear;
    interpolate(grad((1-c))) linear;
    interpolate((((p*psiu)*sL)*Xi)) linear;
    interpolate((sL*((1|Xi)-Xi))) linear;
    interpolate(((rhoUnburned*sL)*Xi)) linear;
    interpolate((laplacian(interpolate(alphaEff),c)|mag(-grad(c)))) linear;
}

snGradSchemes
{
    default        corrected;
}

Code:

FoamFile
{
    version    2.0;
    format      ascii;
    class      dictionary;
    location    "system";
    object      fvSolution;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

solvers
{
    rho
    {
        solver          diagonal;
    }

    rhoE
    {
        solver          diagonal;
    }
   
    U
    {
        solver                PCG;
        preconditioner  DIC;
        tolerance        1e-06;
        relTol          0;
    };

    fH
    {
        solver                PCG;
        preconditioner  DIC;
        tolerance        1e-06;
        relTol          0;
    };
    tau
    {
        solver                PCG;
        preconditioner  DIC;
        tolerance        1e-06;
        relTol          0;
    };
    c
    {
        solver                PCG;
        preconditioner  DIC;
        tolerance        1e-06;
        relTol          0;
    };
    hu
    {
        solver                PCG;
        preconditioner  DIC;
        tolerance        1e-06;
        relTol          0;
    };
   
    Xi
    {
        solver                PBiCG;
        preconditioner  DILU;
        tolerance        1e-06;
        relTol          0;
    };

    k
    {
        solver                PBiCG;
        preconditioner  DILU;
        tolerance        1e-06;
        relTol          0;
    };
    omega
    {
        solver                PBiCG;
        preconditioner  DILU;
        tolerance        1e-06;
        relTol          0;
    };
   
}

Riemann
{
    secondOrder yes;            // Riemann: 1st or 2nd order
}

relaxationFactors
{
    // under-relaxation factors used in wave-transmissive schemes
    k              0.2;
    omega          0.2;
}


jameswilson620 January 19, 2015 12:13

Any updates on this problem? I am experiencing the same issues but in a modified version of porousInterFoam where increasing permeability[m^2] results in this checkerboard pressure field.

James

wyldckat January 19, 2015 14:22

Greetings to all!

@James: Can you provide a test case and respective solver?

Either way, try following the same analysis strategy I used here: http://www.cfd-online.com/Forums/ope...tml#post446350 post #17

Best regards,
Bruno

jameswilson620 January 23, 2015 11:18

Quote:

Originally Posted by wyldckat (Post 528184)
Greetings to all!

@James: Can you provide a test case and respective solver?

Either way, try following the same analysis strategy I used here: http://www.cfd-online.com/Forums/ope...tml#post446350 post #17

Best regards,
Bruno

Bruno,

Ive seen your posts all throughout the forums. Thanks for your help and input! I need to get better at following up on my own solutions since I have fixed my problem! :D

My checkerboarding was caused by slip boundary conditions, i.e. checkerboarding would occur anywhere there were no gradients in the velocity field (resulting in unstable oscillations that still satisfied continuity). Im not sure what parameters/mat'l properties resulted in my cases diverging and not any of my others; however, I increased nOuterCorrectors in fvSolution for PIMPLE:

Code:

PIMPLE
{
    momentumPredictor  no;
    nOuterCorrectors    2; // increased from 1 -> 2
    nCorrectors        3;
    nNonOrthogonalCorrectors 0;
}

and it mitigated this issue!

I cant give you stats on the difference in iterations between the first and second loops; however, I know the second pass through the PIMPLE loop with nOuterCorrectors=2 resulted in nearly the order of iterations in the first pass.

I believe in my first case (mixed slip and no-slip boundaries), I had a high value of sigma (0.1N/m) and a small domain resulting in relatively large surface tension forces and consequently, un-realistic velocities on the slip walls across the interface since the BC is set to zeroGradient/slip/symetry and forced the liquid phase to adjust rapidly.

In another case, I had a uniform inflow and slip conditions on various boundaries resulting in the checkerboarding due to the onset of instability from the lack of gradients anywhere in the flow field.

I cannot reproduce the error since I have modified those cases. so I didnt provide a test case : /

I hope this helps, James

chriss85 January 26, 2015 03:12

If increasing the number of iterations fixes your problem, then this is a simple convergence issue. I suggest you monitor the convergence behaviour of the initial residuals.


All times are GMT -4. The time now is 17:05.