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

Diff of /trunk/dyn3d/limit.f

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

revision 3 by guez, Wed Feb 27 13:16:39 2008 UTC revision 25 by guez, Fri Mar 5 16:43:45 2010 UTC
# Line 1  Line 1 
1  module limit_mod  module limit_mod
2    
   ! This module is clean: no C preprocessor directive, no include line.  
   
3    IMPLICIT none    IMPLICIT none
4    
5  contains  contains
# Line 15  contains Line 13  contains
13      ! Both grids must be regular.      ! Both grids must be regular.
14    
15      use dimens_m, only: iim, jjm      use dimens_m, only: iim, jjm
     use comconst, only: daysec, dtvr  
16      use indicesol, only: epsfra, nbsrf, is_ter, is_oce, is_lic, is_sic      use indicesol, only: epsfra, nbsrf, is_ter, is_oce, is_lic, is_sic
17      use dimphy, only: klon, zmasq      use dimphy, only: klon, zmasq
     use conf_gcm_m, only: day_step  
18      use comgeom, only: rlonu, rlatv      use comgeom, only: rlonu, rlatv
19      use etat0_mod, only: pctsrf      use etat0_mod, only: pctsrf
20      use start_init_orog_m, only: masque      use start_init_orog_m, only: mask
21      use conf_dat2d_m, only: conf_dat2d      use conf_dat2d_m, only: conf_dat2d
22      use inter_barxy_m, only: inter_barxy      use inter_barxy_m, only: inter_barxy
23      use interpolation, only: spline, splint      use numer_rec, only: spline, splint
24      use grid_change, only: dyn_phy      use grid_change, only: dyn_phy
25    
26      use netcdf95, only: handle_err, coordin, &      use netcdf95, only: handle_err, nf95_gw_var, NF95_CLOSE, NF95_DEF_DIM, &
27           NF90_CLOBBER, NF95_CLOSE, NF95_DEF_DIM, nf90_def_var, nf95_enddef, &           nf95_enddef, NF95_CREATE, nf95_inq_dimid, nf95_inquire_dimension, &
28           NF90_FLOAT, NF90_GET_VAR, NF90_GLOBAL, NF90_NOWRITE, NF90_PUT_ATT, &           nf95_inq_varid, NF95_OPEN
29           NF90_PUT_VAR, NF90_UNLIMITED, &      use netcdf, only: NF90_CLOBBER, nf90_def_var, NF90_FLOAT, NF90_GET_VAR, &
30           NF95_CREATE, nf95_inq_dimid, nf95_inquire_dimension, nf95_inq_varid, &           NF90_GLOBAL, NF90_NOWRITE, NF90_PUT_ATT, NF90_PUT_VAR, &
31           nf95_open           NF90_UNLIMITED
32    
33      ! Variables local to the procedure:      ! Variables local to the procedure:
34    
# Line 86  contains Line 82  contains
82      read (unit=*, nml=limit_nml)      read (unit=*, nml=limit_nml)
83      write(unit=*, nml=limit_nml)      write(unit=*, nml=limit_nml)
84    
     ! Initializations:  
     dtvr = daysec / real(day_step)  
     CALL inigeom  
   
