Ignore:
Timestamp:
Oct 22, 2010, 6:18:27 PM (14 years ago)
Author:
jghattas
Message:
  • Added variables written to file phystokenc.nc by option offline.
  • initphysto and phystokenc rewritten in F90
  • ener.h modified to be compatible with F77 and F90 syntax
File:
1 moved

Legend:

Unmodified
Added
Removed
  • LMDZ5/branches/LMDZ5V1.0-dev/libf/phylmd/initphysto.F90

    r1436 r1447  
    22! $Id$
    33!
    4 C
    5 C
    6       subroutine initphysto
    7      .  (infile,
    8      .  rlon, rlat, tstep,t_ops,t_wrt,nq,fileid)
    9        
    10        USE dimphy
    11        USE mod_phys_lmdz_para
    12        USE IOIPSL
    13        USE iophy
    14        USE control_mod
    15 
    16       implicit none
    17 
    18 C
    19 C   Routine d'initialisation des ecritures des fichiers histoires LMDZ
    20 C   au format IOIPSL
    21 C
    22 C   Appels succesifs des routines: histbeg
    23 C                                  histhori
    24 C                                  histver
    25 C                                  histdef
    26 C                                  histend
    27 C
    28 C   Entree:
    29 C
    30 C      infile: nom du fichier histoire a creer
    31 C      day0,anne0: date de reference
    32 C      tstep: duree du pas de temps en seconde
    33 C      t_ops: frequence de l'operation pour IOIPSL
    34 C      t_wrt: frequence d'ecriture sur le fichier
    35 C      nq: nombre de traceurs
    36 C
    37 C   Sortie:
    38 C      fileid: ID du fichier netcdf cree
    39 C      filevid:ID du fichier netcdf pour la grille v
    40 C
    41 C   L. Fairhead, LMD, 03/99
    42 C
    43 C =====================================================================
    44 C
    45 C   Declarations
    46 #include "dimensions.h"
    47 #include "paramet.h"
    48 #include "comconst.h"
    49 #include "comgeom.h"
    50 #include "temps.h"
    51 #include "ener.h"
    52 #include "logic.h"
    53 #include "description.h"
    54 #include "serre.h"
    55 #include "indicesol.h"
    56 cym#include "dimphy.h"
    57 
    58 C   Arguments
    59       character*(*) infile
    60       integer nhoriid, i
    61       real tstep, t_ops, t_wrt
    62       integer fileid, filevid
    63       integer nq,l
    64       real nivsigs(llm)
    65 
    66 C   Variables locales
    67 C
    68       integer tau0
    69       real zjulian
    70       character*3 str
    71       character*10 ctrac
    72       integer iq
    73       integer uhoriid, vhoriid, thoriid, zvertiid
    74       integer ii,jj
    75       integer zan, idayref
    76       logical ok_sync
    77       REAL zx_lon(iim,jjm+1), zx_lat(iim,jjm+1)
    78 C
    79       REAL rlon(klon), rlat(klon)
    80 
    81 C  Initialisations
    82 C
    83       pi = 4. * atan (1.)
    84       str='q  '
    85       ctrac = 'traceur   '
    86       ok_sync= .true.
    87 C
    88 C  Appel a histbeg: creation du fichier netcdf et initialisations diverses
    89 C         
    90 
    91       zan = annee_ref
    92       idayref = day_ref
    93       CALL ymds2ju(zan, 1, idayref, 0.0, zjulian)
    94       tau0 = 0
     4SUBROUTINE initphysto(infile,tstep,t_ops,t_wrt,fileid)
     5 
     6  USE dimphy
     7  USE mod_phys_lmdz_para
     8  USE IOIPSL
     9  USE iophy
     10  USE control_mod
     11 
     12  IMPLICIT NONE
     13
     14!
     15!   Routine d'initialisation des ecritures des fichiers histoires LMDZ
     16!   au format IOIPSL
     17!
     18!   Appels succesifs des routines: histbeg
     19!                                  histhori
     20!                                  histver
     21!                                  histdef
     22!                                  histend
     23!
     24!   Entree:
     25!
     26!      infile: nom du fichier histoire a creer
     27!      day0,anne0: date de reference
     28!      tstep: duree du pas de temps en seconde
     29!      t_ops: frequence de l'operation pour IOIPSL
     30!      t_wrt: frequence d'ecriture sur le fichier
     31!
     32!   Sortie:
     33!      fileid: ID du fichier netcdf cree
     34!
     35!   L. Fairhead, LMD, 03/99
     36!
     37! =====================================================================
     38!
     39!   Declarations
     40  INCLUDE "dimensions.h"
     41  INCLUDE "paramet.h"
     42  INCLUDE "comconst.h"
     43  INCLUDE "comgeom.h"
     44  INCLUDE "temps.h"
     45  INCLUDE "logic.h"
     46  INCLUDE "description.h"
     47  INCLUDE "serre.h"
     48  INCLUDE "indicesol.h"
     49
     50!   Arguments
     51  CHARACTER(len=*), INTENT(IN) :: infile
     52  REAL, INTENT(IN)             :: tstep
     53  REAL, INTENT(IN)             :: t_ops
     54  REAL, INTENT(IN)             :: t_wrt
     55  INTEGER, INTENT(OUT)         :: fileid
     56
     57! Variables locales
     58  INTEGER nhoriid, i
     59  INTEGER l,k
     60  REAL nivsigs(llm)
     61  INTEGER tau0
     62  REAL zjulian
     63  INTEGER iq
     64  INTEGER uhoriid, vhoriid, thoriid, zvertiid
     65  INTEGER ii,jj
     66  INTEGER zan, idayref
     67  LOGICAL ok_sync
     68  REAL zx_lon(iim,jjm+1), zx_lat(iim,jjm+1)
     69  CHARACTER(len=12) :: nvar
     70
     71!  Initialisations
     72!
     73  pi = 4. * ATAN (1.)
     74  ok_sync= .TRUE.
     75!
     76!  Appel a histbeg: creation du fichier netcdf et initialisations diverses
     77!         
     78
     79  zan = annee_ref
     80  idayref = day_ref
     81  CALL ymds2ju(zan, 1, idayref, 0.0, zjulian)
     82  tau0 = 0
     83 
     84  CALL histbeg_phy(infile,tau0, zjulian, tstep, &
     85       nhoriid, fileid)
     86
     87!$OMP MASTER   
     88!  Appel a histvert pour la grille verticale
     89!
     90  DO l=1,llm
     91     nivsigs(l)=REAL(l)
     92  ENDDO
     93 
     94  CALL histvert(fileid, 'sig_s', 'Niveaux sigma', &
     95       'sigma_level', &
     96       llm, nivsigs, zvertiid)
     97!
     98!  Appels a histdef pour la definition des variables a sauvegarder
     99!
     100  CALL histdef(fileid, "phis", "Surface geop. height", "-", &
     101       iim,jj_nb,nhoriid, 1,1,1, -99, 32, &
     102       "once", t_ops, t_wrt)
     103 
     104  CALL histdef(fileid, "aire", "Grid area", "-", &
     105       iim,jj_nb,nhoriid, 1,1,1, -99, 32, &
     106       "once", t_ops, t_wrt)
     107
     108  CALL histdef(fileid, "longitudes", "longitudes", "-", &
     109       iim,jj_nb,nhoriid, 1,1,1, -99, 32, &
     110       "once", t_ops, t_wrt)
     111
     112  CALL histdef(fileid, "latitudes", "latitudes", "-", &
     113       iim,jj_nb,nhoriid, 1,1,1, -99, 32, &
     114       "once", t_ops, t_wrt)
     115! T
     116  CALL histdef(fileid, 't', 'Temperature', 'K', iim, jj_nb, nhoriid, &
     117       llm, 1, llm, zvertiid, 32, 'inst(X)', t_ops, t_wrt)
     118! mfu
     119  CALL histdef(fileid, 'mfu', 'flx m. pan. mt', 'kg m/s',iim, jj_nb, nhoriid, &
     120       llm, 1, llm, zvertiid,32, 'inst(X)', t_ops, t_wrt)
     121! mfd
     122  CALL histdef(fileid, 'mfd', 'flx m. pan. des', 'kg m/s',iim, jj_nb, nhoriid, &
     123       llm, 1, llm, zvertiid, 32, 'inst(X)', t_ops, t_wrt)
     124! en_u
     125  CALL histdef(fileid, 'en_u', 'flx ent pan mt', 'kg m/s', iim, jj_nb, nhoriid, &
     126       llm, 1, llm, zvertiid,32, 'inst(X)', t_ops, t_wrt)
     127! de_u
     128  CALL histdef(fileid, 'de_u', 'flx det pan mt', 'kg m/s',iim, jj_nb, nhoriid, &
     129       llm, 1, llm, zvertiid,32, 'inst(X)', t_ops, t_wrt)
     130! en_d
     131  CALL histdef(fileid, 'en_d', 'flx ent pan dt', 'kg m/s', iim, jj_nb, nhoriid, &
     132       llm, 1, llm, zvertiid,32, 'inst(X)', t_ops, t_wrt)
     133! de_d
     134  CALL histdef(fileid, 'de_d', 'flx det pan dt', 'kg m/s', iim, jj_nb, nhoriid, &
     135       llm, 1, llm, zvertiid, 32, 'inst(X)', t_ops, t_wrt)
     136! coefh
     137  CALL histdef(fileid, "coefh", " ", " ", iim, jj_nb, nhoriid, &
     138       llm, 1, llm, zvertiid,32, "inst(X)", t_ops, t_wrt)
     139! fm_th
     140  CALL histdef(fileid, "fm_th", " ", " ",iim, jj_nb, nhoriid, &
     141       llm, 1, llm, zvertiid,32, "inst(X)", t_ops, t_wrt)
     142! en_th
     143  CALL histdef(fileid, "en_th", " ", " ",iim, jj_nb, nhoriid, &
     144       llm, 1, llm, zvertiid,32, "inst(X)", t_ops, t_wrt)
     145! frac_impa
     146  CALL histdef(fileid, 'frac_impa', ' ', ' ',iim, jj_nb, nhoriid, &
     147       llm, 1, llm, zvertiid,32, 'inst(X)', t_ops, t_wrt)
     148! frac_nucl
     149  CALL histdef(fileid, 'frac_nucl', ' ', ' ',iim, jj_nb, nhoriid, &
     150       llm, 1, llm, zvertiid,32, 'inst(X)', t_ops, t_wrt)
     151! pyu1
     152  CALL histdef(fileid, "pyu1", " ", " ", iim,jj_nb,nhoriid, &
     153       1,1,1, -99, 32, "inst(X)", t_ops, t_wrt)
     154! pyv1
     155  CALL histdef(fileid, "pyv1", " ", " ", iim,jj_nb,nhoriid, &
     156       1,1,1, -99, 32,"inst(X)", t_ops, t_wrt)   
     157! ftsol1
     158  CALL histdef(fileid, "ftsol1", " ", " ",iim, jj_nb, nhoriid, &
     159       1, 1,1, -99,32, "inst(X)", t_ops, t_wrt)
     160! ftsol2
     161  CALL histdef(fileid, "ftsol2", " ", " ",iim, jj_nb, nhoriid, &
     162       1, 1,1, -99,32, "inst(X)", t_ops, t_wrt)
     163! ftsol3
     164  CALL histdef(fileid, "ftsol3", " ", " ", iim, jj_nb, nhoriid, &
     165       1, 1,1, -99,32, "inst(X)", t_ops, t_wrt)
     166! ftsol4
     167  CALL histdef(fileid, "ftsol4", " ", " ",iim, jj_nb, nhoriid, &
     168       1, 1,1, -99, 32, "inst(X)", t_ops, t_wrt)
     169! psrf1
     170  CALL histdef(fileid, "psrf1", " ", " ",iim, jj_nb, nhoriid, &
     171       1, 1, 1, -99,32, "inst(X)", t_ops, t_wrt)
     172! psrf2
     173  CALL histdef(fileid, "psrf2", " ", " ",iim, jj_nb, nhoriid, &
     174       1, 1, 1, -99, 32, "inst(X)", t_ops, t_wrt)
     175! psrf3
     176  CALL histdef(fileid, "psrf3", " ", " ",iim, jj_nb, nhoriid, &
     177       1, 1, 1, -99, 32, "inst(X)", t_ops, t_wrt)
     178! psrf4
     179  CALL histdef(fileid, "psrf4", " ", " ", iim, jj_nb, nhoriid, &
     180       1, 1, 1, -99,32, "inst(X)", t_ops, t_wrt)
     181! sh
     182  CALL histdef(fileid, 'sh', '', '', iim, jj_nb, nhoriid, &
     183       llm, 1, llm, zvertiid, 32, 'inst(X)', t_ops, t_wrt)
     184! da
     185  CALL histdef(fileid, 'da', '', '', iim, jj_nb, nhoriid, &
     186       llm, 1, llm, zvertiid, 32, 'inst(X)', t_ops, t_wrt)
     187! mp
     188  CALL histdef(fileid, 'mp', '', '', iim, jj_nb, nhoriid, &
     189       llm, 1, llm, zvertiid, 32, 'inst(X)', t_ops, t_wrt)
     190! upwd
     191  CALL histdef(fileid, 'upwd', '', '', iim, jj_nb, nhoriid, &
     192       llm, 1, llm, zvertiid, 32, 'inst(X)', t_ops, t_wrt)
     193! dnwd
     194  CALL histdef(fileid, 'dnwd', '', '', iim, jj_nb, nhoriid, &
     195       llm, 1, llm, zvertiid, 32, 'inst(X)', t_ops, t_wrt)
     196
     197! phi
     198  DO k=1,llm
     199     IF (k<10) THEN
     200        WRITE(nvar,'(i1)') k
     201     ELSE IF (k<100) THEN
     202        WRITE(nvar,'(i2)') k
     203     ELSE
     204        WRITE(nvar,'(i3)') k
     205     END IF
     206     nvar='phi_lev'//trim(nvar)
     207     
     208     CALL histdef(fileid, nvar, '', '', iim, jj_nb, nhoriid, &
     209          llm, 1, llm, zvertiid, 32, 'inst(X)', t_ops, t_wrt)
     210  END DO
     211
     212  CALL histend(fileid)
     213  IF (ok_sync) CALL histsync
     214!$OMP END MASTER
    95215       
    96 cym     CALL gr_fi_ecrit(1,klon,iim,jjm+1,rlon,zx_lon)
    97 cym         DO i = 1, iim
    98 cym            zx_lon(i,1) = rlon(i+1)
    99 cym            zx_lon(i,jjm+1) = rlon(i+1)
    100 cym         ENDDO
    101 cym         CALL gr_fi_ecrit(1,klon,iim,jjm+1,rlat,zx_lat)
    102 
    103 
    104       call histbeg_phy(infile,tau0, zjulian, tstep,
    105      .                 nhoriid, fileid)
    106 
    107 c$OMP MASTER   
    108 C  Appel a histvert pour la grille verticale
    109 C
    110         DO l=1,llm
    111             nivsigs(l)=REAL(l)
    112          ENDDO
    113 
    114         write(*,*) 'avant histvert ds initphysto'
    115 
    116       call histvert(fileid, 'sig_s', 'Niveaux sigma',
    117      . 'sigma_level',
    118      .              llm, nivsigs, zvertiid)
    119 C
    120 C  Appels a histdef pour la definition des variables a sauvegarder
    121 C
    122         write(*,*) 'apres histvert ds initphysto'
    123 
    124        CALL histdef(fileid, "phis", "Surface geop. height", "-",
    125      .                iim,jj_nb,nhoriid, 1,1,1, -99, 32,
    126      .                "once", t_ops, t_wrt)
    127 c
    128         write(*,*) 'apres phis ds initphysto'
    129 
    130          CALL histdef(fileid, "aire", "Grid area", "-",
    131      .                iim,jj_nb,nhoriid, 1,1,1, -99, 32,
    132      .                "once", t_ops, t_wrt)
    133          write(*,*) 'apres aire ds initphysto'
    134 
    135 cym     Attention dtime et istphy ne sont pas �rit ---> a �iminer ?
    136          CALL histdef(fileid, "dtime", "tps phys ", "s",
    137      .                1,1,nhoriid, 1,1,1, -99, 32,
    138      .                "once", t_ops, t_wrt)
    139        
    140          CALL histdef(fileid, "istphy", "tps stock", "s",
    141      .                1,1,nhoriid, 1,1,1, -99, 32,
    142      .                "once", t_ops, t_wrt)
    143 
    144 C T
    145 C
    146       call histdef(fileid, 't', 'Temperature', 'K',
    147      .             iim, jj_nb, nhoriid, llm, 1, llm, zvertiid,
    148      .             32, 'inst(X)', t_ops, t_wrt)
    149         write(*,*) 'apres t ds initphysto'
    150 C mfu
    151 C
    152       call histdef(fileid, 'mfu', 'flx m. pan. mt', 'kg m/s',
    153      .             iim, jj_nb, nhoriid, llm, 1, llm, zvertiid,
    154      .             32, 'inst(X)', t_ops, t_wrt)
    155         write(*,*) 'apres mfu ds initphysto'
    156 C
    157 C mfd
    158 C
    159       call histdef(fileid, 'mfd', 'flx m. pan. des', 'kg m/s',
    160      .             iim, jj_nb, nhoriid, llm, 1, llm, zvertiid,
    161      .             32, 'inst(X)', t_ops, t_wrt)
    162 
    163 C
    164 C en_u
    165 C
    166       call histdef(fileid, 'en_u', 'flx ent pan mt', 'kg m/s',
    167      .             iim, jj_nb, nhoriid, llm, 1, llm, zvertiid,
    168      .             32, 'inst(X)', t_ops, t_wrt)
    169                write(*,*) 'apres en_u ds initphysto'
    170 C
    171 C de_u
    172 C
    173       call histdef(fileid, 'de_u', 'flx det pan mt', 'kg m/s',
    174      .             iim, jj_nb, nhoriid, llm, 1, llm, zvertiid,
    175      .             32, 'inst(X)', t_ops, t_wrt)
    176 
    177 C
    178 C en_d
    179 C
    180       call histdef(fileid, 'en_d', 'flx ent pan dt', 'kg m/s',
    181      .             iim, jj_nb, nhoriid, llm, 1, llm, zvertiid,
    182      .             32, 'inst(X)', t_ops, t_wrt)
    183 C
    184 
    185 C
    186 C de_d
    187 C
    188       call histdef(fileid, 'de_d', 'flx det pan dt', 'kg m/s',
    189      .             iim, jj_nb, nhoriid, llm, 1, llm, zvertiid,
    190      .             32, 'inst(X)', t_ops, t_wrt)
    191 
    192 c coefh frac_impa,frac_nucl
    193        
    194         call histdef(fileid, "coefh", " ", " ",
    195      .             iim, jj_nb, nhoriid, llm, 1, llm, zvertiid,
    196      .             32, "inst(X)", t_ops, t_wrt)
    197 
    198 c abderrahmane le 16 09 02
    199         call histdef(fileid, "fm_th", " ", " ",
    200      .             iim, jj_nb, nhoriid, llm, 1, llm, zvertiid,
    201      .             32, "inst(X)", t_ops, t_wrt)
    202 
    203         call histdef(fileid, "en_th", " ", " ",
    204      .             iim, jj_nb, nhoriid, llm, 1, llm, zvertiid,
    205      .             32, "inst(X)", t_ops, t_wrt)
    206 c fin aj
    207        
    208         write(*,*) 'apres coefh ds initphysto' 
    209 
    210         call histdef(fileid, 'frac_impa', ' ', ' ',
    211      .             iim, jj_nb, nhoriid, llm, 1, llm, zvertiid,
    212      .             32, 'inst(X)', t_ops, t_wrt)
    213        
    214         call histdef(fileid, 'frac_nucl', ' ', ' ',
    215      .             iim, jj_nb, nhoriid, llm, 1, llm, zvertiid,
    216      .             32, 'inst(X)', t_ops, t_wrt)
    217 
    218 c
    219 c pyu1
    220 c
    221       CALL histdef(fileid, "pyu1", " ", " ",
    222      .                iim,jj_nb,nhoriid, 1,1,1, -99, 32,
    223      .                "inst(X)", t_ops, t_wrt)
    224 
    225 c
    226 c pyv1
    227 c
    228         CALL histdef(fileid, "pyv1", " ", " ",
    229      .                iim,jj_nb,nhoriid, 1,1,1, -99, 32,
    230      .                "inst(X)", t_ops, t_wrt)
    231        
    232         write(*,*) 'apres pyv1 ds initphysto'
    233 c
    234 c ftsol1
    235 c
    236         call histdef(fileid, "ftsol1", " ", " ",
    237      .             iim, jj_nb, nhoriid, 1, 1,1, -99,32,
    238      .             "inst(X)", t_ops, t_wrt)
    239 
    240 c
    241 c ftsol2
    242 c
    243         call histdef(fileid, "ftsol2", " ", " ",
    244      .             iim, jj_nb, nhoriid, 1, 1,1, -99,32,
    245      .             "inst(X)", t_ops, t_wrt)
    246 
    247 c
    248 c ftsol3
    249 c
    250         call histdef(fileid, "ftsol3", " ", " ",
    251      .             iim, jj_nb, nhoriid, 1, 1,1, -99,
    252      .             32, "inst(X)", t_ops, t_wrt)
    253 
    254 c
    255 c ftsol4
    256 c
    257         call histdef(fileid, "ftsol4", " ", " ",
    258      .             iim, jj_nb, nhoriid, 1, 1,1, -99,
    259      .             32, "inst(X)", t_ops, t_wrt)
    260        
    261 c
    262 c rain
    263 c
    264         call histdef(fileid, "rain", " ", " ",
    265      .             iim, jj_nb, nhoriid, 1, 1,1, -99,
    266      .             32, "inst(X)", t_ops, t_wrt)
    267 
    268 c
    269 c psrf1
    270 c
    271         call histdef(fileid, "psrf1", " ", " ",
    272      .             iim, jj_nb, nhoriid, 1, 1, 1, -99,
    273      .             32, "inst(X)", t_ops, t_wrt)
    274        
    275 c
    276 c psrf2
    277 c
    278         call histdef(fileid, "psrf2", " ", " ",
    279      .             iim, jj_nb, nhoriid, 1, 1, 1, -99,
    280      .             32, "inst(X)", t_ops, t_wrt)
    281 
    282 c
    283 c psrf3
    284 c
    285         call histdef(fileid, "psrf3", " ", " ",
    286      .             iim, jj_nb, nhoriid, 1, 1, 1, -99,
    287      .             32, "inst(X)", t_ops, t_wrt)
    288 
    289 c
    290 c psrf4
    291 c
    292         call histdef(fileid, "psrf4", " ", " ",
    293      .             iim, jj_nb, nhoriid, 1, 1, 1, -99,
    294      .             32, "inst(X)", t_ops, t_wrt)
    295        
    296         write(*,*) 'avant histend ds initphysto'       
    297 
    298       call histend(fileid)
    299 c     if (ok_sync) call histsync(fileid)
    300       if (ok_sync) call histsync
    301 c$OMP END MASTER
    302        
    303 
    304       return
    305       end
     216END SUBROUTINE initphysto
Note: See TracChangeset for help on using the changeset viewer.