source: LMDZ6/trunk/libf/phylmdiso/phyredem.F90 @ 5774

Last change on this file since 5774 was 5662, checked in by Laurent Fairhead, 6 months ago

Ajout du modèle thermodynamique de glace de mer interactive améliorant les flux échangés à la surface de la banquise (Doctorat de Nicolas Michalezyk, Contact : Nicolas Michaleyk, Guillaume Gastineau)

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