respec / HSPsquared

Hydrologic Simulation Program Python (HSPsquared)
GNU Affero General Public License v3.0
43 stars 17 forks source link

GQUAL PHFLAG = 1 and PHYTFG = 1 not available for computed timeseries #64

Closed PaulDudaRESPEC closed 2 years ago

PaulDudaRESPEC commented 2 years ago

In GQUAL, the flags PHFLAG and PHYTFG can be used to indicate that input data to the module should come from timeseries computed in RQUAL modules PHYTO and PHCARB. In HSPF, the values of these state variables from the previous time step are available and used. However, because of differences in the time looping in HSP2, those computed time series are not yet available when needed.

A possible solution to this issue would be to change the sequence of simulated sections, so that RQUAL sections are computed before GQUAL.

PaulDudaRESPEC commented 2 years ago

I changed the code to execute RQUAL before GQUAL, and it seems to work successfully. There's a slight difference in GQUAL that results from this change in some cases when compared to HSPF output, where in certain situations HSPF used the previous time step value of RQUAL output in the GQUAL computation. With this HSP2 code change, we actually use the current time step value of RQUAL output, which is logically a better solution.

aufdenkampe commented 2 years ago

That sounds like a win-win. Thanks!