1 | |
---|
2 | ! $Id: phyredem.F90 3506 2019-05-16 14:38:11Z ymeurdesoif $ |
---|
3 | |
---|
4 | SUBROUTINE 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, & |
---|
15 | ftsol, beta_aridity, delta_tsurf, falb_dir, & |
---|
16 | falb_dif, qsol, fevap, radsol, solsw, sollw, & |
---|
17 | sollwdown, rain_fall, snow_fall, bs_fall, z0m, z0h, & |
---|
18 | agesno, zmea, zstd, zsig, zgam, zthe, zpic, & |
---|
19 | zval, rugoro, t_ancien, q_ancien, & |
---|
20 | prw_ancien, prlw_ancien, prsw_ancien, prbsw_ancien, & |
---|
21 | ql_ancien, qs_ancien, qbs_ancien, cf_ancien, & |
---|
22 | rvc_ancien, u_ancien, v_ancien, & |
---|
23 | clwcon, rnebcon, ratqs, pbl_tke, & |
---|
24 | wake_delta_pbl_tke, zmax0, f0, sig1, w01, & |
---|
25 | wake_deltat, wake_deltaq, wake_s, wake_dens, & |
---|
26 | awake_dens, cv_gen, & |
---|
27 | wake_cstar, & |
---|
28 | wake_pe, wake_fip, fm_therm, entr_therm, & |
---|
29 | detr_therm, ale_bl, ale_bl_trig, alp_bl, & |
---|
30 | ale_wake, ale_bl_stat, & |
---|
31 | du_gwd_rando, du_gwd_front, u10m, v10m, & |
---|
32 | treedrg, solswfdiff, delta_sal, ds_ns, dt_ns, & |
---|
33 | delta_sst, ratqs_inter_, dter, dser, dt_ds |
---|
34 | #ifdef ISO |
---|
35 | USE phys_state_var_mod, ONLY: xtsol, fxtevap,xtrain_fall, xtsnow_fall, & |
---|
36 | xt_ancien, xtl_ancien, xts_ancien, & |
---|
37 | wake_deltaxt |
---|
38 | #endif |
---|
39 | USE lmdz_geometry, ONLY: longitude_deg, latitude_deg |
---|
40 | USE iostart, ONLY: open_restartphy, close_restartphy, enddef_restartphy, put_field, put_var |
---|
41 | USE traclmdz_mod, ONLY: traclmdz_to_restart |
---|
42 | USE infotrac_phy, ONLY: type_trac, nqtot, tracers, nbtr, niso |
---|
43 | #ifdef ISO |
---|
44 | #ifdef ISOVERIF |
---|
45 | USE isotopes_verif_mod |
---|
46 | #endif |
---|
47 | #endif |
---|
48 | USE carbon_cycle_mod, ONLY: carbon_cycle_cpl, co2_send, carbon_cycle_rad, RCO2_glo |
---|
49 | USE indice_sol_mod, ONLY: nbsrf, is_oce, is_sic, is_ter, is_lic, epsfra |
---|
50 | USE surface_data, ONLY: type_ocean, version_ocean |
---|
51 | USE ocean_slab_mod, ONLY: nslay, tslab, seaice, tice, fsic |
---|
52 | USE time_phylmdz_mod, ONLY: annee_ref, day_end, itau_phy, pdtphys |
---|
53 | USE config_ocean_skin_m, ONLY: activate_ocean_skin |
---|
54 | USE lmdz_abort_physic, ONLY: abort_physic |
---|
55 | USE lmdz_alpale |
---|
56 | USE lmdz_clesphys |
---|
57 | USE lmdz_compbl, ONLY: iflag_pbl, iflag_pbl_split, iflag_order2_sollw, ifl_pbltree |
---|
58 | |
---|
59 | IMPLICIT NONE |
---|
60 | |
---|
61 | include "dimsoil.h" |
---|
62 | !====================================================================== |
---|
63 | CHARACTER*(*) fichnom |
---|
64 | |
---|
65 | ! les variables globales ecrites dans le fichier restart |
---|
66 | |
---|
67 | REAL tsoil(klon, nsoilmx, nbsrf) |
---|
68 | REAL qsurf(klon, nbsrf) |
---|
69 | REAL snow(klon, nbsrf) |
---|
70 | REAL fder(klon) |
---|
71 | REAL run_off_lic_0(klon) |
---|
72 | REAL trs(klon, nbtr) |
---|
73 | #ifdef ISO |
---|
74 | REAL xtsnow(niso,klon, nbsrf) |
---|
75 | REAL xtrun_off_lic_0(niso,klon) |
---|
76 | REAL Rland_ice(niso,klon) |
---|
77 | #endif |
---|
78 | |
---|
79 | INTEGER nid, nvarid, idim1, idim2, idim3 |
---|
80 | INTEGER ierr |
---|
81 | INTEGER length |
---|
82 | PARAMETER (length=100) |
---|
83 | REAL tab_cntrl(length) |
---|
84 | |
---|
85 | INTEGER isoil, nsrf,isw |
---|
86 | CHARACTER (len=2) :: str2 |
---|
87 | CHARACTER (len=256) :: nam, lnam |
---|
88 | INTEGER :: it, iq, pass |
---|
89 | |
---|
90 | !====================================================================== |
---|
91 | |
---|
92 | ! Get variables which will be written to restart file from module |
---|
93 | ! pbl_surface_mod |
---|
94 | CALL pbl_surface_final(fder, snow, qsurf, tsoil & |
---|
95 | #ifdef ISO |
---|
96 | ,xtsnow,Rland_ice & |
---|
97 | #endif |
---|
98 | ) |
---|
99 | |
---|
100 | ! Get a variable calculated in module fonte_neige_mod |
---|
101 | CALL fonte_neige_final(run_off_lic_0 & |
---|
102 | #ifdef ISO |
---|
103 | ,xtrun_off_lic_0 & |
---|
104 | #endif |
---|
105 | ) |
---|
106 | |
---|
107 | !====================================================================== |
---|
108 | |
---|
109 | CALL open_restartphy(fichnom) |
---|
110 | |
---|
111 | |
---|
112 | DO ierr = 1, length |
---|
113 | tab_cntrl(ierr) = 0.0 |
---|
114 | ENDDO |
---|
115 | tab_cntrl(1) = pdtphys |
---|
116 | tab_cntrl(2) = radpas |
---|
117 | ! co2_ppm : current value of atmospheric CO2 |
---|
118 | tab_cntrl(3) = co2_ppm |
---|
119 | tab_cntrl(4) = solaire |
---|
120 | tab_cntrl(5) = iflag_con |
---|
121 | tab_cntrl(6) = nbapp_rad |
---|
122 | |
---|
123 | IF( iflag_cycle_diurne>=1 ) tab_cntrl( 7 ) = iflag_cycle_diurne |
---|
124 | IF( soil_model ) tab_cntrl( 8 ) = 1. |
---|
125 | IF( new_oliq ) tab_cntrl( 9 ) = 1. |
---|
126 | IF( ok_orodr ) tab_cntrl(10 ) = 1. |
---|
127 | IF( ok_orolf ) tab_cntrl(11 ) = 1. |
---|
128 | |
---|
129 | tab_cntrl(13) = day_end |
---|
130 | tab_cntrl(14) = annee_ref |
---|
131 | tab_cntrl(15) = itau_phy |
---|
132 | |
---|
133 | ! co2_ppm0 : initial value of atmospheric CO2 |
---|
134 | ! tab_cntrl(16) = co2_ppm0 |
---|
135 | |
---|
136 | ! PC -- initial value of RCO2 for the radiation scheme |
---|
137 | ! tab_cntrl(17) = co2_ppm * 1.0e-06 * RMCO2 / RMD |
---|
138 | IF (carbon_cycle_rad) tab_cntrl(17) = RCO2_glo |
---|
139 | !PRINT*, "PC : phyredem RCO2_glo =",RCO2_glo |
---|
140 | |
---|
141 | DO pass=1,2 ! pass=1 netcdf definition ; pass=2 netcdf write |
---|
142 | |
---|
143 | CALL put_var(pass, "controle", "Parametres de controle", tab_cntrl) |
---|
144 | |
---|
145 | CALL put_field(pass,"longitude", & |
---|
146 | "Longitudes de la grille physique", longitude_deg) |
---|
147 | |
---|
148 | CALL put_field(pass,"latitude", "Latitudes de la grille physique", latitude_deg) |
---|
149 | |
---|
150 | ! PB ajout du masque terre/mer |
---|
151 | |
---|
152 | CALL put_field(pass,"masque", "masque terre mer", zmasq) |
---|
153 | |
---|
154 | ! BP ajout des fraction de chaque sous-surface |
---|
155 | |
---|
156 | ! Get last fractions from slab ocean |
---|
157 | IF (type_ocean == 'slab' .AND. version_ocean == "sicINT") THEN |
---|
158 | WHERE (1.-zmasq(:)>EPSFRA) |
---|
159 | pctsrf(:,is_oce)=(1.-fsic(:))*(1.-zmasq(:)) |
---|
160 | pctsrf(:,is_sic)=fsic(:)*(1.-zmasq(:)) |
---|
161 | END WHERE |
---|
162 | END IF |
---|
163 | |
---|
164 | ! 1. fraction de terre |
---|
165 | |
---|
166 | CALL put_field(pass,"FTER", "fraction de continent", pctsrf(:, is_ter)) |
---|
167 | |
---|
168 | ! 2. Fraction de glace de terre |
---|
169 | |
---|
170 | CALL put_field(pass,"FLIC", "fraction glace de terre", pctsrf(:, is_lic)) |
---|
171 | |
---|
172 | ! 3. fraction ocean |
---|
173 | |
---|
174 | CALL put_field(pass,"FOCE", "fraction ocean", pctsrf(:, is_oce)) |
---|
175 | |
---|
176 | ! 4. Fraction glace de mer |
---|
177 | |
---|
178 | CALL put_field(pass,"FSIC", "fraction glace mer", pctsrf(:, is_sic)) |
---|
179 | |
---|
180 | IF(nbsrf >99) CALL abort_physic("phyredem", "Trop de sous-mailles", 1) |
---|
181 | IF(nsoilmx>99) CALL abort_physic("phyredem", "Trop de sous-mailles", 1) |
---|
182 | IF(nsw >99) CALL abort_physic("phyredem", "Trop de bandes", 1) |
---|
183 | |
---|
184 | ! Surface variables |
---|
185 | CALL put_field_srf1(pass,"TS","Temperature",ftsol(:,:)) |
---|
186 | |
---|
187 | IF (iflag_pbl>1 .AND. iflag_wake>=1 .AND. iflag_pbl_split >=1) THEN |
---|
188 | CALL put_field_srf1(pass, "DELTATS", & |
---|
189 | "w-x surface temperature difference", delta_tsurf(:,:)) |
---|
190 | CALL put_field_srf1(pass, "BETAS", "Aridity factor", beta_aridity(:,:)) |
---|
191 | end IF |
---|
192 | ! End surface variables |
---|
193 | |
---|
194 | ! ================== Albedo ======================================= |
---|
195 | PRINT*,'PHYREDEM NOUVEAU' |
---|
196 | CALL put_field_srf2(pass,"A_dir_SW","Albedo direct",falb_dir(:,:,:)) |
---|
197 | CALL put_field_srf2(pass,"A_dif_SW","Albedo diffus",falb_dif(:,:,:)) |
---|
198 | |
---|
199 | CALL put_field_srf1(pass,"U10M", "u a 10m", u10m) |
---|
200 | |
---|
201 | CALL put_field_srf1(pass,"V10M", "v a 10m", v10m) |
---|
202 | |
---|
203 | |
---|
204 | ! ================== Tsoil ========================================= |
---|
205 | CALL put_field_srf2(pass,"Tsoil","Temperature",tsoil(:,:,:)) |
---|
206 | !FC |
---|
207 | ! CALL put_field_srf2("treedrg","freinage arbres",treedrg(:,:,:)) |
---|
208 | CALL put_field(pass,"treedrg_ter","freinage arbres",treedrg(:,:,is_ter)) |
---|
209 | |
---|
210 | |
---|
211 | CALL put_field_srf1(pass,"QS" , "Humidite",qsurf(:,:)) |
---|
212 | |
---|
213 | CALL put_field (pass,"QSOL", "Eau dans le sol (mm)", qsol) |
---|
214 | |
---|
215 | CALL put_field_srf1(pass,"EVAP", "Evaporation", fevap(:,:)) |
---|
216 | |
---|
217 | CALL put_field_srf1(pass,"SNOW", "Neige", snow(:,:)) |
---|
218 | |
---|
219 | CALL put_field(pass,"RADS", "Rayonnement net a la surface", radsol) |
---|
220 | |
---|
221 | CALL put_field(pass,"solsw", "Rayonnement solaire a la surface", solsw) |
---|
222 | |
---|
223 | CALL put_field(pass,"solswfdiff", "Fraction du rayonnement solaire a la surface qui est diffus", solswfdiff) |
---|
224 | |
---|
225 | CALL put_field(pass,"sollw", "Rayonnement IF a la surface", sollw) |
---|
226 | |
---|
227 | CALL put_field(pass,"sollwdown", "Rayonnement down IF a la surface", sollwdown) |
---|
228 | |
---|
229 | CALL put_field(pass,"fder", "Derive de flux", fder) |
---|
230 | |
---|
231 | CALL put_field(pass,"rain_f", "precipitation liquide", rain_fall) |
---|
232 | |
---|
233 | CALL put_field(pass,"snow_f", "precipitation solide", snow_fall) |
---|
234 | |
---|
235 | CALL put_field_srf1(pass,"Z0m", "rugosite", z0m(:,:)) |
---|
236 | |
---|
237 | CALL put_field_srf1(pass,"Z0h", "rugosite", z0h(:,:)) |
---|
238 | |
---|
239 | CALL put_field_srf1(pass,"AGESNO", "Age de la neige", agesno(:,:)) |
---|
240 | |
---|
241 | CALL put_field(pass,"ZMEA", "ZMEA", zmea) |
---|
242 | |
---|
243 | CALL put_field(pass,"ZSTD", "ZSTD", zstd) |
---|
244 | |
---|
245 | CALL put_field(pass,"ZSIG", "ZSIG", zsig) |
---|
246 | |
---|
247 | CALL put_field(pass,"ZGAM", "ZGAM", zgam) |
---|
248 | |
---|
249 | CALL put_field(pass,"ZTHE", "ZTHE", zthe) |
---|
250 | |
---|
251 | CALL put_field(pass,"ZPIC", "ZPIC", zpic) |
---|
252 | |
---|
253 | CALL put_field(pass,"ZVAL", "ZVAL", zval) |
---|
254 | |
---|
255 | CALL put_field(pass,"RUGSREL", "RUGSREL", rugoro) |
---|
256 | |
---|
257 | CALL put_field(pass,"TANCIEN", "TANCIEN", t_ancien) |
---|
258 | |
---|
259 | CALL put_field(pass,"QANCIEN", "QANCIEN", q_ancien) |
---|
260 | |
---|
261 | CALL put_field(pass,"QLANCIEN", "QLANCIEN", ql_ancien) |
---|
262 | |
---|
263 | CALL put_field(pass,"QSANCIEN", "QSANCIEN", qs_ancien) |
---|
264 | |
---|
265 | IF (ok_bs) THEN |
---|
266 | CALL put_field(pass,"bs_f", "precipitation neige soufflee", bs_fall) |
---|
267 | CALL put_field(pass,"QBSANCIEN", "QBSANCIEN", qbs_ancien) |
---|
268 | CALL put_field(pass,"PRBSWANCIEN", "PRBSWANCIEN", prbsw_ancien) |
---|
269 | ENDIF |
---|
270 | |
---|
271 | IF ( ok_ice_supersat ) THEN |
---|
272 | CALL put_field(pass,"CFANCIEN", "CFANCIEN", cf_ancien) |
---|
273 | CALL put_field(pass,"RVCANCIEN", "RVCANCIEN", rvc_ancien) |
---|
274 | ENDIF |
---|
275 | |
---|
276 | CALL put_field(pass,"PRWANCIEN", "PRWANCIEN", prw_ancien) |
---|
277 | |
---|
278 | CALL put_field(pass,"PRLWANCIEN", "PRLWANCIEN", prlw_ancien) |
---|
279 | |
---|
280 | CALL put_field(pass,"PRSWANCIEN", "PRSWANCIEN", prsw_ancien) |
---|
281 | |
---|
282 | CALL put_field(pass,"UANCIEN", "UANCIEN", u_ancien) |
---|
283 | |
---|
284 | CALL put_field(pass,"VANCIEN", "VANCIEN", v_ancien) |
---|
285 | |
---|
286 | CALL put_field(pass,"CLWCON", "Eau liquide convective", clwcon) |
---|
287 | |
---|
288 | CALL put_field(pass,"RNEBCON", "Nebulosite convective", rnebcon) |
---|
289 | |
---|
290 | CALL put_field(pass,"RATQS", "Ratqs", ratqs) |
---|
291 | |
---|
292 | ! run_off_lic_0 |
---|
293 | |
---|
294 | CALL put_field(pass,"RUNOFFLIC0", "Runofflic0", run_off_lic_0) |
---|
295 | |
---|
296 | ! DEB TKE PBL ! |
---|
297 | |
---|
298 | IF (iflag_pbl>1) THEN |
---|
299 | CALL put_field_srf3(pass,"TKE", "Energ. Cineti. Turb.", & |
---|
300 | pbl_tke(:,:,:)) |
---|
301 | CALL put_field_srf3(pass,"DELTATKE", "Del TKE wk/env.", & |
---|
302 | wake_delta_pbl_tke(:,:,:)) |
---|
303 | END IF |
---|
304 | |
---|
305 | ! FIN TKE PBL ! |
---|
306 | !IM ajout zmax0, f0, sig1, w01 |
---|
307 | !IM wake_deltat, wake_deltaq, wake_s, wake_cstar, wake_pe, wake_fip |
---|
308 | |
---|
309 | CALL put_field(pass,"ZMAX0", "ZMAX0", zmax0) |
---|
310 | |
---|
311 | CALL put_field(pass,"F0", "F0", f0) |
---|
312 | |
---|
313 | CALL put_field(pass,"sig1", "sig1 Emanuel", sig1) |
---|
314 | |
---|
315 | CALL put_field(pass,"w01", "w01 Emanuel", w01) |
---|
316 | |
---|
317 | ! wake_deltat |
---|
318 | CALL put_field(pass,"WAKE_DELTAT", "WAKE_DELTAT", wake_deltat) |
---|
319 | |
---|
320 | CALL put_field(pass,"WAKE_DELTAQ", "WAKE_DELTAQ", wake_deltaq) |
---|
321 | |
---|
322 | CALL put_field(pass,"WAKE_S", "Wake frac. area", wake_s) |
---|
323 | |
---|
324 | CALL put_field(pass,"WAKE_DENS", "Wake num. /unit area", wake_dens) |
---|
325 | |
---|
326 | CALL put_field(pass,"AWAKE_DENS", "Active Wake num. /unit area", awake_dens) |
---|
327 | |
---|
328 | CALL put_field(pass,"CV_GEN", "CB birth rate", cv_gen) |
---|
329 | |
---|
330 | CALL put_field(pass,"WAKE_CSTAR", "WAKE_CSTAR", wake_cstar) |
---|
331 | |
---|
332 | CALL put_field(pass,"WAKE_PE", "WAKE_PE", wake_pe) |
---|
333 | |
---|
334 | CALL put_field(pass,"WAKE_FIP", "WAKE_FIP", wake_fip) |
---|
335 | |
---|
336 | ! thermiques |
---|
337 | |
---|
338 | CALL put_field(pass,"FM_THERM", "FM_THERM", fm_therm) |
---|
339 | |
---|
340 | CALL put_field(pass,"ENTR_THERM", "ENTR_THERM", entr_therm) |
---|
341 | |
---|
342 | CALL put_field(pass,"DETR_THERM", "DETR_THERM", detr_therm) |
---|
343 | |
---|
344 | CALL put_field(pass,"ALE_BL", "ALE_BL", ale_bl) |
---|
345 | |
---|
346 | CALL put_field(pass,"ALE_BL_TRIG", "ALE_BL_TRIG", ale_bl_trig) |
---|
347 | |
---|
348 | CALL put_field(pass,"ALP_BL", "ALP_BL", alp_bl) |
---|
349 | |
---|
350 | CALL put_field(pass,"ALE_WAKE", "ALE_WAKE", ale_wake) |
---|
351 | |
---|
352 | CALL put_field(pass,"ALE_BL_STAT", "ALE_BL_STAT", ale_bl_stat) |
---|
353 | |
---|
354 | |
---|
355 | ! fisrtilp/clouds |
---|
356 | CALL put_field(pass,"RATQS_INTER","Relative width of the lsc sugrid scale water",ratqs_inter_) |
---|
357 | |
---|
358 | |
---|
359 | IF (ANY(type_trac == ['co2i','inco'])) THEN |
---|
360 | IF (carbon_cycle_cpl) THEN |
---|
361 | IF (.NOT. ALLOCATED(co2_send)) THEN |
---|
362 | ! This is the case of create_etat0_limit, ce0l |
---|
363 | ALLOCATE(co2_send(klon)) |
---|
364 | co2_send(:) = co2_ppm0 |
---|
365 | END IF |
---|
366 | CALL put_field(pass,"co2_send", "co2_ppm for coupling", co2_send) |
---|
367 | END IF |
---|
368 | |
---|
369 | ! trs from traclmdz_mod |
---|
370 | ELSE IF (type_trac == 'lmdz') THEN |
---|
371 | CALL traclmdz_to_restart(trs) |
---|
372 | it = 0 |
---|
373 | DO iq = 1, nqtot |
---|
374 | IF(.NOT.(tracers(iq)%isAdvected .AND. tracers(iq)%isInPhysics)) CYCLE |
---|
375 | it = it+1 |
---|
376 | CALL put_field(pass,"trs_"//tracers(iq)%name, "", trs(:, it)) |
---|
377 | END DO |
---|
378 | END IF |
---|
379 | |
---|
380 | ! Restart variables for Slab ocean |
---|
381 | IF (type_ocean == 'slab') THEN |
---|
382 | IF (nslay==1) THEN |
---|
383 | CALL put_field(pass,"tslab", "Slab ocean temperature", tslab) |
---|
384 | ELSE |
---|
385 | DO it=1,nslay |
---|
386 | WRITE(str2,'(i2.2)') it |
---|
387 | CALL put_field(pass,"tslab"//str2, "Slab ocean temperature", tslab(:,it)) |
---|
388 | END DO |
---|
389 | END IF |
---|
390 | IF (version_ocean == 'sicINT') THEN |
---|
391 | CALL put_field(pass,"seaice", "Slab seaice (kg/m2)", seaice) |
---|
392 | CALL put_field(pass,"slab_tice", "Slab sea ice temperature", tice) |
---|
393 | END IF |
---|
394 | END IF |
---|
395 | |
---|
396 | IF (ok_gwd_rando) CALL put_field(pass,"du_gwd_rando", & |
---|
397 | "tendency on zonal wind due to flott gravity waves", du_gwd_rando) |
---|
398 | |
---|
399 | IF (.NOT. ok_hines .AND. ok_gwd_rando) CALL put_field(pass,"du_gwd_front", & |
---|
400 | "tendency on zonal wind due to acama gravity waves", du_gwd_front) |
---|
401 | |
---|
402 | IF (activate_ocean_skin >= 1) THEN |
---|
403 | IF (activate_ocean_skin == 2 .AND. type_ocean == 'couple') THEN |
---|
404 | CALL put_field(pass, "delta_sal", & |
---|
405 | "ocean-air interface salinity minus bulk salinity", delta_sal) |
---|
406 | CALL put_field(pass, "delta_SST", & |
---|
407 | "ocean-air interface temperature minus bulk SST", delta_sst) |
---|
408 | CALL put_field(pass, "dter", & |
---|
409 | "ocean-air interface temperature minus subskin temperature", & |
---|
410 | dter) |
---|
411 | CALL put_field(pass, "dser", & |
---|
412 | "ocean-air interface salinity minus subskin salinity", dser) |
---|
413 | CALL put_field(pass, "dt_ds", & |
---|
414 | "(tks / tkt) * dTer", dt_ds) |
---|
415 | end if |
---|
416 | |
---|
417 | CALL put_field(pass, "dS_ns", "delta salinity near surface", ds_ns) |
---|
418 | CALL put_field(pass, "dT_ns", "delta temperature near surface", dT_ns) |
---|
419 | end if |
---|
420 | |
---|
421 | #ifdef ISO |
---|
422 | WRITE(*,*) 'phyredem 342' |
---|
423 | CALL phyisoredem (pass, & |
---|
424 | xtsnow, & |
---|
425 | xtrun_off_lic_0,Rland_ice, & |
---|
426 | run_off_lic_0) |
---|
427 | #endif |
---|
428 | |
---|
429 | IF (pass==1) CALL enddef_restartphy |
---|
430 | IF (pass==2) CALL close_restartphy |
---|
431 | ENDDO ! DO pass=1,2 ! pass=1 netcdf definition ; pass=2 netcdf write |
---|
432 | |
---|
433 | !$OMP BARRIER |
---|
434 | |
---|
435 | |
---|
436 | CONTAINS |
---|
437 | |
---|
438 | |
---|
439 | SUBROUTINE put_field_srf1(pass,nam,lnam,field) |
---|
440 | |
---|
441 | IMPLICIT NONE |
---|
442 | INTEGER, INTENT(IN) :: pass |
---|
443 | CHARACTER(LEN=*), INTENT(IN) :: nam, lnam |
---|
444 | REAL, INTENT(IN) :: field(:,:) |
---|
445 | CHARACTER(LEN=256) :: nm, lm, str |
---|
446 | DO nsrf = 1, SIZE(field,2) |
---|
447 | WRITE(str, '(i2.2)') nsrf |
---|
448 | nm=TRIM(nam)//TRIM(str) |
---|
449 | lm=TRIM(lnam)//" de surface No. "//TRIM(str) |
---|
450 | CALL put_field(pass,nm,lm,field(:,nsrf)) |
---|
451 | END DO |
---|
452 | |
---|
453 | END SUBROUTINE put_field_srf1 |
---|
454 | |
---|
455 | |
---|
456 | SUBROUTINE put_field_srf2(pass,nam,lnam,field) |
---|
457 | |
---|
458 | IMPLICIT NONE |
---|
459 | INTEGER, INTENT(IN) :: pass |
---|
460 | CHARACTER(LEN=*), INTENT(IN) :: nam, lnam |
---|
461 | REAL, INTENT(IN) :: field(:,:,:) |
---|
462 | CHARACTER(LEN=256) :: nm, lm, str |
---|
463 | DO nsrf = 1, SIZE(field,3) |
---|
464 | DO isoil=1, SIZE(field,2) |
---|
465 | WRITE(str, '(i2.2,"srf",i2.2)')isoil,nsrf |
---|
466 | ! WRITE(lunout,*)"PHYREDEM ",TRIM(nam)//TRIM(str) |
---|
467 | nm=TRIM(nam)//TRIM(str) |
---|
468 | lm=TRIM(lnam)//" du sol No. "//TRIM(str) |
---|
469 | CALL put_field(pass,nm,lm,field(:,isoil,nsrf)) |
---|
470 | END DO |
---|
471 | END DO |
---|
472 | |
---|
473 | END SUBROUTINE put_field_srf2 |
---|
474 | |
---|
475 | |
---|
476 | SUBROUTINE put_field_srf3(pass,nam,lnam,field) |
---|
477 | |
---|
478 | IMPLICIT NONE |
---|
479 | INTEGER, INTENT(IN) :: pass |
---|
480 | CHARACTER(LEN=*), INTENT(IN) :: nam, lnam |
---|
481 | REAL, INTENT(IN) :: field(:,:,:) |
---|
482 | CHARACTER(LEN=256) :: nm, lm, str |
---|
483 | DO nsrf = 1, SIZE(field,3) |
---|
484 | WRITE(str, '(i2.2)') nsrf |
---|
485 | nm=TRIM(nam)//TRIM(str) |
---|
486 | lm=TRIM(lnam)//TRIM(str) |
---|
487 | CALL put_field(pass,nm,lm,field(:,1:klev+1,nsrf)) |
---|
488 | END DO |
---|
489 | |
---|
490 | END SUBROUTINE put_field_srf3 |
---|
491 | |
---|
492 | #ifdef ISO |
---|
493 | ! je voulais mettre cette SUBROUTINE dans isotopes_mod, mais elle a besoin de put_field_srf1 qui est contenue dans la SUBROUTINE phyredem. Si on veut mettre cette routine dans isotopes_mod, il faudrait convertir ce fichier en module pour pouvoir en appeler des routines |
---|
494 | |
---|
495 | SUBROUTINE phyisoredem(pass, & |
---|
496 | xtsnow, & |
---|
497 | xtrun_off_lic_0,Rland_ice, & |
---|
498 | run_off_lic_0) |
---|
499 | USE dimphy |
---|
500 | !USE lmdz_grid_phy |
---|
501 | !USE lmdz_phys_para |
---|
502 | USE phys_state_var_mod, ONLY: q_ancien,xt_ancien,wake_deltaq,wake_deltaxt, & |
---|
503 | xtrain_fall,xtsnow_fall, ql_ancien,xtl_ancien,qs_ancien,xts_ancien, & |
---|
504 | xtsol,fxtevap |
---|
505 | USE infotrac_phy,ONLY: niso, ntiso |
---|
506 | !USE control_mod |
---|
507 | USE indice_sol_mod, ONLY: nbsrf |
---|
508 | USE iostart, ONLY: put_field |
---|
509 | USE isotopes_mod, ONLY: isoName,iso_eau |
---|
510 | #ifdef ISOVERIF |
---|
511 | USE isotopes_verif_mod |
---|
512 | #endif |
---|
513 | #ifdef ISOTRAC |
---|
514 | USE isotrac_mod, ONLY: index_zone,index_iso,strtrac |
---|
515 | #endif |
---|
516 | !USE phyredem, ONLY: put_field_srf1 |
---|
517 | USE lmdz_alpale |
---|
518 | USE lmdz_clesphys |
---|
519 | USE lmdz_compbl, ONLY: iflag_pbl, iflag_pbl_split, iflag_order2_sollw, ifl_pbltree |
---|
520 | |
---|
521 | IMPLICIT NONE |
---|
522 | |
---|
523 | ! equivalent isotopique de phyredem |
---|
524 | |
---|
525 | include "dimsoil.h" |
---|
526 | ! inputs |
---|
527 | !REAL xtsol(niso,klon) |
---|
528 | REAL xtsnow(niso,klon,nbsrf) |
---|
529 | !REAL xtevap(ntiso,klon,nbsrf) |
---|
530 | REAL xtrun_off_lic_0(niso,klon) |
---|
531 | REAL Rland_ice(niso,klon) |
---|
532 | REAL run_off_lic_0(klon) |
---|
533 | INTEGER, INTENT(IN) :: pass |
---|
534 | |
---|
535 | ! locals |
---|
536 | REAL iso_tmp(klon) |
---|
537 | REAL iso_tmp_lonlev(klon,klev) |
---|
538 | REAL iso_tmp_lonsrf(klon,nbsrf) |
---|
539 | INTEGER i,ixt,k,nsrf |
---|
540 | INTEGER nid, nvarid |
---|
541 | INTEGER ierr |
---|
542 | CHARACTER*7 str7 |
---|
543 | CHARACTER*2 str2 |
---|
544 | CHARACTER*50 outiso |
---|
545 | INTEGER lnblnk |
---|
546 | #ifdef ISOTRAC |
---|
547 | INTEGER iiso,izone |
---|
548 | #endif |
---|
549 | |
---|
550 | WRITE(*,*) 'phyisoredem 41: entrée' |
---|
551 | #ifdef ISOVERIF |
---|
552 | IF (iso_eau.gt.0) THEN |
---|
553 | DO k=1,klev |
---|
554 | DO i=1,klon |
---|
555 | CALL iso_verif_egalite(xt_ancien(iso_eau,i,k),q_ancien(i,k), & |
---|
556 | 'phyisoredem 50a') |
---|
557 | CALL iso_verif_egalite(xtl_ancien(iso_eau,i,k),ql_ancien(i,k), & |
---|
558 | 'phyisoredem 50b') |
---|
559 | CALL iso_verif_egalite(xts_ancien(iso_eau,i,k),qs_ancien(i,k), & |
---|
560 | 'phyisoredem 50c') |
---|
561 | |
---|
562 | enddo !do i=1,klon |
---|
563 | enddo !do k=1,klev |
---|
564 | DO i=1,klon |
---|
565 | DO nsrf = 1, nbsrf |
---|
566 | CALL iso_verif_egalite(fxtevap(iso_eau,i,nsrf),fevap(i,nsrf), & |
---|
567 | 'phyisoredem 50d') |
---|
568 | enddo !DO nsrf = 1, nbsrf |
---|
569 | enddo |
---|
570 | endif !if (iso_eau.gt.0) THEN |
---|
571 | DO i=1,klon |
---|
572 | DO ixt=1,niso |
---|
573 | CALL iso_verif_noNaN(xtsol(ixt,i),'phyisoredem 72') |
---|
574 | enddo !do ixt=1,niso |
---|
575 | enddo !do i=1,klon |
---|
576 | #ifdef ISOTRAC |
---|
577 | DO k=1,klev |
---|
578 | DO i=1,klon |
---|
579 | CALL iso_verif_traceur(xt_ancien(1,i,k), & |
---|
580 | 'phyisoredem 60') |
---|
581 | enddo !do i=1,klon |
---|
582 | enddo !do k=1,kle |
---|
583 | #endif |
---|
584 | #endif |
---|
585 | |
---|
586 | DO ixt=1,ntiso |
---|
587 | |
---|
588 | outiso = TRIM(isoName(ixt)) |
---|
589 | i = INDEX(outiso, '_', .TRUE.) |
---|
590 | outiso = outiso(1:i-1)//outiso(i+1:LEN_TRIM(outiso)) |
---|
591 | WRITE(*,*) 'phyredem 550: ixt,outiso=',ixt,TRIM(outiso) |
---|
592 | |
---|
593 | iso_tmp_lonsrf(:,:)=fxtevap(ixt,:,:) |
---|
594 | CALL put_field_srf1(pass, "XTEVAP"//TRIM(outiso), "Evaporation de surface",iso_tmp_lonsrf) |
---|
595 | |
---|
596 | iso_tmp(:)=xtrain_fall(ixt,:) |
---|
597 | CALL put_field(pass, "xtrain_f"//TRIM(outiso), "precipitation liquide",iso_tmp) |
---|
598 | |
---|
599 | iso_tmp(:)=xtsnow_fall(ixt,:) |
---|
600 | CALL put_field(pass, "xtsnow_f"//TRIM(outiso), "precipitation solide",iso_tmp) |
---|
601 | |
---|
602 | iso_tmp_lonlev(:,:)=xt_ancien(ixt,:,:) |
---|
603 | CALL put_field(pass, "XTANCIEN"//TRIM(outiso), "QANCIEN", iso_tmp_lonlev) |
---|
604 | |
---|
605 | iso_tmp_lonlev(:,:)=xtl_ancien(ixt,:,:) |
---|
606 | CALL put_field(pass, "XTLANCIEN"//TRIM(outiso), "QLANCIEN", iso_tmp_lonlev) |
---|
607 | |
---|
608 | iso_tmp_lonlev(:,:)=xts_ancien(ixt,:,:) |
---|
609 | CALL put_field(pass, "XTSANCIEN"//TRIM(outiso), "QSANCIEN", iso_tmp_lonlev) |
---|
610 | |
---|
611 | iso_tmp_lonlev(:,:)=wake_deltaxt(ixt,:,:) |
---|
612 | CALL put_field(pass,"WAKE_DELTAXT"//TRIM(outiso), "WAKE_DELTAQ", iso_tmp_lonlev) |
---|
613 | |
---|
614 | iso_tmp_lonlev(:,:)=wake_deltaxt(ixt,:,:) |
---|
615 | CALL put_field(pass,"WAKE_DELTAXT"//TRIM(outiso), "WAKE_DELTAXT",iso_tmp_lonlev) |
---|
616 | |
---|
617 | ! variables seulement pour niso: |
---|
618 | IF (ixt.le.niso) THEN |
---|
619 | iso_tmp_lonsrf(:,:)=xtsnow(ixt,:,:) |
---|
620 | CALL put_field_srf1(pass, "XTSNOW"//TRIM(outiso), "NEIGE", iso_tmp_lonsrf) |
---|
621 | |
---|
622 | iso_tmp(:)=xtsol(ixt,:) |
---|
623 | CALL put_field(pass, "XTSOL"//TRIM(outiso), "Eau dans le sol (mm)",iso_tmp) |
---|
624 | |
---|
625 | iso_tmp(:)=Rland_ice(ixt,:) |
---|
626 | CALL put_field(pass, "Rland_ice"//TRIM(outiso), "ratio land ice", iso_tmp) |
---|
627 | |
---|
628 | iso_tmp(:)=xtrun_off_lic_0(ixt,:) |
---|
629 | CALL put_field(pass,"XTRUNOFFLIC0"//TRIM(outiso), "Runofflic0", iso_tmp) |
---|
630 | |
---|
631 | endif ! if (ixt.le.niso) THEN |
---|
632 | enddo !do ixt=1,niso |
---|
633 | |
---|
634 | WRITE(*,*) 'phyisoredem 261: sortie' |
---|
635 | END SUBROUTINE phyisoredem |
---|
636 | #endif |
---|
637 | |
---|
638 | END SUBROUTINE phyredem |
---|