CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM (
-   -   first order gradient scheme ?? (

kdarc May 25, 2010 16:13

first order gradient scheme ??

I want to implement something seemingly simple, but I've managed to waste half a day on this already...

All I want to do is to implement a gradient scheme for a scalar that is first order upwind. (ie; for a discrete jump in field values, I only want ONE cell to show a value for the gradient)

presumably, something along the lines of:

grad(p) Gauss linearUpwind ;

should work, but this takes me down a path of error messages such as:

request for surfaceScalarField Gauss from objectRegistry region0 failed
available objects of type surfaceScalarField are


where following the suggested options leads to nothing useful.

Any help sincerely appreciated.

JinBiao May 25, 2010 22:06

I do not know why you need a linear upwind differencing for the pressure gradient. Upwind is applied for the convection term in the N-S equation.

The error message means that the field in the grad operator (in your case p) is not a surfaceScalarField.

I think

grad(p) Gauss linear;

will work in your case.


kdarc May 26, 2010 09:51

I never said I was solving NS equations, using the scalar p perhaps confuses people.

Let me graphically illustrate what I'm seeking:

kdarc May 26, 2010 12:08

by just not giving up, I got what I wanted:

the magic code:

grad(s) faceLimited Gauss upwind phi 0;

thanks to all who looked in on this.

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