| 1 | SUBROUTINE regolith_co2adsorption_old(ngrid,nslope,nsoil_PEM,ps,tsoil_PEM,TI_PEM,tend_h2oglaciers,tend_co2glaciers,co2ice,waterice,m_co2_completesoil,delta_mreg) |
|---|
| 2 | use comsoil_h_PEM, only: layer_PEM, mlayer_PEM,n_1km |
|---|
| 3 | USE comcstfi_h, only: r, cpp, mugaz, g, rcp, pi, rad |
|---|
| 4 | use comslope_mod, only : subslope_dist,def_slope_mean |
|---|
| 5 | IMPLICIT NONE |
|---|
| 6 | ! Input: |
|---|
| 7 | INTEGER,INTENT(IN) :: ngrid, nslope, nsoil_PEM |
|---|
| 8 | REAL,INTENT(IN) :: ps(ngrid) ! Average surface pressure [Pa] |
|---|
| 9 | REAL,INTENT(IN) :: tsoil_PEM(ngrid,nsoil_PEM,nslope) ! Mean Soil Temperature [K] |
|---|
| 10 | REAL,INTENT(IN) :: TI_PEM(ngrid,nsoil_PEM,nslope) ! Mean Thermal Inertia [USI] |
|---|
| 11 | REAL,INTENT(IN) :: tend_h2oglaciers(ngrid,nslope),tend_co2glaciers(ngrid,nslope) !tendancies on the glaciers |
|---|
| 12 | REAL,INTENT(IN) :: waterice(ngrid,nslope) ! water ice at the surface [KG/m^2] |
|---|
| 13 | REAL,INTENT(IN) :: co2ice(ngrid,nslope) ! co2 ice at the surface [Kg/m^2] |
|---|
| 14 | |
|---|
| 15 | ! Outputs: |
|---|
| 16 | REAL,INTENT(INOUT) :: m_co2_completesoil(ngrid,nsoil_PEM,nslope) |
|---|
| 17 | REAL,INTENT(INOUT) :: delta_mreg(ngrid) |
|---|
| 18 | |
|---|
| 19 | |
|---|
| 20 | |
|---|
| 21 | ! Constants: |
|---|
| 22 | |
|---|
| 23 | REAL :: as = 1.9e4 ! Bulher & Piqueux 2020, assuming exchange only between 0 and 868m, last layer of the PEM |
|---|
| 24 | REAL :: delta = 5.749e1 ! Zent & Quinn, 1995 |
|---|
| 25 | REAL :: beta = -4.0711 ! Zent & Quinn, 1995 |
|---|
| 26 | REAL :: gama = 0.2788 ! Zent & Quinn, 1995 |
|---|
| 27 | REAL :: inertie_thresold = 2000. ! look for ice |
|---|
| 28 | REAL :: rho_regolith = 2000. ! density of the reoglith, buhler and piqueux 2021 |
|---|
| 29 | ! Input: Local |
|---|
| 30 | INTEGER :: ig,islope,iloop,iref,k |
|---|
| 31 | REAL :: dm_co2_regolith_slope(ngrid,nsoil_PEM,nslope) ! elementary mass adsorded per mesh per slope |
|---|
| 32 | INTEGER :: ispermanent_co2glaciers(ngrid,nslope) |
|---|
| 33 | INTEGER :: ispermanent_h2oglaciers(ngrid,nslope) |
|---|
| 34 | REAL :: deltam_reg_complete(ngrid,n_1km,nslope) |
|---|
| 35 | REAL :: deltam_reg_slope(ngrid,nslope) |
|---|
| 36 | |
|---|
| 37 | dm_co2_regolith_slope(:,:,:) = 0 |
|---|
| 38 | delta_mreg(:) = 0. |
|---|
| 39 | !0. Initialization |
|---|
| 40 | do ig = 1,ngrid |
|---|
| 41 | do islope = 1,nslope |
|---|
| 42 | if((abs(tend_h2oglaciers(ig,islope)).gt.1e-5).and.(abs(waterice(ig,islope)).gt.0)) then |
|---|
| 43 | ispermanent_h2oglaciers(ig,islope) = 1 |
|---|
| 44 | else |
|---|
| 45 | ispermanent_h2oglaciers(ig,islope) = 0 |
|---|
| 46 | endif |
|---|
| 47 | |
|---|
| 48 | if((abs(tend_co2glaciers(ig,islope)).gt.1e-5).and.(abs(co2ice(ig,islope)).gt.0)) then |
|---|
| 49 | ispermanent_co2glaciers(ig,islope) = 1 |
|---|
| 50 | else |
|---|
| 51 | ispermanent_co2glaciers(ig,islope) = 0 |
|---|
| 52 | endif |
|---|
| 53 | enddo |
|---|
| 54 | enddo |
|---|
| 55 | ! 1. we compute the mass of co2 adsorded in each layer of the meshes |
|---|
| 56 | |
|---|
| 57 | do ig = 1,ngrid |
|---|
| 58 | do islope = 1,nslope |
|---|
| 59 | do iloop = 1,n_1km |
|---|
| 60 | if((TI_PEM(ig,iloop,islope).lt.inertie_thresold).and.(ispermanent_h2oglaciers(ig,islope).eq.0).and.(ispermanent_co2glaciers(ig,islope).eq.0)) then |
|---|
| 61 | dm_co2_regolith_slope(ig,iloop,islope) = rho_regolith*as*delta*(ps(ig)**gama)*(tsoil_PEM(ig,iloop,islope))**beta |
|---|
| 62 | else |
|---|
| 63 | if(abs(m_co2_completesoil(ig,iloop,islope)).lt.1-10) then !!! we are at first call |
|---|
| 64 | dm_co2_regolith_slope(ig,iloop,islope) = rho_regolith*as*delta*(ps(ig)**gama)*(tsoil_PEM(ig,iloop,islope))**beta |
|---|
| 65 | else ! no change: permanent ice stick the atoms of CO2 |
|---|
| 66 | dm_co2_regolith_slope(ig,iloop,islope) = m_co2_completesoil(ig,iloop,islope) |
|---|
| 67 | endif |
|---|
| 68 | endif |
|---|
| 69 | enddo |
|---|
| 70 | enddo |
|---|
| 71 | enddo |
|---|
| 72 | |
|---|
| 73 | |
|---|
| 74 | ! 2. Check the exchange between the atmosphere and the regolith |
|---|
| 75 | |
|---|
| 76 | do ig = 1,ngrid |
|---|
| 77 | delta_mreg(ig) = 0. |
|---|
| 78 | do islope = 1,nslope |
|---|
| 79 | deltam_reg_slope(ig,islope) = 0. |
|---|
| 80 | do iloop = 1,n_1km |
|---|
| 81 | if((TI_PEM(ig,iloop,islope).lt.inertie_thresold).and.(ispermanent_h2oglaciers(ig,islope).eq.0).and.(ispermanent_co2glaciers(ig,islope).eq.0)) then |
|---|
| 82 | deltam_reg_complete(ig,iloop,islope) = (dm_co2_regolith_slope(ig,iloop,islope) - m_co2_completesoil(ig,iloop,islope)) & |
|---|
| 83 | *(layer_PEM(iloop+1) - layer_PEM(iloop)) |
|---|
| 84 | else ! NO EXCHANGE AS ICE BLOCK THE DYNAMIC! |
|---|
| 85 | deltam_reg_complete(ig,iloop,islope) = 0. |
|---|
| 86 | endif |
|---|
| 87 | deltam_reg_slope(ig,islope) = deltam_reg_slope(ig,islope) + deltam_reg_complete(ig,iloop,islope) |
|---|
| 88 | enddo |
|---|
| 89 | delta_mreg(ig) = delta_mreg(ig) + deltam_reg_slope(ig,islope)*subslope_dist(ig,islope)/cos(pi*def_slope_mean(islope)/180.) |
|---|
| 90 | enddo |
|---|
| 91 | enddo |
|---|
| 92 | m_co2_completesoil(:,:,:) = dm_co2_regolith_slope(:,:,:) |
|---|
| 93 | |
|---|
| 94 | |
|---|
| 95 | !======================================================================= |
|---|
| 96 | RETURN |
|---|
| 97 | END |
|---|