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

Last change on this file since 5295 was 5285, checked in by abarral, 9 months ago

As discussed internally, remove generic ONLY: ... for new _mod_h modules

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