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 |
---|
9 | USE fonte_neige_mod, ONLY : fonte_neige_final |
---|
10 | USE pbl_surface_mod, ONLY : pbl_surface_final |
---|
11 | USE phys_state_var_mod, ONLY: radpas, zmasq, pctsrf, ftsol, falb_dir, & |
---|
12 | falb_dif, qsol, fevap, radsol, solsw, sollw, & |
---|
13 | sollwdown, rain_fall, snow_fall, z0m, z0h, & |
---|
14 | agesno, zmea, zstd, zsig, zgam, zthe, zpic, & |
---|
15 | zval, rugoro, t_ancien, q_ancien, u_ancien, & |
---|
16 | v_ancien, clwcon, rnebcon, ratqs, pbl_tke, & |
---|
17 | wake_delta_pbl_tke, zmax0, f0, sig1, w01, & |
---|
18 | wake_deltat, wake_deltaq, wake_s, wake_cstar, & |
---|
19 | wake_pe, wake_fip, fm_therm, entr_therm, & |
---|
20 | detr_therm, Ale_bl, Ale_bl_trig, Alp_bl, & |
---|
21 | du_gwd_rando, du_gwd_front |
---|
22 | USE geometry_mod, ONLY : longitude_deg, latitude_deg |
---|
23 | USE iostart, ONLY: open_restartphy, close_restartphy, put_field, put_var |
---|
24 | USE traclmdz_mod, ONLY : traclmdz_to_restart |
---|
25 | USE infotrac_phy, ONLY: type_trac, niadv, tname, nbtr, nqo |
---|
26 | USE carbon_cycle_mod, ONLY : carbon_cycle_cpl, co2_send |
---|
27 | USE indice_sol_mod, ONLY: nbsrf, is_oce, is_sic, is_ter, is_lic, epsfra |
---|
28 | USE surface_data, ONLY: type_ocean, version_ocean |
---|
29 | USE ocean_slab_mod, ONLY : tslab, seaice, tice, fsic |
---|
30 | USE time_phylmdz_mod, ONLY: annee_ref, day_end, itau_phy, pdtphys |
---|
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) |
---|
306 | |
---|
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) |
---|
322 | |
---|
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) |
---|
341 | |
---|
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 |
---|