85      ! Process rugosity:      ! Process rugosity:
86    
87      PRINT *, 'Processing rugosity...'      PRINT *, 'Processing rugosity...'
88      call NF95_OPEN('Rugos.nc', NF90_NOWRITE, ncid)      call NF95_OPEN('Rugos.nc', NF90_NOWRITE, ncid)
89    
90      dlon_ini => coordin(ncid, "longitude")      ! Read coordinate variables:
91    
92        call nf95_inq_varid(ncid, "longitude", varid)
93        call nf95_gw_var(ncid, varid, dlon_ini)
94      imdep = size(dlon_ini)      imdep = size(dlon_ini)
95    
96      dlat_ini => coordin(ncid, "latitude")      call nf95_inq_varid(ncid, "latitude", varid)
97        call nf95_gw_var(ncid, varid, dlat_ini)
98      jmdep = size(dlat_ini)      jmdep = size(dlat_ini)
99    
100      timeyear => coordin(ncid, "temps")      call nf95_inq_varid(ncid, "temps", varid)
101        call nf95_gw_var(ncid, varid, timeyear)
102      lmdep = size(timeyear)      lmdep = size(timeyear)
103    
104      ALLOCATE(champ(imdep, jmdep), champtime(iim, jjm + 1, lmdep))      ALLOCATE(champ(imdep, jmdep), champtime(iim, jjm + 1, lmdep))
105      allocate(dlon(imdep), dlat(jmdep))      allocate(dlon(imdep), dlat(jmdep))
106      call NF95_INQ_VARID(ncid, 'RUGOS', varid)      call NF95_INQ_VARID(ncid, 'RUGOS', varid)
107    
108      ! Compute "champtime":      ! Read the primary variable day by day and regrid horizontally,
109        ! result in "champtime":
110      DO  l = 1, lmdep      DO  l = 1, lmdep
111         ierr = NF90_GET_VAR(ncid, varid, champ, start=(/1, 1, l/))         ierr = NF90_GET_VAR(ncid, varid, champ, start=(/1, 1, l/))
112         call handle_err("NF90_GET_VAR", ierr)         call handle_err("NF90_GET_VAR", ierr)
# Line 117  contains Line 115  contains
115         CALL inter_barxy(dlon, dlat(:jmdep -1), LOG(champ), rlonu(:iim), &         CALL inter_barxy(dlon, dlat(:jmdep -1), LOG(champ), rlonu(:iim), &
116              rlatv, champtime(:, :, l))              rlatv, champtime(:, :, l))
117         champtime(:, :, l) = EXP(champtime(:, :, l))         champtime(:, :, l) = EXP(champtime(:, :, l))
118         where (nint(masque(:iim, :)) /= 1) champtime(:, :, l) = 0.001         where (nint(mask(:iim, :)) /= 1) champtime(:, :, l) = 0.001
119      end do      end do
120    
121      call NF95_CLOSE(ncid)      call NF95_CLOSE(ncid)
# Line 125  contains Line 123  contains
123      DEALLOCATE(dlon, dlat, champ, dlon_ini, dlat_ini)      DEALLOCATE(dlon, dlat, champ, dlon_ini, dlat_ini)
124      allocate(yder(lmdep))      allocate(yder(lmdep))
125    
126        ! Interpolate monthly values to daily values, at each horizontal position:
127      DO j = 1, jjm + 1      DO j = 1, jjm + 1
128         DO i = 1, iim         DO i = 1, iim
129            yder(:) = SPLINE(timeyear, champtime(i, j, :))            yder(:) = SPLINE(timeyear, champtime(i, j, :))
# Line 144  contains Line 143  contains
143      PRINT *, 'Processing sea ice...'      PRINT *, 'Processing sea ice...'
144      call NF95_OPEN('amipbc_sic_1x1.nc', NF90_NOWRITE, ncid)      call NF95_OPEN('amipbc_sic_1x1.nc', NF90_NOWRITE, ncid)
145    
146      dlon_ini => coordin(ncid, "longitude")      call nf95_inq_varid(ncid, "longitude", varid)
147        call nf95_gw_var(ncid, varid, dlon_ini)
148      imdep = size(dlon_ini)      imdep = size(dlon_ini)
149    
150      dlat_ini => coordin(ncid, "latitude")      call nf95_inq_varid(ncid, "latitude", varid)
151        call nf95_gw_var(ncid, varid, dlat_ini)
152      jmdep = size(dlat_ini)      jmdep = size(dlat_ini)
153    
154      call nf95_inq_dimid(ncid, "time", dimid)      call nf95_inq_dimid(ncid, "time", dimid)
# Line 241  contains Line 242  contains
242      PRINT *, 'Traitement de la sst'      PRINT *, 'Traitement de la sst'
243      call NF95_OPEN('amipbc_sst_1x1.nc', NF90_NOWRITE, ncid)      call NF95_OPEN('amipbc_sst_1x1.nc', NF90_NOWRITE, ncid)
244    
245      dlon_ini => coordin(ncid, "longitude")      call nf95_inq_varid(ncid, "longitude", varid)
246        call nf95_gw_var(ncid, varid, dlon_ini)
247      imdep = size(dlon_ini)      imdep = size(dlon_ini)
248    
249      dlat_ini => coordin(ncid, "latitude")      call nf95_inq_varid(ncid, "latitude", varid)
250        call nf95_gw_var(ncid, varid, dlat_ini)
251      jmdep = size(dlat_ini)      jmdep = size(dlat_ini)
252    
253      call nf95_inq_dimid(ncid, "time", dimid)      call nf95_inq_dimid(ncid, "time", dimid)
# Line 310  contains Line 313  contains
313      PRINT *, 'Traitement de l albedo'      PRINT *, 'Traitement de l albedo'
314      call NF95_OPEN('Albedo.nc', NF90_NOWRITE, ncid)      call NF95_OPEN('Albedo.nc', NF90_NOWRITE, ncid)
315    
316      dlon_ini => coordin(ncid, "longitude")      call nf95_inq_varid(ncid, "longitude", varid)
317        call nf95_gw_var(ncid, varid, dlon_ini)
318      imdep = size(dlon_ini)      imdep = size(dlon_ini)
319    
320      dlat_ini => coordin(ncid, "latitude")      call nf95_inq_varid(ncid, "latitude", varid)
321        call nf95_gw_var(ncid, varid, dlat_ini)
322      jmdep = size(dlat_ini)      jmdep = size(dlat_ini)
323    
324      timeyear => coordin(ncid, "temps")      call nf95_inq_varid(ncid, "temps", varid)
325        call nf95_gw_var(ncid, varid, timeyear)
326      lmdep = size(timeyear)      lmdep = size(timeyear)
327    
328      ALLOCATE ( champ(imdep, jmdep), champtime(iim, jjm + 1, lmdep))      ALLOCATE ( champ(imdep, jmdep), champtime(iim, jjm + 1, lmdep))

Legend:
Removed from v.3  
changed lines
  Added in v.25

  ViewVC Help
Powered by ViewVC 1.1.21