| 1 | MODULE stopping_crit_mod |
|---|
| 2 | |
|---|
| 3 | implicit none |
|---|
| 4 | |
|---|
| 5 | !======================================================================= |
|---|
| 6 | contains |
|---|
| 7 | !======================================================================= |
|---|
| 8 | |
|---|
| 9 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
|---|
| 10 | !!! |
|---|
| 11 | !!! Purpose: Criterions to check if the PEM needs to call the PCM |
|---|
| 12 | !!! Author: RV & LL, 02/2023 |
|---|
| 13 | !!! |
|---|
| 14 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
|---|
| 15 | |
|---|
| 16 | SUBROUTINE stopping_crit_h2o_ice(cell_area,h2oice_ini_surf,is_h2oice_sublim_ini,h2o_ice,stopPEM,ngrid) |
|---|
| 17 | |
|---|
| 18 | use time_evol_mod, only: h2o_ice_crit |
|---|
| 19 | use comslope_mod, only: subslope_dist, nslope |
|---|
| 20 | |
|---|
| 21 | implicit none |
|---|
| 22 | |
|---|
| 23 | !======================================================================= |
|---|
| 24 | ! |
|---|
| 25 | ! Routine to check if the h2o ice criterion to stop the PEM is reached |
|---|
| 26 | ! |
|---|
| 27 | !======================================================================= |
|---|
| 28 | ! Inputs |
|---|
| 29 | !------- |
|---|
| 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) :: h2o_ice ! Actual density of h2o ice |
|---|
| 33 | real, intent(in) :: h2oice_ini_surf ! Initial surface of sublimating h2o ice |
|---|
| 34 | logical, dimension(ngrid,nslope), intent(in) :: is_h2oice_sublim_ini ! Grid points where h2o ice was initially sublimating |
|---|
| 35 | ! Outputs |
|---|
| 36 | !-------- |
|---|
| 37 | integer, intent(inout) :: stopPEM ! Stopping criterion code |
|---|
| 38 | ! Locals |
|---|
| 39 | ! ------ |
|---|
| 40 | integer :: i, islope ! Loop |
|---|
| 41 | real :: h2oice_now_surf ! Current surface of h2o ice |
|---|
| 42 | |
|---|
| 43 | !======================================================================= |
|---|
| 44 | if (stopPEM > 0) return |
|---|
| 45 | |
|---|
| 46 | ! Computation of the present surface of h2o ice still sublimating |
|---|
| 47 | h2oice_now_surf = 0. |
|---|
| 48 | do i = 1,ngrid |
|---|
| 49 | do islope = 1,nslope |
|---|
| 50 | if (is_h2oice_sublim_ini(i,islope) .and. h2o_ice(i,islope) > 0.) h2oice_now_surf = h2oice_now_surf + cell_area(i)*subslope_dist(i,islope) |
|---|
| 51 | enddo |
|---|
| 52 | enddo |
|---|
| 53 | |
|---|
| 54 | ! Check of the criterion |
|---|
| 55 | if (h2oice_now_surf < h2oice_ini_surf*(1. - h2o_ice_crit)) then |
|---|
| 56 | stopPEM = 1 |
|---|
| 57 | write(*,*) "Reason of stopping: the surface of h2o ice sublimating reaches the threshold" |
|---|
| 58 | write(*,*) "h2oice_now_surf < h2oice_ini_surf*(1. - h2o_ice_crit)", h2oice_now_surf < h2oice_ini_surf*(1. - h2o_ice_crit) |
|---|
| 59 | write(*,*) "Initial surface of h2o ice sublimating =", h2oice_ini_surf |
|---|
| 60 | write(*,*) "Current surface of h2o ice sublimating =", h2oice_now_surf |
|---|
| 61 | write(*,*) "Percentage of change accepted =", h2o_ice_crit*100 |
|---|
| 62 | else if (h2oice_now_surf > h2oice_ini_surf*(1. + h2o_ice_crit)) then |
|---|
| 63 | stopPEM = 1 |
|---|
| 64 | write(*,*) "Reason of stopping: the surface of h2o ice sublimating reaches the threshold" |
|---|
| 65 | write(*,*) "h2oice_now_surf > h2oice_ini_surf*(1. + h2o_ice_crit)", h2oice_now_surf > h2oice_ini_surf*(1. + h2o_ice_crit) |
|---|
| 66 | write(*,*) "Initial surface of h2o ice sublimating =", h2oice_ini_surf |
|---|
| 67 | write(*,*) "Current surface of h2o ice sublimating =", h2oice_now_surf |
|---|
| 68 | write(*,*) "Percentage of change accepted =", h2o_ice_crit*100 |
|---|
| 69 | endif |
|---|
| 70 | |
|---|
| 71 | if (abs(h2oice_ini_surf) < 1.e-5) stopPEM = 0 |
|---|
| 72 | |
|---|
| 73 | END SUBROUTINE stopping_crit_h2o_ice |
|---|
| 74 | |
|---|
| 75 | !======================================================================= |
|---|
| 76 | |
|---|
| 77 | SUBROUTINE stopping_crit_co2(cell_area,co2ice_sublim_surf_ini,is_co2ice_sublim_ini,co2_ice,stopPEM,ngrid,ps_avg_global_ini,ps_avg_global,nslope) |
|---|
| 78 | |
|---|
| 79 | use time_evol_mod, only: co2_ice_crit, ps_criterion |
|---|
| 80 | use comslope_mod, only: subslope_dist |
|---|
| 81 | |
|---|
| 82 | implicit none |
|---|
| 83 | |
|---|
| 84 | !======================================================================= |
|---|
| 85 | ! |
|---|
| 86 | ! Routine to check if the co2 and pressure criteria to stop the PEM are reached |
|---|
| 87 | ! |
|---|
| 88 | !======================================================================= |
|---|
| 89 | ! Inputs |
|---|
| 90 | !------- |
|---|
| 91 | integer, intent(in) :: ngrid, nslope ! # of grid physical grid points |
|---|
| 92 | real, dimension(ngrid), intent(in) :: cell_area ! Area of the cells |
|---|
| 93 | real, dimension(ngrid,nslope), intent(in) :: co2_ice ! Actual density of co2 ice |
|---|
| 94 | real, intent(in) :: co2ice_sublim_surf_ini ! Initial surface of sublimatingco2 ice |
|---|
| 95 | logical, dimension(ngrid,nslope), intent(in) :: is_co2ice_sublim_ini ! Grid points where co2 ice was initially sublimating |
|---|
| 96 | real, intent(in) :: ps_avg_global_ini ! Planet average pressure from the PCM start files |
|---|
| 97 | real, intent(in) :: ps_avg_global ! Planet average pressure from the PEM computations |
|---|
| 98 | ! Outputs |
|---|
| 99 | !-------- |
|---|
| 100 | integer, intent(inout) :: stopPEM ! Stopping criterion code |
|---|
| 101 | |
|---|
| 102 | ! Locals |
|---|
| 103 | ! ------ |
|---|
| 104 | integer :: i, islope ! Loop |
|---|
| 105 | real :: co2ice_now_surf ! Current surface of co2 ice |
|---|
| 106 | |
|---|
| 107 | !======================================================================= |
|---|
| 108 | if (stopPEM > 0) return |
|---|
| 109 | |
|---|
| 110 | ! Computation of the present surface of co2 ice still sublimating |
|---|
| 111 | co2ice_now_surf = 0. |
|---|
| 112 | do i = 1,ngrid |
|---|
| 113 | do islope = 1,nslope |
|---|
| 114 | if (is_co2ice_sublim_ini(i,islope) .and. co2_ice(i,islope) > 0.) co2ice_now_surf = co2ice_now_surf + cell_area(i)*subslope_dist(i,islope) |
|---|
| 115 | enddo |
|---|
| 116 | enddo |
|---|
| 117 | |
|---|
| 118 | ! Check of the criterion |
|---|
| 119 | if (co2ice_now_surf < co2ice_sublim_surf_ini*(1. - co2_ice_crit)) then |
|---|
| 120 | stopPEM = 3 |
|---|
| 121 | write(*,*) "Reason of stopping: the surface of co2 ice sublimating reaches the threshold" |
|---|
| 122 | write(*,*) "co2ice_now_surf < co2ice_sublim_surf_ini*(1. - co2_ice_crit)", co2ice_now_surf < co2ice_sublim_surf_ini*(1. - co2_ice_crit) |
|---|
| 123 | write(*,*) "Initial surface of co2 ice sublimating =", co2ice_sublim_surf_ini |
|---|
| 124 | write(*,*) "Current surface of co2 ice sublimating =", co2ice_now_surf |
|---|
| 125 | write(*,*) "Percentage of change accepted =", co2_ice_crit*100. |
|---|
| 126 | else if (co2ice_now_surf > co2ice_sublim_surf_ini*(1. + co2_ice_crit)) then |
|---|
| 127 | stopPEM = 3 |
|---|
| 128 | write(*,*) "Reason of stopping: the surface of co2 ice sublimating reaches the threshold" |
|---|
| 129 | write(*,*) "co2ice_now_surf > co2ice_sublim_surf_ini*(1. + co2_ice_crit)", co2ice_now_surf > co2ice_sublim_surf_ini*(1. + co2_ice_crit) |
|---|
| 130 | write(*,*) "Current surface of co2 ice sublimating =", co2ice_now_surf |
|---|
| 131 | write(*,*) "Initial surface of co2 ice sublimating =", co2ice_sublim_surf_ini |
|---|
| 132 | write(*,*) "Percentage of change accepted =", co2_ice_crit*100. |
|---|
| 133 | endif |
|---|
| 134 | |
|---|
| 135 | if (abs(co2ice_sublim_surf_ini) < 1.e-5) stopPEM = 0 |
|---|
| 136 | |
|---|
| 137 | if (ps_avg_global < ps_avg_global_ini*(1. - ps_criterion)) then |
|---|
| 138 | stopPEM = 4 |
|---|
| 139 | write(*,*) "Reason of stopping: the global pressure reaches the threshold" |
|---|
| 140 | write(*,*) "ps_avg_global < ps_avg_global_ini*(1. - ps_criterion)", ps_avg_global < ps_avg_global_ini*(1. - ps_criterion) |
|---|
| 141 | write(*,*) "Initial global pressure =", ps_avg_global_ini |
|---|
| 142 | write(*,*) "Current global pressure =", ps_avg_global |
|---|
| 143 | write(*,*) "Percentage of change accepted =", ps_criterion*100. |
|---|
| 144 | else if (ps_avg_global > ps_avg_global_ini*(1. + ps_criterion)) then |
|---|
| 145 | stopPEM = 4 |
|---|
| 146 | write(*,*) "Reason of stopping: the global pressure reaches the threshold" |
|---|
| 147 | write(*,*) "ps_avg_global > ps_avg_global_ini*(1. + ps_criterion)", ps_avg_global > ps_avg_global_ini*(1. + ps_criterion) |
|---|
| 148 | write(*,*) "Initial global pressure =", ps_avg_global_ini |
|---|
| 149 | write(*,*) "Current global pressure =", ps_avg_global |
|---|
| 150 | write(*,*) "Percentage of change accepted =", ps_criterion*100. |
|---|
| 151 | endif |
|---|
| 152 | |
|---|
| 153 | END SUBROUTINE stopping_crit_co2 |
|---|
| 154 | |
|---|
| 155 | END MODULE |
|---|