| [3989] | 1 | MODULE sorption |
|---|
| [3991] | 2 | !----------------------------------------------------------------------- |
|---|
| 3 | ! NAME |
|---|
| 4 | ! sorption |
|---|
| 5 | ! |
|---|
| 6 | ! DESCRIPTION |
|---|
| 7 | ! CO2 and H2O adsorption/desorption in regolith following Zent & Quinn |
|---|
| 8 | ! (1995) and Jackosky et al. (1997). |
|---|
| 9 | ! |
|---|
| 10 | ! AUTHORS & DATE |
|---|
| 11 | ! L. Lange, 2023 |
|---|
| [4065] | 12 | ! JB Clement, 02/2026 |
|---|
| [3991] | 13 | ! |
|---|
| 14 | ! NOTES |
|---|
| 15 | ! |
|---|
| 16 | !----------------------------------------------------------------------- |
|---|
| [3082] | 17 | |
|---|
| [4065] | 18 | ! DEPENDENCIES |
|---|
| 19 | ! ------------ |
|---|
| 20 | use numerics, only: dp, qp, di, k4, minieps |
|---|
| 21 | |
|---|
| [3991] | 22 | ! DECLARATION |
|---|
| 23 | ! ----------- |
|---|
| [3456] | 24 | implicit none |
|---|
| [3082] | 25 | |
|---|
| [4065] | 26 | ! PARAMETERS |
|---|
| 27 | ! ---------- |
|---|
| 28 | logical(k4), protected :: do_sorption ! Flag to compute adsorption/desorption |
|---|
| [3082] | 29 | |
|---|
| [3456] | 30 | contains |
|---|
| [3991] | 31 | !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
|---|
| 32 | |
|---|
| [3456] | 33 | !======================================================================= |
|---|
| [4065] | 34 | SUBROUTINE set_sorption_config(do_sorption_in) |
|---|
| [3991] | 35 | !----------------------------------------------------------------------- |
|---|
| 36 | ! NAME |
|---|
| [4065] | 37 | ! set_sorption_config |
|---|
| [3991] | 38 | ! |
|---|
| 39 | ! DESCRIPTION |
|---|
| [4065] | 40 | ! Setter for 'sorption' configuration parameters. |
|---|
| [3991] | 41 | ! |
|---|
| 42 | ! AUTHORS & DATE |
|---|
| [4065] | 43 | ! JB Clement, 02/2026 |
|---|
| [3991] | 44 | ! |
|---|
| 45 | ! NOTES |
|---|
| 46 | ! |
|---|
| 47 | !----------------------------------------------------------------------- |
|---|
| [2888] | 48 | |
|---|
| [4065] | 49 | ! DEPENDENCIES |
|---|
| 50 | ! ------------ |
|---|
| 51 | use utility, only: bool2str |
|---|
| 52 | use display, only: print_msg |
|---|
| 53 | |
|---|
| [3991] | 54 | ! DECLARATION |
|---|
| 55 | ! ----------- |
|---|
| [3456] | 56 | implicit none |
|---|
| [2888] | 57 | |
|---|
| [3991] | 58 | ! ARGUMENTS |
|---|
| 59 | ! --------- |
|---|
| [4065] | 60 | logical(k4), intent(in) :: do_sorption_in |
|---|
| [2980] | 61 | |
|---|
| [3991] | 62 | ! CODE |
|---|
| 63 | ! ---- |
|---|
| [4065] | 64 | do_sorption = do_sorption_in |
|---|
| 65 | call print_msg('do_sorption = '//bool2str(do_sorption)) |
|---|
| [2888] | 66 | |
|---|
| [4065] | 67 | END SUBROUTINE set_sorption_config |
|---|
| [3991] | 68 | !======================================================================= |
|---|
| [2888] | 69 | |
|---|
| [3456] | 70 | !======================================================================= |
|---|
| [4065] | 71 | SUBROUTINE evolve_regolith_adsorption(d_h2oice,d_co2ice,h2oice,co2ice,tsoil,TI,ps,q_h2o_ts,q_co2_ts,h2o_ads_reg,co2_ads_reg,delta_h2o_ads,delta_co2_ads) |
|---|
| [3991] | 72 | !----------------------------------------------------------------------- |
|---|
| 73 | ! NAME |
|---|
| [4065] | 74 | ! evolve_regolith_adsorption |
|---|
| [3991] | 75 | ! |
|---|
| 76 | ! DESCRIPTION |
|---|
| [4065] | 77 | ! Compute both H2O and CO2 adsorption in regolith. |
|---|
| [3991] | 78 | ! |
|---|
| 79 | ! AUTHORS & DATE |
|---|
| 80 | ! L. Lange, 2023 |
|---|
| [4065] | 81 | ! JB Clement, 12/2025 |
|---|
| 82 | ! C. Metz, 02/2026 |
|---|
| [3991] | 83 | ! |
|---|
| 84 | ! NOTES |
|---|
| 85 | ! |
|---|
| 86 | !----------------------------------------------------------------------- |
|---|
| [2888] | 87 | |
|---|
| [4065] | 88 | ! DEPENDENCIES |
|---|
| 89 | ! ------------ |
|---|
| 90 | use geometry, only: ngrid, nslope, nsoil |
|---|
| [3991] | 91 | |
|---|
| 92 | ! DECLARATION |
|---|
| 93 | ! ----------- |
|---|
| [3456] | 94 | implicit none |
|---|
| [2863] | 95 | |
|---|
| [3991] | 96 | ! ARGUMENTS |
|---|
| 97 | ! --------- |
|---|
| [4065] | 98 | real(dp), dimension(:,:), intent(in) :: d_h2oice, d_co2ice ! tendencies on the glaciers [1] |
|---|
| 99 | real(dp), dimension(:,:), intent(in) :: h2oice ! H2O ice at the surface [kg/m^2] |
|---|
| 100 | real(dp), dimension(:,:), intent(in) :: co2ice ! CO2 ice at the surface [kg/m^2] |
|---|
| 101 | real(dp), dimension(:,:,:), intent(in) :: TI ! Soil Thermal inertia [J/K/^2/s^1/2] |
|---|
| 102 | real(dp), dimension(:,:,:), intent(in) :: tsoil ! Soil temperature [K] |
|---|
| 103 | real(dp), dimension(:,:), intent(in) :: ps ! Average surface pressure [Pa] |
|---|
| 104 | real(dp), dimension(:,:), intent(in) :: q_co2_ts ! Mass mixing ratio of co2 in the first layer [kg/kg] |
|---|
| 105 | real(dp), dimension(:,:), intent(in) :: q_h2o_ts ! Mass mixing ratio of H2o in the first layer [kg/kg] |
|---|
| 106 | real(dp), dimension(:), intent(out) :: delta_h2o_ads ! Difference density of h2o adsorbed [kg/m^3] |
|---|
| 107 | real(dp), dimension(:), intent(out) :: delta_co2_ads ! Difference density of co2 adsorbed [kg/m^3] |
|---|
| 108 | real(dp), dimension(:,:,:), intent(inout) :: h2o_ads_reg, co2_ads_reg |
|---|
| [2985] | 109 | |
|---|
| [3991] | 110 | ! LOCAL VARIABLES |
|---|
| 111 | ! --------------- |
|---|
| [4065] | 112 | real(dp), dimension(ngrid,nsoil,nslope) :: theta_h2o_ads ! Fraction of the pores occupied by H2O molecules |
|---|
| [3456] | 113 | |
|---|
| [3991] | 114 | ! CODE |
|---|
| 115 | ! ---- |
|---|
| [4065] | 116 | call evolve_h2o_ads(d_h2oice,d_co2ice,h2oice,co2ice,ps,q_h2o_ts,q_co2_ts,tsoil,TI,theta_h2o_ads,h2o_ads_reg,delta_h2o_ads) |
|---|
| 117 | call evolve_co2_ads(d_h2oice,d_co2ice,h2oice,co2ice,ps,q_h2o_ts,q_co2_ts,tsoil,TI,co2_ads_reg,delta_co2_ads) |
|---|
| [2863] | 118 | |
|---|
| [4065] | 119 | END SUBROUTINE evolve_regolith_adsorption |
|---|
| [3991] | 120 | !======================================================================= |
|---|
| [2863] | 121 | |
|---|
| [3456] | 122 | !======================================================================= |
|---|
| [4065] | 123 | SUBROUTINE evolve_h2o_ads(d_h2oice,d_co2ice,h2oice,co2ice,ps,q_h2o_ts,q_co2_ts,tsoil,TI,theta_h2o_ads,h2o_ads_reg,delta_h2o_ads) |
|---|
| [3991] | 124 | !----------------------------------------------------------------------- |
|---|
| 125 | ! NAME |
|---|
| [4065] | 126 | ! evolve_h2o_ads |
|---|
| [3991] | 127 | ! |
|---|
| 128 | ! DESCRIPTION |
|---|
| 129 | ! Compute H2O adsorption in regolith following Jackosky et al. (1997). |
|---|
| 130 | ! |
|---|
| 131 | ! AUTHORS & DATE |
|---|
| 132 | ! L. Lange, 2023 |
|---|
| 133 | ! JB Clement, 2025 |
|---|
| 134 | ! |
|---|
| 135 | ! NOTES |
|---|
| 136 | ! |
|---|
| 137 | !----------------------------------------------------------------------- |
|---|
| [2863] | 138 | |
|---|
| [3991] | 139 | ! DEPENDENCIES |
|---|
| 140 | ! ------------ |
|---|
| [4065] | 141 | use geometry, only: ngrid, nslope, nsoil, nday |
|---|
| 142 | use soil, only: layer, index_breccia |
|---|
| 143 | use slopes, only: subslope_dist, def_slope_mean |
|---|
| 144 | use atmosphere, only: ap, bp |
|---|
| 145 | use planet, only: alpha_clap_h2o, beta_clap_h2o, m_h2o, m_co2,m_noco2, rho_regolith |
|---|
| 146 | use maths, only: pi |
|---|
| [3206] | 147 | |
|---|
| [3991] | 148 | ! DECLARATION |
|---|
| 149 | ! ----------- |
|---|
| [3456] | 150 | implicit none |
|---|
| [2794] | 151 | |
|---|
| [3991] | 152 | ! ARGUMENTS |
|---|
| 153 | ! --------- |
|---|
| [4065] | 154 | real(dp), dimension(:,:), intent(in) :: d_h2oice, d_co2ice ! Tendencies on the glaciers () |
|---|
| 155 | real(dp), dimension(:,:), intent(in) :: h2oice ! H2O ice at the surface [kg/m^2] |
|---|
| 156 | real(dp), dimension(:,:), intent(in) :: co2ice ! CO2 ice at the surface [kg/m^2] |
|---|
| 157 | real(dp), dimension(:,:), intent(in) :: ps ! Surface pressure [Pa] |
|---|
| 158 | real(dp), dimension(:,:), intent(in) :: q_co2_ts ! Mass mixing ratio of co2 in the first layer [kg/kg] |
|---|
| 159 | real(dp), dimension(:,:), intent(in) :: q_h2o_ts ! Mass mixing ratio of H2o in the first layer [kg/kg] |
|---|
| 160 | real(dp), dimension(:,:,:), intent(in) :: TI ! Soil Thermal inertia [J/K/^2/s^1/2] |
|---|
| 161 | real(dp), dimension(:,:,:), intent(in) :: tsoil ! Soil temperature [K] |
|---|
| 162 | real(dp), dimension(:,:,:), intent(inout) :: h2o_ads_reg ! Density of h2o adsorbed [kg/m^3] |
|---|
| 163 | real(dp), dimension(:,:,:), intent(out) :: theta_h2o_ads ! Fraction of the pores occupied by H2O molecules |
|---|
| 164 | real(dp), dimension(:), intent(out) :: delta_h2o_ads ! Difference density of h2o adsorbed [kg/m^3] |
|---|
| [2794] | 165 | |
|---|
| [3991] | 166 | ! LOCAL VARIABLES |
|---|
| 167 | ! --------------- |
|---|
| 168 | ! Constants: |
|---|
| [4065] | 169 | real(dp) :: Ko = 1.57e-8_dp ! Jackosky et al. 1997 |
|---|
| 170 | real(dp) :: e = 2573.9_dp ! Jackosky et al. 1997 |
|---|
| 171 | real(dp) :: mu = 0.48_dp ! Jackosky et al. 1997 |
|---|
| 172 | real(dp) :: m_theta = 2.84e-7_dp ! Mass of h2o per m^2 absorbed Jackosky et al. 1997 |
|---|
| 173 | ! real(dp) :: as = 18.9e3_dp ! Specific area, Buhler & Piqueux 2021 |
|---|
| 174 | real(dp) :: as = 9.48e4_dp ! Specific area, Zent |
|---|
| 175 | real(dp) :: inertie_thresold = 800._dp ! TI > 800 means cementation |
|---|
| 176 | real(dp), dimension(ngrid,index_breccia,nslope) :: deltam_reg_complete ! Difference in the mass per slope and soil layer [kg/m^3] |
|---|
| 177 | real(dp) :: K ! Used to compute theta |
|---|
| 178 | integer(di) :: ig, iloop, islope, it ! For loops |
|---|
| 179 | logical(k4), dimension(ngrid,nslope) :: ispermanent_co2glaciers ! Check if the co2 glacier is permanent |
|---|
| 180 | logical(k4), dimension(ngrid,nslope) :: ispermanent_h2oglaciers ! Check if the h2o glacier is permanent |
|---|
| 181 | real(dp), dimension(ngrid,nslope) :: deltam_reg_slope ! Difference density of h2o adsorbed per slope [kg/m^3] |
|---|
| 182 | real(dp), dimension(ngrid,nsoil,nslope) :: dm_h2o_regolith_slope ! Elementary h2o mass adsorded per mesh per slope |
|---|
| 183 | real(dp) :: A, B ! Used to compute the mean mass above the surface |
|---|
| 184 | real(dp) :: p_sat ! Saturated vapor pressure of ice |
|---|
| 185 | real(dp), dimension(:,:), allocatable :: mass_mean ! Mean mass above the surface |
|---|
| 186 | real(dp), dimension(:,:), allocatable :: zplev_mean ! Pressure above the surface |
|---|
| 187 | real(dp), dimension(:,:), allocatable :: pvapor ! Partial pressure above the surface |
|---|
| 188 | real(dp), dimension(:) , allocatable :: pvapor_avg ! Yearly averaged |
|---|
| [3456] | 189 | |
|---|
| [3991] | 190 | ! CODE |
|---|
| 191 | ! ---- |
|---|
| [2794] | 192 | ! 0. Some initializations |
|---|
| [4065] | 193 | allocate(mass_mean(ngrid,nday),zplev_mean(ngrid,nday),pvapor(ngrid,nday),pvapor_avg(ngrid)) |
|---|
| 194 | A = 1._dp/m_co2 - 1._dp/m_noco2 |
|---|
| 195 | B = 1._dp/m_noco2 |
|---|
| 196 | theta_h2o_ads = 0._dp |
|---|
| 197 | dm_h2o_regolith_slope = 0._dp |
|---|
| [3456] | 198 | ispermanent_h2oglaciers = .false. |
|---|
| 199 | ispermanent_co2glaciers = .false. |
|---|
| [2794] | 200 | |
|---|
| [3961] | 201 | ! 0.1 Look at perennial ice |
|---|
| [4065] | 202 | where (abs(d_h2oice(:,:)) > 1.e-5 .and. h2oice(:,:) > 0._dp) ispermanent_h2oglaciers(:,:) = .true. |
|---|
| 203 | where (abs(d_co2ice(:,:)) > 1.e-5 .and. co2ice(:,:) > 0._dp) ispermanent_co2glaciers(:,:) = .true. |
|---|
| [2985] | 204 | |
|---|
| [3961] | 205 | ! 0.2 Compute the partial pressure of vapor |
|---|
| 206 | ! a. the molecular mass into the column |
|---|
| 207 | do ig = 1,ngrid |
|---|
| [4065] | 208 | mass_mean(ig,:) = 1._dp/(A*q_co2_ts(ig,:) + B) |
|---|
| 209 | end do |
|---|
| [3961] | 210 | |
|---|
| 211 | ! b. pressure level |
|---|
| [4065] | 212 | do it = 1,nday |
|---|
| [3456] | 213 | do ig = 1,ngrid |
|---|
| [3961] | 214 | zplev_mean(ig,it) = ap(1) + bp(1)*ps(ig,it) |
|---|
| [4065] | 215 | end do |
|---|
| 216 | end do |
|---|
| [2842] | 217 | |
|---|
| [3961] | 218 | ! c. Vapor pressure |
|---|
| [4065] | 219 | pvapor = mass_mean/m_h2o*q_h2o_ts*zplev_mean |
|---|
| 220 | pvapor_avg = sum(pvapor,2)/nday |
|---|
| [3456] | 221 | deallocate(pvapor,zplev_mean,mass_mean) |
|---|
| [2794] | 222 | |
|---|
| [3961] | 223 | ! 1. we compute the mass of H2O adsorded in each layer of the meshes |
|---|
| 224 | do ig = 1,ngrid |
|---|
| 225 | do islope = 1,nslope |
|---|
| 226 | do iloop = 1,index_breccia |
|---|
| [4065] | 227 | K = Ko*exp(e/tsoil(ig,iloop,islope)) |
|---|
| 228 | if (TI(ig,iloop,islope) < inertie_thresold) then |
|---|
| 229 | theta_h2o_ads(ig,iloop,islope) = (K*pvapor_avg(ig)/(1._dp + K*pvapor_avg(ig)))**mu |
|---|
| [3961] | 230 | else |
|---|
| [4065] | 231 | p_sat = exp(beta_clap_h2o/tsoil(ig,iloop,islope) + alpha_clap_h2o) ! we assume fixed temperature in the ice ... not really good but ... |
|---|
| 232 | theta_h2o_ads(ig,iloop,islope) = (K*p_sat/(1._dp + K*p_sat))**mu |
|---|
| 233 | end if |
|---|
| 234 | dm_h2o_regolith_slope(ig,iloop,islope) = as*theta_h2o_ads(ig,iloop,islope)*m_theta*rho_regolith |
|---|
| 235 | end do |
|---|
| 236 | end do |
|---|
| 237 | end do |
|---|
| [2794] | 238 | |
|---|
| [3961] | 239 | ! 2. Check the exchange between the atmosphere and the regolith |
|---|
| 240 | do ig = 1,ngrid |
|---|
| [4065] | 241 | delta_h2o_ads(ig) = 0._dp |
|---|
| [3961] | 242 | do islope = 1,nslope |
|---|
| [4065] | 243 | deltam_reg_slope(ig,islope) = 0._dp |
|---|
| [3961] | 244 | do iloop = 1,index_breccia |
|---|
| [4065] | 245 | if (TI(ig,iloop,islope) < inertie_thresold .and. .not. ispermanent_h2oglaciers(ig,islope) .and. .not. ispermanent_co2glaciers(ig,islope)) then |
|---|
| [3961] | 246 | if (iloop == 1) then |
|---|
| [4065] | 247 | deltam_reg_complete(ig,iloop,islope) = (dm_h2o_regolith_slope(ig,iloop,islope) - h2o_ads_reg(ig,iloop,islope))*(layer(iloop)) |
|---|
| [3961] | 248 | else |
|---|
| [4065] | 249 | deltam_reg_complete(ig,iloop,islope) = (dm_h2o_regolith_slope(ig,iloop,islope) - h2o_ads_reg(ig,iloop,islope))*(layer(iloop) - layer(iloop - 1)) |
|---|
| 250 | end if |
|---|
| [3961] | 251 | else ! NO EXCHANGE AS ICE BLOCK THE DYNAMIC! |
|---|
| [4065] | 252 | deltam_reg_complete(ig,iloop,islope) = 0._dp |
|---|
| 253 | end if |
|---|
| [3961] | 254 | deltam_reg_slope(ig,islope) = deltam_reg_slope(ig,islope) + deltam_reg_complete(ig,iloop,islope) |
|---|
| [4065] | 255 | end do |
|---|
| 256 | delta_h2o_ads(ig) = delta_h2o_ads(ig) + deltam_reg_slope(ig,islope)*subslope_dist(ig,islope)/cos(pi*def_slope_mean(islope)/180._dp) |
|---|
| 257 | end do |
|---|
| 258 | end do |
|---|
| 259 | h2o_ads_reg = dm_h2o_regolith_slope |
|---|
| [2794] | 260 | |
|---|
| [4065] | 261 | END SUBROUTINE evolve_h2o_ads |
|---|
| [3991] | 262 | !======================================================================= |
|---|
| [3961] | 263 | |
|---|
| [3456] | 264 | !======================================================================= |
|---|
| [4065] | 265 | SUBROUTINE evolve_co2_ads(d_h2oice,d_co2ice,h2oice,co2ice,ps,q_h2o_ts,q_co2_ts,tsoil,TI,co2_ads_reg,delta_co2_ads) |
|---|
| [2863] | 266 | |
|---|
| [3991] | 267 | !----------------------------------------------------------------------- |
|---|
| 268 | ! NAME |
|---|
| [4065] | 269 | ! evolve_co2_ads |
|---|
| [3991] | 270 | ! |
|---|
| 271 | ! DESCRIPTION |
|---|
| 272 | ! Compute CO2 adsorption in regolith following Zent & Quinn (1995). |
|---|
| 273 | ! |
|---|
| 274 | ! AUTHORS & DATE |
|---|
| 275 | ! L. Lange, 2023 |
|---|
| 276 | ! JB Clement, 2025 |
|---|
| 277 | ! |
|---|
| 278 | ! NOTES |
|---|
| 279 | ! |
|---|
| 280 | !----------------------------------------------------------------------- |
|---|
| 281 | |
|---|
| 282 | ! DEPENDENCIES |
|---|
| 283 | ! ------------ |
|---|
| [4065] | 284 | use geometry, only: ngrid, nslope, nsoil, nday |
|---|
| 285 | use soil, only: layer, index_breccia |
|---|
| 286 | use slopes, only: subslope_dist, def_slope_mean |
|---|
| 287 | use atmosphere, only: ap, bp |
|---|
| 288 | use planet, only: m_co2, m_noco2, rho_regolith |
|---|
| 289 | use maths, only: pi |
|---|
| [3206] | 290 | |
|---|
| [3991] | 291 | ! DECLARATION |
|---|
| 292 | ! ----------- |
|---|
| [3456] | 293 | implicit none |
|---|
| [2794] | 294 | |
|---|
| [3991] | 295 | ! ARGUMENTS |
|---|
| 296 | ! --------- |
|---|
| [4065] | 297 | real(dp), dimension(:,:), intent(in) :: ps ! Average surface pressure [Pa] |
|---|
| 298 | real(dp), dimension(:,:,:), intent(in) :: tsoil ! Mean Soil Temperature [K] |
|---|
| 299 | real(dp), dimension(:,:,:), intent(in) :: TI ! Mean Thermal Inertia [USI] |
|---|
| 300 | real(dp), dimension(:,:), intent(in) :: d_h2oice, d_co2ice ! Tendencies on the glaciers () |
|---|
| 301 | real(dp), dimension(:,:), intent(in) :: q_co2_ts, q_h2o_ts ! Mass mixing ratio of co2 and h2o in the first layer [kg/kg] |
|---|
| 302 | real(dp), dimension(:,:), intent(in) :: h2oice ! Water ice at the surface [kg/m^2] |
|---|
| 303 | real(dp), dimension(:,:), intent(in) :: co2ice ! CO2 ice at the surface [kg/m^2] |
|---|
| 304 | real(dp), dimension(:,:,:), intent(inout) :: co2_ads_reg ! Density of co2 adsorbed [kg/m^3] |
|---|
| 305 | real(dp), dimension(:), intent(out) :: delta_co2_ads ! Difference density of co2 adsorbed [kg/m^3] |
|---|
| [3456] | 306 | |
|---|
| [3991] | 307 | ! LOCAL VARIABLES |
|---|
| 308 | ! --------------- |
|---|
| [2794] | 309 | ! Constants: |
|---|
| [4065] | 310 | real(dp) :: alpha = 7.512e-6_dp ! Zent & Quinn 1995 |
|---|
| 311 | real(dp) :: beta = -1541.5_dp ! Zent & Quinn 1995 |
|---|
| 312 | real(dp) :: inertie_thresold = 800._dp ! TI > 800 means cementation |
|---|
| 313 | real(dp) :: m_theta = 4.27e-7_dp ! Mass of co2 per m^2 absorbed |
|---|
| 314 | ! real(dp) :: as = 18.9e3_dp ! Specific area, Buhler & Piqueux 2021 |
|---|
| 315 | real(dp) :: as = 9.48e4_dp ! Same as previous but from zent |
|---|
| 316 | real(dp) :: A, B ! Used to compute the mean mass above the surface |
|---|
| 317 | integer(di) :: ig, islope, iloop, it ! For loops |
|---|
| 318 | real(dp), dimension(ngrid,nsoil,nslope) :: dm_co2_regolith_slope ! Elementary mass adsorded per mesh per slope |
|---|
| 319 | logical(k4), dimension(ngrid,nslope) :: ispermanent_co2glaciers ! Check if the co2 glacier is permanent |
|---|
| 320 | logical(k4), dimension(ngrid,nslope) :: ispermanent_h2oglaciers ! Check if the h2o glacier is permanent |
|---|
| 321 | real(dp), dimension(ngrid,index_breccia,nslope) :: deltam_reg_complete ! Difference in the mass per slope and soil layer [kg/m^3] |
|---|
| 322 | real(dp), dimension(ngrid,nslope) :: deltam_reg_slope ! Difference in the mass per slope [kg/m^3] |
|---|
| 323 | real(dp), dimension(ngrid,nsoil,nslope) :: m_h2o_adsorbed ! Density of CO2 adsorbed [kg/m^3] |
|---|
| 324 | real(dp), dimension(ngrid,nsoil,nslope) :: theta_h2o_ads ! Fraction of the pores occupied by H2O molecules |
|---|
| 325 | real(dp), dimension(ngrid) :: delta_mh2o ! Difference density of h2o adsorbed [kg/m^3] |
|---|
| 326 | ! nday array are allocated because heavy... |
|---|
| 327 | real(dp), dimension(:,:), allocatable :: mass_mean ! Mean mass above the surface |
|---|
| 328 | real(dp), dimension(:,:), allocatable :: zplev_mean ! Pressure above the surface |
|---|
| 329 | real(dp), dimension(:,:), allocatable :: pco2 ! Partial pressure above the surface |
|---|
| 330 | real(dp), dimension(:), allocatable :: pco2_avg ! Yearly averaged |
|---|
| [3456] | 331 | |
|---|
| [3991] | 332 | ! CODE |
|---|
| 333 | ! ---- |
|---|
| [2794] | 334 | ! 0. Some initializations |
|---|
| [4065] | 335 | allocate(mass_mean(ngrid,nday),zplev_mean(ngrid,nday),pco2(ngrid,nday),pco2_avg(ngrid)) |
|---|
| 336 | m_h2o_adsorbed = 0._dp |
|---|
| 337 | A = 1._dp/m_co2 - 1._dp/m_noco2 |
|---|
| 338 | B = 1._dp/m_noco2 |
|---|
| 339 | dm_co2_regolith_slope = 0._dp |
|---|
| 340 | delta_co2_ads = 0._dp |
|---|
| [3456] | 341 | ispermanent_h2oglaciers = .false. |
|---|
| 342 | ispermanent_co2glaciers = .false. |
|---|
| [2794] | 343 | |
|---|
| [3961] | 344 | ! 0.1 Look at perennial ice |
|---|
| [4065] | 345 | where (abs(d_h2oice(:,:)) > 1.e-5 .and. h2oice(:,:) > 0._dp) ispermanent_h2oglaciers(:,:) = .true. |
|---|
| 346 | where (abs(d_co2ice(:,:)) > 1.e-5 .and. co2ice(:,:) > 0._dp) ispermanent_co2glaciers(:,:) = .true. |
|---|
| [2985] | 347 | |
|---|
| [3961] | 348 | ! 0.2 Compute the partial pressure of CO2 |
|---|
| 349 | ! a. the molecular mass into the column |
|---|
| 350 | do ig = 1,ngrid |
|---|
| [4065] | 351 | mass_mean(ig,:) = 1._dp/(A*q_co2_ts(ig,:) + B) |
|---|
| 352 | end do |
|---|
| [3961] | 353 | |
|---|
| 354 | ! b. pressure level |
|---|
| [4065] | 355 | do it = 1,nday |
|---|
| [3456] | 356 | do ig = 1,ngrid |
|---|
| [3961] | 357 | zplev_mean(ig,it) = ap(1) + bp(1)*ps(ig,it) |
|---|
| [4065] | 358 | end do |
|---|
| 359 | end do |
|---|
| [2794] | 360 | |
|---|
| [3961] | 361 | ! c. Vapor pressure |
|---|
| [4065] | 362 | pco2 = mass_mean/m_co2*q_co2_ts*zplev_mean |
|---|
| 363 | pco2_avg(:) = sum(pco2(:,:),2)/nday |
|---|
| [2794] | 364 | |
|---|
| [3961] | 365 | deallocate(zplev_mean,mass_mean,pco2) |
|---|
| [2794] | 366 | |
|---|
| [3961] | 367 | ! 1. Compute the fraction of the pores occupied by H2O |
|---|
| [4065] | 368 | call evolve_h2o_ads(d_h2oice,d_co2ice,h2oice,co2ice,ps,q_co2_ts,q_h2o_ts,tsoil,TI,theta_h2o_ads,m_h2o_adsorbed,delta_mh2o) |
|---|
| [2794] | 369 | |
|---|
| [3961] | 370 | ! 2. we compute the mass of co2 adsorded in each layer of the meshes |
|---|
| 371 | do ig = 1,ngrid |
|---|
| 372 | do islope = 1,nslope |
|---|
| 373 | do iloop = 1,index_breccia |
|---|
| [4065] | 374 | if (TI(ig,iloop,islope) < inertie_thresold .and. .not. ispermanent_h2oglaciers(ig,islope) .and. .not. ispermanent_co2glaciers(ig,islope)) then |
|---|
| 375 | dm_co2_regolith_slope(ig,iloop,islope) = as*rho_regolith*m_theta*(1._dp - theta_h2o_ads(ig,iloop,islope))*alpha*pco2_avg(ig)/ & |
|---|
| 376 | (alpha*pco2_avg(ig) + sqrt(tsoil(ig,iloop,islope))*exp(beta/tsoil(ig,iloop,islope))) |
|---|
| [3961] | 377 | else |
|---|
| [4065] | 378 | if (abs(co2_ads_reg(ig,iloop,islope)) < minieps) then !!! we are at first call |
|---|
| 379 | dm_co2_regolith_slope(ig,iloop,islope) = as*rho_regolith*m_theta*(1._dp - theta_h2o_ads(ig,iloop,islope))*alpha*pco2_avg(ig) & |
|---|
| 380 | /(alpha*pco2_avg(ig)+sqrt(tsoil(ig,iloop,islope))*exp(beta/tsoil(ig,iloop,islope))) |
|---|
| [3961] | 381 | else ! no change: permanent ice stick the atoms of CO2 |
|---|
| [4065] | 382 | dm_co2_regolith_slope(ig,iloop,islope) = co2_ads_reg(ig,iloop,islope) |
|---|
| 383 | end if |
|---|
| 384 | end if |
|---|
| 385 | end do |
|---|
| 386 | end do |
|---|
| 387 | end do |
|---|
| [2794] | 388 | |
|---|
| [3961] | 389 | ! 3. Check the exchange between the atmosphere and the regolith |
|---|
| 390 | do ig = 1,ngrid |
|---|
| [4065] | 391 | delta_co2_ads(ig) = 0._dp |
|---|
| [3961] | 392 | do islope = 1,nslope |
|---|
| [4065] | 393 | deltam_reg_slope(ig,islope) = 0._dp |
|---|
| [3961] | 394 | do iloop = 1,index_breccia |
|---|
| [4065] | 395 | if (TI(ig,iloop,islope) < inertie_thresold .and. .not. ispermanent_h2oglaciers(ig,islope) .and. .not. ispermanent_co2glaciers(ig,islope)) then |
|---|
| [3961] | 396 | if (iloop == 1) then |
|---|
| [4065] | 397 | deltam_reg_complete(ig,iloop,islope) = (dm_co2_regolith_slope(ig,iloop,islope) - co2_ads_reg(ig,iloop,islope))*(layer(iloop)) |
|---|
| [3961] | 398 | else |
|---|
| [4065] | 399 | deltam_reg_complete(ig,iloop,islope) = (dm_co2_regolith_slope(ig,iloop,islope) - co2_ads_reg(ig,iloop,islope))*(layer(iloop) - layer(iloop - 1)) |
|---|
| 400 | end if |
|---|
| [3961] | 401 | else ! NO EXCHANGE AS ICE BLOCK THE DYNAMIC! |
|---|
| [4065] | 402 | deltam_reg_complete(ig,iloop,islope) = 0._dp |
|---|
| 403 | end if |
|---|
| [3961] | 404 | deltam_reg_slope(ig,islope) = deltam_reg_slope(ig,islope) + deltam_reg_complete(ig,iloop,islope) |
|---|
| [4065] | 405 | end do |
|---|
| 406 | delta_co2_ads(ig) = delta_co2_ads(ig) + deltam_reg_slope(ig,islope)*subslope_dist(ig,islope)/cos(pi*def_slope_mean(islope)/180._dp) |
|---|
| 407 | end do |
|---|
| 408 | end do |
|---|
| 409 | co2_ads_reg = dm_co2_regolith_slope |
|---|
| [2794] | 410 | |
|---|
| [4065] | 411 | END SUBROUTINE evolve_co2_ads |
|---|
| [3991] | 412 | !======================================================================= |
|---|
| [2794] | 413 | |
|---|
| [4065] | 414 | !======================================================================= |
|---|
| 415 | SUBROUTINE compute_totmass_adsorbed(h2o_ads_reg,co2_ads_reg,totmass_adsco2,totmass_adsh2o) |
|---|
| 416 | !----------------------------------------------------------------------- |
|---|
| 417 | ! NAME |
|---|
| 418 | ! compute_totmass_adsorbed |
|---|
| 419 | ! |
|---|
| 420 | ! DESCRIPTION |
|---|
| 421 | ! Compute the total mass of CO2 and H2O adsorbed in the regolith. |
|---|
| 422 | ! |
|---|
| 423 | ! AUTHORS & DATE |
|---|
| 424 | ! L. Lange, 2023 |
|---|
| 425 | ! JB Clement, 12/2025 |
|---|
| 426 | ! C. Metz, 02/2026 |
|---|
| 427 | ! |
|---|
| 428 | ! NOTES |
|---|
| 429 | ! |
|---|
| 430 | !----------------------------------------------------------------------- |
|---|
| 431 | |
|---|
| 432 | ! DEPENDENCIES |
|---|
| 433 | ! ------------ |
|---|
| 434 | use geometry, only: ngrid, nslope, nsoil, cell_area |
|---|
| 435 | use slopes, only: subslope_dist, def_slope_mean |
|---|
| 436 | use soil, only: layer |
|---|
| 437 | use maths, only: pi |
|---|
| 438 | use display, only: print_msg |
|---|
| 439 | use utility, only: real2str |
|---|
| 440 | |
|---|
| 441 | ! DECLARATION |
|---|
| 442 | ! ----------- |
|---|
| 443 | implicit none |
|---|
| 444 | |
|---|
| 445 | ! ARGUMENTS |
|---|
| 446 | ! --------- |
|---|
| 447 | real(dp), dimension(:,:,:), intent(in) :: h2o_ads_reg, co2_ads_reg |
|---|
| 448 | real(qp), intent(out) :: totmass_adsco2, totmass_adsh2o |
|---|
| 449 | |
|---|
| 450 | ! LOCAL VARIABLES |
|---|
| 451 | ! --------------- |
|---|
| 452 | integer(di) :: i, islope, l |
|---|
| 453 | real(dp) :: thickness, slope_corr |
|---|
| 454 | |
|---|
| 455 | ! CODE |
|---|
| 456 | ! ---- |
|---|
| 457 | totmass_adsco2 = 0._qp |
|---|
| 458 | totmass_adsh2o = 0._qp |
|---|
| 459 | do i = 1,ngrid |
|---|
| 460 | do islope = 1,nslope |
|---|
| 461 | slope_corr = subslope_dist(i,islope)/cos(pi*def_slope_mean(islope)/180._dp) |
|---|
| 462 | do l = 1,nsoil |
|---|
| 463 | if (l == 1) then |
|---|
| 464 | thickness = layer(l) |
|---|
| 465 | else |
|---|
| 466 | thickness = layer(l) - layer(l-1) |
|---|
| 467 | end if |
|---|
| 468 | totmass_adsco2 = totmass_adsco2 + co2_ads_reg(i,l,islope)*thickness*slope_corr*cell_area(i) |
|---|
| 469 | totmass_adsh2o = totmass_adsh2o + h2o_ads_reg(i,l,islope)*thickness*slope_corr*cell_area(i) |
|---|
| 470 | end do |
|---|
| 471 | end do |
|---|
| 472 | end do |
|---|
| 473 | call print_msg("Total mass of CO2 adsorbed in the regolith [kg] = "//real2str(totmass_adsco2)) |
|---|
| 474 | call print_msg("Total mass of H2O adsorbed in the regolith [kg] = "//real2str(totmass_adsh2o)) |
|---|
| 475 | |
|---|
| 476 | END SUBROUTINE compute_totmass_adsorbed |
|---|
| 477 | !======================================================================= |
|---|
| 478 | |
|---|
| [3989] | 479 | END MODULE sorption |
|---|