Skip to content

Commit

Permalink
Merge pull request #780 from dgergel/feature/fix_close_energy_bug
Browse files Browse the repository at this point in the history
Feature/fix close energy bug
  • Loading branch information
bartnijssen committed Mar 9, 2018
2 parents 69cb323 + d1a3a2c commit 9fae303
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
14 changes: 6 additions & 8 deletions vic/drivers/shared_all/src/initialize_parameters.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ void
initialize_parameters()
{
extern parameters_struct param;
extern option_struct options;
// Initialize temporary parameters

// Lapse Rate
Expand Down Expand Up @@ -215,13 +214,12 @@ initialize_parameters()
param.FROZEN_MAXITER = 1000;

// Canopy Iterations
if (options.CLOSE_ENERGY) {
// iterate to close energy balance
param.MAX_ITER_GRND_CANOPY = 10;
}
else {
param.MAX_ITER_GRND_CANOPY = 0;
}
// initialized to 10, set to 0 if
// options.CLOSE_ENERGY is false
// this allows for flexibility in
// changing the maximum number of
// iterations
param.MAX_ITER_GRND_CANOPY = 10;

// Newton-Raphson solver parameters
param.NEWT_RAPH_MAXTRIAL = 150;
Expand Down
6 changes: 6 additions & 0 deletions vic/drivers/shared_image/src/vic_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -1563,6 +1563,12 @@ vic_init(void)
initialize_energy(all_vars[i].energy, nveg);
}

// Canopy Iterations
if (!options.CLOSE_ENERGY) {
// do not iterate to close energy balance
param.MAX_ITER_GRND_CANOPY = 0;
}

// set state metadata structure
set_state_meta_data_info();

Expand Down

0 comments on commit 9fae303

Please sign in to comment.