/[lmdze]/trunk/dyn3d/etat0.f
ViewVC logotype

Diff of /trunk/dyn3d/etat0.f

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

revision 43 by guez, Fri Apr 8 12:43:31 2011 UTC revision 71 by guez, Mon Jul 8 18:12:18 2013 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    
     ! This subroutine creates "mask".  
   
20      use caldyn0_m, only: caldyn0      use caldyn0_m, only: caldyn0
21      use comconst, only: dtvr, daysec, cpp, kappa      use comconst, only: dtvr, daysec, cpp, kappa
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
     use comvert, only: ap, bp, preff, pa  
24      use conf_gcm_m, only: day_step, iphysiq, dayref, anneeref      use conf_gcm_m, only: day_step, iphysiq, dayref, anneeref
25      use dimens_m, only: iim, jjm, llm, nqmx      use dimens_m, only: iim, jjm, llm, nqmx
26      use dimphy, only: zmasq      use dimphy, only: zmasq
27      use dimsoil, only: nsoilmx      use dimsoil, only: nsoilmx
28        use disvert_m, only: ap, bp, preff, pa
29      use dynredem0_m, only: dynredem0      use dynredem0_m, only: dynredem0
30      use dynredem1_m, only: dynredem1      use dynredem1_m, only: dynredem1
31      use exner_hyb_m, only: exner_hyb      use exner_hyb_m, only: exner_hyb
     USE flincom, only: flinclo, flinopen_nozoom, flininfo  
     use flinget_m, only: flinget  
32      use geopot_m, only: geopot      use geopot_m, only: geopot
33      use grid_atob, only: grille_m      use grid_atob, only: grille_m
34      use grid_change, only: init_dyn_phy, dyn_phy      use grid_change, only: init_dyn_phy, dyn_phy
35      use histcom, only: histclo      use histclo_m, only: histclo
36      use indicesol, only: is_oce, is_sic, is_ter, is_lic, epsfra      use indicesol, only: is_oce, is_sic, is_ter, is_lic, epsfra
37      use iniadvtrac_m, only: iniadvtrac      use iniadvtrac_m, only: iniadvtrac
38      use inidissip_m, only: inidissip      use inifilr_m, only: inifilr
39      use inigeom_m, only: inigeom      use inigeom_m, only: inigeom
40        use massdair_m, only: massdair
41        use netcdf, only: nf90_nowrite
42        use netcdf95, only: nf95_close, nf95_get_var, nf95_gw_var, &
43             nf95_inq_varid, nf95_open
44      use nr_util, only: pi      use nr_util, only: pi
45      use paramet_m, only: ip1jm, ip1jmp1      use paramet_m, only: ip1jm, ip1jmp1
46      use phyredem_m, only: phyredem      use phyredem_m, only: phyredem
# Line 49  contains Line 49  contains
49      use regr_lat_time_coefoz_m, only: regr_lat_time_coefoz      use regr_lat_time_coefoz_m, only: regr_lat_time_coefoz
50      use regr_pr_o3_m, only: regr_pr_o3      use regr_pr_o3_m, only: regr_pr_o3
51      use serre, only: alphax      use serre, only: alphax
52        use startdyn, only: start_init_dyn
53      USE start_init_orog_m, only: start_init_orog, mask, phis      USE start_init_orog_m, only: start_init_orog, mask, phis
54      use start_init_phys_m, only: start_init_phys      use start_init_phys_m, only: start_init_phys
55      use startdyn, only: start_inter_3d, start_init_dyn      use start_inter_3d_m, only: start_inter_3d
56      use temps, only: itau_phy, annee_ref, day_ref      use temps, only: itau_phy, annee_ref, day_ref
57    
58      ! Variables local to the procedure:      ! Variables local to the procedure:
# Line 60  contains Line 61  contains
61      ! (latitude and longitude of a point of the scalar grid identified      ! (latitude and longitude of a point of the scalar grid identified
62      ! by a simple index, in °)      ! by a simple index, in °)
63    
64      REAL, dimension(iim + 1, jjm + 1, llm):: uvent, t3d, tpot      REAL, dimension(iim + 1, jjm + 1, llm):: ucov, t3d, tpot
65      REAL vvent(iim + 1, jjm, llm)      REAL vcov(iim + 1, jjm, llm)
66    
67      REAL q3d(iim + 1, jjm + 1, llm, nqmx)      REAL q(iim + 1, jjm + 1, llm, nqmx)
68      ! (mass fractions of trace species      ! (mass fractions of trace species
69      ! "q3d(i, j, l)" is at longitude "rlonv(i)", latitude "rlatu(j)"      ! "q(i, j, l)" is at longitude "rlonv(i)", latitude "rlatu(j)"
70      ! and pressure level "pls(i, j, l)".)      ! and pressure level "pls(i, j, l)".)
71    
72      real qsat(iim + 1, jjm + 1, llm) ! mass fraction of saturating water vapor      real qsat(iim + 1, jjm + 1, llm) ! mass fraction of saturating water vapor
# Line 91  contains Line 92  contains
92      REAL t_ancien(klon, llm), q_ancien(klon, llm)      !      REAL t_ancien(klon, llm), q_ancien(klon, llm)      !
93      REAL run_off_lic_0(klon)      REAL run_off_lic_0(klon)
94      real clwcon(klon, llm), rnebcon(klon, llm), ratqs(klon, llm)      real clwcon(klon, llm), rnebcon(klon, llm), ratqs(klon, llm)
95      ! déclarations pour lecture glace de mer  
96      INTEGER iml_lic, jml_lic, llm_tmp, ttm_tmp      ! Déclarations pour lecture glace de mer :
97      INTEGER itaul(1), fid      INTEGER iml_lic, jml_lic
98      REAL lev(1), date      INTEGER ncid, varid
99      REAL, ALLOCATABLE:: lon_lic(:, :), lat_lic(:, :)      REAL, pointer:: dlon_lic(:), dlat_lic(:)
     REAL, ALLOCATABLE:: dlon_lic(:), dlat_lic(:)  
