source: LMDZ6/branches/Amaury_dev/libf/phylmdiso/phyredem.F90 @ 5423

Last change on this file since 5423 was 5224, checked in by abarral, 3 months ago

Merge r5204 r5205
Light lint
Correct missing IOIPSL includes

File size: 21.2 KB
RevLine 
[5099]1
[3927]2! $Id: phyredem.F90 3506 2019-05-16 14:38:11Z ymeurdesoif $
[5099]3
[5106]4SUBROUTINE phyredem(fichnom)
[5099]5
[3927]6!-------------------------------------------------------------------------------
7! Author: Z.X. Li (LMD/CNRS), 1993/08/18
8!-------------------------------------------------------------------------------
9! Purpose: Write restart state for physics.
10!-------------------------------------------------------------------------------
11  USE dimphy, ONLY: klon, klev
[5101]12  USE fonte_neige_mod,  ONLY: fonte_neige_final
13  USE pbl_surface_mod,  ONLY: pbl_surface_final
[3940]14  USE phys_state_var_mod, ONLY: radpas, zmasq, pctsrf,                       &
15                                ftsol, beta_aridity, delta_tsurf, falb_dir,  &
[3927]16                                falb_dif, qsol, fevap, radsol, solsw, sollw, &
[4523]17                                sollwdown, rain_fall, snow_fall, bs_fall, z0m, z0h, &
[3927]18                                agesno, zmea, zstd, zsig, zgam, zthe, zpic,  &
19                                zval, rugoro, t_ancien, q_ancien,            &
[4523]20                                prw_ancien, prlw_ancien, prsw_ancien, prbsw_ancien,      &
[5224]21                                ql_ancien, qs_ancien, qbs_ancien, cf_ancien, &
22                                rvc_ancien, u_ancien, v_ancien,              &
23                                clwcon, rnebcon, ratqs, pbl_tke,             &
[3927]24                                wake_delta_pbl_tke, zmax0, f0, sig1, w01,    &
25                                wake_deltat, wake_deltaq, wake_s, wake_dens, &
[4056]26                                awake_dens, cv_gen,                          &
[3927]27                                wake_cstar,                                  &
28                                wake_pe, wake_fip, fm_therm, entr_therm,     &
29                                detr_therm, ale_bl, ale_bl_trig, alp_bl,     &
30                                ale_wake, ale_bl_stat,                       &
[3940]31                                du_gwd_rando, du_gwd_front, u10m, v10m, &
32                                treedrg, solswfdiff, delta_sal, ds_ns, dt_ns, &
[4613]33                                delta_sst, ratqs_inter_, dter, dser, dt_ds
[3927]34#ifdef ISO
35  USE phys_state_var_mod, ONLY: xtsol, fxtevap,xtrain_fall, xtsnow_fall,     &
36                                xt_ancien, xtl_ancien, xts_ancien,           &
37                                wake_deltaxt                             
38#endif
[5112]39  USE lmdz_geometry, ONLY: longitude_deg, latitude_deg
[3927]40  USE iostart, ONLY: open_restartphy, close_restartphy, enddef_restartphy, put_field, put_var
[5101]41  USE traclmdz_mod, ONLY: traclmdz_to_restart
[4389]42  USE infotrac_phy, ONLY: type_trac, nqtot, tracers, nbtr, niso
[3927]43#ifdef ISO
44#ifdef ISOVERIF
45  USE isotopes_verif_mod
46#endif
47#endif
[5101]48  USE carbon_cycle_mod, ONLY: carbon_cycle_cpl, co2_send, carbon_cycle_rad, RCO2_glo
[3927]49  USE indice_sol_mod, ONLY: nbsrf, is_oce, is_sic, is_ter, is_lic, epsfra
50  USE surface_data, ONLY: type_ocean, version_ocean
[5101]51  USE ocean_slab_mod, ONLY: nslay, tslab, seaice, tice, fsic
[3927]52  USE time_phylmdz_mod, ONLY: annee_ref, day_end, itau_phy, pdtphys
[5117]53  USE config_ocean_skin_m, ONLY: activate_ocean_skin
[5132]54  USE lmdz_abort_physic, ONLY: abort_physic
[5134]55  USE lmdz_alpale
[5137]56  USE lmdz_clesphys
[5139]57  USE lmdz_compbl, ONLY: iflag_pbl, iflag_pbl_split, iflag_order2_sollw, ifl_pbltree
[3927]58
[5134]59  IMPLICIT NONE
[3927]60
61  include "dimsoil.h"
62  !======================================================================
63  CHARACTER*(*) fichnom
64
65  ! les variables globales ecrites dans le fichier restart
66
67  REAL tsoil(klon, nsoilmx, nbsrf)
68  REAL qsurf(klon, nbsrf)
69  REAL snow(klon, nbsrf)
[5117]70  REAL fder(klon)
[3927]71  REAL run_off_lic_0(klon)
72  REAL trs(klon, nbtr)
73#ifdef ISO
74  REAL xtsnow(niso,klon, nbsrf)
75  REAL xtrun_off_lic_0(niso,klon)
76  REAL Rland_ice(niso,klon)
77#endif
78
79  INTEGER nid, nvarid, idim1, idim2, idim3
80  INTEGER ierr
81  INTEGER length
82  PARAMETER (length=100)
83  REAL tab_cntrl(length)
84
85  INTEGER isoil, nsrf,isw
86  CHARACTER (len=2) :: str2
87  CHARACTER (len=256) :: nam, lnam
[4056]88  INTEGER           :: it, iq, pass
[3927]89
90  !======================================================================
91
92  ! Get variables which will be written to restart file from module
93  ! pbl_surface_mod
94  CALL pbl_surface_final(fder, snow, qsurf,  tsoil &
95#ifdef ISO
96       ,xtsnow,Rland_ice &
97#endif       
98       )
99
100  ! Get a variable calculated in module fonte_neige_mod
101  CALL fonte_neige_final(run_off_lic_0 &
102#ifdef ISO
103       ,xtrun_off_lic_0 &
104#endif       
105       )
106
107  !======================================================================
108
109  CALL open_restartphy(fichnom)
110
111 
112  DO ierr = 1, length
113     tab_cntrl(ierr) = 0.0
114  ENDDO
115  tab_cntrl(1) = pdtphys
116  tab_cntrl(2) = radpas
117  ! co2_ppm : current value of atmospheric CO2
118  tab_cntrl(3) = co2_ppm
119  tab_cntrl(4) = solaire
120  tab_cntrl(5) = iflag_con
121  tab_cntrl(6) = nbapp_rad
122
[5082]123  IF( iflag_cycle_diurne>=1 ) tab_cntrl( 7 ) = iflag_cycle_diurne
[3927]124  IF(   soil_model ) tab_cntrl( 8 ) = 1.
125  IF(     new_oliq ) tab_cntrl( 9 ) = 1.
126  IF(     ok_orodr ) tab_cntrl(10 ) = 1.
127  IF(     ok_orolf ) tab_cntrl(11 ) = 1.
128
129  tab_cntrl(13) = day_end
130  tab_cntrl(14) = annee_ref
131  tab_cntrl(15) = itau_phy
132
133  ! co2_ppm0 : initial value of atmospheric CO2
[4298]134  ! tab_cntrl(16) = co2_ppm0
[3927]135
[4298]136  !  PC -- initial value of RCO2 for the radiation scheme
137  !  tab_cntrl(17) = co2_ppm * 1.0e-06 * RMCO2 / RMD
138  IF (carbon_cycle_rad) tab_cntrl(17) = RCO2_glo
139  !PRINT*, "PC : phyredem RCO2_glo =",RCO2_glo
140
[3927]141  DO pass=1,2   ! pass=1 netcdf definition ; pass=2 netcdf write
142 
143    CALL put_var(pass, "controle", "Parametres de controle", tab_cntrl)
144
145    CALL put_field(pass,"longitude", &
146         "Longitudes de la grille physique", longitude_deg)
147
148    CALL put_field(pass,"latitude", "Latitudes de la grille physique", latitude_deg)
149
150    ! PB ajout du masque terre/mer
151
152    CALL put_field(pass,"masque", "masque terre mer", zmasq)
153
154    ! BP ajout des fraction de chaque sous-surface
155
156    ! Get last fractions from slab ocean
157    IF (type_ocean == 'slab' .AND. version_ocean == "sicINT") THEN
[5082]158        WHERE (1.-zmasq(:)>EPSFRA)
[3927]159            pctsrf(:,is_oce)=(1.-fsic(:))*(1.-zmasq(:))
160            pctsrf(:,is_sic)=fsic(:)*(1.-zmasq(:))
161        END WHERE
162    END IF
163
164    ! 1. fraction de terre
165
166    CALL put_field(pass,"FTER", "fraction de continent", pctsrf(:, is_ter))
167
168    ! 2. Fraction de glace de terre
169
170    CALL put_field(pass,"FLIC", "fraction glace de terre", pctsrf(:, is_lic))
171
172    ! 3. fraction ocean
173
174    CALL put_field(pass,"FOCE", "fraction ocean", pctsrf(:, is_oce))
175
176    ! 4. Fraction glace de mer
177
178    CALL put_field(pass,"FSIC", "fraction glace mer", pctsrf(:, is_sic))
179
[4389]180    IF(nbsrf  >99) CALL abort_physic("phyredem", "Trop de sous-mailles", 1)
181    IF(nsoilmx>99) CALL abort_physic("phyredem", "Trop de sous-mailles", 1)
182    IF(nsw    >99) CALL abort_physic("phyredem", "Trop de bandes", 1)
[3927]183
[3940]184!    Surface variables
[3927]185    CALL put_field_srf1(pass,"TS","Temperature",ftsol(:,:))
186
[5116]187    IF (iflag_pbl>1 .AND. iflag_wake>=1  .AND. iflag_pbl_split >=1) THEN
[4056]188       CALL put_field_srf1(pass, "DELTATS", &
189                      "w-x surface temperature difference",  delta_tsurf(:,:))
190       CALL put_field_srf1(pass, "BETAS", "Aridity factor", beta_aridity(:,:))
191    end IF
[3940]192!    End surface variables
193
[3927]194! ================== Albedo =======================================
[5103]195    PRINT*,'PHYREDEM NOUVEAU'
[3927]196    CALL put_field_srf2(pass,"A_dir_SW","Albedo direct",falb_dir(:,:,:))
197    CALL put_field_srf2(pass,"A_dif_SW","Albedo diffus",falb_dif(:,:,:))
198
199    CALL put_field_srf1(pass,"U10M", "u a 10m", u10m)
200
201    CALL put_field_srf1(pass,"V10M", "v a 10m", v10m)
202
203
204! ================== Tsoil =========================================
205    CALL put_field_srf2(pass,"Tsoil","Temperature",tsoil(:,:,:))
206!FC
207!  CALL put_field_srf2("treedrg","freinage arbres",treedrg(:,:,:))
208    CALL put_field(pass,"treedrg_ter","freinage arbres",treedrg(:,:,is_ter))
209
210
211    CALL put_field_srf1(pass,"QS"  , "Humidite",qsurf(:,:))
212
213    CALL put_field     (pass,"QSOL", "Eau dans le sol (mm)", qsol)
214
215    CALL put_field_srf1(pass,"EVAP", "Evaporation", fevap(:,:))
216
217    CALL put_field_srf1(pass,"SNOW", "Neige", snow(:,:))
218
219    CALL put_field(pass,"RADS", "Rayonnement net a la surface", radsol)
220
221    CALL put_field(pass,"solsw", "Rayonnement solaire a la surface", solsw)
222
[3940]223    CALL put_field(pass,"solswfdiff", "Fraction du rayonnement solaire a la surface qui est diffus", solswfdiff)
224
[3927]225    CALL put_field(pass,"sollw", "Rayonnement IF a la surface", sollw)
226
227    CALL put_field(pass,"sollwdown", "Rayonnement down IF a la surface", sollwdown)
228
229    CALL put_field(pass,"fder", "Derive de flux", fder)
230
231    CALL put_field(pass,"rain_f", "precipitation liquide", rain_fall)
232
233    CALL put_field(pass,"snow_f", "precipitation solide", snow_fall)
234
235    CALL put_field_srf1(pass,"Z0m", "rugosite", z0m(:,:))
236
237    CALL put_field_srf1(pass,"Z0h", "rugosite", z0h(:,:))
238
239    CALL put_field_srf1(pass,"AGESNO", "Age de la neige", agesno(:,:))
240
241    CALL put_field(pass,"ZMEA", "ZMEA", zmea)
242
243    CALL put_field(pass,"ZSTD", "ZSTD", zstd)
244
245    CALL put_field(pass,"ZSIG", "ZSIG", zsig)
246
247    CALL put_field(pass,"ZGAM", "ZGAM", zgam)
248
249    CALL put_field(pass,"ZTHE", "ZTHE", zthe)
250
251    CALL put_field(pass,"ZPIC", "ZPIC", zpic)
252
253    CALL put_field(pass,"ZVAL", "ZVAL", zval)
254
255    CALL put_field(pass,"RUGSREL", "RUGSREL", rugoro)
256
257    CALL put_field(pass,"TANCIEN", "TANCIEN", t_ancien)
258
259    CALL put_field(pass,"QANCIEN", "QANCIEN", q_ancien)
260
261    CALL put_field(pass,"QLANCIEN", "QLANCIEN", ql_ancien)
262
263    CALL put_field(pass,"QSANCIEN", "QSANCIEN", qs_ancien)
264
[4523]265    IF (ok_bs) THEN
266       CALL put_field(pass,"bs_f", "precipitation neige soufflee", bs_fall)
267       CALL put_field(pass,"QBSANCIEN", "QBSANCIEN", qbs_ancien)
268       CALL put_field(pass,"PRBSWANCIEN", "PRBSWANCIEN", prbsw_ancien)
269    ENDIF
270
[5224]271    IF ( ok_ice_supersat ) THEN
272      CALL put_field(pass,"CFANCIEN", "CFANCIEN", cf_ancien)
273      CALL put_field(pass,"RVCANCIEN", "RVCANCIEN", rvc_ancien)
274    ENDIF
275
[3927]276    CALL put_field(pass,"PRWANCIEN", "PRWANCIEN", prw_ancien)
277
278    CALL put_field(pass,"PRLWANCIEN", "PRLWANCIEN", prlw_ancien)
279
280    CALL put_field(pass,"PRSWANCIEN", "PRSWANCIEN", prsw_ancien)
281
282    CALL put_field(pass,"UANCIEN", "UANCIEN", u_ancien)
283
284    CALL put_field(pass,"VANCIEN", "VANCIEN", v_ancien)
285
286    CALL put_field(pass,"CLWCON", "Eau liquide convective", clwcon)
287
288    CALL put_field(pass,"RNEBCON", "Nebulosite convective", rnebcon)
289
290    CALL put_field(pass,"RATQS", "Ratqs", ratqs)
291
292    ! run_off_lic_0
293
294    CALL put_field(pass,"RUNOFFLIC0", "Runofflic0", run_off_lic_0)
295
296    ! DEB TKE PBL !
297
[5116]298    IF (iflag_pbl>1) THEN
[3927]299      CALL put_field_srf3(pass,"TKE", "Energ. Cineti. Turb.", &
300           pbl_tke(:,:,:))
301      CALL put_field_srf3(pass,"DELTATKE", "Del TKE wk/env.", &
302           wake_delta_pbl_tke(:,:,:))
303    END IF
304
305    ! FIN TKE PBL !
306    !IM ajout zmax0, f0, sig1, w01
307    !IM wake_deltat, wake_deltaq, wake_s, wake_cstar, wake_pe, wake_fip
308
309    CALL put_field(pass,"ZMAX0", "ZMAX0", zmax0)
310
311    CALL put_field(pass,"F0", "F0", f0)
312
313    CALL put_field(pass,"sig1", "sig1 Emanuel", sig1)
314
315    CALL put_field(pass,"w01", "w01 Emanuel", w01)
316
317    ! wake_deltat
318    CALL put_field(pass,"WAKE_DELTAT", "WAKE_DELTAT", wake_deltat)
319
320    CALL put_field(pass,"WAKE_DELTAQ", "WAKE_DELTAQ", wake_deltaq)
321
322    CALL put_field(pass,"WAKE_S", "Wake frac. area", wake_s)
323
324    CALL put_field(pass,"WAKE_DENS", "Wake num. /unit area", wake_dens)
325
[4056]326    CALL put_field(pass,"AWAKE_DENS", "Active Wake num. /unit area", awake_dens)
327
328    CALL put_field(pass,"CV_GEN", "CB birth rate", cv_gen)
329
[3927]330    CALL put_field(pass,"WAKE_CSTAR", "WAKE_CSTAR", wake_cstar)
331
332    CALL put_field(pass,"WAKE_PE", "WAKE_PE", wake_pe)
333
334    CALL put_field(pass,"WAKE_FIP", "WAKE_FIP", wake_fip)
335
336    ! thermiques
337
338    CALL put_field(pass,"FM_THERM", "FM_THERM", fm_therm)
339
340    CALL put_field(pass,"ENTR_THERM", "ENTR_THERM", entr_therm)
341
342    CALL put_field(pass,"DETR_THERM", "DETR_THERM", detr_therm)
343
344    CALL put_field(pass,"ALE_BL", "ALE_BL", ale_bl)
345
346    CALL put_field(pass,"ALE_BL_TRIG", "ALE_BL_TRIG", ale_bl_trig)
347
348    CALL put_field(pass,"ALP_BL", "ALP_BL", alp_bl)
349
350    CALL put_field(pass,"ALE_WAKE", "ALE_WAKE", ale_wake)
351
352    CALL put_field(pass,"ALE_BL_STAT", "ALE_BL_STAT", ale_bl_stat)
353
354
[3940]355    ! fisrtilp/clouds
[4613]356    CALL put_field(pass,"RATQS_INTER","Relative width of the lsc sugrid scale water",ratqs_inter_)
[3940]357
358
[4389]359    IF (ANY(type_trac == ['co2i','inco'])) THEN
[4170]360       IF (carbon_cycle_cpl) THEN
361          IF (.NOT. ALLOCATED(co2_send)) THEN
362             ! This is the case of create_etat0_limit, ce0l
363             ALLOCATE(co2_send(klon))
364             co2_send(:) = co2_ppm0
365          END IF
366          CALL put_field(pass,"co2_send", "co2_ppm for coupling", co2_send)
367       END IF
368
[3927]369    ! trs from traclmdz_mod
[4389]370    ELSE IF (type_trac == 'lmdz') THEN
[3927]371       CALL traclmdz_to_restart(trs)
[4056]372       it = 0
373       DO iq = 1, nqtot
[4071]374          IF(.NOT.(tracers(iq)%isAdvected .AND. tracers(iq)%isInPhysics)) CYCLE
[4056]375          it = it+1
376          CALL put_field(pass,"trs_"//tracers(iq)%name, "", trs(:, it))
[3927]377       END DO
[4056]378    END IF
379
[3927]380    ! Restart variables for Slab ocean
381    IF (type_ocean == 'slab') THEN
[5082]382        IF (nslay==1) THEN
[3927]383          CALL put_field(pass,"tslab", "Slab ocean temperature", tslab)
384        ELSE
385          DO it=1,nslay
386            WRITE(str2,'(i2.2)') it
387            CALL put_field(pass,"tslab"//str2, "Slab ocean temperature", tslab(:,it))
388          END DO
389        END IF
390        IF (version_ocean == 'sicINT') THEN
391            CALL put_field(pass,"seaice", "Slab seaice (kg/m2)", seaice)
392            CALL put_field(pass,"slab_tice", "Slab sea ice temperature", tice)
393        END IF
394    END IF
395
[5117]396    IF (ok_gwd_rando) CALL put_field(pass,"du_gwd_rando", &
[3927]397         "tendency on zonal wind due to flott gravity waves", du_gwd_rando)
398
[5117]399    IF (.NOT. ok_hines .AND. ok_gwd_rando) CALL put_field(pass,"du_gwd_front", &
[3927]400         "tendency on zonal wind due to acama gravity waves", du_gwd_front)
401
[5117]402    IF (activate_ocean_skin >= 1) THEN
403       IF (activate_ocean_skin == 2 .AND. type_ocean == 'couple') THEN
[3940]404          CALL put_field(pass, "delta_sal", &
405               "ocean-air interface salinity minus bulk salinity", delta_sal)
406          CALL put_field(pass, "delta_SST", &
407               "ocean-air interface temperature minus bulk SST", delta_sst)
[4374]408          CALL put_field(pass, "dter", &
409               "ocean-air interface temperature minus subskin temperature", &
410               dter)
411          CALL put_field(pass, "dser", &
412               "ocean-air interface salinity minus subskin salinity", dser)
413          CALL put_field(pass, "dt_ds", &
414               "(tks / tkt) * dTer", dt_ds)
[3940]415       end if
416       
417       CALL put_field(pass, "dS_ns", "delta salinity near surface", ds_ns)
418       CALL put_field(pass, "dT_ns", "delta temperature near surface", dT_ns)
419    end if
420
[3927]421#ifdef ISO
[5116]422      WRITE(*,*) 'phyredem 342'
[5103]423      CALL phyisoredem (pass, &
[5087]424                 xtsnow, &
425                 xtrun_off_lic_0,Rland_ice, &
426                 run_off_lic_0)
[3927]427#endif
428
429    IF (pass==1) CALL enddef_restartphy
430    IF (pass==2) CALL close_restartphy
431  ENDDO ! DO pass=1,2   ! pass=1 netcdf definition ; pass=2 netcdf write
432 
433  !$OMP BARRIER
434
435
436  CONTAINS
437
438
439SUBROUTINE put_field_srf1(pass,nam,lnam,field)
440
441  IMPLICIT NONE
[4056]442  INTEGER, INTENT(IN)           :: pass
[3927]443  CHARACTER(LEN=*),  INTENT(IN) :: nam, lnam
444  REAL,              INTENT(IN) :: field(:,:)
445  CHARACTER(LEN=256) :: nm, lm, str
446  DO nsrf = 1, SIZE(field,2)
447    WRITE(str, '(i2.2)') nsrf
448    nm=TRIM(nam)//TRIM(str)
449    lm=TRIM(lnam)//" de surface No. "//TRIM(str)
450    CALL put_field(pass,nm,lm,field(:,nsrf))
451  END DO
452
453END SUBROUTINE put_field_srf1
454
455
456SUBROUTINE put_field_srf2(pass,nam,lnam,field)
457
458  IMPLICIT NONE
459  INTEGER, INTENT(IN)            :: pass
460  CHARACTER(LEN=*),  INTENT(IN) :: nam, lnam
461  REAL,              INTENT(IN) :: field(:,:,:)
462  CHARACTER(LEN=256) :: nm, lm, str
463  DO nsrf = 1, SIZE(field,3)
464    DO isoil=1, SIZE(field,2)
465      WRITE(str, '(i2.2,"srf",i2.2)')isoil,nsrf
466!      WRITE(lunout,*)"PHYREDEM ",TRIM(nam)//TRIM(str)
467      nm=TRIM(nam)//TRIM(str)
468      lm=TRIM(lnam)//" du sol No. "//TRIM(str)
469      CALL put_field(pass,nm,lm,field(:,isoil,nsrf))
470    END DO
471  END DO
472
473END SUBROUTINE put_field_srf2
474
475
476SUBROUTINE put_field_srf3(pass,nam,lnam,field)
477
478  IMPLICIT NONE
479  INTEGER, INTENT(IN)            :: pass
480  CHARACTER(LEN=*),  INTENT(IN) :: nam, lnam
481  REAL,              INTENT(IN) :: field(:,:,:)
482  CHARACTER(LEN=256) :: nm, lm, str
483  DO nsrf = 1, SIZE(field,3)
484    WRITE(str, '(i2.2)') nsrf
485    nm=TRIM(nam)//TRIM(str)
486    lm=TRIM(lnam)//TRIM(str)
487    CALL put_field(pass,nm,lm,field(:,1:klev+1,nsrf))
488  END DO
489
490END SUBROUTINE put_field_srf3
491
492#ifdef ISO
[5103]493! je voulais mettre cette SUBROUTINE dans isotopes_mod, mais elle a besoin de put_field_srf1 qui est contenue dans la SUBROUTINE phyredem. Si on veut mettre cette routine dans isotopes_mod, il faudrait convertir ce fichier en module pour pouvoir en appeler des routines
[3927]494
[5106]495      SUBROUTINE phyisoredem(pass, &
[5087]496                xtsnow, &
497                xtrun_off_lic_0,Rland_ice, &
498                run_off_lic_0)
[3927]499      USE dimphy
[5110]500      !USE lmdz_grid_phy
501      !USE lmdz_phys_para
[3927]502      USE phys_state_var_mod, ONLY: q_ancien,xt_ancien,wake_deltaq,wake_deltaxt, &
503        xtrain_fall,xtsnow_fall, ql_ancien,xtl_ancien,qs_ancien,xts_ancien, &
504        xtsol,fxtevap
[4143]505      USE infotrac_phy,ONLY: niso, ntiso
[3927]506      !USE control_mod
507      USE indice_sol_mod, ONLY: nbsrf
508      USE iostart, ONLY: put_field
[4149]509      USE isotopes_mod, ONLY: isoName,iso_eau
[3927]510#ifdef ISOVERIF
511      USE isotopes_verif_mod
512#endif
513#ifdef ISOTRAC
[5117]514    USE isotrac_mod, ONLY: index_zone,index_iso,strtrac
[3927]515#endif
516      !USE phyredem, ONLY: put_field_srf1
[5134]517      USE lmdz_alpale
[5137]518      USE lmdz_clesphys
[5139]519      USE lmdz_compbl, ONLY: iflag_pbl, iflag_pbl_split, iflag_order2_sollw, ifl_pbltree
[3927]520
[5113]521        IMPLICIT NONE
[3927]522
523        ! equivalent isotopique de phyredem
524
[5103]525 include "dimsoil.h"
[3927]526      ! inputs
527      !REAL xtsol(niso,klon)
528      REAL xtsnow(niso,klon,nbsrf)
[4143]529      !REAL xtevap(ntiso,klon,nbsrf)     
[3927]530      REAL xtrun_off_lic_0(niso,klon)
531      REAL Rland_ice(niso,klon)
[5117]532      REAL run_off_lic_0(klon)
533      INTEGER, INTENT(IN) :: pass
[3927]534
535      ! locals
[5117]536      REAL iso_tmp(klon)
537      REAL iso_tmp_lonlev(klon,klev)
538      REAL iso_tmp_lonsrf(klon,nbsrf)
539      INTEGER i,ixt,k,nsrf
[3927]540      INTEGER nid, nvarid
541      INTEGER ierr
542      CHARACTER*7 str7
543      CHARACTER*2 str2
[4056]544      CHARACTER*50 outiso
[5117]545      INTEGER lnblnk
[3927]546#ifdef ISOTRAC
[5117]547      INTEGER iiso,izone
[3927]548#endif     
549
[5116]550      WRITE(*,*) 'phyisoredem 41: entrée'
[3927]551#ifdef ISOVERIF
[5117]552     IF (iso_eau.gt.0) THEN
[5158]553      DO k=1,klev
554        DO i=1,klon
[5103]555           CALL iso_verif_egalite(xt_ancien(iso_eau,i,k),q_ancien(i,k), &
[5087]556                 'phyisoredem 50a')
[5103]557           CALL iso_verif_egalite(xtl_ancien(iso_eau,i,k),ql_ancien(i,k), &
[5087]558                 'phyisoredem 50b')
[5103]559           CALL iso_verif_egalite(xts_ancien(iso_eau,i,k),qs_ancien(i,k), &
[5087]560                 'phyisoredem 50c')
[3927]561         
562        enddo !do i=1,klon
563      enddo !do k=1,klev
[5158]564      DO i=1,klon
[3927]565        DO nsrf = 1, nbsrf
[5103]566           CALL iso_verif_egalite(fxtevap(iso_eau,i,nsrf),fevap(i,nsrf), &
[5087]567                 'phyisoredem 50d')
[3927]568        enddo !DO nsrf = 1, nbsrf
569       enddo
[5116]570      endif !if (iso_eau.gt.0) THEN
[5158]571      DO i=1,klon
572       DO ixt=1,niso
[5103]573        CALL iso_verif_noNaN(xtsol(ixt,i),'phyisoredem 72')
[3927]574       enddo !do ixt=1,niso
575      enddo !do i=1,klon
576#ifdef ISOTRAC       
[5158]577      DO k=1,klev
578        DO i=1,klon
[5103]579          CALL iso_verif_traceur(xt_ancien(1,i,k), &
[5087]580                         'phyisoredem 60')
[3927]581        enddo !do i=1,klon
582      enddo !do k=1,kle
583#endif
584#endif
585
[5158]586   DO ixt=1,ntiso
[3927]587
[4149]588      outiso = TRIM(isoName(ixt))
589      i = INDEX(outiso, '_', .TRUE.)
590      outiso = outiso(1:i-1)//outiso(i+1:LEN_TRIM(outiso))
[5116]591      WRITE(*,*) 'phyredem 550: ixt,outiso=',ixt,TRIM(outiso)
[3927]592     
593      iso_tmp_lonsrf(:,:)=fxtevap(ixt,:,:)
[4056]594      CALL put_field_srf1(pass, "XTEVAP"//TRIM(outiso), "Evaporation de surface",iso_tmp_lonsrf)
[3927]595
596      iso_tmp(:)=xtrain_fall(ixt,:)
[4056]597      CALL put_field(pass,    "xtrain_f"//TRIM(outiso), "precipitation liquide",iso_tmp)
[3927]598
599      iso_tmp(:)=xtsnow_fall(ixt,:)
[4056]600      CALL put_field(pass,    "xtsnow_f"//TRIM(outiso), "precipitation solide",iso_tmp)
[3927]601
602      iso_tmp_lonlev(:,:)=xt_ancien(ixt,:,:)
[4056]603      CALL put_field(pass,    "XTANCIEN"//TRIM(outiso), "QANCIEN",     iso_tmp_lonlev)
[3927]604
605      iso_tmp_lonlev(:,:)=xtl_ancien(ixt,:,:)
[4056]606      CALL put_field(pass,   "XTLANCIEN"//TRIM(outiso), "QLANCIEN",    iso_tmp_lonlev)
[3927]607
608      iso_tmp_lonlev(:,:)=xts_ancien(ixt,:,:)
[4056]609      CALL put_field(pass,   "XTSANCIEN"//TRIM(outiso), "QSANCIEN",    iso_tmp_lonlev)
[3927]610
611      iso_tmp_lonlev(:,:)=wake_deltaxt(ixt,:,:)
[4056]612      CALL put_field(pass,"WAKE_DELTAXT"//TRIM(outiso), "WAKE_DELTAQ", iso_tmp_lonlev)
[3927]613
614      iso_tmp_lonlev(:,:)=wake_deltaxt(ixt,:,:)
[4056]615      CALL put_field(pass,"WAKE_DELTAXT"//TRIM(outiso), "WAKE_DELTAXT",iso_tmp_lonlev)
[3927]616
617      ! variables seulement pour niso:
[5117]618      IF (ixt.le.niso) THEN
[4491]619      iso_tmp_lonsrf(:,:)=xtsnow(ixt,:,:)
620      CALL put_field_srf1(pass, "XTSNOW"//TRIM(outiso), "NEIGE",       iso_tmp_lonsrf)
621
[3927]622      iso_tmp(:)=xtsol(ixt,:)
[4056]623      CALL put_field(pass,      "XTSOL"//TRIM(outiso), "Eau dans le sol (mm)",iso_tmp)
[3927]624
625      iso_tmp(:)=Rland_ice(ixt,:)
[4056]626      CALL put_field(pass,  "Rland_ice"//TRIM(outiso), "ratio land ice",      iso_tmp)
[3927]627
[4491]628      iso_tmp(:)=xtrun_off_lic_0(ixt,:)
629      CALL put_field(pass,"XTRUNOFFLIC0"//TRIM(outiso), "Runofflic0",  iso_tmp)
630
[5116]631      endif ! if (ixt.le.niso) THEN
[3927]632      enddo !do ixt=1,niso
633
[5116]634      WRITE(*,*) 'phyisoredem 261: sortie'
[3927]635      END SUBROUTINE phyisoredem
636#endif
637
638END SUBROUTINE phyredem
Note: See TracBrowser for help on using the repository browser.