@@ -167,10 +167,6 @@ subroutine canopy_structure( currentSite , bc_in )
167167 ! Perform numerical checks on some cohort and patch structures
168168 ! ------------------------------------------------------------------------------
169169
170- ! call val_check_ed_vars(currentPatch,'co_n:co_dbh:pa_area',return_code)
171- ! ! No need to make error message, already generated in math_check_ed_vars
172- ! if(return_code>0) call endrun(msg=errMsg(sourcefile, __LINE__))
173-
174170 ! canopy layer has a special bounds check
175171 currentCohort = > currentPatch% tallest
176172 do while (associated (currentCohort))
@@ -253,7 +249,7 @@ subroutine canopy_structure( currentSite , bc_in )
253249 area_not_balanced = .false.
254250 do i_lyr = 1 ,z
255251 call CanopyLayerArea(currentPatch,currentSite% spread,i_lyr,arealayer(i_lyr))
256- if ( ((arealayer(i_lyr)- currentPatch% area)/ currentPatch% area > area_check_rel_precision) .or. &
252+ if ( ((arealayer(i_lyr)- currentPatch% area)/ currentPatch% area > area_check_rel_precision) .or. &
257253 ((arealayer(i_lyr)- currentPatch% area) > area_check_precision ) ) then
258254 area_not_balanced = .true.
259255 endif
@@ -557,9 +553,11 @@ subroutine DemoteFromLayer(currentSite,currentPatch,i_lyr)
557553 do while (associated (currentCohort))
558554 if (currentCohort% canopy_layer == i_lyr) then
559555 area_res = area_res + &
560- currentCohort% c_area* currentCohort% excl_weight* scale_factor_min
556+ currentCohort% c_area * currentCohort% excl_weight * &
557+ scale_factor_min
561558 scale_factor_res = scale_factor_res + &
562- currentCohort% c_area * (1._r8 - (currentCohort% excl_weight * scale_factor_min))
559+ currentCohort% c_area * &
560+ (1._r8 - (currentCohort% excl_weight * scale_factor_min))
563561 endif
564562 currentCohort = > currentCohort% shorter
565563 enddo
@@ -577,15 +575,18 @@ subroutine DemoteFromLayer(currentSite,currentPatch,i_lyr)
577575 (1._r8 - (currentCohort% excl_weight* scale_factor_min) ) * scale_factor_res)
578576
579577 if (debug)then
580- if ((currentCohort% excl_weight > (currentCohort% c_area+ area_target_precision)) .or. &
578+ if ((currentCohort% excl_weight > &
579+ (currentCohort% c_area+ area_target_precision)) .or. &
581580 (currentCohort% excl_weight < 0._r8 ) ) then
582- write (fates_log(),* ) ' exclusion area error (2)'
583- write (fates_log(),* ) ' currentCohort%c_area: ' ,currentCohort% c_area
584- write (fates_log(),* ) ' currentCohort%excl_weight: ' ,currentCohort% excl_weight
585- write (fates_log(),* ) ' excess: ' ,currentCohort% excl_weight - currentCohort% c_area
586- call endrun(msg= errMsg(sourcefile, __LINE__))
581+ write (fates_log(),* ) ' exclusion area error (2)'
582+ write (fates_log(),* ) ' currentCohort%c_area: ' ,currentCohort% c_area
583+ write (fates_log(),* ) ' currentCohort%excl_weight: ' , &
584+ currentCohort% excl_weight
585+ write (fates_log(),* ) ' excess: ' , &
586+ currentCohort% excl_weight - currentCohort% c_area
587+ call endrun(msg= errMsg(sourcefile, __LINE__))
587588 end if
588- end if
589+ end if
589590
590591 endif
591592 currentCohort = > currentCohort% shorter
@@ -1017,18 +1018,22 @@ subroutine PromoteIntoLayer(currentSite,currentPatch,i_lyr)
10171018 currentCohort = > currentPatch% tallest
10181019 do while (associated (currentCohort))
10191020 if (currentCohort% canopy_layer == (i_lyr+1 ) ) then
1020- currentCohort% prom_weight = currentCohort% c_area * currentCohort% prom_weight * scale_factor
1021+ currentCohort% prom_weight = currentCohort% c_area * &
1022+ currentCohort% prom_weight * scale_factor
10211023
10221024 if (debug)then
1023- if ((currentCohort% prom_weight > (currentCohort% c_area+ area_target_precision)) .or. &
1024- (currentCohort% prom_weight < 0._r8 ) ) then
1025- write (fates_log(),* ) ' promotion area too big (1)'
1026- write (fates_log(),* ) ' currentCohort%c_area: ' ,currentCohort% c_area
1027- write (fates_log(),* ) ' currentCohort%prom_weight: ' ,currentCohort% prom_weight
1028- write (fates_log(),* ) ' excess: ' ,currentCohort% prom_weight - currentCohort% c_area
1029- call endrun(msg= errMsg(sourcefile, __LINE__))
1025+ if ((currentCohort% prom_weight > &
1026+ (currentCohort% c_area+ area_target_precision)) .or. &
1027+ (currentCohort% prom_weight < 0._r8 ) ) then
1028+ write (fates_log(),* ) ' promotion area too big (1)'
1029+ write (fates_log(),* ) ' currentCohort%c_area: ' ,currentCohort% c_area
1030+ write (fates_log(),* ) ' currentCohort%prom_weight: ' , &
1031+ currentCohort% prom_weight
1032+ write (fates_log(),* ) ' excess: ' , &
1033+ currentCohort% prom_weight - currentCohort% c_area
1034+ call endrun(msg= errMsg(sourcefile, __LINE__))
10301035 end if
1031- end if
1036+ end if
10321037
10331038 endif
10341039 currentCohort = > currentCohort% shorter
@@ -1047,7 +1052,8 @@ subroutine PromoteIntoLayer(currentSite,currentPatch,i_lyr)
10471052 area_res = area_res + &
10481053 currentCohort% c_area* currentCohort% prom_weight* scale_factor_min
10491054 scale_factor_res = scale_factor_res + &
1050- currentCohort% c_area * (1._r8 - (currentCohort% prom_weight * scale_factor_min))
1055+ currentCohort% c_area * &
1056+ (1._r8 - (currentCohort% prom_weight * scale_factor_min))
10511057 endif
10521058 currentCohort = > currentCohort% shorter
10531059 enddo
@@ -1062,16 +1068,20 @@ subroutine PromoteIntoLayer(currentSite,currentPatch,i_lyr)
10621068
10631069 currentCohort% prom_weight = currentCohort% c_area * &
10641070 (currentCohort% prom_weight * scale_factor_min + &
1065- (1._r8 - (currentCohort% prom_weight* scale_factor_min) ) * scale_factor_res)
1071+ (1._r8 - (currentCohort% prom_weight* scale_factor_min) ) * &
1072+ scale_factor_res)
10661073
10671074 if (debug)then
1068- if ((currentCohort% prom_weight > (currentCohort% c_area+ area_target_precision)) .or. &
1069- (currentCohort% prom_weight < 0._r8 ) ) then
1070- write (fates_log(),* ) ' promotion area error (2)'
1071- write (fates_log(),* ) ' currentCohort%c_area: ' ,currentCohort% c_area
1072- write (fates_log(),* ) ' currentCohort%prom_weight: ' ,currentCohort% prom_weight
1073- write (fates_log(),* ) ' excess: ' ,currentCohort% prom_weight - currentCohort% c_area
1074- call endrun(msg= errMsg(sourcefile, __LINE__))
1075+ if ((currentCohort% prom_weight > &
1076+ (currentCohort% c_area+ area_target_precision)) .or. &
1077+ (currentCohort% prom_weight < 0._r8 ) ) then
1078+ write (fates_log(),* ) ' promotion area error (2)'
1079+ write (fates_log(),* ) ' currentCohort%c_area: ' ,currentCohort% c_area
1080+ write (fates_log(),* ) ' currentCohort%prom_weight: ' , &
1081+ currentCohort% prom_weight
1082+ write (fates_log(),* ) ' excess: ' , &
1083+ currentCohort% prom_weight - currentCohort% c_area
1084+ call endrun(msg= errMsg(sourcefile, __LINE__))
10751085 end if
10761086 end if
10771087
@@ -1192,7 +1202,8 @@ subroutine PromoteIntoLayer(currentSite,currentPatch,i_lyr)
11921202
11931203 call CanopyLayerArea(currentPatch,currentSite% spread,i_lyr,arealayer_current)
11941204
1195- if ((abs (arealayer_current - currentPatch% area)/ arealayer_current > area_check_rel_precision ) .or. &
1205+ if ((abs (arealayer_current - currentPatch% area)/ arealayer_current > &
1206+ area_check_rel_precision ) .or. &
11961207 (abs (arealayer_current - currentPatch% area) > area_check_precision) ) then
11971208 write (fates_log(),* ) ' promotion did not bring area within tolerance'
11981209 write (fates_log(),* ) ' arealayer:' ,arealayer_current
@@ -1252,7 +1263,8 @@ subroutine canopy_spread( currentSite )
12521263
12531264 enddo ! currentPatch
12541265
1255- ! If the canopy area is approaching closure, squash the tree canopies and make them taller and thinner
1266+ ! If the canopy area is approaching closure,
1267+ ! squash the tree canopies and make them taller and thinner
12561268 if ( sitelevel_canopyarea/ AREA .gt. ED_val_canopy_closure_thresh ) then
12571269 currentSite% spread = currentSite% spread - inc
12581270 else
@@ -1290,15 +1302,15 @@ subroutine canopy_summarization( nsites, sites, bc_in )
12901302 type (ed_patch_type) , pointer :: currentPatch
12911303 type (ed_cohort_type) , pointer :: currentCohort
12921304 integer :: s
1293- integer :: ft ! plant functional type
1305+ integer :: ft ! plant functional type
12941306 integer :: ifp
1295- integer :: patchn ! identification number for each patch.
1296- real (r8 ) :: canopy_leaf_area ! total amount of leaf area in the vegetated area. m2.
1297- real (r8 ) :: leaf_c ! leaf carbon [kg]
1298- real (r8 ) :: fnrt_c ! fineroot carbon [kg]
1299- real (r8 ) :: sapw_c ! sapwood carbon [kg]
1300- real (r8 ) :: store_c ! storage carbon [kg]
1301- real (r8 ) :: struct_c ! structure carbon [kg]
1307+ integer :: patchn ! identification number for each patch.
1308+ real (r8 ) :: canopy_leaf_area ! total amount of leaf area in the vegetated area. m2.
1309+ real (r8 ) :: leaf_c ! leaf carbon [kg]
1310+ real (r8 ) :: fnrt_c ! fineroot carbon [kg]
1311+ real (r8 ) :: sapw_c ! sapwood carbon [kg]
1312+ real (r8 ) :: store_c ! storage carbon [kg]
1313+ real (r8 ) :: struct_c ! structure carbon [kg]
13021314 !- ---------------------------------------------------------------------
13031315
13041316 if ( debug ) then
0 commit comments