[1827] | 1 | SUBROUTINE phyredem (fichnom) |
---|
[2293] | 2 | ! |
---|
| 3 | !------------------------------------------------------------------------------- |
---|
| 4 | ! Author: Z.X. Li (LMD/CNRS), 1993/08/18 |
---|
| 5 | !------------------------------------------------------------------------------- |
---|
| 6 | ! Purpose: Write restart state for physics. |
---|
| 7 | !------------------------------------------------------------------------------- |
---|
[1827] | 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 |
---|
[2320] | 16 | USE infotrac_phy, ONLY: type_trac, niadv, tname, nbtr, nqo |
---|
[1827] | 17 | USE control_mod |
---|
| 18 | USE carbon_cycle_mod, ONLY : carbon_cycle_cpl, co2_send |
---|
| 19 | USE indice_sol_mod |
---|
[2057] | 20 | USE surface_data |
---|
[2209] | 21 | USE ocean_slab_mod, ONLY : tslab, seaice, tice, fsic |
---|
[967] | 22 | |
---|
[1827] | 23 | IMPLICIT none |
---|
[2293] | 24 | |
---|
[1827] | 25 | include "dimsoil.h" |
---|
| 26 | include "clesphys.h" |
---|
| 27 | include "temps.h" |
---|
| 28 | include "thermcell.h" |
---|
| 29 | include "compbl.h" |
---|
| 30 | !====================================================================== |
---|
| 31 | CHARACTER*(*) fichnom |
---|
[967] | 32 | |
---|
[1827] | 33 | ! les variables globales ecrites dans le fichier restart |
---|
[782] | 34 | |
---|
[1827] | 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) |
---|
[782] | 41 | |
---|
[1827] | 42 | INTEGER nid, nvarid, idim1, idim2, idim3 |
---|
| 43 | INTEGER ierr |
---|
| 44 | INTEGER length |
---|
| 45 | PARAMETER (length=100) |
---|
| 46 | REAL tab_cntrl(length) |
---|
[782] | 47 | |
---|
[2237] | 48 | INTEGER isoil, nsrf,isw |
---|
[1827] | 49 | CHARACTER (len=7) :: str7 |
---|
[2293] | 50 | CHARACTER (len=256) :: nam, lnam |
---|
[1827] | 51 | INTEGER :: it, iiq |
---|
[524] | 52 | |
---|
[1827] | 53 | !====================================================================== |
---|
[524] | 54 | |
---|
[1827] | 55 | ! Get variables which will be written to restart file from module |
---|
| 56 | ! pbl_surface_mod |
---|
[2243] | 57 | CALL pbl_surface_final(fder, snow, qsurf, tsoil) |
---|
[1279] | 58 | |
---|
[1827] | 59 | ! Get a variable calculated in module fonte_neige_mod |
---|
| 60 | CALL fonte_neige_final(run_off_lic_0) |
---|
[1001] | 61 | |
---|
[1827] | 62 | !====================================================================== |
---|
[1001] | 63 | |
---|
[1827] | 64 | CALL open_restartphy(fichnom) |
---|
[1001] | 65 | |
---|
[1827] | 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 |
---|
[524] | 76 | |
---|
[1827] | 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. |
---|
[524] | 82 | |
---|
[1827] | 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 | |
---|
[2209] | 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 | |
---|
[1827] | 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 | |
---|
[2293] | 127 | IF(nbsrf>99) THEN |
---|
[2311] | 128 | PRINT*, "Trop de sous-mailles"; CALL abort_physic("phyredem", "", 1) |
---|
[2293] | 129 | END IF |
---|
| 130 | IF(nsoilmx>99) THEN |
---|
[2311] | 131 | PRINT*, "Trop de sous-surfaces"; CALL abort_physic("phyredem", "", 1) |
---|
[2293] | 132 | END IF |
---|
[2299] | 133 | IF(nsw>99) THEN |
---|
[2311] | 134 | PRINT*, "Trop de bandes"; CALL abort_physic("phyredem", "", 1) |
---|
[2299] | 135 | END IF |
---|
[1827] | 136 | |
---|
[2293] | 137 | CALL put_field_srf1("TS","Temperature",ftsol(:,:)) |
---|
| 138 | |
---|
[2237] | 139 | ! ================== Albedo ======================================= |
---|
| 140 | print*,'PHYREDEM NOUVEAU' |
---|
[2293] | 141 | CALL put_field_srf2("A_dir_SW","Albedo direct",falb_dir(:,:,:)) |
---|
| 142 | CALL put_field_srf2("A_dif_SW","Albedo diffus",falb_dif(:,:,:)) |
---|
[2237] | 143 | |
---|
[2293] | 144 | ! ================== Tsoil ========================================= |
---|
| 145 | CALL put_field_srf2("Tsoil","Temperature",tsoil(:,:,:)) |
---|
[524] | 146 | |
---|
[2293] | 147 | CALL put_field_srf1("QS" , "Humidite",qsurf(:,:)) |
---|
[1827] | 148 | |
---|
[2293] | 149 | CALL put_field ("QSOL", "Eau dans le sol (mm)", qsol) |
---|
[1827] | 150 | |
---|
[2293] | 151 | CALL put_field_srf1("EVAP", "Evaporation", fevap(:,:)) |
---|
[1827] | 152 | |
---|
[2299] | 153 | CALL put_field_srf1("SNOW", "Neige", snow(:,:)) |
---|
[1827] | 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 | |
---|
[2188] | 161 | CALL put_field("sollwdown", "Rayonnement down IF a la surface", sollw) |
---|
| 162 | |
---|
[1827] | 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 | |
---|
[2293] | 169 | CALL put_field_srf1("Z0m", "rugosite", z0m(:,:)) |
---|
[1827] | 170 | |
---|
[2293] | 171 | CALL put_field_srf1("Z0h", "rugosite", z0h(:,:)) |
---|
[1827] | 172 | |
---|
[2293] | 173 | CALL put_field_srf1("AGESNO", "Age de la neige", agesno(:,:)) |
---|
| 174 | |
---|
[1827] | 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 |
---|
[2293] | 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 |
---|
[1619] | 217 | |
---|
[1827] | 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 |
---|
[1619] | 221 | |
---|
[1827] | 222 | CALL put_field("ZMAX0", "ZMAX0", zmax0) |
---|
[1619] | 223 | |
---|
[1827] | 224 | CALL put_field("F0", "F0", f0) |
---|
[878] | 225 | |
---|
[1827] | 226 | CALL put_field("sig1", "sig1 Emanuel", sig1) |
---|
[1001] | 227 | |
---|
[1827] | 228 | CALL put_field("w01", "w01 Emanuel", w01) |
---|
[1001] | 229 | |
---|
[1827] | 230 | ! wake_deltat |
---|
| 231 | CALL put_field("WAKE_DELTAT", "WAKE_DELTAT", wake_deltat) |
---|
[1279] | 232 | |
---|
[1827] | 233 | CALL put_field("WAKE_DELTAQ", "WAKE_DELTAQ", wake_deltaq) |
---|
[1403] | 234 | |
---|
[1827] | 235 | CALL put_field("WAKE_S", "WAKE_S", wake_s) |
---|
[1403] | 236 | |
---|
[1827] | 237 | CALL put_field("WAKE_CSTAR", "WAKE_CSTAR", wake_cstar) |
---|
[1403] | 238 | |
---|
[1827] | 239 | CALL put_field("WAKE_PE", "WAKE_PE", wake_pe) |
---|
[1403] | 240 | |
---|
[1827] | 241 | CALL put_field("WAKE_FIP", "WAKE_FIP", wake_fip) |
---|
[1279] | 242 | |
---|
[1827] | 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 | |
---|
[2069] | 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 | |
---|
[1827] | 257 | ! trs from traclmdz_mod |
---|
| 258 | IF (type_trac == 'lmdz') THEN |
---|
| 259 | CALL traclmdz_to_restart(trs) |
---|
| 260 | DO it=1, nbtr |
---|
[2265] | 261 | !! iiq=niadv(it+2) ! jyg |
---|
| 262 | iiq=niadv(it+nqo) ! jyg |
---|
[1827] | 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 | |
---|
[2057] | 275 | ! Restart variables for Slab ocean |
---|
| 276 | IF (type_ocean == 'slab') THEN |
---|
| 277 | CALL put_field("tslab", "Slab ocean temperature", tslab) |
---|
[2209] | 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 |
---|
[2057] | 282 | END IF |
---|
| 283 | |
---|
[2333] | 284 | if (ok_gwd_rando) call put_field("du_gwd_rando", & |
---|
| 285 | "tendency on zonal wind due to flott gravity waves", du_gwd_rando) |
---|
[1938] | 286 | |
---|
[2333] | 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 | |
---|
[1827] | 290 | CALL close_restartphy |
---|
| 291 | !$OMP BARRIER |
---|
| 292 | |
---|
[2293] | 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 |
---|
[2299] | 303 | DO nsrf = 1, SIZE(field,2) |
---|
[2293] | 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 |
---|
[2299] | 319 | DO nsrf = 1, SIZE(field,3) |
---|
| 320 | DO isoil=1, SIZE(field,2) |
---|
[2293] | 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 |
---|
[2299] | 338 | DO nsrf = 1, SIZE(field,3) |
---|
[2293] | 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 | |
---|
[1827] | 348 | END SUBROUTINE phyredem |
---|