source: LMDZ4/trunk/libf/dyn3d/etat0_netcdf.F90 @ 1403

Last change on this file since 1403 was 1403, checked in by Laurent Fairhead, 14 years ago

Merged LMDZ4V5.0-dev branch changes r1292:r1399 to trunk.

Validation:
Validation consisted in compiling the HEAD revision of the trunk,
LMDZ4V5.0-dev branch and the merged sources and running different
configurations on local and SX8 machines comparing results.

Local machine: bench configuration, 32x24x11, gfortran

  • IPSLCM5A configuration (comparison between trunk and merged sources):
    • numerical convergence on dynamical fields over 3 days
    • start files are equivalent (except for RN and PB fields)
    • daily history files equivalent
  • MH07 configuration, new physics package (comparison between LMDZ4V5.0-dev branch and merged sources):
    • numerical convergence on dynamical fields over 3 days
    • start files are equivalent (except for RN and PB fields)
    • daily history files equivalent

SX8 machine (brodie), 96x95x39 on 4 processors:

  • IPSLCM5A configuration:
    • start files are equivalent (except for RN and PB fields)
    • monthly history files equivalent
  • MH07 configuration:
    • start files are equivalent (except for RN and PB fields)
    • monthly history files equivalent

Changes to the makegcm and create_make_gcm scripts to take into account
main programs in F90 files


Fusion de la branche LMDZ4V5.0-dev (r1292:r1399) au tronc principal

Validation:
La validation a consisté à compiler la HEAD de le trunk et de la banche
LMDZ4V5.0-dev et les sources fusionnées et de faire tourner le modéle selon
différentes configurations en local et sur SX8 et de comparer les résultats

En local: 32x24x11, config bench/gfortran

  • pour une config IPSLCM5A (comparaison tronc/fusion):
    • convergence numérique sur les champs dynamiques après 3 jours
    • restart et restartphy égaux (à part sur RN et Pb)
    • fichiers histoire égaux
  • pour une config nlle physique (MH07) (comparaison LMDZ4v5.0-dev/fusion):
    • convergence numérique sur les champs dynamiques après 3 jours
    • restart et restartphy égaux
    • fichiers histoire équivalents

Sur brodie, 96x95x39 sur 4 proc:

  • pour une config IPSLCM5A:
    • restart et restartphy égaux (à part sur RN et PB)
    • pas de différence dans les fichiers histmth.nc
  • pour une config MH07
    • restart et restartphy égaux (à part sur RN et PB)
    • pas de différence dans les fichiers histmth.nc

