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