Skip to content

Commit 898148e

Browse files
Dalei Haodaleihao
authored andcommitted
add finetop
debug & define cosinc_col add model outputs; & modify surface area correction for longwave radiation & debug correct surface area for thermal radiation for soilT module update snowsnicar_AD model change COSINC output name to avoid duplicate fix a small bug in variable name fix small bugs debug debug fix bugs set SZA<85 limit fix small bugs fix one bug and add initialization for few variables fix small bugs delete log output and add control to adjust albedo delete log output delete write output add more outputs like MODIS daytime and nighttime ST debug fix a small bug add MODIS FSNO output fix a bug clean up the code in biogeophys clean up the code in main clean up the code fix urban bug add code to calculate apparent surface albedo for EAM fix a small bug debug debug & modify code to not change for urban landunits debug fix typo debug consider the top effects on upward radaiton to sky debug Conflicts: components/elm/src/biogeophys/SoilFluxesMod.F90 components/elm/src/biogeophys/SurfaceAlbedoMod.F90 components/elm/src/main/atm2lndType.F90 components/elm/src/main/elm_initializeMod.F90 fix a LAI bug delete ; debug & add test add restart variables fix a bug debug debug restart issues remove log output
1 parent 9cfdf01 commit 898148e

32 files changed

+925
-125
lines changed

cime_config/tests.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,8 @@
101101
"ERS.ELM_USRDAT.I1850ELM.elm-usrdat",
102102
"ERS.r05_r05.IELM.elm-lnd_rof_2way",
103103
"ERS.r05_r05.IELM.elm-V2_ELM_MOSART_features",
104-
"ERS.ELM_USRDAT.IELM.elm-surface_water_dynamics"
104+
"ERS.ELM_USRDAT.IELM.elm-surface_water_dynamics",
105+
"ERS.ELM_USRDAT.IELM.elm-finetop_rad"
105106
)
106107
},
107108

components/elm/bld/namelist_files/namelist_defaults.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -661,6 +661,9 @@ this mask will have smb calculated over the entire global land surface
661661
<!--ftopdat>same as fsurfdat </ftopdat-->
662662
<use_top_solar_rad>.false.</use_top_solar_rad>
663663

664+
<!-- Use the radiation parameterization for fine-scale topographic effects -->
665+
<use_finetop_rad>.false.</use_finetop_rad>
666+
664667
<!-- SNICAR (SNow, ICe, and Aerosol Radiative model) datasets -->
665668
<!-- *********** Resolution independent: *********** -->
666669
<fsnowoptics >lnd/clm2/snicardata/snicar_optics_5bnd_mam_c160322.nc</fsnowoptics>

components/elm/bld/namelist_files/namelist_definition.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -760,6 +760,13 @@ If TRUE, TOP solar radiation parameterization will be activated, which considers
760760
</entry>
761761
<!-- End TOP solar radiation parameterization -->
762762

763+
<!-- fineTOP radiation parameterization -->
764+
<entry id="use_finetop_rad" type="logical" category="elm_physics"
765+
group="elm_inparm" valid_values="" value=".false.">
766+
If TRUE, fineTOP radiation parameterization will be activated, which considers the effects of fine(grid)-scale topography.
767+
</entry>
768+
<!-- End fineTOP radiation parameterization -->
769+
763770
<!-- ======================================================================================== -->
764771
<!-- Former CPP tokens -->
765772
<!-- ======================================================================================== -->
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
./xmlchange DATM_MODE=CLMMOSARTTEST
2+
3+
./xmlchange LND_DOMAIN_FILE=domain.lnd.1km_SierraNevada.c240628.nc
4+
./xmlchange ATM_DOMAIN_FILE=domain.lnd.1km_SierraNevada.c240628.nc
5+
./xmlchange LND_DOMAIN_PATH="\$DIN_LOC_ROOT/share/domains/domain.clm"
6+
./xmlchange ATM_DOMAIN_PATH="\$DIN_LOC_ROOT/share/domains/domain.clm"
7+
8+
./xmlchange -file env_run.xml -id DATM_CLMNCEP_YR_END -val 2000
9+
./xmlchange -file env_run.xml -id DATM_CLMNCEP_YR_START -val 2000
10+
./xmlchange -file env_run.xml -id DATM_CLMNCEP_YR_ALIGN -val 1
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
fsurdat = '$DIN_LOC_ROOT/lnd/clm2/surfdata_map/surfdata_1km_SierraNevada_simyr2010_c240628.nc'
2+
use_finetop_rad = .true.
3+
use_top_solar_rad = .false.

