From 661feef483c05fff955b6fe31f77f1d3e4290866 Mon Sep 17 00:00:00 2001 From: Kyle Palmquist Date: Tue, 4 Dec 2018 21:51:58 -0700 Subject: [PATCH 01/21] Incorporate space back into transp_contribution_by_group, addressing issue #197 - added the space parameter back to the resource partitioning code - also adjust key parameters for big sagebrush for testing purposes --- sxw_resource.c | 14 ++++++-------- .../Stepwat_Inputs/Input/species.in | 2 +- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/sxw_resource.c b/sxw_resource.c index be9719b1..eeea8bb5 100644 --- a/sxw_resource.c +++ b/sxw_resource.c @@ -243,9 +243,7 @@ static void _transp_contribution_by_group(RealF use_by_group[]) { int t; RealD *transp; RealF sumUsedByGroup = 0., sumTranspTotal = 0., TranspRemaining = 0.; - RealF transp_ratio; - added_transp = 0; - RealF transp_ratio_sd; + RealF transp_ratio, added_transp = 0, transp_ratio_sd; // year 0 is a set up year. No need to calculate transpiration. // if there are multiple iterations the last year will run twice; @@ -271,16 +269,16 @@ static void _transp_contribution_by_group(RealF use_by_group[]) { switch (t) { case 0://Tree - transp = SXW.transpVeg[SW_TREES]; + transp = SXW.transpTotal; break; case 1://Shrub - transp = SXW.transpVeg[SW_SHRUB]; + transp = SXW.transpTotal; break; case 2://Grass - transp = SXW.transpVeg[SW_GRASS]; + transp = SXW.transpTotal; break; case 3://Forb - transp = SXW.transpVeg[SW_FORBS]; + transp = SXW.transpTotal; break; default: transp = SXW.transpTotal; @@ -293,7 +291,7 @@ static void _transp_contribution_by_group(RealF use_by_group[]) { ForEachTrPeriod(p) { int nLyrs = getNTranspLayers(RGroup[g]->veg_prod_type); for (l = 0; l < nLyrs; l++) { - use_by_group[g] += (RealF) (_roots_active_rel[Iglp(g, l, p)] * transp[Ilp(l, p)]); + use_by_group[g] += (RealF) (_roots_active_rel[Iglp(g, l, p)] * RGroup[g]->min_res_req * transp[Ilp(l, p)]); } } //printf("for groupName= %s, use_by_group[g] in transp= %f \n",RGroup[g]->name,use_by_group[g] ); diff --git a/testing.sagebrush.master/Stepwat_Inputs/Input/species.in b/testing.sagebrush.master/Stepwat_Inputs/Input/species.in index e18907b5..7334fa40 100644 --- a/testing.sagebrush.master/Stepwat_Inputs/Input/species.in +++ b/testing.sagebrush.master/Stepwat_Inputs/Input/species.in @@ -78,7 +78,7 @@ # ALSO tested max age for ARTR - found that model is not very sensitive to max age but literature shows 100-150 max age # name rg age irate ratep slow disturb pestab eind minbio maxbio clonal vegindv tclass cosurv onoff var pseed - artr 1 100 0.10000 0.900 4 3 0.3000 2 2.000 400.00 n 0 2 0.0100 1 0.0 0 + artr 1 100 0.35000 0.900 4 3 0.1500 1 2.000 1000.00 n 0 2 0.0100 1 0.0 0 trdu 2 1 0.94700 0.900 2 3 0.0300 5 0.035 4.700 n 0 2 0.0000 0 0.0 0 cryp 2 1 0.94700 0.900 2 3 0.2000 10 0.035 4.700 n 0 2 0.0000 1 0.0001 100 amre 3 1 0.94700 0.900 2 3 0.0300 5 0.035 4.429 n 0 2 0.0000 0 0.0 0 From 5a3c31f27b82deff37d83edad19d20c40978daf6 Mon Sep 17 00:00:00 2001 From: kpalmqui Date: Wed, 5 Dec 2018 16:54:19 -0700 Subject: [PATCH 02/21] Updated Phlox hoodii maxbio Changed the maximum biomass value for PHHO, based on PHHO biomass data collected by Lexi Smith. --- testing.sagebrush.master/Stepwat_Inputs/Input/species.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing.sagebrush.master/Stepwat_Inputs/Input/species.in b/testing.sagebrush.master/Stepwat_Inputs/Input/species.in index 7334fa40..66df43ae 100644 --- a/testing.sagebrush.master/Stepwat_Inputs/Input/species.in +++ b/testing.sagebrush.master/Stepwat_Inputs/Input/species.in @@ -84,7 +84,7 @@ amre 3 1 0.94700 0.900 2 3 0.0300 5 0.035 4.429 n 0 2 0.0000 0 0.0 0 chen 3 1 0.94700 0.900 2 2 0.2000 8 0.035 4.429 n 0 1 0.0000 1 0.0001 100 acmi 4 10 0.42600 0.900 2 3 0.1500 6 0.035 5.000 n 0 2 0.0100 0 0.0 0 - phho 4 10 0.42600 0.900 2 3 0.1500 15 0.035 5.000 n 0 2 0.0100 1 0.0 0 + phho 4 10 0.42600 0.900 2 3 0.1500 15 0.035 22.000 n 0 2 0.0100 1 0.0 0 arfr 5 5 0.42600 0.900 2 3 0.1000 5 0.035 7.480 n 0 2 0.0100 1 0.0 0 lipu 5 35 0.42600 0.900 2 3 0.1000 4 0.035 7.480 n 0 2 0.0100 0 0.0 0 brte 6 1 0.94700 0.900 2 3 0.1500 20 0.020 5.000 n 0 2 0.0000 1 0.0001 1000 From 5af9744ed35bb937ce3d5c51034b182cd8c61e3f Mon Sep 17 00:00:00 2001 From: kpalmqui Date: Fri, 7 Dec 2018 13:53:03 -0700 Subject: [PATCH 03/21] Changed default C4 grass species to BOGR and edited eind - turned on BOGR as the default C4 grass species as this is one of the most common C4 grass species in big sagebrush ecosystems -turned off SPCR - set eind to be 20 as default (similiar to C3 grass species) --- testing.sagebrush.master/Stepwat_Inputs/Input/species.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/testing.sagebrush.master/Stepwat_Inputs/Input/species.in b/testing.sagebrush.master/Stepwat_Inputs/Input/species.in index 66df43ae..bd400209 100644 --- a/testing.sagebrush.master/Stepwat_Inputs/Input/species.in +++ b/testing.sagebrush.master/Stepwat_Inputs/Input/species.in @@ -91,8 +91,8 @@ vuoc 6 1 0.94700 0.900 2 1 0.0300 16 0.020 5.000 n 0 2 0.0000 0 0.0 0 pssp 7 35 0.47400 0.900 2 3 0.1500 20 0.500 15.096 y 3 2 0.0100 1 0.0 0 koma 7 5 0.47400 0.900 2 3 0.1500 2 0.500 15.096 y 3 2 0.0100 0 0.0 0 - bogr 8 35 0.47400 0.900 2 2 0.0500 2 0.605 15.096 y 3 1 0.0100 0 0.0 0 - spcr 8 29 0.47400 0.900 2 3 0.0500 3 0.605 6.000 y 0 1 0.0100 1 0.0 0 + bogr 8 35 0.47400 0.900 2 2 0.0500 20 0.605 15.096 y 3 1 0.0100 1 0.0 0 + spcr 8 29 0.47400 0.900 2 3 0.0500 3 0.605 6.000 y 0 1 0.0100 0 0.0 0 gusa 9 35 0.73700 0.900 2 3 0.1500 2 0.986 12.126 n 0 2 0.0100 0 0.0 0 chvi 9 17 0.47400 0.900 2 2 0.1500 2 0.986 70.726 n 0 2 0.0100 1 0.0 0 oppo 10 30 0.28900 0.900 4 4 0.0500 1 2.250 15.00 y 3 1 0.0100 1 0.0 0 From 749cea701719eeaf9ef3f05025929f7ad3e8415f Mon Sep 17 00:00:00 2001 From: chaukap Date: Mon, 21 Jan 2019 10:14:33 -0700 Subject: [PATCH 04/21] Removed switch statement (issue #204) Because all cases of the switch statement did the exact same thing, the entire block has been replaced with `transp = SXW.transpTotal` --- sxw_resource.c | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/sxw_resource.c b/sxw_resource.c index eeea8bb5..caeec319 100644 --- a/sxw_resource.c +++ b/sxw_resource.c @@ -266,24 +266,7 @@ static void _transp_contribution_by_group(RealF use_by_group[]) { { use_by_group[g] = 0.; t = RGroup[g]->veg_prod_type - 1; - - switch (t) { - case 0://Tree - transp = SXW.transpTotal; - break; - case 1://Shrub - transp = SXW.transpTotal; - break; - case 2://Grass - transp = SXW.transpTotal; - break; - case 3://Forb - transp = SXW.transpTotal; - break; - default: - transp = SXW.transpTotal; - break; - } + transp = SXW.transpTotal; //Loops through each month and calculates amount of transpiration for each STEPPE functional group //according to whether that group has active living roots in each soil layer for each month From 71b06e116cd7dba6de43a77a497d61b450f3a6ca Mon Sep 17 00:00:00 2001 From: Chandler Haukap Date: Tue, 5 Feb 2019 17:02:54 -0700 Subject: [PATCH 05/21] (issue #198) rescaled space if some rgroups are not established. To rescale space I had to modify three files: in ST_structs.h: added a new variable, baseline_min_res_req, to the rgroup struct. This variable records the space parameter from inputs, since we are going to change min_res_req every year. in ST_params.c: assigned input "space" to baseline_min_res_req. in ST_resgroups.c: rescaled space. Once an rgroup is done establishing we betermine is any species established. If they have not we add the group's min_res_req to the total unused space variable. Once all groups are done establishing we loop through the rgroups again and redistribute any unused space. --- ST_params.c | 1 + ST_resgroups.c | 22 ++++++++++++++++++++++ ST_structs.h | 3 ++- 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/ST_params.c b/ST_params.c index cd4b8c4a..426d946f 100644 --- a/ST_params.c +++ b/ST_params.c @@ -950,6 +950,7 @@ static void _rgroup_add1( char name[], RealF space, RealF density, RGroup[rg]->max_density = density; RGroup[rg]->max_per_sqm = density / Globals.plotsize; RGroup[rg]->slowrate = slow; + RGroup[rg]->baseline_min_res_req = space; RGroup[rg]->min_res_req = space; RGroup[rg]->est_annually = itob(estann); RGroup[rg]->startyr = styr; diff --git a/ST_resgroups.c b/ST_resgroups.c index e72e4fe0..f45ecd73 100644 --- a/ST_resgroups.c +++ b/ST_resgroups.c @@ -607,6 +607,7 @@ void rgroup_Establish(void) { /*------------------------------------------------------*/ IntS i, num_est; /* number of individuals of sp. that establish*/ + RealF unused_space = 0; /* sums up all of the space that goes unused if a species does not establish */ GrpIndex rg; SppIndex sp; GroupType *g; @@ -625,6 +626,7 @@ void rgroup_Establish(void) { continue; g->regen_ok = TRUE; /* default */ + g->min_res_req = g->baseline_min_res_req; /* reset min_res_req, if it was modified last year */ if (Globals.currYear < RGroup[rg]->startyr) { g->regen_ok = FALSE; @@ -673,7 +675,27 @@ void rgroup_Establish(void) { } /* end ForEachGroupSpp() */ } + + // if no species in this group established we need to redistribute min_res_req + if(g->est_count == 0){ + unused_space += g->min_res_req; + } } /* end ForEachGroup() */ + + // If there is unused space we need to redistribute + if(unused_space > 0){ + // printf("\nYear %d: unused_space = %f\n\n", Globals.currYear, unused_space); + ForEachGroup(rg){ + g = RGroup[rg]; + // If this group is established, give it some of the unused space. + if(g->est_count != 0){ + // printf("%s before: %f\n", g->name, g->min_res_req); + /* This formula will proportionally redistribute the unused space to all groups that are established */ + g->min_res_req = g->min_res_req / (1 - unused_space); + // printf("%s after: %f\n", g->name, g->min_res_req); + } + } + } } /***********************************************************/ void rgroup_IncrAges(void) diff --git a/ST_structs.h b/ST_structs.h index 031c212e..18bc6138 100644 --- a/ST_structs.h +++ b/ST_structs.h @@ -177,7 +177,8 @@ struct resourcegroup_st { grazingfrq, /* grazing effect on group at this frequency: <1=prob, >1=# years */ grazingfreq_startyr;/* start year for grazing frequency*/ SppIndex species[MAX_SPP_PER_GRP]; /*list of spp belonging to this grp*/ - RealF min_res_req, /* input from table */ + RealF baseline_min_res_req, /* input from table */ + min_res_req, /* input from table, rescaled if an rgroup is not established */ max_density, /* number of mature plants per plot allowed */ max_per_sqm, /* convert density and plotsize to max plants/m^2 */ max_bmass, /* sum of mature biomass for all species in group */ From 33da1ad30f626af5d20c1e440c45fdd2025e97a9 Mon Sep 17 00:00:00 2001 From: Chandler Haukap Date: Fri, 15 Mar 2019 12:52:41 -0600 Subject: [PATCH 06/21] TransRemaining issues corrected (issue #236) * In ST_resgroups.c: set min_res_req to 0 if no species establish in that group. This ensures that min_res_req for all RGroups always sums to 1. * In sxw_resource: _roots_active_rel[group, layer, month] now reflects the groups roots relative to all groups. This ensures that for a given layer and month the sum of _roots_active_rel for all groups will be 1. The new implementation does not require the RGroup's vegtype, so I removed the variable t from transp_contribution_bygroup. Transpiration distribution is now implemented by the new algorithm discussed in the issue. --- ST_resgroups.c | 2 ++ sxw_resource.c | 40 +++++++++++++++++++++++++++++----------- 2 files changed, 31 insertions(+), 11 deletions(-) diff --git a/ST_resgroups.c b/ST_resgroups.c index f45ecd73..e3adec56 100644 --- a/ST_resgroups.c +++ b/ST_resgroups.c @@ -679,6 +679,8 @@ void rgroup_Establish(void) { // if no species in this group established we need to redistribute min_res_req if(g->est_count == 0){ unused_space += g->min_res_req; + // this group needs no resources because it is not established. + g->min_res_req = 0; } } /* end ForEachGroup() */ diff --git a/sxw_resource.c b/sxw_resource.c index caeec319..362892d4 100644 --- a/sxw_resource.c +++ b/sxw_resource.c @@ -211,16 +211,20 @@ void _sxw_update_root_tables( RealF sizes[] ) { * STEPPE group's roots in a given layer in a given month */ ForEachGroup(g) { - int t = RGroup[g]->veg_prod_type-1; int nLyrs = getNTranspLayers(RGroup[g]->veg_prod_type); for (l = 0; l < nLyrs; l++) { ForEachTrPeriod(p) { + RealD sum_all_veg_types = 0; + for(int t = 0; t < NVEGTYPES; ++t){ + sum_all_veg_types += _roots_active_sum[Itlp(t,l,p)]; + } + _roots_active_rel[Iglp(g, l, p)] = - ZRO(_roots_active_sum[Itlp(t,l,p)]) ? + ZRO(sum_all_veg_types) ? 0. : _roots_active[Iglp(g, l, p)] - / _roots_active_sum[Itlp(t,l, p)]; + / sum_all_veg_types; } } } @@ -240,8 +244,7 @@ static void _transp_contribution_by_group(RealF use_by_group[]) { GrpIndex g; TimeInt p; LyrIndex l; - int t; - RealD *transp; + RealD *transp, proportion_total_resources, average_proportion; RealF sumUsedByGroup = 0., sumTranspTotal = 0., TranspRemaining = 0.; RealF transp_ratio, added_transp = 0, transp_ratio_sd; @@ -265,16 +268,14 @@ static void _transp_contribution_by_group(RealF use_by_group[]) { ForEachGroup(g) //Steppe functional group { use_by_group[g] = 0.; - t = RGroup[g]->veg_prod_type - 1; transp = SXW.transpTotal; //Loops through each month and calculates amount of transpiration for each STEPPE functional group //according to whether that group has active living roots in each soil layer for each month - ForEachTrPeriod(p) { int nLyrs = getNTranspLayers(RGroup[g]->veg_prod_type); for (l = 0; l < nLyrs; l++) { - use_by_group[g] += (RealF) (_roots_active_rel[Iglp(g, l, p)] * RGroup[g]->min_res_req * transp[Ilp(l, p)]); + use_by_group[g] += (RealF) (_roots_active_rel[Iglp(g, l, p)] * transp[Ilp(l, p)]); } } //printf("for groupName= %s, use_by_group[g] in transp= %f \n",RGroup[g]->name,use_by_group[g] ); @@ -282,17 +283,34 @@ static void _transp_contribution_by_group(RealF use_by_group[]) { sumUsedByGroup += use_by_group[g]; //printf(" sumUsedByGroup in transp=%f \n",sumUsedByGroup); } + + // Rescale transpiration based on space (min_res_req) + ForEachGroup(g){ + if(use_by_group[g] != 0){ //Prevents NaN errors + //Proportion of total traspiration that this group would recieve without accounting for space + proportion_total_resources = use_by_group[g] / sumUsedByGroup; + //Average of the two proportions. This equally weights proportion_total_resources and min_res_req. + average_proportion = (proportion_total_resources + RGroup[g]->min_res_req) / 2; + //Recalculate this group's resources. + use_by_group[g] = sumUsedByGroup * average_proportion; + } + } + //sumUsedByGroup needs to be synced because of potention floating point errors + sumUsedByGroup = 0; + ForEachGroup(g){ + sumUsedByGroup += use_by_group[g]; + } + //Very small amounts of transpiration remain and not perfectly partitioned to functional groups. //This check makes sure any remaining transpiration is divided proportionately among groups. - ForEachTrPeriod(p) { - for (t = 0; t < SXW.NSoLyrs; t++) + for (int t = 0; t < SXW.NSoLyrs; t++) sumTranspTotal += SXW.transpTotal[Ilp(t, p)]; } TranspRemaining = sumTranspTotal - sumUsedByGroup; - //printf(" sumTranspTotal=%f, sumUsedByGroup=%f TranspRemaining=%f"\n", sumTranspTotal, sumUsedByGroup, TranspRemaining); + //printf("Total = %f\tUsed = %f\tRemaining = %f\n", sumTranspTotal, sumUsedByGroup, TranspRemaining); /* ------------- Begin testing to see if additional transpiration is necessary ------------- */ From 4febca1793727a608698d7a2854bea13116b1c1a Mon Sep 17 00:00:00 2001 From: Chandler Haukap Date: Fri, 15 Mar 2019 13:09:44 -0600 Subject: [PATCH 07/21] Moved declaration of variables outside of for loops (issue #236) I didn't realize this, but our contiguous integration checks use a c standard < c99. Before c99 you were not allowed to declare variables inside for loops. This isn't a big deal, I just moved all declarations back to the top of the functions. --- sxw_resource.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sxw_resource.c b/sxw_resource.c index 362892d4..a42b36e6 100644 --- a/sxw_resource.c +++ b/sxw_resource.c @@ -216,7 +216,7 @@ void _sxw_update_root_tables( RealF sizes[] ) { ForEachTrPeriod(p) { RealD sum_all_veg_types = 0; - for(int t = 0; t < NVEGTYPES; ++t){ + for(t = 0; t < NVEGTYPES; ++t){ sum_all_veg_types += _roots_active_sum[Itlp(t,l,p)]; } @@ -243,6 +243,7 @@ static void _transp_contribution_by_group(RealF use_by_group[]) { GrpIndex g; TimeInt p; + int nLyrs, t; LyrIndex l; RealD *transp, proportion_total_resources, average_proportion; RealF sumUsedByGroup = 0., sumTranspTotal = 0., TranspRemaining = 0.; @@ -273,7 +274,7 @@ static void _transp_contribution_by_group(RealF use_by_group[]) { //Loops through each month and calculates amount of transpiration for each STEPPE functional group //according to whether that group has active living roots in each soil layer for each month ForEachTrPeriod(p) { - int nLyrs = getNTranspLayers(RGroup[g]->veg_prod_type); + nLyrs = getNTranspLayers(RGroup[g]->veg_prod_type); for (l = 0; l < nLyrs; l++) { use_by_group[g] += (RealF) (_roots_active_rel[Iglp(g, l, p)] * transp[Ilp(l, p)]); } @@ -305,7 +306,7 @@ static void _transp_contribution_by_group(RealF use_by_group[]) { //Very small amounts of transpiration remain and not perfectly partitioned to functional groups. //This check makes sure any remaining transpiration is divided proportionately among groups. ForEachTrPeriod(p) { - for (int t = 0; t < SXW.NSoLyrs; t++) + for (t = 0; t < SXW.NSoLyrs; t++) sumTranspTotal += SXW.transpTotal[Ilp(t, p)]; } From f9264f326998f317a89b263888bb6759a79e0bfe Mon Sep 17 00:00:00 2001 From: Kyle Palmquist Date: Wed, 26 Jun 2019 22:15:21 -0400 Subject: [PATCH 08/21] Update g->pr to reflect res_extra, issue #329 This commit: -updates res_avail to include res_extra -moves the calculation of g->pr to right before it is used and after res_extra is determined. --- ST_mortality.c | 4 ++++ ST_resgroups.c | 9 +++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/ST_mortality.c b/ST_mortality.c index 9a98dc77..3129dd75 100644 --- a/ST_mortality.c +++ b/ST_mortality.c @@ -146,6 +146,10 @@ void mort_Main( Bool *killed) { /* annuals are not subject to these sources of mortality and instead die in _kill_annuals */ if (g->max_age == 1) continue; + /* Calculate PR at the functional group level: resources required/resources available */ + g->pr = ZRO(g->res_avail) ? 0. : g->res_required / g->res_avail; + //printf("g->pr after = %f\n,Group = %s \n",RGroup[rg]->name, g->pr);/* kill plants if low resources for consecutive years */ + /* kill plants if low resources for consecutive years */ /* increment yrs_neg_pr if pr > 1, else zero it. */ /* one good year cancels all previous bad years. */ diff --git a/ST_resgroups.c b/ST_resgroups.c index 481897ee..6f39184b 100644 --- a/ST_resgroups.c +++ b/ST_resgroups.c @@ -100,10 +100,6 @@ void rgroup_PartResources(void) { LogError(logfp, LOGWARN, "RGroup %s : res_avail is Zero and res_required > 0", g->name); } - /* Calculate PR at the functional group level: resources required/resources available */ - g->pr = ZRO(g->res_avail) ? 0. : g->res_required / g->res_avail; - //printf("g->pr = %f\n,Group = %s \n",RGroup[rg]->name, g->pr); - /* If relsize>0 and individuals are established, reset noplants from TRUE to FALSE */ if (GT(getRGroupRelsize(rg), 0.)) noplants = FALSE; @@ -267,9 +263,10 @@ static void _res_part_extra(RealF extra, RealF size[]) { /* If the group can use extra resources, divide out extra based on * proportional biomass */ - if (g->use_extra_res) + if (g->use_extra_res) { g->res_extra = req_prop * extra; - + g->res_avail += g->res_extra; + } /* If the group can't use extra resources, set res_extra to 0 */ else g->res_extra = 0.; From 18bfac0d5c78b5f9f7fe1ce04abc791e42d90adb Mon Sep 17 00:00:00 2001 From: dschlaep Date: Mon, 8 Jul 2019 09:32:22 -0400 Subject: [PATCH 09/21] Fix un-initialized variable `tgmod` (function `rgroup_Grow`) the variable `tgmod` was un-initialized/had outdated value if `s->temp_class == NoSeason` - close #332 --- ST_resgroups.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ST_resgroups.c b/ST_resgroups.c index 6f39184b..185cd804 100644 --- a/ST_resgroups.c +++ b/ST_resgroups.c @@ -468,8 +468,7 @@ void rgroup_Grow(void) { continue; /* Modify growth rate by temperature calculated in Env_Generate() */ - if (s->tempclass != NoSeason) - tgmod = Env.temp_reduction[s->tempclass]; + tgmod = (s->tempclass == NoSeason) ? 1. : Env.temp_reduction[s->tempclass]; /* Now increase size of the individual plants of current species */ ForEachIndiv(ndv, s) { From 0e9d919671367aefc3bdfe0dd8ee3ec7ef74a594 Mon Sep 17 00:00:00 2001 From: dschlaep Date: Mon, 8 Jul 2019 09:54:52 -0400 Subject: [PATCH 10/21] Fix float comparison in function `rgroup_ResPartIndiv` Use macro `GE` instead of `==` to check that the two float variables `ndv->res_avail` and `ndv->res_required` represent sufficient resources - close #333 - this commit does not change the testing output on my local computer --- ST_resgroups.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ST_resgroups.c b/ST_resgroups.c index 185cd804..9c7fba95 100644 --- a/ST_resgroups.c +++ b/ST_resgroups.c @@ -381,7 +381,7 @@ void rgroup_ResPartIndiv(void) { /* If individuals already have the resources they require do * not assign extra */ - if (ndv->res_avail == ndv->res_required) { + if (GE(ndv->res_avail, ndv->res_required)) { ndv->res_extra = 0.0; //printf("ndv->res_extra = %f\n", ndv->res_extra); } From e2c03a800f85a3dc833ab8573629f96d4bd0224f Mon Sep 17 00:00:00 2001 From: dschlaep Date: Mon, 8 Jul 2019 10:07:29 -0400 Subject: [PATCH 11/21] Fix float comparison in function `_res_part_extra` Use macro `ZRO` instead of `== 0` to check whether the float variable `sum_size` is zero - close #334 - this commit does not change the testing output on my local computer (this condition is never triggered in the test run) --- ST_resgroups.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ST_resgroups.c b/ST_resgroups.c index 9c7fba95..6a6371c5 100644 --- a/ST_resgroups.c +++ b/ST_resgroups.c @@ -253,7 +253,7 @@ static void _res_part_extra(RealF extra, RealF size[]) { continue; /* Check to avoid dividing by 0 */ - if (sum_size == 0.) + if (ZRO(sum_size)) req_prop = 0.; /* Calculate proportional biomass of each group out of the total biomass From 35f66d1583c60a91dda7475d3bc1db1c6746dec4 Mon Sep 17 00:00:00 2001 From: dschlaep Date: Mon, 8 Jul 2019 11:02:54 -0400 Subject: [PATCH 12/21] Improve function `_sxw_sw_setup`: remove unnecessarily call to `SW_VPD_init` - close #335 The `SOILWAT2` function `SW_VPD_init` is called by `_begin_year` which in turn is called by `SW_CTL_run_current_year`. That the function `_begin_year` calls `SW_VPD_init` is "new" since `SOILWAT2` incorporated CO2-effects (commit https://github.com/DrylandEcology/SOILWAT2/commit/1755c287084f905c6067b19010ea05cfd8915407 merged into [v3.5.0](https://github.com/DrylandEcology/SOILWAT2/releases/tag/v3.5.0)). Thus, the `STEPWAT2` function `_sxw_sw_setup` no longer needs to call `SW_VPD_init` because it will be called anyhow in due time by `SOILWAT2`. - this commit does not change testing output --- sxw_soilwat.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sxw_soilwat.c b/sxw_soilwat.c index 1ef0e78d..918cf60c 100644 --- a/sxw_soilwat.c +++ b/sxw_soilwat.c @@ -94,7 +94,10 @@ void _sxw_sw_setup (RealF sizes[]) { } } - SW_VPD_init(); + /* We no longer need to call `SW_VPD_init` since SOILWAT2 v3.5.0. SOILWAT2 + calls `SW_VPD_init` at the beginning of each year (for dynamic CO2-effects) + */ + // SW_VPD_init(); } void _sxw_sw_run(void) { From cd3fd9391c1eec07a28e47917c8b852527e3fd57 Mon Sep 17 00:00:00 2001 From: dschlaep Date: Wed, 10 Jul 2019 13:32:49 -0400 Subject: [PATCH 13/21] Increase mortality count only if relsize has become zero due to fire (#345) - close #345 --- ST_indivs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ST_indivs.c b/ST_indivs.c index 95d6ecf4..4267dd07 100644 --- a/ST_indivs.c +++ b/ST_indivs.c @@ -225,7 +225,6 @@ void indiv_proportion_Kill(IndivType *ndv, int killType, RealF proportKilled) // insertIndivKill(ndv->id, killType); //kill indiv Proportionally or adjust their real size irrespective of being annual or perennial, both will have this effect - species_Update_Kills(ndv->myspecies, ndv->age); // saving killing year real size here that is going to use for calculating next year proportional recovery ndv->prv_yr_relsize = ndv->relsize; @@ -238,6 +237,8 @@ void indiv_proportion_Kill(IndivType *ndv, int killType, RealF proportKilled) if (ZERO(ndv->relsize) || LT(ndv->relsize, 0.0)) { ndv->relsize =0.0; + // increase mortality count only if relsize has become zero due to fire + species_Update_Kills(ndv->myspecies, ndv->age); } #undef xF_DELTA From 542f571908b45fa55c182528e2bcb77a6a5dbb53 Mon Sep 17 00:00:00 2001 From: dschlaep Date: Sun, 14 Jul 2019 17:07:31 -0400 Subject: [PATCH 14/21] Inputs density and pseed changed to units of # / m2 (#350) fix inconsistencies in units between documentation, inputs, and how the code uses these variables: - inputs are in units of number per square meter (so that these inputs do not depend on plot size) - internally, code converts these to number per plot (because that is the unit of the simulation) --- ST_params.c | 8 +++++--- ST_structs.h | 4 ++-- testing.sagebrush.master/Stepwat_Inputs/Input/rgroup.in | 6 +++--- testing.sagebrush.master/Stepwat_Inputs/Input/species.in | 2 +- 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/ST_params.c b/ST_params.c index 3758af89..dfdb8c4f 100644 --- a/ST_params.c +++ b/ST_params.c @@ -904,8 +904,9 @@ static void _rgroup_add1( char name[], RealF space, RealF density, RGroup[rg]->grp_num = rg; RGroup[rg]->max_stretch = (IntS) stretch; RGroup[rg]->max_spp_estab = (IntS) estab; - RGroup[rg]->max_density = density; - RGroup[rg]->max_per_sqm = density / Globals.plotsize; + // input of `density` is in units of [# / m2]; convert to units of [# / plot] + RGroup[rg]->max_density = density * Globals.plotsize; // density per plot + RGroup[rg]->max_per_sqm = density; // density per square-meter RGroup[rg]->use_mort = itob(mort); RGroup[rg]->slowrate = slow; RGroup[rg]->baseline_min_res_req = space; @@ -1103,7 +1104,8 @@ static void _species_init( void) { Species[sp]->received_prob = 0; Species[sp]->cohort_surv = cohort; Species[sp]->var = var; - Species[sp]->pseed = pseed / Globals.plotsize; + // input of `pseed` is in units of [# / m2]; convert to units of [# / plot] + Species[sp]->pseed = pseed * Globals.plotsize; /* Species[sp]->ann_mort_prob = (age > 0) ? -log(cohort)/age : 0.0; diff --git a/ST_structs.h b/ST_structs.h index 98196577..b6478e5c 100644 --- a/ST_structs.h +++ b/ST_structs.h @@ -90,7 +90,7 @@ struct species_st { estabs, /* number of individuals established in iter */ *seedprod, /* annuals: array of previous years' seed production (size = viable_yrs)*/ seedbank, - pseed; + pseed; /* average number of seeds produced by annual species per 1g of biomass, per 1m^2 and per year (internally re-calculated as seeds per 1 g biomass per plot and per year) */ RealF lastyear_relsize, /* relsize from the previous year, used for annual establishment */ extragrowth, /* amt of superfluous growth from extra resources */ received_prob, //the chance that this species received seeds this year... only applicable if using seed dispersal and gridded option @@ -181,7 +181,7 @@ struct resourcegroup_st { RealF baseline_min_res_req, /* input from table */ min_res_req, /* input from table, rescaled if an rgroup is not established */ max_density, /* number of mature plants per plot allowed */ - max_per_sqm, /* convert density and plotsize to max plants/m^2 */ + max_per_sqm, /* density of mature plants in units of plants / m^2 */ max_bmass, /* sum of mature biomass for all species in group */ killfreq, /* kill group at this frequency: <1=prob, >1=# years */ ignition, /* cheatgrass biomass (g/m2) that triggers potential ignition of a wildfire */ diff --git a/testing.sagebrush.master/Stepwat_Inputs/Input/rgroup.in b/testing.sagebrush.master/Stepwat_Inputs/Input/rgroup.in index 9528aaac..866ff65f 100644 --- a/testing.sagebrush.master/Stepwat_Inputs/Input/rgroup.in +++ b/testing.sagebrush.master/Stepwat_Inputs/Input/rgroup.in @@ -14,9 +14,9 @@ # name = a name to give the group (12 chars) # space = proportion of the resource space used by the group. # this must sum to 1.0 -# density = relative number of mature individuals per plot, reassigned to max_density in the model code -# maxest = maximum species that can establish in a given year, -# this value cannot be greater than the number of species assigned +# density = number of mature individuals per square-meter, converted to `max_density` (in units of plants per plot) in the model code +# maxest = maximum species that can establish in a given year, +# this value cannot be greater than the number of species assigned # to the resource group in the species.in file # slow = slow growth rate, defines when to count stretched years # stretch = max yrs resources can be stretched before low-resource mortality occurs. diff --git a/testing.sagebrush.master/Stepwat_Inputs/Input/species.in b/testing.sagebrush.master/Stepwat_Inputs/Input/species.in index bd400209..68e94f7e 100644 --- a/testing.sagebrush.master/Stepwat_Inputs/Input/species.in +++ b/testing.sagebrush.master/Stepwat_Inputs/Input/species.in @@ -50,7 +50,7 @@ # along with the mean (pestab), is used to calculate the two shape parameters: alpha and beta. # Default value: 0.0001. NOTE: var must be < pestab * (1-pestab) or alpha and/or beta will be negative, # we will no longer be meeting the assumptions of a beta distribution, and the code will fail. -# pseed = the average number of seeds produced by annual species per 1g of biomass, per 1m^2 and per year. +# pseed = the average number of seeds produced by annual species per 1g of biomass, per 1m^2 and per year (internally re-calculated as seeds per 1 g biomass per plot and per year) ###PARAMETER SOURCES #TM - eind values are density values taken from Adler datasets from Idaho. Species vuoc (1090), bogr, spcr, brar (2080), are from Karl et al 1999 From 1612092120ebf275057ebe45d9c446e1e70937a5 Mon Sep 17 00:00:00 2001 From: dschlaep Date: Tue, 23 Jul 2019 17:03:40 -0400 Subject: [PATCH 15/21] Add code comments to explain variable `_roots_active_rel` --- sxw_resource.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sxw_resource.c b/sxw_resource.c index 15fc2e86..7a1e5f24 100644 --- a/sxw_resource.c +++ b/sxw_resource.c @@ -197,6 +197,9 @@ void _sxw_update_root_tables( RealF sizes[] ) { /* Rescale _roots_active_sum to represent the relative "activity" of a * STEPPE group's roots in a given layer in a given month */ + /* Details: for each soil layer `l` and each month (trperiod) `p`, the sum + of `_roots_active_rel[Iglp(g, l, p)]` across rgroups `g` must be 1; + see its use by function _transp_contribution_by_group() */ ForEachGroup(g) { nLyrs = getNTranspLayers(RGroup[g]->veg_prod_type); @@ -260,6 +263,10 @@ static void _transp_contribution_by_group(RealF use_by_group[]) { //Loops through each month and calculates amount of transpiration for each STEPPE functional group //according to whether that group has active living roots in each soil layer for each month + /* Details: for each soil layer `l` and each month (trperiod) `p`, the + sum of `_roots_active_rel[Iglp(g, l, p)]` across rgroups `g` must + be 1; only if they sum to 1, can they can be used as proper weights + for `transp[Ilp(l, p)]` to be split up among rgroups */ ForEachTrPeriod(p) { nLyrs = getNTranspLayers(RGroup[g]->veg_prod_type); for (l = 0; l < nLyrs; l++) { From 43f180fc2425ab071625a2c0a36f0ec691382168 Mon Sep 17 00:00:00 2001 From: Kyle Palmquist Date: Fri, 26 Jul 2019 12:57:53 -0400 Subject: [PATCH 16/21] Removed est_count from calculation of RGroup relative size, resolved issue #366 --- ST_resgroups.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ST_resgroups.c b/ST_resgroups.c index 6a6371c5..832eaa92 100644 --- a/ST_resgroups.c +++ b/ST_resgroups.c @@ -737,17 +737,18 @@ void rgroup_IncrAges(void) /* Sums relsize for all individuals in all species in RGroup rg. param rg = RGroup index. Return: RGroup relsize. */ + RealF getRGroupRelsize(GrpIndex rg){ Int n; SppIndex sp; double sum = 0.0; ForEachEstSpp( sp, rg, n){ - sum += getSpeciesRelsize(sp); + sum += getSpeciesRelsize(sp); } if(RGroup[rg]->est_count > 0){ - return (RealF) sum / (RealF) RGroup[rg]->est_count; + return (RealF) sum; } else { return 0; } From fcec88fc5b50dc8df5f42c236d458c0bc1012cda Mon Sep 17 00:00:00 2001 From: dschlaep Date: Tue, 30 Jul 2019 12:26:22 -0400 Subject: [PATCH 17/21] Fix space redistribution (#368) - fix function `rgroup_Establish` so that input values of `space` do not need to sum to exactly 1 (based on activated resource groups), i.e., make inputs `space` and `on` in file `rgroup.in` independent from each other --> calculate "used_space" instead of "unused_space" which missed values from de-activated resource groups and didn't adjust if the sum of space (`min_res_req`) was larger than 1 - I'm not sure what to do if `used_space = 0`: currently, the code sends a fatal signal (@kpalmqui - any suggestions?) --- ST_resgroups.c | 47 +++++++++++++++++++++++++++++++---------------- 1 file changed, 31 insertions(+), 16 deletions(-) diff --git a/ST_resgroups.c b/ST_resgroups.c index 832eaa92..d28d2519 100644 --- a/ST_resgroups.c +++ b/ST_resgroups.c @@ -612,7 +612,8 @@ void rgroup_Establish(void) { /*------------------------------------------------------*/ IntS i, num_est; /* number of individuals of sp. that establish*/ - RealF unused_space = 0; /* sums up all of the space that goes unused if a species does not establish */ + RealF + used_space = 0; /* sums up all of the space that is currently used */ GrpIndex rg; SppIndex sp; GroupType *g; @@ -669,29 +670,43 @@ void rgroup_Establish(void) { } /* end ForEachGroupSpp() */ } - // if no species in this group established we need to redistribute min_res_req - if(g->est_count == 0){ - unused_space += g->min_res_req; + // sum up min_res_req in case we need to redistribute min_res_req + if (g->est_count > 0) { + used_space += g->min_res_req; + } else { // this group needs no resources because it is not established. g->min_res_req = 0; } } /* end ForEachGroup() */ - // If there is unused space we need to redistribute - if(unused_space > 0){ - // printf("\nYear %d: unused_space = %f\n\n", Globals.currYear, unused_space); - ForEachGroup(rg){ - g = RGroup[rg]; - // If this group is established, give it some of the unused space. - if(g->est_count != 0){ - // printf("%s before: %f\n", g->name, g->min_res_req); - /* This formula will proportionally redistribute the unused space to all groups that are established */ - g->min_res_req = g->min_res_req / (1 - unused_space); - // printf("%s after: %f\n", g->name, g->min_res_req); - } + + if (ZRO(used_space)) { + // We shouldn't have arrived here + LogError(stderr, LOGFATAL, "Invalid space values"); + } + + //RealF tmp = 0.; + + // If there is unused (or too much used) space we need to redistribute + if (!EQ(used_space, 1.0)) { + //printf("\nYear %d: used_space = %f\n", Globals.currYear, used_space); + + ForEachGroup(rg) { + g = RGroup[rg]; + /* Redistribute the unused (or too much used) space to all groups that + are established */ + if (g->est_count > 0) { + //printf("%s before: %f -- ", g->name, g->min_res_req); + g->min_res_req = g->min_res_req / used_space; + //printf("%s after: %f\n", g->name, g->min_res_req); + //tmp += g->min_res_req; } + } } + + //printf("Sum of space after adjustment = %f\n", tmp); } + /***********************************************************/ void rgroup_IncrAges(void) { From a3874f45680b8e3775ad055475c07223392152cc Mon Sep 17 00:00:00 2001 From: Kyle Palmquist Date: Wed, 7 Aug 2019 20:20:35 -0400 Subject: [PATCH 18/21] Removed unnecessary logerror and printf statements - resolves issue #368 --- ST_resgroups.c | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/ST_resgroups.c b/ST_resgroups.c index d28d2519..16e3f46c 100644 --- a/ST_resgroups.c +++ b/ST_resgroups.c @@ -651,7 +651,6 @@ void rgroup_Establish(void) { if (Species[sp]->max_age == 1) { //printf("Globals.currYear = %hu, call to _add_annuals sp=%d Species[sp]->lastyear_relsize : %.5f \n", Globals.currYear, sp, Species[sp]->lastyear_relsize); num_est = _add_annuals(rg, sp, Species[sp]->lastyear_relsize); - // printf("g->seedbank annuals=%d \n",g->seedbank); } /* Establishment for species that belong to perennial functional groups*/ @@ -679,14 +678,6 @@ void rgroup_Establish(void) { } } /* end ForEachGroup() */ - - if (ZRO(used_space)) { - // We shouldn't have arrived here - LogError(stderr, LOGFATAL, "Invalid space values"); - } - - //RealF tmp = 0.; - // If there is unused (or too much used) space we need to redistribute if (!EQ(used_space, 1.0)) { //printf("\nYear %d: used_space = %f\n", Globals.currYear, used_space); @@ -698,13 +689,9 @@ void rgroup_Establish(void) { if (g->est_count > 0) { //printf("%s before: %f -- ", g->name, g->min_res_req); g->min_res_req = g->min_res_req / used_space; - //printf("%s after: %f\n", g->name, g->min_res_req); - //tmp += g->min_res_req; } } } - - //printf("Sum of space after adjustment = %f\n", tmp); } /***********************************************************/ From 508bf17085160d26a1f7e52c1007603371873e91 Mon Sep 17 00:00:00 2001 From: Chandler Haukap Date: Mon, 12 Aug 2019 13:49:19 -0600 Subject: [PATCH 19/21] Renamed baseline_min_res_req to space (pr #376) --- ST_params.c | 2 +- ST_resgroups.c | 2 +- ST_structs.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ST_params.c b/ST_params.c index 0b83b4ec..dc03fdb5 100644 --- a/ST_params.c +++ b/ST_params.c @@ -914,7 +914,7 @@ static void _rgroup_add1( char name[], RealF space, RealF density, RGroup[rg]->max_per_sqm = density; // density per square-meter RGroup[rg]->use_mort = itob(mort); RGroup[rg]->slowrate = slow; - RGroup[rg]->baseline_min_res_req = space; + RGroup[rg]->space = space; RGroup[rg]->min_res_req = space; RGroup[rg]->est_annually = itob(estann); RGroup[rg]->startyr = styr; diff --git a/ST_resgroups.c b/ST_resgroups.c index 16e3f46c..a1706479 100644 --- a/ST_resgroups.c +++ b/ST_resgroups.c @@ -632,7 +632,7 @@ void rgroup_Establish(void) { continue; g->regen_ok = TRUE; /* default */ - g->min_res_req = g->baseline_min_res_req; /* reset min_res_req, if it was modified last year */ + g->min_res_req = g->space; /* reset min_res_req, if it was modified last year */ if (Globals.currYear < RGroup[rg]->startyr) { g->regen_ok = FALSE; diff --git a/ST_structs.h b/ST_structs.h index ef4ea956..4ad8a4f9 100644 --- a/ST_structs.h +++ b/ST_structs.h @@ -180,7 +180,7 @@ struct resourcegroup_st { grazingfrq, /* grazing effect on group at this frequency: <1=prob, >1=# years */ grazingfreq_startyr;/* start year for grazing frequency*/ SppIndex *species; /*list of spp belonging to this grp*/ - RealF baseline_min_res_req, /* input from table */ + RealF space, /* input from table */ min_res_req, /* input from table, rescaled if an rgroup is not established */ max_density, /* number of mature plants per plot allowed */ max_per_sqm, /* density of mature plants in units of plants / m^2 */ From 13464c6f32e3348ce420dd390a0a9078df9ae978 Mon Sep 17 00:00:00 2001 From: Daniel Schlaepfer Date: Mon, 19 Aug 2019 13:36:23 -0400 Subject: [PATCH 20/21] Clean up function `_sxw_sw_setup` Previously, the function `_sxw_sw_setup` called `SW_VPD_init` to setup SOILWAT2's vegetation data. We no longer need to call `SW_VPD_init` since SOILWAT2 v3.5.0. SOILWAT2 calls `SW_VPD_init` at the beginning of each year (for dynamic CO2-effects). Remove commented out code to address https://github.com/DrylandEcology/STEPWAT2/pull/376#discussion_r314931051 --- sxw_soilwat.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/sxw_soilwat.c b/sxw_soilwat.c index 462c9148..1981d979 100644 --- a/sxw_soilwat.c +++ b/sxw_soilwat.c @@ -93,11 +93,6 @@ void _sxw_sw_setup (RealF sizes[]) { v->veg[k].lai_conv_daily[doy] = 0.; } } - - /* We no longer need to call `SW_VPD_init` since SOILWAT2 v3.5.0. SOILWAT2 - calls `SW_VPD_init` at the beginning of each year (for dynamic CO2-effects) - */ - // SW_VPD_init(); } void _sxw_sw_run(void) { From d04ca2aa725cf33f922b697f224d6ef6c1563597 Mon Sep 17 00:00:00 2001 From: Chandler Haukap Date: Mon, 19 Aug 2019 14:22:21 -0600 Subject: [PATCH 21/21] Addressed comments of PR #376 These changes are only regarding comments, mainly printf statements. --- ST_mortality.c | 1 - ST_resgroups.c | 3 --- ST_structs.h | 2 +- sxw_resource.c | 4 ---- 4 files changed, 1 insertion(+), 9 deletions(-) diff --git a/ST_mortality.c b/ST_mortality.c index 3129dd75..5b22f092 100644 --- a/ST_mortality.c +++ b/ST_mortality.c @@ -148,7 +148,6 @@ void mort_Main( Bool *killed) { /* Calculate PR at the functional group level: resources required/resources available */ g->pr = ZRO(g->res_avail) ? 0. : g->res_required / g->res_avail; - //printf("g->pr after = %f\n,Group = %s \n",RGroup[rg]->name, g->pr);/* kill plants if low resources for consecutive years */ /* kill plants if low resources for consecutive years */ /* increment yrs_neg_pr if pr > 1, else zero it. */ diff --git a/ST_resgroups.c b/ST_resgroups.c index a1706479..c16a508f 100644 --- a/ST_resgroups.c +++ b/ST_resgroups.c @@ -383,7 +383,6 @@ void rgroup_ResPartIndiv(void) { * not assign extra */ if (GE(ndv->res_avail, ndv->res_required)) { ndv->res_extra = 0.0; - //printf("ndv->res_extra = %f\n", ndv->res_extra); } /* Assign extra resource as the difference of what is required @@ -680,14 +679,12 @@ void rgroup_Establish(void) { // If there is unused (or too much used) space we need to redistribute if (!EQ(used_space, 1.0)) { - //printf("\nYear %d: used_space = %f\n", Globals.currYear, used_space); ForEachGroup(rg) { g = RGroup[rg]; /* Redistribute the unused (or too much used) space to all groups that are established */ if (g->est_count > 0) { - //printf("%s before: %f -- ", g->name, g->min_res_req); g->min_res_req = g->min_res_req / used_space; } } diff --git a/ST_structs.h b/ST_structs.h index 4ad8a4f9..c1027e08 100644 --- a/ST_structs.h +++ b/ST_structs.h @@ -181,7 +181,7 @@ struct resourcegroup_st { grazingfreq_startyr;/* start year for grazing frequency*/ SppIndex *species; /*list of spp belonging to this grp*/ RealF space, /* input from table */ - min_res_req, /* input from table, rescaled if an rgroup is not established */ + min_res_req, /* input space from table, rescaled if one or more rgroups is not established */ max_density, /* number of mature plants per plot allowed */ max_per_sqm, /* density of mature plants in units of plants / m^2 */ max_bmass, /* sum of mature biomass for all species in group */ diff --git a/sxw_resource.c b/sxw_resource.c index 7a1e5f24..94a35b8f 100644 --- a/sxw_resource.c +++ b/sxw_resource.c @@ -305,7 +305,6 @@ static void _transp_contribution_by_group(RealF use_by_group[]) { } TranspRemaining = sumTranspTotal - sumUsedByGroup; - //printf("Total = %f\tUsed = %f\tRemaining = %f\n", sumTranspTotal, sumUsedByGroup, TranspRemaining); /* ------------- Begin testing to see if additional transpiration is necessary ------------- */ @@ -389,9 +388,6 @@ static void _transp_contribution_by_group(RealF use_by_group[]) { // replace the sum of squares with what we just calculated transp_window.SoS_array[transp_window.oldest_index] = ssqr; - //printf("Year %d: ratio = %f, mean = %f, sos = %f\n",Globals.currYear, - //transp_ratio+added_transp_ratio,transp_window.ratio_average, transp_window.sum_of_sqrs); - /* Adds the additional transpiration to the remaining transpiration * so it can be distributed proportionally to the functional groups. */ TranspRemaining += added_transp;