[3456] | 1 | MODULE adsorption_mod |
---|
[3082] | 2 | |
---|
[3456] | 3 | implicit none |
---|
[3082] | 4 | |
---|
[3456] | 5 | logical :: adsorption_pem ! True by default, to compute adsorption/desorption. Read in pem.def |
---|
| 6 | real, save, allocatable, dimension(:,:,:) :: co2_adsorbded_phys ! co2 that is in the regolith [kg/m^2] |
---|
| 7 | real, save, allocatable, dimension(:,:,:) :: h2o_adsorbded_phys ! h2o that is in the regolith [kg/m^2] |
---|
[3082] | 8 | |
---|
[3456] | 9 | !======================================================================= |
---|
| 10 | contains |
---|
| 11 | !======================================================================= |
---|
[2794] | 12 | |
---|
[2863] | 13 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
---|
| 14 | !!! |
---|
| 15 | !!! Purpose: Compute CO2 and H2O adsorption, following the methods from Zent & Quinn 1995, Jackosky et al., 1997 |
---|
| 16 | !!! |
---|
| 17 | !!! Author: LL, 01/2023 |
---|
| 18 | !!! |
---|
| 19 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
---|
[3456] | 20 | SUBROUTINE ini_adsorption_h_PEM(ngrid,nslope,nsoilmx_PEM) |
---|
[2888] | 21 | |
---|
[3456] | 22 | implicit none |
---|
[2888] | 23 | |
---|
[3456] | 24 | integer, intent(in) :: ngrid ! number of atmospheric columns |
---|
| 25 | integer, intent(in) :: nslope ! number of slope within a mesh |
---|
| 26 | integer, intent(in) :: nsoilmx_PEM ! number of soil layer in the PEM |
---|
[2980] | 27 | |
---|
[3456] | 28 | allocate(co2_adsorbded_phys(ngrid,nsoilmx_PEM,nslope)) |
---|
| 29 | allocate(h2o_adsorbded_phys(ngrid,nsoilmx_PEM,nslope)) |
---|
[2888] | 30 | |
---|
[3456] | 31 | END SUBROUTINE ini_adsorption_h_PEM |
---|
[2888] | 32 | |
---|
[3456] | 33 | !======================================================================= |
---|
| 34 | SUBROUTINE end_adsorption_h_PEM |
---|
[2888] | 35 | |
---|
[3456] | 36 | if (allocated(co2_adsorbded_phys)) deallocate(co2_adsorbded_phys) |
---|
| 37 | if (allocated(h2o_adsorbded_phys)) deallocate(h2o_adsorbded_phys) |
---|
[2985] | 38 | |
---|
[3456] | 39 | END SUBROUTINE end_adsorption_h_PEM |
---|
[2863] | 40 | |
---|
[3456] | 41 | !======================================================================= |
---|
[3498] | 42 | SUBROUTINE regolith_adsorption(ngrid,nslope,nsoil_PEM,timelen,d_h2oglaciers,d_co2glaciers,waterice,co2ice,tsoil_PEM,TI_PEM,ps,q_co2,q_h2o, & |
---|
[3456] | 43 | m_h2o_completesoil,delta_mh2oreg, m_co2_completesoil,delta_mco2reg) |
---|
[2863] | 44 | |
---|
[3456] | 45 | implicit none |
---|
[2863] | 46 | |
---|
[3456] | 47 | ! Inputs |
---|
| 48 | integer, intent(in) :: ngrid, nslope, nsoil_PEM, timelen ! size dimension: physics x subslope x soil x timeseries |
---|
[3498] | 49 | real, dimension(ngrid,nslope), intent(in) :: d_h2oglaciers, d_co2glaciers ! tendancies on the glaciers [1] |
---|
[3456] | 50 | real, dimension(ngrid,nslope), intent(in) :: waterice ! water ice at the surface [kg/m^2] |
---|
| 51 | real, dimension(ngrid,nslope), intent(in) :: co2ice ! co2 ice at the surface [kg/m^2] |
---|
| 52 | real, dimension(ngrid,nsoil_PEM,nslope), intent(in) :: TI_PEM ! Soil Thermal inertia (J/K/^2/s^1/2) |
---|
| 53 | real, dimension(ngrid,nsoil_PEM,nslope), intent(in) :: tsoil_PEM ! Soil temperature (K) |
---|
| 54 | real, dimension(ngrid,timelen), intent(in) :: ps ! Average surface pressure [Pa] |
---|
| 55 | real, dimension(ngrid,timelen), intent(in) :: q_co2 ! Mass mixing ratio of co2 in the first layer (kg/kg) |
---|
| 56 | real, dimension(ngrid,timelen), intent(in) :: q_h2o ! Mass mixing ratio of H2o in the first layer (kg/kg) |
---|
[2985] | 57 | |
---|
[3456] | 58 | ! Outputs |
---|
| 59 | real, dimension(ngrid), intent(out) :: delta_mh2oreg ! Difference density of h2o adsorbed (kg/m^3) |
---|
| 60 | real, dimension(ngrid), intent(out) :: delta_mco2reg ! Difference density of co2 adsorbed (kg/m^3) |
---|
| 61 | real, dimension(ngrid,nsoil_PEM,nslope), intent(inout) :: m_co2_completesoil ! Density of co2 adsorbed (kg/m^3) |
---|
| 62 | real, dimension(ngrid,nsoil_PEM,nslope), intent(inout) :: m_h2o_completesoil ! Density of h2o adsorbed (kg/m^3) |
---|
| 63 | |
---|
| 64 | ! Local variables |
---|
| 65 | real, dimension(ngrid,nsoil_PEM,nslope) :: theta_h2o_adsorbded ! Fraction of the pores occupied by H2O molecules |
---|
| 66 | ! ------------- |
---|
[2863] | 67 | ! Compute H2O adsorption, then CO2 adsorption |
---|
[3498] | 68 | call regolith_h2oadsorption(ngrid,nslope,nsoil_PEM,timelen,d_h2oglaciers,d_co2glaciers,waterice,co2ice,ps,q_co2,q_h2o,tsoil_PEM,TI_PEM, & |
---|
[3456] | 69 | theta_h2o_adsorbded,m_h2o_completesoil,delta_mh2oreg) |
---|
[3498] | 70 | call regolith_co2adsorption(ngrid,nslope,nsoil_PEM,timelen,d_h2oglaciers,d_co2glaciers,waterice,co2ice,ps,q_co2,q_h2o, & |
---|
[3456] | 71 | tsoil_PEM,TI_PEM,m_co2_completesoil,delta_mco2reg) |
---|
[2863] | 72 | |
---|
[3456] | 73 | END SUBROUTINE |
---|
[2863] | 74 | |
---|
[3456] | 75 | !======================================================================= |
---|
[3498] | 76 | SUBROUTINE regolith_h2oadsorption(ngrid,nslope,nsoil_PEM,timelen,d_h2oglaciers,d_co2glaciers,waterice,co2ice,ps,q_co2,q_h2o,tsoil_PEM,TI_PEM, & |
---|
[3456] | 77 | theta_h2o_adsorbded,m_h2o_completesoil,delta_mreg) |
---|
[2863] | 78 | |
---|
| 79 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
---|
| 80 | !!! |
---|
| 81 | !!! Purpose: Compute H2O adsorption, following the methods from Jackosky et al., 1997 |
---|
| 82 | !!! |
---|
| 83 | !!! Author: LL, 01/2023 |
---|
| 84 | !!! |
---|
| 85 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
---|
| 86 | |
---|
[3206] | 87 | use comsoil_h_PEM, only: layer_PEM, index_breccia |
---|
| 88 | use comslope_mod, only: subslope_dist, def_slope_mean |
---|
[3456] | 89 | use vertical_layers_mod, only: ap, bp |
---|
[3206] | 90 | use constants_marspem_mod, only: alpha_clap_h2o, beta_clap_h2o, m_h2o, m_co2,m_noco2, rho_regolith |
---|
| 91 | |
---|
[3082] | 92 | #ifndef CPP_STD |
---|
| 93 | use comcstfi_h, only: pi |
---|
| 94 | #else |
---|
| 95 | use comcstfi_mod, only: pi |
---|
| 96 | #endif |
---|
[2863] | 97 | |
---|
[3456] | 98 | implicit none |
---|
[2794] | 99 | |
---|
[3456] | 100 | ! Inputs |
---|
| 101 | integer, intent(in) :: ngrid, nslope, nsoil_PEM,timelen ! Size dimension |
---|
[3498] | 102 | real, dimension(ngrid,nslope), intent(in) :: d_h2oglaciers, d_co2glaciers ! Tendencies on the glaciers () |
---|
[3456] | 103 | real, dimension(ngrid,nslope), intent(in) :: waterice ! Water ice at the surface [kg/m^2] |
---|
| 104 | real, dimension(ngrid,nslope), intent(in) :: co2ice ! CO2 ice at the surface [kg/m^2] |
---|
| 105 | real, dimension(ngrid,timelen), intent(in) :: ps ! Surface pressure (Pa) |
---|
| 106 | real, dimension(ngrid,timelen), intent(in) :: q_co2 ! Mass mixing ratio of co2 in the first layer (kg/kg) |
---|
| 107 | real, dimension(ngrid,timelen), intent(in) :: q_h2o ! Mass mixing ratio of H2o in the first layer (kg/kg) |
---|
| 108 | real, dimension(ngrid,nsoil_PEM,nslope), intent(in) :: TI_PEM ! Soil Thermal inertia (J/K/^2/s^1/2) |
---|
| 109 | real, dimension(ngrid,nsoil_PEM,nslope), intent(in) :: tsoil_PEM ! Soil temperature (K) |
---|
[2794] | 110 | |
---|
[3456] | 111 | ! Outputs |
---|
| 112 | real, dimension(ngrid,nsoil_PEM,nslope), intent(inout) :: m_h2o_completesoil ! Density of h2o adsorbed (kg/m^3)(ngrid,nsoil_PEM,nslope) |
---|
| 113 | real, dimension(ngrid,nsoil_PEM,nslope), intent(out) :: theta_h2o_adsorbded ! Fraction of the pores occupied by H2O molecules |
---|
| 114 | real, dimension(ngrid), intent(out) :: delta_mreg ! Difference density of h2o adsorbed (kg/m^3) |
---|
[2944] | 115 | |
---|
[3456] | 116 | ! Constants |
---|
| 117 | real :: Ko = 1.57e-8 ! Jackosky et al. 1997 |
---|
| 118 | real :: e = 2573.9 ! Jackosky et al. 1997 |
---|
| 119 | real :: mu = 0.48 ! Jackosky et al. 1997 |
---|
| 120 | real :: m_theta = 2.84e-7 ! Mass of h2o per m^2 absorbed Jackosky et al. 1997 |
---|
| 121 | ! real :: as = 18.9e3 ! Specific area, Buhler & Piqueux 2021 |
---|
| 122 | real :: as = 9.48e4 ! Specific area, Zent |
---|
| 123 | real :: inertie_thresold = 800. ! TI > 800 means cementation |
---|
[2794] | 124 | |
---|
[3456] | 125 | ! Local variables |
---|
| 126 | real, dimension(ngrid,index_breccia,nslope) :: deltam_reg_complete ! Difference in the mass per slope and soil layer (kg/m^3) |
---|
| 127 | real :: K ! Used to compute theta |
---|
| 128 | integer :: ig, iloop, islope, it ! For loops |
---|
| 129 | logical, dimension(ngrid,nslope) :: ispermanent_co2glaciers ! Check if the co2 glacier is permanent |
---|
| 130 | logical, dimension(ngrid,nslope) :: ispermanent_h2oglaciers ! Check if the h2o glacier is permanent |
---|
| 131 | real, dimension(ngrid,nslope) :: deltam_reg_slope ! Difference density of h2o adsorbed per slope (kg/m^3) |
---|
| 132 | real, dimension(ngrid,nsoil_PEM,nslope) :: dm_h2o_regolith_slope ! Elementary h2o mass adsorded per mesh per slope |
---|
| 133 | real :: A, B ! Used to compute the mean mass above the surface |
---|
| 134 | real :: p_sat ! Saturated vapor pressure of ice |
---|
| 135 | real, dimension(:,:), allocatable :: mass_mean ! Mean mass above the surface |
---|
| 136 | real, dimension(:,:), allocatable :: zplev_mean ! Pressure above the surface |
---|
| 137 | real, dimension(:,:), allocatable :: pvapor ! Partial pressure above the surface |
---|
| 138 | real, dimension(:) , allocatable :: pvapor_avg ! Yearly averaged |
---|
| 139 | |
---|
[2794] | 140 | ! 0. Some initializations |
---|
[3456] | 141 | allocate(mass_mean(ngrid,timelen),zplev_mean(ngrid,timelen),pvapor(ngrid,timelen),pvapor_avg(ngrid)) |
---|
| 142 | A = 1./m_co2 - 1./m_noco2 |
---|
| 143 | B = 1./m_noco2 |
---|
| 144 | theta_h2o_adsorbded = 0. |
---|
| 145 | dm_h2o_regolith_slope = 0. |
---|
| 146 | ispermanent_h2oglaciers = .false. |
---|
| 147 | ispermanent_co2glaciers = .false. |
---|
[2794] | 148 | |
---|
[2985] | 149 | #ifndef CPP_STD |
---|
[3456] | 150 | ! 0.1 Look at perennial ice |
---|
| 151 | do ig = 1,ngrid |
---|
| 152 | do islope = 1,nslope |
---|
[3498] | 153 | if (abs(d_h2oglaciers(ig,islope)) > 1.e-5 .and. abs(waterice(ig,islope)) > 0.) ispermanent_h2oglaciers(ig,islope) = .true. |
---|
| 154 | if (abs(d_co2glaciers(ig,islope)) > 1.e-5 .and. abs(co2ice(ig,islope)) > 0.) ispermanent_co2glaciers(ig,islope) = .true. |
---|
[3456] | 155 | enddo |
---|
| 156 | enddo |
---|
[2985] | 157 | |
---|
[3456] | 158 | ! 0.2 Compute the partial pressure of vapor |
---|
| 159 | ! a. the molecular mass into the column |
---|
| 160 | do ig = 1,ngrid |
---|
| 161 | mass_mean(ig,:) = 1/(A*q_co2(ig,:) + B) |
---|
| 162 | enddo |
---|
[2842] | 163 | |
---|
[3456] | 164 | ! b. pressure level |
---|
| 165 | do it = 1,timelen |
---|
| 166 | do ig = 1,ngrid |
---|
| 167 | zplev_mean(ig,it) = ap(1) + bp(1)*ps(ig,it) |
---|
| 168 | enddo |
---|
[2863] | 169 | enddo |
---|
[2842] | 170 | |
---|
[3456] | 171 | ! c. Vapor pressure |
---|
| 172 | pvapor = mass_mean/m_h2o*q_h2o*zplev_mean |
---|
| 173 | pvapor_avg = sum(pvapor,2)/timelen |
---|
| 174 | #endif |
---|
| 175 | deallocate(pvapor,zplev_mean,mass_mean) |
---|
[2794] | 176 | |
---|
[2985] | 177 | #ifndef CPP_STD |
---|
[3456] | 178 | ! 1. we compute the mass of H2O adsorded in each layer of the meshes |
---|
| 179 | do ig = 1,ngrid |
---|
| 180 | do islope = 1,nslope |
---|
| 181 | do iloop = 1,index_breccia |
---|
| 182 | K = Ko*exp(e/tsoil_PEM(ig,iloop,islope)) |
---|
| 183 | if (TI_PEM(ig,iloop,islope) < inertie_thresold) then |
---|
| 184 | theta_h2o_adsorbded(ig,iloop,islope) = (K*pvapor_avg(ig)/(1. + K*pvapor_avg(ig)))**mu |
---|
| 185 | else |
---|
| 186 | p_sat = exp(beta_clap_h2o/tsoil_PEM(ig,iloop,islope) + alpha_clap_h2o) ! we assume fixed temperature in the ice ... not really good but ... |
---|
| 187 | theta_h2o_adsorbded(ig,iloop,islope) = (K*p_sat/(1. + K*p_sat))**mu |
---|
| 188 | endif |
---|
| 189 | dm_h2o_regolith_slope(ig,iloop,islope) = as*theta_h2o_adsorbded(ig,iloop,islope)*m_theta*rho_regolith |
---|
| 190 | enddo |
---|
| 191 | enddo |
---|
| 192 | enddo |
---|
[2794] | 193 | |
---|
[3456] | 194 | ! 2. Check the exchange between the atmosphere and the regolith |
---|
| 195 | do ig = 1,ngrid |
---|
| 196 | delta_mreg(ig) = 0. |
---|
| 197 | do islope = 1,nslope |
---|
| 198 | deltam_reg_slope(ig,islope) = 0. |
---|
| 199 | do iloop = 1,index_breccia |
---|
| 200 | if (TI_PEM(ig,iloop,islope) < inertie_thresold .and. .not. ispermanent_h2oglaciers(ig,islope) .and. .not. ispermanent_co2glaciers(ig,islope)) then |
---|
| 201 | if (iloop == 1) then |
---|
| 202 | deltam_reg_complete(ig,iloop,islope) = (dm_h2o_regolith_slope(ig,iloop,islope) - m_h2o_completesoil(ig,iloop,islope))*(layer_PEM(iloop)) |
---|
| 203 | else |
---|
| 204 | deltam_reg_complete(ig,iloop,islope) = (dm_h2o_regolith_slope(ig,iloop,islope) - m_h2o_completesoil(ig,iloop,islope))*(layer_PEM(iloop) - layer_PEM(iloop - 1)) |
---|
| 205 | endif |
---|
| 206 | else ! NO EXCHANGE AS ICE BLOCK THE DYNAMIC! |
---|
| 207 | deltam_reg_complete(ig,iloop,islope) = 0. |
---|
| 208 | endif |
---|
| 209 | deltam_reg_slope(ig,islope) = deltam_reg_slope(ig,islope) + deltam_reg_complete(ig,iloop,islope) |
---|
| 210 | enddo |
---|
| 211 | delta_mreg(ig) = delta_mreg(ig) + deltam_reg_slope(ig,islope)*subslope_dist(ig,islope)/cos(pi*def_slope_mean(islope)/180.) |
---|
| 212 | enddo |
---|
[2863] | 213 | enddo |
---|
[3456] | 214 | m_h2o_completesoil = dm_h2o_regolith_slope |
---|
[2842] | 215 | #endif |
---|
[3456] | 216 | END SUBROUTINE |
---|
[2794] | 217 | |
---|
[3456] | 218 | !======================================================================= |
---|
[2863] | 219 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
---|
| 220 | !!! |
---|
| 221 | !!! Purpose: Compute CO2 following the methods from Zent & Quinn 1995 |
---|
| 222 | !!! |
---|
| 223 | !!! Author: LL, 01/2023 |
---|
| 224 | !!! |
---|
| 225 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
---|
[3498] | 226 | SUBROUTINE regolith_co2adsorption(ngrid,nslope,nsoil_PEM,timelen,d_h2oglaciers,d_co2glaciers,waterice,co2ice,ps,q_co2,q_h2o,tsoil_PEM,TI_PEM,m_co2_completesoil,delta_mreg) |
---|
[2863] | 227 | |
---|
[3206] | 228 | use comsoil_h_PEM, only: layer_PEM, index_breccia, index_breccia |
---|
| 229 | use comslope_mod, only: subslope_dist, def_slope_mean |
---|
| 230 | use vertical_layers_mod, only: ap, bp |
---|
| 231 | use constants_marspem_mod, only: m_co2, m_noco2, rho_regolith |
---|
| 232 | |
---|
[3082] | 233 | #ifndef CPP_STD |
---|
| 234 | use comcstfi_h, only: pi |
---|
| 235 | #else |
---|
| 236 | use comcstfi_mod, only: pi |
---|
| 237 | #endif |
---|
[2794] | 238 | |
---|
[3456] | 239 | implicit none |
---|
[2794] | 240 | |
---|
[3456] | 241 | ! Inputs: |
---|
| 242 | integer, intent(in) :: ngrid, nslope, nsoil_PEM,timelen ! Size dimension |
---|
| 243 | real, dimension(ngrid,timelen), intent(in) :: ps ! Average surface pressure [Pa] |
---|
| 244 | real, dimension(ngrid,nsoil_PEM,nslope), intent(in) :: tsoil_PEM ! Mean Soil Temperature [K] |
---|
| 245 | real, dimension(ngrid,nsoil_PEM,nslope), intent(in) :: TI_PEM ! Mean Thermal Inertia [USI] |
---|
[3498] | 246 | real, dimension(ngrid,nslope), intent(in) :: d_h2oglaciers, d_co2glaciers ! Tendencies on the glaciers () |
---|
[3456] | 247 | real, dimension(ngrid,timelen), intent(in) :: q_co2, q_h2o ! Mass mixing ratio of co2 and h2o in the first layer (kg/kg) |
---|
| 248 | real, dimension(ngrid,nslope), intent(in) :: waterice ! Water ice at the surface [kg/m^2] |
---|
| 249 | real, dimension(ngrid,nslope), intent(in) :: co2ice ! CO2 ice at the surface [kg/m^2] |
---|
| 250 | |
---|
[2794] | 251 | ! Outputs: |
---|
[3456] | 252 | real, dimension(ngrid,nsoil_PEM,nslope), intent(inout) :: m_co2_completesoil ! Density of co2 adsorbed (kg/m^3) |
---|
| 253 | real, dimension(ngrid), intent(out) :: delta_mreg ! Difference density of co2 adsorbed (kg/m^3) |
---|
| 254 | |
---|
[2794] | 255 | ! Constants: |
---|
[3456] | 256 | real :: alpha = 7.512e-6 ! Zent & Quinn 1995 |
---|
| 257 | real :: beta = -1541.5 ! Zent & Quinn 1995 |
---|
| 258 | real :: inertie_thresold = 800. ! TI > 800 means cementation |
---|
| 259 | real :: m_theta = 4.27e-7 ! Mass of co2 per m^2 absorbed |
---|
[3206] | 260 | ! real :: as = 18.9e3 ! Specific area, Buhler & Piqueux 2021 |
---|
[3456] | 261 | real :: as = 9.48e4 ! Same as previous but from zent |
---|
[2794] | 262 | |
---|
[3456] | 263 | ! Local |
---|
| 264 | real :: A, B ! Used to compute the mean mass above the surface |
---|
| 265 | integer :: ig, islope, iloop, it ! For loops |
---|
| 266 | real, dimension(ngrid,nsoil_PEM,nslope) :: dm_co2_regolith_slope ! Elementary mass adsorded per mesh per slope |
---|
| 267 | logical, dimension(ngrid,nslope) :: ispermanent_co2glaciers ! Check if the co2 glacier is permanent |
---|
| 268 | logical, dimension(ngrid,nslope) :: ispermanent_h2oglaciers ! Check if the h2o glacier is permanent |
---|
| 269 | real, dimension(ngrid,index_breccia,nslope) :: deltam_reg_complete ! Difference in the mass per slope and soil layer (kg/m^3) |
---|
| 270 | real, dimension(ngrid,nslope) :: deltam_reg_slope ! Difference in the mass per slope (kg/m^3) |
---|
| 271 | real, dimension(ngrid,nsoil_PEM,nslope) :: m_h2o_adsorbed ! Density of CO2 adsorbed (kg/m^3) |
---|
| 272 | real, dimension(ngrid,nsoil_PEM,nslope) :: theta_h2o_adsorbed ! Fraction of the pores occupied by H2O molecules |
---|
| 273 | real, dimension(ngrid) :: delta_mh2o ! Difference density of h2o adsorbed (kg/m^3) |
---|
| 274 | ! timelen array are allocated because heavy... |
---|
| 275 | real, dimension(:,:), allocatable :: mass_mean ! Mean mass above the surface |
---|
| 276 | real, dimension(:,:), allocatable :: zplev_mean ! Pressure above the surface |
---|
| 277 | real, dimension(:,:), allocatable :: pco2 ! Partial pressure above the surface |
---|
| 278 | real, dimension(:), allocatable :: pco2_avg ! Yearly averaged |
---|
| 279 | |
---|
[2794] | 280 | ! 0. Some initializations |
---|
[3456] | 281 | allocate(mass_mean(ngrid,timelen),zplev_mean(ngrid,timelen),pco2(ngrid,timelen),pco2_avg(ngrid)) |
---|
| 282 | m_h2o_adsorbed = 0. |
---|
| 283 | A = 1./m_co2 - 1./m_noco2 |
---|
| 284 | B = 1./m_noco2 |
---|
| 285 | dm_co2_regolith_slope = 0. |
---|
| 286 | delta_mreg = 0. |
---|
| 287 | ispermanent_h2oglaciers = .false. |
---|
| 288 | ispermanent_co2glaciers = .false. |
---|
[2794] | 289 | |
---|
[2985] | 290 | #ifndef CPP_STD |
---|
[3456] | 291 | ! 0.1 Look at perennial ice |
---|
| 292 | do ig = 1,ngrid |
---|
| 293 | do islope = 1,nslope |
---|
[3498] | 294 | if (abs(d_h2oglaciers(ig,islope)) > 1.e-5 .and. abs(waterice(ig,islope)) > 0.) ispermanent_h2oglaciers(ig,islope) = .true. |
---|
| 295 | if (abs(d_co2glaciers(ig,islope)) > 1.e-5 .and. abs(co2ice(ig,islope)) > 0.) ispermanent_co2glaciers(ig,islope) = .true. |
---|
[3456] | 296 | enddo |
---|
| 297 | enddo |
---|
[2985] | 298 | |
---|
[3456] | 299 | ! 0.2 Compute the partial pressure of CO2 |
---|
| 300 | ! a. the molecular mass into the column |
---|
| 301 | do ig = 1,ngrid |
---|
| 302 | mass_mean(ig,:) = 1./(A*q_co2(ig,:) + B) |
---|
| 303 | enddo |
---|
[2794] | 304 | |
---|
[3456] | 305 | ! b. pressure level |
---|
| 306 | do it = 1,timelen |
---|
| 307 | do ig = 1,ngrid |
---|
| 308 | zplev_mean(ig,it) = ap(1) + bp(1)*ps(ig,it) |
---|
| 309 | enddo |
---|
[2794] | 310 | enddo |
---|
| 311 | |
---|
[3456] | 312 | ! c. Vapor pressure |
---|
| 313 | pco2 = mass_mean/m_co2*q_co2*zplev_mean |
---|
| 314 | pco2_avg(:) = sum(pco2(:,:),2)/timelen |
---|
[2794] | 315 | |
---|
[3456] | 316 | deallocate(zplev_mean,mass_mean,pco2) |
---|
[2794] | 317 | |
---|
[3456] | 318 | ! 1. Compute the fraction of the pores occupied by H2O |
---|
[3498] | 319 | call regolith_h2oadsorption(ngrid,nslope,nsoil_PEM,timelen,d_h2oglaciers,d_co2glaciers,waterice,co2ice,ps,q_co2,q_h2o,tsoil_PEM,TI_PEM, & |
---|
[3456] | 320 | theta_h2o_adsorbed, m_h2o_adsorbed,delta_mh2o) |
---|
[2794] | 321 | |
---|
[3456] | 322 | ! 2. we compute the mass of co2 adsorded in each layer of the meshes |
---|
| 323 | do ig = 1,ngrid |
---|
| 324 | do islope = 1,nslope |
---|
| 325 | do iloop = 1,index_breccia |
---|
| 326 | if (TI_PEM(ig,iloop,islope) < inertie_thresold .and. .not. ispermanent_h2oglaciers(ig,islope) .and. .not. ispermanent_co2glaciers(ig,islope)) then |
---|
| 327 | dm_co2_regolith_slope(ig,iloop,islope) = as*rho_regolith*m_theta*(1. - theta_h2o_adsorbed(ig,iloop,islope))*alpha*pco2_avg(ig)/ & |
---|
| 328 | (alpha*pco2_avg(ig) + sqrt(tsoil_PEM(ig,iloop,islope))*exp(beta/tsoil_PEM(ig,iloop,islope))) |
---|
| 329 | else |
---|
| 330 | if (abs(m_co2_completesoil(ig,iloop,islope)) < 1.e-10) then !!! we are at first call |
---|
| 331 | dm_co2_regolith_slope(ig,iloop,islope) = as*rho_regolith*m_theta*(1. - theta_h2o_adsorbed(ig,iloop,islope))*alpha*pco2_avg(ig) & |
---|
| 332 | /(alpha*pco2_avg(ig)+sqrt(tsoil_PEM(ig,iloop,islope))*exp(beta/tsoil_PEM(ig,iloop,islope))) |
---|
| 333 | else ! no change: permanent ice stick the atoms of CO2 |
---|
| 334 | dm_co2_regolith_slope(ig,iloop,islope) = m_co2_completesoil(ig,iloop,islope) |
---|
| 335 | endif |
---|
| 336 | endif |
---|
| 337 | enddo |
---|
| 338 | enddo |
---|
[2895] | 339 | enddo |
---|
[2794] | 340 | |
---|
[3456] | 341 | ! 3. Check the exchange between the atmosphere and the regolith |
---|
| 342 | do ig = 1,ngrid |
---|
| 343 | delta_mreg(ig) = 0. |
---|
| 344 | do islope = 1,nslope |
---|
| 345 | deltam_reg_slope(ig,islope) = 0. |
---|
| 346 | do iloop = 1,index_breccia |
---|
| 347 | if (TI_PEM(ig,iloop,islope) < inertie_thresold .and. .not. ispermanent_h2oglaciers(ig,islope) .and. .not. ispermanent_co2glaciers(ig,islope)) then |
---|
| 348 | if (iloop == 1) then |
---|
| 349 | deltam_reg_complete(ig,iloop,islope) = (dm_co2_regolith_slope(ig,iloop,islope) - m_co2_completesoil(ig,iloop,islope))*(layer_PEM(iloop)) |
---|
| 350 | else |
---|
| 351 | deltam_reg_complete(ig,iloop,islope) = (dm_co2_regolith_slope(ig,iloop,islope) - m_co2_completesoil(ig,iloop,islope))*(layer_PEM(iloop) - layer_PEM(iloop - 1)) |
---|
| 352 | endif |
---|
| 353 | else ! NO EXCHANGE AS ICE BLOCK THE DYNAMIC! |
---|
| 354 | deltam_reg_complete(ig,iloop,islope) = 0. |
---|
| 355 | endif |
---|
| 356 | deltam_reg_slope(ig,islope) = deltam_reg_slope(ig,islope) + deltam_reg_complete(ig,iloop,islope) |
---|
| 357 | enddo |
---|
| 358 | delta_mreg(ig) = delta_mreg(ig) + deltam_reg_slope(ig,islope)*subslope_dist(ig,islope)/cos(pi*def_slope_mean(islope)/180.) |
---|
| 359 | enddo |
---|
[2794] | 360 | enddo |
---|
[3456] | 361 | m_co2_completesoil = dm_co2_regolith_slope |
---|
[2842] | 362 | #endif |
---|
[2794] | 363 | |
---|
[3456] | 364 | END SUBROUTINE regolith_co2adsorption |
---|
[2794] | 365 | |
---|
[3456] | 366 | END MODULE adsorption_mod |
---|
| 367 | |
---|