[Thread Prev][Thread Next][Index]

Re: [ferret_users] How to Calulate second order Derivatives



It is pretty straightforward to write any sort of derivative in Ferret. For example, GCMs typically have particular schemes for derivatives that are not the same as the simple centered or sideways derivatives in DDC, DDB or DDF; in analyzing model output, it is often desirable to use the same derivative algorithm as done in the actual model run. Here, as an illustration, is an example that implements the 4th-order derivative scheme in the Gent-Cane model. In this script, the grid shape is hardwired (see definitions of deglen and xx), but this could also be a passed argument.

Billy K
---------------------------------------------------------
! finds the 4th-order centered x-difference as in G/C model
! arg1=variable name

! constants etc needed
let pi=4.*atan(1.)
let deglen=111198.6 ! one degree latitude in meters
let deglenx=deglen*cos(pi*y[g=u]/180) ! one deg lon at latitude y

let xx = x[g=u] ! hardwire the grid-defining variable
let delx = deglenx*(xx[i=@shf:1]-xx[i=@shf:-1])/2
let d$1dx = ($1[i=@shf:-2] - 8*$1[i=@shf:-1] + 8*$1[i=@shf:1] - $1 [i=@shf:2]) / (12*delx)

On 5Jul 2006, at 8:34 AM, Ansley Manke wrote:

Hi Murali
Ferret does not have a transformation for second order derivatives. The @DDF, @DDB, and @DDC transformations just apply finite difference approximations for the derivatives. It would not be difficult, I suppose, to write an external function to do finite differences of higher orders. Has anyone done this?

Ansley

Murali Krishna wrote:
Dear Ferreters,

To calculate 1st order differntial expression (�P/�x) we are using the function transformations @DDF, @DDB or @DDC. Then how to calculate second order derivative (�2P/�x2)? and I saw lot of the people using the @DDC function for both Differential (dP/dx) and Partial Differential (�P/�x) expressions. what are the exact transformations to be used to perform these two operations. Please help me.

Thanks in advance.



With Regards,

Murali Krishna
--------------------------------------------------------------------- --------------------------

S.Murali Krishna,
Senior Research Fellow,
Indian National Centre for Ocean Information Services (INCOIS),
"Ocean Valley", P.B No.21,IDA Jeedimetla P.O,
Hyderabad - 500 055, India. Mobile:09885694594
smkrishna@incois.gov.in



[Thread Prev][Thread Next][Index]

Dept of Commerce / NOAA / OAR / PMEL / TMAP

Contact Us | Privacy Policy | Disclaimer | Accessibility Statement