| 1 | MODULE criterion_pem_stop_mod |
|---|
| 2 | |
|---|
| 3 | implicit none |
|---|
| 4 | |
|---|
| 5 | contains |
|---|
| 6 | |
|---|
| 7 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
|---|
| 8 | !!! |
|---|
| 9 | !!! Purpose: Criterions to check if the PEM needs to call the PCM |
|---|
| 10 | !!! Author: RV & LL, 02/2023 |
|---|
| 11 | !!! |
|---|
| 12 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
|---|
| 13 | |
|---|
| 14 | SUBROUTINE criterion_waterice_stop(cell_area,ini_surf,qsurf,STOPPING,ngrid,initial_h2o_ice) |
|---|
| 15 | |
|---|
| 16 | use time_evol_mod, only: water_ice_criterion |
|---|
| 17 | use comslope_mod, only: subslope_dist, nslope |
|---|
| 18 | |
|---|
| 19 | implicit none |
|---|
| 20 | |
|---|
| 21 | !======================================================================= |
|---|
| 22 | ! |
|---|
| 23 | ! Routine that checks if the water ice criterion to stop the PEM is reached |
|---|
| 24 | ! |
|---|
| 25 | !======================================================================= |
|---|
| 26 | |
|---|
| 27 | ! arguments: |
|---|
| 28 | ! ---------- |
|---|
| 29 | ! INPUT |
|---|
| 30 | integer, intent(in) :: ngrid ! # of physical grid points |
|---|
| 31 | real, dimension(ngrid), intent(in) :: cell_area ! Area of the cells |
|---|
| 32 | real, dimension(ngrid,nslope), intent(in) :: qsurf ! Actual density of water ice |
|---|
| 33 | real, intent(in) :: ini_surf ! Initial surface of h2o ice that was sublimating |
|---|
| 34 | real, dimension(ngrid,nslope), intent(in) :: initial_h2o_ice ! Grid point that initialy were covered by h2o_ice |
|---|
| 35 | ! OUTPUT |
|---|
| 36 | logical, intent(out) :: STOPPING ! Is the criterion reached? |
|---|
| 37 | ! local: |
|---|
| 38 | ! ------ |
|---|
| 39 | integer :: i, islope ! Loop |
|---|
| 40 | real :: present_surf ! Initial/Actual surface of water ice |
|---|
| 41 | |
|---|
| 42 | !======================================================================= |
|---|
| 43 | ! Initialisation to false |
|---|
| 44 | STOPPING = .false. |
|---|
| 45 | |
|---|
| 46 | ! Computation of the present surface of water ice sublimating |
|---|
| 47 | present_surf = 0. |
|---|
| 48 | do i = 1,ngrid |
|---|
| 49 | do islope = 1,nslope |
|---|
| 50 | !if (initial_h2o_ice(i,islope) > 0.5 .and. qsurf(i,islope) > 0.) present_surf = present_surf + cell_area(i)*subslope_dist(i,islope) |
|---|
| 51 | if (initial_h2o_ice(i,islope) > 0.5) present_surf = present_surf + cell_area(i)*subslope_dist(i,islope) |
|---|
| 52 | enddo |
|---|
| 53 | enddo |
|---|
| 54 | |
|---|
| 55 | ! Check of the criterion |
|---|
| 56 | if (present_surf < ini_surf*(1. - water_ice_criterion) .or. present_surf > ini_surf*(1. + water_ice_criterion)) then |
|---|
| 57 | STOPPING = .true. |
|---|
| 58 | write(*,*) "Reason of stopping: the surface of water ice sublimating reach the threshold" |
|---|
| 59 | write(*,*) "Current surface of water ice sublimating =", present_surf |
|---|
| 60 | write(*,*) "Initial surface of water ice sublimating =", ini_surf |
|---|
| 61 | write(*,*) "Percentage of change accepted =", water_ice_criterion*100 |
|---|
| 62 | write(*,*) "present_surf < ini_surf*(1. - water_ice_criterion)", (present_surf < ini_surf*(1. - water_ice_criterion)) |
|---|
| 63 | endif |
|---|
| 64 | |
|---|
| 65 | if (ini_surf < 1.e-5 .and. ini_surf > -1.e-5) STOPPING = .false. |
|---|
| 66 | |
|---|
| 67 | END SUBROUTINE criterion_waterice_stop |
|---|
| 68 | |
|---|
| 69 | ! ---------------------------------------------------------------------- |
|---|
| 70 | |
|---|
| 71 | SUBROUTINE criterion_co2_stop(cell_area,ini_surf,qsurf,STOPPING_ice,STOPPING_ps,ngrid,initial_co2_ice,global_ave_press_GCM,global_ave_press_new,nslope) |
|---|
| 72 | |
|---|
| 73 | use time_evol_mod, only: co2_ice_criterion, ps_criterion |
|---|
| 74 | use comslope_mod, only: subslope_dist |
|---|
| 75 | |
|---|
| 76 | implicit none |
|---|
| 77 | |
|---|
| 78 | !======================================================================= |
|---|
| 79 | ! |
|---|
| 80 | ! Routine that checks if the co2 and pressure criteria to stop the PEM are reached |
|---|
| 81 | ! |
|---|
| 82 | !======================================================================= |
|---|
| 83 | |
|---|
| 84 | ! arguments: |
|---|
| 85 | ! ---------- |
|---|
| 86 | ! INPUT |
|---|
| 87 | integer, intent(in) :: ngrid, nslope ! # of grid physical grid points |
|---|
| 88 | real, dimension(ngrid), intent(in) :: cell_area ! Area of the cells |
|---|
| 89 | real, dimension(ngrid,nslope), intent(in) :: qsurf ! Actual density of water ice |
|---|
| 90 | real, intent(in) :: ini_surf ! Initial surface of co2 ice that was sublimating |
|---|
| 91 | real, dimension(ngrid,nslope), intent(in) :: initial_co2_ice ! Grid point that initialy were covered by co2_ice |
|---|
| 92 | real, intent(in) :: global_ave_press_GCM ! Planet average pressure from the PCM start files |
|---|
| 93 | real, intent(in) :: global_ave_press_new ! Planet average pressure from the PEM computations |
|---|
| 94 | ! OUTPUT |
|---|
| 95 | logical, intent(out) :: STOPPING_ice ! Is the criterion for co2 ice reached? |
|---|
| 96 | logical, intent(out) :: STOPPING_ps ! Is the criterion for pressure reached? |
|---|
| 97 | ! local: |
|---|
| 98 | ! ------ |
|---|
| 99 | integer :: i, islope ! Loop |
|---|
| 100 | real :: present_surf ! Initial/Actual surface of water ice |
|---|
| 101 | |
|---|
| 102 | !======================================================================= |
|---|
| 103 | ! Initialisation to false |
|---|
| 104 | STOPPING_ice = .false. |
|---|
| 105 | STOPPING_ps = .false. |
|---|
| 106 | |
|---|
| 107 | ! Computation of the actual surface |
|---|
| 108 | present_surf = 0. |
|---|
| 109 | do i = 1,ngrid |
|---|
| 110 | do islope = 1,nslope |
|---|
| 111 | if (initial_co2_ice(i,islope) > 0.5 .and. qsurf(i,islope) > 0.) present_surf = present_surf + cell_area(i)*subslope_dist(i,islope) |
|---|
| 112 | enddo |
|---|
| 113 | enddo |
|---|
| 114 | |
|---|
| 115 | ! Check of the criterion |
|---|
| 116 | if (present_surf < ini_surf*(1. - co2_ice_criterion) .or. present_surf > ini_surf*(1. + co2_ice_criterion)) then |
|---|
| 117 | STOPPING_ice = .true. |
|---|
| 118 | write(*,*) "Reason of stopping: the surface of co2 ice sublimating reach the threshold" |
|---|
| 119 | write(*,*) "Current surface of co2 ice sublimating =", present_surf |
|---|
| 120 | write(*,*) "Initial surface of co2 ice sublimating =", ini_surf |
|---|
| 121 | write(*,*) "Percentage of change accepted =", co2_ice_criterion*100. |
|---|
| 122 | write(*,*) "present_surf < ini_surf*(1. - co2_ice_criterion)", (present_surf < ini_surf*(1. - co2_ice_criterion)) |
|---|
| 123 | endif |
|---|
| 124 | |
|---|
| 125 | if (abs(ini_surf) < 1.e-5) STOPPING_ice = .false. |
|---|
| 126 | |
|---|
| 127 | if (global_ave_press_new < global_ave_press_GCM*(1. - ps_criterion) .or. global_ave_press_new > global_ave_press_GCM*(1. + ps_criterion)) then |
|---|
| 128 | STOPPING_ps = .true. |
|---|
| 129 | write(*,*) "Reason of stopping: the global pressure reach the threshold" |
|---|
| 130 | write(*,*) "Current global pressure =", global_ave_press_new |
|---|
| 131 | write(*,*) "PCM global pressure =", global_ave_press_GCM |
|---|
| 132 | write(*,*) "Percentage of change accepted =", ps_criterion*100. |
|---|
| 133 | write(*,*) "global_ave_press_new < global_ave_press_GCM*(1. - ps_criterion)", (global_ave_press_new < global_ave_press_GCM*(1. - ps_criterion)) |
|---|
| 134 | endif |
|---|
| 135 | |
|---|
| 136 | END SUBROUTINE criterion_co2_stop |
|---|
| 137 | |
|---|
| 138 | END MODULE |
|---|