CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (http://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   How to calculate the gradient along the boundaries from a known volScalarFiled? (http://www.cfd-online.com/Forums/openfoam-programming-development/90681-how-calculate-gradient-along-boundaries-known-volscalarfiled.html)

 shddx1 July 18, 2011 11:48

How to calculate the gradient along the boundaries from a known volScalarFiled?

Hi,

I first obtained a volScalarField in a calculation domain, and then I want to calculate the gradient along the domain boundaries.

Does anyone know how to obtain the gradient along domain boundaries from a known volScalarField?

Thank you very much!

 bojiezhang October 27, 2011 09:54

hi shddx1:
I have the same problem with you ! I define a volScalrField first and the value is fixed for all the cells, but I want to caculate the gradient. Do you solve the problem, can you tell me? Thank you!

 cliffoi October 28, 2011 18:04

You can obtain the surface normal gradient at each boundary using snGrad function.

This will give you the surface normal gradient without any non-orthogonality or skewness corrections. If you need these corrections, use fvc::snGrad().

Then access the value at the boundary with snGradP.boundaryField()[patchI].

If you are looking for a full gradient vector at the boundary, this is a little tricker. Here you will have to interpolate the field gradient (fvc::grad(p)) to the faces and then replace the surface normal component of this with the value coming from fvc::snGrad(p).

Hope this helps
Ivor

 alimea October 2, 2016 04:04

Quote: