Skip to content

Commit

Permalink
Add some basic concentration tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
evetion committed Nov 14, 2024
1 parent dfbdbb1 commit 7b91635
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
5 changes: 5 additions & 0 deletions core/test/run_models_test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,11 @@ end

# flows are recorded at the end of each period, and are undefined at the start
@test unique(table.time) == Ribasim.datetimes(model)[1:(end - 1)]

@test isfile(joinpath(dirname(toml_path), "results/concentration.arrow"))
table = Ribasim.concentration_table(model)
@test "Continuity" in table.substance
@test all(isapprox.(table.concentration[table.substance .== "Continuity"], 1.0))
end

@testitem "basic arrow model" begin
Expand Down
3 changes: 2 additions & 1 deletion python/ribasim_testmodels/ribasim_testmodels/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import numpy as np
import pandas as pd
import ribasim
from ribasim.config import Node
from ribasim.config import Experimental, Node
from ribasim.input_base import TableModel
from ribasim.nodes import (
basin,
Expand All @@ -26,6 +26,7 @@ def basic_model() -> ribasim.Model:
starttime="2020-01-01",
endtime="2021-01-01",
crs="EPSG:28992",
experimental=Experimental(concentration=True),
)
model.logging = ribasim.Logging(verbosity="debug")

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import numpy as np
import pandas as pd
from ribasim.config import Node
from ribasim.config import Experimental, Node
from ribasim.model import Model, Solver
from ribasim.nodes import (
basin,
Expand Down Expand Up @@ -604,6 +604,7 @@ def continuous_concentration_condition_model() -> Model:
endtime="2020-02-01",
crs="EPSG:28992",
solver=Solver(saveat=86400 / 8),
experimental=Experimental(concentration=True),
)

basi = model.basin.add(
Expand Down

0 comments on commit 7b91635

Please sign in to comment.