CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Running, Solving & CFD (
-   -   Problem with very high gradients (

Henning86 November 27, 2012 14:12

Problem with very high gradients
2 Attachment(s)
Hi Foamers,

i'm trying to implent a new boundary condition for which i need the second derivative of U in normal direction. (slip velocity)

In order to get a second order derivative (which isn't laplacian) i'll do:


    volScalarField Ux(U.component(0));

in partial2UT only components 0,4,8 are of interest i store these values in another tensorfield and repeat it for Uy and Uz so that i finally get.

| Ux,xx Uy,xx Uz,xx |
d2U=| Ux,yy Uy,yy Uz,yy |
| Ux,xx Uy,xx Uz,zz |

This works great but only to a certain dimension of the mesh. Attached to this post there are 2 cases and a modified rhoPimpleFoam solver.

the first case "microKanal2"(Kanal:channel in german) has a height of 1.68e-3 meters. The velocity field result in a parabola with an increasing maximum for higher x values. Therefore the first derivative dU shows in y direction a linear function. The tensor compoent(3) Ux,yy should be a a constant value for a cross section of the channel, but changing with the position of x (see picture).

the second case "microKanal" has a height of 1.68e-4 meters. For component 3 of the tensor there are following values (see attached picture)

The field isn't smooth at all it suddenly jumps to another value. A possible reason for that could be that double isn't accurate enough.

Does anyone know what the problem is and how it can be solved?

Best regards


immortality November 28, 2012 17:23

Where did you write these codes?

Henning86 November 29, 2012 18:05

the code is in the rhoPimpleFoam.C after the pimple loop

or what do you mean exactly?

ziemowitzima February 13, 2013 16:22

Hello Henning
I am facing the same problem.
I need to calculate second derivative e.g for field F i need F_xx, F_yy.
I did it the same way as you.
gradF = fvc::grad(F) // vector of first derivatives
gradgradF = fvc::grad(gradF) // tensor of second derivatives

as far as gradF is fine/smooth, gradgradF is not anymore ...

Were you able to solve this problem ?


Henning86 February 15, 2013 18:27

sadly not.

for what do you need it?

ziemowitzima February 15, 2013 18:40

Dear Henning,
please see my post located at:

where I am writing about other way of dealing with second order mixed derivative.
What do you think about that ?


All times are GMT -4. The time now is 07:03.