source: trunk/LMDZ.COMMON/libf/evolution/ComputeCO2Adsorption.F90 @ 2849

Last change on this file since 2849 was 2842, checked in by romain.vande, 3 years ago

Mars PEM:
PEM is now adapted to run with XIOS diurnal averages (when they will work properly)
RV

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