components/elm/cime_config/testdefs/testmods_dirs/elm/snowveg_arctic/shell_commands

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@
77
./xmlchange DATM_CLMNCEP_YR_END=2000
88
./xmlchange ELM_USRDAT_NAME=42_FLUXNETSITES
99
./xmlchange NTASKS=1
10-
./xmlchange NTHRDS=1
10+
./xmlchange NTHRDS=1

components/elm/src/biogeophys/CanopyFluxesMod.F90

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ module CanopyFluxesMod
1414
use shr_log_mod , only : errMsg => shr_log_errMsg
1515
use abortutils , only : endrun
1616
use elm_varctl , only : iulog, use_cn, use_lch4, use_c13, use_c14, use_fates
17-
use elm_varctl , only : use_hydrstress
17+
use elm_varctl , only : use_hydrstress, use_finetop_rad
1818
use elm_varpar , only : nlevgrnd, nlevsno
1919
use elm_varcon , only : namep
2020
use elm_varcon , only : mm_epsilon
@@ -100,6 +100,7 @@ subroutine CanopyFluxes(bounds, num_nolakeurbanp, filter_nolakeurbanp, &
100100
use elm_varcon , only : isecspday, degpsec
101101
use pftvarcon , only : irrigated
102102
use elm_varcon , only : c14ratio
103+
use shr_const_mod , only : SHR_CONST_PI
103104

104105
!NEW
105106
use elm_varsur , only : firrig
@@ -314,7 +315,7 @@ subroutine CanopyFluxes(bounds, num_nolakeurbanp, filter_nolakeurbanp, &
314315
real(r8) :: tau_diff(bounds%begp:bounds%endp) ! Difference from previous iteration tau
315316
real(r8) :: prev_tau(bounds%begp:bounds%endp) ! Previous iteration tau
316317
real(r8) :: prev_tau_diff(bounds%begp:bounds%endp) ! Previous difference in iteration tau
317-
318+
real(r8) :: slope_rad, deg2rad
318319
character(len=64) :: event !! timing event
319320

320321
! Indices for raw and rah
@@ -329,6 +330,7 @@ subroutine CanopyFluxes(bounds, num_nolakeurbanp, filter_nolakeurbanp, &
329330
snl => col_pp%snl , & ! Input: [integer (:) ] number of snow layers
330331
dayl => grc_pp%dayl , & ! Input: [real(r8) (:) ] daylength (s)
331332
max_dayl => grc_pp%max_dayl , & ! Input: [real(r8) (:) ] maximum daylength for this grid cell (s)
333+
slope_deg => grc_pp%slope_deg , &
332334

333335
forc_lwrad => top_af%lwrad , & ! Input: [real(r8) (:) ] downward infrared (longwave) radiation (W/m**2)
334336
forc_q => top_as%qbot , & ! Input: [real(r8) (:) ] atmospheric specific humidity (kg/kg)
@@ -516,7 +518,7 @@ subroutine CanopyFluxes(bounds, num_nolakeurbanp, filter_nolakeurbanp, &
516518
end if
517519
#endif
518520

519-
521+
deg2rad = SHR_CONST_PI/180._r8
520522
! Initialize
521523
do f = 1, fn
522524
p = filterp(f)
@@ -701,6 +703,11 @@ subroutine CanopyFluxes(bounds, num_nolakeurbanp, filter_nolakeurbanp, &
701703
bir(p) = - (2._r8-emv(p)*(1._r8-emg(c))) * emv(p) * sb
702704
cir(p) = emv(p)*emg(c)*sb
703705

706+
if (use_finetop_rad) then
707+
slope_rad = slope_deg(g) * deg2rad
708+
bir(p) = bir(p) / cos(slope_rad)
709+
cir(p) = cir(p) / cos(slope_rad)
710+
endif
704711
! Saturated vapor pressure, specific humidity, and their derivatives
705712
! at the leaf surface
706713

@@ -1269,15 +1276,25 @@ subroutine CanopyFluxes(bounds, num_nolakeurbanp, filter_nolakeurbanp, &
12691276

12701277
! Downward longwave radiation below the canopy
12711278

1272-
dlrad(p) = (1._r8-emv(p))*emg(c)*forc_lwrad(t) + &
1273-
emv(p)*emg(c)*sb*tlbef(p)**3*(tlbef(p) + 4._r8*dt_veg(p))
1274-
1279+
if (use_finetop_rad) then
1280+
slope_rad = slope_deg(g) * deg2rad
1281+
dlrad(p) = (1._r8-emv(p))*emg(c)*forc_lwrad(t) + &
1282+
emv(p)*emg(c)*sb*tlbef(p)**3*(tlbef(p) + 4._r8*dt_veg(p))/cos(slope_rad)
1283+
else
1284+
dlrad(p) = (1._r8-emv(p))*emg(c)*forc_lwrad(t) + &
1285+
emv(p)*emg(c)*sb*tlbef(p)**3*(tlbef(p) + 4._r8*dt_veg(p))
1286+
endif
12751287
! Upward longwave radiation above the canopy
1276-
1277-
ulrad(p) = ((1._r8-emg(c))*(1._r8-emv(p))*(1._r8-emv(p))*forc_lwrad(t) &
1278-
+ emv(p)*(1._r8+(1._r8-emg(c))*(1._r8-emv(p)))*sb*tlbef(p)**3*(tlbef(p) + &
1279-
4._r8*dt_veg(p)) + emg(c)*(1._r8-emv(p))*sb*lw_grnd)
1280-
1288+
if (use_finetop_rad) then
1289+
slope_rad = slope_deg(g) * deg2rad
1290+
ulrad(p) = ((1._r8-emg(c))*(1._r8-emv(p))*(1._r8-emv(p))*forc_lwrad(t) &
1291+
+ emv(p)*(1._r8+(1._r8-emg(c))*(1._r8-emv(p)))*sb*tlbef(p)**3*(tlbef(p) + &
1292+
4._r8*dt_veg(p))/cos(slope_rad) + emg(c)*(1._r8-emv(p))*sb*lw_grnd/cos(slope_rad))
1293+
else
1294+
ulrad(p) = ((1._r8-emg(c))*(1._r8-emv(p))*(1._r8-emv(p))*forc_lwrad(t) &
1295+
+ emv(p)*(1._r8+(1._r8-emg(c))*(1._r8-emv(p)))*sb*tlbef(p)**3*(tlbef(p) + &
1296+
4._r8*dt_veg(p)) + emg(c)*(1._r8-emv(p))*sb*lw_grnd)
1297+
endif
12811298
! Derivative of soil energy flux with respect to soil temperature
12821299

12831300
cgrnds(p) = cgrnds(p) + cpair*forc_rho(t)*wtg(p)*wtal(p)

components/elm/src/biogeophys/CanopyHydrologyMod.F90

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ module CanopyHydrologyMod
2929
use elm_varcon , only : snw_rds_min
3030
use pftvarcon , only : irrigated
3131
use GridcellType , only : grc_pp
32-
use timeinfoMod, only : dtime_mod
32+
use timeinfoMod , only : dtime_mod
3333
!
3434
! !PUBLIC TYPES:
3535
implicit none
@@ -713,7 +713,7 @@ subroutine CanopyHydrology(bounds, &
713713
call FracH2oSfc(bounds, num_nolakec, filter_nolakec, &
714714
col_wf%qflx_h2osfc2topsoi, dtime)
715715

716-
end associate
716+
end associate
717717

718718
end subroutine CanopyHydrology
719719

components/elm/src/biogeophys/CanopyTemperatureMod.F90

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ module CanopyTemperatureMod
1313
use shr_kind_mod , only : r8 => shr_kind_r8
1414
use shr_const_mod , only : SHR_CONST_PI
1515
use decompMod , only : bounds_type
16-
use elm_varctl , only : iulog, use_fates
16+
use elm_varctl , only : iulog, use_fates, use_finetop_rad
1717
use PhotosynthesisMod , only : Photosynthesis, PhotosynthesisTotal, Fractionation
1818
use elm_instMod , only : alm_fates
1919
use SurfaceResistanceMod , only : calc_soilevap_stress
@@ -29,6 +29,7 @@ module CanopyTemperatureMod
2929
use ColumnDataType , only : col_es, col_ef, col_ws
3030
use VegetationType , only : veg_pp
3131
use VegetationDataType , only : veg_es, veg_ef, veg_wf
32+
use GridcellType , only : grc_pp
3233
!
3334
! !PUBLIC TYPES:
3435
implicit none
@@ -74,6 +75,7 @@ subroutine CanopyTemperature(bounds, &
7475
use column_varcon , only : icol_road_imperv, icol_road_perv
7576
use landunit_varcon , only : istice, istice_mec, istwet, istsoil, istdlak, istcrop, istdlak
7677
use elm_varpar , only : nlevgrnd, nlevurb, nlevsno, nlevsoi
78+
use shr_const_mod , only : SHR_CONST_PI
7779
!
7880
! !ARGUMENTS:
7981
type(bounds_type) , intent(in) :: bounds
@@ -109,6 +111,7 @@ subroutine CanopyTemperature(bounds, &
109111
real(r8) :: vol_ice ! partial volume of ice lens in layer
110112
real(r8) :: vol_liq ! partial volume of liquid water in layer
111113
real(r8) :: fh2o_eff(bounds%begc:bounds%endc) ! effective surface water fraction (i.e. seen by atm)
114+
real(r8) :: slope_rad, deg2rad
112115
!------------------------------------------------------------------------------
113116

114117
associate( &
@@ -200,6 +203,7 @@ subroutine CanopyTemperature(bounds, &
200203
tssbef => col_es%t_ssbef & ! Output: [real(r8) (:,:) ] soil/snow temperature before update (K)
201204
)
202205

206+
deg2rad = SHR_CONST_PI/180._r8
203207
do j = -nlevsno+1, nlevgrnd
204208
do fc = 1,num_nolakec
205209
c = filter_nolakec(fc)
@@ -409,6 +413,7 @@ subroutine CanopyTemperature(bounds, &
409413

410414
do fp = 1,num_nolakep
411415
p = filter_nolakep(fp)
416+
g = veg_pp%gridcell(p)
412417

413418
! Initial set (needed for history tape fields)
414419

@@ -439,7 +444,12 @@ subroutine CanopyTemperature(bounds, &
439444
! Vegetation Emissivity
440445

441446
avmuir = 1._r8
442-
emv(p) = 1._r8-exp(-(elai(p)+esai(p))/avmuir)
447+
if (use_finetop_rad .and. (.not. lun_pp%urbpoi(l))) then
448+
slope_rad = grc_pp%slope_deg(g) * deg2rad
449+
emv(p) = 1._r8-exp(-(elai(p)+esai(p))*cos(slope_rad)/avmuir)
450+
else
451+
emv(p) = 1._r8-exp(-(elai(p)+esai(p))/avmuir)
452+
endif
443453

444454
z0mv(p) = z0m(p)
445455
z0hv(p) = z0mv(p)

components/elm/src/biogeophys/SnowSnicarMod.F90

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1812,7 +1812,7 @@ subroutine SNICAR_AD_RT (flg_snw_ice, bounds, num_nourbanc, filter_nourbanc, &
18121812
use elm_varpar , only : nlevsno, numrad
18131813
use elm_time_manager , only : get_nstep
18141814
use shr_const_mod , only : SHR_CONST_PI
1815-
use elm_varctl , only : snow_shape, snicar_atm_type, use_dust_snow_internal_mixing
1815+
use elm_varctl , only : snow_shape, snicar_atm_type, use_dust_snow_internal_mixing, use_finetop_rad
18161816
!
18171817
! !ARGUMENTS:
18181818
integer , intent(in) :: flg_snw_ice ! flag: =1 when called from CLM, =2 when called from CSIM
@@ -1868,6 +1868,7 @@ subroutine SNICAR_AD_RT (flg_snw_ice, bounds, num_nourbanc, filter_nourbanc, &
18681868
!integer :: trip ! flag: =1 to redo RT calculation if result is unrealistic
18691869
!integer :: flg_dover ! defines conditions for RT redo (explained below)
18701870

1871+
real(r8):: slope_rad, deg2rad
18711872
real(r8):: albedo ! temporary snow albedo [frc]
18721873
real(r8):: flx_sum ! temporary summation variable for NIR weighting
18731874
real(r8):: albout_lcl(numrad_snw) ! snow albedo by band [frc]
@@ -2140,6 +2141,7 @@ subroutine SNICAR_AD_RT (flg_snw_ice, bounds, num_nourbanc, filter_nourbanc, &
21402141
! Define constants
21412142
pi = SHR_CONST_PI
21422143
nint_snw_rds_min = nint(snw_rds_min)
2144+
deg2rad = SHR_CONST_PI/180._r8
21432145

21442146
! always use Delta approximation for snow
21452147
DELTA = 1
@@ -2202,6 +2204,7 @@ subroutine SNICAR_AD_RT (flg_snw_ice, bounds, num_nourbanc, filter_nourbanc, &
22022204
! (when called from CSIM, there is only one column)
22032205
do fc = 1,num_nourbanc
22042206
c_idx = filter_nourbanc(fc)
2207+
g_idx = col_pp%gridcell(c_idx)
22052208

22062209
! Zero absorbed radiative fluxes:
22072210
do i=-nlevsno+1,1,1
@@ -2266,6 +2269,13 @@ subroutine SNICAR_AD_RT (flg_snw_ice, bounds, num_nourbanc, filter_nourbanc, &
22662269
lon_coord = 0
22672270
endif ! end if flg_snw_ice == 1
22682271

2272+
if (use_finetop_rad) then
2273+
slope_rad = grc_pp%slope_deg(g_idx) * deg2rad
2274+
h2osno_liq_lcl = h2osno_liq_lcl * cos(slope_rad)
2275+
h2osno_ice_lcl = h2osno_ice_lcl * cos(slope_rad)
2276+
h2osno_lcl = h2osno_lcl * cos(slope_rad)
2277+
endif
2278+
22692279
#ifdef MODAL_AER
22702280
!mgf++
22712281
!

0 commit comments

Comments
 (0)