source: LMDZ6/trunk/libf/phylmd/phyredem.F90 @ 3333

Last change on this file since 3333 was 3317, checked in by musat, 7 years ago

Utilisation de la clef iflag_cycle_diurne ; l'ancienne clef
cycle_diurne n'existe plus.

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