[Thread Prev][Thread Next][Index]

Re: [ferret_users] computation of derivatives



Dear Ferreters
G'day

I am attaching an image in which there are four terms that I am trying to compute. 
term-1 = d(theta)/d(time) on z depth
term-2 = d(theta)/d(time) on n depth
term-3 = d(z)/d(time) on n depth
term-4 = d(theta)/d(z)

In my understanding...
term-1 is the differentiation of theta w.r.t. time and can be calculated as theta[l=@ddc]. However, here I am having confusion that whether the term-1 is a differentiation or linear trend.

or shall I compute the derivatives w.r.t. time and then compute the slope?

In ferret, differentiation are having operators like @ddc and the slope is from go regress. @ddc considers all the points but the slope depends on the final and initial terms. 

Cheers, Saurabh

On Wed, Dec 7, 2022 at 1:59 PM saurabh rathore <rohitsrb2020@xxxxxxxxx> wrote:
Hello Ryo
Thank you for your reply.
I am working on it and will let you know once it is done.

Cheers, Saurabh

On Tue, Dec 6, 2022 at 5:47 PM Ryo Furue <furue@xxxxxxxxxx> wrote:
Dear Saurabh

On Tue, Dec 6, 2022 at 7:48 AM saurabh rathore <rohitsrb2020@xxxxxxxxx> wrote:

here is the problem that I am having variables var1(time,lev,lat,lon) and var2(time,lev,lat,lon) and I want to differentiate var1 w.r.t. var2 i.e. d(var1)/d(var2).


Before discussing how to implement it in Ferret, we need to make it clear what you mean by d(var1)/d(var2) in a multidimensional space.

To illustrate the problem, let's consider 2D variables var1(x,y) and var2(x,y). Along a zonal section at a fixed latitude y0, we observe how these variables change:

var1(x + dx, y0) = var1(x, y0) + [∂(var1)/∂x] dx,
var2(x + dx, y0) = var1(x, y0) + [∂(var2)/∂x] dx.

So the changes are

d(var1) = [∂(var1)/∂x] dx,
d(var2) = [∂(var2)/∂x] dx.

Along this zonal section, therefore,

d(var1)/d(var2)
= {[∂(var1)/∂x] dx} / {[∂(var2)/∂x] dx}
= [∂(var1)/∂x] / [∂(var2)/∂x]

This result is the same as a 1D case.  You can easily implement this in Ferret using the partial derivative operator(s) in the x direction.

Similarly, along a meridional, you get d(var1)/d(var2) =  [∂(var1)/∂y] / [∂(var2)/∂y].

Along an arbitrary section, we move from point (x,y) to point (x + dx, y + dy) and observe

var1(x+dx, y+dy)
= var1(x, y) + [∂(var1)/∂x] dx +  [∂(var1)/∂y] dy
= var1(x,y) + {[∂(var1)/∂x] cos θ +  [∂(var1)/∂y] sin θ} dl,

where dl = sqrt(dx^2 + dy^2) is the length of the (dx,dy) vector and θ is the angle that the vector makes from due east.  So,

d(var1) =  {[∂(var1)/∂x] cos θ +  [∂(var1)/∂y] sin θ} dl.

Likewise for d(var2).  Therefore,

d(var1)/d(var2) =  {[∂(var1)/∂x] cos θ +  [∂(var1)/∂y] sin θ} /  {[∂(var2)/∂x] cos θ +  [∂(var2)/∂y] sin θ}

in the direction θ.

In the 4D space (x,y,z,t), you specify the direction (dx, dy, dz, dt) and do the same as the above.

Cheers,

Ryo

Attachment: heave-spice-1.png
Description: PNG image


[Thread Prev][Thread Next][Index]
Contact Us
Dept of Commerce / NOAA / OAR / PMEL / Ferret

Privacy Policy | Disclaimer | Accessibility Statement