Changeset 3778 for trunk/LMDZ.COMMON/libf
- Timestamp:
- May 26, 2025, 10:34:57 AM (3 weeks ago)
- Location:
- trunk/LMDZ.COMMON/libf/evolution
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LMDZ.COMMON/libf/evolution/changelog.txt
r3777 r3778 663 663 == 23/05/2025 == JBC 664 664 Big improvements of Python scripts to output the stratifications (user-friendly prompt, error checks, code modularity, nice visualization, etc). 665 666 == 26/05/2025 == JBC 667 - New subroutine to detect whether there is subsurface ice or not 668 - Rework of the initialization/update/finalization of the situation regarding the layering data structure 669 - Introduction of a threshold 'h_patchy_dust' under which the top dust layer is not considered as a stratum 670 - 'deposits' is renamed as 'layerings_map' 671 - Few cleanings -
trunk/LMDZ.COMMON/libf/evolution/layering_mod.F90
r3770 r3778 2 2 3 3 !======================================================================= 4 ! Purpose: Manage layered depositsin the PEM with a linked list data structure4 ! Purpose: Manage layered layerings_map in the PEM with a linked list data structure 5 5 ! 6 6 ! Author: JBC … … 19 19 20 20 ! Physical parameters 21 real, parameter :: d_dust = 5.78e-2 ! Tendency of dust [kg.m-2.y-1] 22 real, parameter :: dry_lag_porosity = 0.4 ! Porosity of dust lag 23 real, parameter :: dry_regolith_porosity = 0.4 ! Porosity of regolith 24 real, parameter :: breccia_porosity = 0.1 ! Porosity of breccia 25 real, parameter :: co2ice_porosity = 0. ! Porosity of CO2 ice 26 real, parameter :: h2oice_porosity = 0. ! Porosity of H2O ice 27 real, parameter :: rho_dust = 2500. ! Density of dust [kg.m-3] 28 real, parameter :: rho_rock = 3200. ! Density of rock [kg.m-3] 21 real, parameter :: d_dust = 5.78e-2 ! Tendency of dust [kg.m-2.y-1] 22 real, parameter :: dry_lag_porosity = 0.4 ! Porosity of dust lag 23 real, parameter :: dry_regolith_porosity = 0.4 ! Porosity of regolith 24 real, parameter :: breccia_porosity = 0.1 ! Porosity of breccia 25 real, parameter :: co2ice_porosity = 0. ! Porosity of CO2 ice 26 real, parameter :: h2oice_porosity = 0. ! Porosity of H2O ice 27 real, parameter :: rho_dust = 2500. ! Density of dust [kg.m-3] 28 real, parameter :: rho_rock = 3200. ! Density of rock [kg.m-3] 29 real, parameter :: h_patchy_dust = 0.05 ! Height under which a dust statum is considered patchy [m] 29 30 30 31 ! Lag layer parameters -> see Levrard et al. 2007 31 real, parameter :: hmin_lag = 0.5! Minimal height of the lag deposit to reduce the sublimation rate32 real, parameter :: hmin_lag = 0.5 ! Minimal height of the lag deposit to reduce the sublimation rate 32 33 real, parameter :: fred_subl = 0.1 ! Reduction factor of sublimation rate 33 34 … … 49 50 type(stratum), pointer :: bottom => null() ! First stratum (head of the list) 50 51 type(stratum), pointer :: top => null() ! Last stratum (tail of the list) 52 !real :: h_toplag ! Height of dust layer at the top [m] 53 !type(stratum), pointer :: subice => null() ! Shallower stratum containing ice 54 !type(stratum), pointer :: surf => null() ! Surface stratum 51 55 end type layering 52 56 … … 70 74 ! > stratif2array 71 75 ! > array2stratif 72 ! > print_ deposits76 ! > print_layerings_map 73 77 ! Procedures to get information about a stratum: 74 78 ! > thickness 79 ! > thickness_toplag 75 80 ! > is_co2ice_str 76 81 ! > is_h2oice_str 77 82 ! > is_dust_str 78 83 ! > is_dust_lag 79 ! > compute_h_toplag84 ! > subsurface_ice_layering 80 85 ! Procedures for the algorithm to evolve the layering: 81 86 ! > make_layering … … 118 123 allocate(str) 119 124 nullify(str%up,str%down) 120 str%top_elevation = 1.121 str%h_co2ice = 0.122 str%h_h2oice = 0.123 str%h_dust = 1.124 str%h_pore = 0.125 str%top_elevation = 1. 126 str%h_co2ice = 0. 127 str%h_h2oice = 0. 128 str%h_dust = 1. 129 str%h_pore = 0. 125 130 str%poreice_volfrac = 0. 126 if (present(top_elevation)) str%top_elevation = top_elevation127 if (present(co2ice)) str%h_co2ice= co2ice128 if (present(h2oice)) str%h_h2oice= h2oice129 if (present(dust)) str%h_dust= dust130 if (present(pore)) str%h_pore= pore131 if (present(poreice)) str%poreice_volfrac = poreice131 if (present(top_elevation)) str%top_elevation = top_elevation 132 if (present(co2ice)) str%h_co2ice = co2ice 133 if (present(h2oice)) str%h_h2oice = h2oice 134 if (present(dust)) str%h_dust = dust 135 if (present(pore)) str%h_pore = pore 136 if (present(poreice)) str%poreice_volfrac = poreice 132 137 133 138 ! Increment the number of strata … … 167 172 allocate(str) 168 173 nullify(str%up,str%down) 169 str%top_elevation = 1.170 str%h_co2ice = 0.171 str%h_h2oice = 0.172 str%h_dust = 1.173 str%h_pore = 0.174 str%top_elevation = 1. 175 str%h_co2ice = 0. 176 str%h_h2oice = 0. 177 str%h_dust = 1. 178 str%h_pore = 0. 174 179 str%poreice_volfrac = 0. 175 if (present(top_elevation)) str%top_elevation = top_elevation176 if (present(co2ice)) str%h_co2ice= co2ice177 if (present(h2oice)) str%h_h2oice= h2oice178 if (present(dust)) str%h_dust= dust179 if (present(pore)) str%h_pore= pore180 if (present(poreice)) str%poreice_volfrac = poreice180 if (present(top_elevation)) str%top_elevation = top_elevation 181 if (present(co2ice)) str%h_co2ice = co2ice 182 if (present(h2oice)) str%h_h2oice = h2oice 183 if (present(dust)) str%h_dust = dust 184 if (present(pore)) str%h_pore = pore 185 if (present(poreice)) str%poreice_volfrac = poreice 181 186 182 187 ! Increment the number of strata … … 353 358 !======================================================================= 354 359 ! To get the maximum number of "stratum" in the stratification (layerings) 355 FUNCTION get_nb_str_max( stratif,ngrid,nslope) RESULT(nb_str_max)356 357 implicit none 358 359 !---- Arguments 360 type(layering), dimension(ngrid,nslope), intent(in) :: stratif360 FUNCTION get_nb_str_max(layerings_map,ngrid,nslope) RESULT(nb_str_max) 361 362 implicit none 363 364 !---- Arguments 365 type(layering), dimension(ngrid,nslope), intent(in) :: layerings_map 361 366 integer, intent(in) :: ngrid, nslope 362 367 integer :: nb_str_max … … 369 374 do islope = 1,nslope 370 375 do ig = 1,ngrid 371 nb_str_max = max( stratif(ig,islope)%nb_str,nb_str_max)376 nb_str_max = max(layerings_map(ig,islope)%nb_str,nb_str_max) 372 377 enddo 373 378 enddo … … 376 381 377 382 !======================================================================= 378 ! To convert the stratification data structure (layerings)into an array able to be outputted379 SUBROUTINE stratif2array( stratif,ngrid,nslope,stratif_array)383 ! To convert the layerings map into an array able to be outputted 384 SUBROUTINE stratif2array(layerings_map,ngrid,nslope,stratif_array) 380 385 381 386 implicit none … … 383 388 !---- Arguments 384 389 integer, intent(in) :: ngrid, nslope 385 type(layering), dimension(ngrid,nslope), intent(in) :: stratif390 type(layering), dimension(ngrid,nslope), intent(in) :: layerings_map 386 391 real, dimension(:,:,:,:), allocatable, intent(inout) :: stratif_array 387 392 … … 394 399 do islope = 1,nslope 395 400 do ig = 1,ngrid 396 current => stratif(ig,islope)%bottom401 current => layerings_map(ig,islope)%bottom 397 402 k = 1 398 403 do while (associated(current)) … … 412 417 413 418 !======================================================================= 414 ! To convert the stratification array into the stratification data structure (layerings)415 SUBROUTINE array2stratif(stratif_array,ngrid,nslope, stratif)419 ! To convert the stratification array into the layerings map 420 SUBROUTINE array2stratif(stratif_array,ngrid,nslope,layerings_map) 416 421 417 422 implicit none … … 420 425 integer, intent(in) :: ngrid, nslope 421 426 real, dimension(:,:,:,:), allocatable, intent(in) :: stratif_array 422 type(layering), dimension(ngrid,nslope), intent(inout) :: stratif427 type(layering), dimension(ngrid,nslope), intent(inout) :: layerings_map 423 428 424 429 !---- Local variables … … 429 434 do ig = 1,ngrid 430 435 do k = 1,size(stratif_array,3) 431 call add_stratum( stratif(ig,islope),stratif_array(ig,islope,k,1),stratif_array(ig,islope,k,2),stratif_array(ig,islope,k,3),stratif_array(ig,islope,k,4),stratif_array(ig,islope,k,5),stratif_array(ig,islope,k,6))436 call add_stratum(layerings_map(ig,islope),stratif_array(ig,islope,k,1),stratif_array(ig,islope,k,2),stratif_array(ig,islope,k,3),stratif_array(ig,islope,k,4),stratif_array(ig,islope,k,5),stratif_array(ig,islope,k,6)) 432 437 enddo 433 438 enddo … … 437 442 438 443 !======================================================================= 439 ! To display deposits440 SUBROUTINE print_ deposits(this,ngrid,nslope)444 ! To display the map of layerings 445 SUBROUTINE print_layerings_map(this,ngrid,nslope) 441 446 442 447 implicit none … … 460 465 enddo 461 466 462 END SUBROUTINE print_ deposits467 END SUBROUTINE print_layerings_map 463 468 464 469 !======================================================================= … … 477 482 478 483 END FUNCTION thickness 479 480 !=======================================================================481 ! To know whether the stratum can be considered as a CO2 ice layer482 FUNCTION is_co2ice_str(str) RESULT(co2ice_str)483 484 implicit none485 486 !---- Arguments487 type(stratum), intent(in) :: str488 logical :: co2ice_str489 490 !---- Code491 co2ice_str = .false.492 if (str%h_co2ice > str%h_h2oice .and. str%h_co2ice > str%h_dust) co2ice_str = .true.493 494 END FUNCTION is_co2ice_str495 496 !=======================================================================497 ! To know whether the stratum can be considered as a H2O ice layer498 FUNCTION is_h2oice_str(str) RESULT(h2oice_str)499 500 implicit none501 502 !---- Arguments503 type(stratum), intent(in) :: str504 logical :: h2oice_str505 506 !---- Code507 h2oice_str = .false.508 if (str%h_h2oice > str%h_co2ice .and. str%h_h2oice > str%h_dust) h2oice_str = .true.509 510 END FUNCTION is_h2oice_str511 512 !=======================================================================513 ! To know whether the stratum can be considered as a dust layer514 FUNCTION is_dust_str(str) RESULT(dust_str)515 516 implicit none517 518 !---- Arguments519 type(stratum), intent(in) :: str520 logical :: dust_str521 522 !---- Code523 dust_str = .false.524 if (str%h_dust > str%h_co2ice .and. str%h_dust > str%h_h2oice) dust_str = .true.525 526 END FUNCTION is_dust_str527 528 !=======================================================================529 ! To know whether the stratum can be considered as a dust lag530 FUNCTION is_dust_lag(str) RESULT(dust_lag)531 532 implicit none533 534 !---- Arguments535 type(stratum), intent(in) :: str536 logical :: dust_lag537 538 !---- Code539 dust_lag = .false.540 if (str%h_co2ice < tol .and. str%h_h2oice < tol .and. str%poreice_volfrac < tol) dust_lag = .true.541 542 END FUNCTION is_dust_lag543 484 544 485 !======================================================================= … … 559 500 current => this%top 560 501 ! Is the considered stratum a dust lag? 561 do while ( current%h_co2ice < tol .and. current%h_h2oice < tol .and. current%poreice_volfrac < tol.and. associated(current))502 do while (is_dust_lag(current) .and. associated(current)) 562 503 h_toplag = h_toplag + thickness(current) 563 504 current => current%down … … 565 506 566 507 END FUNCTION thickness_toplag 508 509 !======================================================================= 510 ! To know whether the stratum can be considered as a CO2 ice layer 511 FUNCTION is_co2ice_str(str) RESULT(co2ice_str) 512 513 implicit none 514 515 !---- Arguments 516 type(stratum), intent(in) :: str 517 logical :: co2ice_str 518 519 !---- Code 520 co2ice_str = .false. 521 if (str%h_co2ice > str%h_h2oice .and. str%h_co2ice > str%h_dust) co2ice_str = .true. 522 523 END FUNCTION is_co2ice_str 524 525 !======================================================================= 526 ! To know whether the stratum can be considered as a H2O ice layer 527 FUNCTION is_h2oice_str(str) RESULT(h2oice_str) 528 529 implicit none 530 531 !---- Arguments 532 type(stratum), intent(in) :: str 533 logical :: h2oice_str 534 535 !---- Code 536 h2oice_str = .false. 537 if (str%h_h2oice > str%h_co2ice .and. str%h_h2oice > str%h_dust) h2oice_str = .true. 538 539 END FUNCTION is_h2oice_str 540 541 !======================================================================= 542 ! To know whether the stratum can be considered as a dust layer 543 FUNCTION is_dust_str(str) RESULT(dust_str) 544 545 implicit none 546 547 !---- Arguments 548 type(stratum), intent(in) :: str 549 logical :: dust_str 550 551 !---- Code 552 dust_str = .false. 553 if (str%h_dust > str%h_co2ice .and. str%h_dust > str%h_h2oice) dust_str = .true. 554 555 END FUNCTION is_dust_str 556 557 !======================================================================= 558 ! To know whether the stratum can be considered as a dust lag 559 FUNCTION is_dust_lag(str) RESULT(dust_lag) 560 561 implicit none 562 563 !---- Arguments 564 type(stratum), intent(in) :: str 565 logical :: dust_lag 566 567 !---- Code 568 dust_lag = .false. 569 if (str%h_co2ice < tol .and. str%h_h2oice < tol .and. str%poreice_volfrac < tol) dust_lag = .true. 570 571 END FUNCTION is_dust_lag 572 573 !======================================================================= 574 ! To get data about possible subsurface ice in a layering 575 SUBROUTINE subsurface_ice_layering(this,is_subsurface_ice,h_toplag,h2o_ice) 576 577 implicit none 578 579 !---- Arguments 580 type(layering), intent(in) :: this 581 logical, intent(out) :: is_subsurface_ice 582 real, intent(out) :: h2o_ice, h_toplag 583 584 !---- Local variables 585 type(stratum), pointer :: current 586 587 !---- Code 588 h_toplag = 0. 589 h2o_ice = 0. 590 is_subsurface_ice = .false. 591 current => this%top 592 ! Is the considered stratum a dust lag? 593 if (is_dust_lag(current)) return 594 do while (is_dust_lag(current) .and. associated(current)) 595 h_toplag = h_toplag + thickness(current) 596 current => current%down 597 enddo 598 ! Is the stratum below the dust lag made of ice? 599 if (is_h2oice_str(current)) then 600 if (h_toplag >= h_patchy_dust) then 601 is_subsurface_ice = .true. 602 else 603 h_toplag = 0. 604 h2o_ice = current%h_h2oice 605 endif 606 endif 607 608 END SUBROUTINE subsurface_ice_layering 567 609 568 610 !======================================================================= … … 597 639 zlag = 0. 598 640 641 ! NOTHING HAPPENS 642 if (abs(dh_co2ice) < tol .and. abs(dh_h2oice) < tol .and. abs(dh_dust) < tol) then 643 ! So we do nothing 644 !----------------------------------------------------------------------- 599 645 ! DUST SEDIMENTATION with possibly ice condensation 600 if (dh_dust > dh_co2ice .and. dh_dust > dh_h2oice .and. dh_co2ice >= 0. .and. dh_h2oice >= 0.) then646 else if (dh_dust > dh_co2ice .and. dh_dust > dh_h2oice .and. dh_co2ice >= 0. .and. dh_h2oice >= 0.) then 601 647 write(*,*) '> Layering: dust sedimentation' 602 648 h_pore = dh_dust*dry_regolith_porosity/(1. - dry_regolith_porosity) … … 608 654 else 609 655 this%top%top_elevation = this%top%top_elevation + h_tot 610 this%top%h_co2ice = this%top%h_co2ice+ dh_co2ice611 this%top%h_h2oice = this%top%h_h2oice+ dh_h2oice612 this%top%h_dust = this%top%h_dust+ dh_dust613 this%top%h_pore = this%top%h_pore+ h_pore656 this%top%h_co2ice = this%top%h_co2ice + dh_co2ice 657 this%top%h_h2oice = this%top%h_h2oice + dh_h2oice 658 this%top%h_dust = this%top%h_dust + dh_dust 659 this%top%h_pore = this%top%h_pore + h_pore 614 660 endif 615 661 !----------------------------------------------------------------------- 616 ! DUST LIFTING 617 !(with possibly ice sublimation???) 662 ! DUST LIFTING with possibly ice sublimation 618 663 !else if (dh_dust < dh_co2ice .and. dh_dust < dh_h2oice .and. dh_co2ice <= 0. .and. dh_h2oice <= 0.) then 619 664 else if (dh_dust < 0. .and. abs(dh_co2ice) < eps .and. abs(dh_h2oice) < eps) then … … 651 696 else 652 697 this%top%top_elevation = this%top%top_elevation + h_tot 653 this%top%h_co2ice = this%top%h_co2ice+ dh_co2ice654 this%top%h_h2oice = this%top%h_h2oice+ dh_h2oice655 this%top%h_dust = this%top%h_dust+ dh_dust656 this%top%h_pore = this%top%h_pore+ h_pore698 this%top%h_co2ice = this%top%h_co2ice + dh_co2ice 699 this%top%h_h2oice = this%top%h_h2oice + dh_h2oice 700 this%top%h_dust = this%top%h_dust + dh_dust 701 this%top%h_pore = this%top%h_pore + h_pore 657 702 endif 658 703 !----------------------------------------------------------------------- … … 710 755 711 756 !----------------------------------------------------------------------- 712 ! NOTHING HAPPENS713 else if (abs(dh_co2ice) < tol .and. abs(dh_h2oice) < tol .and. abs(dh_dust) < tol) then714 ! We do nothing715 !-----------------------------------------------------------------------716 757 ! UNUSUAL (WEIRD) SITUATION 717 758 else … … 741 782 ! Update of properties in the eroding dust lag 742 783 str%top_elevation = str%top_elevation - h2lift*(1. + str%h_pore/str%h_dust) 743 str%h_pore = str%h_pore- h2lift*str%h_pore/str%h_dust744 str%h_dust = str%h_dust- h2lift784 str%h_pore = str%h_pore - h2lift*str%h_pore/str%h_dust 785 str%h_dust = str%h_dust - h2lift 745 786 746 787 ! Remove the eroding dust lag if there is no dust anymore … … 775 816 ! Update of properties in the sublimating stratum 776 817 str%top_elevation = str%top_elevation - h2subl*(1. + h_pore/h_ice) - hsubl_dust 777 str%h_co2ice = str%h_co2ice- h2subl_co2ice778 str%h_h2oice = str%h_h2oice- h2subl_h2oice779 str%h_dust = str%h_dust- hsubl_dust780 str%h_pore = str%h_pore- h2subl*h_pore/h_ice818 str%h_co2ice = str%h_co2ice - h2subl_co2ice 819 str%h_h2oice = str%h_h2oice - h2subl_h2oice 820 str%h_dust = str%h_dust - hsubl_dust 821 str%h_pore = str%h_pore - h2subl*h_pore/h_ice 781 822 782 823 ! Correct the value of top_elevation for the upper strata -
trunk/LMDZ.COMMON/libf/evolution/pem.F90
r3770 r3778 69 69 use writediagpem_mod, only: writediagpem, writediagsoilpem 70 70 use co2condens_mod, only: CO2cond_ps 71 use layering_mod, only: ptrarray, stratum, layering, del_layering, make_layering, get_nb_str_max, & 72 nb_str_max, layering_algo, thickness_toplag, is_dust_lag, is_h2oice_str 71 use layering_mod, only: ptrarray, stratum, layering, del_layering, make_layering, layering_algo, & 72 get_nb_str_max, nb_str_max, thickness_toplag, subsurface_ice_layering, & 73 is_dust_lag, is_co2ice_str, is_h2oice_str 73 74 use dyn_ss_ice_m_mod, only: dyn_ss_ice_m 74 75 use version_info_mod, only: print_version_info … … 163 164 real :: total_surface ! Total surface of the planet 164 165 165 ! Variables for h2o _ice evolution166 ! Variables for h2o ice evolution 166 167 real, dimension(:,:), allocatable :: h2o_ice ! h2o ice in the PEM 167 168 real, dimension(:,:), allocatable :: d_h2oice ! physical point x slope field: Tendency of evolution of perennial h2o ice … … 182 183 real :: extra_mass ! Intermediate variables Extra mass of a tracer if it is greater than 1 183 184 184 ! Variables for co2 _ice evolution185 ! Variables for co2 ice evolution 185 186 real, dimension(:,:), allocatable :: co2_ice ! co2 ice in the PEM 186 187 real, dimension(:,:), allocatable :: d_co2ice ! physical point x slope field: Tendency of evolution of perennial co2 ice over a year … … 194 195 real, dimension(:,:), allocatable :: q_co2_PEM_phys ! Grid points x Times co2 mass mixing ratio in the first layer computed in the PEM, first value comes from PCM [kg/kg] 195 196 196 ! Variables for the evolution of layered deposits197 type(layering), dimension(:,:), allocatable :: deposits! Layering for each grid point and slope197 ! Variables for the evolution of layered layerings_map 198 type(layering), dimension(:,:), allocatable :: layerings_map ! Layering for each grid point and slope 198 199 type(ptrarray), dimension(:,:), allocatable :: current ! Current active stratum in the layering 199 200 logical, dimension(:,:), allocatable :: new_str, new_lag ! Flags for the layering algorithm 200 201 real :: h2o_ice_depth_old ! Old depth of subsurface ice layer 202 logical :: is_subsurface_ice ! Boolean to know if there is subsurface ice 201 203 202 204 ! Variables for slopes … … 645 647 !------------------------ 646 648 write(*,*) '> Reading "startpem.nc"' 647 allocate(co2_ice(ngrid,nslope),h2o_ice(ngrid,nslope), deposits(ngrid,nslope))649 allocate(co2_ice(ngrid,nslope),h2o_ice(ngrid,nslope),layerings_map(ngrid,nslope)) 648 650 allocate(delta_h2o_adsorbed(ngrid),delta_co2_adsorbed(ngrid),delta_h2o_icetablesublim(ngrid)) 649 651 delta_h2o_icetablesublim = 0. 650 652 call pemetat0("startpem.nc",ngrid,nsoilmx,nsoilmx_PEM,nslope,timelen,timestep,TI_PEM,tsoil_PEM,icetable_depth,icetable_thickness,ice_porefilling, & 651 653 tsurf_avg_yr1,tsurf_avg,q_co2_PEM_phys,q_h2o_PEM_phys,ps_timeseries,ps_avg_global_ini,d_h2oice,d_co2ice,co2_ice,h2o_ice, & 652 watersurf_density_avg,watersoil_density_PEM_avg,co2_adsorbed_phys,delta_co2_adsorbed,h2o_adsorbed_phys,delta_h2o_adsorbed, deposits)654 watersurf_density_avg,watersoil_density_PEM_avg,co2_adsorbed_phys,delta_co2_adsorbed,h2o_adsorbed_phys,delta_h2o_adsorbed,layerings_map) 653 655 deallocate(tsurf_avg_yr1) 654 656 … … 658 660 co2ice_sublim_surf_ini = 0. 659 661 h2oice_ini_surf = 0. 660 h2o_ice_depth = 0.661 662 is_co2ice_sublim_ini = .false. 662 663 is_h2oice_sublim_ini = .false. … … 666 667 do ig = 1,ngrid 667 668 do islope = 1,nslope 668 co2_ice(ig,islope) = deposits(ig,islope)%top%h_co2ice669 h2o_ice(ig,islope) = deposits(ig,islope)%top%h_h2oice669 co2_ice(ig,islope) = layerings_map(ig,islope)%top%h_co2ice 670 h2o_ice(ig,islope) = layerings_map(ig,islope)%top%h_h2oice 670 671 enddo 671 672 enddo … … 681 682 is_h2oice_sublim_ini(i,islope) = .true. 682 683 h2oice_ini_surf = h2oice_ini_surf + cell_area(i)*subslope_dist(i,islope) 683 if (layering_algo) h2o_ice_depth(ig,islope) = thickness_toplag(deposits(ig,islope))684 684 endif 685 685 enddo … … 687 687 write(*,*) "Total initial surface of CO2 ice sublimating =", co2ice_sublim_surf_ini 688 688 write(*,*) "Total initial surface of H2O ice sublimating =", h2oice_ini_surf 689 690 ! We put the sublimating tendency coming from subsurface ice 691 where (zdqsdif_ssi_tot > 0.) 692 d_h2oice = -zdqsdif_ssi_tot 693 end where 689 694 690 695 if (adsorption_pem) then … … 742 747 do islope = 1,nslope 743 748 do ig = 1,ngrid 744 current(ig,islope)%p => deposits(ig,islope)%top749 current(ig,islope)%p => layerings_map(ig,islope)%top 745 750 enddo 746 751 enddo … … 822 827 do islope = 1,nslope 823 828 do ig = 1,ngrid 824 call make_layering(deposits(ig,islope),d_co2ice(ig,islope),d_h2oice(ig,islope),new_str(ig,islope),zshift_surf(ig,islope),new_lag(ig,islope),zlag(ig,islope),current(ig,islope)%p) 825 co2_ice(ig,islope) = deposits(ig,islope)%top%h_co2ice 826 h2o_ice(ig,islope) = deposits(ig,islope)%top%h_h2oice 829 call make_layering(layerings_map(ig,islope),d_co2ice(ig,islope),d_h2oice(ig,islope),new_str(ig,islope),zshift_surf(ig,islope),new_lag(ig,islope),zlag(ig,islope),current(ig,islope)%p) 830 co2_ice = 0. 831 h2o_ice = 0. 832 h2o_ice_depth = 0. 833 if (is_co2ice_str(layerings_map(ig,islope)%top)) then 834 co2_ice(ig,islope) = layerings_map(ig,islope)%top%h_co2ice 835 else if (is_h2oice_str(layerings_map(ig,islope)%top)) then 836 h2o_ice(ig,islope) = layerings_map(ig,islope)%top%h_h2oice 837 else 838 call subsurface_ice_layering(layerings_map(ig,islope),is_subsurface_ice,h2o_ice_depth(ig,islope),h2o_ice(ig,islope)) 839 endif 827 840 enddo 828 841 enddo … … 844 857 do islope = 1,nslope 845 858 do ig = 1,ngrid 846 deposits(ig,islope)%top%h_co2ice = co2_ice(ig,islope)847 deposits(ig,islope)%top%h_h2oice = h2o_ice(ig,islope)859 layerings_map(ig,islope)%top%h_co2ice = co2_ice(ig,islope) 860 layerings_map(ig,islope)%top%h_h2oice = h2o_ice(ig,islope) 848 861 enddo 849 862 enddo … … 1028 1041 if (is_h2oice_sublim_ini(ig,islope)) then 1029 1042 h2o_ice_depth_old = h2o_ice_depth(ig,islope) 1030 h2o_ice_depth(ig,islope) = thickness_toplag( deposits(ig,islope))1043 h2o_ice_depth(ig,islope) = thickness_toplag(layerings_map(ig,islope)) 1031 1044 call recomp_tend_h2o(h2o_ice_depth_old,h2o_ice_depth(ig,islope),tsurf_avg(ig,islope),tsoil_PEM_timeseries_old(ig,:,islope,:),tsoil_PEM_timeseries(ig,:,islope,:),d_h2oice(ig,islope)) 1032 1045 endif … … 1097 1110 ! III_a Update surface values for the PCM start files 1098 1111 !------------------------ 1099 ! III_a.1 Ice update for start file1100 1112 write(*,*) 1101 1113 write(*,*) '********* PEM finalization *********' 1114 ! III_a.1 Ice update for start file 1102 1115 write(*,*) '> Reconstructing perennial ice and frost for the PCM' 1103 1116 watercap = 0. … … 1127 1140 !endif 1128 1141 enddo 1129 1130 ! III_a.2 Subsurface-surface interaction update for start file1131 zdqsdif_ssi_tot = 0.1132 h2o_ice_depth = 0.1133 if (layering_algo) then1134 write(*,*) '> Reconstructing ice sublimation flux from subsurface to surface for the PCM'1135 do ig = 1,ngrid1136 do islope = 1,nslope1137 if (is_dust_lag(deposits(ig,islope)%top) .and. is_h2oice_str(deposits(ig,islope)%top%down)) then1138 zdqsdif_ssi_tot(ig,islope) = d_h2oice(ig,islope)1139 h2o_ice_depth(ig,islope) = thickness_toplag(deposits(ig,islope))1140 endif1141 enddo1142 enddo1143 endif1144 1142 1145 1143 ! III.a.3. Tsurf update for start file … … 1313 1311 !------------------------ 1314 1312 write(*,*) '> Writing "restartpem.nc"' 1315 if (layering_algo) nb_str_max = get_nb_str_max( deposits,ngrid,nslope) ! Get the maximum number of "stratum" in the depositsication (layerings)1313 if (layering_algo) nb_str_max = get_nb_str_max(layerings_map,ngrid,nslope) ! Get the maximum number of "stratum" in the layerings_mapication (layerings) 1316 1314 call pemdem0("restartpem.nc",longitude,latitude,cell_area,ngrid,nslope,def_slope,subslope_dist) 1317 1315 call pemdem1("restartpem.nc",i_myear,nsoilmx_PEM,ngrid,nslope,tsoil_PEM,TI_PEM,icetable_depth,icetable_thickness,ice_porefilling, & 1318 co2_adsorbed_phys,h2o_adsorbed_phys,h2o_ice, deposits)1316 co2_adsorbed_phys,h2o_adsorbed_phys,h2o_ice,layerings_map) 1319 1317 1320 1318 call info_PEM(i_myear_leg,stopPEM,i_myear,n_myear) … … 1331 1329 do islope = 1,nslope 1332 1330 do i = 1,ngrid 1333 call del_layering( deposits(i,islope))1331 call del_layering(layerings_map(i,islope)) 1334 1332 enddo 1335 1333 enddo 1336 1334 endif 1337 1335 deallocate(q,longitude,latitude,cell_area,tsoil_PEM) 1338 deallocate(co2_ice,h2o_ice, deposits)1336 deallocate(co2_ice,h2o_ice,layerings_map) 1339 1337 !----------------------------- END OUTPUT ------------------------------ 1340 1338 -
trunk/LMDZ.COMMON/libf/evolution/pemetat0.F90
r3770 r3778 9 9 SUBROUTINE pemetat0(filename,ngrid,nsoil_PCM,nsoil_PEM,nslope,timelen,timestep,TI_PEM,tsoil_PEM,icetable_depth,icetable_thickness,ice_porefilling, & 10 10 tsurf_avg_yr1,tsurf_avg_yr2,q_co2,q_h2o,ps_timeseries,ps_avg_global,d_h2oice,d_co2ice,co2_ice,h2o_ice, & 11 watersurf_avg,watersoil_avg,m_co2_regolith_phys,deltam_co2_regolith_phys,m_h2o_regolith_phys,deltam_h2o_regolith_phys, stratif)11 watersurf_avg,watersoil_avg,m_co2_regolith_phys,deltam_co2_regolith_phys,m_h2o_regolith_phys,deltam_h2o_regolith_phys,layerings_map) 12 12 13 13 use iostart_PEM, only: open_startphy, close_startphy, get_field, get_var, inquire_dimension, inquire_dimension_length … … 54 54 real, dimension(ngrid,nslope), intent(out) :: h2o_ice ! h2o ice amount [kg/m^2] 55 55 real, dimension(ngrid,nslope), intent(out) :: co2_ice ! co2 ice amount [kg/m^2] 56 type(layering), dimension(ngrid,nslope), intent(inout) :: stratif ! stratification (layerings)56 type(layering), dimension(ngrid,nslope), intent(inout) :: layerings_map ! Layerings 57 57 real, dimension(ngrid,nsoil_PEM,nslope), intent(inout) :: TI_PEM ! soil (mid-layer) thermal inertia in the PEM grid [SI] 58 58 real, dimension(ngrid,nsoil_PEM,nslope), intent(inout) :: tsoil_PEM ! soil (mid-layer) temperature [K] … … 71 71 character(2) :: num ! intermediate string to read PEM start sloped variables 72 72 logical :: startpem_file ! boolean to check if we read the startfile or not 73 real, dimension(:,:,:,:), allocatable :: stratif_array ! Array for stratification (layerings)73 real, dimension(:,:,:,:), allocatable :: stratif_array ! Array for layerings 74 74 75 75 #ifdef CPP_STD … … 132 132 133 133 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 134 ! Stratification (layerings)134 ! Layerings 135 135 nb_str_max = 68 136 136 if (layering_algo) then … … 178 178 enddo ! islope 179 179 if (.not. found) then 180 write(*,*) 'So the deposits are initialized with sub-surface strata.'180 write(*,*) 'So the layerings are initialized with sub-surface strata.' 181 181 write(*,*) 'Ice is added with ''ini_huge_h2oice'' where ''watercaptag'' is true and otherwise with ''perennial_co2ice'' found in the PCM.' 182 182 do ig = 1,ngrid 183 183 if (watercaptag(ig)) then 184 184 do islope = 1,nslope 185 call ini_layering( stratif(ig,islope))186 call add_stratum( stratif(ig,islope),ini_huge_h2oice,0.,ini_huge_h2oice,0.,0.,0.)185 call ini_layering(layerings_map(ig,islope)) 186 call add_stratum(layerings_map(ig,islope),ini_huge_h2oice,0.,ini_huge_h2oice,0.,0.,0.) 187 187 enddo 188 188 else 189 189 do islope = 1,nslope 190 call ini_layering( stratif(ig,islope))191 if (perennial_co2ice(ig,islope) > 0.) call add_stratum( stratif(ig,islope),perennial_co2ice(ig,islope),perennial_co2ice(ig,islope),0.,0.,0.,0.)190 call ini_layering(layerings_map(ig,islope)) 191 if (perennial_co2ice(ig,islope) > 0.) call add_stratum(layerings_map(ig,islope),perennial_co2ice(ig,islope),perennial_co2ice(ig,islope),0.,0.,0.,0.) 192 192 enddo 193 193 endif 194 194 enddo 195 195 else 196 call array2stratif(stratif_array,ngrid,nslope, stratif)196 call array2stratif(stratif_array,ngrid,nslope,layerings_map) 197 197 endif 198 198 deallocate(stratif_array) … … 383 383 co2_ice = perennial_co2ice 384 384 385 ! Stratification (layerings)385 ! Layerings 386 386 nb_str_max = 68 387 387 if (layering_algo) then 388 write(*,*)'So the deposits are initialized with sub-surface strata.'388 write(*,*)'So the layerings are initialized with sub-surface strata.' 389 389 write(*,*)'Ice is added with ''ini_huge_h2oice'' where ''watercaptag'' is true and otherwise with ''perennial_co2ice'' found in the PCM.' 390 390 do ig = 1,ngrid 391 391 if (watercaptag(ig)) then 392 392 do islope = 1,nslope 393 call ini_layering( stratif(ig,islope))394 call add_stratum( stratif(ig,islope),ini_huge_h2oice,0.,ini_huge_h2oice,0.,0.,0.)393 call ini_layering(layerings_map(ig,islope)) 394 call add_stratum(layerings_map(ig,islope),ini_huge_h2oice,0.,ini_huge_h2oice,0.,0.,0.) 395 395 enddo 396 396 else 397 397 do islope = 1,nslope 398 call ini_layering( stratif(ig,islope))399 if (perennial_co2ice(ig,islope) > 0.) call add_stratum( stratif(ig,islope),perennial_co2ice(ig,islope),perennial_co2ice(ig,islope),0.,0.,0.,0.)398 call ini_layering(layerings_map(ig,islope)) 399 if (perennial_co2ice(ig,islope) > 0.) call add_stratum(layerings_map(ig,islope),perennial_co2ice(ig,islope),perennial_co2ice(ig,islope),0.,0.,0.,0.) 400 400 enddo 401 401 endif -
trunk/LMDZ.COMMON/libf/evolution/pemredem.F90
r3770 r3778 58 58 59 59 SUBROUTINE pemdem1(filename,i_myear,nsoil_PEM,ngrid,nslope,tsoil_slope_PEM,inertiesoil_slope_PEM, & 60 icetable_depth,icetable_thickness,ice_porefilling,m_co2_regolith,m_h2o_regolith,h2o_ice, stratif)60 icetable_depth,icetable_thickness,ice_porefilling,m_co2_regolith,m_h2o_regolith,h2o_ice,layerings_map) 61 61 62 62 ! write time-dependent variable to restart file … … 78 78 real, dimension(ngrid,nsoil_PEM,nslope), intent(in) :: m_co2_regolith, m_h2o_regolith 79 79 real, dimension(ngrid,nslope), intent(in) :: h2o_ice 80 type(layering), dimension(ngrid,nslope), intent(in) :: stratif ! Stratification (layerings)80 type(layering), dimension(ngrid,nslope), intent(in) :: layerings_map ! Layerings 81 81 82 82 integer :: islope … … 96 96 if (layering_algo) then 97 97 allocate(stratif_array(ngrid,nslope,nb_str_max,6)) 98 call stratif2array( stratif,ngrid,nslope,stratif_array)98 call stratif2array(layerings_map,ngrid,nslope,stratif_array) 99 99 do islope = 1,nslope 100 100 write(num,fmt='(i2.2)') islope
Note: See TracChangeset
for help on using the changeset viewer.