Derivatives of U and V in curvilinear coordinates

Discussion about analysis, visualization, and collaboration tools and techniques

Moderators: arango, robertson

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

Derivatives of U and V in curvilinear coordinates

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

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

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,:));

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

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.