Changeset 4180 for trunk/LMDZ.COMMON/libf/evolution
- Timestamp:
- Apr 10, 2026, 7:17:55 PM (4 hours ago)
- Location:
- trunk/LMDZ.COMMON/libf/evolution
- Files:
-
- 19 edited
-
changelog.txt (modified) (1 diff)
-
config.F90 (modified) (4 diffs)
-
display.F90 (modified) (3 diffs)
-
glaciers.F90 (modified) (2 diffs)
-
io_netcdf.F90 (modified) (6 diffs)
-
layered_deposits.F90 (modified) (19 diffs)
-
maths.F90 (modified) (1 diff)
-
numerics.F90 (modified) (1 diff)
-
orbit.F90 (modified) (2 diffs)
-
output.F90 (modified) (2 diffs)
-
pem.F90 (modified) (7 diffs)
-
planet.F90 (modified) (6 diffs)
-
soil_therm_inertia.F90 (modified) (3 diffs)
-
sorption.F90 (modified) (4 diffs)
-
stopping_crit.F90 (modified) (1 diff)
-
surf_ice.F90 (modified) (4 diffs)
-
surf_temp.F90 (modified) (2 diffs)
-
tendencies.F90 (modified) (5 diffs)
-
utility.F90 (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LMDZ.COMMON/libf/evolution/changelog.txt
r4174 r4180 963 963 - adds new stopping criterion when H2O flux balance fails8 (sanity check); 964 964 - introduces configurable weighting strategies for H2O flux balancing. 965 966 == 10/04/2026 == JBC 967 - Rework layering-related logic, especially clarify interactions between surface and subsurface water tendencies and disable CO2 lag resistance (inconsistent without updating pressure and mass balance + PCM). 968 - Prevent simultaneous activation of layering and ice flows. 969 - Add warning when flux_geo /= 0 while soil is disabled. 970 - Add new utility function "is_lvl_enabled" for displaying. 971 - Replace deprecated 'minieps' with 'eps'/'tol'. -
trunk/LMDZ.COMMON/libf/evolution/config.F90
r4170 r4180 17 17 ! DEPENDENCIES 18 18 ! ------------ 19 use numerics, only: dp, di, k4, minieps19 use numerics, only: dp, di, k4, eps 20 20 21 21 ! DECLARATION … … 240 240 ! DEPENDENCIES 241 241 ! ------------ 242 use stoppage, only: stop_clean 243 use soil, only: do_soil, reg_thprop_dependp, flux_geo 244 use sorption, only: do_sorption 245 use orbit, only: evo_orbit 246 use evolution, only: pem_ini_date 247 use ice_table, only: icetable_equilibrium, icetable_dynamic 248 use display, only: print_msg, LVL_WRN 242 use stoppage, only: stop_clean 243 use soil, only: do_soil, reg_thprop_dependp, flux_geo 244 use sorption, only: do_sorption 245 use orbit, only: evo_orbit 246 use evolution, only: pem_ini_date 247 use ice_table, only: icetable_equilibrium, icetable_dynamic 248 use glaciers, only: h2oice_flow, co2ice_flow 249 use layered_deposits, only: do_layering 250 use display, only: print_msg, LVL_WRN 249 251 250 252 ! DECLARATION … … 255 257 ! ---- 256 258 ! Warnings (possible incompatibilities) 257 if (evo_orbit .and. abs(pem_ini_date) < minieps) call print_msg('''evo_orbit = .true.'' but the initial date of the PEM is set to 0!',LVL_WRN) 259 if (evo_orbit .and. abs(pem_ini_date) < eps) call print_msg('''evo_orbit = .true.'' but the initial date of the PEM is set to 0!',LVL_WRN) 260 if (abs(flux_geo) > eps .and. .not. do_soil) call print_msg('soil is not activated but flux_geo /= 0!',LVL_WRN) 258 261 259 262 ! Errors (true incompatibilities) 260 263 if (.not. do_soil) then 261 264 if (icetable_equilibrium .or. icetable_dynamic) call stop_clean(__FILE__,__LINE__,'ice table must be used when do_soil = true!',1) 262 if (abs(flux_geo) > minieps) call stop_clean(__FILE__,__LINE__,'soil is not activated but flux_geo /= 0!',1)263 265 if (reg_thprop_dependp) call stop_clean(__FILE__,__LINE__,'regolith properties vary according to Ps only when soil = true!',1) 264 266 if (do_sorption) call stop_clean(__FILE__,__LINE__,'do_soil must be true when do_sorption = true!',1) 265 267 end if 268 if (do_layering .and. h2oice_flow) call stop_clean(__FILE__,__LINE__,'layering and H2O ice flow cannot be activated at the same time!',1) 269 if (do_layering .and. co2ice_flow) call stop_clean(__FILE__,__LINE__,'layering and CO2 ice flow cannot be activated at the same time!',1) 266 270 267 271 END SUBROUTINE check_config_incompatibility … … 458 462 call print_msg('> Initializing soil parameters',LVL_NFO) 459 463 volcapa = controle(35) 460 if (abs(volcapa) < minieps) call stop_clean(__FILE__,__LINE__,'volcapa is 0 in "'//startfi_name//'"!',1)464 if (abs(volcapa) < eps) call stop_clean(__FILE__,__LINE__,'volcapa is 0 in "'//startfi_name//'"!',1) 461 465 462 466 ! Initialize orbital data -
trunk/LMDZ.COMMON/libf/evolution/display.F90
r4170 r4180 19 19 use, intrinsic :: iso_fortran_env, only: stderr => error_unit 20 20 use, intrinsic :: iso_fortran_env, only: stdin => input_unit 21 use numerics, only: dp, di, li, k4, minieps21 use numerics, only: dp, di, li, k4, eps 22 22 23 23 ! DECLARATION … … 277 277 278 278 END SUBROUTINE print_msg 279 !======================================================================= 280 281 !======================================================================= 282 FUNCTION is_lvl_enabled(lvl) RESULT(enabled) 283 !----------------------------------------------------------------------- 284 ! NAME 285 ! is_lvl_enabled 286 ! 287 ! DESCRIPTION 288 ! Return true if a message at level 'lvl' should be displayed. 289 ! 290 ! AUTHORS & DATE 291 ! JB Clement, 04/2026 292 ! 293 ! NOTES 294 ! 295 !----------------------------------------------------------------------- 296 297 ! DECLARATION 298 ! ----------- 299 implicit none 300 301 ! ARGUMENTS 302 ! --------- 303 integer(di), intent(in) :: lvl 304 305 ! LOCAL VARIABLES 306 ! --------------- 307 logical(k4) :: enabled 308 309 ! CODE 310 ! ---- 311 enabled = .false. 312 if (lvl <= verbosity_lvl) enabled = .true. 313 314 END FUNCTION is_lvl_enabled 279 315 !======================================================================= 280 316 … … 465 501 if (gottacatch_emall_()) then 466 502 call print_msg('',LVL_NFO) 467 if (abs(n_yr_run - first_gen) < minieps) then503 if (abs(n_yr_run - first_gen) < eps) then 468 504 do i = 1,size(surprise) 469 505 call print_msg(trim(surprise(i)),LVL_NFO) -
trunk/LMDZ.COMMON/libf/evolution/glaciers.F90
r4170 r4180 18 18 ! DEPENDENCIES 19 19 ! ------------ 20 use numerics, only: dp, di, k4, minieps20 use numerics, only: dp, di, k4, eps 21 21 22 22 ! DECLARATION … … 301 301 iaval = islope + 1 302 302 end if 303 do while (iaval /= iflat .and. abs(subslope_dist(ig,iaval)) < minieps)303 do while (iaval /= iflat .and. abs(subslope_dist(ig,iaval)) < eps) 304 304 if (iaval > iflat) then 305 305 iaval = iaval - 1 -
trunk/LMDZ.COMMON/libf/evolution/io_netcdf.F90
r4152 r4180 16 16 ! DEPEDENCIES 17 17 ! ----------- 18 use numerics, only: dp, di, k4, minieps18 use numerics, only: dp, di, k4, eps 19 19 use netcdf, only: nf90_double, nf90_noerr, nf90_strerror, nf90_write, nf90_nowrite, & 20 20 nf90_open, nf90_close, nf90_redef, nf90_enddef, nf90_inquire, nf90_max_var_dims, & … … 989 989 if (.not. has_fill) call check_nc(nf90_get_att(ncid,varid,"missing_value",fill_value),'getting missing value',has_fill) 990 990 if (has_fill) then 991 if (abs(var - fill_value) < minieps) call stop_clean(__FILE__,__LINE__,'Fill values ('//real2str(fill_value)//') detected in '//var_name//'!',1)991 if (abs(var - fill_value) < eps) call stop_clean(__FILE__,__LINE__,'Fill values ('//real2str(fill_value)//') detected in '//var_name//'!',1) 992 992 end if 993 993 … … 1074 1074 if (.not. has_fill) call check_nc(nf90_get_att(ncid,varid,"missing_value",fill_value),'getting missing value',has_fill) 1075 1075 if (has_fill) then 1076 if (any(abs(var - fill_value) < minieps)) call stop_clean(__FILE__,__LINE__,'Fill values ('//real2str(fill_value)//') detected in '//var_name//'!',1)1076 if (any(abs(var - fill_value) < eps)) call stop_clean(__FILE__,__LINE__,'Fill values ('//real2str(fill_value)//') detected in '//var_name//'!',1) 1077 1077 end if 1078 1078 … … 1159 1159 if (.not. has_fill) call check_nc(nf90_get_att(ncid,varid,"missing_value",fill_value),'getting missing value',has_fill) 1160 1160 if (has_fill) then 1161 if (any(abs(var - fill_value) < minieps)) call stop_clean(__FILE__,__LINE__,'Fill values ('//real2str(fill_value)//') detected in '//var_name//'!',1)1161 if (any(abs(var - fill_value) < eps)) call stop_clean(__FILE__,__LINE__,'Fill values ('//real2str(fill_value)//') detected in '//var_name//'!',1) 1162 1162 end if 1163 1163 … … 1244 1244 if (.not. has_fill) call check_nc(nf90_get_att(ncid,varid,"missing_value",fill_value),'getting missing value',has_fill) 1245 1245 if (has_fill) then 1246 if (any(abs(var - fill_value) < minieps)) call stop_clean(__FILE__,__LINE__,'Fill values ('//real2str(fill_value)//') detected in '//var_name//'!',1)1246 if (any(abs(var - fill_value) < eps)) call stop_clean(__FILE__,__LINE__,'Fill values ('//real2str(fill_value)//') detected in '//var_name//'!',1) 1247 1247 end if 1248 1248 … … 1329 1329 if (.not. has_fill) call check_nc(nf90_get_att(ncid,varid,"missing_value",fill_value),'getting missing value',has_fill) 1330 1330 if (has_fill) then 1331 if (any(abs(var - fill_value) < minieps)) call stop_clean(__FILE__,__LINE__,'Fill values ('//real2str(fill_value)//') detected in '//var_name//'!',1)1331 if (any(abs(var - fill_value) < eps)) call stop_clean(__FILE__,__LINE__,'Fill values ('//real2str(fill_value)//') detected in '//var_name//'!',1) 1332 1332 end if 1333 1333 -
trunk/LMDZ.COMMON/libf/evolution/layered_deposits.F90
r4174 r4180 17 17 ! DEPENDENCIES 18 18 ! ------------ 19 use numerics, only: dp, di, k4, tol 19 use numerics, only: dp, di, k4, tol, eps 20 20 use geometry, only: ngrid, nslope 21 21 use surf_ice, only: rho_co2ice, rho_h2oice … … 505 505 end do 506 506 this%nb_str = 0 507 nullify(this%top) 508 nullify(this%bottom) 507 509 508 510 END SUBROUTINE del_layering … … 699 701 do ig = 1,ngrid 700 702 do k = 1,size(layerings_array,3) 701 call add_stratum(layerings_map(ig,islope),layerings_array(ig,islope,k,1),layerings_array(ig,islope,k,2),layerings_array(ig,islope,k,3),layerings_array(ig,islope,k,4),layerings_array(ig,islope,k,5),layerings_array(ig,islope,k,6)) 703 call add_stratum(layerings_map(ig,islope),layerings_array(ig,islope,k,1), & 704 layerings_array(ig,islope,k,2),layerings_array(ig,islope,k,3), & 705 layerings_array(ig,islope,k,4),layerings_array(ig,islope,k,5), & 706 layerings_array(ig,islope,k,6)) 702 707 end do 703 708 end do … … 742 747 ! CODE 743 748 ! ---- 749 h2o_ice(:,:) = 0._dp 750 co2_ice(:,:) = 0._dp 751 h2oice_depth(:,:) = 0._dp 744 752 do ig = 1,ngrid 745 753 do islope = 1,nslope … … 1070 1078 ! Is the considered stratum a dust lag? 1071 1079 if (.not. is_dust_lag(current)) return 1072 do while (is_dust_lag(current))1080 do 1073 1081 h_toplag = h_toplag + thickness(current) 1074 if (associated(current%down)) then 1075 current => current%down 1076 else 1077 exit 1082 if (.not. associated(current%down)) then ! Bottom of the layering and only dust lag strata 1083 h_toplag = 0._dp 1084 return 1078 1085 end if 1086 current => current%down 1087 if (.not. is_dust_lag(current)) exit 1079 1088 end do 1080 1081 if (.not. associated(current%down)) then ! Bottom of the layering -> no ice below1082 h_toplag = 0._dp1083 return1084 end if1085 1089 1086 1090 ! Is the stratum below the dust lag made of ice? … … 1091 1095 end if 1092 1096 else if (current%h_co2ice > 0._dp .and. current%h_co2ice > current%h_h2oice) then ! No, there is more CO2 ice than H2O ice 1097 if (h_toplag < h_patchy_ice) co2_ice = current%h_co2ice*rho_co2ice ! The dust lag is too thin to considered ice as subsurface ice 1093 1098 h_toplag = 0._dp ! Because it matters only for H2O ice 1094 if (h_toplag < h_patchy_ice) co2_ice = current%h_co2ice*rho_co2ice ! But the dust lag is too thin to considered ice as subsurface ice1095 1099 end if 1096 1100 … … 1128 1132 ! Update of properties in the eroding dust lag 1129 1133 str%top_elevation = str%top_elevation - h2lift*(1._dp + str%h_pore/str%h_dust) 1130 str%h_pore = str%h_pore - h2lift*str%h_pore/str%h_dust1131 str%h_dust = str%h_dust - h2lift1134 str%h_pore = max(0._dp,str%h_pore - h2lift*str%h_pore/str%h_dust) 1135 str%h_dust = max(0._dp,str%h_dust - h2lift) 1132 1136 1133 1137 ! Remove the eroding dust lag if there is no dust anymore … … 1188 1192 str%h_dust = str%h_dust - hlag_dust 1189 1193 str%h_pore = str%h_pore - h2subl*h_pore/h_ice 1194 str%h_co2ice = max(0._dp,str%h_co2ice) 1195 str%h_h2oice = max(0._dp,str%h_h2oice) 1196 str%h_dust = max(0._dp,str%h_dust) 1197 str%h_pore = max(0._dp,str%h_pore) 1190 1198 1191 1199 ! Correct the value of top_elevation for the upper strata … … 1224 1232 1225 1233 !======================================================================= 1226 SUBROUTINE evolve_layering(this,d_co2ice,d_h2oice,new_str,zshift_surf,new_lag,zlag,current) 1234 SUBROUTINE get_co2_subl_resistance(current,R_subl) 1235 !----------------------------------------------------------------------- 1236 ! NAME 1237 ! get_co2_subl_resistance 1238 ! 1239 ! DESCRIPTION 1240 ! Compute CO2 sublimation inhibition factor due to upper lag strata. 1241 ! 1242 ! AUTHORS & DATE 1243 ! JB Clement, 04/2026 1244 ! 1245 ! NOTES 1246 ! 1247 !----------------------------------------------------------------------- 1248 1249 ! DECLARATION 1250 ! ----------- 1251 implicit none 1252 1253 ! ARGUMENTS 1254 ! --------- 1255 type(stratum), pointer, intent(in) :: current 1256 real(dp), intent(out) :: R_subl 1257 1258 ! LOCAL VARIABLES 1259 ! --------------- 1260 real(dp) :: h_toplag 1261 type(stratum), pointer :: currentloc 1262 1263 ! CODE 1264 ! ---- 1265 R_subl = 1._dp 1266 if (.not. associated(current%up)) return ! If there is no upper stratum 1267 1268 h_toplag = 0._dp 1269 currentloc => current%up 1270 do while (is_dust_lag(currentloc) .and. associated(currentloc%up)) 1271 h_toplag = h_toplag + thickness(currentloc) 1272 currentloc => currentloc%up 1273 end do 1274 1275 if (currentloc%h_h2oice >= h_patchy_ice) then 1276 ! There is a thick H2O ice layer above the dust lag, so CO2 sublimation is fully inhibited 1277 R_subl = 0._dp 1278 else 1279 h_toplag = h_toplag + thickness(currentloc) 1280 R_subl = fred_sublco2**(h_toplag/hmin_lag_co2) 1281 end if 1282 1283 END SUBROUTINE get_co2_subl_resistance 1284 !======================================================================= 1285 1286 !======================================================================= 1287 SUBROUTINE settle_h2o_surf_subsurf_tend(h2oice_depth,flux_ssice,d_h2oice,icell,jcell) 1288 !----------------------------------------------------------------------- 1289 ! NAME 1290 ! settle_h2o_surf_subsurf_tend 1291 ! 1292 ! DESCRIPTION 1293 ! Reconcile H2O surface and subsurface tendencies for one grid cell. 1294 ! 1295 ! AUTHORS & DATE 1296 ! JB Clement, 04/2026 1297 ! 1298 ! NOTES 1299 ! 1300 !----------------------------------------------------------------------- 1301 1302 ! DEPENDENCIES 1303 ! ------------ 1304 use display, only: print_msg, LVL_ERR, LVL_WRN, LVL_DBG, is_lvl_enabled 1305 1306 ! DECLARATION 1307 ! ----------- 1308 implicit none 1309 1310 ! ARGUMENTS 1311 ! --------- 1312 real(dp), intent(in) :: h2oice_depth 1313 real(dp), intent(inout) :: flux_ssice, d_h2oice 1314 integer(di), intent(in), optional :: icell, jcell 1315 1316 ! LOCAL VARIABLES 1317 ! --------------- 1318 logical(k4) :: has_ssice, ss_sublim, ss_cond, surf_sublim, surf_cond 1319 character(64) :: cell_tag 1320 1321 ! CODE 1322 ! ---- 1323 cell_tag = '' 1324 if (present(icell) .and. present(jcell)) then 1325 if (is_lvl_enabled(LVL_DBG)) write(cell_tag,'(a,i0,a,i0,a)') ' [i=',icell,',islope=',jcell,']' 1326 end if 1327 1328 has_ssice = h2oice_depth > 0._dp 1329 ss_sublim = flux_ssice < -eps 1330 ss_cond = flux_ssice > eps 1331 surf_sublim = d_h2oice < -eps 1332 surf_cond = d_h2oice > eps 1333 1334 if (has_ssice) then 1335 if (ss_sublim) then 1336 if (surf_sublim) then 1337 call print_msg('Sublimating subsurface ice but sublimating surface ice is also present!'//trim(cell_tag),LVL_ERR) 1338 else if (surf_cond) then 1339 call print_msg('Sublimating subsurface ice but condensing surface ice is also present!'//trim(cell_tag),LVL_WRN) 1340 call print_msg('This may happen because yearly minimum of frost is growing!',LVL_WRN) 1341 call print_msg('Choice: condensing surface ice overrules sublimating subsurface ice!',LVL_WRN) 1342 flux_ssice = 0._dp 1343 else 1344 ! Needed so the layering algorithm receives a retreat tendency 1345 d_h2oice = flux_ssice 1346 end if 1347 else if (ss_cond) then 1348 if (surf_cond) then 1349 call print_msg('Condensing subsurface ice but condensing surface ice is also present!'//trim(cell_tag),LVL_WRN) 1350 call print_msg('This may happen because yearly minimum of frost is growing!',LVL_WRN) 1351 call print_msg('Choice: condensing surface ice overrules condensing subsurface ice!',LVL_WRN) 1352 flux_ssice = 0._dp 1353 else if (surf_sublim) then 1354 call print_msg('Condensing subsurface ice but sublimating surface ice is also present!'//trim(cell_tag),LVL_ERR) 1355 else 1356 call print_msg('Condensing subsurface ice cannot be handled by the current layering algorithm!'//trim(cell_tag),LVL_ERR) 1357 end if 1358 else 1359 flux_ssice = 0._dp ! Very small subsurface flux is set to zero to avoid numerical issues 1360 end if 1361 else 1362 if (abs(flux_ssice) > eps) call print_msg('Subsurface ice flux is non-zero while there is no subsurface ice!'//trim(cell_tag),LVL_ERR) 1363 end if 1364 1365 END SUBROUTINE settle_h2o_surf_subsurf_tend 1366 !======================================================================= 1367 1368 !======================================================================= 1369 SUBROUTINE evolve_layering(this,d_co2ice,d_h2oice,h2oice_depth,flux_ssice,new_str,zshift_surf,new_lag,zlag,current,icell,jcell) 1227 1370 !----------------------------------------------------------------------- 1228 1371 ! NAME … … 1239 1382 ! 1240 1383 ! NOTES 1241 ! Creates dust lag layers when ice sublimation occurs.1384 ! 1242 1385 !----------------------------------------------------------------------- 1243 1386 … … 1255 1398 ! ARGUMENTS 1256 1399 ! --------- 1257 real(dp), intent(in) :: d_co2ice, d_h2oice 1258 type(layering), intent(inout) :: this 1259 type(stratum), pointer, intent(inout) :: current 1260 logical(k4), intent(inout) :: new_str, new_lag 1261 real(dp), intent(out) :: zshift_surf, zlag 1262 1263 ! LOCAL VARIABLES 1264 ! --------------- 1265 real(dp) :: dh_co2ice, dh_h2oice, dh_dust, dh_dust_co2, dh_dust_h2o 1266 real(dp) :: h_co2ice_old, h_h2oice_old 1267 real(dp) :: h2subl_co2ice, h2subl_h2oice, h2subl_co2ice_tot, h2subl_h2oice_tot 1268 real(dp) :: h2lift, h2lift_tot, h_pore, h_tot, h_toplag, R_subl 1269 logical(k4) :: unexpected 1270 type(stratum), pointer :: currentloc 1271 1272 ! CODE 1273 ! ---- 1400 real(dp), intent(inout) :: d_co2ice, d_h2oice, flux_ssice 1401 real(dp), intent(in) :: h2oice_depth 1402 type(layering), intent(inout) :: this 1403 type(stratum), pointer, intent(inout) :: current 1404 logical(k4), intent(inout) :: new_str, new_lag 1405 real(dp), intent(out) :: zshift_surf, zlag 1406 integer(di), intent(in), optional :: icell, jcell 1407 1408 ! LOCAL VARIABLES 1409 ! --------------- 1410 real(dp) :: dh_co2ice, dh_h2oice, dh_dust, dh_dust_co2, dh_dust_h2o 1411 real(dp) :: h_co2ice_old, h_h2oice_old 1412 real(dp) :: h2subl_co2ice, h2subl_h2oice, h2subl_co2ice_tot, h2subl_h2oice_tot 1413 real(dp) :: h2lift, h2lift_tot, h_pore, h_tot!, R_subl 1414 logical(k4) :: unexpected 1415 1416 ! CODE 1417 ! ---- 1418 call settle_h2o_surf_subsurf_tend(h2oice_depth,flux_ssice,d_h2oice,icell,jcell) 1419 1274 1420 dh_co2ice = d_co2ice/rho_co2ice 1275 1421 dh_h2oice = d_h2oice/rho_h2oice … … 1298 1444 else if (dh_co2ice >= 0._dp .and. dh_h2oice >= 0._dp .and. dh_dust >= 0._dp) then 1299 1445 ! Which porosity is considered? 1300 if (dh_co2ice > dh_h2oice .and. dh_co2ice >dh_dust) then ! CO2 ice is dominant1446 if (dh_co2ice >= dh_h2oice .and. dh_co2ice >= dh_dust) then ! CO2 ice is dominant 1301 1447 h_pore = dh_co2ice*co2ice_porosity/(1._dp - co2ice_porosity) 1302 else if (dh_h2oice > dh_co2ice .and. dh_h2oice >dh_dust) then ! H2O ice is dominant1448 else if (dh_h2oice >= dh_co2ice .and. dh_h2oice >= dh_dust) then ! H2O ice is dominant 1303 1449 h_pore = dh_h2oice*h2oice_porosity/(1._dp - h2oice_porosity) 1304 else if (dh_dust > dh_co2ice .and. dh_dust >dh_h2oice) then ! Dust is dominant1450 else if (dh_dust >= dh_co2ice .and. dh_dust >= dh_h2oice) then ! Dust is dominant 1305 1451 h_pore = dh_dust*regolith_porosity/(1._dp - regolith_porosity) 1306 1452 else … … 1330 1476 1331 1477 ! How much is CO2 ice sublimation inhibited by the top dust lag? 1332 R_subl = 1. 1333 if (associated(current%up)) then ! If there is an upper stratum 1334 h_toplag = 0._dp 1335 currentloc => current%up 1336 do while (is_dust_lag(currentloc) .and. associated(currentloc%up)) 1337 h_toplag = h_toplag + thickness(currentloc) 1338 currentloc => currentloc%up 1339 end do 1340 if (currentloc%h_h2oice >= h_patchy_ice) then 1341 R_subl = 0._dp 1342 else if (0._dp < currentloc%h_h2oice .and. currentloc%h_h2oice < h_patchy_ice) then 1343 h_toplag = h_toplag + thickness(currentloc) 1344 R_subl = fred_sublco2**(h_toplag/hmin_lag_co2) 1345 else 1346 R_subl = fred_sublco2**(h_toplag/hmin_lag_co2) 1347 end if 1348 end if 1349 h2subl_co2ice_tot = h2subl_co2ice_tot*R_subl 1478 !call get_co2_subl_resistance(current,R_subl) 1479 !h2subl_co2ice_tot = h2subl_co2ice_tot*R_subl 1350 1480 1351 1481 ! Is there CO2 ice to sublimate? … … 1388 1518 end if 1389 1519 end do 1520 ! In case the retreat loop exhausted all strata while residual demand remains then the tendency is set to 0 1390 1521 if (h2subl_co2ice_tot > 0._dp) dh_co2ice = 0._dp ! No CO2 ice available anymore so the tendency is set to 0 1391 1522 if (h2subl_h2oice_tot > 0._dp) dh_h2oice = 0._dp ! No H2O ice available anymore so the tendency is set to 0 … … 1409 1540 1410 1541 ! How much is CO2 ice sublimation inhibited by the top dust lag? 1411 R_subl = 1. 1412 if (associated(current%up)) then ! If there is an upper stratum 1413 h_toplag = 0._dp 1414 currentloc => current%up 1415 do while (is_dust_lag(currentloc) .and. associated(currentloc%up)) 1416 h_toplag = h_toplag + thickness(currentloc) 1417 currentloc => currentloc%up 1418 end do 1419 if (currentloc%h_h2oice >= h_patchy_ice) then 1420 R_subl = 0._dp 1421 else if (0._dp < currentloc%h_h2oice .and. currentloc%h_h2oice < h_patchy_ice) then 1422 h_toplag = h_toplag + thickness(currentloc) 1423 R_subl = fred_sublco2**(h_toplag/hmin_lag_co2) 1424 else 1425 R_subl = fred_sublco2**(h_toplag/hmin_lag_co2) 1426 end if 1427 end if 1428 h2subl_co2ice_tot = h2subl_co2ice_tot*R_subl 1542 !call get_co2_subl_resistance(current,R_subl) 1543 !h2subl_co2ice_tot = h2subl_co2ice_tot*R_subl 1429 1544 1430 1545 ! Is there CO2 ice to sublimate? … … 1461 1576 end if 1462 1577 end do 1578 ! In case the retreat loop exhausted all strata while residual demand remains then the tendency is set to 0 1463 1579 if (h2subl_co2ice_tot > 0._dp) dh_co2ice = 0._dp ! No CO2 ice available anymore so the tendency is set to 0 1464 1580 if (h2lift_tot > 0._dp) dh_dust = 0._dp ! No dust available anymore so the tendency is set to 0 … … 1499 1615 1500 1616 ! How much is CO2 ice sublimation inhibited by the top dust lag? 1501 R_subl = 1._dp 1502 if (associated(current%up)) then ! If there is an upper stratum 1503 h_toplag = 0._dp 1504 currentloc => current%up 1505 do while (is_dust_lag(currentloc) .and. associated(currentloc%up)) 1506 h_toplag = h_toplag + thickness(currentloc) 1507 currentloc => currentloc%up 1508 end do 1509 if (currentloc%h_h2oice >= h_patchy_ice) then 1510 R_subl = 0._dp 1511 else if (0._dp < currentloc%h_h2oice .and. currentloc%h_h2oice < h_patchy_ice) then 1512 h_toplag = h_toplag + thickness(currentloc) 1513 R_subl = fred_sublco2**(h_toplag/hmin_lag_co2) 1514 else 1515 R_subl = fred_sublco2**(h_toplag/hmin_lag_co2) 1516 end if 1517 end if 1518 h2subl_co2ice_tot = h2subl_co2ice_tot*R_subl 1617 !call get_co2_subl_resistance(current,R_subl) 1618 !h2subl_co2ice_tot = h2subl_co2ice_tot*R_subl 1519 1619 1520 1620 ! Is there CO2 ice to sublimate? … … 1551 1651 end if 1552 1652 end do 1653 ! In case the retreat loop exhausted all strata while residual demand remains then the tendency is set to 0 1553 1654 if (h2subl_co2ice_tot > 0._dp) dh_co2ice = 0._dp ! No CO2 ice available anymore so the tendency is set to 0 1554 1655 if (h2lift_tot > 0._dp) dh_dust = 0._dp ! No dust available anymore so the tendency is set to 0 … … 1567 1668 end if 1568 1669 1670 ! New tendencies for ice 1671 d_co2ice = dh_co2ice*rho_co2ice 1672 d_h2oice = dh_h2oice*rho_h2oice 1673 1569 1674 zshift_surf = this%top%top_elevation - zshift_surf 1570 1675 -
trunk/LMDZ.COMMON/libf/evolution/maths.F90
r4138 r4180 17 17 ! DEPENDENCIES 18 18 ! ------------ 19 use numerics, only: dp, di, k4 , minieps19 use numerics, only: dp, di, k4 20 20 21 21 ! DECLARATION -
trunk/LMDZ.COMMON/libf/evolution/numerics.F90
r4076 r4180 74 74 real(qp), parameter :: minieps_qp = epsilon(1._qp) 75 75 real(wp), parameter :: minieps = epsilon(1._wp) 76 real(wp), parameter :: tol = 100._wp*minieps 76 real(wp), parameter :: eps = 100._wp*minieps ! ~ 10^(-14) 77 real(wp), parameter :: eps_qp = 100._wp*minieps_qp ! ~ 10^(-14) 78 real(wp), parameter :: tol = 100._wp*eps ! ~ 10^(-12) 77 79 78 80 ! Minimum number of significant decimal digits -
trunk/LMDZ.COMMON/libf/evolution/orbit.F90
r4170 r4180 15 15 ! DEPENDENCIES 16 16 ! ------------ 17 use numerics, only: dp, di, k4, largest_nb, minieps17 use numerics, only: dp, di, k4, largest_nb, eps 18 18 19 19 ! DECLARATION … … 477 477 call print_msg('Obl. (current|accepted min|accepted max): '//real2str(obliquity)//' | '//real2str(min_obl)//real2str(max_obl),LVL_NFO) 478 478 479 max_ecc = min(eccentricity + max_change_ecc,1. - minieps) ! ecc < 1.479 max_ecc = min(eccentricity + max_change_ecc,1. - eps) ! ecc < 1. 480 480 min_ecc = max(eccentricity - max_change_ecc,0._dp) ! ecc >= 0. 481 481 call print_msg('Ecc. (current|accepted min|accepted max): '//real2str(eccentricity)//' | '//real2str(min_ecc)//' | '//real2str(max_ecc),LVL_NFO) -
trunk/LMDZ.COMMON/libf/evolution/output.F90
r4170 r4180 16 16 ! DEPENDENCIES 17 17 ! ------------ 18 use numerics, only: dp, di, k4, minieps18 use numerics, only: dp, di, k4, eps 19 19 20 20 ! DECLARATION … … 469 469 470 470 ! If output timing not met, return 471 if (abs(mod(idt,output_rate)) > minieps) return471 if (abs(mod(idt,output_rate)) > eps) return 472 472 473 473 ! If it is the first writing of the current timestep -
trunk/LMDZ.COMMON/libf/evolution/pem.F90
r4174 r4180 31 31 use clim_state_init, only: read_start, read_startfi, read_startevo 32 32 use config, only: read_rundef, read_display_config 33 use display, only: print_ini, print_end, print_msg, LVL_NFO, LVL_WRN33 use display, only: print_ini, print_end, print_msg, is_lvl_enabled, LVL_NFO, LVL_WRN, LVL_DBG 34 34 use evolution, only: n_yr_run, n_yr_sim, ntot_yr_sim, nmax_yr_run, dt, idt, r_plnt2earth_yr, pem_ini_date 35 35 use geometry, only: ngrid, nslope, nsoil_PCM, nsoil, cell_area, total_surface … … 38 38 use layered_deposits, only: do_layering, del_layering, evolve_layering, ptrarray, layering2surfice, surfice2layering, print_layering 39 39 use maths, only: pi 40 use numerics, only: dp, qp, di, li, k4, minieps, minieps_qp40 use numerics, only: dp, qp, di, li, k4, eps, eps_qp 41 41 use orbit, only: evo_orbit, read_orbitpm, compute_maxyr_orbit, update_orbit 42 42 use output, only: write_diagevo, dim_ngrid, dim_nsoil … … 233 233 if (do_layering) then 234 234 h2oice_depth_old(:,:) = h2oice_depth(:,:) 235 ! The sublimating tendency coming from subsurface ice is given through the surface ice tendency236 where (h2oice_depth(:,:) > 0. .and. flux_ssice_avg(:,:) < 0._dp) d_h2oice(:,:) = flux_ssice_avg(:,:)237 235 do islope = 1,nslope 238 236 do i = 1,ngrid 239 call evolve_layering(layerings_map(i,islope),d_co2ice(i,islope),d_h2oice(i,islope),new_str(i,islope),zshift_surf(i,islope),new_lag(i,islope),zlag(i,islope),current(i,islope)%p) 240 call print_layering(layerings_map(i,islope)) 237 call evolve_layering(layerings_map(i,islope),d_co2ice(i,islope),d_h2oice(i,islope),h2oice_depth(i,islope),flux_ssice_avg(i,islope), & 238 new_str(i,islope),zshift_surf(i,islope),new_lag(i,islope),zlag(i,islope),current(i,islope)%p,i,islope) 239 if (is_lvl_enabled(LVL_DBG)) call print_layering(layerings_map(i,islope)) 241 240 end do 242 241 end do … … 255 254 call evolve_h2oice(delta_h2o_ads,delta_icetable,h2o_ice,d_h2oice,zshift_surf,stopcrit) 256 255 call evolve_co2ice(co2_ice,d_co2ice,zshift_surf) 257 end if 258 259 ! Flow glaciers according to surface ice 260 if (co2ice_flow) then 261 allocate(is_co2ice_flow(ngrid,nslope)) 262 call flow_co2glaciers(q_co2_ts,ps_ts,ps_avg_glob_old,ps_avg_glob,co2_ice,is_co2ice_flow) 263 end if 264 if (h2oice_flow) then 265 allocate(is_h2oice_flow(ngrid,nslope)) 266 call flow_h2oglaciers(tsurf_avg,h2o_ice,is_h2oice_flow) 267 end if 268 if (do_layering) call surfice2layering(h2o_ice,co2_ice,layerings_map) 256 257 ! Flow glaciers according to surface ice 258 if (co2ice_flow) then 259 allocate(is_co2ice_flow(ngrid,nslope)) 260 call flow_co2glaciers(q_co2_ts,ps_ts,ps_avg_glob_old,ps_avg_glob,co2_ice,is_co2ice_flow) 261 end if 262 if (h2oice_flow) then 263 allocate(is_h2oice_flow(ngrid,nslope)) 264 call flow_h2oglaciers(tsurf_avg,h2o_ice,is_h2oice_flow) 265 end if 266 end if ! do_layering 269 267 270 268 ! Adapt surface temperature if surface ice disappeared … … 337 335 338 336 ! Checking mass balance for CO2 339 if (abs(CO2cond_ps_PCM - 1._dp) < minieps) then337 if (abs(CO2cond_ps_PCM - 1._dp) < eps) then 340 338 totmass_co2ice = 0._dp 341 339 totmass_atmco2 = 0._dp … … 346 344 end do 347 345 end do 348 totmass_ini = max(totmass_atmco2_ini + totmass_co2ice_ini + totmass_adsco2_ini, minieps_qp) ! To avoid division by 0346 totmass_ini = max(totmass_atmco2_ini + totmass_co2ice_ini + totmass_adsco2_ini,eps_qp) ! To avoid division by 0 349 347 call print_msg('> Relative total CO2 mass balance = '//real2str(100._qp*(totmass_atmco2 + totmass_co2ice + totmass_adsco2 - totmass_atmco2_ini - totmass_co2ice_ini - totmass_adsco2_ini)/totmass_ini)//' %',LVL_NFO) 350 348 if (abs((totmass_atmco2 + totmass_co2ice + totmass_adsco2 - totmass_atmco2_ini - totmass_co2ice_ini - totmass_adsco2_ini)/totmass_ini) > 0.01_qp) then 351 349 call print_msg('Mass balance is not conserved!',LVL_WRN) 352 totmass_ini = max(totmass_atmco2_ini, minieps_qp) ! To avoid division by 0350 totmass_ini = max(totmass_atmco2_ini,eps_qp) ! To avoid division by 0 353 351 call print_msg(' Atmospheric CO2 mass balance = '//real2str(100._qp*(totmass_atmco2 - totmass_atmco2_ini)/totmass_ini)//' %',LVL_WRN) 354 totmass_ini = max(totmass_co2ice_ini, minieps_qp) ! To avoid division by 0352 totmass_ini = max(totmass_co2ice_ini,eps_qp) ! To avoid division by 0 355 353 call print_msg(' CO2 ice mass balance = '//real2str(100._qp*(totmass_co2ice - totmass_co2ice_ini)/totmass_ini)//' %',LVL_WRN) 356 totmass_ini = max(totmass_adsco2_ini, minieps_qp) ! To avoid division by 0354 totmass_ini = max(totmass_adsco2_ini,eps_qp) ! To avoid division by 0 357 355 call print_msg(' Adsorbed CO2 mass balance = '//real2str(100._qp*(totmass_adsco2 - totmass_adsco2_ini)/totmass_ini)//' %',LVL_WRN) 358 356 end if … … 412 410 call update_workflow_status(n_yr_run,stopcrit%stop_code(),n_yr_sim,ntot_yr_sim) 413 411 414 ! Deallocation 415 if (do_layering) then 416 deallocate(h2oice_depth,h2oice_depth_old,new_str,new_lag,current) 417 do islope = 1,nslope 418 do i = 1,ngrid 419 call del_layering(layerings_map(i,islope)) 420 end do 421 end do 422 end if 412 ! Clean-up 413 if (do_layering) deallocate(h2oice_depth,h2oice_depth_old,new_str,new_lag,current) 423 414 call end_allocation() 424 415 -
trunk/LMDZ.COMMON/libf/evolution/planet.F90
r4170 r4180 21 21 ! ------------ 22 22 use numerics, only: dp, qp, k4 23 use layered_deposits, only: layering 23 use layered_deposits, only: layering, del_layering 24 24 25 25 ! DECLARATION … … 231 231 implicit none 232 232 233 ! LOCAL VARIABLES 234 ! --------------- 235 integer :: i, islope 236 233 237 ! CODE 234 238 ! ---- … … 253 257 delta_h2o_ads(:) = 0._dp 254 258 delta_co2_ads(:) = 0._dp 259 do islope = 1,nslope 260 do i = 1,ngrid 261 layerings_map(i,islope)%nb_str = 0 262 nullify(layerings_map(i,islope)%bottom,layerings_map(i,islope)%top) 263 end do 264 end do 255 265 256 266 END SUBROUTINE allocate_startevo_state … … 386 396 !----------------------------------------------------------------------- 387 397 388 ! DECLARATION 389 ! ----------- 390 implicit none 398 ! DEPENDENCIES 399 ! ------------ 400 use geometry, only: ngrid, nslope 401 402 ! DECLARATION 403 ! ----------- 404 implicit none 405 406 ! LOCAL VARIABLES 407 ! --------------- 408 integer :: i, islope 391 409 392 410 ! CODE … … 407 425 if (allocated(tsoil_ts)) deallocate(tsoil_ts) 408 426 if (allocated(tsoil_ts_old)) deallocate(tsoil_ts_old) 409 if (allocated(layerings_map)) deallocate(layerings_map) 427 if (allocated(layerings_map)) then 428 do islope = 1,nslope 429 do i = 1,ngrid 430 call del_layering(layerings_map(i,islope)) 431 end do 432 end do 433 deallocate(layerings_map) 434 end if 410 435 if (allocated(h2o_soildensity_avg)) deallocate(h2o_soildensity_avg) 411 436 if (allocated(delta_co2_ads)) deallocate(delta_co2_ads) … … 424 449 if (allocated(d_co2ice_ini)) deallocate(d_co2ice_ini) 425 450 if (allocated(d_h2oice)) deallocate(d_h2oice) 426 if (allocated(layerings_map)) deallocate(layerings_map)427 451 if (allocated(flux_ssice_avg)) deallocate(flux_ssice_avg) 428 452 -
trunk/LMDZ.COMMON/libf/evolution/soil_therm_inertia.F90
r4135 r4180 18 18 ! DEPENDENCIES 19 19 ! ------------ 20 use numerics, only: dp, di, k4, minieps20 use numerics, only: dp, di, k4, eps 21 21 22 22 ! DECLARATION … … 143 143 regolith_inertia(:,islope) = inertiedat(:,1) 144 144 do ig = 1,ngrid 145 if (abs(h2o_ice(ig,islope)) < minieps) regolith_inertia(ig,islope) = TI_regolith_avg145 if (abs(h2o_ice(ig,islope)) < eps) regolith_inertia(ig,islope) = TI_regolith_avg 146 146 if (reg_thprop_dependp) then 147 147 if (TI(ig,1,islope) < reg_inertie_thresold) then … … 191 191 if (icetable_depth(ig,islope) > -1.e-6_dp) then 192 192 ! 3.0 Case where it is perennial ice 193 if (icetable_depth(ig,islope) < minieps) then193 if (icetable_depth(ig,islope) < eps) then 194 194 call get_ice_TI(.true.,1._dp,0._dp,ice_inertia) 195 195 do isoil = 1,nsoil -
trunk/LMDZ.COMMON/libf/evolution/sorption.F90
r4174 r4180 18 18 ! DEPENDENCIES 19 19 ! ------------ 20 use numerics, only: dp, qp, di, k4, minieps20 use numerics, only: dp, qp, di, k4, eps 21 21 22 22 ! DECLARATION … … 230 230 deltam_reg_slope(ig,islope) = 0._dp 231 231 do iloop = 1,index_breccia 232 if (TI(ig,iloop,islope) < inertie_thresold .and. abs(h2o_ice(ig,islope)) < minieps .and. abs(co2_ice(ig,islope)) < minieps) then232 if (TI(ig,iloop,islope) < inertie_thresold .and. abs(h2o_ice(ig,islope)) < eps .and. abs(co2_ice(ig,islope)) < eps) then 233 233 if (iloop == 1) then 234 234 deltam_reg_complete(ig,iloop,islope) = (dm_h2o_regolith_slope(ig,iloop,islope) - h2o_ads_reg(ig,iloop,islope))*(layer(iloop)) … … 347 347 do islope = 1,nslope 348 348 do iloop = 1,index_breccia 349 if (TI(ig,iloop,islope) < inertie_thresold .and. abs(h2o_ice(ig,islope)) < minieps .and. abs(co2_ice(ig,islope)) < minieps) then349 if (TI(ig,iloop,islope) < inertie_thresold .and. abs(h2o_ice(ig,islope)) < eps .and. abs(co2_ice(ig,islope)) < eps) then 350 350 dm_co2_regolith_slope(ig,iloop,islope) = as*rho_regolith*m_theta*(1._dp - theta_h2o_ads(ig,iloop,islope))*alpha*pco2_avg(ig)/ & 351 351 (alpha*pco2_avg(ig) + sqrt(tsoil(ig,iloop,islope))*exp(beta/tsoil(ig,iloop,islope))) 352 352 else 353 if (abs(co2_ads_reg(ig,iloop,islope)) < minieps) then !!! we are at first call353 if (abs(co2_ads_reg(ig,iloop,islope)) < eps) then !!! we are at first call 354 354 dm_co2_regolith_slope(ig,iloop,islope) = as*rho_regolith*m_theta*(1._dp - theta_h2o_ads(ig,iloop,islope))*alpha*pco2_avg(ig) & 355 355 /(alpha*pco2_avg(ig)+sqrt(tsoil(ig,iloop,islope))*exp(beta/tsoil(ig,iloop,islope))) … … 368 368 deltam_reg_slope(ig,islope) = 0._dp 369 369 do iloop = 1,index_breccia 370 if (TI(ig,iloop,islope) < inertie_thresold .and. abs(h2o_ice(ig,islope)) < minieps .and. abs(co2_ice(ig,islope)) < minieps) then370 if (TI(ig,iloop,islope) < inertie_thresold .and. abs(h2o_ice(ig,islope)) < eps .and. abs(co2_ice(ig,islope)) < eps) then 371 371 if (iloop == 1) then 372 372 deltam_reg_complete(ig,iloop,islope) = (dm_co2_regolith_slope(ig,iloop,islope) - co2_ads_reg(ig,iloop,islope))*(layer(iloop)) -
trunk/LMDZ.COMMON/libf/evolution/stopping_crit.F90
r4174 r4180 16 16 ! DEPENDENCIES 17 17 ! ------------ 18 use numerics, only: dp, qp, di, k4, minieps_qp18 use numerics, only: dp, di, k4 19 19 20 20 ! DECLARATION -
trunk/LMDZ.COMMON/libf/evolution/surf_ice.F90
r4174 r4180 16 16 ! DEPENDENCIES 17 17 ! ------------ 18 use numerics, only: dp, qp, di, k4, minieps18 use numerics, only: dp, qp, di, k4, eps, tol 19 19 20 20 ! DECLARATION … … 30 30 integer(di), parameter :: WEIGHT_RESERVOIR = 5_di ! Weight by locally available H2O ice mass 31 31 integer(di), parameter :: WEIGHT_DIRECTION = 6_di ! Weight by directional capacity (up/down) 32 integer(di), private :: weight_method = WEIGHT_ DIRECTION! Default method for balancing32 integer(di), private :: weight_method = WEIGHT_COMBINED ! Default method for balancing 33 33 real(dp), parameter :: rho_co2ice = 1650._dp ! Density of CO2 ice [kg.m-3] 34 34 real(dp), parameter :: rho_h2oice = 920._dp ! Density of H2O ice [kg.m-3] … … 420 420 ! --------------- 421 421 integer(di), parameter :: max_iter = 50_di ! Maximum number of iterations for the balancing procedure 422 real(dp), parameter :: eps = 1.e-12_dp ! Small number to prevent division by zero in weights normalization423 real(dp), parameter :: tiny_corr = minieps ! Minimum correction to consider that progress is made in the balancing procedure424 422 integer(di) :: i, islope, iter 425 423 integer(di) :: method_used … … 556 554 Delta = Delta - Delta_used 557 555 558 if (abs(Delta_used) < tiny_corr) exit 556 ! Test if the balancing procedure progresses 557 if (abs(Delta_used) < tol) exit 559 558 end do 560 559 -
trunk/LMDZ.COMMON/libf/evolution/surf_temp.F90
r4147 r4180 16 16 ! DEPENDENCIES 17 17 ! ------------ 18 use numerics, only: dp, di, k4, minieps18 use numerics, only: dp, di, k4, eps 19 19 20 20 ! DECLARATION … … 182 182 do i = 1,nlon 183 183 do islope = 1,nslope 184 if (mask_co2ice_ini(i,j,islope) > 0.5_dp .and. co2ice_ll(i,j,islope) < minieps .and. mask_co2ice_disappeared(i,j,islope) < 0.5_dp) then184 if (mask_co2ice_ini(i,j,islope) > 0.5_dp .and. co2ice_ll(i,j,islope) < eps .and. mask_co2ice_disappeared(i,j,islope) < 0.5_dp) then 185 185 found = .false. 186 186 mask_co2ice_disappeared(i,j,islope) = 1._dp -
trunk/LMDZ.COMMON/libf/evolution/tendencies.F90
r4170 r4180 18 18 ! DEPENDENCIES 19 19 ! ------------ 20 use numerics, only: dp, di, k4, minieps, tol20 use numerics, only: dp, di, k4, eps 21 21 22 22 ! DECLARATION … … 62 62 63 63 ! If the difference is too small, then there is no evolution 64 where (abs(d_ice) < minieps) d_ice = 0._dp64 where (abs(d_ice) < eps) d_ice = 0._dp 65 65 66 66 ! If the tendency is negative but there is no ice reservoir for the PEM 67 where (d_ice(:,:) < 0._dp .and. abs(perice(:,:)) < minieps) d_ice(:,:) = 0._dp67 where (d_ice(:,:) < 0._dp .and. abs(perice(:,:)) < eps) d_ice(:,:) = 0._dp 68 68 69 69 END SUBROUTINE compute_tendice … … 170 170 ! ARGUMENTS 171 171 ! --------- 172 real(dp), dimension(:,:), intent(in) :: h2oice_depth_old ! Old H2O ice depth173 real(dp), dimension(:,:), intent(in) :: h2oice_depth_new ! New H2O ice depth174 real(dp), dimension(:,:), intent(in) :: tsurf ! Surface temperature175 real(dp), dimension(:,:,:,:), intent(in) :: tsoil_ts_old ! Old soil temperature time series176 real(dp), dimension(:,:,:,:), intent(in) :: tsoil_ts_new ! New soil temperature time series177 real(dp), dimension(:,:), intent(inout) :: flux_ssice_avg ! Tendency of sub-surface ice172 real(dp), dimension(:,:), intent(in) :: h2oice_depth_old ! Old H2O ice depth 173 real(dp), dimension(:,:), intent(in) :: h2oice_depth_new ! New H2O ice depth 174 real(dp), dimension(:,:), intent(in) :: tsurf ! Surface temperature 175 real(dp), dimension(:,:,:,:), intent(in) :: tsoil_ts_old ! Old soil temperature time series 176 real(dp), dimension(:,:,:,:), intent(in) :: tsoil_ts_new ! New soil temperature time series 177 real(dp), dimension(:,:), intent(inout) :: flux_ssice_avg ! Tendency of sub-surface ice 178 178 179 179 ! LOCAL VARIABLES … … 190 190 do islope = 1,nslope 191 191 ! Higher resistance due to growing lag layer (higher depth) 192 Rz_old = h2oice_depth_old(i,islope)*zcdv/ coef_ssdif_PCM(i,islope) ! Old resistance from PCM193 Rz_new = h2oice_depth_new(i,islope)*zcdv/ coef_ssdif_PCM(i,islope) ! New resistance based on new depth194 R_dec = Rz_old/ Rz_new! Decrease because of resistance192 Rz_old = h2oice_depth_old(i,islope)*zcdv/max(abs(coef_ssdif_PCM(i,islope)),eps) ! Old resistance from PCM 193 Rz_new = h2oice_depth_new(i,islope)*zcdv/max(abs(coef_ssdif_PCM(i,islope)),eps) ! New resistance based on new depth 194 R_dec = Rz_old/max(Rz_new,eps) ! Decrease because of resistance 195 195 196 196 ! The maxmimum of the daily averages over one year for the saturation vapor pressure at the ice table location … … 203 203 204 204 ! Lower humidity due to growing lag layer (higher depth) 205 if (abs(psv_max_old) < tol) then205 if (abs(psv_max_old) < eps) then 206 206 hum_dec = 1._dp 207 207 else -
trunk/LMDZ.COMMON/libf/evolution/utility.F90
r4117 r4180 16 16 ! DEPENDENCIES 17 17 ! ------------ 18 use numerics, only: dp, qp, di, li, k4, minieps18 use numerics, only: dp, qp, di, li, k4, eps 19 19 20 20 ! DECLARATION … … 302 302 idigits = 1 303 303 ! If x /= 0 then: 304 if (abs(x) >= minieps) idigits = int(log10(abs(x))) + 1304 if (abs(x) >= eps) idigits = int(log10(abs(x))) + 1 305 305 306 306 END FUNCTION nb_digits
Note: See TracChangeset
for help on using the changeset viewer.
