source: LMDZ5/trunk/libf/dyn3d/etat0_netcdf.F90 @ 1498

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

Modified closure for the new physics package, new values for the iflag_coupl parameter
FH


Fermeture modifiée pour la nouvelle physique, nouvelles valeurs définies pour
le paramètre iflag_coupl
FH

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