Skip to content

Commit

Permalink
Add tstops for more timeseries (#1418)
Browse files Browse the repository at this point in the history
Fixes #595



This problem shown in the issue seems to be resolved, I can't reproduce
it. When I went back to the default solver and initial level of $0$, I
still get the same graph:

![fine_graph](https://github.com/Deltares/Ribasim/assets/74617371/cfdc91fd-9ab4-4126-995a-0b9712be406b)
  • Loading branch information
SouthEndMusic authored Apr 23, 2024
1 parent 94f36bc commit d4c36d4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
17 changes: 12 additions & 5 deletions core/src/model.jl
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,19 @@ function Model(config::Config)::Model
end

# tell the solver to stop when new data comes in
# TODO add all time tables here
time_flow_boundary = load_structvector(db, config, FlowBoundaryTimeV1)
tstops = Vector{Float64}[]
push!(tstops, get_tstops(time_flow_boundary.time, config.starttime))
time_user_demand = load_structvector(db, config, UserDemandTimeV1)
push!(tstops, get_tstops(time_user_demand.time, config.starttime))
for schema_version in [
FlowBoundaryTimeV1,
LevelBoundaryTimeV1,
UserDemandTimeV1,
LevelDemandTimeV1,
FlowDemandTimeV1,
TabulatedRatingCurveTimeV1,
PidControlTimeV1,
]
time_schema = load_structvector(db, config, schema_version)
push!(tstops, get_tstops(time_schema.time, config.starttime))
end

# use state
state = load_structvector(db, config, BasinStateV1)
Expand Down
3 changes: 1 addition & 2 deletions python/ribasim_testmodels/ribasim_testmodels/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,15 +323,14 @@ def outlet_model():
starttime="2020-01-01",
endtime="2021-01-01",
crs="EPSG:28992",
solver=ribasim.Solver(saveat=0),
)

# Set up the basins
model.basin.add(
Node(3, Point(2.0, 0.0)),
[
basin.Profile(area=[1000.0, 1000.0], level=[0.0, 1.0]),
basin.State(level=[1e-3]),
basin.State(level=[0.0]),
],
)

Expand Down

0 comments on commit d4c36d4

Please sign in to comment.