CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   Main CFD Forum (http://www.cfd-online.com/Forums/main/)
-   -   Finite difference schemes on non uniform grid (http://www.cfd-online.com/Forums/main/14234-finite-difference-schemes-non-uniform-grid.html)

charlie ryan October 12, 2007 11:47

Finite difference schemes on non uniform grid
 
Hi

i have a non uniform grid, and i would like to use a finite difference scheme upon it to solve a collection of coupled PDE's [i.e. use FD method to create a load of ODE's then solve these using Runge Kutta - Method of Lines]. But i am struggling to find a source for finite difference schemes with non-uniform grids, for approximating y_x and y_xx. I have found formulas for central differences, but would also like formulas for backward and foward differences, for both y_x and y_xx - does antone know of a reference that contains these? Or perhaps you could show me how to derive them?! Thanks in advance,

Charlie Ryan

Harish October 12, 2007 14:45

Re: Finite difference schemes on non uniform grid
 
Deriving them can be done using taylor series expansion.

Assume you want to find the derivative at node i using the points i-1,i,i+1.

fx_i = Af_i + B f_i-1 + C f_i+1

your aim is to find A,B,C now.Expand f_i+1 and f_i-1 using taylor expansion and assume (hn=abs(x_i-x_i-1) , hp=abs(x_i+1-x_i) )

f_i-1=f_i-hn fx_i+hn^2/2 fxx_i + HOT

f_i+1= f_i +hp fx_i +hp^2/2 fxx_i + HOT

substituting back you would get

fx_i=(A+B+C)f_i+(-B hn + C hp) fx_i +(B hn^2/2 + C hp^2/2)fxx_i

equating both sides u get three equations A+B+C =0 -B hn + C hp = 1 B hn^2 + C hp^2 =0

Solve to get A,B,C and you have the expansion.


cfd_newbie October 13, 2007 11:13

Re: Finite difference schemes on non uniform grid
 
A very good book for finite difference is:

"Computational Fluid Mechanics and Heat Transfer" by Dale A. Anderson, John C. Tannehill, R. H. Pletcher

I hope this could help you

charlie ryan October 18, 2007 11:32

Re: Finite difference schemes on non uniform grid
 
Hi

thanks for your responses - very helpful both of them. One Q - how do you calculate the error [the HOT?], from the finite difference approximation? Thanks Charlie


All times are GMT -4. The time now is 08:01.