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,ini_h2oice_sublim,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) :: ini_h2oice_sublim ! 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 | ! Computation of the present surface of h2o ice still sublimating |
---|
45 | h2oice_now_surf = 0. |
---|
46 | do i = 1,ngrid |
---|
47 | do islope = 1,nslope |
---|
48 | if (ini_h2oice_sublim(i,islope) .and. h2o_ice(i,islope) > 0.) h2oice_now_surf = h2oice_now_surf + cell_area(i)*subslope_dist(i,islope) |
---|
49 | enddo |
---|
50 | enddo |
---|
51 | |
---|
52 | ! Check of the criterion |
---|
53 | if (h2oice_now_surf < h2oice_ini_surf*(1. - h2o_ice_crit)) then |
---|
54 | stopPEM = 1 |
---|
55 | write(*,*) "Reason of stopping: the surface of h2o ice sublimating reaches the threshold" |
---|
56 | write(*,*) "h2oice_now_surf < h2oice_ini_surf*(1. - h2o_ice_crit)", h2oice_now_surf < h2oice_ini_surf*(1. - h2o_ice_crit) |
---|
57 | write(*,*) "Initial surface of h2o ice sublimating =", h2oice_ini_surf |
---|
58 | write(*,*) "Current surface of h2o ice sublimating =", h2oice_now_surf |
---|
59 | write(*,*) "Percentage of change accepted =", h2o_ice_crit*100 |
---|
60 | else if (h2oice_now_surf > h2oice_ini_surf*(1. + h2o_ice_crit)) then |
---|
61 | stopPEM = 1 |
---|
62 | write(*,*) "Reason of stopping: the surface of h2o ice sublimating reaches the threshold" |
---|
63 | write(*,*) "h2oice_now_surf > h2oice_ini_surf*(1. + h2o_ice_crit)", h2oice_now_surf > h2oice_ini_surf*(1. + h2o_ice_crit) |
---|
64 | write(*,*) "Initial surface of h2o ice sublimating =", h2oice_ini_surf |
---|
65 | write(*,*) "Current surface of h2o ice sublimating =", h2oice_now_surf |
---|
66 | write(*,*) "Percentage of change accepted =", h2o_ice_crit*100 |
---|
67 | endif |
---|
68 | |
---|
69 | if (abs(h2oice_ini_surf) < 1.e-5) stopPEM = 0 |
---|
70 | |
---|
71 | END SUBROUTINE stopping_crit_h2o_ice |
---|
72 | |
---|
73 | !======================================================================= |
---|
74 | |
---|
75 | SUBROUTINE stopping_crit_co2(cell_area,co2ice_ini_surf,ini_co2ice_sublim,co2_ice,stopPEM,ngrid,global_avg_press_PCM,global_avg_press_new,nslope) |
---|
76 | |
---|
77 | use time_evol_mod, only: co2_ice_crit, ps_criterion |
---|
78 | use comslope_mod, only: subslope_dist |
---|
79 | |
---|
80 | implicit none |
---|
81 | |
---|
82 | !======================================================================= |
---|
83 | ! |
---|
84 | ! Routine to check if the co2 and pressure criteria to stop the PEM are reached |
---|
85 | ! |
---|
86 | !======================================================================= |
---|
87 | ! Inputs |
---|
88 | !------- |
---|
89 | integer, intent(in) :: ngrid, nslope ! # of grid physical grid points |
---|
90 | real, dimension(ngrid), intent(in) :: cell_area ! Area of the cells |
---|
91 | real, dimension(ngrid,nslope), intent(in) :: co2_ice ! Actual density of co2 ice |
---|
92 | real, intent(in) :: co2ice_ini_surf ! Initial surface of sublimatingco2 ice |
---|
93 | logical, dimension(ngrid,nslope), intent(in) :: ini_co2ice_sublim ! Grid points where co2 ice was initially sublimating |
---|
94 | real, intent(in) :: global_avg_press_PCM ! Planet average pressure from the PCM start files |
---|
95 | real, intent(in) :: global_avg_press_new ! Planet average pressure from the PEM computations |
---|
96 | ! Outputs |
---|
97 | !-------- |
---|
98 | integer, intent(inout) :: stopPEM ! Stopping criterion code |
---|
99 | |
---|
100 | ! Locals |
---|
101 | ! ------ |
---|
102 | integer :: i, islope ! Loop |
---|
103 | real :: co2ice_now_surf ! Current surface of co2 ice |
---|
104 | |
---|
105 | !======================================================================= |
---|
106 | ! Computation of the present surface of co2 ice still sublimating |
---|
107 | co2ice_now_surf = 0. |
---|
108 | do i = 1,ngrid |
---|
109 | do islope = 1,nslope |
---|
110 | if (ini_co2ice_sublim(i,islope) .and. co2_ice(i,islope) > 0.) co2ice_now_surf = co2ice_now_surf + cell_area(i)*subslope_dist(i,islope) |
---|
111 | enddo |
---|
112 | enddo |
---|
113 | |
---|
114 | ! Check of the criterion |
---|
115 | if (co2ice_now_surf < co2ice_ini_surf*(1. - co2_ice_crit)) then |
---|
116 | stopPEM = 3 |
---|
117 | write(*,*) "Reason of stopping: the surface of co2 ice sublimating reaches the threshold" |
---|
118 | write(*,*) "co2ice_now_surf < co2ice_ini_surf*(1. - co2_ice_crit)", co2ice_now_surf < co2ice_ini_surf*(1. - co2_ice_crit) |
---|
119 | write(*,*) "Initial surface of co2 ice sublimating =", co2ice_ini_surf |
---|
120 | write(*,*) "Current surface of co2 ice sublimating =", co2ice_now_surf |
---|
121 | write(*,*) "Percentage of change accepted =", co2_ice_crit*100. |
---|
122 | else if (co2ice_now_surf > co2ice_ini_surf*(1. + co2_ice_crit)) then |
---|
123 | stopPEM = 3 |
---|
124 | write(*,*) "Reason of stopping: the surface of co2 ice sublimating reaches the threshold" |
---|
125 | write(*,*) "co2ice_now_surf > co2ice_ini_surf*(1. + co2_ice_crit)", co2ice_now_surf > co2ice_ini_surf*(1. + co2_ice_crit) |
---|
126 | write(*,*) "Current surface of co2 ice sublimating =", co2ice_now_surf |
---|
127 | write(*,*) "Initial surface of co2 ice sublimating =", co2ice_ini_surf |
---|
128 | write(*,*) "Percentage of change accepted =", co2_ice_crit*100. |
---|
129 | endif |
---|
130 | |
---|
131 | if (abs(co2ice_ini_surf) < 1.e-5) stopPEM = 0 |
---|
132 | |
---|
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(*,*) "Initial global pressure =", global_avg_press_PCM |
---|
138 | write(*,*) "Current global pressure =", global_avg_press_new |
---|
139 | write(*,*) "Percentage of change accepted =", ps_criterion*100. |
---|
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(*,*) "Initial global pressure =", global_avg_press_PCM |
---|
145 | write(*,*) "Current global pressure =", global_avg_press_new |
---|
146 | write(*,*) "Percentage of change accepted =", ps_criterion*100. |
---|
147 | endif |
---|
148 | |
---|
149 | END SUBROUTINE stopping_crit_co2 |
---|
150 | |
---|
151 | END MODULE |
---|