[Thread Prev][Thread Next][Index]
Re: derivatives on an uneven grid
Hi Brent,
some weeks ago I ran into the same problem. I wrote a ferret script to
calculate first and second derivatives on an unequal grid:
let zet=z[gz=rho]
let h1=zet-zet[k=@shf:-1]
let h2=zet[k=@shf:1]-zet
let a=(-1)/(h1+h1*h1/h2)
let b=1/(h2+h2*h2/h1)
let c=(-1)*(a+b)
let rhoz=a*rho[k=@shf:-1]+b*rho[k=@shf:1]+c*rho
let aa=2/(h1*h1+h1*h2)
let bb=2/(h2*h2+h1*h2)
let cc=(-1)*(aa+bb)
let rhozz=aa*rho[k=@shf:-1]+bb*rho[k=@shf:1]+cc*rho
The variables rho and rhozz are now the first and second derivatives (in
the vertical direction) of the variable rho. The variable h1 is
the distance between the uppermost and the central
points. The variable h2 is the distance between the central and the
lowermost points. It can easily be seen that the centered difference
formulations will show up if h1=h2.
Hopefully this answers your questions. If there are any more questions
I'll be happy to answer them.
Regards,
John
------------------------------------------
John Donners
Royal Netherlands Meteorological Institute
Dept. Oceanographic Research
P.O. Box 201
Wilheminalaan 10
3730 AE De Bilt
tel. nr. : ++31 30 2206701
fax. nr. : ++31 30 2202570
e-mail : donners@knmi.nl
--------------------------------------------------------------
Zie ook/see also: http://www.knmi.nl/maildisclaimer.html
[Thread Prev][Thread Next][Index]
Dept of Commerce /
NOAA /
OAR /
PMEL /
TMAP
Contact Us | Privacy Policy | Disclaimer | Accessibility Statement