Changeset 28 for trunk


Ignore:
Timestamp:
07/27/07 15:20:37 (17 years ago)
Author:
pinsard
Message:

forcagequimarche now run on my account in aedon

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/forcagequimarche.pro

    r2 r28  
    1 PRO forcagequimarche,iyear,ian  
    2 @init2 
    3 @initorca2_bab 
    4  
    5  
    6  
     1; + 
     2; 
     3; @file_comments 
     4; calcul d'une matrice 3D de conductivité sigma=f(T,S) en fonction de T et S 
     5; de ORCA, sur la grille T 
     6; 
     7; @categories 
     8; orca grid 
     9; 
     10; @param orcares {in}{required}{type=string} 
     11; code of ORCA grid to use for output results 
     12; must be 'ORCA2' 
     13; 
     14; @param iyear {in}{required}{type=integer} 
     15; real year 
     16; 
     17; @param ian {in}{required}{type=integer} 
     18; simulation year 
     19; 
     20; @keyword DRAKKAR_EXP {type=string} 
     21; code for Drakkar experiment 
     22; only used when orcares = ORCA025 
     23; must be G42 ++ G70 
     24; 
     25; @restrictions 
     26;  - Requires SAXO tools 
     27; 
     28; @todo 
     29; validation of ORCA2 processing (now some nan in output files !) 
     30; add ORCA025 
     31; provide tools to plot output files 
     32; produce a NetCDF GDT or CF compliant 
     33; 
     34; @pre 
     35; see geomag_profile.sh 
     36; be sure to have ++ in the directory defined in ${GEOMAG_ID}/ 
     37; 
     38; @post 
     39; see geomag_profile.sh 
     40; ++ in the directory defined in ${GEOMAG_OD}/ 
     41; 
     42; @examples 
     43; for ORCA2 
     44; IDL> .run forcagequimarche 
     45; IDL> forcagequimarche, 'ORCA2', '1993', '01' 
     46; 
     47; @history 
     48; fplod 2007-07-27T10:29:18Z cerbere.locean-ipsl.upmc.fr (Linux) 
     49; add orcares parameter 
     50; add optional keyword drakkar_exp 
     51; add header for idldoc 
     52; add check of io directories 
     53; replace io directories user dependant to $GEOMAG_ID and $GEOMAG_OD 
     54; replace call of divfred by call of div 
     55; 
     56; @version 
     57; $Id$ 
     58; 
     59;- 
     60; 
     61PRO forcagequimarche,orcares,iyear,ian,DRAKKAR_EXP = drakkar_exp 
     62; 
     63;---- 
     64; check input parameters 
     65;---- 
     66; 
     67; check orcares definition 
     68; 
     69  CASE orcares OF 
     70     'ORCA2': BEGIN 
     71                 msg = 'iii : valid orcares parameter = ' + orcares 
     72                 ras = report(msg) 
     73                 filename_oce = 'meshmask_bab.nc' 
     74                 IF keyword_set(DRAKKAR_EXP) THEN BEGIN 
     75                    msg = 'www : unused DRAKKAR_EXP keyword = ' + drakkar_exp 
     76                    ras = report(msg) 
     77                 END 
     78              END 
     79      ELSE  : BEGIN 
     80                 msg = 'eee : invalid orcares parameter = ' + orcares 
     81                 ras = report(msg) 
     82                 msg = 'eee : orcares must be ORCA2 or ORCA025++' 
     83                 ras = report(msg) 
     84                 RETURN 
     85              END 
     86  ENDCASE 
     87 
     88; ++ check iyear 
     89; ++ check ian 
     90 
     91;++@init2 
     92; init grid 
     93initocemeshmask, orcares, DRAKKAR_EXP = drakkar_exp 
    794 
    895@common 
    9  
    10  
    11  
    12 ;ian='01' 
    13 ;iyear='1993' 
    14  
     96; 
     97; check for input files 
     98; 
     99; test if ${GEOMAG_ID} defined 
     100  geomag_id_env=GETENV('GEOMAG_ID') 
     101  CASE geomag_id_env OF 
     102     ''  :  BEGIN 
     103              msg = 'eee : ${GEOMAG_ID} is not defined' 
     104              ras = report(msg) 
     105              RETURN 
     106            END 
     107     ELSE: BEGIN 
     108             msg = 'iii : ${GEOMAG_ID} is ' + geomag_id_env 
     109             ras = report(msg) 
     110           END 
     111  ENDCASE 
     112; 
     113  iodirin = isadirectory(geomag_id_env) 
     114; 
     115; existence and protection of ${GEOMAG_ID} 
     116  IF (FILE_TEST(iodirin, /DIRECTORY, /EXECUTABLE, /READ) EQ 0) THEN BEGIN 
     117     msg = 'eee : the directory' + iodirin  + ' is not accessible.' 
     118     ras = report(msg) 
     119     RETURN 
     120  ENDIF 
     121; 
     122; test if ${GEOMAG_OD} defined 
     123  geomag_od_env=GETENV('GEOMAG_OD') 
     124  CASE geomag_od_env OF 
     125     '' : BEGIN 
     126             msg = 'eee : ${GEOMAG_OD} is not defined' 
     127             ras = report(msg) 
     128             RETURN 
     129          END 
     130     ELSE: BEGIN 
     131             msg = 'iii : ${GEOMAG_OD} is ' + geomag_od_env 
     132             ras = report(msg) 
     133           END 
     134  ENDCASE 
     135; 
     136; check if output data will be possible 
     137  iodirout = isadirectory(geomag_od_env) 
     138; 
     139; existence and protection 
     140  IF (FILE_TEST(iodirout, /DIRECTORY, /WRITE) EQ 0) THEN BEGIN 
     141     msg = 'eee : the directory' + iodirout  + ' was not found.' 
     142     ras = report(msg) 
     143     RETURN 
     144  ENDIF 
     145; 
    15146e_exp='ESS' 
    16 rep_fred='/usr/work/sur/fvi/OPA/geomag/' 
    17147key_portrait = 0 
    18 ; stockage des fichiers brut  
    19   ioDATA='/usr/work/sur/fvi/OPA/ORCA2/' 
    20   file_U=e_exp+'_5d_'+ian+'0101_'+ian+'1231_grid_U.nc'  
    21   print, file_U 
    22   file_V=e_exp+'_5d_'+ian+'0101_'+ian+'1231_grid_V.nc'  
    23   print, file_V 
    24   file_T=e_exp+'_5d_'+ian+'0101_'+ian+'1231_grid_T.nc'  
    25   print, file_T 
    26   file_Sed= rep_fred+'cond_sed_ORCA2.nc' 
    27   file_Br= rep_fred+'Br_ORCA2.nc' 
    28  
    29  
     148; stockage des fichiers brut 
     149  ioDATA=geomag_id_env 
     150 
     151  CASE orcares OF 
     152     'ORCA2': BEGIN 
     153  file_U=e_exp+'_5d_'+ian+'0101_'+ian+'1231_grid_U.nc' 
     154  file_V=e_exp+'_5d_'+ian+'0101_'+ian+'1231_grid_V.nc' 
     155  file_T=e_exp+'_5d_'+ian+'0101_'+ian+'1231_grid_T.nc' 
     156  file_Sed= geomag_id_env+'cond_sed_ORCA2.nc' 
     157  file_Br= geomag_id_env+'Br_ORCA2.nc' 
     158     END 
     159  ENDCASE 
     160; 
    30161; title 
    31162     t_exp= e_exp 
    32 ;     t_exp0= e_exp0 
    33163     t_bt  = 'bar_transp' 
    34 ioORLN2 = '/usr/work/sur/fvi/OPA/ORCA2' 
     164ioORLN2 = geomag_id_env 
     165; 
    35166;facteur d'echelle vertical  for partial steps 
    36167e3v3d=read_ncdf('e3v_ps',0,/timestep,iodir=ioORLN2,/nostruct,/tout,filename='meshmask_bab.nc') 
     
    39170;BR=read_ncdf('Br',0,/timestep,/nostruct,/tout,filename=file_Br) 
    40171BR=read_ncdf('Br',0,/timestep,/nostruct,/tout,filename=file_Br,/cont_nofill) 
    41  
    42  
    43  
    44  
     172; 
    45173; vertical integration: 
    46 e3t3d=make_array(jpi,jpj,jpk)    
     174e3t3d=make_array(jpi,jpj,jpk) 
    47175        for k=0, jpk-1 do begin              &$ 
    48           for j=0,jpj-1 do begin              &$       
     176          for j=0,jpj-1 do begin              &$ 
    49177            for i=0,jpi-1 do begin             &$ 
    50178              e3t3d(i,j,k) = e3t(k)    &$ 
     
    53181        endfor 
    54182jpt = 73 
    55  
    56 ;vud = make_array(jpi,jpj,jpt)    
     183; 
     184;vud = make_array(jpi,jpj,jpt) 
    57185;vvd = make_array(jpi, jpj, jpt) 
    58186divBustar = make_array(jpi, jpj, jpt) 
    59187diver3=replicate(0.,182,149,1,73) 
    60188sigma3=replicate(0.,182,149,1,73) 
    61  
    62  
    63 FOR jt = 0, jpt-1 DO BEGIN &$    
    64  
     189; 
     190FOR jt = 0, jpt-1 DO BEGIN &$ 
     191; 
    65192; ouverture des fichiers et stockage en memoire partial steps 
    66   vu=read_ncdf('vozocrtx',jt,jt, /timestep, iodir=ioDATA,/nostruct,/TOUT,filename=file_U)  &$    
    67 ;stop 
    68   vv=read_ncdf('vomecrty',jt,jt, /timestep,iodir=ioDATA,/nostruct,/TOUT,filename=file_V)  &$    
     193  vu=read_ncdf('vozocrtx',jt,jt, /timestep, iodir=ioDATA,/nostruct,/TOUT,filename=file_U)  &$ 
     194;stop 
     195  vv=read_ncdf('vomecrty',jt,jt, /timestep,iodir=ioDATA,/nostruct,/TOUT,filename=file_V)  &$ 
    69196;stop 
    70197; lecture salinite & temperature 
     
    77204  conduct(mask_t)=0. 
    78205; Somme conduct au point T 
    79  
    80  
     206; 
    81207; Calcul SIGMA 
    82  
     208; 
    83209  SIGMAoc=total(conduct*e3t3d*tmask,3) 
    84210  SIGMA=SIGMAsed+SIGMAoc 
    85  
    86  
    87  
     211; 
    88212  SIGMA_u=(SIGMA+shift(SIGMA,-1,0))/2. 
    89  
    90213  SIGMA_v=(SIGMA+shift(SIGMA,0,1))/2. 
    91  
     214; 
    92215; Calcul B en points u et v 
    93  
     216; 
    94217  BR_u=(BR+shift(BR,-1,0))/2. 
    95  
    96218  BR_v=(BR+shift(BR,0,1))/2. 
    97  
    98  
     219; 
    99220; Calcul integrale conduct 
    100  
     221; 
    101222  conduct_u=(conduct+shift(conduct,-1,0,0))/2. 
    102  
    103223  conduct_v=(conduct+shift(conduct,0,1,0))/2. 
    104    
     224; 
    105225  u_cond_u=total( vu*conduct_u*e3u3d*umask(),3) 
    106  
    107226  v_cond_v=total( vv*conduct_v*e3v3d*vmask(),3) 
    108  
    109  
     227; 
    110228  Bu_star= BR_u*u_cond_u/SIGMA_u 
    111  
    112229  Bv_star= BR_v*v_cond_v/SIGMA_v 
    113  
     230; 
    114231; Divergence du champ 
    115  
    116   Diver=divfred(Bu_star,Bv_star) 
     232  Diver=div(Bu_star,Bv_star) 
    117233 
    118234Diver=Diver*1e-6 
     
    120236lecontinent=where(Diver GT 1.E08) 
    121237Diver(lecontinent)=0. 
    122  
    123  
    124238 
    125239;stop 
     
    134248sigma3(181,*,*,*)=sigma3(1,*,*,*) 
    135249 
    136  
    137250print,  jt 
    138251 
    139  
    140 ENDFOR   
     252ENDFOR 
    141253; on ferme le NetCDF 
    142254;NCDF_CLOSE,id3 
    143255;NCDF_CLOSE,id4 
    144  
    145  
    146  
    147256 
    148257temps=fltarr(73) 
     
    154263 
    155264   vargrid = 'T' 
    156    iodir = '/usr/work/sur/fvi/OPA/ORCA2/' 
     265   iodir = geomag_od_env 
    157266; Nom 
    158267   idout = NCDF_CREATE(iodir+'DivBustar_5d_'+iyear+'_grid_T.nc',/clobber) 
     
    203312; Creation de la latitude 
    204313   NCDF_VARPUT, idout, id1, gphit 
    205 ; Creation de la profondeur  
    206    NCDF_VARPUT, idout, id2, gdept  
     314; Creation de la profondeur 
     315   NCDF_VARPUT, idout, id2, gdept 
    207316; Creation du calendrier 
    208317 
    209318   NCDF_VARPUT, idout, id3, temps 
    210319 
    211     
     320 
    212321; Ecriture des donnees 
    213322 
    214 ; ecriture des glam_8  
     323; ecriture des glam_8 
    215324   NCDF_VARPUT, idout, id4 , diver3 
    216325 
     
    267376; Creation de la latitude 
    268377   NCDF_VARPUT, idout, id1, gphit 
    269 ; Creation de la profondeur  
    270    NCDF_VARPUT, idout, id2, gdept  
     378; Creation de la profondeur 
     379   NCDF_VARPUT, idout, id2, gdept 
    271380; Creation du calendrier 
    272381 
    273382   NCDF_VARPUT, idout, id3, temps 
    274383 
    275     
     384 
    276385; Ecriture des donnees 
    277386 
    278 ; ecriture des glam_8  
     387; ecriture des glam_8 
    279388   NCDF_VARPUT, idout, id4 , sigma3 
    280389 
Note: See TracChangeset for help on using the changeset viewer.