CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (http://www.cfd-online.com/Forums/openfoam-solving/)
-   -   gradient schemes (http://www.cfd-online.com/Forums/openfoam-solving/124345-gradient-schemes.html)

 callumso October 2, 2013 13:27

gradient schemes

Hi dear Foamers,

I have been fiddling with different gradient schemes for my simulations. I used the following settings without problems:

grad(p) Gauss linear;
grad(p) Gauss upwind phi;

My simulations only run with the following setting:
grad(p) cellLimited Gauss upwind phi 1.0;

I am concerned about the "upwind" scheme which I think would be very diffusive.

As far as I understand, the interpolation scheme can be any scheme that calculates the face value from the cell values. Therefore I tried to experiment with the TVD interpolation schemes like
grad(p) Gauss vanLeer01 phi;

But this option doesn't work as the code runs into segmentation fault. I also tried some other schemes as well as linearUpwind. But just don't work. I have difficulty sussing out what parameters are needed from the code. Could anyone explain a bit how this gradient scheme can be set? Thanks in advance.

Callum

 Tushar@cfd October 11, 2013 08:23

Quote:
 Originally Posted by callumso (Post 454736) Hi dear Foamers, I have been fiddling with different gradient schemes for my simulations. I used the following settings without problems: grad(p) Gauss linear; grad(p) Gauss upwind phi; My simulations only run with the following setting: grad(p) cellLimited Gauss upwind phi 1.0; I am concerned about the "upwind" scheme which I think would be very diffusive. As far as I understand, the interpolation scheme can be any scheme that calculates the face value from the cell values. Therefore I tried to experiment with the TVD interpolation schemes like grad(p) Gauss vanLeer01 phi; But this option doesn't work as the code runs into segmentation fault. I also tried some other schemes as well as linearUpwind. But just don't work. I have difficulty sussing out what parameters are needed from the code. Could anyone explain a bit how this gradient scheme can be set? Thanks in advance. Callum
Hello Callum,

What do you mean by "p"? Is it the pressure?
If it is pressure then for finite volume method, I guess we have pressure at nodal grid points and for that different interpolation schemes (gradient schemes) will be applied you can refer some of these on Internet.

Best Luck!

 callumso October 12, 2013 15:58

Hi yeah, yup "p" means pressure here. But I am just asking a general question, it can be any other variables.

According to the OpenFOAM documentations, it should be an interpolation scheme after "Gauss". So I just suppose I can use a TVD scheme to obtain the surface value for integration in the Gauss reconstruction method. BUt it seems it doesn't work in this way.

To be honest, I haven't looked into what limiting method is used for "cellLimited" or "faceLimited".

 RodriguezFatz October 14, 2013 06:04

Callumso, this can also be a matter of initialization. Did you try to run the code with "upwind" for some iterations (let's say 500) and then switch the scheme?

Also: I am not sure if this "upwind=dissipation" holds for anything else than the velocity. If you set div(phi,U) to upwind, it will result in additional diffusion by the numerical error. But "p"? Can you (mathematically) see, that a first order pressure gradient has the form of the diffusion of "U"?

 simt October 14, 2013 09:35

grad(p) is not a convection term and central differencing ( Gauss linear; ) can and should be used.

For grad(U) a limiter should be applied ( cellLimited Gauss linear 1; )

 RodriguezFatz October 14, 2013 09:37

?!?
But he said that everything else than upwind diverges...

 callumso October 14, 2013 19:42

Thank you all for the replies. But sorry for the misleading question.

My problem is actually with the turbulence equations instead of p or U.
I have to use upwind and cell limited for grad(k) and grad(omega) and these appear in some explicit source terms in the k-omega SST models. I also need to use upwind convective schemes for k and omega equations now. Otherwise k and omega just blow up quickly.

For Rodriguez: indeed when first order upwind is used, it will always be diffusive, no matter what variable it is. This can be easily shown by expanding the terms into power series and the second derivative term will appear which leads to diffusivity. When central scheme is used, the second derivative is cancelled out, but the third derivative persists which leads to dispersion, not too much a concern to me, though.

For Smit: yes, I always use Gauss linear for grad(p). But I also use Gauss linear for grad(U). My p and U equations are alright. Just the k and omega equations have problems. It seems commercial packages like FLUENT tend to use first order upwind schemes for the turbulence equations. My research needs to capture the k more accurately than a usual case. URANS instead of LES is currently used to reduce the computational cost. That's why I try to keep the k equation as less dissipative as possible.

The question about grad() is just a general one, and more about understanding of the code instead of the numerical method itself.

 RodriguezFatz October 15, 2013 03:47

Quote:
 Originally Posted by callumso (Post 456947) For Rodriguez: indeed when first order upwind is used, it will always be diffusive, no matter what variable it is. This can be easily shown by expanding the terms into power series and the second derivative term will appear which leads to diffusivity. When central scheme is used, the second derivative is cancelled out, but the third derivative persists which leads to dispersion, not too much a concern to me, though.
That's what I was trying to say. But you were talking about pressure and there is no transport equation for pressure. So this argument doesn't hold for pressure.

Try

Code:

```gradSchemes {     default none;     grad(p)    faceMDLimited edgeCellsLeastSquares 1;     grad(U)    faceMDLimited edgeCellsLeastSquares 1;     grad(omega)    faceLimited edgeCellsLeastSquares 1;     grad(k)    faceLimited edgeCellsLeastSquares 1; }```
and

Code:

```divSchemes {       default        none;     div(phi,U)      bounded Gauss linear;     div(phi,k)      bounded Gauss linearUpwind grad(k);     div(phi,omega)  bounded Gauss linearUpwind grad(omega);     div((nuEff*dev(T(grad(U))))) Gauss linear; }```
1) Did you try to switch to higher order scheme as I suggested?
2) Do you have lowRe or highRe boundary conditions? What do you use for boundary conditions?
3) Fluent... you can choose the div scheme for the turbulent variables, but normaly only up to linear upwind ("2nd order upwind"). But for me it looks like Fluent uses limiters at every possible place. At least I can get convergence in OpenFoam with the same grids only when I set limiters everywhere...

 All times are GMT -4. The time now is 20:15.