Changeset 4180 for trunk/LMDZ.COMMON/libf/evolution/pem.F90
- Timestamp:
- Apr 10, 2026, 7:17:55 PM (6 hours ago)
- File:
-
- 1 edited
-
trunk/LMDZ.COMMON/libf/evolution/pem.F90 (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LMDZ.COMMON/libf/evolution/pem.F90
r4174 r4180 31 31 use clim_state_init, only: read_start, read_startfi, read_startevo 32 32 use config, only: read_rundef, read_display_config 33 use display, only: print_ini, print_end, print_msg, LVL_NFO, LVL_WRN33 use display, only: print_ini, print_end, print_msg, is_lvl_enabled, LVL_NFO, LVL_WRN, LVL_DBG 34 34 use evolution, only: n_yr_run, n_yr_sim, ntot_yr_sim, nmax_yr_run, dt, idt, r_plnt2earth_yr, pem_ini_date 35 35 use geometry, only: ngrid, nslope, nsoil_PCM, nsoil, cell_area, total_surface … … 38 38 use layered_deposits, only: do_layering, del_layering, evolve_layering, ptrarray, layering2surfice, surfice2layering, print_layering 39 39 use maths, only: pi 40 use numerics, only: dp, qp, di, li, k4, minieps, minieps_qp40 use numerics, only: dp, qp, di, li, k4, eps, eps_qp 41 41 use orbit, only: evo_orbit, read_orbitpm, compute_maxyr_orbit, update_orbit 42 42 use output, only: write_diagevo, dim_ngrid, dim_nsoil … … 233 233 if (do_layering) then 234 234 h2oice_depth_old(:,:) = h2oice_depth(:,:) 235 ! The sublimating tendency coming from subsurface ice is given through the surface ice tendency236 where (h2oice_depth(:,:) > 0. .and. flux_ssice_avg(:,:) < 0._dp) d_h2oice(:,:) = flux_ssice_avg(:,:)237 235 do islope = 1,nslope 238 236 do i = 1,ngrid 239 call evolve_layering(layerings_map(i,islope),d_co2ice(i,islope),d_h2oice(i,islope),new_str(i,islope),zshift_surf(i,islope),new_lag(i,islope),zlag(i,islope),current(i,islope)%p) 240 call print_layering(layerings_map(i,islope)) 237 call evolve_layering(layerings_map(i,islope),d_co2ice(i,islope),d_h2oice(i,islope),h2oice_depth(i,islope),flux_ssice_avg(i,islope), & 238 new_str(i,islope),zshift_surf(i,islope),new_lag(i,islope),zlag(i,islope),current(i,islope)%p,i,islope) 239 if (is_lvl_enabled(LVL_DBG)) call print_layering(layerings_map(i,islope)) 241 240 end do 242 241 end do … … 255 254 call evolve_h2oice(delta_h2o_ads,delta_icetable,h2o_ice,d_h2oice,zshift_surf,stopcrit) 256 255 call evolve_co2ice(co2_ice,d_co2ice,zshift_surf) 257 end if 258 259 ! Flow glaciers according to surface ice 260 if (co2ice_flow) then 261 allocate(is_co2ice_flow(ngrid,nslope)) 262 call flow_co2glaciers(q_co2_ts,ps_ts,ps_avg_glob_old,ps_avg_glob,co2_ice,is_co2ice_flow) 263 end if 264 if (h2oice_flow) then 265 allocate(is_h2oice_flow(ngrid,nslope)) 266 call flow_h2oglaciers(tsurf_avg,h2o_ice,is_h2oice_flow) 267 end if 268 if (do_layering) call surfice2layering(h2o_ice,co2_ice,layerings_map) 256 257 ! Flow glaciers according to surface ice 258 if (co2ice_flow) then 259 allocate(is_co2ice_flow(ngrid,nslope)) 260 call flow_co2glaciers(q_co2_ts,ps_ts,ps_avg_glob_old,ps_avg_glob,co2_ice,is_co2ice_flow) 261 end if 262 if (h2oice_flow) then 263 allocate(is_h2oice_flow(ngrid,nslope)) 264 call flow_h2oglaciers(tsurf_avg,h2o_ice,is_h2oice_flow) 265 end if 266 end if ! do_layering 269 267 270 268 ! Adapt surface temperature if surface ice disappeared … … 337 335 338 336 ! Checking mass balance for CO2 339 if (abs(CO2cond_ps_PCM - 1._dp) < minieps) then337 if (abs(CO2cond_ps_PCM - 1._dp) < eps) then 340 338 totmass_co2ice = 0._dp 341 339 totmass_atmco2 = 0._dp … … 346 344 end do 347 345 end do 348 totmass_ini = max(totmass_atmco2_ini + totmass_co2ice_ini + totmass_adsco2_ini, minieps_qp) ! To avoid division by 0346 totmass_ini = max(totmass_atmco2_ini + totmass_co2ice_ini + totmass_adsco2_ini,eps_qp) ! To avoid division by 0 349 347 call print_msg('> Relative total CO2 mass balance = '//real2str(100._qp*(totmass_atmco2 + totmass_co2ice + totmass_adsco2 - totmass_atmco2_ini - totmass_co2ice_ini - totmass_adsco2_ini)/totmass_ini)//' %',LVL_NFO) 350 348 if (abs((totmass_atmco2 + totmass_co2ice + totmass_adsco2 - totmass_atmco2_ini - totmass_co2ice_ini - totmass_adsco2_ini)/totmass_ini) > 0.01_qp) then 351 349 call print_msg('Mass balance is not conserved!',LVL_WRN) 352 totmass_ini = max(totmass_atmco2_ini, minieps_qp) ! To avoid division by 0350 totmass_ini = max(totmass_atmco2_ini,eps_qp) ! To avoid division by 0 353 351 call print_msg(' Atmospheric CO2 mass balance = '//real2str(100._qp*(totmass_atmco2 - totmass_atmco2_ini)/totmass_ini)//' %',LVL_WRN) 354 totmass_ini = max(totmass_co2ice_ini, minieps_qp) ! To avoid division by 0352 totmass_ini = max(totmass_co2ice_ini,eps_qp) ! To avoid division by 0 355 353 call print_msg(' CO2 ice mass balance = '//real2str(100._qp*(totmass_co2ice - totmass_co2ice_ini)/totmass_ini)//' %',LVL_WRN) 356 totmass_ini = max(totmass_adsco2_ini, minieps_qp) ! To avoid division by 0354 totmass_ini = max(totmass_adsco2_ini,eps_qp) ! To avoid division by 0 357 355 call print_msg(' Adsorbed CO2 mass balance = '//real2str(100._qp*(totmass_adsco2 - totmass_adsco2_ini)/totmass_ini)//' %',LVL_WRN) 358 356 end if … … 412 410 call update_workflow_status(n_yr_run,stopcrit%stop_code(),n_yr_sim,ntot_yr_sim) 413 411 414 ! Deallocation 415 if (do_layering) then 416 deallocate(h2oice_depth,h2oice_depth_old,new_str,new_lag,current) 417 do islope = 1,nslope 418 do i = 1,ngrid 419 call del_layering(layerings_map(i,islope)) 420 end do 421 end do 422 end if 412 ! Clean-up 413 if (do_layering) deallocate(h2oice_depth,h2oice_depth_old,new_str,new_lag,current) 423 414 call end_allocation() 424 415
Note: See TracChangeset
for help on using the changeset viewer.
