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