/[lmdze]/trunk/libf/dyn3d/etat0.f90
ViewVC logotype

Diff of /trunk/libf/dyn3d/etat0.f90

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

revision 15 by guez, Fri Aug 1 15:24:12 2008 UTC revision 67 by guez, Tue Oct 2 15:50:56 2012 UTC
# Line 17  contains Line 17  contains
17    
18      ! From "etat0_netcdf.F", version 1.3 2005/05/25 13:10:09      ! From "etat0_netcdf.F", version 1.3 2005/05/25 13:10:09
19    
20      ! This subroutine creates "mask".      use caldyn0_m, only: caldyn0
21        use comconst, only: dtvr, daysec, cpp, kappa
     USE ioipsl, only: flinget, flinclo, flinopen_nozoom, flininfo, histclo  
   
     USE start_init_orog_m, only: start_init_orog, mask, phis  
     use start_init_phys_m, only: qsol_2d  
     use startdyn, only: start_inter_3d, start_init_dyn  
     use dimens_m, only: iim, jjm, llm, nqmx  
     use paramet_m, only: ip1jm, ip1jmp1  
     use comconst, only: dtvr, daysec, cpp, kappa, pi  
     use comdissnew, only: lstardis, nitergdiv, nitergrot, niterh, &  
          tetagdiv, tetagrot, tetatemp  
     use indicesol, only: is_oce, is_sic, is_ter, is_lic, epsfra  
     use comvert, only: ap, bp, preff, pa  
     use dimphy, only: zmasq  
     use conf_gcm_m, only: day_step, iphysiq, dayref, anneeref  
