From 2d0e1758a662c2fb4b1aa4dd47e96c56b60b1c38 Mon Sep 17 00:00:00 2001 From: Rich Fiorella Date: Tue, 11 Jun 2024 14:39:25 -0600 Subject: [PATCH] Add missing allocation of wt_polygon matrix wt_polygon had never been allocated in elm_initializeMod, so needs to be added here in order to get polygon weights in surfrdMod.F90 --- components/elm/src/main/elm_initializeMod.F90 | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/components/elm/src/main/elm_initializeMod.F90 b/components/elm/src/main/elm_initializeMod.F90 index 2a8079692379..e131a1938076 100755 --- a/components/elm/src/main/elm_initializeMod.F90 +++ b/components/elm/src/main/elm_initializeMod.F90 @@ -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 @@ -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 @@ -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 @@ -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 )) @@ -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