/[MITgcm]/MITgcm_contrib/tides/tide_rot.m
ViewVC logotype

Contents of /MITgcm_contrib/tides/tide_rot.m

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (show annotations) (download)
Thu Mar 21 01:30:27 2013 UTC (11 years, 1 month ago) by dimitri
Branch: MAIN
CVS Tags: HEAD
adding Xiochun Wang's scripts for computing tidal forcing for regional
MITgcm configurations

1 % function [utide_am1 utide_ph1 vtide_am1 vtide_ph1] = tide_rot(utide_am0,utide_ph0,vtide_am0,vtide_ph0,angleCS, angleSN)
2 %
3 % Rotate tidal current parameter from NS and EW to a new coordinate defined by angleCS and angleSN
4 %
5 % Input: utide_am0, utide_ph0(in deg)
6 % vtide_am0, vtide_ph0(in deg)
7 % AngleCS angleSN: cos(alpha), sin(alpha);
8 % alpha is the angle between new coordinate (utide_am1, vtide_am1) and due east
9 %
10 % Output: utide_am1, utide_ph1(in deg)
11 % vtide_am1, vtide_ph1(in deg);
12 %
13 % Both input and output are assumed (1 L) array
14 %
15 % XC WANG /07/12/2012
16 %
17 function [utide_am1 utide_ph1 vtide_am1 vtide_ph1] = tide_rot(utide_am0,utide_ph0,vtide_am0,vtide_ph0,angleCS,angleSN)
18
19 rad2deg = 180/pi ;
20 deg2rad = pi/180 ;
21
22 % Convert deg to radian
23 utide_ph0 = utide_ph0*deg2rad ;
24 vtide_ph0 = vtide_ph0*deg2rad ;
25
26 u1_p1 = utide_am0.*angleCS.*cos(utide_ph0) + vtide_am0.*angleSN.*cos(vtide_ph0) ;
27 u1_p2 = utide_am0.*angleCS.*sin(utide_ph0) + vtide_am0.*angleSN.*sin(vtide_ph0) ;
28
29 utide_am1 = sqrt(u1_p1.*u1_p1 + u1_p2.*u1_p2) ;
30 sin1 = u1_p2 ./ utide_am1 ;
31 cos1 = u1_p1 ./ utide_am1 ;
32 utide_ph1 = atan2(sin1, cos1) ;
33 utide_ph1 = utide_ph1*rad2deg ;
34
35 v1_p1 = -utide_am0.*angleSN.*cos(utide_ph0) + vtide_am0.*angleCS.*cos(vtide_ph0) ;
36 v1_p2 = -utide_am0.*angleSN.*sin(utide_ph0) + vtide_am0.*angleCS.*sin(vtide_ph0) ;
37 vtide_am1 = sqrt(v1_p1 .* v1_p1 + v1_p2.*v1_p2) ;
38 sin1 = v1_p2 ./ vtide_am1 ;
39 cos1 = v1_p1 ./ vtide_am1 ;
40 vtide_ph1 = atan2(sin1, cos1) ;
41 vtide_ph1 = vtide_ph1*rad2deg ;
42
43 return
44 end

  ViewVC Help
Powered by ViewVC 1.1.22