source: LMDZ6/trunk/libf/phylmd/phyetat0_mod.f90

Last change on this file was 5274, checked in by abarral, 9 hours ago

Replace yomcst.h by existing module

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