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