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