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

Support transient user demand return factor #1727

Merged
merged 10 commits into from
Aug 19, 2024
Merged

Support transient user demand return factor #1727

merged 10 commits into from
Aug 19, 2024

Conversation

Jingru923
Copy link
Contributor

Fixes #1230

@Jingru923 Jingru923 linked an issue Aug 14, 2024 that may be closed by this pull request
@Jingru923 Jingru923 marked this pull request as ready for review August 14, 2024 12:17
Copy link
Collaborator

@SouthEndMusic SouthEndMusic left a comment

Choose a reason for hiding this comment

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

Looking good! You should test it by having a simple model without allocation with a transient return factor

core/src/read.jl Outdated Show resolved Hide resolved
core/src/read.jl Outdated Show resolved Hide resolved
@@ -395,8 +395,8 @@ end
@test only(model.integrator.sol(0day)) == 1000.0
# constant UserDemand withdraws to 0.9m/900m3
@test only(model.integrator.sol(150day)) ≈ 900 atol = 5
# dynamic UserDemand withdraws to 0.5m/509m3
@test only(model.integrator.sol(180day)) ≈ 509 atol = 1
# dynamic UserDemand withdraws to 0.5m/503m3
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is still too coarse a test. You should have a look at DataFrame(Ribasim.flow_table(model)), and check whether the outflow to inflow proportion matches your transient return factor

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Timepoint at 179day show a return ratio of 0.197ish and return factor is 0.2

@SouthEndMusic
Copy link
Collaborator

I made some modifications to the test model so that:

  • The different user demand nodes abstract flow at different times so that they can be tested individually
  • The interpolations are not so steep that averaging flows makes testing hard

Copy link
Collaborator

@SouthEndMusic SouthEndMusic left a comment

Choose a reason for hiding this comment

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

I had one last remark, other than that this is good to if you agree with my changes.

core/src/read.jl Outdated Show resolved Hide resolved
@Jingru923 Jingru923 merged commit 0cf38a6 into main Aug 19, 2024
24 of 29 checks passed
@Jingru923 Jingru923 deleted the return-factor branch August 19, 2024 08:57
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.

Add support for transient UserDemand return factor
2 participants