/[lmdze]/trunk/Sources/phylmd/phyredem.f
ViewVC logotype

Diff of /trunk/Sources/phylmd/phyredem.f

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

trunk/libf/phylmd/phyredem.f90 revision 72 by guez, Tue Jul 23 13:00:07 2013 UTC trunk/Sources/phylmd/phyredem.f revision 140 by guez, Fri Jun 5 18:58:06 2015 UTC
# Line 4  module phyredem_m Line 4  module phyredem_m
4    
5  contains  contains
6    
7    SUBROUTINE phyredem(fichnom, rlat, rlon, pctsrf, tsol, tsoil, tslab, &    SUBROUTINE phyredem(fichnom, pctsrf, tsol, tsoil, tslab, seaice, qsurf, &
8         seaice, qsurf, qsol, snow, albedo, alblw, evap, rain_fall, snow_fall, &         qsol, snow, albedo, alblw, evap, rain_fall, snow_fall, solsw, sollw, &
9         solsw, sollw, fder, radsol, frugs, agesno, zmea, zstd, zsig, zgam, &         fder, radsol, frugs, agesno, zmea, zstd, zsig, zgam, zthe, zpic, zval, &
10         zthe, zpic, zval, t_ancien, q_ancien, rnebcon, ratqs, clwcon, &         t_ancien, q_ancien, rnebcon, ratqs, clwcon, run_off_lic_0, sig1, w01)
        run_off_lic_0, sig1, w01)  
