CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM (
-   -   linearUpwind (

robdeb April 11, 2013 08:51


I'm trying to understand the linearUpwind scheme in OpenFOAM. The linearUpwind.C isn't clear to me. So I have some questions:
-Is it simply the extansion of the upwind scheme to the second order?
-In the User Guide, it is said to be first/second order bounded. But for me, I would not have expected it to be bounded in the second order. Where am I wrong?

Thank you.

chegdan April 11, 2013 16:28


-Is it simply the extension of the upwind scheme to the second order?


-In the User Guide, it is said to be first/second order bounded. But for me, I would not have expected it to be bounded in the second order. Where am I wrong?
It is unbounded unless you use a gradient scheme that bounds the values. Maybe this older discussion will help:

Good luck.

robdeb April 11, 2013 16:54

Thank you very much for your answer!

robdeb April 19, 2013 06:47

Hi again,

I'm simulating a supersonic flow with a shock, inviscid case.
I wanted to compare a TVD scheme (limitedLinear) with linearUpwind. I tried linearUpwind without cellLimited and then with cellLimited. What I expected was that the linearUpwind scheme without cellLimited gave me spurious oscillations but it doesn't. The two case (linearUpwind with and without cellLimited) gave me the same results. The localisation of the shock isn't very good compare to limitedLinear but I see no spurious oscillations near it.
How can we explain it?

Thank you.


chegdan April 20, 2013 20:08

What type of gradient scheme are you using?

robdeb April 22, 2013 03:28

Gauss linear

fredo490 April 23, 2013 10:42

give your full scheme file. Maybe you can try a leastsquare method.

robdeb April 24, 2013 03:30

Here is my fvSchemes for the linearUpwind case without cellLimited:

/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.1.1 |
| \\ / A nd | Web: |
| \\/ M anipulation | |
version 2.0;
format ascii;
class dictionary;
location "system";
object fvSchemes;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

default Euler;

default Gauss linear;
grad(p) Gauss linear;
grad(U) Gauss linear;

default none;
div(phi,U) Gauss upwind;
div(phid,p) Gauss linearUpwind grad(U);
div(phi,e) Gauss linearUpwind grad(U);
div(phi,K) Gauss linearUpwind grad(U);
div((muEff*dev2(T(grad(U))))) Gauss linear 1;

default none;
laplacian((rho*(1|A(U))),p) Gauss linear corrected;
laplacian(muEff,U) Gauss linear corrected;
laplacian(alphaEff,e) Gauss linear corrected;

default linear;

default corrected;

default no;
p ;

// ************************************************** *********************** //

Thank you, I'll try leastSquare method.

fredo490 April 24, 2013 08:18

why you didn't put "div(phi,U)" to the second order ?

All the gradient should take the solved variable:

div(phid,p) Gauss linearUpwind grad(p);
div(phi,e) Gauss linearUpwind grad(e);
div(phi,K) Gauss linearUpwind grad(K);

robdeb April 24, 2013 09:01

I noticed that for all the inviscid case in the tutorials, sonicFoam never use second order for this term. I've tried a second order but it doesn't improve my solution and gave me more spurious oscillations just after the shock.

Sorry for the mistake, I saw it but forgot to change it for the "linearUpwind without cellLimited" case but I didn't made the mistake for the "linearUpwind with cellLimited" case. So I don't think the mistake come from that. But I just ran the simulation with the corrections, I'll tell you if it changes something.

Thank you

All times are GMT -4. The time now is 22:41.