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

Calculate derivatives in a non-uniform grid

Register Blogs Community New Posts Updated Threads Search

Like Tree6Likes
  • 1 Post By Moreza7
  • 1 Post By Светлана
  • 1 Post By Moreza7
  • 1 Post By Светлана
  • 2 Post By FMDenaro

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 1, 2019, 07:08
Default Calculate derivatives in a non-uniform grid
  #1
Senior Member
 
Join Date: Jan 2018
Posts: 121
Rep Power: 8
Moreza7 is on a distinguished road
I have a non-uniform 2D grid (non-equal intervals between nodes). [x,y]
I also have the data (U) calculated on this grid.
I want to calculate the derivatives of U with respect to y and then x.

How can I do this? (Specially using MATLAB)
Светлана likes this.
Moreza7 is offline   Reply With Quote

Old   August 1, 2019, 07:17
Default
  #2
Senior Member
 
Svetlana Tkachenko
Join Date: Oct 2013
Location: Australia, Sydney
Posts: 407
Rep Power: 14
Светлана is on a distinguished road
Is it rectangular grid?



You could just use matrix operations ie


dmyfdx = (myf(2:end)-myf(1:end-1)) / (coordx(2:end)-coordx(1:end-1))


where myf is your variable and coordx is the x coordinate in the grid. If this is not sufficiently helpful then please create a small test case demonstrating the data format in a small example. Thanks.
Moreza7 likes this.
Светлана is offline   Reply With Quote

Old   August 1, 2019, 07:45
Default
  #3
Senior Member
 
Join Date: Jan 2018
Posts: 121
Rep Power: 8
Moreza7 is on a distinguished road
Quote:
Originally Posted by Светлана View Post
Is it rectangular grid?



You could just use matrix operations ie


dmyfdx = (myf(2:end)-myf(1:end-1)) / (coordx(2:end)-coordx(1:end-1))


where myf is your variable and coordx is the x coordinate in the grid. If this is not sufficiently helpful then please create a small test case demonstrating the data format in a small example. Thanks.
Yes, it is rectangular ,but your solution is only useful for first order - first derivative. How about second order and second derivative?
Светлана likes this.
Moreza7 is offline   Reply With Quote

Old   August 1, 2019, 17:17
Default
  #4
Senior Member
 
Svetlana Tkachenko
Join Date: Oct 2013
Location: Australia, Sydney
Posts: 407
Rep Power: 14
Светлана is on a distinguished road
I think you can view the formulas here


http://web.media.mit.edu/~crtaylor/calculator.html


Vary the number of input points to get the desired order of accuracy.
Moreza7 likes this.
Светлана is offline   Reply With Quote

Old   August 1, 2019, 17:39
Default
  #5
Senior Member
 
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,768
Rep Power: 71
FMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura about
Quote:
Originally Posted by Moreza7 View Post
Yes, it is rectangular ,but your solution is only useful for first order - first derivative. How about second order and second derivative?



For example, you have the value f1,f2,f3 at x1,x2,x3. Then you can define a lagrangian second degree polynomial and compute analytically the derivative. More nodes allow you to increase the degree of the polynomial and the accuracy of the derivative.


Have also a look to the textbook of Peric & Ferziger
Светлана and Moreza7 like this.
FMDenaro is offline   Reply With Quote

Old   August 2, 2019, 01:23
Default
  #6
Senior Member
 
Join Date: Jan 2018
Posts: 121
Rep Power: 8
Moreza7 is on a distinguished road
Quote:
Originally Posted by Светлана View Post
I think you can view the formulas here


http://web.media.mit.edu/~crtaylor/calculator.html


Vary the number of input points to get the desired order of accuracy.
Thank you ,but this is for uniform grids.

Last edited by Moreza7; August 2, 2019 at 03:37.
Moreza7 is offline   Reply With Quote

Reply

Tags
derivatives, non-uniform grid


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 Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
dsmcFoam setup hherbol OpenFOAM Pre-Processing 1 November 19, 2021 01:52
Inlet patch problems martyn88 OpenFOAM Running, Solving & CFD 6 April 21, 2017 18:34
LES supersonic free jet martyn88 OpenFOAM 22 April 17, 2015 06:00
Divergent temperature in chtMultiRegion(Simple)Foam akrasemann OpenFOAM Running, Solving & CFD 13 March 24, 2014 02:54
Combustion Convergence problems Art Stretton Phoenics 5 April 2, 2002 05:59


All times are GMT -4. The time now is 12:46.