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

Last change on this file since 2502 was 2499, checked in by oboucher, 9 years ago

Various changes to diagnose properly 2D tendency in q, ql, qs from dynamics
as previous diagnostics were incorrect.
Cleaned up all such diagnostics in physiq_mod.F90 as well

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