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