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

Last change on this file since 5446 was 2952, checked in by Laurent Fairhead, 7 years ago

Parametrization of drag by copses
Need version 4465 of ORCHIDEE at least

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