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

Fix BMI.update_until (InexactError: Int64) #387

Merged
merged 8 commits into from
Apr 17, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/src/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
`to_river` variable from overland flow and lateral subsurface flow was not added to the
inflow of these locations.
- Close netCDF `NCDataset` with state variables in extended BMI function `save_state`.
- `BMI.update_until` could throw an `InexactError: Int64` caused by a not whole number. This
is fixed by applying `round()`.

### Changed
- Stop exposing scalar variables through BMI. The `BMI.get_value_ptr` function was
Expand Down
3 changes: 2 additions & 1 deletion src/bmi.jl
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ end
function BMI.update_until(model::Model, time::Float64)
@unpack clock, network, config = model
curtime = BMI.get_current_time(model)
n = Int(max(0, (time - curtime) / model.clock.Δt.value))
steps = round((time - curtime) / model.clock.Δt.value)
n = Int(max(0, steps))
for _ = 1:n
model = run_timestep(model)
end
Expand Down
Loading