100      REAL, ALLOCATABLE:: fraclic(:, :) ! fraction land ice      REAL, ALLOCATABLE:: fraclic(:, :) ! fraction land ice
101      REAL flic_tmp(iim + 1, jjm + 1) !fraction land ice temporary      REAL flic_tmp(iim + 1, jjm + 1) ! fraction land ice temporary
102    
103      INTEGER l, ji      INTEGER l, ji
104    
# Line 106  contains Line 106  contains
106      real pks(iim + 1, jjm + 1)      real pks(iim + 1, jjm + 1)
107    
108      REAL masse(iim + 1, jjm + 1, llm)      REAL masse(iim + 1, jjm + 1, llm)
109      REAL phi(ip1jmp1, llm)      REAL phi(iim + 1, jjm + 1, llm)
110      REAL pbaru(ip1jmp1, llm), pbarv(ip1jm, llm)      REAL pbaru(ip1jmp1, llm), pbarv(ip1jm, llm)
111      REAL w(ip1jmp1, llm)      REAL w(ip1jmp1, llm)
112      REAL phystep      REAL phystep
     real trash  
113    
114      !---------------------------------      !---------------------------------
115    
# Line 148  contains Line 147  contains
147      ! Compute pressure on intermediate levels:      ! Compute pressure on intermediate levels:
148      forall(l = 1: llm + 1) p3d(:, :, l) = ap(l) + bp(l) * psol      forall(l = 1: llm + 1) p3d(:, :, l) = ap(l) + bp(l) * psol
149      CALL exner_hyb(psol, p3d, pks, pk)      CALL exner_hyb(psol, p3d, pks, pk)
150      IF (MINVAL(pk) == MAXVAL(pk)) stop '"pk" should not be constant'      IF (MINVAL(pk) == MAXVAL(pk)) then
151           print *, '"pk" should not be constant'
152           stop 1
153        end IF
154    
155      pls = preff * (pk / cpp)**(1. / kappa)      pls = preff * (pk / cpp)**(1. / kappa)
156      PRINT *, "minval(pls) = ", minval(pls)      PRINT *, "minval(pls) = ", minval(pls)
157      print *, "maxval(pls) = ", maxval(pls)      print *, "maxval(pls) = ", maxval(pls)
158    
159      call start_inter_3d('U', rlonv, rlatv, pls, uvent)      call start_inter_3d('U', rlonv, rlatv, pls, ucov)
160      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, :)
161      uvent(iim+1, :, :) = uvent(1, :, :)      ucov(iim+1, :, :) = ucov(1, :, :)
162    
163      call start_inter_3d('V', rlonu, rlatu(:jjm), pls(:, :jjm, :), vvent)      call start_inter_3d('V', rlonu, rlatu(:jjm), pls(:, :jjm, :), vcov)
164      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, :)
165      vvent(iim + 1, :, :) = vvent(1, :, :)      vcov(iim + 1, :, :) = vcov(1, :, :)
166    
167      call start_inter_3d('TEMP', rlonu, rlatv, pls, t3d)      call start_inter_3d('TEMP', rlonu, rlatv, pls, t3d)
168      PRINT *,  'minval(t3d) = ', minval(t3d)      PRINT *,  'minval(t3d) = ', minval(t3d)
# Line 181  contains Line 183  contains
183      IF (MINVAL(qsat) == MAXVAL(qsat)) stop '"qsat" should not be constant'      IF (MINVAL(qsat) == MAXVAL(qsat)) stop '"qsat" should not be constant'
184    
185      ! Water vapor:      ! Water vapor:
186      call start_inter_3d('R', rlonu, rlatv, pls, q3d(:, :, :, 1))      call start_inter_3d('R', rlonu, rlatv, pls, q(:, :, :, 1))
187      q3d(:, :, :, 1) = 0.01 * q3d(:, :, :, 1) * qsat      q(:, :, :, 1) = 0.01 * q(:, :, :, 1) * qsat
188      WHERE (q3d(:, :, :, 1) < 0.) q3d(:, :, :, 1) = 1E-10      WHERE (q(:, :, :, 1) < 0.) q(:, :, :, 1) = 1E-10
189      DO l = 1, llm      DO l = 1, llm
190         q3d(:, 1, l, 1) = SUM(aire_2d(:, 1) * q3d(:, 1, l, 1)) / apoln         q(:, 1, l, 1) = SUM(aire_2d(:, 1) * q(:, 1, l, 1)) / apoln
191         q3d(:, jjm + 1, l, 1) &         q(:, jjm + 1, l, 1) &
192              = SUM(aire_2d(:, jjm + 1) * q3d(:, jjm + 1, l, 1)) / apols              = SUM(aire_2d(:, jjm + 1) * q(:, jjm + 1, l, 1)) / apols
193      ENDDO      ENDDO
194    
195      q3d(:, :, :, 2:4) = 0. ! liquid water, radon and lead      q(:, :, :, 2:4) = 0. ! liquid water, radon and lead
196    
197      if (nqmx >= 5) then      if (nqmx >= 5) then
198         ! Ozone:         ! Ozone:
199         call regr_lat_time_coefoz         call regr_lat_time_coefoz
200         call regr_pr_o3(q3d(:, :, :, 5))         call regr_pr_o3(q(:, :, :, 5))
201         ! Convert from mole fraction to mass fraction:         ! Convert from mole fraction to mass fraction:
202         q3d(:, :, :, 5) = q3d(:, :, :, 5)  * 48. / 29.         q(:, :, :, 5) = q(:, :, :, 5)  * 48. / 29.
203      end if      end if
204    
205      tsol = pack(tsol_2d, dyn_phy)      tsol = pack(tsol_2d, dyn_phy)
# Line 215  contains Line 217  contains
217      zpic = pack(zpic_2d, dyn_phy)      zpic = pack(zpic_2d, dyn_phy)
218      zval = pack(zval_2d, dyn_phy)      zval = pack(zval_2d, dyn_phy)
219    
220      ! On initialise les sous-surfaces:      ! On initialise les sous-surfaces.
221      ! Lecture du fichier glace de terre pour fixer la fraction de terre      ! Lecture du fichier glace de terre pour fixer la fraction de terre
222      ! et de glace de terre:      ! et de glace de terre :
223      CALL flininfo("landiceref.nc", iml_lic, jml_lic, llm_tmp, &  
224           ttm_tmp, fid)      call nf95_open("landiceref.nc", nf90_nowrite, ncid)
225      ALLOCATE(lat_lic(iml_lic, jml_lic))  
226      ALLOCATE(lon_lic(iml_lic, jml_lic))      call nf95_inq_varid(ncid, 'longitude', varid)
227      ALLOCATE(dlon_lic(iml_lic))      call nf95_gw_var(ncid, varid, dlon_lic)
228      ALLOCATE(dlat_lic(jml_lic))      iml_lic = size(dlon_lic)
229    
230        call nf95_inq_varid(ncid, 'latitude', varid)
231        call nf95_gw_var(ncid, varid, dlat_lic)
232        jml_lic = size(dlat_lic)
233    
234        call nf95_inq_varid(ncid, 'landice', varid)
235      ALLOCATE(fraclic(iml_lic, jml_lic))      ALLOCATE(fraclic(iml_lic, jml_lic))
236      CALL flinopen_nozoom(iml_lic, jml_lic, &      call nf95_get_var(ncid, varid, fraclic)
237           llm_tmp, lon_lic, lat_lic, lev, ttm_tmp, itaul, date, trash,  &  
238           fid)      call nf95_close(ncid)
     CALL flinget(fid, 'landice', iml_lic, jml_lic, llm_tmp, ttm_tmp &  
          , 1, 1, fraclic)  
     CALL flinclo(fid)  
