source: LMDZ5/trunk/libf/phylmd/phyredem.F90 @ 2744

Last change on this file since 2744 was 2656, checked in by Ehouarn Millour, 8 years ago

Making the slab work:

  • added a slab_heat_transp_mod module for horizontal diffusion and Ekman transport
  • added storage and output of relevent variables in phyredem, phyetat0, phy_output_ctrlout_mod, phys_output_write_mod
  • moved nslay (number of slab layers) out of dimphy into ocean_slab_mod.

FC

  • 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: 11.5 KB
RevLine 
[1827]1SUBROUTINE phyredem (fichnom)
[2293]2!
3!-------------------------------------------------------------------------------
4! Author: Z.X. Li (LMD/CNRS), 1993/08/18
5!-------------------------------------------------------------------------------
6! Purpose: Write restart state for physics.
7!-------------------------------------------------------------------------------
[2395]8  USE dimphy, ONLY: klon, klev
[1827]9  USE fonte_neige_mod,  ONLY : fonte_neige_final
10  USE pbl_surface_mod,  ONLY : pbl_surface_final
[2499]11  USE phys_state_var_mod, ONLY: radpas, zmasq, pctsrf, ftsol, falb_dir,      &
[2395]12                                falb_dif, qsol, fevap, radsol, solsw, sollw, &
[2499]13                                sollwdown, rain_fall, snow_fall, z0m, z0h,   &
14                                agesno, zmea, zstd, zsig, zgam, zthe, zpic,  &
15                                zval, rugoro, t_ancien, q_ancien,            &
16                                prw_ancien, prlw_ancien, prsw_ancien,        &
17                                ql_ancien, qs_ancien,  u_ancien,             &
18                                v_ancien, clwcon, rnebcon, ratqs, pbl_tke,   &
19                                wake_delta_pbl_tke, zmax0, f0, sig1, w01,    &
[2635]20                                wake_deltat, wake_deltaq, wake_s, wake_dens, &
21                                wake_cstar,                                  &
[2499]22                                wake_pe, wake_fip, fm_therm, entr_therm,     &
23                                detr_therm, Ale_bl, Ale_bl_trig, Alp_bl,     &
[2569]24                                du_gwd_rando, du_gwd_front, u10m, v10m
[2395]25  USE geometry_mod, ONLY : longitude_deg, latitude_deg
26  USE iostart, ONLY: open_restartphy, close_restartphy, put_field, put_var
[1827]27  USE traclmdz_mod, ONLY : traclmdz_to_restart
[2320]28  USE infotrac_phy, ONLY: type_trac, niadv, tname, nbtr, nqo
[1827]29  USE carbon_cycle_mod, ONLY : carbon_cycle_cpl, co2_send
[2395]30  USE indice_sol_mod, ONLY: nbsrf, is_oce, is_sic, is_ter, is_lic, epsfra
31  USE surface_data, ONLY: type_ocean, version_ocean
[2656]32  USE ocean_slab_mod, ONLY : nslay, tslab, seaice, tice, fsic
[2344]33  USE time_phylmdz_mod, ONLY: annee_ref, day_end, itau_phy, pdtphys
[967]34
[1827]35  IMPLICIT none
[2293]36
[1827]37  include "dimsoil.h"
38  include "clesphys.h"
39  include "thermcell.h"
40  include "compbl.h"
41  !======================================================================
42  CHARACTER*(*) fichnom
[967]43
[1827]44  ! les variables globales ecrites dans le fichier restart
[782]45
[1827]46  REAL tsoil(klon, nsoilmx, nbsrf)
47  REAL qsurf(klon, nbsrf)
48  REAL snow(klon, nbsrf)
49  real fder(klon)
50  REAL run_off_lic_0(klon)
51  REAL trs(klon, nbtr)
[782]52
[1827]53  INTEGER nid, nvarid, idim1, idim2, idim3
54  INTEGER ierr
55  INTEGER length
56  PARAMETER (length=100)
57  REAL tab_cntrl(length)
[782]58
[2237]59  INTEGER isoil, nsrf,isw
[2656]60  CHARACTER (len=2) :: str2
[2293]61  CHARACTER (len=256) :: nam, lnam
[1827]62  INTEGER           :: it, iiq
[524]63
[1827]64  !======================================================================
[524]65
[1827]66  ! Get variables which will be written to restart file from module
67  ! pbl_surface_mod
[2243]68  CALL pbl_surface_final(fder, snow, qsurf,  tsoil)
[1279]69
[1827]70  ! Get a variable calculated in module fonte_neige_mod
71  CALL fonte_neige_final(run_off_lic_0)
[1001]72
[1827]73  !======================================================================
[1001]74
[1827]75  CALL open_restartphy(fichnom)
[1001]76
[1827]77  DO ierr = 1, length
78     tab_cntrl(ierr) = 0.0
79  ENDDO
[2344]80  tab_cntrl(1) = pdtphys
[1827]81  tab_cntrl(2) = radpas
82  ! co2_ppm : current value of atmospheric CO2
83  tab_cntrl(3) = co2_ppm
84  tab_cntrl(4) = solaire
85  tab_cntrl(5) = iflag_con
86  tab_cntrl(6) = nbapp_rad
[524]87
[1827]88  IF( cycle_diurne ) tab_cntrl( 7 ) = 1.
89  IF(   soil_model ) tab_cntrl( 8 ) = 1.
90  IF(     new_oliq ) tab_cntrl( 9 ) = 1.
91  IF(     ok_orodr ) tab_cntrl(10 ) = 1.
92  IF(     ok_orolf ) tab_cntrl(11 ) = 1.
[524]93
[1827]94  tab_cntrl(13) = day_end
95  tab_cntrl(14) = annee_ref
96  tab_cntrl(15) = itau_phy
97
98  ! co2_ppm0 : initial value of atmospheric CO2
99  tab_cntrl(16) = co2_ppm0
100
101  CALL put_var("controle", "Parametres de controle", tab_cntrl)
102
103  CALL put_field("longitude", &
[2395]104       "Longitudes de la grille physique", longitude_deg)
[1827]105
[2395]106  CALL put_field("latitude", "Latitudes de la grille physique", latitude_deg)
[1827]107
108  ! PB ajout du masque terre/mer
109
110  CALL put_field("masque", "masque terre mer", zmasq)
111
112  ! BP ajout des fraction de chaque sous-surface
113
[2209]114  ! Get last fractions from slab ocean
115  IF (type_ocean == 'slab' .AND. version_ocean == "sicINT") THEN
116      WHERE (1.-zmasq(:).GT.EPSFRA)
117          pctsrf(:,is_oce)=(1.-fsic(:))*(1.-zmasq(:))
118          pctsrf(:,is_sic)=fsic(:)*(1.-zmasq(:))
119      END WHERE
120  END IF
121
[1827]122  ! 1. fraction de terre
123
124  CALL put_field("FTER", "fraction de continent", pctsrf(:, is_ter))
125
126  ! 2. Fraction de glace de terre
127
128  CALL put_field("FLIC", "fraction glace de terre", pctsrf(:, is_lic))
129
130  ! 3. fraction ocean
131
132  CALL put_field("FOCE", "fraction ocean", pctsrf(:, is_oce))
133
134  ! 4. Fraction glace de mer
135
136  CALL put_field("FSIC", "fraction glace mer", pctsrf(:, is_sic))
137
[2293]138  IF(nbsrf>99) THEN
[2311]139    PRINT*, "Trop de sous-mailles";  CALL abort_physic("phyredem", "", 1)
[2293]140  END IF
141  IF(nsoilmx>99) THEN
[2311]142    PRINT*, "Trop de sous-surfaces"; CALL abort_physic("phyredem", "", 1)
[2293]143  END IF
[2299]144  IF(nsw>99) THEN
[2311]145    PRINT*, "Trop de bandes"; CALL abort_physic("phyredem", "", 1)
[2299]146  END IF
[1827]147
[2293]148  CALL put_field_srf1("TS","Temperature",ftsol(:,:))
149
[2237]150! ================== Albedo =======================================
151  print*,'PHYREDEM NOUVEAU'
[2293]152  CALL put_field_srf2("A_dir_SW","Albedo direct",falb_dir(:,:,:))
153  CALL put_field_srf2("A_dif_SW","Albedo diffus",falb_dif(:,:,:))
[2237]154
[2569]155  CALL put_field_srf1("U10M", "u a 10m", u10m)
156
157  CALL put_field_srf1("V10M", "v a 10m", v10m)
158
159
[2293]160! ================== Tsoil =========================================
161  CALL put_field_srf2("Tsoil","Temperature",tsoil(:,:,:))
[524]162
[2293]163  CALL put_field_srf1("QS"  , "Humidite",qsurf(:,:))
[1827]164
[2293]165  CALL put_field     ("QSOL", "Eau dans le sol (mm)", qsol)
[1827]166
[2293]167  CALL put_field_srf1("EVAP", "Evaporation", fevap(:,:))
[1827]168
[2299]169  CALL put_field_srf1("SNOW", "Neige", snow(:,:))
[1827]170
171  CALL put_field("RADS", "Rayonnement net a la surface", radsol)
172
173  CALL put_field("solsw", "Rayonnement solaire a la surface", solsw)
174
175  CALL put_field("sollw", "Rayonnement IF a la surface", sollw)
176
[2356]177  CALL put_field("sollwdown", "Rayonnement down IF a la surface", sollwdown)
[2188]178
[1827]179  CALL put_field("fder", "Derive de flux", fder)
180
181  CALL put_field("rain_f", "precipitation liquide", rain_fall)
182
183  CALL put_field("snow_f", "precipitation solide", snow_fall)
184
[2293]185  CALL put_field_srf1("Z0m", "rugosite", z0m(:,:))
[1827]186
[2293]187  CALL put_field_srf1("Z0h", "rugosite", z0h(:,:))
[1827]188
[2293]189  CALL put_field_srf1("AGESNO", "Age de la neige", agesno(:,:))
190
[1827]191  CALL put_field("ZMEA", "ZMEA", zmea)
192
193  CALL put_field("ZSTD", "ZSTD", zstd)
194
195  CALL put_field("ZSIG", "ZSIG", zsig)
196
197  CALL put_field("ZGAM", "ZGAM", zgam)
198
199  CALL put_field("ZTHE", "ZTHE", zthe)
200
201  CALL put_field("ZPIC", "ZPIC", zpic)
202
203  CALL put_field("ZVAL", "ZVAL", zval)
204
205  CALL put_field("RUGSREL", "RUGSREL", rugoro)
206
207  CALL put_field("TANCIEN", "TANCIEN", t_ancien)
208
209  CALL put_field("QANCIEN", "QANCIEN", q_ancien)
210
[2497]211  CALL put_field("QLANCIEN", "QLANCIEN", ql_ancien)
212
213  CALL put_field("QSANCIEN", "QSANCIEN", qs_ancien)
214
[2499]215  CALL put_field("PRWANCIEN", "PRWANCIEN", prw_ancien)
[1827]216
[2499]217  CALL put_field("PRLWANCIEN", "PRLWANCIEN", prlw_ancien)
[1827]218
[2499]219  CALL put_field("PRSWANCIEN", "PRSWANCIEN", prsw_ancien)
220
221  CALL put_field("UANCIEN", "UANCIEN", u_ancien)
222
223  CALL put_field("VANCIEN", "VANCIEN", v_ancien)
224
[1827]225  CALL put_field("CLWCON", "Eau liquide convective", clwcon)
226
227  CALL put_field("RNEBCON", "Nebulosite convective", rnebcon)
228
229  CALL put_field("RATQS", "Ratqs", ratqs)
230
231  ! run_off_lic_0
232
233  CALL put_field("RUNOFFLIC0", "Runofflic0", run_off_lic_0)
234
235  ! DEB TKE PBL !
236
237  IF (iflag_pbl>1) then
[2293]238    CALL put_field_srf3("TKE", "Energ. Cineti. Turb.", &
239         pbl_tke(:,:,:))
240    CALL put_field_srf3("DELTATKE", "Del TKE wk/env.", &
241         wake_delta_pbl_tke(:,:,:))
242  END IF
[1619]243
[1827]244  ! FIN TKE PBL !
245  !IM ajout zmax0, f0, sig1, w01
246  !IM wake_deltat, wake_deltaq, wake_s, wake_cstar, wake_pe, wake_fip
[1619]247
[1827]248  CALL put_field("ZMAX0", "ZMAX0", zmax0)
[1619]249
[1827]250  CALL put_field("F0", "F0", f0)
[878]251
[1827]252  CALL put_field("sig1", "sig1 Emanuel", sig1)
[1001]253
[1827]254  CALL put_field("w01", "w01 Emanuel", w01)
[1001]255
[1827]256  ! wake_deltat
257  CALL put_field("WAKE_DELTAT", "WAKE_DELTAT", wake_deltat)
[1279]258
[1827]259  CALL put_field("WAKE_DELTAQ", "WAKE_DELTAQ", wake_deltaq)
[1403]260
[2635]261  CALL put_field("WAKE_S", "Wake frac. area", wake_s)
[1403]262
[2635]263  CALL put_field("WAKE_DENS", "Wake num. /unit area", wake_dens)
264
[1827]265  CALL put_field("WAKE_CSTAR", "WAKE_CSTAR", wake_cstar)
[1403]266
[1827]267  CALL put_field("WAKE_PE", "WAKE_PE", wake_pe)
[1403]268
[1827]269  CALL put_field("WAKE_FIP", "WAKE_FIP", wake_fip)
[1279]270
[1827]271  ! thermiques
272
273  CALL put_field("FM_THERM", "FM_THERM", fm_therm)
274
275  CALL put_field("ENTR_THERM", "ENTR_THERM", entr_therm)
276
277  CALL put_field("DETR_THERM", "DETR_THERM", detr_therm)
278
[2069]279  CALL put_field("ALE_BL", "ALE_BL", Ale_bl)
280
281  CALL put_field("ALE_BL_TRIG", "ALE_BL_TRIG", Ale_bl_trig)
282
283  CALL put_field("ALP_BL", "ALP_BL", Alp_bl)
284
[1827]285  ! trs from traclmdz_mod
286  IF (type_trac == 'lmdz') THEN
287     CALL traclmdz_to_restart(trs)
288     DO it=1, nbtr
[2265]289!!        iiq=niadv(it+2)                                                           ! jyg
290        iiq=niadv(it+nqo)                                                           ! jyg
[1827]291        CALL put_field("trs_"//tname(iiq), "", trs(:, it))
292     END DO
293     IF (carbon_cycle_cpl) THEN
294        IF (.NOT. ALLOCATED(co2_send)) THEN
295           ! This is the case of create_etat0_limit, ce0l
296           ALLOCATE(co2_send(klon))
297           co2_send(:) = co2_ppm0
298        END IF
299        CALL put_field("co2_send", "co2_ppm for coupling", co2_send)
300     END IF
301  END IF
302
[2057]303  ! Restart variables for Slab ocean
304  IF (type_ocean == 'slab') THEN
[2656]305      IF (nslay.EQ.1) THEN
306        CALL put_field("tslab", "Slab ocean temperature", tslab)
307      ELSE
308        DO it=1,nslay
309          WRITE(str2,'(i2.2)') it
310          CALL put_field("tslab"//str2, "Slab ocean temperature", tslab(:,it))
311        END DO
312      END IF
[2209]313      IF (version_ocean == 'sicINT') THEN
314          CALL put_field("seaice", "Slab seaice (kg/m2)", seaice)
315          CALL put_field("slab_tice", "Slab sea ice temperature", tice)
316      END IF
[2057]317  END IF
318
[2333]319  if (ok_gwd_rando) call put_field("du_gwd_rando", &
320       "tendency on zonal wind due to flott gravity waves", du_gwd_rando)
[1938]321
[2333]322  IF (.not. ok_hines .and. ok_gwd_rando) call put_field("du_gwd_front", &
323       "tendency on zonal wind due to acama gravity waves", du_gwd_front)
324
[1827]325  CALL close_restartphy
326  !$OMP BARRIER
327
[2293]328
329  CONTAINS
330
331
332SUBROUTINE put_field_srf1(nam,lnam,field)
333
334  IMPLICIT NONE
335  CHARACTER(LEN=*),  INTENT(IN) :: nam, lnam
336  REAL,              INTENT(IN) :: field(:,:)
337  CHARACTER(LEN=256) :: nm, lm, str
[2299]338  DO nsrf = 1, SIZE(field,2)
[2293]339    WRITE(str, '(i2.2)') nsrf
340    nm=TRIM(nam)//TRIM(str)
341    lm=TRIM(lnam)//" de surface No. "//TRIM(str)
342    CALL put_field(nm,lm,field(:,nsrf))
343  END DO
344
345END SUBROUTINE put_field_srf1
346
347
348SUBROUTINE put_field_srf2(nam,lnam,field)
349
350  IMPLICIT NONE
351  CHARACTER(LEN=*),  INTENT(IN) :: nam, lnam
352  REAL,              INTENT(IN) :: field(:,:,:)
353  CHARACTER(LEN=256) :: nm, lm, str
[2299]354  DO nsrf = 1, SIZE(field,3)
355    DO isoil=1, SIZE(field,2)
[2293]356      WRITE(str, '(i2.2,"srf",i2.2)')isoil,nsrf
357!      WRITE(lunout,*)"PHYREDEM ",TRIM(nam)//TRIM(str)
358      nm=TRIM(nam)//TRIM(str)
359      lm=TRIM(lnam)//" du sol No. "//TRIM(str)
360      CALL put_field(nm,lm,field(:,isoil,nsrf))
361    END DO
362  END DO
363
364END SUBROUTINE put_field_srf2
365
366
367SUBROUTINE put_field_srf3(nam,lnam,field)
368
369  IMPLICIT NONE
370  CHARACTER(LEN=*),  INTENT(IN) :: nam, lnam
371  REAL,              INTENT(IN) :: field(:,:,:)
372  CHARACTER(LEN=256) :: nm, lm, str
[2299]373  DO nsrf = 1, SIZE(field,3)
[2293]374    WRITE(str, '(i2.2)') nsrf
375    nm=TRIM(nam)//TRIM(str)
376    lm=TRIM(lnam)//TRIM(str)
377    CALL put_field(nm,lm,field(:,1:klev+1,nsrf))
378  END DO
379
380END SUBROUTINE put_field_srf3
381
382
[1827]383END SUBROUTINE phyredem
Note: See TracBrowser for help on using the repository browser.