CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Main CFD Forum (https://www.cfd-online.com/Forums/main/)
-   -   discontinuous second derivative (https://www.cfd-online.com/Forums/main/100659-discontinuous-second-derivative.html)

 new_at_this April 27, 2012 22:24

discontinuous second derivative

I am calculating the first and second derivative of a velocity profile. I am using a 3 point centered for the 1st derivative and 5 point central stencil for the 2nd derivative.

For some reason I am getting a discontinuous 2nd derivative but I have a smooth 1st derivative. Could some one explain what is going on?

 FMDenaro April 28, 2012 05:50

Quote:
 Originally Posted by new_at_this (Post 357593) I am calculating the first and second derivative of a velocity profile. I am using a 3 point centered for the 1st derivative and 5 point central stencil for the 2nd derivative. For some reason I am getting a discontinuous 2nd derivative but I have a smooth 1st derivative. Could some one explain what is going on?
could you post the plot of the original function?

 new_at_this April 28, 2012 10:44

here is the original velocity profile that was calculated from my cfd code. I am trying to find the inflection points in the profile

http://i1118.photobucket.com/albums/...g/velocity.jpg

1st derivative

http://i1118.photobucket.com/albums/...zhang/1der.jpg

2nd derivative

http://i1118.photobucket.com/albums/...ang/2deriv.jpg

 cdegroot April 28, 2012 12:29

What are you doing near the boundary for the 5 point stencil?

 new_at_this April 28, 2012 12:39

I am using the following formulas for the boundary point and the first interior point. I have also calculated the 2nd derivative with the 3point central scheme and my main problem is that it is showing an inflection point near the boundary of the flow but I do not expect that to be there.

 new_at_this April 28, 2012 12:54

The velocity profile was generated using a 2D navier stokes code on a staggered grid with dirichlet boundary conditions. I have run the code using parameters where I do not expect to see any inflection points but they still appear near the boundary. This makes me think that it is a consequence of the method I am using and not a physical property of the flow. Is this possible?

 FMDenaro April 28, 2012 13:12

Quote:
 Originally Posted by new_at_this (Post 358185) The velocity profile was generated using a 2D navier stokes code on a staggered grid with dirichlet boundary conditions. I have run the code using parameters where I do not expect to see any inflection points but they still appear near the boundary. This makes me think that it is a consequence of the method I am using and not a physical property of the flow. Is this possible?
First, if this is the solution in a laminar channel flow, it is not correct, you shoudl have a parabolic velocity profile and a linear first derivative. Furthermore, the second derivative along y is balanced by the pressure derivative along x which is constant

 new_at_this April 28, 2012 13:50

This is not channel flow. It is a lid driven cavity problem with both the upper and lower walls moving at RE ~ 500. Also could you elaborate on how the second derivative along y being balanced by the pressure derivative along x affects my problem?

 new_at_this April 28, 2012 14:59

So if I run a lid driven cavity flow for a square domain and a Re of 100 and take the velocity at x = 0.5, I find that there is an inflection point near the upper moving wall using a 3 point and a 5 point difference scheme for the second derivative. Conceptually I don't expect this to be there. Is there anyone that can explain what I am seeing?

 sbaffini April 28, 2012 16:55

I suggest you to check your derivative (1st and 2nd) function toward some simple case (say a sin function) and perform a grid refinement study to see that everything is fine.

My visual impression is that you kinda used a wrong sign near the boundaries (or for interior points). Also, the first formula you posted (the one for the first interior point) clearly has an error (i'm saying it just because if it is not a typo and you copied it from the code it could help you in find out where the problem is).

According to your second derivative plot, the first derivative one has a first derivative (sorry about this sentence) which is always negative but, according to the image, this does not seem to be the case.

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