CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM (http://www.cfd-online.com/Forums/openfoam/)
-   -   Crank Nicholson scheme for Laplacian failed (http://www.cfd-online.com/Forums/openfoam/77638-crank-nicholson-scheme-laplacian-failed.html)

Cyp June 29, 2010 11:22

Crank Nicholson scheme for Laplacian failed
 
Hi!

I modify the laplacian discretization scheme into the scalarTransportFoam solver as suggested in the programmer's guide P-43 to implement the crank Nicholson scheme :

Code:

solve
      (
        fvm::ddt(rho,T)
      + fvm::div(phi,T)
      - 0.5*(fvm::laplacian(rho*DT,T)+fvc::laplacian(rho*DT,T))
      == ff
      );

where ff is my source term. The compilation is OK. However during runs, my results are wrong. For instance, if I integrate T over the entire domain, the returning result is half the expected one. It looks as if the fvc::laplacian(rho*DT,T) term is not account for.

In my fvSchemes I specify :
Code:

laplacianSchemes
{
    default    none;
    laplacian ((rho*DT),T) Gauss linear corrected;
}

Do you know how I can solve my problem ?

Regards,
Cyp

theory37 July 16, 2010 11:12

Try moving
Code:

0.5*(fvm::laplacian(rho*DT,T)+fvc::laplacian(rho*DT,T))
to the right hand side of == (and changing the sign, of course).

Cyp July 19, 2010 07:36

I tried your modification but I still have my problem...

How is your fvSchemes file ??

theory37 July 19, 2010 07:58

The relevant part of my fvSchemes dictionary:
Code:

laplacianSchemes
{
    default        Gauss linear corrected;
}

although what you have should work fine. Also, what does your ddtSchemes sub-dictionary look like? I'm fairly certain you need to have
Code:

ddtSchemes
{
    default          CrankNicholson 1;
}

in order for this to work properly, although I'm not sure. If this also doesn't work, perhaps try the exact equation shown in the Programmer's Guide?

Mike


All times are GMT -4. The time now is 18:34.