11    
12      ! From phylmd/phyredem.F, version 1.3 2005/05/25 13:10:09      ! From phylmd/phyredem.F, version 1.3, 2005/05/25 13:10:09
13      ! Author: Z. X. Li (LMD/CNRS)      ! Author: Z. X. Li (LMD/CNRS)
14      ! Date: 19930818      ! Date: 1993/08/18
15      ! Objet : écriture de l'état de démarrage ou redémarrage pour la physique  
16        ! Objet : \'ecriture de l'\'etat de d\'emarrage ou red\'emarrage
17        ! pour la physique
18    
19      USE dimphy, ONLY: klev, klon, zmasq      USE dimphy, ONLY: klev, klon, zmasq
20      USE dimsoil, ONLY: nsoilmx      USE dimsoil, ONLY: nsoilmx
# Line 21  contains Line 22  contains
22      USE netcdf, ONLY: nf90_clobber, nf90_global, nf90_float      USE netcdf, ONLY: nf90_clobber, nf90_global, nf90_float
23      USE netcdf95, ONLY: nf95_create, nf95_put_att, nf95_def_dim, &      USE netcdf95, ONLY: nf95_create, nf95_put_att, nf95_def_dim, &
24           nf95_def_var, nf95_enddef, nf95_redef, nf95_put_var, nf95_close           nf95_def_var, nf95_enddef, nf95_redef, nf95_put_var, nf95_close
25        use phyetat0_m, only: rlat, rlon
26      USE temps, ONLY: itau_phy      USE temps, ONLY: itau_phy
27    
28      CHARACTER(len=*) fichnom      CHARACTER(len=*), INTENT(IN):: fichnom
29      REAL, INTENT(IN):: rlat(klon), rlon(klon)      REAL, INTENT(IN):: pctsrf(:, :) ! (klon, nbsrf)
30      REAL pctsrf(klon, nbsrf)      REAL, INTENT(IN):: tsol(:, :) ! (klon, nbsrf)
31      REAL tsol(klon, nbsrf)      REAL, INTENT(IN):: tsoil(:, :, :) ! (klon, nsoilmx, nbsrf)
32      REAL tsoil(klon, nsoilmx, nbsrf)      REAL, INTENT(IN):: tslab(:), seaice(:) ! (klon) slab ocean
33      REAL tslab(klon), seaice(klon) !IM "slab" ocean      REAL, INTENT(IN):: qsurf(:, :) ! (klon, nbsrf)
34      REAL qsurf(klon, nbsrf)  
35      REAL, intent(in):: qsol(klon)      REAL, intent(in):: qsol(:) ! (klon)
36      REAL snow(klon, nbsrf)      ! column-density of water in soil, in kg m-2
37      REAL albedo(klon, nbsrf)  
38      REAL alblw(klon, nbsrf)      REAL, INTENT(IN):: snow(klon, nbsrf)
39      REAL evap(klon, nbsrf)      REAL, INTENT(IN):: albedo(klon, nbsrf)
40        REAL, INTENT(IN):: alblw(klon, nbsrf)
41        REAL, INTENT(IN):: evap(klon, nbsrf)
42      REAL, INTENT(IN):: rain_fall(klon)      REAL, INTENT(IN):: rain_fall(klon)
43      REAL snow_fall(klon)      REAL, INTENT(IN):: snow_fall(klon)
44      REAL solsw(klon)      REAL, INTENT(IN):: solsw(klon)
45      REAL, INTENT(IN):: sollw(klon)      REAL, INTENT(IN):: sollw(klon)
46      REAL fder(klon)      REAL, INTENT(IN):: fder(klon)
47      REAL radsol(klon)      REAL, INTENT(IN):: radsol(klon)
48      REAL frugs(klon, nbsrf)      REAL, INTENT(IN):: frugs(klon, nbsrf)
49      REAL agesno(klon, nbsrf)      REAL, INTENT(IN):: agesno(klon, nbsrf)
50      REAL zmea(klon)      REAL, INTENT(IN):: zmea(klon)
51      REAL, intent(in):: zstd(klon)      REAL, intent(in):: zstd(klon)
52      REAL, intent(in):: zsig(klon)      REAL, intent(in):: zsig(klon)
53      REAL zgam(klon)      REAL, intent(in):: zgam(klon)
54      REAL zthe(klon)      REAL, intent(in):: zthe(klon)
55      REAL zpic(klon)      REAL, intent(in):: zpic(klon)
56      REAL zval(klon)      REAL, intent(in):: zval(klon)
57      REAL t_ancien(klon, klev), q_ancien(klon, klev)      REAL, intent(in):: t_ancien(klon, klev), q_ancien(klon, klev)
58      REAL rnebcon(klon, klev), ratqs(klon, klev), clwcon(klon, klev)      REAL, intent(in):: rnebcon(klon, klev), ratqs(klon, klev)
59      REAL run_off_lic_0(klon)      REAL, intent(in):: clwcon(klon, klev)
60        REAL, intent(in):: run_off_lic_0(klon)
61      real, intent(in):: sig1(klon, klev) ! section adiabatic updraft      real, intent(in):: sig1(klon, klev) ! section adiabatic updraft
62    
63      real, intent(in):: w01(klon, klev)      real, intent(in):: w01(klon, klev)
# Line 60  contains Line 65  contains
65    
66      ! Local:      ! Local:
67    
68      INTEGER ncid, idim2, idim3      INTEGER ncid, idim2, idim3, dimid_nbsrf, dimid_nsoilmx
69      integer varid, varid_run_off_lic_0, varid_sig1, varid_w01      integer varid, varid_run_off_lic_0, varid_sig1, varid_w01, varid_rlon
70      INTEGER isoil, nsrf      integer varid_rlat, varid_zmasq, varid_fter, varid_flic, varid_foce
71      CHARACTER(len=7) str7      integer varid_fsic, varid_ts, varid_tsoil
72        INTEGER nsrf
73      CHARACTER(len=2) str2      CHARACTER(len=2) str2
74    
75      !------------------------------------------------------------      !------------------------------------------------------------
# Line 72  contains Line 78  contains
78      CALL nf95_create(fichnom, nf90_clobber, ncid)      CALL nf95_create(fichnom, nf90_clobber, ncid)
79    
80      call nf95_put_att(ncid, nf90_global, 'title', &      call nf95_put_att(ncid, nf90_global, 'title', &
81           'Fichier redémarrage physique')           'start file for the physics code')
82      call nf95_put_att(ncid, nf90_global, "itau_phy", itau_phy)      call nf95_put_att(ncid, nf90_global, "itau_phy", itau_phy)
83    
84      call nf95_def_dim(ncid, 'points_physiques', klon, idim2)      call nf95_def_dim(ncid, 'points_physiques', klon, idim2)
85      call nf95_def_dim(ncid, 'klev', klev, idim3)      call nf95_def_dim(ncid, 'klev', klev, idim3)
86        call nf95_def_dim(ncid, 'nbsrf', nbsrf, dimid_nbsrf)
87        call nf95_def_dim(ncid, 'nsoilmx', nsoilmx, dimid_nsoilmx)
88    
89      call nf95_def_var(ncid, 'longitude', nf90_float, idim2, varid)      call nf95_def_var(ncid, 'longitude', nf90_float, idim2, varid_rlon)
90      call nf95_put_att(ncid, varid, 'title', &      call nf95_def_var(ncid, 'latitude', nf90_float, idim2, varid_rlat)
          'Longitudes de la grille physique')  
     call nf95_enddef(ncid)  
     call nf95_put_var(ncid, varid, rlon)  
91    
92      call nf95_redef(ncid)      call nf95_def_var(ncid, 'masque', nf90_float, idim2, varid_zmasq)
93      call nf95_def_var(ncid, 'latitude', nf90_float, idim2, varid)      call nf95_put_att(ncid, varid_zmasq, 'title', 'masque terre mer')
     call nf95_put_att(ncid, varid, 'title', &  
          'Latitudes de la grille physique')  
     call nf95_enddef(ncid)  
     call nf95_put_var(ncid, varid, rlat)  
94    
95      ! PB ajout du masque terre/mer      ! Fractions de chaque sous-surface
96    
97      call nf95_redef(ncid)      call nf95_def_var(ncid, 'FTER', nf90_float, idim2, varid_fter)
98      call nf95_def_var(ncid, 'masque', nf90_float, idim2, varid)      call nf95_put_att(ncid, varid_fter, 'title', 'fraction de continent')
     call nf95_put_att(ncid, varid, 'title', 'masque terre mer')  
     call nf95_enddef(ncid)  
     call nf95_put_var(ncid, varid, zmasq)  
     ! BP ajout des fraction de chaque sous-surface  
