CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   Adams-Bashforth implicit scheme for time. (https://www.cfd-online.com/Forums/openfoam-solving/121018-adams-bashforth-implicit-scheme-time.html)

Mirage12 July 19, 2013 06:30

Adams-Bashforth implicit scheme for time.
 
Hello :)

I would like to use a second order accurate Adams-Bashforth implicit scheme for time.
I searched in the Internet, how to implement this scheme in OpenFOAM but i did not find any Information about it...

Can we use this kind of scheme in OpenFOAM ?
Is there any option to use other scheme, which works in the same way ?

ARTem July 22, 2013 04:35

Hello, Mirage12.

For example, I want to solve ∂y/∂t + ∂(yU_i)/∂x_i = 0. To use Adams-Bashforth, I should do next

y^(n+1) = y^(n) - dt*(3/2*( ∂(y^(n+1)U_i)/∂x_i) - 0.5*( ∂(y^(n)U_i)/∂x_i)). That seems right, yes?

So, implementation would be

Code:


phi = U & mesh.Sf();
...
yEqn
(
    fvm::ddt(y)
 + 1.5*fvm::div(phi, y)
  - 0.5*fvc::div(phi, y)
);

with "Euler" word used in OF ddtScheme dictionary.

Mirage12 July 22, 2013 23:57

I don t know ...

ARTem July 23, 2013 04:42

Of course, you can study how CrankNicholson scheme is implemented in OF and create AB from it, but this is the fastest way.
By the way, Crank-Nicholson scheme is easy to implement too
Code:

yEqn
(
    fvm::ddt(y)
  + 0.5*fvm::div(phi, y)
  + 0.5*fvc::div(phi, y)
);


Mirage12 July 23, 2013 05:11

could you please specify where should i implement the code ?
i am not really an expert...i am just a beginner :D

ARTem July 23, 2013 05:23

Okay, e.g., let's take icoFoam and use AB for momentum time discretisation.

icoFoam.C looks like:
Code:

...
        fvVectorMatrix UEqn
        (
            fvm::ddt(U)
          + fvm::div(phi, U)
          - fvm::laplacian(nu, U)
        );
...

So, we just rewrite this part of code (it's better to copy all icoFoam folder to icoFoamAB e.g. for keeping original files untouched).
Code:

...
        fvVectorMatrix UEqn
        (
            fvm::ddt(U)
          +1.5*fvm::div(phi, U)
          -0.5*fvc::div(phi, U)
          - fvm::laplacian(nu, U)
        );
...

Here I used AB time advance scheme for convective fluxes and Euler implicit for diffusive fluxes.

Mirage12 July 23, 2013 06:03

Thx , i wil try it :)


All times are GMT -4. The time now is 08:58.