Changeset 3039 for trunk/LMDZ.COMMON/libf/evolution/pemetat0.F90
- Timestamp:
- Sep 11, 2023, 12:41:50 PM (15 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LMDZ.COMMON/libf/evolution/pemetat0.F90
r3019 r3039 1 1 SUBROUTINE pemetat0(filename,ngrid,nsoil_GCM,nsoil_PEM,nslope,timelen,timestep,TI_PEM,tsoil_PEM,ice_table, ice_table_thickness, & 2 2 tsurf_ave_yr1,tsurf_ave_yr2,q_co2,q_h2o,ps_inst,tsoil_inst,tend_h2oglaciers,tend_co2glaciers,co2ice,waterice, & 3 3 global_ave_pressure,watersurf_ave,watersoil_ave, m_co2_regolith_phys,deltam_co2_regolith_phys, & 4 4 m_h2o_regolith_phys,deltam_h2o_regolith_phys, water_reservoir) 5 5 6 use iostart_PEM, only: open_startphy, close_startphy, get_field, get_var 7 use comsoil_h_PEM, only: soil_pem,layer_PEM, mlayer_PEM,fluxgeo,inertiedat_PEM,water_reservoir_nom,depth_breccia,depth_bedrock,index_breccia,index_bedrock 8 use comsoil_h, only: volcapa,inertiedat 9 use adsorption_mod, only : regolith_adsorption,adsorption_pem 10 USE temps_mod_evol, ONLY: year_PEM 11 USE ice_table_mod, only: computeice_table_equilibrium 12 USE constants_marspem_mod,only: alpha_clap_h2o,beta_clap_h2o, & 13 TI_breccia,TI_bedrock 14 use soil_thermalproperties_mod, only: update_soil_thermalproperties 15 use tracer_mod, only: mmol,igcm_h2o_vap ! tracer names and molar masses 6 use iostart_PEM, only: open_startphy, close_startphy, get_field, get_var 7 use comsoil_h_PEM, only: soil_pem, layer_PEM, mlayer_PEM, fluxgeo, inertiedat_PEM, water_reservoir_nom, depth_breccia, depth_bedrock, index_breccia, index_bedrock 8 use comsoil_h, only: volcapa,inertiedat 9 use adsorption_mod, only: regolith_adsorption, adsorption_pem 10 use ice_table_mod, only: computeice_table_equilibrium 11 use constants_marspem_mod, only: alpha_clap_h2o, beta_clap_h2o, TI_breccia, TI_bedrock 12 use soil_thermalproperties_mod, only: update_soil_thermalproperties 13 use tracer_mod, only: mmol, igcm_h2o_vap ! tracer names and molar masses 16 14 17 15 #ifndef CPP_STD 18 USE comcstfi_h, only: r, mugaz 16 use comcstfi_h, only: r, mugaz 17 use surfdat_h, only: watercaptag 19 18 #else 20 USEcomcstfi_mod, only: r, mugaz19 use comcstfi_mod, only: r, mugaz 21 20 #endif 22 21 23 24 #ifndef CPP_STD25 use surfdat_h, only: watercaptag26 #endif27 28 22 implicit none 29 23 24 include "callkeys.h" 25 30 26 character(len=*), intent(in) :: filename ! name of the startfi_PEM.nc 31 27 integer,intent(in) :: ngrid ! # of physical grid points … … 73 69 real :: alph_tmp(ngrid,nsoil_PEM-1) ! Intermediate for tsoil computation [] 74 70 real :: beta_tmp(ngrid,nsoil_PEM-1) ! Intermediate for tsoil computatio [] 75 real :: year_PEM_read ! Year of the PEM previous run76 71 LOGICAL :: startpem_file ! boolean to check if we read the startfile or not 77 72 #ifdef CPP_STD … … 97 92 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 98 93 99 100 94 !0. Check if the start_PEM exist. 101 95 … … 110 104 call open_startphy(filename) 111 105 112 call get_var("Time",year_PEM_read,found) 113 year_PEM=INT(year_PEM_read) 114 if(.not.found) then 115 write(*,*)'PEMetat0: failed loading year_PEM; take default=0' 116 else 117 write(*,*)'year_PEM of startpem=', year_PEM 118 endif 119 120 if(soil_pem) then 106 if (soil_pem) then 121 107 122 108 !1. Thermal Inertia … … 161 147 ENDDO ! islope 162 148 163 print *,'PEMETAT0: THERMAL INERTIA DONE'149 write(*,*) 'PEMETAT0: THERMAL INERTIA DONE' 164 150 165 151 ! b. Special case for inertiedat, inertiedat_PEM … … 204 190 205 191 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 206 207 192 !2. Soil Temperature 208 209 193 DO islope=1,nslope 210 194 write(num,fmt='(i2.2)') islope … … 260 244 enddo 261 245 enddo 262 263 264 246 ENDDO ! islope 265 247 266 print *,'PEMETAT0: SOIL TEMP DONE' 267 268 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 269 248 write(*,*) 'PEMETAT0: SOIL TEMP DONE' 249 250 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 270 251 !3. Ice Table 271 272 273 252 call get_field("ice_table",ice_table,found) 274 253 if(.not.found) then … … 282 261 endif 283 262 284 print *,'PEMETAT0: ICE TABLE DONE' 285 286 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 287 263 write(*,*) 'PEMETAT0: ICE TABLE DONE' 264 265 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 288 266 !4. CO2 & H2O Adsorption 289 290 267 if(adsorption_pem) then 291 268 DO islope=1,nslope … … 318 295 deltam_h2o_regolith_phys(:) = 0. 319 296 endif 320 print *,'PEMETAT0: CO2 & H2O adsorption done'297 write(*,*) 'PEMETAT0: CO2 & H2O adsorption DONE' 321 298 endif 322 299 endif ! soil_pem 323 300 324 325 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 326 301 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 327 302 !. 5 water reservoir 328 329 303 #ifndef CPP_STD 330 304 call get_field("water_reservoir",water_reservoir,found) … … 342 316 #endif 343 317 344 345 318 call close_startphy 346 319 347 320 else !No startfi, let's build all by hand 348 321 349 year_PEM=0 350 351 if(soil_pem) then 322 if (soil_pem) then 352 323 353 324 !a) Thermal inertia … … 407 378 enddo 408 379 409 410 380 !!! zone de transition 411 381 delta = depth_bedrock … … 424 394 enddo 425 395 426 print *,'PEMETAT0: TI DONE' 427 428 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 429 430 396 write(*,*) 'PEMETAT0: TI DONE' 397 398 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 431 399 !b) Soil temperature 432 400 do islope = 1,nslope … … 458 426 enddo 459 427 enddo 460 461 do isoil = nsoil_GCM+1,nsoil_PEM 462 do ig = 1,ngrid 463 watersoil_ave(ig,isoil,islope) = exp(beta_clap_h2o/tsoil_PEM(ig,isoil,islope) + alpha_clap_h2o)/tsoil_PEM(ig,isoil,islope)*mmol(igcm_h2o_vap)/(mugaz*r) 428 429 do isoil = nsoil_GCM+1,nsoil_PEM 430 do ig = 1,ngrid 431 watersoil_ave(ig,isoil,islope) = exp(beta_clap_h2o/tsoil_PEM(ig,isoil,islope) + alpha_clap_h2o)/tsoil_PEM(ig,isoil,islope)*mmol(igcm_h2o_vap)/(mugaz*r) 432 enddo 464 433 enddo 465 enddo466 434 enddo !islope 467 print *,'PEMETAT0: TSOIL DONE ' 468 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 469 !c) Ice table 470 call computeice_table_equilibrium(ngrid,nslope,nsoil_PEM,watercaptag,watersurf_ave,watersoil_ave,TI_PEM(:,1,:),ice_table,ice_table_thickness) 471 call update_soil_thermalproperties(ngrid,nslope,nsoil_PEM,tend_h2oglaciers,waterice,global_ave_pressure,ice_table,ice_table_thickness,TI_PEM) 472 do islope = 1,nslope 473 call soil_pem_ini(ngrid,nsoil_PEM,TI_PEM(:,:,islope),tsurf_ave_yr2(:,islope),tsoil_PEM(:,:,islope)) 474 enddo 475 476 477 478 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 479 480 print *,'PEMETAT0: Ice table DONE ' 481 482 435 write(*,*) 'PEMETAT0: TSOIL DONE' 436 437 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 438 !c) Ice table 439 call computeice_table_equilibrium(ngrid,nslope,nsoil_PEM,watercaptag,watersurf_ave,watersoil_ave,TI_PEM(:,1,:),ice_table,ice_table_thickness) 440 call update_soil_thermalproperties(ngrid,nslope,nsoil_PEM,tend_h2oglaciers,waterice,global_ave_pressure,ice_table,ice_table_thickness,TI_PEM) 441 do islope = 1,nslope 442 call soil_pem_ini(ngrid,nsoil_PEM,TI_PEM(:,:,islope),tsurf_ave_yr2(:,islope),tsoil_PEM(:,:,islope)) 443 enddo 444 write(*,*) 'PEMETAT0: Ice table DONE' 483 445 484 446 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 485 447 !d) Regolith adsorbed 486 487 448 if(adsorption_pem) then 488 449 m_co2_regolith_phys(:,:,:) = 0. … … 496 457 endif 497 458 498 print *,'PEMETAT0: CO2 adsorption done ' 499 459 write(*,*) 'PEMETAT0: CO2 adsorption DONE' 500 460 endif !soil_pem 501 461 502 503 504 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 505 506 507 462 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 508 463 !. e) water reservoir 509 510 464 #ifndef CPP_STD 511 512 465 do ig=1,ngrid 513 466 if(watercaptag(ig)) then … … 517 470 endif 518 471 enddo 519 520 472 #endif 521 473 … … 527 479 DO islope = 1,nslope 528 480 DO iloop = 1,nsoil_PEM 529 if(isnan(tsoil_PEM(ig,iloop,islope))) then 530 call abort_pem("PEM - pemetat0","NAN detected in Tsoil",1) 531 endif 481 if (isnan(tsoil_PEM(ig,iloop,islope))) call abort_pem("PEM - pemetat0","NaN detected in Tsoil",1) 532 482 ENDDO 533 483 ENDDO … … 535 485 endif!soil_pem 536 486 537 538 539 END SUBROUTINE 487 END SUBROUTINE
Note: See TracChangeset
for help on using the changeset viewer.