-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Nash Cascade based surface runoff #112
Conversation
… var name 'giuh_runoff' with a more generic name 'surface_runoff', bug fix in the volume, end surface and other related changes.
…ated, add example config file for Nash cascade based surface runoff, updated README.md
documented surface runoff schemes and Nash parameters for the surface runoff.
|
||
model->giuh_ordinates = malloc(sizeof(double) * model->num_giuh_ordinates); | ||
// Work with copy of the string pointer to make sure the original pointer remains unchanged, so mem can be freed at end | ||
copy = giuh_originates_string_val; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not a string copy, and these comments should probably reflect that. This is a copy of the pointer so that the beginning of the string isn't lost. The following loop will set value = copy
, and then changes ,
to \0
so that strtod
converts the right bytes for the ordinate value. I think the full string copy
is misleading, that would require something like strcpy
or some other allocation of a buffer and copy of the string values. This is just a reference copy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch. it has been there for a while but probably nobody caught it. I agree we are just copying one pointer to another, and not a full string copy, to preserve the original pointer to giuh_ordinates. I will update the comment to help clearly explain it, please have a look afterward.
… for the subsurface lateral flow N_nash and K_Nash.
Added a new scheme for the surface runoff that is based on Nash Cascade approach. The CFE will now support two schemes for surface runoff: 1) GIUH-based scheme, and 2) NASH_CASCADE-based scheme. Also, with these changes we will have now one Nash cascade model for the surface and one for the subsurface lateral flow. The two Nash models are slight different and hence implemented differently, but the hope is to merge them later. The changes in this PR don't change results of the existing tests.
Additions
Removals
Changes
GIUH_RUNOFF
toSURFACE_RUNOFF
surface_runoff_scheme
as an input in the config fileTesting
Checklist