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