[3927] | 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 |
---|
[3940] | 14 | USE phys_state_var_mod, ONLY: radpas, zmasq, pctsrf, & |
---|
| 15 | ftsol, beta_aridity, delta_tsurf, falb_dir, & |
---|
[3927] | 16 | falb_dif, qsol, fevap, radsol, solsw, sollw, & |
---|
| 17 | sollwdown, rain_fall, snow_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, & |
---|
| 21 | ql_ancien, qs_ancien, u_ancien, & |
---|
| 22 | v_ancien, clwcon, rnebcon, ratqs, pbl_tke, & |
---|
| 23 | wake_delta_pbl_tke, zmax0, f0, sig1, w01, & |
---|
| 24 | wake_deltat, wake_deltaq, wake_s, wake_dens, & |
---|
| 25 | wake_cstar, & |
---|
| 26 | wake_pe, wake_fip, fm_therm, entr_therm, & |
---|
| 27 | detr_therm, ale_bl, ale_bl_trig, alp_bl, & |
---|
| 28 | ale_wake, ale_bl_stat, & |
---|
[3940] | 29 | du_gwd_rando, du_gwd_front, u10m, v10m, & |
---|
| 30 | treedrg, solswfdiff, delta_sal, ds_ns, dt_ns, & |
---|
| 31 | delta_sst, ratqs_inter |
---|
[3927] | 32 | #ifdef ISO |
---|
| 33 | USE phys_state_var_mod, ONLY: xtsol, fxtevap,xtrain_fall, xtsnow_fall, & |
---|
| 34 | xt_ancien, xtl_ancien, xts_ancien, & |
---|
| 35 | wake_deltaxt |
---|
| 36 | #endif |
---|
| 37 | USE geometry_mod, ONLY : longitude_deg, latitude_deg |
---|
| 38 | USE iostart, ONLY: open_restartphy, close_restartphy, enddef_restartphy, put_field, put_var |
---|
| 39 | USE traclmdz_mod, ONLY : traclmdz_to_restart |
---|
| 40 | USE infotrac_phy, ONLY: type_trac, niadv, tname, nbtr, nqo,itr_indice |
---|
| 41 | #ifdef ISO |
---|
| 42 | USE infotrac_phy, ONLY: itr_indice,niso,ntraciso |
---|
| 43 | #ifdef ISOVERIF |
---|
| 44 | USE isotopes_verif_mod |
---|
| 45 | #endif |
---|
| 46 | #endif |
---|
| 47 | USE carbon_cycle_mod, ONLY : carbon_cycle_cpl, co2_send |
---|
| 48 | USE indice_sol_mod, ONLY: nbsrf, is_oce, is_sic, is_ter, is_lic, epsfra |
---|
| 49 | USE surface_data, ONLY: type_ocean, version_ocean |
---|
| 50 | USE ocean_slab_mod, ONLY : nslay, tslab, seaice, tice, fsic |
---|
| 51 | USE time_phylmdz_mod, ONLY: annee_ref, day_end, itau_phy, pdtphys |
---|
[3940] | 52 | use config_ocean_skin_m, only: activate_ocean_skin |
---|
[3927] | 53 | |
---|
| 54 | IMPLICIT none |
---|
| 55 | |
---|
| 56 | include "dimsoil.h" |
---|
| 57 | include "clesphys.h" |
---|
| 58 | include "thermcell.h" |
---|
| 59 | include "compbl.h" |
---|
| 60 | !====================================================================== |
---|
| 61 | CHARACTER*(*) fichnom |
---|
| 62 | |
---|
| 63 | ! les variables globales ecrites dans le fichier restart |
---|
| 64 | |
---|
| 65 | REAL tsoil(klon, nsoilmx, nbsrf) |
---|
| 66 | REAL qsurf(klon, nbsrf) |
---|
| 67 | REAL snow(klon, nbsrf) |
---|
| 68 | real fder(klon) |
---|
| 69 | REAL run_off_lic_0(klon) |
---|
| 70 | REAL trs(klon, nbtr) |
---|
| 71 | #ifdef ISO |
---|
| 72 | REAL xtsnow(niso,klon, nbsrf) |
---|
| 73 | REAL xtrun_off_lic_0(niso,klon) |
---|
| 74 | REAL Rland_ice(niso,klon) |
---|
| 75 | #endif |
---|
| 76 | INTEGER iq ! C Risi |
---|
| 77 | |
---|
| 78 | INTEGER nid, nvarid, idim1, idim2, idim3 |
---|
| 79 | INTEGER ierr |
---|
| 80 | INTEGER length |
---|
| 81 | PARAMETER (length=100) |
---|
| 82 | REAL tab_cntrl(length) |
---|
| 83 | |
---|
| 84 | INTEGER isoil, nsrf,isw |
---|
| 85 | CHARACTER (len=2) :: str2 |
---|
| 86 | CHARACTER (len=256) :: nam, lnam |
---|
| 87 | INTEGER :: it, iiq, pass |
---|
| 88 | |
---|
| 89 | !====================================================================== |
---|
| 90 | |
---|
| 91 | ! Get variables which will be written to restart file from module |
---|
| 92 | ! pbl_surface_mod |
---|
| 93 | CALL pbl_surface_final(fder, snow, qsurf, tsoil & |
---|
| 94 | #ifdef ISO |
---|
| 95 | ,xtsnow,Rland_ice & |
---|
| 96 | #endif |
---|
| 97 | ) |
---|
| 98 | |
---|
| 99 | ! Get a variable calculated in module fonte_neige_mod |
---|
| 100 | CALL fonte_neige_final(run_off_lic_0 & |
---|
| 101 | #ifdef ISO |
---|
| 102 | ,xtrun_off_lic_0 & |
---|
| 103 | #endif |
---|
| 104 | ) |
---|
| 105 | |
---|
| 106 | !====================================================================== |
---|
| 107 | |
---|
| 108 | CALL open_restartphy(fichnom) |
---|
| 109 | |
---|
| 110 | |
---|
| 111 | DO ierr = 1, length |
---|
| 112 | tab_cntrl(ierr) = 0.0 |
---|
| 113 | ENDDO |
---|
| 114 | tab_cntrl(1) = pdtphys |
---|
| 115 | tab_cntrl(2) = radpas |
---|
| 116 | ! co2_ppm : current value of atmospheric CO2 |
---|
| 117 | tab_cntrl(3) = co2_ppm |
---|
| 118 | tab_cntrl(4) = solaire |
---|
| 119 | tab_cntrl(5) = iflag_con |
---|
| 120 | tab_cntrl(6) = nbapp_rad |
---|
| 121 | |
---|
| 122 | IF( iflag_cycle_diurne.GE.1 ) tab_cntrl( 7 ) = iflag_cycle_diurne |
---|
| 123 | IF( soil_model ) tab_cntrl( 8 ) = 1. |
---|
| 124 | IF( new_oliq ) tab_cntrl( 9 ) = 1. |
---|
| 125 | IF( ok_orodr ) tab_cntrl(10 ) = 1. |
---|
| 126 | IF( ok_orolf ) tab_cntrl(11 ) = 1. |
---|
| 127 | |
---|
| 128 | tab_cntrl(13) = day_end |
---|
| 129 | tab_cntrl(14) = annee_ref |
---|
| 130 | tab_cntrl(15) = itau_phy |
---|
| 131 | |
---|
| 132 | ! co2_ppm0 : initial value of atmospheric CO2 |
---|
| 133 | tab_cntrl(16) = co2_ppm0 |
---|
| 134 | |
---|
| 135 | DO pass=1,2 ! pass=1 netcdf definition ; pass=2 netcdf write |
---|
| 136 | |
---|
| 137 | CALL put_var(pass, "controle", "Parametres de controle", tab_cntrl) |
---|
| 138 | |
---|
| 139 | CALL put_field(pass,"longitude", & |
---|
| 140 | "Longitudes de la grille physique", longitude_deg) |
---|
| 141 | |
---|
| 142 | CALL put_field(pass,"latitude", "Latitudes de la grille physique", latitude_deg) |
---|
| 143 | |
---|
| 144 | ! PB ajout du masque terre/mer |
---|
| 145 | |
---|
| 146 | CALL put_field(pass,"masque", "masque terre mer", zmasq) |
---|
| 147 | |
---|
| 148 | ! BP ajout des fraction de chaque sous-surface |
---|
| 149 | |
---|
| 150 | ! Get last fractions from slab ocean |
---|
| 151 | IF (type_ocean == 'slab' .AND. version_ocean == "sicINT") THEN |
---|
| 152 | WHERE (1.-zmasq(:).GT.EPSFRA) |
---|
| 153 | pctsrf(:,is_oce)=(1.-fsic(:))*(1.-zmasq(:)) |
---|
| 154 | pctsrf(:,is_sic)=fsic(:)*(1.-zmasq(:)) |
---|
| 155 | END WHERE |
---|
| 156 | END IF |
---|
| 157 | |
---|
| 158 | ! 1. fraction de terre |
---|
| 159 | |
---|
| 160 | CALL put_field(pass,"FTER", "fraction de continent", pctsrf(:, is_ter)) |
---|
| 161 | |
---|
| 162 | ! 2. Fraction de glace de terre |
---|
| 163 | |
---|
| 164 | CALL put_field(pass,"FLIC", "fraction glace de terre", pctsrf(:, is_lic)) |
---|
| 165 | |
---|
| 166 | ! 3. fraction ocean |
---|
| 167 | |
---|
| 168 | CALL put_field(pass,"FOCE", "fraction ocean", pctsrf(:, is_oce)) |
---|
| 169 | |
---|
| 170 | ! 4. Fraction glace de mer |
---|
| 171 | |
---|
| 172 | CALL put_field(pass,"FSIC", "fraction glace mer", pctsrf(:, is_sic)) |
---|
| 173 | |
---|
| 174 | IF(nbsrf>99) THEN |
---|
| 175 | PRINT*, "Trop de sous-mailles"; CALL abort_physic("phyredem", "", 1) |
---|
| 176 | END IF |
---|
| 177 | IF(nsoilmx>99) THEN |
---|
| 178 | PRINT*, "Trop de sous-surfaces"; CALL abort_physic("phyredem", "", 1) |
---|
| 179 | END IF |
---|
| 180 | IF(nsw>99) THEN |
---|
| 181 | PRINT*, "Trop de bandes"; CALL abort_physic("phyredem", "", 1) |
---|
| 182 | END IF |
---|
| 183 | |
---|
[3940] | 184 | ! Surface variables |
---|
[3927] | 185 | CALL put_field_srf1(pass,"TS","Temperature",ftsol(:,:)) |
---|
| 186 | |
---|
[3940] | 187 | !! CALL put_field_srf1(pass,"DELTA_TS","w-x surface temperature difference", delta_tsurf(:,:)) |
---|
| 188 | CALL put_field_srf1(pass,"DELTATS","w-x surface temperature difference", delta_tsurf(:,:)) |
---|
| 189 | |
---|
| 190 | ! CALL put_field_srf1(pass,"BETA_S","Aridity factor", beta_aridity(:,:)) |
---|
| 191 | CALL put_field_srf1(pass,"BETAS","Aridity factor", beta_aridity(:,:)) |
---|
| 192 | ! End surface variables |
---|
| 193 | |
---|
[3927] | 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 | |
---|
[3940] | 223 | CALL put_field(pass,"solswfdiff", "Fraction du rayonnement solaire a la surface qui est diffus", solswfdiff) |
---|
| 224 | |
---|
[3927] | 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 | CALL put_field(pass,"PRWANCIEN", "PRWANCIEN", prw_ancien) |
---|
| 266 | |
---|
| 267 | CALL put_field(pass,"PRLWANCIEN", "PRLWANCIEN", prlw_ancien) |
---|
| 268 | |
---|
| 269 | CALL put_field(pass,"PRSWANCIEN", "PRSWANCIEN", prsw_ancien) |
---|
| 270 | |
---|
| 271 | CALL put_field(pass,"UANCIEN", "UANCIEN", u_ancien) |
---|
| 272 | |
---|
| 273 | CALL put_field(pass,"VANCIEN", "VANCIEN", v_ancien) |
---|
| 274 | |
---|
| 275 | CALL put_field(pass,"CLWCON", "Eau liquide convective", clwcon) |
---|
| 276 | |
---|
| 277 | CALL put_field(pass,"RNEBCON", "Nebulosite convective", rnebcon) |
---|
| 278 | |
---|
| 279 | CALL put_field(pass,"RATQS", "Ratqs", ratqs) |
---|
| 280 | |
---|
| 281 | ! run_off_lic_0 |
---|
| 282 | |
---|
| 283 | CALL put_field(pass,"RUNOFFLIC0", "Runofflic0", run_off_lic_0) |
---|
| 284 | |
---|
| 285 | ! DEB TKE PBL ! |
---|
| 286 | |
---|
| 287 | IF (iflag_pbl>1) then |
---|
| 288 | CALL put_field_srf3(pass,"TKE", "Energ. Cineti. Turb.", & |
---|
| 289 | pbl_tke(:,:,:)) |
---|
| 290 | CALL put_field_srf3(pass,"DELTATKE", "Del TKE wk/env.", & |
---|
| 291 | wake_delta_pbl_tke(:,:,:)) |
---|
| 292 | END IF |
---|
| 293 | |
---|
| 294 | ! FIN TKE PBL ! |
---|
| 295 | !IM ajout zmax0, f0, sig1, w01 |
---|
| 296 | !IM wake_deltat, wake_deltaq, wake_s, wake_cstar, wake_pe, wake_fip |
---|
| 297 | |
---|
| 298 | CALL put_field(pass,"ZMAX0", "ZMAX0", zmax0) |
---|
| 299 | |
---|
| 300 | CALL put_field(pass,"F0", "F0", f0) |
---|
| 301 | |
---|
| 302 | CALL put_field(pass,"sig1", "sig1 Emanuel", sig1) |
---|
| 303 | |
---|
| 304 | CALL put_field(pass,"w01", "w01 Emanuel", w01) |
---|
| 305 | |
---|
| 306 | ! wake_deltat |
---|
| 307 | CALL put_field(pass,"WAKE_DELTAT", "WAKE_DELTAT", wake_deltat) |
---|
| 308 | |
---|
| 309 | CALL put_field(pass,"WAKE_DELTAQ", "WAKE_DELTAQ", wake_deltaq) |
---|
| 310 | |
---|
| 311 | CALL put_field(pass,"WAKE_S", "Wake frac. area", wake_s) |
---|
| 312 | |
---|
| 313 | CALL put_field(pass,"WAKE_DENS", "Wake num. /unit area", wake_dens) |
---|
| 314 | |
---|
| 315 | CALL put_field(pass,"WAKE_CSTAR", "WAKE_CSTAR", wake_cstar) |
---|
| 316 | |
---|
| 317 | CALL put_field(pass,"WAKE_PE", "WAKE_PE", wake_pe) |
---|
| 318 | |
---|
| 319 | CALL put_field(pass,"WAKE_FIP", "WAKE_FIP", wake_fip) |
---|
| 320 | |
---|
| 321 | ! thermiques |
---|
| 322 | |
---|
| 323 | CALL put_field(pass,"FM_THERM", "FM_THERM", fm_therm) |
---|
| 324 | |
---|
| 325 | CALL put_field(pass,"ENTR_THERM", "ENTR_THERM", entr_therm) |
---|
| 326 | |
---|
| 327 | CALL put_field(pass,"DETR_THERM", "DETR_THERM", detr_therm) |
---|
| 328 | |
---|
| 329 | CALL put_field(pass,"ALE_BL", "ALE_BL", ale_bl) |
---|
| 330 | |
---|
| 331 | CALL put_field(pass,"ALE_BL_TRIG", "ALE_BL_TRIG", ale_bl_trig) |
---|
| 332 | |
---|
| 333 | CALL put_field(pass,"ALP_BL", "ALP_BL", alp_bl) |
---|
| 334 | |
---|
| 335 | CALL put_field(pass,"ALE_WAKE", "ALE_WAKE", ale_wake) |
---|
| 336 | |
---|
| 337 | CALL put_field(pass,"ALE_BL_STAT", "ALE_BL_STAT", ale_bl_stat) |
---|
| 338 | |
---|
| 339 | |
---|
[3940] | 340 | ! fisrtilp/clouds |
---|
| 341 | CALL put_field(pass,"RATQS_INTER","Relative width of the lsc sugrid scale water",ratqs_inter) |
---|
| 342 | |
---|
| 343 | |
---|
[3927] | 344 | ! trs from traclmdz_mod |
---|
| 345 | IF (type_trac == 'lmdz') THEN |
---|
| 346 | CALL traclmdz_to_restart(trs) |
---|
| 347 | DO it=1, nbtr |
---|
| 348 | !! iiq=niadv(it+2) ! jyg |
---|
| 349 | !iiq=niadv(it+nqo) ! C Risi: on efface pour remplacer: |
---|
| 350 | iq=itr_indice(it) ! jyg |
---|
| 351 | iiq=niadv(iq) ! jyg |
---|
| 352 | CALL put_field(pass,"trs_"//tname(iiq), "", trs(:, it)) |
---|
| 353 | END DO |
---|
| 354 | IF (carbon_cycle_cpl) THEN |
---|
| 355 | IF (.NOT. ALLOCATED(co2_send)) THEN |
---|
| 356 | ! This is the case of create_etat0_limit, ce0l |
---|
| 357 | ALLOCATE(co2_send(klon)) |
---|
| 358 | co2_send(:) = co2_ppm0 |
---|
| 359 | END IF |
---|
| 360 | CALL put_field(pass,"co2_send", "co2_ppm for coupling", co2_send) |
---|
| 361 | END IF |
---|
| 362 | END IF |
---|
| 363 | |
---|
| 364 | ! Restart variables for Slab ocean |
---|
| 365 | IF (type_ocean == 'slab') THEN |
---|
| 366 | IF (nslay.EQ.1) THEN |
---|
| 367 | CALL put_field(pass,"tslab", "Slab ocean temperature", tslab) |
---|
| 368 | ELSE |
---|
| 369 | DO it=1,nslay |
---|
| 370 | WRITE(str2,'(i2.2)') it |
---|
| 371 | CALL put_field(pass,"tslab"//str2, "Slab ocean temperature", tslab(:,it)) |
---|
| 372 | END DO |
---|
| 373 | END IF |
---|
| 374 | IF (version_ocean == 'sicINT') THEN |
---|
| 375 | CALL put_field(pass,"seaice", "Slab seaice (kg/m2)", seaice) |
---|
| 376 | CALL put_field(pass,"slab_tice", "Slab sea ice temperature", tice) |
---|
| 377 | END IF |
---|
| 378 | END IF |
---|
| 379 | |
---|
| 380 | if (ok_gwd_rando) call put_field(pass,"du_gwd_rando", & |
---|
| 381 | "tendency on zonal wind due to flott gravity waves", du_gwd_rando) |
---|
| 382 | |
---|
| 383 | IF (.not. ok_hines .and. ok_gwd_rando) call put_field(pass,"du_gwd_front", & |
---|
| 384 | "tendency on zonal wind due to acama gravity waves", du_gwd_front) |
---|
| 385 | |
---|
[3940] | 386 | if (activate_ocean_skin >= 1) then |
---|
| 387 | if (activate_ocean_skin == 2 .and. type_ocean == 'couple') then |
---|
| 388 | CALL put_field(pass, "delta_sal", & |
---|
| 389 | "ocean-air interface salinity minus bulk salinity", delta_sal) |
---|
| 390 | CALL put_field(pass, "delta_SST", & |
---|
| 391 | "ocean-air interface temperature minus bulk SST", delta_sst) |
---|
| 392 | end if |
---|
| 393 | |
---|
| 394 | CALL put_field(pass, "dS_ns", "delta salinity near surface", ds_ns) |
---|
| 395 | CALL put_field(pass, "dT_ns", "delta temperature near surface", dT_ns) |
---|
| 396 | end if |
---|
| 397 | |
---|
[3927] | 398 | #ifdef ISO |
---|
| 399 | write(*,*) 'phyredem 342' |
---|
| 400 | call phyisoredem (pass, & |
---|
| 401 | & xtsnow, & |
---|
| 402 | & xtrun_off_lic_0,Rland_ice, & |
---|
| 403 | & run_off_lic_0) |
---|
| 404 | #endif |
---|
| 405 | |
---|
| 406 | IF (pass==1) CALL enddef_restartphy |
---|
| 407 | IF (pass==2) CALL close_restartphy |
---|
| 408 | ENDDO ! DO pass=1,2 ! pass=1 netcdf definition ; pass=2 netcdf write |
---|
| 409 | |
---|
| 410 | |
---|
| 411 | |
---|
| 412 | !$OMP BARRIER |
---|
| 413 | |
---|
| 414 | |
---|
| 415 | CONTAINS |
---|
| 416 | |
---|
| 417 | |
---|
| 418 | SUBROUTINE put_field_srf1(pass,nam,lnam,field) |
---|
| 419 | |
---|
| 420 | IMPLICIT NONE |
---|
| 421 | INTEGER, INTENT(IN) :: pass |
---|
| 422 | CHARACTER(LEN=*), INTENT(IN) :: nam, lnam |
---|
| 423 | REAL, INTENT(IN) :: field(:,:) |
---|
| 424 | CHARACTER(LEN=256) :: nm, lm, str |
---|
| 425 | DO nsrf = 1, SIZE(field,2) |
---|
| 426 | WRITE(str, '(i2.2)') nsrf |
---|
| 427 | nm=TRIM(nam)//TRIM(str) |
---|
| 428 | lm=TRIM(lnam)//" de surface No. "//TRIM(str) |
---|
| 429 | CALL put_field(pass,nm,lm,field(:,nsrf)) |
---|
| 430 | END DO |
---|
| 431 | |
---|
| 432 | END SUBROUTINE put_field_srf1 |
---|
| 433 | |
---|
| 434 | |
---|
| 435 | SUBROUTINE put_field_srf2(pass,nam,lnam,field) |
---|
| 436 | |
---|
| 437 | IMPLICIT NONE |
---|
| 438 | INTEGER, INTENT(IN) :: pass |
---|
| 439 | CHARACTER(LEN=*), INTENT(IN) :: nam, lnam |
---|
| 440 | REAL, INTENT(IN) :: field(:,:,:) |
---|
| 441 | CHARACTER(LEN=256) :: nm, lm, str |
---|
| 442 | DO nsrf = 1, SIZE(field,3) |
---|
| 443 | DO isoil=1, SIZE(field,2) |
---|
| 444 | WRITE(str, '(i2.2,"srf",i2.2)')isoil,nsrf |
---|
| 445 | ! WRITE(lunout,*)"PHYREDEM ",TRIM(nam)//TRIM(str) |
---|
| 446 | nm=TRIM(nam)//TRIM(str) |
---|
| 447 | lm=TRIM(lnam)//" du sol No. "//TRIM(str) |
---|
| 448 | CALL put_field(pass,nm,lm,field(:,isoil,nsrf)) |
---|
| 449 | END DO |
---|
| 450 | END DO |
---|
| 451 | |
---|
| 452 | END SUBROUTINE put_field_srf2 |
---|
| 453 | |
---|
| 454 | |
---|
| 455 | SUBROUTINE put_field_srf3(pass,nam,lnam,field) |
---|
| 456 | |
---|
| 457 | IMPLICIT NONE |
---|
| 458 | INTEGER, INTENT(IN) :: pass |
---|
| 459 | CHARACTER(LEN=*), INTENT(IN) :: nam, lnam |
---|
| 460 | REAL, INTENT(IN) :: field(:,:,:) |
---|
| 461 | CHARACTER(LEN=256) :: nm, lm, str |
---|
| 462 | DO nsrf = 1, SIZE(field,3) |
---|
| 463 | WRITE(str, '(i2.2)') nsrf |
---|
| 464 | nm=TRIM(nam)//TRIM(str) |
---|
| 465 | lm=TRIM(lnam)//TRIM(str) |
---|
| 466 | CALL put_field(pass,nm,lm,field(:,1:klev+1,nsrf)) |
---|
| 467 | END DO |
---|
| 468 | |
---|
| 469 | END SUBROUTINE put_field_srf3 |
---|
| 470 | |
---|
| 471 | #ifdef ISO |
---|
| 472 | ! 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 |
---|
| 473 | |
---|
| 474 | SUBROUTINE phyisoredem (pass, & |
---|
| 475 | & xtsnow, & |
---|
| 476 | & xtrun_off_lic_0,Rland_ice, & |
---|
| 477 | & run_off_lic_0) |
---|
| 478 | USE dimphy |
---|
| 479 | !USE mod_grid_phy_lmdz |
---|
| 480 | !USE mod_phys_lmdz_para |
---|
| 481 | USE phys_state_var_mod, ONLY: q_ancien,xt_ancien,wake_deltaq,wake_deltaxt, & |
---|
| 482 | xtrain_fall,xtsnow_fall, ql_ancien,xtl_ancien,qs_ancien,xts_ancien, & |
---|
| 483 | xtsol,fxtevap |
---|
| 484 | USE infotrac_phy,ONLY: niso, ntraciso |
---|
| 485 | !USE control_mod |
---|
| 486 | USE indice_sol_mod, ONLY: nbsrf |
---|
| 487 | USE iostart, ONLY: put_field |
---|
| 488 | USE isotopes_mod, ONLY: striso,iso_eau |
---|
| 489 | #ifdef ISOVERIF |
---|
| 490 | USE isotopes_verif_mod |
---|
| 491 | #endif |
---|
| 492 | #ifdef ISOTRAC |
---|
| 493 | use isotrac_mod, only: index_zone,index_iso,strtrac |
---|
| 494 | #endif |
---|
| 495 | !USE phyredem, ONLY: put_field_srf1 |
---|
| 496 | |
---|
| 497 | implicit none |
---|
| 498 | |
---|
| 499 | ! equivalent isotopique de phyredem |
---|
| 500 | |
---|
| 501 | #include "dimsoil.h" |
---|
| 502 | #include "clesphys.h" |
---|
| 503 | #include "thermcell.h" |
---|
| 504 | #include "compbl.h" |
---|
| 505 | ! inputs |
---|
| 506 | !REAL xtsol(niso,klon) |
---|
| 507 | REAL xtsnow(niso,klon,nbsrf) |
---|
| 508 | !REAL xtevap(ntraciso,klon,nbsrf) |
---|
| 509 | REAL xtrun_off_lic_0(niso,klon) |
---|
| 510 | REAL Rland_ice(niso,klon) |
---|
| 511 | real run_off_lic_0(klon) |
---|
| 512 | integer, intent(in) :: pass |
---|
| 513 | |
---|
| 514 | ! locals |
---|
| 515 | real iso_tmp(klon) |
---|
| 516 | real iso_tmp_lonlev(klon,klev) |
---|
| 517 | real iso_tmp_lonsrf(klon,nbsrf) |
---|
| 518 | integer i,ixt,k,nsrf |
---|
| 519 | INTEGER nid, nvarid |
---|
| 520 | INTEGER ierr |
---|
| 521 | CHARACTER*7 str7 |
---|
| 522 | CHARACTER*2 str2 |
---|
| 523 | CHARACTER*50 striso_sortie |
---|
| 524 | integer lnblnk |
---|
| 525 | #ifdef ISOTRAC |
---|
| 526 | integer iiso,izone |
---|
| 527 | #endif |
---|
| 528 | |
---|
| 529 | write(*,*) 'phyisoredem 41: entrée' |
---|
| 530 | #ifdef ISOVERIF |
---|
| 531 | if (iso_eau.gt.0) then |
---|
| 532 | do k=1,klev |
---|
| 533 | do i=1,klon |
---|
| 534 | call iso_verif_egalite(xt_ancien(iso_eau,i,k),q_ancien(i,k), & |
---|
| 535 | & 'phyisoredem 50a') |
---|
| 536 | call iso_verif_egalite(xtl_ancien(iso_eau,i,k),ql_ancien(i,k), & |
---|
| 537 | & 'phyisoredem 50b') |
---|
| 538 | call iso_verif_egalite(xts_ancien(iso_eau,i,k),qs_ancien(i,k), & |
---|
| 539 | & 'phyisoredem 50c') |
---|
| 540 | |
---|
| 541 | enddo !do i=1,klon |
---|
| 542 | enddo !do k=1,klev |
---|
| 543 | do i=1,klon |
---|
| 544 | DO nsrf = 1, nbsrf |
---|
| 545 | call iso_verif_egalite(fxtevap(iso_eau,i,nsrf),fevap(i,nsrf), & |
---|
| 546 | & 'phyisoredem 50d') |
---|
| 547 | enddo !DO nsrf = 1, nbsrf |
---|
| 548 | enddo |
---|
| 549 | endif !if (iso_eau.gt.0) then |
---|
| 550 | do i=1,klon |
---|
| 551 | do ixt=1,niso |
---|
| 552 | call iso_verif_noNaN(xtsol(ixt,i),'phyisoredem 72') |
---|
| 553 | enddo !do ixt=1,niso |
---|
| 554 | enddo !do i=1,klon |
---|
| 555 | #ifdef ISOTRAC |
---|
| 556 | do k=1,klev |
---|
| 557 | do i=1,klon |
---|
| 558 | call iso_verif_traceur(xt_ancien(1,i,k), & |
---|
| 559 | & 'phyisoredem 60') |
---|
| 560 | enddo !do i=1,klon |
---|
| 561 | enddo !do k=1,kle |
---|
| 562 | #endif |
---|
| 563 | #endif |
---|
| 564 | |
---|
| 565 | do ixt=1,ntraciso |
---|
| 566 | |
---|
| 567 | if (ixt.le.niso) then |
---|
| 568 | striso_sortie=striso(ixt) |
---|
| 569 | else |
---|
| 570 | #ifdef ISOTRAC |
---|
| 571 | iiso=index_iso(ixt) |
---|
| 572 | izone=index_zone(ixt) |
---|
| 573 | striso_sortie=striso(iiso)//strtrac(izone) |
---|
| 574 | #else |
---|
| 575 | write(*,*) 'phyredem 546: ixt,ntraciso=', ixt,ntraciso |
---|
| 576 | stop |
---|
| 577 | #endif |
---|
| 578 | endif !if (ixt.le.niso) then |
---|
| 579 | write(*,*) 'phyredem 550: ixt,striso_sortie=',ixt,striso_sortie(1:lnblnk(striso_sortie)) |
---|
| 580 | |
---|
| 581 | iso_tmp_lonsrf(:,:)=fxtevap(ixt,:,:) |
---|
| 582 | CALL put_field_srf1(pass,"XTEVAP"//striso_sortie(1:lnblnk(striso_sortie)), & |
---|
| 583 | & "Evaporation de surface",iso_tmp_lonsrf) |
---|
| 584 | |
---|
| 585 | iso_tmp_lonsrf(:,:)=xtsnow(ixt,:,:) |
---|
| 586 | CALL put_field_srf1(pass,"XTSNOW"//striso_sortie(1:lnblnk(striso_sortie)), & |
---|
| 587 | & "NEIGE",iso_tmp_lonsrf) |
---|
| 588 | |
---|
| 589 | iso_tmp(:)=xtrain_fall(ixt,:) |
---|
| 590 | CALL put_field(pass,"xtrain_f"//striso_sortie(1:lnblnk(striso_sortie)), & |
---|
| 591 | & "precipitation liquide",iso_tmp) |
---|
| 592 | |
---|
| 593 | iso_tmp(:)=xtsnow_fall(ixt,:) |
---|
| 594 | CALL put_field(pass,"xtsnow_f"//striso_sortie(1:lnblnk(striso_sortie)), & |
---|
| 595 | & "precipitation solide",iso_tmp) |
---|
| 596 | |
---|
| 597 | iso_tmp_lonlev(:,:)=xt_ancien(ixt,:,:) |
---|
| 598 | CALL put_field(pass,"XTANCIEN"//striso_sortie(1:lnblnk(striso_sortie)), & |
---|
| 599 | & "QANCIEN",iso_tmp_lonlev) |
---|
| 600 | |
---|
| 601 | iso_tmp_lonlev(:,:)=xtl_ancien(ixt,:,:) |
---|
| 602 | CALL put_field(pass,"XTLANCIEN"//striso_sortie(1:lnblnk(striso_sortie)), & |
---|
| 603 | & "QLANCIEN",iso_tmp_lonlev) |
---|
| 604 | |
---|
| 605 | iso_tmp_lonlev(:,:)=xts_ancien(ixt,:,:) |
---|
| 606 | CALL put_field(pass,"XTSANCIEN"//striso_sortie(1:lnblnk(striso_sortie)), & |
---|
| 607 | & "QSANCIEN",iso_tmp_lonlev) |
---|
| 608 | |
---|
| 609 | iso_tmp_lonlev(:,:)=wake_deltaxt(ixt,:,:) |
---|
| 610 | CALL put_field(pass,"WAKE_DELTAXT"//striso_sortie(1:lnblnk(striso_sortie)), & |
---|
| 611 | & "WAKE_DELTAQ",iso_tmp_lonlev) |
---|
| 612 | |
---|
| 613 | iso_tmp(:)=xtrun_off_lic_0(ixt,:) |
---|
| 614 | CALL put_field(pass,"XTRUNOFFLIC0"//striso_sortie(1:lnblnk(striso_sortie)), & |
---|
| 615 | & "Runofflic0",iso_tmp) |
---|
| 616 | |
---|
| 617 | iso_tmp_lonlev(:,:)=wake_deltaxt(ixt,:,:) |
---|
| 618 | CALL put_field(pass,"WAKE_DELTAXT"//striso_sortie(1:lnblnk(striso_sortie)), & |
---|
| 619 | & "WAKE_DELTAXT",iso_tmp_lonlev) |
---|
| 620 | |
---|
| 621 | ! variables seulement pour niso: |
---|
| 622 | if (ixt.le.niso) then |
---|
| 623 | |
---|
| 624 | iso_tmp(:)=xtsol(ixt,:) |
---|
| 625 | CALL put_field(pass,"XTSOL"//striso_sortie(1:lnblnk(striso_sortie)), & |
---|
| 626 | & "Eau dans le sol (mm)",iso_tmp) |
---|
| 627 | |
---|
| 628 | iso_tmp(:)=Rland_ice(ixt,:) |
---|
| 629 | CALL put_field(pass,"Rland_ice"//striso_sortie(1:lnblnk(striso_sortie)), & |
---|
| 630 | & "ratio land ice",iso_tmp) |
---|
| 631 | |
---|
| 632 | endif ! if (ixt.le.niso) then |
---|
| 633 | |
---|
| 634 | enddo !do ixt=1,niso |
---|
| 635 | |
---|
| 636 | write(*,*) 'phyisoredem 261: sortie' |
---|
| 637 | END SUBROUTINE phyisoredem |
---|
| 638 | #endif |
---|
| 639 | |
---|
| 640 | END SUBROUTINE phyredem |
---|