99    
100      ! 1. fraction de terre      call nf95_def_var(ncid, 'FLIC', nf90_float, idim2, varid_flic)
101        call nf95_put_att(ncid, varid_flic, 'title', 'fraction glace de terre')
102    
103      call nf95_redef(ncid)      call nf95_def_var(ncid, 'FOCE', nf90_float, idim2, varid_foce)
104      call nf95_def_var(ncid, 'FTER', nf90_float, idim2, varid)      call nf95_put_att(ncid, varid_foce, 'title', 'fraction ocean')
     call nf95_put_att(ncid, varid, 'title', 'fraction de continent')  
     call nf95_enddef(ncid)  
     call nf95_put_var(ncid, varid, pctsrf(:, is_ter))  
105    
106      ! 2. Fraction de glace de terre      call nf95_def_var(ncid, 'FSIC', nf90_float, idim2, varid_fsic)
107        call nf95_put_att(ncid, varid_fsic, 'title', 'fraction glace mer')
108    
109      call nf95_redef(ncid)      call nf95_def_var(ncid, 'TS', nf90_float, (/idim2, dimid_nbsrf/), varid_ts)
110      call nf95_def_var(ncid, 'FLIC', nf90_float, idim2, varid)      call nf95_put_att(ncid, varid_ts, 'title', 'surface temperature')
     call nf95_put_att(ncid, varid, 'title', 'fraction glace de terre')  
     call nf95_enddef(ncid)  
     call nf95_put_var(ncid, varid, pctsrf(:, is_lic))  
111    
112      ! 3. fraction ocean      call nf95_def_var(ncid, 'Tsoil', nf90_float, (/idim2, dimid_nsoilmx, &
113             dimid_nbsrf/), varid_tsoil)
114        call nf95_put_att(ncid, varid_tsoil, 'title', 'soil temperature')
115    
     call nf95_redef(ncid)  
     call nf95_def_var(ncid, 'FOCE', nf90_float, idim2, varid)  
     call nf95_put_att(ncid, varid, 'title', 'fraction ocean')  
     call nf95_enddef(ncid)  
     call nf95_put_var(ncid, varid, pctsrf(:, is_oce))  
   
     ! 4. Fraction glace de mer  
   
     call nf95_redef(ncid)  
     call nf95_def_var(ncid, 'FSIC', nf90_float, idim2, varid)  
     call nf95_put_att(ncid, varid, 'title', 'fraction glace mer')  
116      call nf95_enddef(ncid)      call nf95_enddef(ncid)
     call nf95_put_var(ncid, varid, pctsrf(:, is_sic))  
117    
118      DO nsrf = 1, nbsrf      call nf95_put_var(ncid, varid_rlon, rlon)
119         IF (nsrf<=99) THEN      call nf95_put_var(ncid, varid_rlat, rlat)
120            WRITE (str2, '(i2.2)') nsrf      call nf95_put_var(ncid, varid_zmasq, zmasq)
121            call nf95_redef(ncid)      call nf95_put_var(ncid, varid_fter, pctsrf(:, is_ter))
122            call nf95_def_var(ncid, 'TS'//str2, nf90_float, idim2, varid)      call nf95_put_var(ncid, varid_flic, pctsrf(:, is_lic))
123            call nf95_put_att(ncid, varid, 'title', &      call nf95_put_var(ncid, varid_foce, pctsrf(:, is_oce))
124                 'Temperature de surface No.'//str2)      call nf95_put_var(ncid, varid_fsic, pctsrf(:, is_sic))
125            call nf95_enddef(ncid)      call nf95_put_var(ncid, varid_ts, tsol)
126         ELSE      call nf95_put_var(ncid, varid_tsoil, tsoil)
           PRINT *, 'Trop de sous-mailles'  
           STOP 1  
        END IF  
        call nf95_put_var(ncid, varid, tsol(:, nsrf))  
     END DO  
   
     DO nsrf = 1, nbsrf  
        DO isoil = 1, nsoilmx  
           IF (isoil<=99 .AND. nsrf<=99) THEN  
              WRITE (str7, '(i2.2, "srf", i2.2)') isoil, nsrf  
              call nf95_redef(ncid)  
              call nf95_def_var(ncid, 'Tsoil'//str7, nf90_float, idim2, varid)  
              call nf95_put_att(ncid, varid, 'title', &  
                   'Temperature du sol No.'//str7)  
              call nf95_enddef(ncid)  
           ELSE  
              PRINT *, 'Trop de couches'  
              STOP 1  
           END IF  
           call nf95_put_var(ncid, varid, tsoil(:, isoil, nsrf))  
        END DO  
     END DO  
127    
128      !IM "slab" ocean      !IM "slab" ocean
129      call nf95_redef(ncid)      call nf95_redef(ncid)

Legend:
Removed from v.72  
changed lines
  Added in v.140

  ViewVC Help
Powered by ViewVC 1.1.21