Skip to content

Commit

Permalink
Add missing allocation of wt_polygon matrix
Browse files Browse the repository at this point in the history
wt_polygon had never been allocated in
elm_initializeMod, so needs to be added here in order
to get polygon weights in surfrdMod.F90
  • Loading branch information
rfiorella committed Jun 11, 2024
1 parent 3189a91 commit 2d0e175
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions components/elm/src/main/elm_initializeMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ module elm_initializeMod
use elm_varctl , only : use_lch4, use_cn, use_voc, use_c13, use_c14
use elm_varctl , only : use_fates, use_betr, use_fates_sp, use_fan
use elm_varsur , only : wt_lunit, urban_valid, wt_nat_patch, wt_cft, wt_glc_mec, topo_glc_mec,firrig,f_surf,f_grd
use elm_varsur , only : fert_cft, fert_p_cft
use elm_varsur , only : fert_cft, fert_p_cft, wt_polygon
use elm_varsur , only : wt_tunit, elv_tunit, slp_tunit,asp_tunit,num_tunit_per_grd
use perf_mod , only : t_startf, t_stopf
!use readParamsMod , only : readParameters
Expand Down Expand Up @@ -62,7 +62,7 @@ subroutine initialize1( )
use elm_varpar , only: update_pft_array_bounds
use elm_varpar , only: surfpft_lb, surfpft_ub
use elm_varcon , only: elm_varcon_init
use landunit_varcon , only: landunit_varcon_init, max_lunit, istice_mec
use landunit_varcon , only: landunit_varcon_init, max_lunit, istice_mec, max_polygon
use column_varcon , only: col_itype_to_icemec_class
use elm_varctl , only: fsurdat, fatmlndfrc, flndtopo, fglcmask, noland, version
use pftvarcon , only: pftconrd
Expand All @@ -86,7 +86,7 @@ subroutine initialize1( )
use filterMod , only: allocFilters
use reweightMod , only: reweight_wrapup
use topounit_varcon , only: max_topounits, has_topounit, topounit_varcon_init
use elm_varctl , only: use_top_solar_rad
use elm_varctl , only: use_top_solar_rad, use_polygonal_tundra
!
! !LOCAL VARIABLES:
integer :: ier ! error status
Expand Down Expand Up @@ -279,6 +279,11 @@ subroutine initialize1( )
allocate (wt_glc_mec (1,1,1))
allocate (topo_glc_mec(1,1,1))
endif
if (use_polygonal_tundra) then
allocate (wt_polygon (begg:endg,1:max_topounits, max_polygon))
else
allocate (wt_polygon (1,1,1)) ! RF-not sure this is needed
endif

allocate (wt_tunit (begg:endg,1:max_topounits ))
allocate (elv_tunit (begg:endg,1:max_topounits ))
Expand Down Expand Up @@ -421,6 +426,7 @@ subroutine initialize1( )
!deallocate (wt_lunit, wt_cft, wt_glc_mec)
deallocate (wt_cft, wt_glc_mec) !wt_lunit not deallocated because it is being used in CanopyHydrologyMod.F90
deallocate (wt_tunit, elv_tunit, slp_tunit, asp_tunit,num_tunit_per_grd)
deallocate (wt_polygon) ! RF - might be used elsewhere, not sure if we want to deallocate here.
call t_stopf('elm_init1')

! initialize glc_topo
Expand Down

0 comments on commit 2d0e175

Please sign in to comment.