CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Main CFD Forum

discontinuous second derivative

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   April 27, 2012, 22:24
Default discontinuous second derivative
  #1
Member
 
Peter
Join Date: Oct 2011
Posts: 52
Rep Power: 5
new_at_this is on a distinguished road
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?
new_at_this is offline   Reply With Quote

Old   April 28, 2012, 05:50
Default
  #2
Senior Member
 
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 1,651
Rep Power: 23
FMDenaro will become famous soon enough
Quote:
Originally Posted by new_at_this View Post
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?
FMDenaro is offline   Reply With Quote

Old   April 28, 2012, 10:44
Default
  #3
Member
 
Peter
Join Date: Oct 2011
Posts: 52
Rep Power: 5
new_at_this is on a distinguished road
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
new_at_this is offline   Reply With Quote

Old   April 28, 2012, 12:29
Default
  #4
Senior Member
 
Chris DeGroot
Join Date: Nov 2011
Location: Canada
Posts: 387
Rep Power: 6
cdegroot is on a distinguished road
What are you doing near the boundary for the 5 point stencil?
cdegroot is offline   Reply With Quote

Old   April 28, 2012, 12:39
Default
  #5
Member
 
Peter
Join Date: Oct 2011
Posts: 52
Rep Power: 5
new_at_this is on a distinguished road
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.

f''_j = \frac{11f_{j-1}-20f_j+6f_{j+2}+4f_{j+2}-f_{j+3}}{12\Delta x^2}
f''_j = \frac{35f_j-104f_{j+1}+114f_{j+2}-56f_{j+3}+11f_{j+4}}{12\Delta x^2}
new_at_this is offline   Reply With Quote

Old   April 28, 2012, 12:54
Default
  #6
Member
 
Peter
Join Date: Oct 2011
Posts: 52
Rep Power: 5
new_at_this is on a distinguished road
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?
new_at_this is offline   Reply With Quote

Old   April 28, 2012, 13:12
Default
  #7
Senior Member
 
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 1,651
Rep Power: 23
FMDenaro will become famous soon enough
Quote:
Originally Posted by new_at_this View Post
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
FMDenaro is offline   Reply With Quote

Old   April 28, 2012, 13:50
Default
  #8
Member
 
Peter
Join Date: Oct 2011
Posts: 52
Rep Power: 5
new_at_this is on a distinguished road
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 is offline   Reply With Quote

Old   April 28, 2012, 14:59
Default
  #9
Member
 
Peter
Join Date: Oct 2011
Posts: 52
Rep Power: 5
new_at_this is on a distinguished road
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?
new_at_this is offline   Reply With Quote

Old   April 28, 2012, 16:55
Default
  #10
Senior Member
 
sbaffini's Avatar
 
Paolo Lampitella
Join Date: Mar 2009
Location: Italy
Posts: 534
Blog Entries: 14
Rep Power: 17
sbaffini will become famous soon enough
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.
sbaffini is offline   Reply With Quote

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Derivative matrix jollage Main CFD Forum 0 September 21, 2011 18:16
can i get pressure derivative in UDF? ruirui389 Fluent UDF and Scheme Programming 4 April 8, 2011 04:12
scalar and its derivative sucker Main CFD Forum 1 April 15, 2008 13:28
Obtaining substantial or partial derivative of vel KRK FLUENT 0 January 10, 2007 13:35
Second derivative with cfx 5.7.1 Alessandro CFX 10 April 21, 2006 10:31


All times are GMT -4. The time now is 23:57.