Skip to content

Commit

Permalink
Correctly initialize new array variables
Browse files Browse the repository at this point in the history
- this commit exactly reproduces output as current master (plus new fix
for forbs #47)
  • Loading branch information
dschlaep committed Jan 23, 2018
1 parent 8dc7164 commit ec6c4d5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
10 changes: 5 additions & 5 deletions SW_Flow.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ extern SW_SKY SW_Sky;

extern unsigned int soil_temp_init; // simply keeps track of whether or not the values for the soil_temperature function have been initialized. 0 for no, 1 for yes.
extern unsigned int fusion_pool_init;
extern char const *key2veg[];

/* *************************************************** */
/* Module-Level Variables */
Expand All @@ -148,7 +149,6 @@ RealD lyrSWCBulk[MAX_LAYERS], lyrDrain[MAX_LAYERS],
lyrTransp[NVEGTYPES][MAX_LAYERS], lyrTranspCo[NVEGTYPES][MAX_LAYERS],
lyrEvap[NVEGTYPES][MAX_LAYERS], lyrEvap_BareGround[MAX_LAYERS],
lyrSWCBulk_atSWPcrit[NVEGTYPES][MAX_LAYERS], lyrHydRed[NVEGTYPES][MAX_LAYERS],
lyrHydRed[NVEGTYPES][MAX_LAYERS],

lyrbDensity[MAX_LAYERS], lyrWidths[MAX_LAYERS],
lyrEvapCo[MAX_LAYERS], lyrSumTrCo[MAX_TRANSP_REGIONS + 1],
Expand Down Expand Up @@ -248,14 +248,14 @@ void SW_Water_Flow(void) {
SW_SOILWAT *sw = &SW_Soilwat;

RealD swpot_avg[NVEGTYPES],
transp_veg[NVEGTYPES], transp_rate[NVEGTYPES] = {1.},
soil_evap[NVEGTYPES], soil_evap_rate[NVEGTYPES] = {1.}, soil_evap_rate_bs = 1.,
surface_evap_veg_rate[NVEGTYPES] = {1.},
transp_veg[NVEGTYPES], transp_rate[NVEGTYPES],
soil_evap[NVEGTYPES], soil_evap_rate[NVEGTYPES], soil_evap_rate_bs = 1.,
surface_evap_veg_rate[NVEGTYPES],
surface_evap_litter_rate = 1., surface_evap_standingWater_rate = 1.,
snow_evap_rate = 1.,
veg_h2o[NVEGTYPES], litter_h2o,
litter_h2o_help, h2o_for_soil = 0., ppt_toUse, snowmelt,
snowdepth_scale_veg[NVEGTYPES] = {1.},
snowdepth_scale_veg[NVEGTYPES],
rate_help, x;

int doy, k;
Expand Down
7 changes: 6 additions & 1 deletion SW_Site.c
Original file line number Diff line number Diff line change
Expand Up @@ -433,14 +433,19 @@ static void _read_layers(void) {
SW_SITE *v = &SW_Site;
FILE *f;
Bool evap_ok = swTRUE, /* mitigate gaps in layers' evap coeffs */
transp_ok_veg[NVEGTYPES] = {swTRUE}, /* same for transpiration coefficients */
transp_ok_veg[NVEGTYPES], /* same for transpiration coefficients */
fail = swFALSE;
LyrIndex lyrno;
int x, k;
const char *errtype = "\0";
RealF dmin = 0.0, dmax, evco, trco_veg[NVEGTYPES], psand, pclay, matricd, imperm,
soiltemp, fval = 0, f_gravel;

// Initialize
ForEachVegType(k) {
transp_ok_veg[k] = swTRUE;
}

/* note that Files.read() must be called prior to this. */
MyFileName = SW_F_name(eLayers);

Expand Down

0 comments on commit ec6c4d5

Please sign in to comment.