22      use comgeom, only: rlatu, rlonv, rlonu, rlatv, aire_2d, apoln, apols, &      use comgeom, only: rlatu, rlonv, rlonu, rlatv, aire_2d, apoln, apols, &
23           cu_2d, cv_2d           cu_2d, cv_2d
24      use serre, only: alphax      use disvert_m, only: ap, bp, preff, pa
25        use conf_gcm_m, only: day_step, iphysiq, dayref, anneeref
26        use dimens_m, only: iim, jjm, llm, nqmx
27        use dimphy, only: zmasq
28      use dimsoil, only: nsoilmx      use dimsoil, only: nsoilmx
29      use temps, only: itau_dyn, itau_phy, annee_ref, day_ref, dt      use dynredem0_m, only: dynredem0
30        use dynredem1_m, only: dynredem1
31        use exner_hyb_m, only: exner_hyb
32        USE flincom, only: flinclo, flinopen_nozoom, flininfo
33        use geopot_m, only: geopot
34      use grid_atob, only: grille_m      use grid_atob, only: grille_m
35      use grid_change, only: init_dyn_phy, dyn_phy      use grid_change, only: init_dyn_phy, dyn_phy
36      use q_sat_m, only: q_sat      use histclo_m, only: histclo
37      use exner_hyb_m, only: exner_hyb      use indicesol, only: is_oce, is_sic, is_ter, is_lic, epsfra
38      use advtrac_m, only: iniadvtrac      use iniadvtrac_m, only: iniadvtrac
39        use inidissip_m, only: inidissip
40        use inifilr_m, only: inifilr
41        use inigeom_m, only: inigeom
42        use massdair_m, only: massdair
43        use netcdf, only: nf90_nowrite
44        use netcdf95, only: nf95_open, nf95_close, nf95_get_var, nf95_inq_varid
45        use nr_util, only: pi
46        use paramet_m, only: ip1jm, ip1jmp1
47        use phyredem_m, only: phyredem
48      use pressure_var, only: pls, p3d      use pressure_var, only: pls, p3d
49      use dynredem0_m, only: dynredem0      use q_sat_m, only: q_sat
50      use regr_lat_time_coefoz_m, only: regr_lat_time_coefoz      use regr_lat_time_coefoz_m, only: regr_lat_time_coefoz
51      use regr_pr_o3_m, only: regr_pr_o3      use regr_pr_o3_m, only: regr_pr_o3
52      use phyredem_m, only: phyredem      use serre, only: alphax
53        USE start_init_orog_m, only: start_init_orog, mask, phis
54        use start_init_phys_m, only: start_init_phys
55        use startdyn, only: start_init_dyn
56        use start_inter_3d_m, only: start_inter_3d
57        use temps, only: itau_phy, annee_ref, day_ref
58    
59      ! Variables local to the procedure:      ! Variables local to the procedure:
60    
# Line 55  contains Line 62  contains
62      ! (latitude and longitude of a point of the scalar grid identified      ! (latitude and longitude of a point of the scalar grid identified
63      ! by a simple index, in °)      ! by a simple index, in °)
64    
65      REAL, dimension(iim + 1, jjm + 1, llm):: uvent, t3d, tpot      REAL, dimension(iim + 1, jjm + 1, llm):: ucov, t3d, tpot
66      REAL vvent(iim + 1, jjm, llm)      REAL vcov(iim + 1, jjm, llm)
67    
68      REAL q3d(iim + 1, jjm + 1, llm, nqmx)      REAL q3d(iim + 1, jjm + 1, llm, nqmx)
69      ! (mass fractions of trace species      ! (mass fractions of trace species
# Line 78  contains Line 85  contains
85      REAL rugmer(klon)      REAL rugmer(klon)
86      real, dimension(iim + 1, jjm + 1):: relief, zstd_2d, zsig_2d, zgam_2d      real, dimension(iim + 1, jjm + 1):: relief, zstd_2d, zsig_2d, zgam_2d
87      real, dimension(iim + 1, jjm + 1):: zthe_2d, zpic_2d, zval_2d      real, dimension(iim + 1, jjm + 1):: zthe_2d, zpic_2d, zval_2d
88      real, dimension(iim + 1, jjm + 1):: tsol_2d, psol      real, dimension(iim + 1, jjm + 1):: tsol_2d, qsol_2d, psol
89      REAL zmea(klon), zstd(klon)      REAL zmea(klon), zstd(klon)
90      REAL zsig(klon), zgam(klon)      REAL zsig(klon), zgam(klon)
91      REAL zthe(klon)      REAL zthe(klon)
# Line 88  contains Line 95  contains
95      real clwcon(klon, llm), rnebcon(klon, llm), ratqs(klon, llm)      real clwcon(klon, llm), rnebcon(klon, llm), ratqs(klon, llm)
96      ! déclarations pour lecture glace de mer      ! déclarations pour lecture glace de mer
97      INTEGER iml_lic, jml_lic, llm_tmp, ttm_tmp      INTEGER iml_lic, jml_lic, llm_tmp, ttm_tmp
98      INTEGER itaul(1), fid      INTEGER itaul(1), fid, ncid, varid
99      REAL lev(1), date      REAL lev(1), date
100      REAL, ALLOCATABLE:: lon_lic(:, :), lat_lic(:, :)      REAL, ALLOCATABLE:: lon_lic(:, :), lat_lic(:, :)
101      REAL, ALLOCATABLE:: dlon_lic(:), dlat_lic(:)      REAL, ALLOCATABLE:: dlon_lic(:), dlat_lic(:)
# Line 105  contains Line 112  contains
112      REAL pbaru(ip1jmp1, llm), pbarv(ip1jm, llm)      REAL pbaru(ip1jmp1, llm), pbarv(ip1jm, llm)
113      REAL w(ip1jmp1, llm)      REAL w(ip1jmp1, llm)
114      REAL phystep      REAL phystep
115        real trash
116    
117      !---------------------------------      !---------------------------------
118    
119      print *, "Call sequence information: etat0"      print *, "Call sequence information: etat0"
120    
     ! Construct a grid:  
   
121      dtvr = daysec / real(day_step)      dtvr = daysec / real(day_step)
122      print *, 'dtvr = ', dtvr      print *, 'dtvr = ', dtvr
123    
124        ! Construct a grid:
125    
126      pa = 5e4      pa = 5e4
127      CALL iniconst      CALL iniconst
128      CALL inigeom      CALL inigeom
# Line 136  contains Line 144  contains
144      zmasq = pack(mask, dyn_phy)      zmasq = pack(mask, dyn_phy)
145      PRINT *, 'Masque construit'      PRINT *, 'Masque construit'
146    
147      CALL start_init_dyn(tsol_2d, psol) ! also compute "qsol_2d"      call start_init_phys(tsol_2d, qsol_2d)
148        CALL start_init_dyn(tsol_2d, psol)
149    
150      ! Compute pressure on intermediate levels:      ! Compute pressure on intermediate levels:
151      forall(l = 1: llm + 1) p3d(:, :, l) = ap(l) + bp(l) * psol      forall(l = 1: llm + 1) p3d(:, :, l) = ap(l) + bp(l) * psol
152      CALL exner_hyb(psol, p3d, pks, pk)      CALL exner_hyb(psol, p3d, pks, pk)
153      IF (MINVAL(pk) == MAXVAL(pk)) stop '"pk" should not be constant'      IF (MINVAL(pk) == MAXVAL(pk)) then
154           print *, '"pk" should not be constant'
155           stop 1
156        end IF
157    
158      pls(:, :, :) = preff * (pk(:, :, :) / cpp)**(1. / kappa)      pls = preff * (pk / cpp)**(1. / kappa)
159      PRINT *, "minval(pls(:, :, :)) = ", minval(pls(:, :, :))      PRINT *, "minval(pls) = ", minval(pls)
160      print *, "maxval(pls(:, :, :)) = ", maxval(pls(:, :, :))      print *, "maxval(pls) = ", maxval(pls)
161    
162      uvent(:, :, :) = start_inter_3d('U', rlonv, rlatv, pls)      call start_inter_3d('U', rlonv, rlatv, pls, ucov)
163      forall (l = 1: llm) uvent(:iim, :, l) = uvent(:iim, :, l) * cu_2d(:iim, :)      forall (l = 1: llm) ucov(:iim, :, l) = ucov(:iim, :, l) * cu_2d(:iim, :)
164      uvent(iim+1, :, :) = uvent(1, :, :)      ucov(iim+1, :, :) = ucov(1, :, :)
165    
166      vvent(:, :, :) = start_inter_3d('V', rlonu, rlatu(:jjm), pls(:, :jjm, :))      call start_inter_3d('V', rlonu, rlatu(:jjm), pls(:, :jjm, :), vcov)
167      forall (l = 1: llm) vvent(:iim, :, l) = vvent(:iim, :, l) * cv_2d(:iim, :)      forall (l = 1: llm) vcov(:iim, :, l) = vcov(:iim, :, l) * cv_2d(:iim, :)
168      vvent(iim + 1, :, :) = vvent(1, :, :)      vcov(iim + 1, :, :) = vcov(1, :, :)
169    
170      t3d(:, :, :) = start_inter_3d('TEMP', rlonu, rlatv, pls)      call start_inter_3d('TEMP', rlonu, rlatv, pls, t3d)
171      PRINT *,  'minval(t3d(:, :, :)) = ', minval(t3d(:, :, :))      PRINT *,  'minval(t3d) = ', minval(t3d)
172      print *, "maxval(t3d(:, :, :)) = ", maxval(t3d(:, :, :))      print *, "maxval(t3d) = ", maxval(t3d)
173    
174      tpot(:iim, :, :) = t3d(:iim, :, :) * cpp / pk(:iim, :, :)      tpot(:iim, :, :) = t3d(:iim, :, :) * cpp / pk(:iim, :, :)
175      tpot(iim + 1, :, :) = tpot(1, :, :)      tpot(iim + 1, :, :) = tpot(1, :, :)
# Line 168  contains Line 180  contains
180      ENDDO      ENDDO
181    
182      ! Calcul de l'humidité à saturation :      ! Calcul de l'humidité à saturation :
183      qsat(:, :, :) = q_sat(t3d, pls)      qsat = q_sat(t3d, pls)
184      PRINT *, "minval(qsat(:, :, :)) = ", minval(qsat(:, :, :))      PRINT *, "minval(qsat) = ", minval(qsat)
185      print *, "maxval(qsat(:, :, :)) = ", maxval(qsat(:, :, :))      print *, "maxval(qsat) = ", maxval(qsat)
186      IF (MINVAL(qsat) == MAXVAL(qsat)) stop '"qsat" should not be constant'      IF (MINVAL(qsat) == MAXVAL(qsat)) stop '"qsat" should not be constant'
187    
188      ! Water vapor:      ! Water vapor:
189      q3d(:, :, :, 1) = 0.01 * start_inter_3d('R', rlonu, rlatv, pls) * qsat      call start_inter_3d('R', rlonu, rlatv, pls, q3d(:, :, :, 1))
190        q3d(:, :, :, 1) = 0.01 * q3d(:, :, :, 1) * qsat
191      WHERE (q3d(:, :, :, 1) < 0.) q3d(:, :, :, 1) = 1E-10      WHERE (q3d(:, :, :, 1) < 0.) q3d(:, :, :, 1) = 1E-10
192      DO l = 1, llm      DO l = 1, llm
193         q3d(:, 1, l, 1) = SUM(aire_2d(:, 1) * q3d(:, 1, l, 1)) / apoln         q3d(:, 1, l, 1) = SUM(aire_2d(:, 1) * q3d(:, 1, l, 1)) / apoln
# Line 207  contains Line 220  contains
220      zpic = pack(zpic_2d, dyn_phy)      zpic = pack(zpic_2d, dyn_phy)
221      zval = pack(zval_2d, dyn_phy)      zval = pack(zval_2d, dyn_phy)
222    
223      ! On initialise les sous-surfaces:      ! On initialise les sous-surfaces.
224      ! Lecture du fichier glace de terre pour fixer la fraction de terre      ! Lecture du fichier glace de terre pour fixer la fraction de terre
225      ! et de glace de terre:      ! et de glace de terre :
226      CALL flininfo("landiceref.nc", iml_lic, jml_lic, llm_tmp, &      CALL flininfo("landiceref.nc", iml_lic, jml_lic, llm_tmp, &
227           ttm_tmp, fid)           ttm_tmp, fid)
228      ALLOCATE(lat_lic(iml_lic, jml_lic))      ALLOCATE(lat_lic(iml_lic, jml_lic))
# Line 217  contains Line 230  contains
230      ALLOCATE(dlon_lic(iml_lic))      ALLOCATE(dlon_lic(iml_lic))
231      ALLOCATE(dlat_lic(jml_lic))      ALLOCATE(dlat_lic(jml_lic))
232      ALLOCATE(fraclic(iml_lic, jml_lic))      ALLOCATE(fraclic(iml_lic, jml_lic))
233      CALL flinopen_nozoom("landiceref.nc", iml_lic, jml_lic, &      CALL flinopen_nozoom(iml_lic, jml_lic, &
234           llm_tmp, lon_lic, lat_lic, lev, ttm_tmp, itaul, date, dt,  &           llm_tmp, lon_lic, lat_lic, lev, ttm_tmp, itaul, date, trash,  &
235           fid)           fid)
     CALL flinget(fid, 'landice', iml_lic, jml_lic, llm_tmp, ttm_tmp &  
          , 1, 1, fraclic)  
236      CALL flinclo(fid)      CALL flinclo(fid)
237        call nf95_open("landiceref.nc", nf90_nowrite, ncid)
238        call nf95_inq_varid(ncid, 'landice', varid)
239        call nf95_get_var(ncid, varid, fraclic)
240        call nf95_close(ncid)
241    
242      ! Interpolation sur la grille T du modèle :      ! Interpolation sur la grille T du modèle :
243      PRINT *, 'Dimensions de "landice"'      PRINT *, 'Dimensions de "landice"'
# Line 288  contains Line 303  contains
303    
304      ! Initialisation pour traceurs:      ! Initialisation pour traceurs:
305      call iniadvtrac      call iniadvtrac
306      ! Ecriture:      CALL inidissip
     CALL inidissip(lstardis, nitergdiv, nitergrot, niterh, tetagdiv, &  
          tetagrot, tetatemp)  
     itau_dyn = 0  
307      itau_phy = 0      itau_phy = 0
308      day_ref = dayref      day_ref = dayref
309      annee_ref = anneeref      annee_ref = anneeref
310    
311      CALL geopot(ip1jmp1, tpot, pk , pks,  phis  , phi)      CALL geopot(ip1jmp1, tpot, pk , pks,  phis, phi)
312      CALL caldyn0(0, uvent, vvent, tpot, psol, masse, pk, phis, phi, w, &      CALL caldyn0(ucov, vcov, tpot, psol, masse, pk, phis, phi, w, pbaru, &
313           pbaru, pbarv, 0)           pbarv)
314      CALL dynredem0("start.nc", dayref, phis)      CALL dynredem0("start.nc", dayref, phis)
315      CALL dynredem1("start.nc", 0., vvent, uvent, tpot, q3d, masse, psol)      CALL dynredem1("start.nc", vcov, ucov, tpot, q3d, masse, psol, itau=0)
316    
317      ! Ecriture état initial physique:      ! Ecriture état initial physique:
     print *, 'dtvr = ', dtvr  
318      print *, "iphysiq = ", iphysiq      print *, "iphysiq = ", iphysiq
319      phystep   = dtvr * REAL(iphysiq)      phystep   = dtvr * REAL(iphysiq)
320      print *, 'phystep = ', phystep      print *, 'phystep = ', phystep

Legend:
Removed from v.15  
changed lines
  Added in v.67

  ViewVC Help
Powered by ViewVC 1.1.21