Derivatives of U and V in curvilinear coordinates

Discussion about analysis, visualization, and collaboration tools and techniques

Moderators: arango, robertson

Post Reply
Message
Author
fcampos
Posts: 7
Joined: Fri Jul 07, 2017 7:34 pm
Location: cicese

Derivatives of U and V in curvilinear coordinates

#1 Post by fcampos » Thu May 03, 2018 11:36 am

Hello
I want to compute the derivative of U and V in curvilinear coordinates but in sigma (no Z) with the aim of compute the conversion of barotropic energy (similar to Marchesiello et al 2003). I did the code in matlab but I'm sure it's good. Can you help me please? I used part of the ROMS-Agrif Visualizations_tool code

Thank you very much.
Attachments
curv_derivatives.m
here the code
(1.85 KiB) Downloaded 70 times

lalvarez
Posts: 100
Joined: Wed Feb 03, 2010 6:59 pm
Location: Universidad Autonoma de Baja California Sur

Re: Derivatives of U and V in curvilinear coordinates

#2 Post by lalvarez » Sun May 06, 2018 10:43 pm

Hello fcampos

You have this
uom(i,:,:) = 2*squeeze(Hu(i,:,:))./(pm(:,1:L)+pm(:,2:Lp));
uon(i,:,:) = 2*squeeze(Hu(i,:,:))./(pn(:,1:L)+pn(:,2:Lp));
von(i,:,:) = 2*squeeze(Hv(i,:,:))./(pn(1:M,:)+pn(2:Mp,:));
vom(i,:,:) = 2*squeeze(Hv(i,:,:))./(pm(1:M,:)+pm(2:Mp,:));

how about
uom(i,:,:) = squeeze(2*((Hu(i,:,:))./(pm(:,1:L)+pm(:,2:Lp))));
uon(i,:,:) = squeeze(2*((Hu(i,:,:))./(pn(:,1:L)+pn(:,2:Lp))));
von(i,:,:) = squeeze(2*((Hv(i,:,:))./(pn(1:M,:)+pn(2:Mp,:))));
vom(i,:,:) = squeeze(2*((Hv(i,:,:))./(pm(1:M,:)+pm(2:Mp,:))));

perhaps it works

fcampos
Posts: 7
Joined: Fri Jul 07, 2017 7:34 pm
Location: cicese

Re: Derivatives of U and V in curvilinear coordinates

#3 Post by fcampos » Mon May 07, 2018 12:59 am

Hello.
The 2 affects all the matrix. So if you put it before or after "squeeze" affect the multiplication in a similar way. The purpose of my question is if the structure of the transformation into sigma coordinates (in matlab) is indeed good. in my opinion it is well written XD.

Thank you for your reply

Post Reply