Changeset 3770 for trunk/LMDZ.COMMON/libf
- Timestamp:
- May 21, 2025, 3:57:33 PM (4 weeks ago)
- Location:
- trunk/LMDZ.COMMON/libf/evolution
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LMDZ.COMMON/libf/evolution/layering_mod.F90
r3704 r3770 19 19 20 20 ! Physical parameters 21 real, parameter :: d_dust = 5.78e-2 22 real, parameter :: dry_lag_porosity = 0.4 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 23 real, parameter :: dry_regolith_porosity = 0.4 ! Porosity of regolith 24 real, parameter :: co2ice_porosity = 0 ! Porosity of CO2 ice 25 real, parameter :: h2oice_porosity = 0 ! Porosity of H2O ice 26 real, parameter :: rho_dust = 2500. ! Density of dust [kg.m-3] 27 real, parameter :: rho_rock = 3200. ! Density of rock [kg.m-3] 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] 28 29 29 30 ! Lag layer parameters -> see Levrard et al. 2007 30 real, parameter :: hmin_lag = 0 ! Minimal height of the lag deposit to reduce the sublimation rate31 real, parameter :: fred_subl = 1 ! Reduction factor of sublimation rate31 real, parameter :: hmin_lag = 0.5 ! Minimal height of the lag deposit to reduce the sublimation rate 32 real, parameter :: fred_subl = 0.1 ! Reduction factor of sublimation rate 32 33 33 34 ! Stratum = node of the linked list 34 35 type :: stratum 35 real :: thickness ! Layer thickness [m]36 36 real :: top_elevation ! Layer top_elevation (top height from the surface) [m] 37 real :: co2ice_volfrac ! CO2 ice volumetric fraction38 real :: h 2oice_volfrac ! H2O ice volumetric fraction39 real :: dust_volfrac ! Dust volumetric fraction40 real :: pore_volfrac ! Pore volumetric fraction = pores37 real :: h_co2ice ! Height of CO2 ice [m] 38 real :: h_h2oice ! Height of H2O ice [m] 39 real :: h_dust ! Height of dust [m] 40 real :: h_pore ! Height of pores [m] 41 41 real :: poreice_volfrac ! Pore-filled ice volumetric fraction 42 42 type(stratum), pointer :: up => null() ! Upper stratum (next node) … … 70 70 ! > stratif2array 71 71 ! > array2stratif 72 ! > print_stratif 72 ! > print_deposits 73 ! Procedures to get information about a stratum: 74 ! > thickness 75 ! > is_co2ice_str 76 ! > is_h2oice_str 77 ! > is_dust_str 78 ! > is_dust_lag 79 ! > compute_h_toplag 73 80 ! Procedures for the algorithm to evolve the layering: 74 81 ! > make_layering 75 ! > subl_co2ice_layering 76 ! > subl_h2oice_layering 77 ! > lift_dust_lags 82 ! > lift_dust_lag 83 ! > subl_ice_str 78 84 !======================================================================= 79 85 ! To display a stratum … … 86 92 87 93 !---- Code 88 write(*,'(a,es13.6)') 'Thickness : ', this%thickness 89 write(*,'(a,es13.6)') 'Top elevation : ', this%top_elevation 90 write(*,'(a,es13.6)') 'CO2 ice (m3/m3) : ', this%co2ice_volfrac 91 write(*,'(a,es13.6)') 'H2O ice (m3/m3) : ', this%h2oice_volfrac 92 write(*,'(a,es13.6)') 'Dust (m3/m3) : ', this%dust_volfrac 93 write(*,'(a,es13.6)') 'Porosity (m3/m3) : ', this%pore_volfrac 94 write(*,'(a,es13.6)') 'Pore-filled ice (m3/m3): ', this%poreice_volfrac 94 write(*,'(a,es13.6)') 'Top elevation [m]: ', this%top_elevation 95 write(*,'(a,es13.6)') 'Height of CO2 ice [m]: ', this%h_co2ice 96 write(*,'(a,es13.6)') 'Height of H2O ice [m]: ', this%h_h2oice 97 write(*,'(a,es13.6)') 'Height of dust [m]: ', this%h_dust 98 write(*,'(a,es13.6)') 'Height of pores [m]: ', this%h_pore 99 write(*,'(a,es13.6)') 'Pore-filled ice [m3/m3]: ', this%poreice_volfrac 95 100 96 101 END SUBROUTINE print_stratum … … 98 103 !======================================================================= 99 104 ! To add a stratum to the top of a layering 100 SUBROUTINE add_stratum(this,t hickness,top_elevation,co2ice,h2oice,dust,pore,poreice)105 SUBROUTINE add_stratum(this,top_elevation,co2ice,h2oice,dust,pore,poreice) 101 106 102 107 implicit none … … 104 109 !---- Arguments 105 110 type(layering), intent(inout) :: this 106 real, intent(in), optional :: t hickness, top_elevation, co2ice, h2oice, dust, pore, poreice111 real, intent(in), optional :: top_elevation, co2ice, h2oice, dust, pore, poreice 107 112 108 113 !---- Local variables … … 113 118 allocate(str) 114 119 nullify(str%up,str%down) 115 str%thickness = 1.116 120 str%top_elevation = 1. 117 str% co2ice_volfrac= 0.118 str%h 2oice_volfrac= 0.119 str% dust_volfrac = 0.120 str% pore_volfrac = 1.121 str%h_co2ice = 0. 122 str%h_h2oice = 0. 123 str%h_dust = 1. 124 str%h_pore = 0. 121 125 str%poreice_volfrac = 0. 122 if (present(thickness)) str%thickness = thickness123 126 if (present(top_elevation)) str%top_elevation = top_elevation 124 if (present(co2ice)) str% co2ice_volfrac= co2ice125 if (present(h2oice)) str%h 2oice_volfrac= h2oice126 if (present(dust)) str% dust_volfrac= dust127 if (present(pore)) str% pore_volfrac= pore127 if (present(co2ice)) str%h_co2ice = co2ice 128 if (present(h2oice)) str%h_h2oice = h2oice 129 if (present(dust)) str%h_dust = dust 130 if (present(pore)) str%h_pore = pore 128 131 if (present(poreice)) str%poreice_volfrac = poreice 129 130 ! Verification of volume fraction131 if (abs(1. - (str%co2ice_volfrac + str%h2oice_volfrac + str%dust_volfrac + str%pore_volfrac)) > tol) then132 call print_stratum(str)133 error stop 'add_stratum: properties for the new stratum are not possible (sum of volumetric fraction /= 1)!'134 endif135 132 136 133 ! Increment the number of strata … … 151 148 !======================================================================= 152 149 ! To insert a stratum after another one in a layering 153 SUBROUTINE insert_stratum(this,str_prev,t hickness,top_elevation,co2ice,h2oice,dust,pore,poreice)150 SUBROUTINE insert_stratum(this,str_prev,top_elevation,co2ice,h2oice,dust,pore,poreice) 154 151 155 152 implicit none … … 158 155 type(layering), intent(inout) :: this 159 156 type(stratum), pointer, intent(inout) :: str_prev 160 real, intent(in), optional :: t hickness, top_elevation, co2ice, h2oice, dust, pore, poreice157 real, intent(in), optional :: top_elevation, co2ice, h2oice, dust, pore, poreice 161 158 162 159 !---- Local variables … … 165 162 !---- Code 166 163 if (.not. associated(str_prev%up)) then ! If str_prev is the top stratum of the layering 167 call add_stratum(this,t hickness,top_elevation,co2ice,h2oice,dust,pore,poreice)164 call add_stratum(this,top_elevation,co2ice,h2oice,dust,pore,poreice) 168 165 else 169 166 ! Creation of the stratum 170 167 allocate(str) 171 168 nullify(str%up,str%down) 172 str%thickness = 1.173 169 str%top_elevation = 1. 174 str% co2ice_volfrac= 0.175 str%h 2oice_volfrac= 0.176 str% dust_volfrac = 0.177 str% pore_volfrac = 1.170 str%h_co2ice = 0. 171 str%h_h2oice = 0. 172 str%h_dust = 1. 173 str%h_pore = 0. 178 174 str%poreice_volfrac = 0. 179 if (present(thickness)) str%thickness = thickness180 175 if (present(top_elevation)) str%top_elevation = top_elevation 181 if (present(co2ice)) str% co2ice_volfrac= co2ice182 if (present(h2oice)) str%h 2oice_volfrac= h2oice183 if (present(dust)) str% dust_volfrac= dust184 if (present(pore)) str% pore_volfrac= pore176 if (present(co2ice)) str%h_co2ice = co2ice 177 if (present(h2oice)) str%h_h2oice = h2oice 178 if (present(dust)) str%h_dust = dust 179 if (present(pore)) str%h_pore = pore 185 180 if (present(poreice)) str%poreice_volfrac = poreice 186 187 ! Verification of volume fraction188 if (abs(1. - (str%co2ice_volfrac + str%h2oice_volfrac + str%dust_volfrac + str%pore_volfrac)) > tol) then189 call print_stratum(str)190 error stop 'add_stratum: properties for the new stratum are not possible (sum of volumetric fraction /= 1)!'191 endif192 181 193 182 ! Increment the number of strata … … 203 192 current => str%up 204 193 do while (associated(current)) 205 current%top_elevation = current%down%top_elevation + current%thickness194 current%top_elevation = current%down%top_elevation + thickness(current) 206 195 current => current%up 207 196 enddo … … 224 213 225 214 !---- Code 226 ! Protect the 3sub-surface strata from removing215 ! Protect the sub-surface strata from removing 227 216 if (str%top_elevation <= 0.) return 228 217 … … 274 263 SUBROUTINE ini_layering(this) 275 264 265 use comsoil_h_PEM, only: soil_pem, nsoilmx_PEM, layer_PEM, index_breccia, index_bedrock 266 276 267 implicit none 277 268 … … 279 270 type(layering), intent(inout) :: this 280 271 281 !---- Code 282 ! Creation of three strata at the bottom of the layering 283 ! 1) Dry porous deep regolith 284 !call add_stratum(this,18.,-12.,0.,0.,dry_regolith_porosity,1. - dry_regolith_porosity) 285 ! 2) Ice-cemented regolith (ice table) 286 !call add_stratum(this,10.,-2.,0.,1. - dry_regolith_porosity,dry_regolith_porosity,0.) 287 ! 3) Dry porous regolith 288 call add_stratum(this,2.,0.,0.,0.,dry_regolith_porosity,1. - dry_regolith_porosity) 272 !---- Local variables 273 integer :: i 274 real :: h_soil, h_pore, h_tot 275 276 !---- Code 277 ! Creation of strata at the bottom of the layering to describe the sub-surface 278 if (soil_pem) then 279 do i = nsoilmx_PEM,index_bedrock,-1 280 h_soil = layer_PEM(i) - layer_PEM(i - 1) ! No porosity 281 call add_stratum(this,-layer_PEM(i - 1),0.,0.,h_soil,0.,0.) 282 enddo 283 do i = index_bedrock - 1,index_breccia,-1 284 h_tot = layer_PEM(i) - layer_PEM(i - 1) 285 h_pore = h_tot*breccia_porosity 286 h_soil = h_tot - h_pore 287 call add_stratum(this,-layer_PEM(i - 1),0.,0.,h_soil,h_pore,0.) 288 enddo 289 do i = index_breccia - 1,2,-1 290 h_tot = layer_PEM(i) - layer_PEM(i - 1) 291 h_pore = h_tot*dry_regolith_porosity 292 h_soil = h_tot - h_pore 293 call add_stratum(this,-layer_PEM(i - 1),0.,0.,h_soil,h_pore,0.) 294 enddo 295 h_pore = layer_PEM(1)*dry_regolith_porosity 296 h_soil = layer_PEM(1) - h_pore 297 call add_stratum(this,0.,0.,0.,h_soil,h_pore,0.) 298 endif 289 299 290 300 END SUBROUTINE ini_layering … … 387 397 k = 1 388 398 do while (associated(current)) 389 stratif_array(ig,islope,k,1) = current%thickness 390 stratif_array(ig,islope,k,2) = current%top_elevation 391 stratif_array(ig,islope,k,3) = current%co2ice_volfrac 392 stratif_array(ig,islope,k,4) = current%h2oice_volfrac 393 stratif_array(ig,islope,k,5) = current%dust_volfrac 394 stratif_array(ig,islope,k,6) = current%pore_volfrac 395 stratif_array(ig,islope,k,7) = current%poreice_volfrac 399 stratif_array(ig,islope,k,1) = current%top_elevation 400 stratif_array(ig,islope,k,2) = current%h_co2ice 401 stratif_array(ig,islope,k,3) = current%h_h2oice 402 stratif_array(ig,islope,k,4) = current%h_dust 403 stratif_array(ig,islope,k,5) = current%h_pore 404 stratif_array(ig,islope,k,6) = current%poreice_volfrac 396 405 current => current%up 397 406 k = k + 1 … … 419 428 do islope = 1,nslope 420 429 do ig = 1,ngrid 421 stratif(ig,islope)%bottom%thickness = stratif_array(ig,islope,1,1) 422 stratif(ig,islope)%bottom%top_elevation = stratif_array(ig,islope,1,2) 423 stratif(ig,islope)%bottom%co2ice_volfrac = stratif_array(ig,islope,1,3) 424 stratif(ig,islope)%bottom%h2oice_volfrac = stratif_array(ig,islope,1,4) 425 stratif(ig,islope)%bottom%dust_volfrac = stratif_array(ig,islope,1,5) 426 stratif(ig,islope)%bottom%pore_volfrac = stratif_array(ig,islope,1,6) 427 stratif(ig,islope)%bottom%poreice_volfrac = stratif_array(ig,islope,1,7) 428 do k = 2,size(stratif_array,3) 429 if (all(abs(stratif_array(ig,islope,k,:)) < eps)) exit 430 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),stratif_array(ig,islope,k,7)) 430 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)) 431 432 enddo 432 433 enddo … … 436 437 437 438 !======================================================================= 438 ! To display a stratification (layerings)439 SUBROUTINE print_ stratif(this,ngrid,nslope)439 ! To display deposits 440 SUBROUTINE print_deposits(this,ngrid,nslope) 440 441 441 442 implicit none … … 459 460 enddo 460 461 461 END SUBROUTINE print_stratif 462 462 END SUBROUTINE print_deposits 463 464 !======================================================================= 465 !======================================================================= 466 ! To compute the thickness of a stratum 467 FUNCTION thickness(this) RESULT(h_str) 468 469 implicit none 470 471 !---- Arguments 472 type(stratum), intent(in) :: this 473 real :: h_str 474 475 !---- Code 476 h_str = this%h_co2ice + this%h_h2oice + this%h_dust + this%h_pore 477 478 END FUNCTION thickness 479 480 !======================================================================= 481 ! To know whether the stratum can be considered as a CO2 ice layer 482 FUNCTION is_co2ice_str(str) RESULT(co2ice_str) 483 484 implicit none 485 486 !---- Arguments 487 type(stratum), intent(in) :: str 488 logical :: co2ice_str 489 490 !---- Code 491 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_str 495 496 !======================================================================= 497 ! To know whether the stratum can be considered as a H2O ice layer 498 FUNCTION is_h2oice_str(str) RESULT(h2oice_str) 499 500 implicit none 501 502 !---- Arguments 503 type(stratum), intent(in) :: str 504 logical :: h2oice_str 505 506 !---- Code 507 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_str 511 512 !======================================================================= 513 ! To know whether the stratum can be considered as a dust layer 514 FUNCTION is_dust_str(str) RESULT(dust_str) 515 516 implicit none 517 518 !---- Arguments 519 type(stratum), intent(in) :: str 520 logical :: dust_str 521 522 !---- Code 523 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_str 527 528 !======================================================================= 529 ! To know whether the stratum can be considered as a dust lag 530 FUNCTION is_dust_lag(str) RESULT(dust_lag) 531 532 implicit none 533 534 !---- Arguments 535 type(stratum), intent(in) :: str 536 logical :: dust_lag 537 538 !---- Code 539 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_lag 543 544 !======================================================================= 545 ! To get the top lag height 546 FUNCTION thickness_toplag(this) RESULT(h_toplag) 547 548 implicit none 549 550 !---- Arguments 551 type(layering), intent(in) :: this 552 real :: h_toplag 553 554 !---- Local variables 555 type(stratum), pointer :: current 556 557 !---- Code 558 h_toplag = 0. 559 current => this%top 560 ! 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)) 562 h_toplag = h_toplag + thickness(current) 563 current => current%down 564 enddo 565 566 END FUNCTION thickness_toplag 567 568 !======================================================================= 463 569 !======================================================================= 464 570 ! Layering algorithm 465 SUBROUTINE make_layering(this,d_co2ice,d_h2oice, d_dust,new_str,zshift_surf,new_lag1,new_lag2,zlag,stopPEM,current1,current2)571 SUBROUTINE make_layering(this,d_co2ice,d_h2oice,new_str,zshift_surf,new_lag,zlag,current) 466 572 467 573 implicit none … … 469 575 !---- Arguments 470 576 ! Inputs 471 real, intent(in) :: d_co2ice, d_h2oice, d_dust472 577 473 578 ! Outputs 474 579 type(layering), intent(inout) :: this 475 type(stratum), pointer, intent(inout) :: current 1, current2476 logical, intent(inout) :: new_str, new_lag1, new_lag2 477 integer, intent(inout) :: stopPEM 580 type(stratum), pointer, intent(inout) :: current 581 real, intent(inout) :: d_co2ice, d_h2oice 582 logical, intent(inout) :: new_str, new_lag 478 583 real, intent(out) :: zshift_surf, zlag 479 584 … … 481 586 real :: dh_co2ice, dh_h2oice, dh_dust 482 587 real :: h_co2ice_old, h_h2oice_old, h_dust_old 483 real :: thickness, h2subl, h2subl_tot, h2lift, h2lift_tot484 real :: h _toplag588 real :: h2subl_co2ice, h2subl_h2oice, h2subl_co2ice_tot, h2subl_h2oice_tot 589 real :: h2lift, h2lift_tot, h_pore, h_tot, h_toplag 485 590 type(stratum), pointer :: currentloc 486 591 … … 489 594 dh_h2oice = d_h2oice/rho_h2oice 490 595 dh_dust = d_dust/rho_dust 491 zshift_surf = 0.596 zshift_surf = this%top%top_elevation 492 597 zlag = 0. 493 598 494 if (dh_dust < 0.) then ! Dust lifting only 495 if (abs(dh_co2ice) > eps .or. abs(dh_h2oice) > eps) error stop 'Situation not managed: dust lifting + CO2/H2O ice condensation/sublimation!' 496 write(*,'(a)') ' Stratification -> Dust lifting' 599 ! 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.) then 601 write(*,*) '> Layering: dust sedimentation' 602 h_pore = dh_dust*dry_regolith_porosity/(1. - dry_regolith_porosity) 603 h_tot = dh_co2ice + dh_h2oice + dh_dust + h_pore 604 ! New stratum at the top of the layering 605 if (new_str) then 606 call add_stratum(this,this%top%top_elevation + h_tot,dh_co2ice,dh_h2oice,dh_dust,h_pore,0.) 607 new_str = .false. 608 else 609 this%top%top_elevation = this%top%top_elevation + h_tot 610 this%top%h_co2ice = this%top%h_co2ice + dh_co2ice 611 this%top%h_h2oice = this%top%h_h2oice + dh_h2oice 612 this%top%h_dust = this%top%h_dust + dh_dust 613 this%top%h_pore = this%top%h_pore + h_pore 614 endif 615 !----------------------------------------------------------------------- 616 ! DUST LIFTING 617 !(with possibly ice sublimation???) 618 !else if (dh_dust < dh_co2ice .and. dh_dust < dh_h2oice .and. dh_co2ice <= 0. .and. dh_h2oice <= 0.) then 619 else if (dh_dust < 0. .and. abs(dh_co2ice) < eps .and. abs(dh_h2oice) < eps) then 620 write(*,*) '> Layering: dust lifting' 497 621 h2lift_tot = abs(dh_dust) 498 do while (h2lift_tot > 0. .and. associated(current 1))622 do while (h2lift_tot > 0. .and. associated(current)) 499 623 ! Is the considered stratum a dust lag? 500 if (abs(1. - (current1%dust_volfrac + current1%pore_volfrac)) < tol) then ! Yes, we can lift dust 501 h_dust_old = current1%dust_volfrac*current1%thickness 502 ! How much dust can be lifted in the considered dust lag? 503 if (h2lift_tot - h_dust_old <= eps) then ! There is enough to lift 504 h2lift = h2lift_tot 505 h2lift_tot = 0. 506 call lift_dust_lags(this,current1,h2lift) 507 else ! Only a fraction can be lifted and so we move to the underlying stratum 508 h2lift = h_dust_old 509 h2lift_tot = h2lift_tot - h2lift 510 call lift_dust_lags(this,current1,h2lift) 511 current1 => current1%down 512 endif 513 else ! No, we stop 514 write(*,'(a)') ' Stratification -> Dust lifting: no dust lag!' 515 stopPEM = 8 624 !if ((current%h_co2ice > eps .and. abs(dh_co2ice) < tol) .or. (current%h_h2oice > eps .and. abs(dh_h2oice) < tol)) then ! No, there is ice cementing the dust 625 if (current%h_co2ice > 0. .or. current%h_h2oice > 0. .or. current%poreice_volfrac > 0.) then ! No, there is ice cementing the dust 626 dh_dust = 0. ! The tendency is set to 0 627 exit 628 else ! Yes, we can lift dust 629 h2lift = min(h2lift_tot,current%h_dust) ! How much dust can be lifted? 630 h2lift_tot = h2lift_tot - h2lift 631 call lift_dust_lag(this,current,h2lift) 632 if (h2lift_tot > 0.) current => current%down ! Still dust to be lifted so we move to the underlying stratum 633 endif 634 enddo 635 if (h2lift_tot > 0.) dh_dust = 0. ! No dust available anymore so the tendency is set to 0 636 !----------------------------------------------------------------------- 637 ! ICE CONDENSATION 638 else if ((dh_co2ice > dh_dust .or. dh_h2oice > dh_dust) .and. dh_dust >= 0.) then 639 write(*,*) '> Layering: ice condensation' 640 ! Which porosity is considered? 641 if (dh_co2ice > dh_h2oice) then ! CO2 ice is dominant 642 h_pore = dh_co2ice*co2ice_porosity/(1. - co2ice_porosity) 643 else ! H2O ice is dominant 644 h_pore = dh_h2oice*h2oice_porosity/(1. - h2oice_porosity) 645 endif 646 h_tot = dh_co2ice + dh_h2oice + dh_dust + h_pore 647 ! New stratum at the top of the layering 648 if (new_str) then 649 call add_stratum(this,this%top%top_elevation + h_tot,dh_co2ice,dh_h2oice,dh_dust,h_pore,0.) 650 new_str = .false. 651 else 652 this%top%top_elevation = this%top%top_elevation + h_tot 653 this%top%h_co2ice = this%top%h_co2ice + dh_co2ice 654 this%top%h_h2oice = this%top%h_h2oice + dh_h2oice 655 this%top%h_dust = this%top%h_dust + dh_dust 656 this%top%h_pore = this%top%h_pore + h_pore 657 endif 658 !----------------------------------------------------------------------- 659 ! ICE SUBLIMATION 660 else if (dh_co2ice <= 0. .and. dh_h2oice <= 0. .and. abs(dh_dust) < tol) then 661 write(*,*) '> Layering: ice sublimation' 662 h2subl_co2ice_tot = abs(dh_co2ice) 663 h2subl_h2oice_tot = abs(dh_h2oice) 664 do while (h2subl_co2ice_tot > 0. .and. h2subl_h2oice_tot > 0. .and. associated(current)) 665 h_co2ice_old = current%h_co2ice 666 h_h2oice_old = current%h_h2oice 667 h_dust_old = current%h_dust 668 669 !~ ! How much is CO2 ice sublimation inhibited by the top dust lag? 670 !~ h_toplag = 0. 671 !~ if (associated(current%up)) then ! If there is an upper stratum 672 !~ currentloc => current%up 673 !~ ! Is the considered stratum a dust lag? 674 !~ do while (.not. (current%h_co2ice > 0. .or. current%h_h2oice > 0. .or. current%poreice_volfrac > 0.) .and. associated(currentloc%up)) 675 !~ h_toplag = h_toplag + thickness(currentloc) 676 !~ currentloc => currentloc%up 677 !~ enddo 678 !~ endif 679 !~ h2subl_co2ice_tot = h2subl_co2ice_tot*fred_subl**(h_toplag/hmin_lag) 680 681 ! Is there CO2 ice to sublimate? 682 h2subl_co2ice = 0. 683 if (h_co2ice_old > 0. .and. h2subl_co2ice_tot > 0.) then 684 h2subl_co2ice = min(h2subl_co2ice_tot,h_co2ice_old) 685 h2subl_co2ice_tot = h2subl_co2ice_tot - h2subl_co2ice 686 endif 687 ! Is there H2O ice to sublimate? 688 h2subl_h2oice = 0. 689 if (h_h2oice_old > 0. .and. h2subl_h2oice_tot > 0.) then 690 h2subl_h2oice = min(h2subl_h2oice_tot,h_h2oice_old) 691 h2subl_h2oice_tot = h2subl_h2oice_tot - h2subl_h2oice 692 endif 693 ! Sublimation 694 if (h2subl_co2ice > 0. .or. h2subl_h2oice >0.) call subl_ice_str(this,current,h2subl_co2ice,h2subl_h2oice,zlag,new_lag) 695 ! Still ice to be sublimated and no more ice in the current stratum so we move to the underlying stratum 696 if ((h2subl_co2ice_tot > 0. .or. h2subl_h2oice_tot > 0.) .and. current%h_co2ice < tol .and. current%h_h2oice < tol) then 697 current => current%down 698 new_lag = .true. 699 else 516 700 exit 517 701 endif 518 702 enddo 519 if (h2lift_tot > 0.) then 520 write(*,'(a)') ' Stratification -> Not enough dust in the lag layers to complete the lifting!' 521 stopPEM = 8 522 endif 523 zshift_surf = dh_dust + h2lift_tot 524 703 if (h2subl_co2ice_tot > 0.) dh_co2ice = 0. ! No CO2 ice available anymore so the tendency is set to 0 704 if (h2subl_h2oice_tot > 0.) dh_h2oice = 0. ! No H2O ice available anymore so the tendency is set to 0 705 !----------------------------------------------------------------------- 706 !~ ! CO2 ICE SUBLIMATION + H2O ICE CONDENSATION 707 !~ else if (dh_co2ice < 0. .and. dh_h2oice > 0. .and. (abs(dh_dust) < abs(dh_co2ice) .or. abs(dh_dust) < abs(dh_h2oice))) then 708 709 ! TO DO???? 710 711 !----------------------------------------------------------------------- 712 ! NOTHING HAPPENS 713 else if (abs(dh_co2ice) < tol .and. abs(dh_h2oice) < tol .and. abs(dh_dust) < tol) then 714 ! We do nothing 715 !----------------------------------------------------------------------- 716 ! UNUSUAL (WEIRD) SITUATION 525 717 else 526 527 !------ Dust sedimentation only 528 if (abs(dh_co2ice) < eps .and. abs(dh_h2oice) < eps) then 529 write(*,'(a)') ' Stratification -> Dust sedimentation' 530 ! New stratum at the layering top by sedimentation of dust 531 thickness = dh_dust/(1. - dry_regolith_porosity) 532 if (thickness > 0.) then ! Only if the stratum is building up 533 if (new_str) then 534 call add_stratum(this,thickness,this%top%top_elevation + thickness,0.,0.,dh_dust/thickness,dry_regolith_porosity,0.) 535 new_str = .false. 536 else 537 this%top%thickness = this%top%thickness + thickness 538 this%top%top_elevation = this%top%top_elevation + thickness 539 endif 540 endif 541 zshift_surf = thickness 542 543 !------ Condensation of CO2 ice + H2O ice 544 else if ((dh_co2ice >= 0. .and. dh_h2oice > 0.) .or. (dh_co2ice > 0. .and. dh_h2oice >= 0.)) then 545 write(*,'(a)') ' Stratification -> CO2 and H2O ice condensation' 546 ! New stratum at the layering top by condensation of CO2 and H2O ice 547 thickness = dh_co2ice/(1. - co2ice_porosity) + dh_h2oice/(1. - h2oice_porosity) + dh_dust 548 if (thickness > 0.) then ! Only if the stratum is building up 549 if (new_str) then 550 call add_stratum(this,thickness,this%top%top_elevation + thickness,dh_co2ice/thickness,dh_h2oice/thickness,dh_dust/thickness,1. - (dh_co2ice/thickness + dh_h2oice/thickness + dh_dust/thickness),0.) 551 new_str = .false. 552 else 553 this%top%thickness = this%top%thickness + thickness 554 this%top%top_elevation = this%top%top_elevation + thickness 555 endif 556 endif 557 zshift_surf = thickness 558 559 !------ Sublimation of CO2 ice + Condensation of H2O ice 560 else if (dh_co2ice < 0. .and. dh_h2oice > 0.) then 561 write(*,'(a)') ' Stratification -> Sublimation of CO2 ice + Condensation of H2O ice' 562 ! CO2 ice sublimation in the considered stratum + New stratum for dust lag 563 h2subl_tot = abs(dh_co2ice) 564 do while (h2subl_tot > 0. .and. associated(current1)) 565 h_co2ice_old = current1%co2ice_volfrac*current1%thickness 566 h_h2oice_old = current1%h2oice_volfrac*current1%thickness 567 h_dust_old = current1%dust_volfrac*current1%thickness 568 569 ! How much is CO2 ice sublimation inhibited by the top dust lag? 570 h_toplag = 0. 571 if (associated(current1%up)) then ! If there is an upper stratum 572 currentloc => current1%up 573 do while (abs(1. - (currentloc%dust_volfrac + currentloc%pore_volfrac)) < tol) 574 h_toplag = h_toplag + currentloc%thickness 575 if (.not. associated(currentloc%up)) exit 576 currentloc => currentloc%up 577 enddo 578 endif 579 h2subl_tot = h2subl_tot*fred_subl**(h_toplag/hmin_lag) 580 581 ! How much CO2 ice can sublimate in the considered stratum? 582 if (h2subl_tot - h_co2ice_old <= eps) then ! There is enough to sublimate 583 h2subl = h2subl_tot 584 h2subl_tot = 0. 585 call subl_co2ice_layering(this,current1,h2subl,h_co2ice_old,h_h2oice_old,h_dust_old,zshift_surf,new_lag1,zlag) 586 else if (h_co2ice_old < eps) then ! There is nothing to sublimate 587 ! Is the considered stratum a dust lag? 588 if (abs(1. - (current1%dust_volfrac + current1%pore_volfrac)) < tol) then ! Yes, we move to the underlying stratum 589 current1 => current1%down 590 new_lag1 = .true. 591 else ! No, so we stop here 592 exit 593 endif 594 else ! Only a fraction can sublimate and so we move to the underlying stratum 595 h2subl = h_co2ice_old 596 h2subl_tot = h2subl_tot - h2subl 597 call subl_co2ice_layering(this,current1,h2subl,h_co2ice_old,h_h2oice_old,h_dust_old,zshift_surf,new_lag1,zlag) 598 current1 => current1%down 599 new_lag1 = .true. 600 endif 601 enddo 602 if (h2subl_tot > 0.) then 603 write(*,'(a)') ' Stratification -> Not enough CO2 ice in the layering to complete the sublimation!' 604 stopPEM = 8 605 endif 606 ! New stratum at the layering top by condensation of H2O ice 607 thickness = dh_h2oice/(1. - h2oice_porosity) + dh_dust 608 if (thickness > 0.) then ! Only if the stratum is building up 609 if (new_str) then 610 call add_stratum(this,thickness,this%top%top_elevation + thickness,0.,dh_h2oice/thickness,dh_dust/thickness,1. - (dh_h2oice/thickness + dh_dust/thickness),0.) 611 new_str = .false. 612 else 613 this%top%thickness = this%top%thickness + thickness 614 this%top%top_elevation = this%top%top_elevation + thickness 615 endif 616 endif 617 zshift_surf = zshift_surf + thickness 618 619 !------ Sublimation of CO2 ice + H2O ice 620 else if ((dh_co2ice <= 0. .and. dh_h2oice < 0.) .or. (dh_co2ice < 0. .and. dh_h2oice <= 0.)) then 621 write(*,'(a)') ' Stratification -> Sublimation of CO2 and H2O ice' 622 ! CO2 ice sublimation in the considered stratum + New stratum for dust lag 623 h2subl_tot = abs(dh_co2ice) 624 do while (h2subl_tot > 0. .and. associated(current1)) 625 h_co2ice_old = current1%co2ice_volfrac*current1%thickness 626 h_h2oice_old = current1%h2oice_volfrac*current1%thickness 627 h_dust_old = current1%dust_volfrac*current1%thickness 628 629 ! How much is CO2 ice sublimation inhibited by the top dust lag? 630 h_toplag = 0. 631 if (associated(current1%up)) then ! If there is an upper stratum 632 currentloc => current1%up 633 do while (abs(1. - (currentloc%dust_volfrac + currentloc%pore_volfrac)) < tol) 634 h_toplag = h_toplag + currentloc%thickness 635 if (.not. associated(currentloc%up)) exit 636 currentloc => currentloc%up 637 enddo 638 endif 639 h2subl_tot = h2subl_tot*fred_subl**(h_toplag/hmin_lag) 640 641 ! How much CO2 ice can sublimate in the considered stratum? 642 if (h2subl_tot - h_co2ice_old <= eps) then ! There is enough to sublimate 643 h2subl = h2subl_tot 644 h2subl_tot = 0. 645 call subl_co2ice_layering(this,current1,h2subl,h_co2ice_old,h_h2oice_old,h_dust_old,zshift_surf,new_lag1,zlag) 646 else if (h_co2ice_old < eps) then ! There is nothing to sublimate 647 ! Is the considered stratum a dust lag? 648 if (abs(1. - (current1%dust_volfrac + current1%pore_volfrac)) < tol) then ! Yes, we move to the underlying stratum 649 current1 => current1%down 650 new_lag1 = .true. 651 else ! No, so we stop here 652 exit 653 endif 654 else ! Only a fraction can sublimate and so we move to the underlying stratum 655 h2subl = h_co2ice_old 656 h2subl_tot = h2subl_tot - h2subl 657 call subl_co2ice_layering(this,current1,h2subl,h_co2ice_old,h_h2oice_old,h_dust_old,zshift_surf,new_lag1,zlag) 658 current1 => current1%down 659 new_lag1 = .true. 660 endif 661 enddo 662 if (h2subl_tot > 0.) then 663 write(*,'(a)') ' Stratification -> Not enough CO2 ice in the layering to complete the sublimation!' 664 stopPEM = 8 665 endif 666 ! H2O ice sublimation in the considered stratum + New stratum for dust lag 667 h2subl_tot = abs(dh_h2oice) 668 do while (h2subl_tot > 0. .and. associated(current2)) 669 h_co2ice_old = current2%co2ice_volfrac*current2%thickness 670 h_h2oice_old = current2%h2oice_volfrac*current2%thickness 671 h_dust_old = current2%dust_volfrac*current2%thickness 672 673 ! How much is H2O ice sublimation inhibited by the top dust lag? 674 h_toplag = 0. 675 if (associated(current2%up)) then ! If there is an upper stratum 676 currentloc => current2%up 677 do while (abs(1. - (currentloc%dust_volfrac + currentloc%pore_volfrac)) < tol) 678 h_toplag = h_toplag + currentloc%thickness 679 if (.not. associated(currentloc%up)) exit 680 currentloc => currentloc%up 681 enddo 682 endif 683 h2subl_tot = h2subl_tot*fred_subl**(h_toplag/hmin_lag) 684 685 ! How much H2O ice can sublimate in the considered stratum? 686 if (h2subl_tot - h_h2oice_old <= eps) then ! There is enough to sublimate 687 h2subl = h2subl_tot 688 h2subl_tot = 0. 689 call subl_h2oice_layering(this,current2,h2subl,h_co2ice_old,h_h2oice_old,h_dust_old,zshift_surf,new_lag2,zlag) 690 else if (h_h2oice_old < eps) then ! There is nothing to sublimate 691 ! Is the considered stratum a dust lag? 692 if (abs(1. - (current1%dust_volfrac + current1%pore_volfrac)) < tol) then ! Yes, we move to the underlying stratum 693 current1 => current1%down 694 new_lag1 = .true. 695 else ! No, so we stop here 696 exit 697 endif 698 else ! Only a fraction can sublimate and so we move to the underlying stratum 699 h2subl = h_h2oice_old 700 h2subl_tot = h2subl_tot - h2subl 701 call subl_h2oice_layering(this,current2,h2subl,h_co2ice_old,h_h2oice_old,h_dust_old,zshift_surf,new_lag2,zlag) 702 current2 => current2%down 703 new_lag2 = .true. 704 endif 705 enddo 706 if (h2subl_tot > 0.) then 707 write(*,'(a)') ' Stratification -> Not enough H2O ice in the layering to complete the sublimation!' 708 stopPEM = 8 709 endif 710 711 !------ Condensation of CO2 ice + Sublimation of H2O ice 712 else if (dh_co2ice > 0. .and. dh_h2oice < 0.) then 713 error stop 'Impossible situation: CO2 ice condensation + H2O ice sublimation!' 714 endif 718 write(*,'(a)') 'Error: situation for the layering construction not managed!' 719 write(*,'(a,es12.3)') ' > dh_co2ice [m/y] = ', dh_co2ice 720 write(*,'(a,es12.3)') ' > dh_h2oice [m/y] = ', dh_h2oice 721 write(*,'(a,es12.3)') ' > dh_dust [m/y] = ', dh_dust, tol 722 !~ error stop 715 723 endif 716 724 725 zshift_surf = this%top%top_elevation - zshift_surf 726 717 727 END SUBROUTINE make_layering 718 728 719 729 !======================================================================= 720 ! To sublimate CO2 ice in the layering 721 SUBROUTINE subl_co2ice_layering(this,str,h2subl,h_co2ice_old,h_h2oice_old,h_dust_old,zshift_surf,new_lag,zlag) 730 ! To lift dust in a stratum 731 SUBROUTINE lift_dust_lag(this,str,h2lift) 732 733 implicit none 734 735 !---- Arguments 736 type(layering), intent(inout) :: this 737 type(stratum), pointer, intent(inout) :: str 738 real, intent(in) :: h2lift 739 740 !---- Code 741 ! Update of properties in the eroding dust lag 742 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_dust 744 str%h_dust = str%h_dust - h2lift 745 746 ! Remove the eroding dust lag if there is no dust anymore 747 if (str%h_dust < tol) call rm_stratum(this,str) 748 749 END SUBROUTINE lift_dust_lag 750 751 !======================================================================= 752 ! To sublimate ice in a stratum 753 SUBROUTINE subl_ice_str(this,str,h2subl_co2ice,h2subl_h2oice,zlag,new_lag) 722 754 723 755 implicit none … … 727 759 type(stratum), pointer, intent(inout) :: str 728 760 logical, intent(inout) :: new_lag 729 real, intent(inout) :: z shift_surf, zlag730 real, intent(in) :: h2subl , h_co2ice_old, h_h2oice_old, h_dust_old731 732 !---- Local variables 733 real :: r_subl, hsubl_dust, h_lag761 real, intent(inout) :: zlag 762 real, intent(in) :: h2subl_co2ice, h2subl_h2oice 763 764 !---- Local variables 765 real :: hsubl_dust, h_pore, h_ice, h_tot, h2subl 734 766 type(stratum), pointer :: current 735 767 736 768 !---- Code 737 ! How much dust does CO2 ice sublimation involve to create the lag? 738 r_subl = h2subl/(1. - co2ice_porosity) & 739 /(str%thickness*(str%co2ice_volfrac/(1. - co2ice_porosity) + str%h2oice_volfrac/(1. - h2oice_porosity))) 740 hsubl_dust = r_subl*str%dust_volfrac*str%thickness 741 742 str%thickness = str%thickness - h2subl/(1. - co2ice_porosity) - hsubl_dust 743 zshift_surf = zshift_surf - h2subl/(1. - co2ice_porosity) - hsubl_dust 744 if (str%thickness < tol) then 745 ! Remove the sublimating stratum if there is no ice anymore 746 call rm_stratum(this,str) 747 else 748 ! Update of properties in the sublimating stratum 749 str%top_elevation = str%top_elevation - h2subl/(1. - co2ice_porosity) - hsubl_dust 750 str%co2ice_volfrac = (h_co2ice_old - h2subl)/str%thickness 751 str%h2oice_volfrac = h_h2oice_old/str%thickness 752 str%dust_volfrac = (h_dust_old - hsubl_dust)/str%thickness 753 str%pore_volfrac = 1. - (str%co2ice_volfrac + str%h2oice_volfrac + str%dust_volfrac) 754 str%poreice_volfrac = 0. 755 ! Correct the value of top_elevation for the upper strata 756 current => str%up 757 do while (associated(current)) 758 current%top_elevation = current%down%top_elevation + current%thickness 759 current => current%up 760 enddo 761 endif 762 763 ! New stratum = dust lag 764 h_lag = hsubl_dust/(1. - dry_lag_porosity) 765 if (h_lag > 0.) then ! Only if the dust lag is building up 769 h_ice = str%h_co2ice + str%h_h2oice 770 h2subl = h2subl_co2ice + h2subl_h2oice 771 772 ! How much dust does ice sublimation involve to create the lag? 773 hsubl_dust = str%h_dust*h2subl/h_ice 774 775 ! Update of properties in the sublimating stratum 776 str%top_elevation = str%top_elevation - h2subl*(1. + h_pore/h_ice) - hsubl_dust 777 str%h_co2ice = str%h_co2ice - h2subl_co2ice 778 str%h_h2oice = str%h_h2oice - h2subl_h2oice 779 str%h_dust = str%h_dust - hsubl_dust 780 str%h_pore = str%h_pore - h2subl*h_pore/h_ice 781 782 ! Correct the value of top_elevation for the upper strata 783 current => str%up 784 do while (associated(current)) 785 current%top_elevation = current%down%top_elevation + thickness(current) 786 current => current%up 787 enddo 788 789 ! Remove the sublimating stratum if there is no ice anymore 790 if (str%h_co2ice < tol .and. str%h_h2oice < tol) call rm_stratum(this,str) 791 792 ! New stratum above the current stratum as a dust lag 793 if (hsubl_dust > 0.) then ! Only if the dust lag is building up 794 h_pore = hsubl_dust*dry_lag_porosity/(1. - dry_lag_porosity) 795 h_tot = hsubl_dust + h_pore 766 796 if (new_lag) then 767 call insert_stratum(this,str, h_lag,str%top_elevation + h_lag,0.,0.,1. - dry_lag_porosity,dry_lag_porosity)797 call insert_stratum(this,str,str%top_elevation + h_tot,0.,0.,hsubl_dust,h_pore) 768 798 new_lag = .false. 769 799 else 770 str%up%thickness = str%up%thickness + h_lag 771 str%up%top_elevation = str%up%top_elevation + h_lag 800 str%up%top_elevation = str%up%top_elevation + h_tot 772 801 endif 773 802 endif 774 zlag = zlag + h_lag 775 776 END SUBROUTINE subl_co2ice_layering 777 778 !======================================================================= 779 ! To sublimate H2O ice in the layering 780 SUBROUTINE subl_h2oice_layering(this,str,h2subl,h_co2ice_old,h_h2oice_old,h_dust_old,zshift_surf,new_lag,zlag) 781 782 implicit none 783 784 !---- Arguments 785 type(layering), intent(inout) :: this 786 type(stratum), pointer, intent(inout) :: str 787 logical, intent(inout) :: new_lag 788 real, intent(inout) :: zshift_surf, zlag 789 real, intent(in) :: h2subl, h_co2ice_old, h_h2oice_old, h_dust_old 790 791 !---- Local variables 792 real :: r_subl, hsubl_dust, h_lag 793 type(stratum), pointer :: current 794 795 !---- Code 796 ! How much dust does CO2 ice sublimation involve to create the lag? 797 r_subl = h2subl/(1. - h2oice_porosity) & 798 /(str%thickness*(str%co2ice_volfrac/(1. - co2ice_porosity) + str%h2oice_volfrac/(1. - h2oice_porosity))) 799 hsubl_dust = r_subl*str%dust_volfrac*str%thickness 800 801 str%thickness = str%thickness - h2subl/(1. - h2oice_porosity) - hsubl_dust 802 zshift_surf = zshift_surf - h2subl/(1. - h2oice_porosity) - hsubl_dust 803 if (str%thickness < tol) then 804 ! Remove the sublimating stratum if there is no ice anymore 805 call rm_stratum(this,str) 806 else 807 ! Update of properties in the sublimating stratum 808 str%top_elevation = str%top_elevation - h2subl/(1. - h2oice_porosity) - hsubl_dust 809 str%co2ice_volfrac = h_co2ice_old/str%thickness 810 str%h2oice_volfrac = (h_h2oice_old - h2subl)/str%thickness 811 str%dust_volfrac = (h_dust_old - hsubl_dust)/str%thickness 812 str%pore_volfrac = 1. - (str%co2ice_volfrac + str%h2oice_volfrac + str%dust_volfrac) 813 str%poreice_volfrac = 0. 814 ! Correct the value of top_elevation for the upper strata 815 current => str%up 816 do while (associated(current)) 817 current%top_elevation = current%down%top_elevation + current%thickness 818 current => current%up 819 enddo 820 endif 821 822 ! New stratum = dust lag 823 h_lag = hsubl_dust/(1. - dry_lag_porosity) 824 if (h_lag > 0.) then ! Only if the dust lag is building up 825 if (new_lag) then 826 call insert_stratum(this,str,h_lag,str%top_elevation + h_lag,0.,0.,1. - dry_lag_porosity,dry_lag_porosity) 827 new_lag = .false. 828 else 829 str%up%thickness = str%up%thickness + h_lag 830 str%up%top_elevation = str%up%top_elevation + h_lag 831 endif 832 endif 833 zlag = zlag + h_lag 834 835 END SUBROUTINE subl_h2oice_layering 836 837 !======================================================================= 838 ! To lift dust in the layering 839 SUBROUTINE lift_dust_lags(this,str,h2lift) 840 841 implicit none 842 843 !---- Arguments 844 type(layering), intent(inout) :: this 845 type(stratum), pointer, intent(inout) :: str 846 real, intent(in) :: h2lift 847 848 !---- Code 849 ! Update of properties in the eroding dust lag 850 str%thickness = str%thickness - h2lift/(1. - str%pore_volfrac) 851 str%top_elevation = str%top_elevation - h2lift/(1. - str%pore_volfrac) 852 ! Remove the eroding dust lag if there is no dust anymore 853 if (str%thickness < tol) call rm_stratum(this,str) 854 855 END SUBROUTINE lift_dust_lags 803 zlag = zlag + h_tot 804 805 END SUBROUTINE subl_ice_str 856 806 857 807 END MODULE layering_mod -
trunk/LMDZ.COMMON/libf/evolution/pem.F90
r3742 r3770 21 21 22 22 ! III Output 23 ! III_a Update surface value for the PCM start files23 ! III_a Update surface values for the PCM start files 24 24 ! III_b Write the "restart.nc" and "restartfi.nc" 25 25 ! III_c Write the "restartpem.nc" … … 69 69 use writediagpem_mod, only: writediagpem, writediagsoilpem 70 70 use co2condens_mod, only: CO2cond_ps 71 use layering_mod, only: d_dust, ptrarray, stratum, layering, ini_layering, del_layering, make_layering, get_nb_str_max, nb_str_max, layering_algo 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 72 73 use dyn_ss_ice_m_mod, only: dyn_ss_ice_m 73 74 use version_info_mod, only: print_version_info … … 119 120 include "comgeom.h" 120 121 include "iniprint.h" 121 include "callkeys.h"122 123 integer ngridmx124 parameter(ngridmx = 2 + (jjm - 1)*iim - 1/jjm)125 122 126 123 ! Same variable names as in the PCM 124 integer, parameter :: ngridmx = 2 + (jjm - 1)*iim - 1/jjm 127 125 integer, parameter :: nlayer = llm ! Number of vertical layer 128 126 integer :: ngrid ! Number of physical grid points … … 196 194 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] 197 195 198 ! Variables for stratification (layering) evolution 199 type(layering), dimension(:,:), allocatable :: stratif ! Layering (linked list of "stratum") for each grid point and slope 200 type(ptrarray), dimension(:,:), allocatable :: current1, current2 ! Current active stratum in the layering 201 logical, dimension(:,:), allocatable :: new_str, new_lag1, new_lag2 ! Flags for the layering algorithm 196 ! Variables for the evolution of layered deposits 197 type(layering), dimension(:,:), allocatable :: deposits ! Layering for each grid point and slope 198 type(ptrarray), dimension(:,:), allocatable :: current ! Current active stratum in the layering 199 logical, dimension(:,:), allocatable :: new_str, new_lag ! Flags for the layering algorithm 200 real :: h2o_ice_depth_old ! Old depth of subsurface ice layer 202 201 203 202 ! Variables for slopes … … 646 645 !------------------------ 647 646 write(*,*) '> Reading "startpem.nc"' 648 allocate(co2_ice(ngrid,nslope),h2o_ice(ngrid,nslope), stratif(ngrid,nslope))647 allocate(co2_ice(ngrid,nslope),h2o_ice(ngrid,nslope),deposits(ngrid,nslope)) 649 648 allocate(delta_h2o_adsorbed(ngrid),delta_co2_adsorbed(ngrid),delta_h2o_icetablesublim(ngrid)) 650 if (layering_algo) then651 do islope = 1,nslope652 do i = 1,ngrid653 call ini_layering(stratif(i,islope))654 enddo655 enddo656 endif657 658 649 delta_h2o_icetablesublim = 0. 659 650 call pemetat0("startpem.nc",ngrid,nsoilmx,nsoilmx_PEM,nslope,timelen,timestep,TI_PEM,tsoil_PEM,icetable_depth,icetable_thickness,ice_porefilling, & 660 651 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, & 661 watersurf_density_avg,watersoil_density_PEM_avg,co2_adsorbed_phys,delta_co2_adsorbed,h2o_adsorbed_phys,delta_h2o_adsorbed, stratif)652 watersurf_density_avg,watersoil_density_PEM_avg,co2_adsorbed_phys,delta_co2_adsorbed,h2o_adsorbed_phys,delta_h2o_adsorbed,deposits) 662 653 deallocate(tsurf_avg_yr1) 663 654 … … 667 658 co2ice_sublim_surf_ini = 0. 668 659 h2oice_ini_surf = 0. 660 h2o_ice_depth = 0. 669 661 is_co2ice_sublim_ini = .false. 670 662 is_h2oice_sublim_ini = .false. 671 663 is_co2ice_ini = .false. 672 664 co2ice_disappeared = .false. 665 if (layering_algo) then 666 do ig = 1,ngrid 667 do islope = 1,nslope 668 co2_ice(ig,islope) = deposits(ig,islope)%top%h_co2ice 669 h2o_ice(ig,islope) = deposits(ig,islope)%top%h_h2oice 670 enddo 671 enddo 672 endif 673 673 do i = 1,ngrid 674 674 do islope = 1,nslope … … 681 681 is_h2oice_sublim_ini(i,islope) = .true. 682 682 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)) 683 684 endif 684 685 enddo … … 736 737 stopPEM = 0 737 738 if (layering_algo) then 738 allocate(new_str(ngrid,nslope),new_lag 1(ngrid,nslope),new_lag2(ngrid,nslope),current1(ngrid,nslope),current2(ngrid,nslope))739 allocate(new_str(ngrid,nslope),new_lag(ngrid,nslope),current(ngrid,nslope)) 739 740 new_str = .true. 740 new_lag1 = .true. 741 new_lag2 = .true. 741 new_lag = .true. 742 742 do islope = 1,nslope 743 743 do ig = 1,ngrid 744 current1(ig,islope)%p => stratif(ig,islope)%top 745 current2(ig,islope)%p => stratif(ig,islope)%top 744 current(ig,islope)%p => deposits(ig,islope)%top 746 745 enddo 747 746 enddo … … 820 819 !------------------------ 821 820 allocate(zshift_surf(ngrid,nslope),zlag(ngrid,nslope)) 822 call evol_h2o_ice(ngrid,nslope,cell_area,delta_h2o_adsorbed,delta_h2o_icetablesublim,h2o_ice,d_h2oice,zshift_surf,stopPEM)823 call evol_co2_ice(ngrid,nslope,co2_ice,d_co2ice,zshift_surf)824 821 if (layering_algo) then 825 822 do islope = 1,nslope 826 823 do ig = 1,ngrid 827 call make_layering(stratif(ig,islope),d_co2ice(ig,islope),d_h2oice(ig,islope),d_dust,new_str(ig,islope),zshift_surf(ig,islope),new_lag1(ig,islope),new_lag2(ig,islope),zlag(ig,islope),stopPEM,current1(ig,islope)%p,current2(ig,islope)%p) 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 828 827 enddo 829 828 enddo 830 829 else 831 830 zlag = 0. 831 call evol_h2o_ice(ngrid,nslope,cell_area,delta_h2o_adsorbed,delta_h2o_icetablesublim,h2o_ice,d_h2oice,zshift_surf,stopPEM) 832 call evol_co2_ice(ngrid,nslope,co2_ice,d_co2ice,zshift_surf) 832 833 endif 833 834 … … 840 841 ps_timeseries,ps_avg_global_old,ps_avg_global_new,co2_ice,flag_co2flow) 841 842 if (h2oice_flow .and. nslope > 1) call flow_h2oglaciers(ngrid,nslope,iflat,subslope_dist,def_slope_mean,tsurf_avg,h2o_ice,flag_h2oflow) 843 if (layering_algo) then 844 do islope = 1,nslope 845 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) 848 enddo 849 enddo 850 endif 842 851 843 852 !------------------------ … … 891 900 if (soil_pem) then 892 901 ! II_d.2 Shifting soil temperature to surface 893 !call shift_tsoil2surf(ngrid,nsoilmx_PEM,nslope,zshift_surf,zlag,tsurf_avg,tsoil_PEM)902 call shift_tsoil2surf(ngrid,nsoilmx_PEM,nslope,zshift_surf,zlag,tsurf_avg,tsoil_PEM) 894 903 895 904 ! II_d.3 Update soil temperature … … 1014 1023 call recomp_tend_co2(ngrid,nslope,timelen,d_co2ice,d_co2ice_ini,co2_ice,emis,vmr_co2_PCM,vmr_co2_PEM_phys,ps_timeseries,ps_avg_global_old,ps_avg_global_new) 1015 1024 write(*,*) "> Updating the H2O sub-surface ice tendency due to lag layer" 1016 do ig = 1,ngrid 1017 do islope = 1,nslope 1018 call recomp_tend_h2o(icetable_depth_old(ig,islope),icetable_depth(ig,islope),tsurf_avg(ig,islope),tsoil_PEM_timeseries_old(ig,:,islope,:),tsoil_PEM_timeseries(ig,:,islope,:),d_h2oice(ig,islope)) 1019 enddo 1020 enddo 1025 if (layering_algo) then 1026 do ig = 1,ngrid 1027 do islope = 1,nslope 1028 if (is_h2oice_sublim_ini(ig,islope)) then 1029 h2o_ice_depth_old = h2o_ice_depth(ig,islope) 1030 h2o_ice_depth(ig,islope) = thickness_toplag(deposits(ig,islope)) 1031 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 endif 1033 enddo 1034 enddo 1035 !~ else 1036 !~ do ig = 1,ngrid 1037 !~ do islope = 1,nslope 1038 !~ call recomp_tend_h2o(icetable_depth_old(ig,islope),icetable_depth(ig,islope),tsurf_avg(ig,islope),tsoil_PEM_timeseries_old(ig,:,islope,:),tsoil_PEM_timeseries(ig,:,islope,:),d_h2oice(ig,islope)) 1039 !~ enddo 1040 !~ enddo 1041 endif 1021 1042 if (soil_pem) deallocate(icetable_depth_old,tsoil_PEM_timeseries_old) 1022 1043 deallocate(vmr_co2_PEM_phys) 1023 1044 write(*,*) "> Updating the H2O sub-surface ice depth" 1024 do ig = 1,ngrid1025 do islope = 1,nslope1026 if (icetable_depth(ig,islope) > 0) then1027 icetable_depth(ig,islope)=icetable_depth(ig,islope) + d_h2oice(ig,islope)*0.01 !!! 0.01 is for 1 percent dust, needs to be updated !!!1028 endif1029 enddo1030 enddo1031 1032 1045 1033 1046 !------------------------ … … 1036 1049 !------------------------ 1037 1050 write(*,*) "> Checking the stopping criteria" 1038 h2o_ice=sum(stratif(ig,islope)%top%h2oice_volfrac*stratif(ig,islope)%top%thickness*subslope_dist(ig,:)/cos(pi*def_slope_mean(:)/180.))1039 co2_ice=sum(stratif(ig,islope)%top%h2oice_volfrac*stratif(ig,islope)%top%thickness*subslope_dist(ig,:)/cos(pi*def_slope_mean(:)/180.))1040 1051 call stopping_crit_h2o_ice(cell_area,h2oice_ini_surf,is_h2oice_sublim_ini,h2o_ice,stopPEM,ngrid) 1041 1052 call stopping_crit_co2(cell_area,co2ice_sublim_surf_ini,is_co2ice_sublim_ini,co2_ice,stopPEM,ngrid,ps_avg_global_ini,ps_avg_global_new,nslope) … … 1062 1073 case(7) 1063 1074 write(*,'(a,i0)') " **** STOPPING because the time limit for the PEM job will be reached soon: ", stopPEM 1064 case(8)1065 write(*,'(a,i0)') " **** STOPPING because the layering algorithm met an hasty end: ", stopPEM1066 1075 case default 1067 1076 write(*,'(a,i0)') " **** STOPPING with unknown stopping criterion code: ", stopPEM … … 1080 1089 deallocate(d_co2ice,d_co2ice_ini,d_h2oice) 1081 1090 deallocate(is_co2ice_ini,is_co2ice_sublim_ini,is_h2oice_sublim_ini) 1082 if (layering_algo) deallocate(new_str,new_lag 1,new_lag2,current1,current2)1091 if (layering_algo) deallocate(new_str,new_lag,current) 1083 1092 !------------------------------ END RUN -------------------------------- 1084 1093 … … 1086 1095 !------------------------ 1087 1096 ! III Output 1088 ! III_a Update surface value for the PCM start files1097 ! III_a Update surface values for the PCM start files 1089 1098 !------------------------ 1090 1099 ! III_a.1 Ice update for start file … … 1093 1102 write(*,*) '> Reconstructing perennial ice and frost for the PCM' 1094 1103 watercap = 0. 1095 perennial_co2ice = sum(stratif(ig,islope)%top%co2ice_volfrac*stratif(ig,islope)%top%thickness*subslope_dist(ig,:)/cos(pi*def_slope_mean(:)/180.))1104 perennial_co2ice = co2_ice 1096 1105 do ig = 1,ngrid 1097 1106 ! H2O ice metamorphism … … 1102 1111 1103 1112 ! Is H2O ice still considered as an infinite reservoir for the PCM? 1104 !if (sum(h2o_ice(ig,:)*subslope_dist(ig,:)/cos(pi*def_slope_mean(:)/180.)) > inf_h2oice_threshold) then 1105 if (sum(stratif(ig,islope)%top%h2oice_volfrac*stratif(ig,islope)%top%thickness*subslope_dist(ig,:)/cos(pi*def_slope_mean(:)/180.)) > inf_h2oice_threshold) then 1106 ! There is enough ice to be considered as an infinite reservoir 1113 if (sum(h2o_ice(ig,:)*subslope_dist(ig,:)/cos(pi*def_slope_mean(:)/180.)) > inf_h2oice_threshold) then 1114 ! There is enough ice to be considered as an infinite reservoir 1107 1115 watercaptag(ig) = .true. 1108 1116 else 1109 ! T here too little ice to be considered as an infinite reservoir so ice is transferred to the frost1117 ! Too little ice to be considered as an infinite reservoir so ice is transferred to the frost 1110 1118 watercaptag(ig) = .false. 1111 1112 ! qsurf(ig,igcm_h2o_ice,:) = qsurf(ig,igcm_h2o_ice,:) + h2o_ice(ig,:) 1113 1114 qsurf(ig,igcm_h2o_ice,:) = qsurf(ig,igcm_h2o_ice,:) + sum(stratif(ig,islope)%top%h2oice_volfrac*stratif(ig,islope)%top%thickness*subslope_dist(ig,:)/cos(pi*def_slope_mean(:)/180.)) 1119 qsurf(ig,igcm_h2o_ice,:) = qsurf(ig,igcm_h2o_ice,:) + h2o_ice(ig,:) 1115 1120 h2o_ice(ig,:) = 0. 1116 1121 endif … … 1123 1128 enddo 1124 1129 1125 ! III.a.2. Tsurf update for start file 1130 ! III_a.2 Subsurface-surface interaction update for start file 1131 zdqsdif_ssi_tot = 0. 1132 h2o_ice_depth = 0. 1133 if (layering_algo) then 1134 write(*,*) '> Reconstructing ice sublimation flux from subsurface to surface for the PCM' 1135 do ig = 1,ngrid 1136 do islope = 1,nslope 1137 if (is_dust_lag(deposits(ig,islope)%top) .and. is_h2oice_str(deposits(ig,islope)%top%down)) then 1138 zdqsdif_ssi_tot(ig,islope) = d_h2oice(ig,islope) 1139 h2o_ice_depth(ig,islope) = thickness_toplag(deposits(ig,islope)) 1140 endif 1141 enddo 1142 enddo 1143 endif 1144 1145 ! III.a.3. Tsurf update for start file 1126 1146 write(*,*) '> Reconstructing the surface temperature for the PCM' 1127 1147 tsurf = tsurf_avg + tsurf_dev 1128 1148 deallocate(tsurf_dev) 1129 1149 1130 ! III_a. 3Tsoil update for start file1150 ! III_a.4 Tsoil update for start file 1131 1151 if (soil_pem) then 1132 1152 write(*,*) '> Reconstructing the soil temperature profile for the PCM' … … 1143 1163 deallocate(tsurf_avg,tsoil_dev) 1144 1164 1145 ! III_a. 4Pressure update for start file1165 ! III_a.5 Pressure update for start file 1146 1166 write(*,*) '> Reconstructing the pressure for the PCM' 1147 1167 allocate(ps_start(ngrid)) … … 1150 1170 deallocate(ps_avg,ps_dev) 1151 1171 1152 ! III_a. 5Tracers update for start file1172 ! III_a.6 Tracers update for start file 1153 1173 write(*,*) '> Reconstructing the tracer VMR for the PCM' 1154 1174 allocate(zplev_start0(ngrid,nlayer + 1),zplev_new(ngrid,nlayer + 1)) … … 1187 1207 q(ig,l + 1,nnq) = q(ig,l + 1,nnq) + extra_mass*(zplev_new(ig,l + 1) - zplev_new(ig,l + 2)) 1188 1208 write(*,*) 'extra ',noms(nnq),extra_mass, noms(nnq) /= "dust_number",noms(nnq) /= "ccn_number" 1189 endif1209 endif 1190 1210 if (q(ig,l,nnq) < 0) q(ig,l,nnq) = 1.e-30 1191 1211 enddo … … 1194 1214 deallocate(zplev_new) 1195 1215 1196 ! III_a. 6Albedo update for start file1216 ! III_a.7 Albedo update for start file 1197 1217 write(*,*) '> Reconstructing the albedo for the PCM' 1198 1218 do ig = 1,ngrid … … 1231 1251 enddo 1232 1252 1233 ! III_a. 7Orbital parameters update for start file1253 ! III_a.8 Orbital parameters update for start file 1234 1254 write(*,*) '> Setting the new orbital parameters' 1235 1255 if (evol_orbit_pem) call recomp_orb_param(i_myear,i_myear_leg) … … 1293 1313 !------------------------ 1294 1314 write(*,*) '> Writing "restartpem.nc"' 1295 if (layering_algo) nb_str_max = get_nb_str_max( stratif,ngrid,nslope) ! Get the maximum number of "stratum" in the stratification (layerings)1315 if (layering_algo) nb_str_max = get_nb_str_max(deposits,ngrid,nslope) ! Get the maximum number of "stratum" in the depositsication (layerings) 1296 1316 call pemdem0("restartpem.nc",longitude,latitude,cell_area,ngrid,nslope,def_slope,subslope_dist) 1297 1317 call pemdem1("restartpem.nc",i_myear,nsoilmx_PEM,ngrid,nslope,tsoil_PEM,TI_PEM,icetable_depth,icetable_thickness,ice_porefilling, & 1298 co2_adsorbed_phys,h2o_adsorbed_phys,h2o_ice, stratif)1318 co2_adsorbed_phys,h2o_adsorbed_phys,h2o_ice,deposits) 1299 1319 1300 1320 call info_PEM(i_myear_leg,stopPEM,i_myear,n_myear) … … 1302 1322 write(*,*) 1303 1323 write(*,*) '****** PEM final information *******' 1304 write(*,'(a,f1 0.2,a)') " + The PEM leg has run for ", i_myear_leg, " Martian years."1305 write(*,'(a,f1 0.2,a,f10.2,a)') " + The chained simulation has run for ", i_myear, " Martian years =", i_myear*convert_years, " Earth years."1306 write(*,'(a,f1 0.2,a)') " + The reached date is now ", (year_bp_ini + i_myear)*convert_years, " Earth years."1324 write(*,'(a,f16.4,a)') " + The PEM leg has run for ", i_myear_leg, " Martian years." 1325 write(*,'(a,f16.4,a,f16.4,a)') " + The chained simulation has run for ", i_myear, " Martian years =", i_myear*convert_years, " Earth years." 1326 write(*,'(a,f16.4,a)') " + The reached date is now ", (year_bp_ini + i_myear)*convert_years, " Earth years." 1307 1327 write(*,*) "+ PEM: so far, so good!" 1308 1328 write(*,*) '************************************' … … 1311 1331 do islope = 1,nslope 1312 1332 do i = 1,ngrid 1313 call del_layering( stratif(i,islope))1333 call del_layering(deposits(i,islope)) 1314 1334 enddo 1315 1335 enddo 1316 1336 endif 1317 1337 deallocate(q,longitude,latitude,cell_area,tsoil_PEM) 1318 deallocate(co2_ice,h2o_ice, stratif)1338 deallocate(co2_ice,h2o_ice,deposits) 1319 1339 !----------------------------- END OUTPUT ------------------------------ 1320 1340 -
trunk/LMDZ.COMMON/libf/evolution/pemetat0.F90
r3673 r3770 21 21 use abort_pem_mod, only: abort_pem 22 22 use compute_soiltemp_mod, only: ini_tsoil_pem, compute_tsoil_pem 23 use layering_mod, only: layering, array2stratif, nb_str_max, layering_algo 23 use layering_mod, only: layering, array2stratif, nb_str_max, layering_algo, add_stratum, ini_layering 24 use callkeys_mod, only: startphy_file 24 25 25 26 #ifndef CPP_STD … … 31 32 32 33 implicit none 33 34 include "callkeys.h"35 34 36 35 character(*), intent(in) :: filename ! name of the startfi_PEM.nc … … 134 133 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 135 134 ! Stratification (layerings) 136 nb_str_max = 1135 nb_str_max = 68 137 136 if (layering_algo) then 138 137 found = inquire_dimension("nb_str_max") 139 138 if (.not. found) then 140 139 write(*,*) 'Pemetat0: failed loading <nb_str_max>!' 141 write(*,*) '''nb_str_max'' is set to 1!'140 write(*,*) '''nb_str_max'' is set to 68 (sub-surface layers)!' 142 141 else 143 142 nb_str_max = int(inquire_dimension_length('nb_str_max')) 144 143 endif 145 allocate(stratif_array(ngrid,nslope,nb_str_max, 7))144 allocate(stratif_array(ngrid,nslope,nb_str_max,6)) 146 145 stratif_array = 0. 147 146 do islope = 1,nslope 148 147 write(num,'(i2.2)') islope 149 call get_field('stratif_slope'//num//'_thickness',stratif_array(:,islope,:,1),found) 150 call get_field('stratif_slope'//num//'_top_elevation',stratif_array(:,islope,:,2),found2) 151 found = found .or. found2 152 call get_field('stratif_slope'//num//'_co2ice_volfrac',stratif_array(:,islope,:,3),found2) 153 found = found .or. found2 154 call get_field('stratif_slope'//num//'_h2oice_volfrac',stratif_array(:,islope,:,4),found2) 155 found = found .or. found2 156 call get_field('stratif_slope'//num//'_dust_volfrac',stratif_array(:,islope,:,5),found2) 157 found = found .or. found2 158 call get_field('stratif_slope'//num//'_pore_volfrac',stratif_array(:,islope,:,6),found2) 159 found = found .or. found2 160 call get_field('stratif_slope'//num//'_icepore_volfrac',stratif_array(:,islope,:,7),found2) 161 found = found .or. found2 162 if (.not. found) then 163 write(*,*) 'Pemetat0: failed loading at least one of the properties of <stratif_slope'//num//'>' 164 endif ! not found 148 call get_field('stratif_slope'//num//'_top_elevation',stratif_array(:,islope,:,1),found) 149 if (.not. found) then 150 write(*,*) 'Pemetat0: failed loading <stratif_slope'//num//'_top_elevation>!' 151 exit 152 endif 153 call get_field('stratif_slope'//num//'_h_co2ice',stratif_array(:,islope,:,2),found) 154 if (.not. found) then 155 write(*,*) 'Pemetat0: failed loading <stratif_slope'//num//'_h_co2ice>!' 156 exit 157 endif 158 call get_field('stratif_slope'//num//'_h_h2oice',stratif_array(:,islope,:,3),found) 159 if (.not. found) then 160 write(*,*) 'Pemetat0: failed loading <stratif_slope'//num//'_h_h2oice>!' 161 exit 162 endif 163 call get_field('stratif_slope'//num//'_h_dust',stratif_array(:,islope,:,4),found) 164 if (.not. found) then 165 write(*,*) 'Pemetat0: failed loading <stratif_slope'//num//'_h_dust>!' 166 exit 167 endif 168 call get_field('stratif_slope'//num//'_h_pore',stratif_array(:,islope,:,5),found) 169 if (.not. found) then 170 write(*,*) 'Pemetat0: failed loading <stratif_slope'//num//'_h_pore>!' 171 exit 172 endif 173 call get_field('stratif_slope'//num//'_icepore_volfrac',stratif_array(:,islope,:,6),found) 174 if (.not. found) then 175 write(*,*) 'Pemetat0: failed loading <stratif_slope'//num//'_icepore_volfrac>!' 176 exit 177 endif 165 178 enddo ! islope 166 call array2stratif(stratif_array,ngrid,nslope,stratif) 179 if (.not. found) then 180 write(*,*) 'So the deposits are initialized with sub-surface strata.' 181 write(*,*) 'Ice is added with ''ini_huge_h2oice'' where ''watercaptag'' is true and otherwise with ''perennial_co2ice'' found in the PCM.' 182 do ig = 1,ngrid 183 if (watercaptag(ig)) then 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.) 187 enddo 188 else 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.) 192 enddo 193 endif 194 enddo 195 else 196 call array2stratif(stratif_array,ngrid,nslope,stratif) 197 endif 167 198 deallocate(stratif_array) 168 199 endif … … 337 368 call close_startphy 338 369 339 else ! No startpem, let's build all by hand370 else ! No startpem, let's build all by hand 340 371 341 372 write(*,*)'There is no "startpem.nc"!' … … 349 380 350 381 ! co2 ice 351 write(*,*)'So ''co2_ice'' is initialized with ''perennial_co2ice'' .'382 write(*,*)'So ''co2_ice'' is initialized with ''perennial_co2ice'' found in the PCM.' 352 383 co2_ice = perennial_co2ice 353 384 354 385 ! Stratification (layerings) 355 nb_str_max = 1 356 if (layering_algo) write(*,*)'So the stratification (layerings) is initialized with 1 sub-surface stratum.' 386 nb_str_max = 68 387 if (layering_algo) then 388 write(*,*)'So the deposits are initialized with sub-surface strata.' 389 write(*,*)'Ice is added with ''ini_huge_h2oice'' where ''watercaptag'' is true and otherwise with ''perennial_co2ice'' found in the PCM.' 390 do ig = 1,ngrid 391 if (watercaptag(ig)) then 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.) 395 enddo 396 else 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.) 400 enddo 401 endif 402 enddo 403 endif 357 404 358 405 if (soil_pem) then -
trunk/LMDZ.COMMON/libf/evolution/pemredem.F90
r3673 r3770 68 68 implicit none 69 69 70 #ifndef CPP_STD71 include "callkeys.h"72 #endif73 74 70 character(*), intent(in) :: filename 75 71 integer, intent(in) :: nsoil_PEM, ngrid, nslope … … 99 95 100 96 if (layering_algo) then 101 allocate(stratif_array(ngrid,nslope,nb_str_max, 7))97 allocate(stratif_array(ngrid,nslope,nb_str_max,6)) 102 98 call stratif2array(stratif,ngrid,nslope,stratif_array) 103 99 do islope = 1,nslope 104 100 write(num,fmt='(i2.2)') islope 105 call put_field('stratif_slope'//num//'_thickness','Layering thickness',stratif_array(:,islope,:,1),Year) 106 call put_field('stratif_slope'//num//'_top_elevation','Layering top elevation',stratif_array(:,islope,:,2),Year) 107 call put_field('stratif_slope'//num//'_co2ice_volfrac','Layering CO2 ice volume fraction',stratif_array(:,islope,:,3),Year) 108 call put_field('stratif_slope'//num//'_h2oice_volfrac','Layering H2O ice volume fraction',stratif_array(:,islope,:,4),Year) 109 call put_field('stratif_slope'//num//'_dust_volfrac','Layering dust volume fraction',stratif_array(:,islope,:,5),Year) 110 call put_field('stratif_slope'//num//'_pore_volfrac','Layering pore volume fraction',stratif_array(:,islope,:,6),Year) 111 call put_field('stratif_slope'//num//'_icepore_volfrac','Layering ice pore volume fraction',stratif_array(:,islope,:,7),Year) 101 call put_field('stratif_slope'//num//'_top_elevation','Layering top elevation',stratif_array(:,islope,:,1),Year) 102 call put_field('stratif_slope'//num//'_h_co2ice','Layering CO2 ice height',stratif_array(:,islope,:,2),Year) 103 call put_field('stratif_slope'//num//'_h_h2oice','Layering H2O ice height',stratif_array(:,islope,:,3),Year) 104 call put_field('stratif_slope'//num//'_h_dust','Layering dust height',stratif_array(:,islope,:,4),Year) 105 call put_field('stratif_slope'//num//'_h_pore','Layering pore height',stratif_array(:,islope,:,5),Year) 106 call put_field('stratif_slope'//num//'_icepore_volfrac','Layering ice pore volume fraction',stratif_array(:,islope,:,6),Year) 112 107 enddo 113 108 deallocate(stratif_array) -
trunk/LMDZ.COMMON/libf/evolution/recomp_tend_mod.F90
r3707 r3770 92 92 Rz_old = icetable_depth_old*zcdv/coef_diff ! Old resistance from PCM 93 93 Rz_new = icetable_depth_new*zcdv/coef_diff ! New resistance based on new depth 94 R_dec = Rz_new/Rz_old ! Decrease because of resistance 94 if (abs(Rz_old) < 1.e-10) then 95 R_dec = 1. 96 else 97 R_dec = Rz_new/Rz_old ! Decrease because of resistance 98 endif 95 99 96 100 ! The maxmimum of the daily averages over one year for the saturation vapor pressure at the ice table location … … 103 107 104 108 ! Lower humidity due to growing lag layer (higher depth) 109 print*, psv_max_old,psv_max_new 105 110 hum_dec = psv_max_old/psv_max_new ! Decrease because of lower water vapor pressure at the new depth 106 111 107 112 ! Flux correction (decrease) 113 print*, 'aaaaah', R_dec,hum_dec 108 114 d_h2oice = d_h2oice/R_dec/hum_dec 109 115 -
trunk/LMDZ.COMMON/libf/evolution/soil_settings_PEM_mod.F90
r3584 r3770 57 57 58 58 do iloop = 0,nsoil_PEM - 1 59 if (lay1*(alpha**(iloop-0.5)) > mlayer_PEM(nsoil_PCM - 1)) then59 if (lay1*(alpha**(iloop-0.5)) > mlayer_PEM(nsoil_PCM - 1)) then 60 60 index_powerlaw = iloop 61 61 exit … … 69 69 ! Build layer_PEM() 70 70 do iloop = 1,nsoil_PEM - 1 71 layer_PEM(iloop) = (mlayer_PEM(iloop) + mlayer_PEM(iloop - 1))/2.71 layer_PEM(iloop) = (mlayer_PEM(iloop) + mlayer_PEM(iloop - 1))/2. 72 72 enddo 73 73 layer_PEM(nsoil_PEM) = 2*mlayer_PEM(nsoil_PEM - 1) - mlayer_PEM(nsoil_PEM - 2) -
trunk/LMDZ.COMMON/libf/evolution/stopping_crit_mod.F90
r3711 r3770 69 69 endif 70 70 71 !if (abs(h2oice_ini_surf) < 1.e-5) stopPEM = 072 73 71 END SUBROUTINE stopping_crit_h2o_ice 74 72 … … 133 131 endif 134 132 135 !if (abs(co2ice_sublim_surf_ini) < 1.e-5) stopPEM = 0136 137 133 if (ps_avg_global < ps_avg_global_ini*(1. - ps_criterion)) then 138 134 stopPEM = 4
Note: See TracChangeset
for help on using the changeset viewer.