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