source: trunk/procs/meshes/mesh_lmdz.pro @ 2

Last change on this file since 2 was 2, checked in by post_it, 17 years ago

Initial import from ~/POST_IT/

File size: 3.6 KB
Line 
1PRO mesh_lmdz, res, NO_SHIFT = no_shift, WHOLE_ARRAYS = whole_arrays
2@common
3@com_eg
4;
5; init grid, sf, masks for LMDZ grid
6;
7   CASE res OF
8      'low': print, ' LMDZ low resolution inits '
9      'high':print, ' LMDZ high resolution inits '
10      ELSE: stop
11   ENDCASE
12
13   CASE res OF
14      'low': BEGIN & jpi = 96L & jpj = 72L & jpk = 19L & key_shift = 0 & END
15      'high': BEGIN & jpi = 144L & jpj = 97L & jpk = 19L & key_shift = 0 & END
16   ENDCASE
17   IF keyword_set(NO_SHIFT) THEN key_shift = 0
18
19   jpiglo = jpi
20   jpjglo = jpj
21   jpkglo = jpk
22
23   ixminmesh  =0
24   ixmaxmesh  =jpi-1
25;
26   iyminmesh  =0
27   iymaxmesh  =jpj-1
28;
29   izminmesh  =0
30   izmaxmesh  =jpk-1
31
32; 1.  Define longitudes
33
34   glamt = 360.0*findgen(jpi)/float(jpi)-180
35   glamt = glamt#replicate(1, jpj)
36
37; 2 Define latitudes
38   CASE res OF
39      'low': BEGIN
40         gphit = 4*findgen(jpj/2)+2
41         gphit = [reverse(-gphit), gphit]
42         gphit = reverse(gphit)
43      END
44      'high': BEGIN
45         gphit = 2.5*findgen(jpj/2)+2.5
46         gphit = [reverse(-gphit), 0, gphit]
47         gphit = reverse(gphit)
48      END
49   ENDCASE
50   gphit = replicate(1, jpi)#gphit
51
52; 3 Define scale factors
53
54   zrad=6371229.0
55
56   ; Exact method: integration on a sphere
57
58   e1t = abs(2*!pi*zrad*sin(gphit*!pi/180.0)/jpi)
59
60   ytop = (shift(gphit, 0, -1)+gphit)*0.5*!pi/180.0
61   ybot = (shift(gphit, 0, +1)+gphit)*0.5*!pi/180.0
62   
63   ytop(*, jpj-1) = !pi/2
64   ybot(*,     0) = -!pi/2
65
66   e2t = zrad*(ytop-ybot)
67
68; 4. Define mask
69
70; open mask file
71   CASE res OF
72      'low': BEGIN
73;          model = 'lmdzl'
74;          s_file = hom_idl+'grids/grids_'+model+'.nc'
75;          tmask = nc_get(s_file, 'sftlf')
76;          tmask = shift(tmask,jpi/2, 0)
77;          tmask = reverse(tmask, 2)
78;          tmask =  tmask < 1
79;          tmask =  1-tmask
80         nummsk = 12
81         s_file = hom_idl+'grids/mask_lmdz_'+res
82         openr, nummsk, s_file, /get_lun, /f77
83         tmask = lonarr(jpi, jpj)
84         readu, nummsk, tmask
85; convention : 1 on sea, 0 on land
86         tmask = 1-tmask
87         close, nummsk
88         free_lun, nummsk
89      END
90      'high': BEGIN
91;         nummsk = 12
92;         s_file = hom_idl+'grids/mask_lmdz_'+res
93;         openr, nummsk, s_file, /get_lun, /f77
94         tmask = lonarr(jpi, jpj)
95;         readu, nummsk, tmask
96; convention : 1 on sea, 0 on land
97         tmask(*, *)= 1
98;         close, nummsk
99;         free_lun, nummsk
100      END
101   ENDCASE
102
103; 5. vertical grid (hPa)
104   gdept = [ 100426.5, 98327.56, 95346.5, 90966.84, 84776.86, 76536.46, $
105    66292.22, 54559.26, 42501.76, 31805.98, 23787.52, 18252.75, 13995.97, $
106    10320.8, 7191.053, 4661.738, 2732.851, 1345.618, 388.2433 ]
107
108   gdept = gdept/100.
109   gdepw = gdept
110
111   e3t = shift(gdept, 1)-gdept
112   e3t[0] = e3t[1]
113
114; Shift re-init U,V,F
115
116; key_shit to have first longitude at 20E
117
118   
119
120   glamt = shift(glamt,key_shift, 0)
121;   glamt(where(glamt LT 20) ) = glamt(where(glamt LT 20) )+360.
122   gphit = shift(gphit,key_shift, 0)
123   e1t = shift(e1t,key_shift, 0)
124   e2t = shift(e2t,key_shift, 0)
125   tmask = reform(shift(tmask,key_shift, 0), jpi*jpj)
126   tmask = reform(tmask#replicate(1, jpk), jpi, jpj, jpk)
127
128   glamu = glamt
129   gphiu = gphit
130   e1u = e1t
131   e2u = e2t
132   glamv = glamt
133   gphiv = gphit
134   e1v = e1t
135   e2v = e2t
136
137   glamf = 0.5*(shift(glamt, -1, 0)+glamt)
138   gphif = 0.5*(shift(gphit, 0, -1)+gphit)
139   glamf(jpi-1, *) =  glamf(jpi-2, *) + (glamf(jpi-2, *)-glamf(jpi-3, *))
140   gphif(*, jpj-1) =  gphif(*, jpj-2) + (gphif(*, jpj-2)-gphif(*, jpj-3))
141   e1f = e1t
142   e2f = e2t
143   
144   e3w = e3t
145   
146   key_periodique=1
147
148   key_offset = [0, 0, 0]
149;
150; indice i pour grille j moyenne zonale
151;
152   diaznl_idx = 1
153
154  return
155END
156
Note: See TracBrowser for help on using the repository browser.