- Timestamp:
- Dec 4, 2024, 4:04:54 PM (7 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LMDZ.COMMON/libf/evolution/compute_soiltemp_mod.F90
r3525 r3532 4 4 !----------------------------------------------------------------------- 5 5 ! Author: LL 6 ! Purpose: This module gathers the different routines used in the PEM to compute the soil temperature evolution and initialisation. 7 ! 8 ! Note: depths of layers and mid-layers, soil thermal inertia and 6 ! Purpose: This module gathers the different routines used in the PEM to compute the soil temperature evolution and initialisation. 7 ! 8 ! Note: depths of layers and mid-layers, soil thermal inertia and 9 9 ! heat capacity are commons in comsoil_PEM.h 10 10 !----------------------------------------------------------------------- … … 12 12 !======================================================================= 13 13 14 15 16 14 SUBROUTINE compute_tsoil_pem(ngrid,nsoil,firstcall,therm_i,timestep,tsurf,tsoil) 17 15 … … 24 22 ! Author: LL 25 23 ! Purpose: Compute soil temperature using an implict 1st order scheme 26 ! 27 ! Note: depths of layers and mid-layers, soil thermal inertia and 24 ! 25 ! Note: depths of layers and mid-layers, soil thermal inertia and 28 26 ! heat capacity are commons in comsoil_PEM.h 29 27 !----------------------------------------------------------------------- … … 31 29 #include "dimensions.h" 32 30 33 !----------------------------------------------------------------------- 34 ! arguments 35 ! --------- 36 ! inputs: 37 integer, intent(in) :: ngrid ! number of (horizontal) grid-points 38 integer, intent(in) :: nsoil ! number of soil layers 39 logical, intent(in) :: firstcall ! identifier for initialization call 31 ! Inputs: 32 ! ------- 33 integer, intent(in) :: ngrid ! number of (horizontal) grid-points 34 integer, intent(in) :: nsoil ! number of soil layers 35 logical, intent(in) :: firstcall ! identifier for initialization call 40 36 real, dimension(ngrid,nsoil), intent(in) :: therm_i ! thermal inertia [SI] 41 37 real, intent(in) :: timestep ! time step [s] 42 38 real, dimension(ngrid), intent(in) :: tsurf ! surface temperature [K] 43 44 ! outputs:39 ! Outputs: 40 !--------- 45 41 real, dimension(ngrid,nsoil), intent(inout) :: tsoil ! soil (mid-layer) temperature [K] 46 ! local variables: 47 integer :: ig, ik 42 ! Local: 43 !------- 44 integer :: ig, ik 48 45 49 46 ! 0. Initialisations and preprocessing step … … 52 49 do ig = 1,ngrid 53 50 do ik = 0,nsoil - 1 54 mthermdiff_PEM(ig,ik) = therm_i(ig,ik + 1)*therm_i(ig,ik + 1)/volcapa 51 mthermdiff_PEM(ig,ik) = therm_i(ig,ik + 1)*therm_i(ig,ik + 1)/volcapa 55 52 enddo 56 53 enddo … … 64 61 enddo 65 62 66 ! 0.3 Build coefficients mu_PEM, q_{k+1/2}, d_k, alph_PEM a_k and capcal63 ! 0.3 Build coefficients mu_PEM, q_{k+1/2}, d_k, alph_PEM 67 64 ! mu_PEM 68 65 mu_PEM = mlayer_PEM(0)/(mlayer_PEM(1) - mlayer_PEM(0)) … … 99 96 ! Other layers: 100 97 do ik = 1,nsoil - 1 101 tsoil(ig,ik + 1) = alph_PEM(ig,ik)*tsoil(ig,ik) + beta_PEM(ig,ik) 98 tsoil(ig,ik + 1) = alph_PEM(ig,ik)*tsoil(ig,ik) + beta_PEM(ig,ik) 102 99 enddo 103 100 enddo … … 139 136 #include "dimensions.h" 140 137 141 !----------------------------------------------------------------------- 142 ! arguments 143 ! --------- 144 ! inputs: 138 ! Inputs: 139 !-------- 145 140 integer, intent(in) :: ngrid ! number of (horizontal) grid-points 146 141 integer, intent(in) :: nsoil ! number of soil layers 147 142 real, dimension(ngrid,nsoil), intent(in) :: therm_i ! thermal inertia [SI] 148 143 real, dimension(ngrid), intent(in) :: tsurf ! surface temperature [K] 149 150 ! outputs:144 ! Outputs: 145 !--------- 151 146 real, dimension(ngrid,nsoil), intent(inout) :: tsoil ! soil (mid-layer) temperature [K] 152 ! local variables: 147 ! Local: 148 !------- 153 149 integer :: ig, ik, iloop 154 150 … … 169 165 enddo 170 166 171 ! 0.3 Build coefficients mu_PEM, q_{k+1/2}, d_k, alph_PEM a_k and capcal167 ! 0.3 Build coefficients mu_PEM, q_{k+1/2}, d_k, alph_PEM 172 168 ! mu_PEM 173 169 mu_PEM = mlayer_PEM(0)/(mlayer_PEM(1) - mlayer_PEM(0)) … … 179 175 do ig = 1,ngrid 180 176 ! d_k 181 do ik = 1,nsoil -1177 do ik = 1,nsoil - 1 182 178 coefd_PEM(ig,ik) = thermdiff_PEM(ig,ik)/(mlayer_PEM(ik) - mlayer_PEM(ik - 1)) 183 179 enddo … … 207 203 ! 2. Compute soil temperatures 208 204 do iloop = 1,10 !just convergence 209 ! First layer: 210 do ig = 1,ngrid 211 tsoil(ig,1)=(tsurf(ig) + mu_PEM*beta_PEM(ig,1)*thermdiff_PEM(ig,1)/mthermdiff_PEM(ig,0))/ & 212 (1. + mu_PEM*(1. - alph_PEM(ig,1))*thermdiff_PEM(ig,1)/mthermdiff_PEM(ig,0)) 213 ! Other layers: 214 do ik = 1,nsoil - 1 215 tsoil(ig,ik + 1) = alph_PEM(ig,ik)*tsoil(ig,ik) + beta_PEM(ig,ik) 216 enddo 217 enddo 218 205 do ig = 1,ngrid 206 ! First layer: 207 tsoil(ig,1) = (tsurf(ig) + mu_PEM*beta_PEM(ig,1)*thermdiff_PEM(ig,1)/mthermdiff_PEM(ig,0))/ & 208 (1. + mu_PEM*(1. - alph_PEM(ig,1))*thermdiff_PEM(ig,1)/mthermdiff_PEM(ig,0)) 209 ! Other layers: 210 do ik = 1,nsoil - 1 211 tsoil(ig,ik + 1) = alph_PEM(ig,ik)*tsoil(ig,ik) + beta_PEM(ig,ik) 212 enddo 213 enddo 219 214 enddo ! iloop 220 215
Note: See TracChangeset
for help on using the changeset viewer.