239    
240      ! Interpolation sur la grille T du modèle :      ! Interpolation sur la grille T du modèle :
241      PRINT *, 'Dimensions de "landice"'      PRINT *, 'Dimensions de "landiceref.nc"'
242      print *, "iml_lic = ", iml_lic      print *, "iml_lic = ", iml_lic
243      print *, "jml_lic = ", jml_lic      print *, "jml_lic = ", jml_lic
244    
245      ! Si les coordonnées sont en degrés, on les transforme :      ! Si les coordonnées sont en degrés, on les transforme :
246      IF (MAXVAL( lon_lic ) > pi)  THEN      IF (MAXVAL( dlon_lic ) > pi)  THEN
247         lon_lic = lon_lic * pi / 180.         dlon_lic = dlon_lic * pi / 180.
248      ENDIF      ENDIF
249      IF (maxval( lat_lic ) > pi) THEN      IF (maxval( dlat_lic ) > pi) THEN
250         lat_lic = lat_lic * pi/ 180.         dlat_lic = dlat_lic * pi/ 180.
251      ENDIF      ENDIF
252    
     dlon_lic = lon_lic(:, 1)  
     dlat_lic = lat_lic(1, :)  
   
253      flic_tmp(:iim, :) = grille_m(dlon_lic, dlat_lic, fraclic, rlonv(:iim), &      flic_tmp(:iim, :) = grille_m(dlon_lic, dlat_lic, fraclic, rlonv(:iim), &
254           rlatu)           rlatu)
255      flic_tmp(iim + 1, :) = flic_tmp(1, :)      flic_tmp(iim + 1, :) = flic_tmp(1, :)
256    
257        deallocate(dlon_lic, dlat_lic) ! pointers
258    
259      ! Passage sur la grille physique      ! Passage sur la grille physique
260      pctsrf = 0.      pctsrf = 0.
261      pctsrf(:, is_lic) = pack(flic_tmp, dyn_phy)      pctsrf(:, is_lic) = pack(flic_tmp, dyn_phy)
# Line 296  contains Line 300  contains
300    
301      ! Initialisation pour traceurs:      ! Initialisation pour traceurs:
302      call iniadvtrac      call iniadvtrac
     CALL inidissip  
303      itau_phy = 0      itau_phy = 0
304      day_ref = dayref      day_ref = dayref
305      annee_ref = anneeref      annee_ref = anneeref
306    
307      CALL geopot(ip1jmp1, tpot, pk , pks,  phis, phi)      CALL geopot(tpot, pk , pks,  phis, phi)
308      CALL caldyn0(uvent, vvent, tpot, psol, masse, pk, phis, phi, w, pbaru, &      CALL caldyn0(ucov, vcov, tpot, psol, masse, pk, phis, phi, w, pbaru, &
309           pbarv)           pbarv)
310      CALL dynredem0("start.nc", dayref, phis)      CALL dynredem0("start.nc", dayref, phis)
311      CALL dynredem1("start.nc", vvent, uvent, tpot, q3d, masse, psol, itau=0)      CALL dynredem1("start.nc", vcov, ucov, tpot, q, masse, psol, itau=0)
312    
313      ! Ecriture état initial physique:      ! Ecriture état initial physique:
314      print *, "iphysiq = ", iphysiq      print *, "iphysiq = ", iphysiq

Legend:
Removed from v.43  
changed lines
  Added in v.71

  ViewVC Help
Powered by ViewVC 1.1.21