source: LMDZ6/branches/LMDZ-ECRAD/libf/phylmd/phyredem.F90 @ 4109

Last change on this file since 4109 was 3756, checked in by oboucher, 4 years ago

The fraction of SW down radiation that is diffuse is extracted from radlwsw.F90 and passed on to pbl_surface for inclusion in fields_out for transfer to ORCHIDEE if it requested in input file coupling_fields.def. Hence there is nothing automatic here. The fraction of SW down radiation is also added as a diagnostic. To satisfy the case when this new quantity is used in ORCHIDEE, then it is added in the restart (and read in case it is there).

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