Skip to content
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

included soil ODE scheme. Little issue in GW mass balance #3

Closed
wants to merge 1 commit into from

Conversation

RY4GIT
Copy link
Collaborator

@RY4GIT RY4GIT commented Jun 11, 2023

Summary

This PR addresses the issue NOAA-OWP/cfe#82

Note that this PR will solve the issue above, but changes the model behavior and scheme largely, and increase the computational time.

Known issue

This PR still has a little issue in groundwater mass balance in this PR. Refer to the code https://github.com/RY4GIT/SMSigxModel/tree/mcmillan_ws/py_cfe or NOAA-OWP/cfe#66 or , which don't have groundwater mass balance issues. I probably forgot to copy or delete some lines from those versions to this one.

Copy link
Collaborator

@jmframe jmframe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this is great. I ran the code and it works. The main thing is that this functionality has to be an option, but replacing the old code. Even though the old code has problems, there is an important aspect of Nextgen to be able to run models as the origional author intended, even if it is a mistake, but we'll just have the option to run the soil-ode instead, and we'll run that most times.

So basically we need a setup like the partitioning scheme can be either Xinanjiang or Schaake. We'll need a soil reservoir flux option for "ODE". I can help with this, if you want.

@@ -368,14 +379,14 @@ def finalize_mass_balance(self, verbose=True):

self.vol_soil_end = self.soil_reservoir['storage_m']

self.global_residual = self.volstart + self.volin - self.volout - self.volend -self.vol_end_giuh
self.schaake_residual = self.volin - self.vol_sch_runoff - self.vol_sch_infilt - self.vol_et_from_rain
self.global_residual = self.volstart + self.volin - self.volout - self.volend -self.vol_end_giuh #(?) - vol_in_nash_end? --- This is already excluded from the system.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not 100% sure, but I think this is still needed here. Since the global residual needs to account for anything that can be left over. Unless you are sure that it will be zero at any time step, we should still subtract from volstart and volin.

@@ -233,7 +240,7 @@ def initialize(self,current_time_step=0):

# ________________________________________________
# Nash cascade
self.K_nash = 0.03
self.K_nash = self.K_nash
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can just delete.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree

import math

@jit(nopython=True)
def conceptual_reservoir_flux_calc(t, S, storage_threshold_primary_m, storage_max_m, coeff_primary, coeff_secondary, PET, infilt, wltsmc):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not include this in the CFE class? Then all these inputs will be in CFE_STATE.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I simply didn't try! They can be included in the CFE class

cfe_state.volout += cfe_state.actual_et_from_rain_m_per_timestep

# ________________________________________________
# Calculate evaporation from soil
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to include options for all the old code. We have to be able to run an identical version as the C code. So there needs to be an option from the configuration file to run this.

@RY4GIT
Copy link
Collaborator Author

RY4GIT commented Jun 15, 2023

Thank you so much for the review!

If you could help me with separating ODE option, it would be great! And I can go ahead figuring out the GW mass balance issue.

Do all changes need to be solved and the PR needs to be merged before you work on the ODE option? Then I will prioritize it (probably done by EOD today or tomorrow)

@jmframe
Copy link
Collaborator

jmframe commented Jun 15, 2023 via email

@RY4GIT
Copy link
Collaborator Author

RY4GIT commented Jun 15, 2023 via email

@jmframe jmframe mentioned this pull request Jun 18, 2023
@jmframe jmframe closed this Jun 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants