| 1 | SUBROUTINE update_soil(ngrid,nslope,nsoil_PEM,tend_h2oglaciers,tend_co2glaciers,co2ice,waterice,ps_new,& |
|---|
| 2 | cellarea,ice_depth,TI_PEM) |
|---|
| 3 | |
|---|
| 4 | |
|---|
| 5 | USE comsoil_h, only: inertiedat, volcapa |
|---|
| 6 | USE comsoil_h_PEM, only: layer_PEM,n_1km,inertiedat_PEM |
|---|
| 7 | USE vertical_layers_mod, ONLY: ap,bp |
|---|
| 8 | implicit none |
|---|
| 9 | ! Input: |
|---|
| 10 | INTEGER,INTENT(IN) :: ngrid, nslope, nsoil_PEM |
|---|
| 11 | REAL,INTENT(IN) :: tend_h2oglaciers(ngrid,nslope),tend_co2glaciers(ngrid,nslope) |
|---|
| 12 | REAL,INTENT(IN) :: ps_new(ngrid) |
|---|
| 13 | REAL,INTENT(IN) :: cellarea(ngrid) |
|---|
| 14 | REAL,INTENT(IN) :: co2ice(ngrid,nslope) |
|---|
| 15 | REAL,INTENT(IN) :: waterice(ngrid,nslope) |
|---|
| 16 | REAL,INTENT(in) :: ice_depth(ngrid,nslope) |
|---|
| 17 | |
|---|
| 18 | |
|---|
| 19 | ! Outputs: |
|---|
| 20 | |
|---|
| 21 | REAL,INTENT(INOUT) :: TI_PEM(ngrid,nsoil_PEM,nslope) |
|---|
| 22 | |
|---|
| 23 | ! Constants: |
|---|
| 24 | |
|---|
| 25 | REAL :: alpha = 0.2 |
|---|
| 26 | REAL :: beta = 1.08e7 |
|---|
| 27 | REAL :: To = 273.15 |
|---|
| 28 | REAL :: R = 8.314 |
|---|
| 29 | REAL :: L = 51058. |
|---|
| 30 | REAL :: inertie_thresold = 800. ! look for ice |
|---|
| 31 | REAL :: inertie_co2glaciers = 2120 ! Mellon et al. 2000 |
|---|
| 32 | REAL :: inertie_averaged = 250 ! Mellon et al. 2000 |
|---|
| 33 | REAL :: ice_inertia = 2120 ! Inertia of ice |
|---|
| 34 | REAL :: surfaceice_inertia = 800 ! Inertia of ice |
|---|
| 35 | REAL :: P610 = 610.0 |
|---|
| 36 | REAL :: m_h2o = 18.01528E-3 |
|---|
| 37 | REAL :: m_co2 = 44.01E-3 ! CO2 molecular mass (kg/mol) |
|---|
| 38 | REAL :: m_noco2 = 33.37E-3 ! Non condensible mol mass (kg/mol) |
|---|
| 39 | REAL :: A,B,mmean |
|---|
| 40 | |
|---|
| 41 | ! Local variables: |
|---|
| 42 | |
|---|
| 43 | INTEGER :: ig,islope,iloop,iref,k |
|---|
| 44 | REAL :: regolith_inertia(ngrid,nslope) ! TI of the regolith |
|---|
| 45 | REAL :: d(ngrid,nsoil_PEM,nslope) |
|---|
| 46 | REAL :: p_avg_new |
|---|
| 47 | REAL :: Total_surface |
|---|
| 48 | INTEGER :: ispermanent_co2glaciers(ngrid,nslope) |
|---|
| 49 | INTEGER :: ispermanent_h2oglaciers(ngrid,nslope) |
|---|
| 50 | |
|---|
| 51 | |
|---|
| 52 | ! 0. Initialisation |
|---|
| 53 | |
|---|
| 54 | |
|---|
| 55 | |
|---|
| 56 | |
|---|
| 57 | Total_surface = sum(cellarea) |
|---|
| 58 | p_avg_new = 0. |
|---|
| 59 | do ig = 1,ngrid |
|---|
| 60 | p_avg_new = p_avg_new + ps_new(ig)*cellarea(ig)/Total_surface |
|---|
| 61 | enddo |
|---|
| 62 | |
|---|
| 63 | |
|---|
| 64 | |
|---|
| 65 | do ig = 1,ngrid |
|---|
| 66 | do islope = 1,nslope |
|---|
| 67 | if((abs(tend_h2oglaciers(ig,islope)).lt.1e-5).and.(abs(waterice(ig,islope)).gt.0)) then |
|---|
| 68 | ispermanent_h2oglaciers(ig,islope) = 1 |
|---|
| 69 | else |
|---|
| 70 | ispermanent_h2oglaciers(ig,islope) = 0 |
|---|
| 71 | endif |
|---|
| 72 | |
|---|
| 73 | if((abs(tend_co2glaciers(ig,islope)).lt.1e-5).and.(abs(co2ice(ig,islope)).gt.0)) then |
|---|
| 74 | ispermanent_co2glaciers(ig,islope) = 1 |
|---|
| 75 | else |
|---|
| 76 | ispermanent_co2glaciers(ig,islope) = 0 |
|---|
| 77 | endif |
|---|
| 78 | enddo |
|---|
| 79 | |
|---|
| 80 | enddo |
|---|
| 81 | |
|---|
| 82 | |
|---|
| 83 | ispermanent_co2glaciers(:,:) = 0 |
|---|
| 84 | ispermanent_h2oglaciers(:,:) = 0 |
|---|
| 85 | |
|---|
| 86 | |
|---|
| 87 | ! 1.Ice TI feedback |
|---|
| 88 | |
|---|
| 89 | ! do ig=1,ngrid |
|---|
| 90 | ! do islope=1,nslope |
|---|
| 91 | ! if ((ispermanent_co2glaciers(ig,islope).eq.1).or.(ispermanent_h2oglaciers(ig,islope).eq.1)) then |
|---|
| 92 | ! do iloop = 1,n_1km |
|---|
| 93 | ! TI_PEM(ig,iloop,islope) = surfaceice_inertia |
|---|
| 94 | ! enddo |
|---|
| 95 | ! endif |
|---|
| 96 | ! enddo |
|---|
| 97 | ! enddo |
|---|
| 98 | do islope = 1,nslope |
|---|
| 99 | call soil_TIfeedback_PEM(ngrid,nsoil_PEM,waterice(:,islope), TI_PEM(:,:,islope)) |
|---|
| 100 | enddo |
|---|
| 101 | |
|---|
| 102 | ! 2. Modification of the regolith thermal inertia. |
|---|
| 103 | |
|---|
| 104 | |
|---|
| 105 | |
|---|
| 106 | do ig=1,ngrid |
|---|
| 107 | do islope=1,nslope |
|---|
| 108 | do iloop =1,n_1km |
|---|
| 109 | d(ig,iloop,islope) = ((inertiedat_PEM(ig,iloop)*inertiedat_PEM(ig,iloop))/(volcapa*alpha*P610**0.6))**(-1/(0.11*log10(P610/beta))) |
|---|
| 110 | if(TI_PEM(ig,iloop,islope).lt.inertie_thresold) then ! we are modifying the regolith properties, not ice |
|---|
| 111 | TI_PEM(ig,iloop,islope) = sqrt(volcapa*alpha*(p_avg_new**0.6)* d(ig,iloop,islope)**(-0.11*log10(p_avg_new/beta))) |
|---|
| 112 | |
|---|
| 113 | endif |
|---|
| 114 | enddo |
|---|
| 115 | enddo |
|---|
| 116 | enddo |
|---|
| 117 | |
|---|
| 118 | |
|---|
| 119 | |
|---|
| 120 | |
|---|
| 121 | |
|---|
| 122 | |
|---|
| 123 | ! 3. Build new TI for the PEM |
|---|
| 124 | ! a) For the regolith |
|---|
| 125 | do ig=1,ngrid |
|---|
| 126 | do islope=1,nslope |
|---|
| 127 | |
|---|
| 128 | if (ice_depth(ig,islope).gt. -1.e-10) then |
|---|
| 129 | ! 3.0 FIrst if permanent ice |
|---|
| 130 | if (ice_depth(ig,islope).lt. 1e-10) then |
|---|
| 131 | do iloop = 1,nsoil_PEM |
|---|
| 132 | TI_PEM(ig,iloop,islope)=max(ice_inertia,inertiedat_PEM(ig,iloop)) |
|---|
| 133 | enddo |
|---|
| 134 | else |
|---|
| 135 | ! 4.1 find the index of the mixed layer |
|---|
| 136 | iref=0 ! initialize iref |
|---|
| 137 | do k=1,nsoil_PEM ! loop on layers |
|---|
| 138 | if (ice_depth(ig,islope).ge.layer_PEM(k)) then |
|---|
| 139 | iref=k ! pure regolith layer up to here |
|---|
| 140 | else |
|---|
| 141 | ! correct iref was obtained in previous cycle |
|---|
| 142 | exit |
|---|
| 143 | endif |
|---|
| 144 | |
|---|
| 145 | enddo |
|---|
| 146 | |
|---|
| 147 | |
|---|
| 148 | |
|---|
| 149 | ! 4.2 Build the new ti |
|---|
| 150 | do iloop=1,iref |
|---|
| 151 | TI_PEM(ig,iloop,islope) =TI_PEM(ig,iloop,islope) |
|---|
| 152 | enddo |
|---|
| 153 | if (iref.lt.nsoil_PEM) then |
|---|
| 154 | if (iref.ne.0) then |
|---|
| 155 | ! mixed layer |
|---|
| 156 | TI_PEM(ig,iref+1,islope)=sqrt((layer_PEM(iref+1)-layer_PEM(iref))/ & |
|---|
| 157 | (((ice_depth(ig,islope)-layer_PEM(iref))/(TI_PEM(ig,iref,islope)**2))+ & |
|---|
| 158 | ((layer_PEM(iref+1)-ice_depth(ig,islope))/(ice_inertia**2)))) |
|---|
| 159 | else ! first layer is already a mixed layer |
|---|
| 160 | ! (ie: take layer(iref=0)=0) |
|---|
| 161 | TI_PEM(ig,1,islope)=sqrt((layer_PEM(1))/ & |
|---|
| 162 | (((ice_depth(ig,islope))/(TI_PEM(ig,1,islope)**2))+ & |
|---|
| 163 | ((layer_PEM(1)-ice_depth(ig,islope))/(ice_inertia**2)))) |
|---|
| 164 | endif ! of if (iref.ne.0) |
|---|
| 165 | ! lower layers of pure ice |
|---|
| 166 | do iloop=iref+2,nsoil_PEM |
|---|
| 167 | TI_PEM(ig,iloop,islope)=ice_inertia |
|---|
| 168 | enddo |
|---|
| 169 | endif ! of if (iref.lt.(nsoilmx)) |
|---|
| 170 | endif ! permanent glaciers |
|---|
| 171 | endif ! depth > 0 |
|---|
| 172 | enddo !islope |
|---|
| 173 | enddo !ig |
|---|
| 174 | |
|---|
| 175 | |
|---|
| 176 | |
|---|
| 177 | |
|---|
| 178 | |
|---|
| 179 | |
|---|
| 180 | |
|---|
| 181 | !======================================================================= |
|---|
| 182 | RETURN |
|---|
| 183 | END |
|---|