source: LMDZ6/branches/LMDZ-QUEST/libf/phylmd/phyredem.F90 @ 5408

Last change on this file since 5408 was 3328, checked in by musat, 7 years ago

Utilisation de la clef iflag_cycle_diurne et
supression de la clef cycle_diurne.

  • 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
Line 
1!
2! $Id: phyredem.F90 3328 2018-05-16 16:10:44Z evignon $
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, ftsol, falb_dir,      &
15                                falb_dif, qsol, fevap, radsol, solsw, sollw, &
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,    &
23                                wake_deltat, wake_deltaq, wake_s, wake_dens, &
24                                wake_cstar,                                  &
25                                wake_pe, wake_fip, fm_therm, entr_therm,     &
26                                detr_therm, ale_bl, ale_bl_trig, alp_bl,     &
27                                ale_wake, ale_bl_stat,                       &
28                                du_gwd_rando, du_gwd_front, u10m, v10m,      &
29                                treedrg
30  USE geometry_mod, ONLY : longitude_deg, latitude_deg
31  USE iostart, ONLY: open_restartphy, close_restartphy, put_field, put_var
32  USE traclmdz_mod, ONLY : traclmdz_to_restart
33  USE infotrac_phy, ONLY: type_trac, niadv, tname, nbtr, nqo
34  USE carbon_cycle_mod, ONLY : carbon_cycle_cpl, co2_send
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
37  USE ocean_slab_mod, ONLY : nslay, tslab, seaice, tice, fsic
38  USE time_phylmdz_mod, ONLY: annee_ref, day_end, itau_phy, pdtphys
39
40  IMPLICIT none
41
42  include "dimsoil.h"
43  include "clesphys.h"
44  include "thermcell.h"
45  include "compbl.h"
46  !======================================================================
47  CHARACTER*(*) fichnom
48
49  ! les variables globales ecrites dans le fichier restart
50
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)
57
58  INTEGER nid, nvarid, idim1, idim2, idim3
59  INTEGER ierr
60  INTEGER length
61  PARAMETER (length=100)
62  REAL tab_cntrl(length)
63
64  INTEGER isoil, nsrf,isw
65  CHARACTER (len=2) :: str2
66  CHARACTER (len=256) :: nam, lnam
67  INTEGER           :: it, iiq
68
69  !======================================================================
70
71  ! Get variables which will be written to restart file from module
72  ! pbl_surface_mod
73  CALL pbl_surface_final(fder, snow, qsurf,  tsoil)
74
75  ! Get a variable calculated in module fonte_neige_mod
76  CALL fonte_neige_final(run_off_lic_0)
77
78  !======================================================================
79
80  CALL open_restartphy(fichnom)
81
82  DO ierr = 1, length
83     tab_cntrl(ierr) = 0.0
84  ENDDO
85  tab_cntrl(1) = pdtphys
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
92
93  IF( iflag_cycle_diurne.GE.1 ) tab_cntrl( 7 ) = iflag_cycle_diurne
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.
98
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", &
109       "Longitudes de la grille physique", longitude_deg)
110
111  CALL put_field("latitude", "Latitudes de la grille physique", latitude_deg)
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
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
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
143  IF(nbsrf>99) THEN
144    PRINT*, "Trop de sous-mailles";  CALL abort_physic("phyredem", "", 1)
145  END IF
146  IF(nsoilmx>99) THEN
147    PRINT*, "Trop de sous-surfaces"; CALL abort_physic("phyredem", "", 1)
148  END IF
149  IF(nsw>99) THEN
150    PRINT*, "Trop de bandes"; CALL abort_physic("phyredem", "", 1)
151  END IF
152
153  CALL put_field_srf1("TS","Temperature",ftsol(:,:))
154
155! ================== Albedo =======================================
156  print*,'PHYREDEM NOUVEAU'
157  CALL put_field_srf2("A_dir_SW","Albedo direct",falb_dir(:,:,:))
158  CALL put_field_srf2("A_dif_SW","Albedo diffus",falb_dif(:,:,:))
159
160  CALL put_field_srf1("U10M", "u a 10m", u10m)
161
162  CALL put_field_srf1("V10M", "v a 10m", v10m)
163
164
165! ================== Tsoil =========================================
166  CALL put_field_srf2("Tsoil","Temperature",tsoil(:,:,:))
167!FC
168!  CALL put_field_srf2("treedrg","freinage arbres",treedrg(:,:,:))
169  CALL put_field("treedrg_ter","freinage arbres",treedrg(:,:,is_ter))
170
171
172  CALL put_field_srf1("QS"  , "Humidite",qsurf(:,:))
173
174  CALL put_field     ("QSOL", "Eau dans le sol (mm)", qsol)
175
176  CALL put_field_srf1("EVAP", "Evaporation", fevap(:,:))
177
178  CALL put_field_srf1("SNOW", "Neige", snow(:,:))
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
186  CALL put_field("sollwdown", "Rayonnement down IF a la surface", sollwdown)
187
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
194  CALL put_field_srf1("Z0m", "rugosite", z0m(:,:))
195
196  CALL put_field_srf1("Z0h", "rugosite", z0h(:,:))
197
198  CALL put_field_srf1("AGESNO", "Age de la neige", agesno(:,:))
199
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
220  CALL put_field("QLANCIEN", "QLANCIEN", ql_ancien)
221
222  CALL put_field("QSANCIEN", "QSANCIEN", qs_ancien)
223
224  CALL put_field("PRWANCIEN", "PRWANCIEN", prw_ancien)
225
226  CALL put_field("PRLWANCIEN", "PRLWANCIEN", prlw_ancien)
227
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
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
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
252
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
256
257  CALL put_field("ZMAX0", "ZMAX0", zmax0)
258
259  CALL put_field("F0", "F0", f0)
260
261  CALL put_field("sig1", "sig1 Emanuel", sig1)
262
263  CALL put_field("w01", "w01 Emanuel", w01)
264
265  ! wake_deltat
266  CALL put_field("WAKE_DELTAT", "WAKE_DELTAT", wake_deltat)
267
268  CALL put_field("WAKE_DELTAQ", "WAKE_DELTAQ", wake_deltaq)
269
270  CALL put_field("WAKE_S", "Wake frac. area", wake_s)
271
272  CALL put_field("WAKE_DENS", "Wake num. /unit area", wake_dens)
273
274  CALL put_field("WAKE_CSTAR", "WAKE_CSTAR", wake_cstar)
275
276  CALL put_field("WAKE_PE", "WAKE_PE", wake_pe)
277
278  CALL put_field("WAKE_FIP", "WAKE_FIP", wake_fip)
279
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
288  CALL put_field("ALE_BL", "ALE_BL", ale_bl)
289
290  CALL put_field("ALE_BL_TRIG", "ALE_BL_TRIG", ale_bl_trig)
291
292  CALL put_field("ALP_BL", "ALP_BL", alp_bl)
293
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
299  ! trs from traclmdz_mod
300  IF (type_trac == 'lmdz') THEN
301     CALL traclmdz_to_restart(trs)
302     DO it=1, nbtr
303!!        iiq=niadv(it+2)                                                           ! jyg
304        iiq=niadv(it+nqo)                                                           ! jyg
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
317  ! Restart variables for Slab ocean
318  IF (type_ocean == 'slab') THEN
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
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
331  END IF
332
333  if (ok_gwd_rando) call put_field("du_gwd_rando", &
334       "tendency on zonal wind due to flott gravity waves", du_gwd_rando)
335
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
339  CALL close_restartphy
340  !$OMP BARRIER
341
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
352  DO nsrf = 1, SIZE(field,2)
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
368  DO nsrf = 1, SIZE(field,3)
369    DO isoil=1, SIZE(field,2)
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
387  DO nsrf = 1, SIZE(field,3)
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
397END SUBROUTINE phyredem
Note: See TracBrowser for help on using the repository browser.