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

Last change on this file since 5424 was 5310, checked in by abarral, 7 weeks ago

unify abort_gcm
rename wxios -> wxios_mod

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