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.
Derivatives of U and V in curvilinear coordinates
Derivatives of U and V in curvilinear coordinates
- Attachments
-
curv_derivatives.m
- here the code
- (1.85 KiB) Downloaded 321 times
-
- Posts: 106
- 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,:));
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
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
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.
Thank you for your reply
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