source: LMDZ6/branches/Test_modipsl/libf/phylmdiso/phyetat0_mod.F90 @ 4623

Last change on this file since 4623 was 4581, checked in by evignon, 17 months ago

(derni?) ajustement et correction de l'initialisation de la neige soufflee
dans phyetat0_mod
dans le cadre de la mise au point de la nouvelle testing
Lionel et Etienne

File size: 24.1 KB
Line 
1! $Id: phyetat0.F90 3890 2021-05-05 15:15:06Z jyg $
2
3MODULE phyetat0_mod
4
5  PRIVATE
6  PUBLIC :: phyetat0
7
8CONTAINS
9
10SUBROUTINE phyetat0 (fichnom, clesphy0, tabcntr0)
11
12  USE dimphy, only: klon, zmasq, klev
13  USE iophy, ONLY : init_iophy_new
14  USE ocean_cpl_mod,    ONLY : ocean_cpl_init
15  USE fonte_neige_mod,  ONLY : fonte_neige_init
16  USE pbl_surface_mod,  ONLY : pbl_surface_init
17#ifdef ISO
18  USE fonte_neige_mod,  ONLY : fonte_neige_init_iso
19  USE pbl_surface_mod,  ONLY : pbl_surface_init_iso
20#endif
21  USE phyetat0_get_mod, ONLY : phyetat0_get, phyetat0_srf
22  USE surface_data,     ONLY : type_ocean, version_ocean
23  USE phys_state_var_mod, ONLY : ancien_ok, clwcon, detr_therm, phys_tstep, &
24       qsol, fevap, z0m, z0h, agesno, &
25       du_gwd_rando, du_gwd_front, entr_therm, f0, fm_therm, &
26       falb_dir, falb_dif, prw_ancien, prlw_ancien, prsw_ancien, prbsw_ancien, &
27       ftsol, pbl_tke, pctsrf, q_ancien, ql_ancien, qs_ancien, qbs_ancien, rneb_ancien, radpas, radsol, rain_fall, ratqs, &
28       rnebcon, rugoro, sig1, snow_fall, bs_fall, solaire_etat0, sollw, sollwdown, &
29       solsw, solswfdiff, t_ancien, u_ancien, v_ancien, w01, wake_cstar, wake_deltaq, &
30       wake_deltat, wake_delta_pbl_TKE, delta_tsurf, beta_aridity, wake_fip, wake_pe, &
31       wake_s, wake_dens, awake_dens, cv_gen, zgam, zmax0, zmea, zpic, zsig, &
32#ifdef ISO
33       fxtevap, xtsol, xt_ancien, xtl_ancien, xts_ancien, wake_deltaxt, &
34       xtrain_fall,xtsnow_fall, &
35#endif
36       zstd, zthe, zval, ale_bl, ale_bl_trig, alp_bl, u10m, v10m, treedrg, &
37       ale_wake, ale_bl_stat, ds_ns, dt_ns, delta_sst, delta_sal, dter, dser, &
38       dt_ds, ratqs_inter
39!FC
40  USE geometry_mod,     ONLY: longitude_deg, latitude_deg
41  USE iostart,          ONLY: close_startphy, get_field, get_var, open_startphy
42  USE infotrac_phy,     ONLY: nqtot, nbtr, type_trac, tracers
43  USE readTracFiles_mod,ONLY: maxlen, new2oldH2O
44  USE traclmdz_mod,     ONLY: traclmdz_from_restart
45  USE carbon_cycle_mod, ONLY: carbon_cycle_init, carbon_cycle_cpl, carbon_cycle_tr, carbon_cycle_rad, co2_send, RCO2_glo
46  USE indice_sol_mod,   ONLY: nbsrf, is_ter, epsfra, is_lic, is_oce, is_sic
47  USE ocean_slab_mod,   ONLY: nslay, tslab, seaice, tice, ocean_slab_init
48  USE time_phylmdz_mod, ONLY: init_iteration, pdtphys, itau_phy
49#ifdef CPP_XIOS
50  USE wxios, ONLY: missing_val
51#else
52  use netcdf, only: missing_val => nf90_fill_real
53#endif
54  use config_ocean_skin_m, only: activate_ocean_skin
55#ifdef ISO
56  USE infotrac_phy, ONLY: niso
57  USE isotopes_routines_mod, ONLY: phyisoetat0
58  USE isotopes_mod, ONLY: iso_eau
59#ifdef ISOVERIF
60  USE isotopes_verif_mod, ONLY: iso_verif_egalite_vect2D,iso_verif_egalite
61#endif
62#endif
63
64  IMPLICIT none
65  !======================================================================
66  ! Auteur(s) Z.X. Li (LMD/CNRS) date: 19930818
67  ! Objet: Lecture de l'etat initial pour la physique
68  !======================================================================
69  include "dimsoil.h"
70  include "clesphys.h"
71  include "alpale.h"
72  include "compbl.h"
73  include "YOMCST.h"
74  !======================================================================
75  CHARACTER*(*) fichnom
76
77  ! les variables globales lues dans le fichier restart
78
79  REAL tsoil(klon, nsoilmx, nbsrf)
80  REAL qsurf(klon, nbsrf)
81  REAL snow(klon, nbsrf)
82  real fder(klon)
83  REAL run_off_lic_0(klon)
84  REAL fractint(klon)
85  REAL trs(klon, nbtr)
86  REAL zts(klon)
87  ! pour drag arbres FC
88  REAL drg_ter(klon,klev)
89
90  CHARACTER*6 ocean_in
91  LOGICAL ok_veget_in
92
93  INTEGER        longcles
94  PARAMETER    ( longcles = 20 )
95  REAL clesphy0( longcles )
96
97  REAL xmin, xmax
98
99  INTEGER nid, nvarid
100  INTEGER ierr, i, nsrf, isoil , k
101  INTEGER length
102  PARAMETER (length=100)
103  INTEGER it, iq, isw
104  REAL tab_cntrl(length), tabcntr0(length)
105  CHARACTER*7 str7
106  CHARACTER*2 str2
107  LOGICAL :: found
108  REAL :: lon_startphy(klon), lat_startphy(klon)
109  CHARACTER(LEN=maxlen) :: tname, t(2)
110
111#ifdef ISO
112  REAL xtsnow(niso,klon, nbsrf)
113  REAL xtrun_off_lic_0(niso,klon)
114  REAL Rland_ice(niso,klon)
115#endif
116  ! FH1D
117  !     real iolat(jjm+1)
118  !real iolat(jjm+1-1/(iim*jjm))
119
120  ! Ouvrir le fichier contenant l'etat initial:
121
122  CALL open_startphy(fichnom)
123
124  ! Lecture des parametres de controle:
125
126  CALL get_var("controle", tab_cntrl)
127
128!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
129  ! FH 2008/05/09 On elimine toutes les clefs physiques dans la dynamique
130  ! Les constantes de la physiques sont lues dans la physique seulement.
131  ! Les egalites du type
132  !             tab_cntrl( 5 )=clesphy0(1)
133  ! sont remplacees par
134  !             clesphy0(1)=tab_cntrl( 5 )
135  ! On inverse aussi la logique.
136  ! On remplit les tab_cntrl avec les parametres lus dans les .def
137!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
138
139  DO i = 1, length
140     tabcntr0( i ) = tab_cntrl( i )
141  ENDDO
142
143  tab_cntrl(1)=pdtphys
144  tab_cntrl(2)=radpas
145
146  ! co2_ppm : value from the previous time step
147
148  ! co2_ppm0 : initial value of atmospheric CO2 (from create_etat0_limit.e .def)
149  co2_ppm0 = 284.32
150  ! when no initial value is available e.g., from a restart
151  ! this variable must be set  in a .def file which will then be
152  ! used by the conf_phys_m.F90 routine.
153  ! co2_ppm0 = 284.32 (illustrative example on how to set the variable in .def
154  ! file, for a pre-industrial CO2 concentration value)
155
156  IF (carbon_cycle_tr .OR. carbon_cycle_cpl) THEN
157     co2_ppm = tab_cntrl(3)
158     RCO2    = co2_ppm * 1.0e-06 * RMCO2 / RMD
159     IF (tab_cntrl(17) > 0. .AND. carbon_cycle_rad) THEN
160           RCO2_glo = tab_cntrl(17)
161       ELSE
162           RCO2_glo    = co2_ppm0 * 1.0e-06 * RMCO2 / RMD
163     ENDIF
164     ! ELSE : keep value from .def
165  ENDIF
166
167  solaire_etat0      = tab_cntrl(4)
168  tab_cntrl(5)=iflag_con
169  tab_cntrl(6)=nbapp_rad
170
171  IF (iflag_cycle_diurne.GE.1) tab_cntrl( 7) = iflag_cycle_diurne
172  IF (soil_model) tab_cntrl( 8) =1.
173  IF (new_oliq) tab_cntrl( 9) =1.
174  IF (ok_orodr) tab_cntrl(10) =1.
175  IF (ok_orolf) tab_cntrl(11) =1.
176  IF (ok_limitvrai) tab_cntrl(12) =1.
177
178  itau_phy = tab_cntrl(15)
179
180  clesphy0(1)=tab_cntrl( 5 )
181  clesphy0(2)=tab_cntrl( 6 )
182  clesphy0(3)=tab_cntrl( 7 )
183  clesphy0(4)=tab_cntrl( 8 )
184  clesphy0(5)=tab_cntrl( 9 )
185  clesphy0(6)=tab_cntrl( 10 )
186  clesphy0(7)=tab_cntrl( 11 )
187  clesphy0(8)=tab_cntrl( 12 )
188  clesphy0(9)=tab_cntrl( 17 )
189
190  ! set time iteration
191   CALL init_iteration(itau_phy)
192
193  ! read latitudes and make a sanity check (because already known from dyn)
194  CALL get_field("latitude",lat_startphy)
195  DO i=1,klon
196    IF (ABS(lat_startphy(i)-latitude_deg(i))>=1) THEN
197      WRITE(*,*) "phyetat0: Error! Latitude discrepancy wrt startphy file:",&
198                 " i=",i," lat_startphy(i)=",lat_startphy(i),&
199                 " latitude_deg(i)=",latitude_deg(i)
200      ! This is presumably serious enough to abort run
201      CALL abort_physic("phyetat0","discrepancy in latitudes!",1)
202    ENDIF
203    IF (ABS(lat_startphy(i)-latitude_deg(i))>=0.0001) THEN
204      WRITE(*,*) "phyetat0: Warning! Latitude discrepancy wrt startphy file:",&
205                 " i=",i," lat_startphy(i)=",lat_startphy(i),&
206                 " latitude_deg(i)=",latitude_deg(i)
207    ENDIF
208  ENDDO
209
210  ! read longitudes and make a sanity check (because already known from dyn)
211  CALL get_field("longitude",lon_startphy)
212  DO i=1,klon
213    IF (ABS(lon_startphy(i)-longitude_deg(i))>=1) THEN
214      IF (ABS(360-ABS(lon_startphy(i)-longitude_deg(i)))>=1) THEN
215        WRITE(*,*) "phyetat0: Error! Longitude discrepancy wrt startphy file:",&
216                   " i=",i," lon_startphy(i)=",lon_startphy(i),&
217                   " longitude_deg(i)=",longitude_deg(i)
218        ! This is presumably serious enough to abort run
219        CALL abort_physic("phyetat0","discrepancy in longitudes!",1)
220      ENDIF
221    ENDIF
222    IF (ABS(lon_startphy(i)-longitude_deg(i))>=1) THEN
223      IF (ABS(360-ABS(lon_startphy(i)-longitude_deg(i))) > 0.0001) THEN
224        WRITE(*,*) "phyetat0: Warning! Longitude discrepancy wrt startphy file:",&
225                   " i=",i," lon_startphy(i)=",lon_startphy(i),&
226                   " longitude_deg(i)=",longitude_deg(i)
227      ENDIF
228    ENDIF
229  ENDDO
230
231  ! Lecture du masque terre mer
232
233  CALL get_field("masque", zmasq, found)
234  IF (.NOT. found) THEN
235     PRINT*, 'phyetat0: Le champ <masque> est absent'
236     PRINT *, 'fichier startphy non compatible avec phyetat0'
237  ENDIF
238
239  ! Lecture des fractions pour chaque sous-surface
240
241  ! initialisation des sous-surfaces
242
243  pctsrf = 0.
244
245  ! fraction de terre
246
247  CALL get_field("FTER", pctsrf(:, is_ter), found)
248  IF (.NOT. found) PRINT*, 'phyetat0: Le champ <FTER> est absent'
249
250  ! fraction de glace de terre
251
252  CALL get_field("FLIC", pctsrf(:, is_lic), found)
253  IF (.NOT. found) PRINT*, 'phyetat0: Le champ <FLIC> est absent'
254
255  ! fraction d'ocean
256
257  CALL get_field("FOCE", pctsrf(:, is_oce), found)
258  IF (.NOT. found) PRINT*, 'phyetat0: Le champ <FOCE> est absent'
259
260  ! fraction glace de mer
261
262  CALL get_field("FSIC", pctsrf(:, is_sic), found)
263  IF (.NOT. found) PRINT*, 'phyetat0: Le champ <FSIC> est absent'
264
265  !  Verification de l'adequation entre le masque et les sous-surfaces
266
267  fractint( 1 : klon) = pctsrf(1 : klon, is_ter)  &
268       + pctsrf(1 : klon, is_lic)
269  DO i = 1 , klon
270     IF ( abs(fractint(i) - zmasq(i) ) .GT. EPSFRA ) THEN
271        WRITE(*, *) 'phyetat0: attention fraction terre pas ',  &
272             'coherente ', i, zmasq(i), pctsrf(i, is_ter) &
273             , pctsrf(i, is_lic)
274        WRITE(*, *) 'Je force la coherence zmasq=fractint'
275        zmasq(i) = fractint(i)
276     ENDIF
277  ENDDO
278  fractint (1 : klon) =  pctsrf(1 : klon, is_oce)  &
279       + pctsrf(1 : klon, is_sic)
280  DO i = 1 , klon
281     IF ( abs( fractint(i) - (1. - zmasq(i))) .GT. EPSFRA ) THEN
282        WRITE(*, *) 'phyetat0 attention fraction ocean pas ',  &
283             'coherente ', i, zmasq(i) , pctsrf(i, is_oce) &
284             , pctsrf(i, is_sic)
285        WRITE(*, *) 'Je force la coherence zmasq=1.-fractint'
286        zmasq(i) = 1. - fractint(i)
287     ENDIF
288  ENDDO
289
290!===================================================================
291! Lecture des temperatures du sol:
292!===================================================================
293
294  found=phyetat0_get(ftsol(:,1),"TS","Surface temperature",283.)
295  IF (found) THEN
296     DO nsrf=2,nbsrf
297        ftsol(:,nsrf)=ftsol(:,1)
298     ENDDO
299  ELSE
300     found=phyetat0_srf(ftsol,"TS","Surface temperature",283.)
301  ENDIF
302
303!===================================================================
304  ! Lecture des albedo difus et direct
305!===================================================================
306
307  DO nsrf = 1, nbsrf
308     DO isw=1, nsw
309        IF (isw.GT.99) THEN
310           PRINT*, "Trop de bandes SW"
311           call abort_physic("phyetat0", "", 1)
312        ENDIF
313        WRITE(str2, '(i2.2)') isw
314        found=phyetat0_srf(falb_dir(:, isw,:),"A_dir_SW"//str2//"srf","Direct Albedo",0.2)
315        found=phyetat0_srf(falb_dif(:, isw,:),"A_dif_SW"//str2//"srf","Direct Albedo",0.2)
316     ENDDO
317  ENDDO
318
319  found=phyetat0_srf(u10m,"U10M","u a 10m",0.)
320  found=phyetat0_srf(v10m,"V10M","v a 10m",0.)
321
322!===================================================================
323  ! Lecture des temperatures du sol profond:
324!===================================================================
325
326   DO isoil=1, nsoilmx
327        IF (isoil.GT.99) THEN
328           PRINT*, "Trop de couches "
329           call abort_physic("phyetat0", "", 1)
330        ENDIF
331        WRITE(str2,'(i2.2)') isoil
332        found=phyetat0_srf(tsoil(:, isoil,:),"Tsoil"//str2//"srf","Temp soil",0.)
333        IF (.NOT. found) THEN
334           PRINT*, "phyetat0: Le champ <Tsoil"//str7//"> est absent"
335           PRINT*, "          Il prend donc la valeur de surface"
336           tsoil(:, isoil, :)=ftsol(:, :)
337        ENDIF
338   ENDDO
339
340!=======================================================================
341! Lecture precipitation/evaporation
342!=======================================================================
343
344  found=phyetat0_srf(qsurf,"QS","Near surface hmidity",0.)
345  found=phyetat0_get(qsol,"QSOL","Surface hmidity / bucket",0.)
346  found=phyetat0_srf(snow,"SNOW","Surface snow",0.)
347  found=phyetat0_srf(fevap,"EVAP","evaporation",0.)
348  found=phyetat0_get(snow_fall,"snow_f","snow fall",0.)
349  found=phyetat0_get(rain_fall,"rain_f","rain fall",0.)
350
351  IF (ok_bs) THEN
352     found=phyetat0_get(bs_fall,"bs_f","blowing snow fall",0.)
353  ELSE
354     bs_fall(:)=0.
355  ENDIF
356
357
358!=======================================================================
359! Radiation
360!=======================================================================
361
362  found=phyetat0_get(solsw,"solsw","net SW radiation surf",0.)
363  found=phyetat0_get(solswfdiff,"solswfdiff","fraction of SW radiation surf that is diffuse",1.)
364  found=phyetat0_get(sollw,"sollw","net LW radiation surf",0.)
365  found=phyetat0_get(sollwdown,"sollwdown","down LW radiation surf",0.)
366  IF (.NOT. found) THEN
367     sollwdown(:) = 0. ;  zts(:)=0.
368     DO nsrf=1,nbsrf
369        zts(:)=zts(:)+ftsol(:,nsrf)*pctsrf(:,nsrf)
370     ENDDO
371     sollwdown(:)=sollw(:)+RSIGMA*zts(:)**4
372  ENDIF
373
374  found=phyetat0_get(radsol,"RADS","Solar radiation",0.)
375  found=phyetat0_get(fder,"fder","Flux derivative",0.)
376
377
378  ! Lecture de la longueur de rugosite
379  found=phyetat0_srf(z0m,"RUG","Z0m ancien",0.001)
380  IF (found) THEN
381     z0h(:,1:nbsrf)=z0m(:,1:nbsrf)
382  ELSE
383     found=phyetat0_srf(z0m,"Z0m","Roughness length, momentum ",0.001)
384     found=phyetat0_srf(z0h,"Z0h","Roughness length, enthalpy ",0.001)
385  ENDIF
386!FC
387  IF (ifl_pbltree>0) THEN
388!CALL get_field("FTER", pctsrf(:, is_ter), found)
389    treedrg(:,1:klev,1:nbsrf)= 0.0
390    CALL get_field("treedrg_ter", drg_ter(:,:), found)
391!  found=phyetat0_srf(treedrg,"treedrg","drag from vegetation" , 0.)
392    !lecture du profile de freinage des arbres
393    IF (.not. found ) THEN
394      treedrg(:,1:klev,1:nbsrf)= 0.0
395    ELSE
396      treedrg(:,1:klev,is_ter)= drg_ter(:,:)
397!     found=phyetat0_get(treedrg,"treedrg","freinage arbres",0.)
398    ENDIF
399  ELSE
400    ! initialize treedrg(), because it will be written in restartphy.nc
401    treedrg(:,:,:) = 0.0
402  ENDIF
403
404  ! Lecture de l'age de la neige:
405  found=phyetat0_srf(agesno,"AGESNO","SNOW AGE",0.001)
406
407  ancien_ok=.true.
408  ancien_ok=ancien_ok.AND.phyetat0_get(t_ancien,"TANCIEN","TANCIEN",0.)
409  ancien_ok=ancien_ok.AND.phyetat0_get(q_ancien,"QANCIEN","QANCIEN",0.)
410  ancien_ok=ancien_ok.AND.phyetat0_get(ql_ancien,"QLANCIEN","QLANCIEN",0.)
411  ancien_ok=ancien_ok.AND.phyetat0_get(qs_ancien,"QSANCIEN","QSANCIEN",0.)
412  ancien_ok=ancien_ok.AND.phyetat0_get(rneb_ancien,"RNEBANCIEN","RNEBANCIEN",0.)
413  ancien_ok=ancien_ok.AND.phyetat0_get(u_ancien,"UANCIEN","UANCIEN",0.)
414  ancien_ok=ancien_ok.AND.phyetat0_get(v_ancien,"VANCIEN","VANCIEN",0.)
415  ancien_ok=ancien_ok.AND.phyetat0_get(prw_ancien,"PRWANCIEN","PRWANCIEN",0.)
416  ancien_ok=ancien_ok.AND.phyetat0_get(prlw_ancien,"PRLWANCIEN","PRLWANCIEN",0.)
417  ancien_ok=ancien_ok.AND.phyetat0_get(prsw_ancien,"PRSWANCIEN","PRSWANCIEN",0.)
418
419  ! cas specifique des variables de la neige soufflee
420  IF (ok_bs) THEN
421     ancien_ok=ancien_ok.AND.phyetat0_get(qbs_ancien,"QBSANCIEN","QBSANCIEN",0.)
422     ancien_ok=ancien_ok.AND.phyetat0_get(prbsw_ancien,"PRBSWANCIEN","PRBSWANCIEN",0.)
423  ELSE
424     qbs_ancien(:,:)=0.
425     prbsw_ancien(:)=0.
426  ENDIF
427
428
429  ! Ehouarn: addtional tests to check if t_ancien, q_ancien contain
430  !          dummy values (as is the case when generated by ce0l,
431  !          or by iniaqua)
432  IF ( (maxval(q_ancien).EQ.minval(q_ancien))       .OR. &
433       (maxval(ql_ancien).EQ.minval(ql_ancien))     .OR. &
434       (maxval(qs_ancien).EQ.minval(qs_ancien))     .OR. &
435       (maxval(rneb_ancien).EQ.minval(rneb_ancien)) .OR. &
436       (maxval(prw_ancien).EQ.minval(prw_ancien))   .OR. &
437       (maxval(prlw_ancien).EQ.minval(prlw_ancien)) .OR. &
438       (maxval(prsw_ancien).EQ.minval(prsw_ancien)) .OR. &
439       (maxval(t_ancien).EQ.minval(t_ancien)) ) THEN
440    ancien_ok=.false.
441  ENDIF
442
443  IF (ok_bs) THEN
444    IF ( (maxval(qbs_ancien).EQ.minval(qbs_ancien))       .OR. &
445         (maxval(prbsw_ancien).EQ.minval(prbsw_ancien)) ) THEN
446       ancien_ok=.false.
447    ENDIF
448  ENDIF
449
450
451  found=phyetat0_get(clwcon,"CLWCON","CLWCON",0.)
452  found=phyetat0_get(rnebcon,"RNEBCON","RNEBCON",0.)
453  found=phyetat0_get(ratqs,"RATQS","RATQS",0.)
454
455  found=phyetat0_get(run_off_lic_0,"RUNOFFLIC0","RUNOFFLIC0",0.)
456
457!==================================
458!  TKE
459!==================================
460!
461  IF (iflag_pbl>1) then
462     found=phyetat0_srf(pbl_tke,"TKE","Turb. Kinetic. Energ. ",1.e-8)
463  ENDIF
464
465  IF (iflag_pbl>1 .AND. iflag_wake>=1  .AND. iflag_pbl_split >=1 ) then
466    found=phyetat0_srf(wake_delta_pbl_tke,"DELTATKE","Del TKE wk/env",0.)
467!!    found=phyetat0_srf(delta_tsurf,"DELTA_TSURF","Delta Ts wk/env ",0.)
468    found=phyetat0_srf(delta_tsurf,"DELTATS","Delta Ts wk/env ",0.)
469!!    found=phyetat0_srf(beta_aridity,"BETA_S","Aridity factor ",1.)
470    found=phyetat0_srf(beta_aridity,"BETAS","Aridity factor ",1.)
471  ENDIF   !(iflag_pbl>1 .AND. iflag_wake>=1 .AND. iflag_pbl_split >=1 )
472
473!==================================
474!  thermiques, poches, convection
475!==================================
476
477! Emanuel
478  found=phyetat0_get(sig1,"sig1","sig1",0.)
479  found=phyetat0_get(w01,"w01","w01",0.)
480
481! Wake
482  found=phyetat0_get(wake_deltat,"WAKE_DELTAT","Delta T wake/env",0.)
483  found=phyetat0_get(wake_deltaq,"WAKE_DELTAQ","Delta hum. wake/env",0.)
484  found=phyetat0_get(wake_s,"WAKE_S","Wake frac. area",0.)
485!jyg<
486!  Set wake_dens to -1000. when there is no restart so that the actual
487!  initialization is made in calwake.
488!!  found=phyetat0_get(1,wake_dens,"WAKE_DENS","Wake num. /unit area",0.)
489  found=phyetat0_get(wake_dens,"WAKE_DENS","Wake num. /unit area",-1000.)
490  found=phyetat0_get(awake_dens,"AWAKE_DENS","Active Wake num. /unit area",0.)
491  found=phyetat0_get(cv_gen,"CV_GEN","CB birth rate",0.)
492!>jyg
493  found=phyetat0_get(wake_cstar,"WAKE_CSTAR","WAKE_CSTAR",0.)
494  found=phyetat0_get(wake_pe,"WAKE_PE","WAKE_PE",0.)
495  found=phyetat0_get(wake_fip,"WAKE_FIP","WAKE_FIP",0.)
496
497! Thermiques
498  found=phyetat0_get(zmax0,"ZMAX0","ZMAX0",40.)
499  found=phyetat0_get(f0,"F0","F0",1.e-5)
500  found=phyetat0_get(fm_therm,"FM_THERM","Thermals mass flux",0.)
501  found=phyetat0_get(entr_therm,"ENTR_THERM","Thermals Entrain.",0.)
502  found=phyetat0_get(detr_therm,"DETR_THERM","Thermals Detrain.",0.)
503
504! ALE/ALP
505  found=phyetat0_get(ale_bl,"ALE_BL","ALE BL",0.)
506  found=phyetat0_get(ale_bl_trig,"ALE_BL_TRIG","ALE BL_TRIG",0.)
507  found=phyetat0_get(alp_bl,"ALP_BL","ALP BL",0.)
508  found=phyetat0_get(ale_wake,"ALE_WAKE","ALE_WAKE",0.)
509  found=phyetat0_get(ale_bl_stat,"ALE_BL_STAT","ALE_BL_STAT",0.)
510
511! fisrtilp/Clouds 0.002 could be ratqsbas. But can stay like this as well
512  found=phyetat0_get(ratqs_inter,"RATQS_INTER","Relative width of the lsc sugrid scale water",0.002)
513
514!===========================================
515  ! Read and send field trs to traclmdz
516!===========================================
517
518!--OB now this is for co2i - ThL: and therefore also for inco
519  IF (ANY(type_trac == ['co2i','inco'])) THEN
520     IF (carbon_cycle_cpl) THEN
521        ALLOCATE(co2_send(klon), stat=ierr)
522        IF (ierr /= 0) CALL abort_physic('phyetat0', 'pb allocation co2_send', 1)
523        found=phyetat0_get(co2_send,"co2_send","co2 send",co2_ppm0)
524     ENDIF
525  ELSE IF (type_trac == 'lmdz') THEN
526     it = 0
527     DO iq = 1, nqtot
528        IF(.NOT.(tracers(iq)%isAdvected .AND. tracers(iq)%isInPhysics)) CYCLE
529        it = it+1
530        tname = tracers(iq)%name
531        t(1) = 'trs_'//TRIM(tname); t(2) = 'trs_'//TRIM(new2oldH2O(tname))
532        found = phyetat0_get(trs(:,it), t(:), "Surf trac"//TRIM(tname), 0.)
533     END DO
534     CALL traclmdz_from_restart(trs)
535  ENDIF
536
537#ifdef ISO
538        ! initialise les isotopes       
539        write(*,*) 'phyetat0 1069'
540         CALL phyisoetat0 (snow,run_off_lic_0, &
541     &           xtsnow,xtrun_off_lic_0, &
542     &           Rland_ice)
543#ifdef ISOVERIF
544      write(*,*) 'phyetat0 1074'
545      if (iso_eau.gt.0) then
546      call iso_verif_egalite_vect2D(  &
547     &           xtsnow,snow, &
548     &           'phyetat0 1101a',niso,klon,nbsrf)
549        do i=1,klon 
550              call iso_verif_egalite(Rland_ice(iso_eau,i),1.0, &
551     &         'phyetat0 1101b')
552         enddo
553      endif
554      write(*,*) 'phyetat0 1102'
555#endif
556#endif
557
558!===========================================
559!  ondes de gravite / relief
560!===========================================
561
562!  ondes de gravite non orographiques
563  IF (ok_gwd_rando) found = &
564       phyetat0_get(du_gwd_rando,"du_gwd_rando","du_gwd_rando",0.)
565  IF (.NOT. ok_hines .AND. ok_gwd_rando) found &
566       = phyetat0_get(du_gwd_front,"du_gwd_front","du_gwd_front",0.)
567
568!  prise en compte du relief sous-maille
569  found=phyetat0_get(zmea,"ZMEA","sub grid orography",0.)
570  found=phyetat0_get(zstd,"ZSTD","sub grid orography",0.)
571  found=phyetat0_get(zsig,"ZSIG","sub grid orography",0.)
572  found=phyetat0_get(zgam,"ZGAM","sub grid orography",0.)
573  found=phyetat0_get(zthe,"ZTHE","sub grid orography",0.)
574  found=phyetat0_get(zpic,"ZPIC","sub grid orography",0.)
575  found=phyetat0_get(zval,"ZVAL","sub grid orography",0.)
576  found=phyetat0_get(zmea,"ZMEA","sub grid orography",0.)
577  found=phyetat0_get(rugoro,"RUGSREL","sub grid orography",0.)
578
579!===========================================
580! Initialize ocean
581!===========================================
582
583  IF ( type_ocean == 'slab' ) THEN
584      CALL ocean_slab_init(phys_tstep, pctsrf)
585      IF (nslay.EQ.1) THEN
586        found=phyetat0_get(tslab,["tslab01","tslab  "],"tslab",0.)
587      ELSE
588          DO i=1,nslay
589            WRITE(str2,'(i2.2)') i
590            found=phyetat0_get(tslab(:,i),"tslab"//str2,"tslab",0.) 
591          ENDDO
592      ENDIF
593      IF (.NOT. found) THEN
594          PRINT*, "phyetat0: Le champ <tslab> est absent"
595          PRINT*, "Initialisation a tsol_oce"
596          DO i=1,nslay
597              tslab(:,i)=MAX(ftsol(:,is_oce),271.35)
598          ENDDO
599      ENDIF
600
601      ! Sea ice variables
602      IF (version_ocean == 'sicINT') THEN
603          found=phyetat0_get(tice,"slab_tice","slab_tice",0.)
604          IF (.NOT. found) THEN
605              PRINT*, "phyetat0: Le champ <tice> est absent"
606              PRINT*, "Initialisation a tsol_sic"
607                  tice(:)=ftsol(:,is_sic)
608          ENDIF
609          found=phyetat0_get(seaice,"seaice","seaice",0.)
610          IF (.NOT. found) THEN
611              PRINT*, "phyetat0: Le champ <seaice> est absent"
612              PRINT*, "Initialisation a 0/1m suivant fraction glace"
613              seaice(:)=0.
614              WHERE (pctsrf(:,is_sic).GT.EPSFRA)
615                  seaice=917.
616              ENDWHERE
617          ENDIF
618      ENDIF !sea ice INT
619  ENDIF ! Slab       
620
621  if (activate_ocean_skin >= 1) then
622     if (activate_ocean_skin == 2 .and. type_ocean == 'couple') then
623        found = phyetat0_get(delta_sal, "delta_sal", &
624             "ocean-air interface salinity minus bulk salinity", 0.)
625        found = phyetat0_get(delta_sst, "delta_SST", &
626             "ocean-air interface temperature minus bulk SST", 0.)
627        found = phyetat0_get(dter, "dter", &
628             "ocean-air interface temperature minus subskin temperature", 0.)
629        found = phyetat0_get(dser, "dser", &
630             "ocean-air interface salinity minus subskin salinity", 0.)
631        found = phyetat0_get(dt_ds, "dt_ds", "(tks / tkt) * dTer", 0.)
632
633        where (pctsrf(:, is_oce) == 0.)
634           delta_sst = missing_val
635           delta_sal = missing_val
636           dter = missing_val
637           dser = missing_val
638           dt_ds = missing_val
639        end where
640     end if
641     
642     found = phyetat0_get(ds_ns, "dS_ns", "delta salinity near surface", 0.)
643     found = phyetat0_get(dt_ns, "dT_ns", "delta temperature near surface", &
644          0.)
645
646     where (pctsrf(:, is_oce) == 0.)
647        ds_ns = missing_val
648        dt_ns = missing_val
649        delta_sst = missing_val
650        delta_sal = missing_val
651     end where
652  end if
653
654  ! on ferme le fichier
655  CALL close_startphy
656
657  ! Initialize module pbl_surface_mod
658
659! 994 est trop grand quand OpenMP est activé : on sort du tableau
660!#ifdef ISOVERIF
661!        write(*,*) 'phyetat0 572: snow(994,:)=',snow(994,2)
662!        write(*,*) 'xtsnow(:,994,2)=',xtsnow(:,994,2)
663!#endif
664
665  CALL pbl_surface_init(fder, snow, qsurf, tsoil)
666#ifdef ISO
667  CALL pbl_surface_init_iso(xtsnow,Rland_ice)
668#endif
669
670  ! Initialize module ocean_cpl_mod for the case of coupled ocean
671  IF ( type_ocean == 'couple' ) THEN
672     CALL ocean_cpl_init(phys_tstep, longitude_deg, latitude_deg)
673  ENDIF
674
675!  CALL init_iophy_new(latitude_deg, longitude_deg)
676
677  ! Initilialize module fonte_neige_mod     
678  CALL fonte_neige_init(run_off_lic_0)
679#ifdef ISO
680   CALL fonte_neige_init_iso(xtrun_off_lic_0)
681#endif
682
683END SUBROUTINE phyetat0
684
685END MODULE phyetat0_mod
686
Note: See TracBrowser for help on using the repository browser.