CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM (
-   -   initialize pressure gradient (

jiejie June 30, 2011 07:55

initialize pressure gradient
Dear Foamers

I am try to setup a Gaussian vortex case, which has a given velocity field and pressure gradient field. I am able to write a app to initialize the velocity across the flow domain by looping through each individual cells. However, I am having problem to initialize the pressure gradient as it requires more than one cell. Would anyone have some suggestions on how to implement this?

Thank you.

nimasam June 30, 2011 09:25

my suggestion :
1) add to createFields.H
volVectorField dpdx

2) add file dpdx with dimension of (p/length) in folder 0

3) use funkySetFields from openFoam wiki to initialize the field

jiejie June 30, 2011 09:36

Hi nimasam

It requires more cell points to calculate the pressure gradient but not sure how to convert pressure gradient to pressure?

I came across the funkyFields but never used it before. Would you be able to elaborate a bit more on it?

Thanks for the reply.

nimasam June 30, 2011 09:46

i can't understand, whats ur mean ? ;)

jiejie June 30, 2011 09:49


Originally Posted by nimasam (Post 314238)
i can't understand, whats ur mean ? ;)

Sorry for the confusion. What I mean is you need more than one cell to calculate the pressure gradient. Is it possible to calculate the pressure at each cell if I know the pressure gradient? This is because I need to initialize the pressure field but I only have the information of the pressure gradient.

nimasam June 30, 2011 09:59

im not sure! it would be compilicated but maybe you can look at streamFunction and use similar method!

All times are GMT -4. The time now is 17:53.