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