source: LMDZ6/branches/contrails/libf/phylmd/phyetat0_mod.f90 @ 5456

Last change on this file since 5456 was 5452, checked in by aborella, 2 days ago

First implementation of the contrails parameterisation
Lacks the emission of H2O + the impact on radiative transfer

  • 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.8 KB
RevLine 
[1403]1! $Id: phyetat0_mod.f90 5452 2024-12-23 17:12:29Z aborella $
[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, &
[5452]25       cf_ancien, rvc_ancien, rcont_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
[5452]422  ! cas specifique des variables de l'aviation
423  IF ( ok_plane_contrail ) THEN
424    ancien_ok=ancien_ok.AND.phyetat0_get(rcont_ancien,"RCONTANCIEN","RCONTANCIEN",0.)
425  ELSE
426    rcont_ancien(:,:)=0.
427  ENDIF
428
[2494]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)
[5084]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(prw_ancien).EQ.minval(prw_ancien))   .OR. &
436       (maxval(prlw_ancien).EQ.minval(prlw_ancien)) .OR. &
437       (maxval(prsw_ancien).EQ.minval(prsw_ancien)) .OR. &
438       (maxval(t_ancien).EQ.minval(t_ancien)) ) THEN
[2494]439    ancien_ok=.false.
[3449]440  ENDIF
[2494]441
[4579]442  IF (ok_bs) THEN
[5084]443    IF ( (maxval(qbs_ancien).EQ.minval(qbs_ancien))       .OR. &
444         (maxval(prbsw_ancien).EQ.minval(prbsw_ancien)) ) THEN
[4579]445       ancien_ok=.false.
446    ENDIF
447  ENDIF
448
[5204]449  IF ( ok_ice_supersat ) THEN
450    IF ( (maxval(cf_ancien).EQ.minval(cf_ancien))     .OR. &
451         (maxval(rvc_ancien).EQ.minval(rvc_ancien)) ) THEN
452       ancien_ok=.false.
453     ENDIF
454  ENDIF
455
[5452]456  IF ( ok_plane_contrail ) THEN
457    IF ( maxval(rcont_ancien).EQ.minval(rcont_ancien) ) THEN
458       ancien_ok=.false.
459     ENDIF
460  ENDIF
461
[4358]462  found=phyetat0_get(clwcon,"CLWCON","CLWCON",0.)
463  found=phyetat0_get(rnebcon,"RNEBCON","RNEBCON",0.)
464  found=phyetat0_get(ratqs,"RATQS","RATQS",0.)
[1827]465
[4358]466  found=phyetat0_get(run_off_lic_0,"RUNOFFLIC0","RUNOFFLIC0",0.)
[1827]467
[2252]468!==================================
469!  TKE
470!==================================
471!
[1827]472  IF (iflag_pbl>1) then
[4358]473     found=phyetat0_srf(pbl_tke,"TKE","Turb. Kinetic. Energ. ",1.e-8)
[1827]474  ENDIF
[1403]475
[2252]476  IF (iflag_pbl>1 .AND. iflag_wake>=1  .AND. iflag_pbl_split >=1 ) then
[4358]477    found=phyetat0_srf(wake_delta_pbl_tke,"DELTATKE","Del TKE wk/env",0.)
478!!    found=phyetat0_srf(delta_tsurf,"DELTA_TSURF","Delta Ts wk/env ",0.)
479    found=phyetat0_srf(delta_tsurf,"DELTATS","Delta Ts wk/env ",0.)
480!!    found=phyetat0_srf(beta_aridity,"BETA_S","Aridity factor ",1.)
481    found=phyetat0_srf(beta_aridity,"BETAS","Aridity factor ",1.)
[2159]482  ENDIF   !(iflag_pbl>1 .AND. iflag_wake>=1 .AND. iflag_pbl_split >=1 )
483
[2251]484!==================================
485!  thermiques, poches, convection
486!==================================
[1403]487
[2252]488! Emanuel
[4358]489  found=phyetat0_get(sig1,"sig1","sig1",0.)
490  found=phyetat0_get(w01,"w01","w01",0.)
[1403]491
[2252]492! Wake
[4358]493  found=phyetat0_get(wake_deltat,"WAKE_DELTAT","Delta T wake/env",0.)
494  found=phyetat0_get(wake_deltaq,"WAKE_DELTAQ","Delta hum. wake/env",0.)
495  found=phyetat0_get(wake_s,"WAKE_S","Wake frac. area",0.)
[4744]496  found=phyetat0_get(awake_s,"AWAKE_S","Active Wake frac. area",0.)
[3000]497!jyg<
498!  Set wake_dens to -1000. when there is no restart so that the actual
499!  initialization is made in calwake.
500!!  found=phyetat0_get(1,wake_dens,"WAKE_DENS","Wake num. /unit area",0.)
[4358]501  found=phyetat0_get(wake_dens,"WAKE_DENS","Wake num. /unit area",-1000.)
502  found=phyetat0_get(awake_dens,"AWAKE_DENS","Active Wake num. /unit area",0.)
503  found=phyetat0_get(cv_gen,"CV_GEN","CB birth rate",0.)
[3000]504!>jyg
[4358]505  found=phyetat0_get(wake_cstar,"WAKE_CSTAR","WAKE_CSTAR",0.)
506  found=phyetat0_get(wake_pe,"WAKE_PE","WAKE_PE",0.)
507  found=phyetat0_get(wake_fip,"WAKE_FIP","WAKE_FIP",0.)
[879]508
[2252]509! Thermiques
[4358]510  found=phyetat0_get(zmax0,"ZMAX0","ZMAX0",40.)
511  found=phyetat0_get(f0,"F0","F0",1.e-5)
512  found=phyetat0_get(fm_therm,"FM_THERM","Thermals mass flux",0.)
513  found=phyetat0_get(entr_therm,"ENTR_THERM","Thermals Entrain.",0.)
514  found=phyetat0_get(detr_therm,"DETR_THERM","Thermals Detrain.",0.)
[782]515
[2252]516! ALE/ALP
[4358]517  found=phyetat0_get(ale_bl,"ALE_BL","ALE BL",0.)
518  found=phyetat0_get(ale_bl_trig,"ALE_BL_TRIG","ALE BL_TRIG",0.)
519  found=phyetat0_get(alp_bl,"ALP_BL","ALP BL",0.)
520  found=phyetat0_get(ale_wake,"ALE_WAKE","ALE_WAKE",0.)
521  found=phyetat0_get(ale_bl_stat,"ALE_BL_STAT","ALE_BL_STAT",0.)
[1279]522
[3862]523! fisrtilp/Clouds 0.002 could be ratqsbas. But can stay like this as well
[4613]524  found=phyetat0_get(ratqs_inter_,"RATQS_INTER","Relative width of the lsc sugrid scale water",0.002)
[3856]525
[2251]526!===========================================
[1827]527  ! Read and send field trs to traclmdz
[2251]528!===========================================
[1827]529
[4170]530!--OB now this is for co2i - ThL: and therefore also for inco
[4389]531  IF (ANY(type_trac == ['co2i','inco'])) THEN
[4170]532     IF (carbon_cycle_cpl) THEN
533        ALLOCATE(co2_send(klon), stat=ierr)
534        IF (ierr /= 0) CALL abort_physic('phyetat0', 'pb allocation co2_send', 1)
[4358]535        found=phyetat0_get(co2_send,"co2_send","co2 send",co2_ppm0)
[4170]536     ENDIF
[4263]537  ELSE IF (type_trac == 'lmdz') THEN
[4056]538     it = 0
539     DO iq = 1, nqtot
[4071]540        IF(.NOT.(tracers(iq)%isAdvected .AND. tracers(iq)%isInPhysics)) CYCLE
[4056]541        it = it+1
[4358]542        tname = tracers(iq)%name
543        t(1) = 'trs_'//TRIM(tname); t(2) = 'trs_'//TRIM(new2oldH2O(tname))
544        found = phyetat0_get(trs(:,it), t(:), "Surf trac"//TRIM(tname), 0.)
[4056]545     END DO
[1827]546     CALL traclmdz_from_restart(trs)
[3421]547  ENDIF
[1827]548
549
[2251]550!===========================================
[2252]551!  ondes de gravite / relief
[2251]552!===========================================
553
[2252]554!  ondes de gravite non orographiques
[3449]555  IF (ok_gwd_rando) found = &
[4358]556       phyetat0_get(du_gwd_rando,"du_gwd_rando","du_gwd_rando",0.)
[3449]557  IF (.NOT. ok_hines .AND. ok_gwd_rando) found &
[4358]558       = phyetat0_get(du_gwd_front,"du_gwd_front","du_gwd_front",0.)
[1938]559
[2252]560!  prise en compte du relief sous-maille
[4358]561  found=phyetat0_get(zmea,"ZMEA","sub grid orography",0.)
562  found=phyetat0_get(zstd,"ZSTD","sub grid orography",0.)
563  found=phyetat0_get(zsig,"ZSIG","sub grid orography",0.)
564  found=phyetat0_get(zgam,"ZGAM","sub grid orography",0.)
565  found=phyetat0_get(zthe,"ZTHE","sub grid orography",0.)
566  found=phyetat0_get(zpic,"ZPIC","sub grid orography",0.)
567  found=phyetat0_get(zval,"ZVAL","sub grid orography",0.)
568  found=phyetat0_get(zmea,"ZMEA","sub grid orography",0.)
569  found=phyetat0_get(rugoro,"RUGSREL","sub grid orography",0.)
[2252]570
[2251]571!===========================================
572! Initialize ocean
573!===========================================
574
[2057]575  IF ( type_ocean == 'slab' ) THEN
[3435]576      CALL ocean_slab_init(phys_tstep, pctsrf)
[5084]577      IF (nslay.EQ.1) THEN
[4358]578        found=phyetat0_get(tslab,["tslab01","tslab  "],"tslab",0.)
[2656]579      ELSE
580          DO i=1,nslay
581            WRITE(str2,'(i2.2)') i
[4358]582            found=phyetat0_get(tslab(:,i),"tslab"//str2,"tslab",0.) 
[3449]583          ENDDO
584      ENDIF
[2057]585      IF (.NOT. found) THEN
586          PRINT*, "phyetat0: Le champ <tslab> est absent"
587          PRINT*, "Initialisation a tsol_oce"
588          DO i=1,nslay
[2209]589              tslab(:,i)=MAX(ftsol(:,is_oce),271.35)
[3449]590          ENDDO
591      ENDIF
[2251]592
[2209]593      ! Sea ice variables
594      IF (version_ocean == 'sicINT') THEN
[4358]595          found=phyetat0_get(tice,"slab_tice","slab_tice",0.)
[2209]596          IF (.NOT. found) THEN
597              PRINT*, "phyetat0: Le champ <tice> est absent"
598              PRINT*, "Initialisation a tsol_sic"
599                  tice(:)=ftsol(:,is_sic)
[3449]600          ENDIF
[4358]601          found=phyetat0_get(seaice,"seaice","seaice",0.)
[2209]602          IF (.NOT. found) THEN
603              PRINT*, "phyetat0: Le champ <seaice> est absent"
604              PRINT*, "Initialisation a 0/1m suivant fraction glace"
605              seaice(:)=0.
[5084]606              WHERE (pctsrf(:,is_sic).GT.EPSFRA)
[2209]607                  seaice=917.
[3449]608              ENDWHERE
609          ENDIF
610      ENDIF !sea ice INT
611  ENDIF ! Slab       
[2057]612
[3815]613  if (activate_ocean_skin >= 1) then
614     if (activate_ocean_skin == 2 .and. type_ocean == 'couple') then
[4358]615        found = phyetat0_get(delta_sal, "delta_sal", &
[3815]616             "ocean-air interface salinity minus bulk salinity", 0.)
[4358]617        found = phyetat0_get(delta_sst, "delta_SST", &
[3815]618             "ocean-air interface temperature minus bulk SST", 0.)
[4370]619        found = phyetat0_get(dter, "dter", &
620             "ocean-air interface temperature minus subskin temperature", 0.)
621        found = phyetat0_get(dser, "dser", &
622             "ocean-air interface salinity minus subskin salinity", 0.)
623        found = phyetat0_get(dt_ds, "dt_ds", "(tks / tkt) * dTer", 0.)
624
625        where (pctsrf(:, is_oce) == 0.)
626           delta_sst = missing_val
627           delta_sal = missing_val
628           dter = missing_val
629           dser = missing_val
630           dt_ds = missing_val
631        end where
[3815]632     end if
633     
[4358]634     found = phyetat0_get(ds_ns, "dS_ns", "delta salinity near surface", 0.)
635     found = phyetat0_get(dt_ns, "dT_ns", "delta temperature near surface", &
[3815]636          0.)
637
638     where (pctsrf(:, is_oce) == 0.)
639        ds_ns = missing_val
640        dt_ns = missing_val
641        delta_sst = missing_val
642        delta_sal = missing_val
643     end where
644  end if
645
[1827]646  ! on ferme le fichier
647  CALL close_startphy
648
649  ! Initialize module pbl_surface_mod
650
[4551]651  if ( iflag_physiq <= 1 ) then
[2243]652  CALL pbl_surface_init(fder, snow, qsurf, tsoil)
[4537]653  endif
[1827]654
655  ! Initialize module ocean_cpl_mod for the case of coupled ocean
656  IF ( type_ocean == 'couple' ) THEN
[3435]657     CALL ocean_cpl_init(phys_tstep, longitude_deg, latitude_deg)
[1827]658  ENDIF
659
[3462]660!  CALL init_iophy_new(latitude_deg, longitude_deg)
[2054]661
[1827]662  ! Initilialize module fonte_neige_mod     
663  CALL fonte_neige_init(run_off_lic_0)
664
665END SUBROUTINE phyetat0
[2243]666
[4358]667END MODULE phyetat0_mod
[2243]668
Note: See TracBrowser for help on using the repository browser.