[2] | 1 | PRO forcageforMOED |
---|
| 2 | @init2 |
---|
| 3 | @initorca2_bab |
---|
| 4 | |
---|
| 5 | @common |
---|
| 6 | |
---|
| 7 | ian='01' |
---|
| 8 | iyear='1993' |
---|
| 9 | |
---|
| 10 | e_exp='ESS' |
---|
| 11 | rep_fred='/usr/work/sur/fvi/OPA/geomag/' |
---|
| 12 | key_portrait = 0 |
---|
| 13 | ; stockage des fichiers brut |
---|
| 14 | ioDATA='/usr/work/sur/fvi/OPA/ORCA2/' |
---|
| 15 | file_U=e_exp+'_5d_'+ian+'0101_'+ian+'1231_grid_U.nc' |
---|
| 16 | print, file_U |
---|
| 17 | file_V=e_exp+'_5d_'+ian+'0101_'+ian+'1231_grid_V.nc' |
---|
| 18 | print, file_V |
---|
| 19 | file_T=e_exp+'_5d_'+ian+'0101_'+ian+'1231_grid_T.nc' |
---|
| 20 | print, file_T |
---|
| 21 | file_Sed= rep_fred+'cond_sed_ORCA2.nc' |
---|
| 22 | file_Br= rep_fred+'Br_ORCA2.nc' |
---|
| 23 | |
---|
| 24 | |
---|
| 25 | ; title |
---|
| 26 | t_exp= e_exp |
---|
| 27 | |
---|
| 28 | t_bt = 'bar_transp' |
---|
| 29 | ioORLN2 = '/usr/work/sur/fvi/OPA/ORCA2' |
---|
| 30 | ;facteur d'echelle vertical for partial steps |
---|
| 31 | e3v3d=read_ncdf('e3v_ps',0,/timestep,iodir=ioORLN2,/nostruct,/tout,filename='meshmask_bab.nc') |
---|
| 32 | e3u3d=read_ncdf('e3u_ps',0,/timestep,iodir=ioORLN2,/nostruct,/tout,filename='meshmask_bab.nc') |
---|
| 33 | SIGMAsed=read_ncdf('cond_sed',0,/timestep,/nostruct,/tout,filename=file_Sed,/cont_nofill) |
---|
| 34 | BR=read_ncdf('Br',0,/timestep,/nostruct,/tout,filename=file_Br,/cont_nofill) |
---|
| 35 | |
---|
| 36 | |
---|
| 37 | |
---|
| 38 | |
---|
| 39 | |
---|
| 40 | ; vertical integration: |
---|
| 41 | e3t3d=make_array(jpi,jpj,jpk) |
---|
| 42 | for k=0, jpk-1 do begin &$ |
---|
| 43 | for j=0,jpj-1 do begin &$ |
---|
| 44 | for i=0,jpi-1 do begin &$ |
---|
| 45 | e3t3d(i,j,k) = e3t(k) &$ |
---|
| 46 | endfor &$ |
---|
| 47 | endfor &$ |
---|
| 48 | endfor |
---|
| 49 | jpt = 73 |
---|
| 50 | |
---|
| 51 | ;vud = make_array(jpi,jpj,jpt) |
---|
| 52 | ;vvd = make_array(jpi, jpj, jpt) |
---|
| 53 | divBustar = make_array(jpi, jpj, jpt) |
---|
| 54 | diver3=replicate(0.,182,149,1,73) |
---|
| 55 | sigma3=replicate(0.,182,149,1,73) |
---|
| 56 | Jpu=replicate(0.,182,149,1,73) |
---|
| 57 | Jpv=replicate(0.,182,149,1,73) |
---|
| 58 | |
---|
| 59 | |
---|
| 60 | FOR jt = 0, jpt-1 DO BEGIN &$ |
---|
| 61 | |
---|
| 62 | ; ouverture des fichiers et stockage en memoire partial steps |
---|
| 63 | vu=read_ncdf('vozocrtx',jt,jt, /timestep, iodir=ioDATA,/nostruct,/TOUT,filename=file_U) &$ |
---|
| 64 | ;stop |
---|
| 65 | vv=read_ncdf('vomecrty',jt,jt, /timestep,iodir=ioDATA,/nostruct,/TOUT,filename=file_V) &$ |
---|
| 66 | ;stop |
---|
| 67 | ; lecture salinite & temperature |
---|
| 68 | temp= read_ncdf('votemper',jt,jt,/timestep,iodir=ioDATA,/nostruct,/tout,filename=file_T) |
---|
| 69 | ;stop |
---|
| 70 | salin=read_ncdf('vosaline',jt,jt,/timestep,iodir=ioDATA,/nostruct,/tout,filename=file_T) |
---|
| 71 | ;stop |
---|
| 72 | conduct=0.02047780622061 + 0.00273147624197*temp + 0.00035133182334*temp*temp + 0.09139808809909*salin + 0.00241425798890*salin*temp -0.00023998958774*salin*salin |
---|
| 73 | mask_t=where(conduct GT 1.e+19) |
---|
| 74 | conduct(mask_t)=0. |
---|
| 75 | ; Somme conduct au point T |
---|
| 76 | |
---|
| 77 | |
---|
| 78 | ; Calcul SIGMA |
---|
| 79 | |
---|
| 80 | SIGMAoc=total(conduct*e3t3d*tmask,3) |
---|
| 81 | SIGMA=SIGMAsed+SIGMAoc |
---|
| 82 | |
---|
| 83 | |
---|
| 84 | |
---|
| 85 | SIGMA_u=(SIGMA+shift(SIGMA,-1,0))/2. |
---|
| 86 | |
---|
| 87 | SIGMA_v=(SIGMA+shift(SIGMA,0,1))/2. |
---|
| 88 | |
---|
| 89 | ; Calcul B en points u et v |
---|
| 90 | |
---|
| 91 | BR_u=(BR+shift(BR,-1,0))/2. |
---|
| 92 | |
---|
| 93 | BR_v=(BR+shift(BR,0,1))/2. |
---|
| 94 | |
---|
| 95 | |
---|
| 96 | ; Calcul integrale conduct |
---|
| 97 | |
---|
| 98 | conduct_u=(conduct+shift(conduct,-1,0,0))/2. |
---|
| 99 | |
---|
| 100 | conduct_v=(conduct+shift(conduct,0,1,0))/2. |
---|
| 101 | |
---|
| 102 | u_cond_u=total( vu*conduct_u*e3u3d*umask(),3) |
---|
| 103 | |
---|
| 104 | v_cond_v=total( vv*conduct_v*e3v3d*vmask(),3) |
---|
| 105 | |
---|
| 106 | |
---|
| 107 | ;calcul de Jp= u_star x Fz k |
---|
| 108 | Jpv_star= -1*BR_u*u_cond_u |
---|
| 109 | |
---|
| 110 | Jpu_star= BR_v*v_cond_v |
---|
| 111 | |
---|
| 112 | ; Divergence du champ |
---|
| 113 | |
---|
| 114 | Diver=divfred(Jpu_star,Jpv_star) |
---|
| 115 | |
---|
| 116 | Diver=Diver*1e-6 |
---|
| 117 | ;stop |
---|
| 118 | lecontinent=where(Diver GT 1.E08) |
---|
| 119 | Diver(lecontinent)=0. |
---|
| 120 | |
---|
| 121 | |
---|
| 122 | |
---|
| 123 | ;stop |
---|
| 124 | ;bande de recouvrement:: |
---|
| 125 | |
---|
| 126 | diver3(1:180,0:147,*,jt)=Diver(*,*) |
---|
| 127 | diver3(0,*,*,*)=diver3(180,*,*,*) |
---|
| 128 | diver3(181,*,*,*)=diver3(1,*,*,*) |
---|
| 129 | |
---|
| 130 | sigma3(1:180,0:147,*,jt)=SIGMA(*,*) |
---|
| 131 | sigma3(0,*,*,*)=sigma3(180,*,*,*) |
---|
| 132 | sigma3(181,*,*,*)=sigma3(1,*,*,*) |
---|
| 133 | |
---|
| 134 | Jpu(1:180,0:147,*,jt)=Jpu_star(*,*) |
---|
| 135 | Jpu(0,*,*,*)=Jpu(180,*,*,*) |
---|
| 136 | Jpu(181,*,*,*)=Jpu(1,*,*,*) |
---|
| 137 | |
---|
| 138 | Jpv(1:180,0:147,*,jt)=Jpv_star(*,*) |
---|
| 139 | Jpv(0,*,*,*)=Jpv(180,*,*,*) |
---|
| 140 | Jpv(181,*,*,*)=Jpv(1,*,*,*) |
---|
| 141 | |
---|
| 142 | |
---|
| 143 | |
---|
| 144 | |
---|
| 145 | print, jt |
---|
| 146 | |
---|
| 147 | |
---|
| 148 | ENDFOR |
---|
| 149 | |
---|
| 150 | |
---|
| 151 | |
---|
| 152 | |
---|
| 153 | temps=fltarr(73) |
---|
| 154 | temps(0)=0. |
---|
| 155 | for jt=0,71 do begin &$ |
---|
| 156 | temps(jt+1)=temps(jt) +5*86400. &$ |
---|
| 157 | endfor |
---|
| 158 | print,temps |
---|
| 159 | |
---|
| 160 | vargrid = 'T' |
---|
| 161 | iodir = '/usr/work/sur/fvi/OPA/ORCA2/' |
---|
| 162 | ; Nom |
---|
| 163 | idout = NCDF_CREATE(iodir+'ForcageMOED_5d_'+iyear+'_grid_T.nc',/clobber) |
---|
| 164 | print, 'Creation du fichier Netcdf' |
---|
| 165 | NCDF_CONTROL, idout, /nofill |
---|
| 166 | ; Dimension |
---|
| 167 | xidout = NCDF_DIMDEF(idout, 'x',jpiglo) |
---|
| 168 | yidout = NCDF_DIMDEF(idout, 'y',jpjglo) |
---|
| 169 | didout = NCDF_DIMDEF(idout, 'deptht',1) |
---|
| 170 | tidout = NCDF_DIMDEF(idout, 'time_counter', /unlimited) |
---|
| 171 | |
---|
| 172 | didout1 = NCDF_DIMDEF(idout, 'deptht1',jpk) |
---|
| 173 | |
---|
| 174 | |
---|
| 175 | ; Attributs globaux |
---|
| 176 | id0 = NCDF_VARDEF(idout, 'nav_lon' , [xidout, yidout ], /FLOAT) |
---|
| 177 | id1 = NCDF_VARDEF(idout, 'nav_lat' , [xidout, yidout ], /FLOAT) |
---|
| 178 | id2 = NCDF_VARDEF(idout, 'deptht' , [ didout1 ], /FLOAT) |
---|
| 179 | id3 = NCDF_VARDEF(idout, 'time_counter', [ tidout], /FLOAT) |
---|
| 180 | id4 = NCDF_VARDEF(idout, 'DivJp' , [xidout, yidout, didout, tidout], /DOUBLE) |
---|
| 181 | id5 = NCDF_VARDEF(idout, 'Sigma' , [xidout, yidout, didout, tidout], /DOUBLE) |
---|
| 182 | id6 = NCDF_VARDEF(idout, 'Jpu' , [xidout, yidout, didout, tidout], /DOUBLE) |
---|
| 183 | id7 = NCDF_VARDEF(idout, 'Jpv' , [xidout, yidout, didout, tidout], /DOUBLE) |
---|
| 184 | |
---|
| 185 | ; Variable 0 |
---|
| 186 | NCDF_ATTPUT, idout, id0, 'units', 'degrees_east' |
---|
| 187 | NCDF_ATTPUT, idout, id0, 'long_name', 'Longitude' |
---|
| 188 | NCDF_ATTPUT, idout, id0, 'nav_model', 'Default grid' |
---|
| 189 | ; Variable 1 |
---|
| 190 | NCDF_ATTPUT, idout, id1, 'units', 'degrees_north' |
---|
| 191 | NCDF_ATTPUT, idout, id1, 'long_name', 'Latitude' |
---|
| 192 | NCDF_ATTPUT, idout, id1, 'nav_model', 'Default grid' |
---|
| 193 | ; Variable 2 |
---|
| 194 | NCDF_ATTPUT, idout, id2, 'units','meters' |
---|
| 195 | NCDF_ATTPUT, idout, id2, 'long_name','Depth' |
---|
| 196 | NCDF_ATTPUT, idout, id2, 'nav_model','Default grid' |
---|
| 197 | ; Variable3 |
---|
| 198 | NCDF_ATTPUT, idout, id3, 'units', 'seconds since 0001-01-01 00:00:00 ' |
---|
| 199 | NCDF_ATTPUT, idout, id3, 'calendar','noleap' |
---|
| 200 | NCDF_ATTPUT, idout, id3, 'title', 'Time' |
---|
| 201 | NCDF_ATTPUT, idout, id3, 'long_name', 'Time axis' |
---|
| 202 | NCDF_ATTPUT, idout, id3, 'time_origin','0001-JAN-01 00:00:00' |
---|
| 203 | ; Variables |
---|
| 204 | NCDF_ATTPUT, idout, id4, 'long_name', 'Divergence Jp' |
---|
| 205 | ; Variables |
---|
| 206 | NCDF_ATTPUT, idout, id5, 'long_name', 'Total Conductance' |
---|
| 207 | NCDF_ATTPUT, idout, id6, 'long_name', 'Jpu=u_star x B (x comp)' |
---|
| 208 | NCDF_ATTPUT, idout, id7, 'long_name', 'Jpv=u_star x B (y comp)' |
---|
| 209 | |
---|
| 210 | |
---|
| 211 | NCDF_CONTROL, idout, /ENDEF |
---|
| 212 | |
---|
| 213 | ; Creation de la longitude |
---|
| 214 | NCDF_VARPUT, idout, id0, glamt |
---|
| 215 | ; Creation de la latitude |
---|
| 216 | NCDF_VARPUT, idout, id1, gphit |
---|
| 217 | ; Creation de la profondeur |
---|
| 218 | NCDF_VARPUT, idout, id2, gdept |
---|
| 219 | ; Creation du calendrier |
---|
| 220 | |
---|
| 221 | NCDF_VARPUT, idout, id3, temps |
---|
| 222 | |
---|
| 223 | |
---|
| 224 | ; Ecriture des donnees |
---|
| 225 | |
---|
| 226 | ; ecriture des glam_8 |
---|
| 227 | NCDF_VARPUT, idout, id4 , diver3 |
---|
| 228 | NCDF_VARPUT, idout, id5 , sigma3 |
---|
| 229 | NCDF_VARPUT, idout, id6 , Jpu |
---|
| 230 | NCDF_VARPUT, idout, id7 , Jpv |
---|
| 231 | |
---|
| 232 | |
---|
| 233 | |
---|
| 234 | NCDF_CLOSE, idout |
---|
| 235 | |
---|
| 236 | |
---|
| 237 | END |
---|