CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM (
-   -   How to calculate the gradient of pressure and velocity (

diegosene September 27, 2011 05:12

How to calculate the gradient of pressure and velocity
Hello guys, I am really new in OpenFoam and i really need some help.

I would like to know how to calculate the gradient of pressure and velocity in the same boundary condition?

Thanks in advance

drrbradford September 28, 2011 08:46


Could you be a little more clear about what it is you want to find out? Do you want to map velocity gradients when post processing?

diegosene September 28, 2011 09:03

Hey! sorry for the few details.

I am changing and creating some boundary conditions with heritance from the mixedFvPatchField.
I am creating a B.C. that will calculate the gradient of the pressure and the velocity, in the same B.C.
and then, create another 2 B.C. one velocity"blabla"Fvvectorfield and other pressure"blabla"FvScalarfield that will just "call" the value of the gradients.

For example
For an outlet using the pressure"blabla"Fvscalarfield, it will call the the gradient from the first B.C.
but i dont know how to calculate both gradients in the same B.C.
Do i need to use snGrad? and how would be the code for that?

Because using this from the mixedFvPatchField:
template<class Type>
tmp<Field<Type> > mixedFvPatchField<Type>::snGrad() const
*(refValue_ - this->patchInternalField())
+ (1.0 - valueFraction_)*refGrad_;

Is there someway to differ velocity and pressure when pointing the patchInternalField?
if I use p.InternalField is correct?

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