Changement sur makegcm et create_make-gcm pour pouvoir prendre en compte des
programmes principaux en *F90

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 18.5 KB
Line 
1!
2! $Id: etat0_netcdf.F90 1403 2010-07-01 09:02:53Z fairhead $
3!
4!-------------------------------------------------------------------------------
5!
6SUBROUTINE etat0_netcdf(ib, masque, letat0)
7!
8!-------------------------------------------------------------------------------
9! Purpose: Creates initial states
10!-------------------------------------------------------------------------------
11! Note: This routine is designed to work for Earth
12!-------------------------------------------------------------------------------
13  USE control_mod
14#ifdef CPP_EARTH
15  USE startvar
16  USE ioipsl
17  USE dimphy
18  USE infotrac
19  USE fonte_neige_mod
20  USE pbl_surface_mod
21  USE phys_state_var_mod
22  USE filtreg_mod
23  USE regr_lat_time_climoz_m, ONLY: regr_lat_time_climoz
24  USE conf_phys_m,            ONLY: conf_phys
25  USE netcdf, ONLY : NF90_OPEN, NF90_NOWRITE, NF90_CLOSE, NF90_NOERR
26#endif
27  IMPLICIT NONE
28!-------------------------------------------------------------------------------
29! Arguments:
30#include "dimensions.h"
31#include "paramet.h"
32#include "iniprint.h"
33  LOGICAL,                    INTENT(IN)    :: ib     ! barycentric interpolat.
34  REAL, DIMENSION(iip1,jjp1), INTENT(INOUT) :: masque ! land mask
35  LOGICAL,                    INTENT(IN)    :: letat0 ! F: masque only required
36#ifndef CPP_EARTH
37  WRITE(lunout,*)'limit_netcdf: Earth-specific routine, needs Earth physics'
38#else
39!-------------------------------------------------------------------------------
40! Local variables:
41#include "comgeom2.h"
42#include "comvert.h"
43#include "comconst.h"
44#include "indicesol.h"
45#include "dimsoil.h"
46#include "temps.h"
47  REAL,    DIMENSION(klon)                 :: tsol, qsol
48  REAL,    DIMENSION(klon)                 :: sn, rugmer, run_off_lic_0
49  REAL,    DIMENSION(iip1,jjp1)            :: orog, rugo, psol, phis
50  REAL,    DIMENSION(iip1,jjp1,llm+1)      :: p3d
51  REAL,    DIMENSION(iip1,jjp1,llm)        :: uvent, t3d, tpot, qsat, qd
52  REAL,    DIMENSION(iip1,jjm ,llm)        :: vvent
53  REAL,    DIMENSION(:,:,:,:), ALLOCATABLE :: q3d
54  REAL,    DIMENSION(klon,nbsrf)           :: qsolsrf, snsrf, evap
55  REAL,    DIMENSION(klon,nbsrf)           :: frugs, agesno
56  REAL,    DIMENSION(klon,nsoilmx,nbsrf)   :: tsoil
57
58!--- Local variables for sea-ice reading:
59  INTEGER                                  :: iml_lic, jml_lic, llm_tmp
60  INTEGER                                  :: ttm_tmp, iret, fid
61  INTEGER, DIMENSION(1)                    :: itaul
62  REAL,    DIMENSION(1)                    :: lev
63  REAL                                     :: date
64  REAL,    DIMENSION(:,:),   ALLOCATABLE   ::  lon_lic,  lat_lic, fraclic
65  REAL,    DIMENSION(:),     ALLOCATABLE   :: dlon_lic, dlat_lic
66  REAL,    DIMENSION(iip1,jjp1)            :: flic_tmp
67
68!--- Misc
69  CHARACTER(LEN=80)                        :: x, fmt
70  INTEGER                                  :: i, j, l, ji
71  REAL,    DIMENSION(iip1,jjp1,llm)        :: alpha, beta, pk, pls, y
72  REAL,    DIMENSION(ip1jmp1)              :: pks
73
74#include "comdissnew.h"
75#include "serre.h"
76#include "clesphys.h"
77
78  REAL,    DIMENSION(iip1,jjp1,llm)        :: masse
79  INTEGER :: itau, iday
80  REAL    :: xpn, xps, time, phystep
81  REAL,    DIMENSION(iim)                  :: xppn, xpps
82  REAL,    DIMENSION(ip1jmp1,llm)          :: pbaru, phi, w
83  REAL,    DIMENSION(ip1jm  ,llm)          :: pbarv
84  REAL,    DIMENSION(klon)                 :: fder
85
86!--- Local variables for ocean mask reading:
87  INTEGER :: nid_o2a, iml_omask, jml_omask
88  LOGICAL :: couple=.FALSE.
89  REAL,    DIMENSION(:,:), ALLOCATABLE ::  lon_omask, lat_omask, ocemask, ocetmp
90  REAL,    DIMENSION(:),   ALLOCATABLE :: dlon_omask,dlat_omask
91  REAL,    DIMENSION(klon)             :: ocemask_fi
92  INTEGER, DIMENSION(klon-2)           :: isst
93  REAL,    DIMENSION(iim,jjp1)         :: zx_tmp_2d
94  REAL    :: dummy
95  LOGICAL :: ok_newmicro, ok_journe, ok_mensuel, ok_instan, ok_hf
96  LOGICAL :: ok_LES, ok_ade, ok_aie, aerosol_couple, new_aod
97  INTEGER :: iflag_radia, flag_aerosol
98  REAL    :: bl95_b0, bl95_b1, fact_cldcon, facttemps, ratqsbas, ratqshaut
99  REAL    :: tau_ratqs
100  INTEGER :: iflag_cldcon, iflag_ratqs, iflag_coupl, iflag_clos, iflag_wake
101  INTEGER :: iflag_thermals, nsplit_thermals
102  INTEGER :: iflag_thermals_ed, iflag_thermals_optflux
103  REAL    :: tau_thermals, solarlong0,  seuil_inversion
104  INTEGER :: read_climoz ! read ozone climatology
105  REAL    :: alp_offset
106!  Allowed values are 0, 1 and 2
107!     0: do not read an ozone climatology
108!     1: read a single ozone climatology that will be used day and night
109!     2: read two ozone climatologies, the average day and night
110!     climatology and the daylight climatology
111!-------------------------------------------------------------------------------
112!--- Constants
113  pi     = 4. * ATAN(1.)
114  rad    = 6371229.
115  daysec = 86400.
116  omeg   = 2.*pi/daysec
117  g      = 9.8
118  kappa  = 0.2857143
119  cpp    = 1004.70885
120  preff  = 101325.
121  pa     = 50000.
122  jmp1   = jjm + 1
123
124!--- CONSTRUCT A GRID
125  CALL conf_phys(  ok_journe, ok_mensuel, ok_instan, ok_hf, ok_LES,     &
126                   solarlong0,seuil_inversion,                          &
127                   fact_cldcon, facttemps,ok_newmicro,iflag_radia,      &
128                   iflag_cldcon,                                        &
129                   iflag_ratqs,ratqsbas,ratqshaut,tau_ratqs,            &
130                   ok_ade, ok_aie, aerosol_couple,                      &
131                   flag_aerosol, new_aod,                               &
132                   bl95_b0, bl95_b1,                                    &
133                   iflag_thermals,nsplit_thermals,tau_thermals,         &
134                   iflag_thermals_ed,iflag_thermals_optflux,            &
135                   iflag_coupl,iflag_clos,iflag_wake, read_climoz,      &
136                   alp_offset )
137
138! co2_ppm0 : initial value of atmospheric CO2 from .def file (co2_ppm value)
139  co2_ppm0 = co2_ppm
140
141  dtvr   = daysec/FLOAT(day_step)
142  WRITE(lunout,*)'dtvr',dtvr
143
144  CALL iniconst()
145  CALL inigeom()
146
147!--- Initializations for tracers
148  CALL infotrac_init
149  ALLOCATE(q3d(iip1,jjp1,llm,nqtot))
150
151  CALL inifilr()
152  CALL phys_state_var_init(read_climoz)
153
154  rlat(1) = ASIN(1.0)
155  DO j=2,jjm; rlat((j-2)*iim+2:(j-1)*iim+1)=rlatu(j);     END DO
156  rlat(klon) = - ASIN(1.0)
157  rlat(:)=rlat(:)*(180.0/pi)
158
159  rlon(1) = 0.0
160  DO j=2,jjm; rlon((j-2)*iim+2:(j-1)*iim+1)=rlonv(1:iim); END DO
161  rlon(klon) = 0.0
162  rlon(:)=rlon(:)*(180.0/pi)
163
164! For a coupled simulation, the ocean mask from ocean model is used to compute
165! the weights an to insure ocean fractions are the same for atmosphere and ocean
166! Otherwise, mask is created using Relief file.
167
168  WRITE(lunout,*)'Essai de lecture masque ocean'
169  iret = NF90_OPEN("o2a.nc", NF90_NOWRITE, nid_o2a)
170  IF(iret/=NF90_NOERR) THEN
171    WRITE(lunout,*)'ATTENTION!! pas de fichier o2a.nc trouve'
172    WRITE(lunout,*)'Run force'
173    x='masque'
174    masque(:,:)=0.0
175    CALL startget_phys2d(x, iip1, jjp1, rlonv, rlatu, masque, 0.0, jjm, &
176   &              rlonu, rlatv, ib)
177    WRITE(lunout,*)'MASQUE construit : Masque'
178    WRITE(lunout,'(97I1)') nINT(masque)
179    CALL gr_dyn_fi(1, iip1, jjp1, klon, masque, zmasq)
180    WHERE(   zmasq(:)<EPSFRA) zmasq(:)=0.
181    WHERE(1.-zmasq(:)<EPSFRA) zmasq(:)=1.
182  ELSE
183    WRITE(lunout,*)'ATTENTION!! fichier o2a.nc trouve'
184    WRITE(lunout,*)'Run couple'
185    couple=.true.
186    iret=NF90_CLOSE(nid_o2a)
187    CALL flininfo("o2a.nc", iml_omask, jml_omask, llm_tmp, ttm_tmp, nid_o2a)
188    IF(iml_omask/=iim .OR.jml_omask/=jjp1) THEN
189      WRITE(lunout,*)'Dimensions non compatibles pour masque ocean'
190      WRITE(lunout,*)'iim = ',iim,' iml_omask = ',iml_omask
191      WRITE(lunout,*)'jjp1 = ',jjp1,' jml_omask = ',jml_omask
192      CALL abort_gcm('etat0_netcdf','Dimensions non compatibles pour masque oc&
193     &ean',1)
194    END IF
195    ALLOCATE(   ocemask(iml_omask,jml_omask),   ocetmp(iml_omask,jml_omask))
196    ALLOCATE( lon_omask(iml_omask,jml_omask),lat_omask(iml_omask,jml_omask))
197    ALLOCATE(dlon_omask(iml_omask),         dlat_omask(jml_omask))
198    CALL flinopen("o2a.nc", .FALSE., iml_omask, jml_omask, llm_tmp, lon_omask,&
199   &              lat_omask, lev, ttm_tmp, itaul, date, dt, fid)
200    CALL flinget(fid, 'OceMask', iml_omask, jml_omask, llm_tmp, ttm_tmp, &
201   &              1, 1, ocetmp)
202    CALL flinclo(fid)
203    dlon_omask(1:iml_omask) = lon_omask(1:iml_omask,1)
204    dlat_omask(1:jml_omask) = lat_omask(1,1:jml_omask)
205    ocemask = ocetmp
206    IF(dlat_omask(1)<dlat_omask(jml_omask)) THEN
207      DO j=1,jml_omask
208        ocemask(:,j) = ocetmp(:,jml_omask-j+1)
209      END DO
210    END IF
211!
212! Ocean mask to physical grid
213!*******************************************************************************
214    WRITE(lunout,*)'ocemask '
215    WRITE(fmt,"(i4,'i1)')")iml_omask ; fmt='('//ADJUSTL(fmt)
216    WRITE(lunout,fmt)int(ocemask)
217    ocemask_fi(1)=ocemask(1,1)
218    DO j=2,jjm; ocemask_fi((j-2)*iim+2:(j-1)*iim+1)=ocemask(1:iim,j); END DO
219    ocemask_fi(klon)=ocemask(1,jjp1)
220    zmasq=1.-ocemask_fi
221  END IF
222
223  CALL gr_fi_dyn(1,klon,iip1,jjp1,zmasq,masque)
224
225  ! The startget calls need to be replaced by a call to restget to get the
226  ! values in the restart file
227  x = 'relief'; orog(:,:) = 0.0
228  CALL startget_phys2d(x,iip1,jjp1,rlonv,rlatu, orog, 0.0,jjm,rlonu,rlatv,ib,&
229 &               masque)
230
231  x = 'rugosite'; rugo(:,:) = 0.0
232  CALL startget_phys2d(x,iip1,jjp1,rlonv,rlatu, rugo, 0.0,jjm, rlonu,rlatv,ib)
233!  WRITE(lunout,'(49I1)') INT(orog(:,:)*10)
234!  WRITE(lunout,'(49I1)') INT(rugo(:,:)*10)
235
236! Sub-surfaces initialization
237!*******************************************************************************
238  pctsrf=0.
239  x = 'psol'; psol(:,:) = 0.0
240  CALL startget_phys2d(x,iip1,jjp1,rlonv,rlatu,psol,0.0,jjm,rlonu,rlatv,ib)
241!  WRITE(lunout,*) 'PSOL :', psol(10,20)
242!  WRITE(lunout,*) ap(:), bp(:)
243
244! Mid-levels pressure computation
245!*******************************************************************************
246  CALL pression(ip1jmp1, ap, bp, psol, p3d)
247  CALL exner_hyb(ip1jmp1, psol, p3d, alpha, beta, pks, pk, y)
248  pls(:,:,:)=preff*(pk(:,:,:)/cpp)**(1./kappa)
249!  WRITE(lunout,*) 'P3D :', p3d(10,20,:)
250!  WRITE(lunout,*) 'PK:',    pk(10,20,:)
251!  WRITE(lunout,*) 'PLS :', pls(10,20,:)
252
253  x = 'surfgeo'; phis(:,:) = 0.0
254  CALL startget_phys2d(x,iip1,jjp1,rlonv,rlatu,phis, 0.0,jjm, rlonu,rlatv,ib)
255
256  x = 'u';    uvent(:,:,:) = 0.0
257  CALL startget_dyn(x,rlonu,rlatu,pls,y,uvent,0.0,  &
258 &                  rlonv,rlatv,ib)
259
260  x = 'v';    vvent(:,:,:) = 0.0
261  CALL startget_dyn(x, rlonv,rlatv,pls(:, :jjm, :),y(:, :jjm, :),vvent,0.0, &
262 &                  rlonu,rlatu(:jjm),ib)
263
264  x = 't';    t3d(:,:,:) = 0.0
265  CALL startget_dyn(x,rlonv,rlatu,pls,y,t3d,0.0,    &
266 &                  rlonu,rlatv,ib)
267
268  x = 'tpot'; tpot(:,:,:) = 0.0
269  CALL startget_dyn(x,rlonv,rlatu,pls,pk,tpot,0.0,  &
270 &                  rlonu,rlatv,ib)
271
272  WRITE(lunout,*) 'T3D min,max:',minval(t3d(:,:,:)),maxval(t3d(:,:,:))
273  WRITE(lunout,*) 'PLS min,max:',minval(pls(:,:,:)),maxval(pls(:,:,:))
274
275! Humidity at saturation computation
276!*******************************************************************************
277  WRITE(lunout,*) 'avant q_sat'
278  CALL q_sat(llm*jjp1*iip1, t3d, pls, qsat)
279  WRITE(lunout,*) 'apres q_sat'
280  WRITE(lunout,*) 'QSAT min,max:',minval(qsat(:,:,:)),maxval(qsat(:,:,:))
281!  WRITE(lunout,*) 'QSAT :',qsat(10,20,:)
282
283  x = 'q';    qd (:,:,:) = 0.0
284  CALL startget_dyn(x,rlonv,rlatu,pls,qsat,qd,0.0, rlonu,rlatv,ib)
285  q3d(:,:,:,:) = 0.0 ; q3d(:,:,:,1) = qd(:,:,:)
286
287!--- OZONE CLIMATOLOGY
288  IF(read_climoz>=1) CALL regr_lat_time_climoz(read_climoz)
289
290  x = 'tsol'; tsol(:) = 0.0
291  CALL startget_phys1d(x,iip1,jjp1,rlonv,rlatu,klon,tsol,0.0,jjm,rlonu,rlatv,ib)
292
293  x = 'qsol';  qsol(:) = 0.0
294  CALL startget_phys1d(x,iip1,jjp1,rlonv,rlatu,klon,qsol,0.0,jjm,rlonu,rlatv,ib)
295
296  x = 'snow';  sn(:) = 0.0
297  CALL startget_phys1d(x,iip1,jjp1,rlonv,rlatu,klon,sn,0.0,jjm,rlonu,rlatv,ib)
298
299  x = 'rads';  radsol(:) = 0.0
300  CALL startget_phys1d(x,iip1,jjp1,rlonv,rlatu,klon,radsol,0.0,jjm,rlonu,rlatv,ib)
301
302  x = 'rugmer'; rugmer(:) = 0.0
303  CALL startget_phys1d(x,iip1,jjp1,rlonv,rlatu,klon,rugmer,0.0,jjm,rlonu,rlatv,ib)
304
305  x = 'zmea';  zmea(:) = 0.0
306  CALL startget_phys1d(x,iip1,jjp1,rlonv,rlatu,klon,zmea,0.0,jjm,rlonu,rlatv,ib)
307
308  x = 'zstd';  zstd(:) = 0.0
309  CALL startget_phys1d(x,iip1,jjp1,rlonv,rlatu,klon,zstd,0.0,jjm,rlonu,rlatv,ib)
310
311  x = 'zsig';  zsig(:) = 0.0
312  CALL startget_phys1d(x,iip1,jjp1,rlonv,rlatu,klon,zsig,0.0,jjm,rlonu,rlatv,ib)
313
314  x = 'zgam';  zgam(:) = 0.0
315  CALL startget_phys1d(x,iip1,jjp1,rlonv,rlatu,klon,zgam,0.0,jjm,rlonu,rlatv,ib)
316
317  x = 'zthe';  zthe(:) = 0.0
318  CALL startget_phys1d(x,iip1,jjp1,rlonv,rlatu,klon,zthe,0.0,jjm,rlonu,rlatv,ib)
319
320  x = 'zpic';  zpic(:) = 0.0
321  CALL startget_phys1d(x,iip1,jjp1,rlonv,rlatu,klon,zpic,0.0,jjm,rlonu,rlatv,ib)
322
323  x = 'zval';  zval(:) = 0.0
324  CALL startget_phys1d(x,iip1,jjp1,rlonv,rlatu,klon,zval,0.0,jjm,rlonu,rlatv,ib)
325
326!  WRITE(lunout,'(48I3)') 'TSOL :', INT(tsol(2:klon)-273)
327
328! Soil ice file reading for soil fraction and soil ice fraction
329!*******************************************************************************
330  CALL flininfo("landiceref.nc", iml_lic, jml_lic, llm_tmp, ttm_tmp, fid)
331  ALLOCATE( lat_lic(iml_lic,jml_lic),lon_lic(iml_lic, jml_lic))
332  ALLOCATE(dlat_lic(jml_lic),       dlon_lic(iml_lic))
333  ALLOCATE( fraclic(iml_lic,jml_lic))
334  CALL flinopen("landiceref.nc", .FALSE., iml_lic, jml_lic, llm_tmp,  &
335 &               lon_lic, lat_lic, lev, ttm_tmp, itaul, date, dt, fid)
336  CALL flinget(fid, 'landice', iml_lic, jml_lic, llm_tmp, ttm_tmp, 1,1, fraclic)
337  CALL flinclo(fid)
338
339! Interpolation on model T-grid
340!*******************************************************************************
341  WRITE(lunout,*)'dimensions de landice iml_lic, jml_lic : ',iml_lic,jml_lic
342! conversion if coordinates are in degrees
343  IF(MAXVAL(lon_lic)>pi) lon_lic=lon_lic*pi/180.
344  IF(MAXVAL(lat_lic)>pi) lat_lic=lat_lic*pi/180.
345  dlon_lic(:)=lon_lic(:,1)
346  dlat_lic(:)=lat_lic(1,:)
347  CALL grille_m( iml_lic, jml_lic, dlon_lic, dlat_lic, fraclic, iim,jjp1,   &
348 &               rlonv, rlatu, flic_tmp(1:iim,:) )
349  flic_tmp(iip1,:)=flic_tmp(1,:)
350
351!--- To the physical grid
352  CALL gr_dyn_fi(1, iip1, jjp1, klon, flic_tmp, pctsrf(:,is_lic))
353
354!--- Adequation with soil/sea mask
355  WHERE(pctsrf(:,is_lic)<EPSFRA) pctsrf(:,is_lic)=0.
356  WHERE(zmasq(:)<EPSFRA)         pctsrf(:,is_lic)=0.
357  pctsrf(:,is_ter)=zmasq(:)
358  DO ji=1,klon
359    IF(zmasq(ji)>EPSFRA) THEN
360      IF(pctsrf(ji,is_lic)>=zmasq(ji)) THEN
361        pctsrf(ji,is_lic)=zmasq(ji)
362        pctsrf(ji,is_ter)=0.
363      ELSE
364        pctsrf(ji,is_ter)=zmasq(ji)-pctsrf(ji,is_lic)
365        IF(pctsrf(ji,is_ter)<EPSFRA) THEN
366          pctsrf(ji,is_ter)=0.
367          pctsrf(ji,is_lic)=zmasq(ji)
368        END IF
369      END IF
370    END IF
371  END DO
372
373! sub-surface ocean and sea ice (sea ice set to zero for start)
374!*******************************************************************************
375  pctsrf(:,is_oce)=(1.-zmasq(:))
376  WHERE(pctsrf(:,is_oce)<EPSFRA) pctsrf(:,is_oce)=0.
377  IF(couple) pctsrf(:,is_oce)=ocemask_fi(:)
378  isst=0
379  WHERE(pctsrf(2:klon-1,is_oce)>0.) isst=1
380
381! It is checked that the sub-surfaces sum is equal to 1
382!*******************************************************************************
383  ji=COUNT((ABS(SUM(pctsrf(:,:),dim=2))-1.0)>EPSFRA)
384  IF(ji/=0) WRITE(lunout,*) 'pb repartition sous maille pour ',ji,' points'
385  CALL gr_fi_ecrit(1, klon, iim, jjp1, zmasq, zx_tmp_2d)
386!  WRITE(fmt,"(i3,')')")iim; fmt='(i'//ADJUSTL(fmt)
387!  WRITE(lunout,*)'zmasq = '
388!  WRITE(lunout,TRIM(fmt))NINT(zx_tmp_2d)
389  CALL gr_fi_dyn(1, klon, iip1, jjp1, zmasq, masque)
390  WRITE(fmt,"(i4,'i1)')")iip1 ; fmt='('//ADJUSTL(fmt)
391  WRITE(lunout,*) 'MASQUE construit : Masque'
392  WRITE(lunout,TRIM(fmt))NINT(masque(:,:))
393
394! Intermediate computation
395!*******************************************************************************
396  CALL massdair(p3d,masse)
397  WRITE(lunout,*)' ALPHAX ',alphax
398  DO l=1,llm
399    xppn(:)=aire(1:iim,1   )*masse(1:iim,1   ,l)
400    xpps(:)=aire(1:iim,jjp1)*masse(1:iim,jjp1,l)
401    xpn=SUM(xppn)/apoln
402    xps=SUM(xpps)/apols
403    masse(:,1   ,l)=xpn
404    masse(:,jjp1,l)=xps
405  END DO
406  q3d(iip1,:,:,:)=q3d(1,:,:,:)
407  phis(iip1,:) = phis(1,:)
408
409  IF(.NOT.letat0) RETURN
410
411! Writing
412!*******************************************************************************
413  CALL inidissip(lstardis,nitergdiv,nitergrot,niterh,tetagdiv,tetagrot,tetatemp)
414  WRITE(lunout,*)'sortie inidissip'
415  itau=0
416  itau_dyn=0
417  itau_phy=0
418  iday=dayref+itau/day_step
419  time=FLOAT(itau-(iday-dayref)*day_step)/day_step
420  IF(time>1.) THEN
421   time=time-1
422   iday=iday+1
423  END IF
424  day_ref=dayref
425  annee_ref=anneeref
426
427  CALL geopot( ip1jmp1, tpot, pk, pks, phis, phi )
428  WRITE(lunout,*)'sortie geopot'
429
430  CALL caldyn0( itau, uvent, vvent, tpot, psol, masse, pk, phis,               &
431                phi,  w, pbaru, pbarv, time+iday-dayref)
432  WRITE(lunout,*)'sortie caldyn0'     
433  CALL dynredem0( "start.nc", dayref, phis)
434  WRITE(lunout,*)'sortie dynredem0'
435  CALL dynredem1( "start.nc", 0.0, vvent, uvent, tpot, q3d, masse, psol)
436  WRITE(lunout,*)'sortie dynredem1'
437
438! Physical initial state writting
439!*******************************************************************************
440  WRITE(lunout,*)'phystep ',dtvr,iphysiq,nbapp_rad
441  phystep   = dtvr * FLOAT(iphysiq)
442  radpas    = NINT (86400./phystep/ FLOAT(nbapp_rad) )
443  WRITE(lunout,*)'phystep =', phystep, radpas
444
445! Init: tsol, qsol, sn, evap, tsoil, rain_fall, snow_fall, solsw, sollw, frugs
446!*******************************************************************************
447  DO i=1,nbsrf; ftsol(:,i) = tsol; END DO
448  DO i=1,nbsrf; snsrf(:,i) = sn;   END DO
449  falb1(:,is_ter) = 0.08; falb1(:,is_lic) = 0.6
450  falb1(:,is_oce) = 0.5;  falb1(:,is_sic) = 0.6
451  falb2 = falb1
452  evap(:,:) = 0.
453  DO i=1,nbsrf; qsolsrf(:,i)=150.; END DO
454  DO i=1,nbsrf; DO j=1,nsoilmx; tsoil(:,j,i) = tsol; END DO; END DO
455  rain_fall = 0.; snow_fall = 0.
456  solsw = 165.;   sollw = -53.
457  t_ancien = 273.15
458  q_ancien = 0.
459  agesno = 0.
460  frugs(:,is_oce) = rugmer(:)
461  frugs(:,is_ter) = MAX(1.0e-05,zstd(:)*zsig(:)/2.0)
462  frugs(:,is_lic) = MAX(1.0e-05,zstd(:)*zsig(:)/2.0)
463  frugs(:,is_sic) = 0.001
464  fder = 0.0
465  clwcon = 0.0
466  rnebcon = 0.0
467  ratqs = 0.0
468  run_off_lic_0 = 0.0
469  rugoro = 0.0
470
471! Before phyredem calling, surface modules and values to be saved in startphy.nc
472! are initialized
473!*******************************************************************************
474  dummy = 1.0
475  pbl_tke(:,:,:) = 1.e-8
476  zmax0(:) = 40.
477  f0(:) = 1.e-5
478  ema_work1(:,:) = 0.
479  ema_work2(:,:) = 0.
480  wake_deltat(:,:) = 0.
481  wake_deltaq(:,:) = 0.
482  wake_s(:) = 0.
483  wake_cstar(:) = 0.
484  wake_fip(:) = 0.
485  CALL fonte_neige_init(run_off_lic_0)
486  CALL pbl_surface_init( qsol, fder, snsrf, qsolsrf, evap, frugs, agesno, tsoil )
487  CALL phyredem( "startphy.nc" )
488
489!  WRITE(lunout,*)'CCCCCCCCCCCCCCCCCC REACTIVER SORTIE VISU DANS ETAT0'
490!  WRITE(lunout,*)'entree histclo'
491  CALL histclo()
492
493#endif
494!#endif of #ifdef CPP_EARTH
495  RETURN
496
497END SUBROUTINE etat0_netcdf
498!
499!-------------------------------------------------------------------------------
Note: See TracBrowser for help on using the repository browser.