Skip to content

Commit

Permalink
Merge branch 'main_network_allocation_main' into main_network_allocat…
Browse files Browse the repository at this point in the history
…ion_optimization
  • Loading branch information
SouthEndMusic committed Jan 30, 2024
2 parents 1d92556 + c24cf35 commit e2a94e8
Show file tree
Hide file tree
Showing 41 changed files with 4,919 additions and 2,479 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/core_tests.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Julia Tests
on:
push:
branches: [main, update/pixi-lock]
branches: [main, update/pixi-lock, update/julia-manifest]
paths-ignore: [".teamcity/**"]
tags: ["*"]
pull_request:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Docs
on:
push:
branches: [main, update/pixi-lock]
branches: [main, update/pixi-lock, update/julia-manifest]
paths-ignore: [".teamcity/**"]
pull_request:
merge_group:
Expand Down
31 changes: 31 additions & 0 deletions .github/workflows/julia_auto_update.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Julia auto update

on:
schedule:
# At 03:00 on day 1 of the month
- cron: "0 3 1 * *"
# on demand
workflow_dispatch:

jobs:
auto-update:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ssh-key: ${{ secrets.SSH_PRIVATE_KEY }}
- uses: prefix-dev/[email protected]
with:
pixi-version: "latest"
- name: Update Julia manifest file
run: |
pixi run update-manifest-julia
pixi install
- uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch: update/julia-manifest
title: Update Julia manifest
commit-message: "Update Julia manifest"
body: Update Julia dependencies to the latest version.
author: "GitHub <[email protected]>"
22 changes: 2 additions & 20 deletions .teamcity/Ribasim/buildTypes/Ribasim_Ribasim_MakeGitHubRelease.xml
Original file line number Diff line number Diff line change
Expand Up @@ -98,44 +98,26 @@ fi]]></param>
<option name="take-successful-builds-only" value="true" />
</options>
</depend-on>
<depend-on sourceBuildTypeId="Ribasim_GenerateTestmodels">
<options>
<option name="run-build-if-dependency-failed" value="RUN_ADD_PROBLEM" />
<option name="take-started-build-with-same-revisions" value="true" />
<option name="take-successful-builds-only" value="true" />
</options>
</depend-on>
<depend-on sourceBuildTypeId="Ribasim_Linux_TestRibasimApi">
<options>
<option name="run-build-if-dependency-failed" value="RUN_ADD_PROBLEM" />
<option name="take-started-build-with-same-revisions" value="true" />
<option name="take-successful-builds-only" value="true" />
</options>
</depend-on>
<depend-on sourceBuildTypeId="Ribasim_Linux_TestRibasimCli">
<options>
<option name="run-build-if-dependency-failed" value="RUN_ADD_PROBLEM" />
<option name="take-started-build-with-same-revisions" value="true" />
<option name="take-successful-builds-only" value="true" />
</options>
</depend-on>
<depend-on sourceBuildTypeId="Ribasim_Windows_TestRibasimCli">
<depend-on sourceBuildTypeId="Ribasim_GenerateTestmodels">
<options>
<option name="run-build-if-dependency-failed" value="RUN_ADD_PROBLEM" />
<option name="take-started-build-with-same-revisions" value="true" />
<option name="take-successful-builds-only" value="true" />
</options>
</depend-on>
<depend-on sourceBuildTypeId="Ribasim_Linux_BuildRibasimCli">
<options>
<option name="run-build-if-dependency-failed" value="RUN_ADD_PROBLEM" />
<option name="take-started-build-with-same-revisions" value="true" />
<option name="take-successful-builds-only" value="true" />
</options>
</depend-on>
<depend-on sourceBuildTypeId="Ribasim_Windows_TestRibasimApi">
<depend-on sourceBuildTypeId="Ribasim_Windows_TestRibasimCli">
<options>
<option name="run-build-if-dependency-failed" value="RUN_ADD_PROBLEM" />
<option name="take-started-build-with-same-revisions" value="true" />
<option name="take-successful-builds-only" value="true" />
</options>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,6 @@ pixi run build-ribasim-cli]]></param>
<param name="secure:github_access_token" value="credentialsJSON:71420214-373c-4ccd-ba32-2ea886843f62" />
</parameters>
</extension>
<extension id="PROVIDE_AWS_CREDS" type="PROVIDE_AWS_CREDS">
<parameters>
<param name="awsConnectionId" value="AmazonWebServicesAws" />
<param name="awsSessionDuration" value="60" />
</parameters>
</extension>
</build-extensions>
<cleanup />
</settings>
Expand Down
80 changes: 42 additions & 38 deletions Manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,9 @@ version = "0.1.5"

[[deps.Bzip2_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"]
git-tree-sha1 = "19a35467a82e236ff51bc17a3a44b69ef35185a2"
git-tree-sha1 = "9e2a6b69137e6969bab0152632dcb3bc108c8bdd"
uuid = "6e34b625-4abd-537c-b88f-471c36dfa7a0"
version = "1.0.8+0"
version = "1.0.8+1"

[[deps.CEnum]]
git-tree-sha1 = "eb4cb44a499229b3b8426dcfb5dd85333951ff90"
Expand Down Expand Up @@ -218,9 +218,9 @@ version = "0.7.3"

[[deps.CodecZstd]]
deps = ["TranscodingStreams", "Zstd_jll"]
git-tree-sha1 = "f69e46bf7b307d15a896b57d5b3321c01cd64923"
git-tree-sha1 = "23373fecba848397b1705f6183188a0c0bc86917"
uuid = "6b39b394-51ab-5f42-8807-6242bab2b4c2"
version = "0.8.1"
version = "0.8.2"

[[deps.ColorTypes]]
deps = ["FixedPointNumbers", "Random"]
Expand Down Expand Up @@ -253,9 +253,9 @@ version = "0.3.0"

[[deps.Compat]]
deps = ["TOML", "UUIDs"]
git-tree-sha1 = "ed2ebb1ff7550226ddb584ba8352facf8d9ffb22"
git-tree-sha1 = "75bd5b6fc5089df449b5d35fa501c846c9b6549b"
uuid = "34da2185-b29b-5c13-b0c7-acf172513d20"
version = "4.11.0"
version = "4.12.0"
weakdeps = ["Dates", "LinearAlgebra"]

[deps.Compat.extensions]
Expand Down Expand Up @@ -355,9 +355,9 @@ uuid = "a10d1c49-ce27-4219-8d33-6db1a4562965"
version = "2.5.0"

[[deps.DataAPI]]
git-tree-sha1 = "8da84edb865b0b5b0100c0666a9bc9a0b71c553c"
git-tree-sha1 = "abe83f3a2f1b857aac70ef8b269080af17764bbe"
uuid = "9a962f9c-6df0-11e9-0e5d-c546b8b5ee8a"
version = "1.15.0"
version = "1.16.0"

[[deps.DataFrames]]
deps = ["Compat", "DataAPI", "DataStructures", "Future", "InlineStrings", "InvertedIndices", "IteratorInterfaceExtensions", "LinearAlgebra", "Markdown", "Missings", "PooledArrays", "PrecompileTools", "PrettyTables", "Printf", "REPL", "Random", "Reexport", "SentinelArrays", "SortingAlgorithms", "Statistics", "TableTraits", "Tables", "Unicode"]
Expand Down Expand Up @@ -401,15 +401,15 @@ uuid = "ade2ca70-3891-5945-98fb-dc099432e06a"

[[deps.Dictionaries]]
deps = ["Indexing", "Random", "Serialization"]
git-tree-sha1 = "e82c3c97b5b4ec111f3c1b55228cebc7510525a2"
git-tree-sha1 = "5bde104a45593207307e1481a58e0339d4643fca"
uuid = "85a47980-9c8c-11e8-2b9f-f7ca1fa99fb4"
version = "0.3.25"
version = "0.3.26"

[[deps.DiffEqBase]]
deps = ["ArrayInterface", "DataStructures", "DocStringExtensions", "EnumX", "EnzymeCore", "FastBroadcast", "ForwardDiff", "FunctionWrappers", "FunctionWrappersWrappers", "LinearAlgebra", "Logging", "Markdown", "MuladdMacro", "Parameters", "PreallocationTools", "PrecompileTools", "Printf", "RecursiveArrayTools", "Reexport", "SciMLBase", "SciMLOperators", "Setfield", "SparseArrays", "Static", "StaticArraysCore", "Statistics", "Tricks", "TruncatedStacktraces"]
git-tree-sha1 = "044648af911974c3928058c1f8c83f159dece274"
git-tree-sha1 = "6af33c2eb7478db06bcf5c810e6f3dda53aac2ac"
uuid = "2b5f629d-d688-5b77-993f-72d75c75574e"
version = "6.145.6"
version = "6.146.0"

[deps.DiffEqBase.extensions]
DiffEqBaseChainRulesCoreExt = "ChainRulesCore"
Expand Down Expand Up @@ -714,9 +714,9 @@ version = "1.14.2+1"

[[deps.HiGHS]]
deps = ["HiGHS_jll", "MathOptInterface", "PrecompileTools", "SparseArrays"]
git-tree-sha1 = "fce13308f09771b160232903cad57be39a8a0ebb"
git-tree-sha1 = "2b650f670ad691b94f506e88b4f3ab591a13f809"
uuid = "87dc4568-4c63-4d18-b0c0-bb2238e4078b"
version = "1.7.5"
version = "1.8.0"

[[deps.HiGHS_jll]]
deps = ["Artifacts", "CompilerSupportLibraries_jll", "JLLWrappers", "Libdl"]
Expand Down Expand Up @@ -750,9 +750,9 @@ version = "1.24.2"

[[deps.IOCapture]]
deps = ["Logging", "Random"]
git-tree-sha1 = "d75853a0bdbfb1ac815478bacd89cd27b550ace6"
git-tree-sha1 = "8b72179abc660bfab5e28472e019392b97d0985c"
uuid = "b5f81e59-6552-4d32-b1f0-c071b021bf89"
version = "0.2.3"
version = "0.2.4"

[[deps.IfElse]]
git-tree-sha1 = "debdd00ffef04665ccbb3e150747a77560e8fad1"
Expand Down Expand Up @@ -825,9 +825,9 @@ version = "1.0.0"

[[deps.JLD2]]
deps = ["FileIO", "MacroTools", "Mmap", "OrderedCollections", "Pkg", "PrecompileTools", "Printf", "Reexport", "Requires", "TranscodingStreams", "UUIDs"]
git-tree-sha1 = "853b9e0b876e8c7093a824c4f83c619d23525e64"
git-tree-sha1 = "7c0008f0b7622c6c0ee5c65cbc667b69f8a65672"
uuid = "033835bb-8acc-5ee8-8aae-3f567f8a3819"
version = "0.4.43"
version = "0.4.45"

[[deps.JLLWrappers]]
deps = ["Artifacts", "Preferences"]
Expand Down Expand Up @@ -1088,9 +1088,9 @@ weakdeps = ["ChainRulesCore", "ForwardDiff", "SpecialFunctions"]

[[deps.LoweredCodeUtils]]
deps = ["JuliaInterpreter"]
git-tree-sha1 = "38756922d32476c8f41f73560b910fc805a5a103"
git-tree-sha1 = "20ce1091ba18bcdae71ad9b71ee2367796ba6c48"
uuid = "6f1432cf-f94c-5a45-995e-cdbf5db27b0b"
version = "2.4.3"
version = "2.4.4"

[[deps.Lz4_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl"]
Expand Down Expand Up @@ -1124,9 +1124,9 @@ version = "5.3.1+0"

[[deps.MacroTools]]
deps = ["Markdown", "Random"]
git-tree-sha1 = "b211c553c199c111d998ecdaf7623d1b89b69f93"
git-tree-sha1 = "2fa9ee3e63fd3a4f7a9a4f4744a52f4856de82df"
uuid = "1914dd2f-81c6-5fcd-8719-6d5c9610ff09"
version = "0.5.12"
version = "0.5.13"

[[deps.ManualMemory]]
git-tree-sha1 = "bcaef4fc7a0cfe2cba636d84cda54b5e4e4ca3cd"
Expand Down Expand Up @@ -1254,10 +1254,10 @@ uuid = "ca575930-c2e3-43a9-ace4-1e988b2c1908"
version = "1.2.0"

[[deps.NonlinearSolve]]
deps = ["ADTypes", "ArrayInterface", "ConcreteStructs", "DiffEqBase", "EnumX", "FastBroadcast", "FastClosures", "FiniteDiff", "ForwardDiff", "LazyArrays", "LineSearches", "LinearAlgebra", "LinearSolve", "MaybeInplace", "PrecompileTools", "Printf", "RecursiveArrayTools", "Reexport", "SciMLBase", "SciMLOperators", "SimpleNonlinearSolve", "SparseArrays", "SparseDiffTools", "StaticArrays", "UnPack"]
git-tree-sha1 = "72b036b728461272ae1b1c3f7096cb4c319d8793"
deps = ["ADTypes", "ArrayInterface", "ConcreteStructs", "DiffEqBase", "FastBroadcast", "FastClosures", "FiniteDiff", "ForwardDiff", "LazyArrays", "LineSearches", "LinearAlgebra", "LinearSolve", "MaybeInplace", "PrecompileTools", "Preferences", "Printf", "RecursiveArrayTools", "Reexport", "SciMLBase", "SimpleNonlinearSolve", "SparseArrays", "SparseDiffTools", "StaticArraysCore", "TimerOutputs"]
git-tree-sha1 = "78bdd3a4a62865cf43c53d63783b0cbfddcdbbe6"
uuid = "8913a72c-1f9b-4ce2-8d82-65094dcecaec"
version = "3.4.0"
version = "3.5.0"

[deps.NonlinearSolve.extensions]
NonlinearSolveBandedMatricesExt = "BandedMatrices"
Expand Down Expand Up @@ -1468,9 +1468,9 @@ version = "1.3.4"

[[deps.RecursiveArrayTools]]
deps = ["Adapt", "ArrayInterface", "DocStringExtensions", "GPUArraysCore", "IteratorInterfaceExtensions", "LinearAlgebra", "RecipesBase", "SparseArrays", "StaticArraysCore", "Statistics", "SymbolicIndexingInterface", "Tables"]
git-tree-sha1 = "4943624c0e437ddf6362a82e5319bc8e83d80857"
git-tree-sha1 = "dd7fc1923fde0cc6cdff451352d17924b0704ca1"
uuid = "731186ca-8d62-57ce-b412-fbd966d074cd"
version = "3.5.2"
version = "3.5.4"

[deps.RecursiveArrayTools.extensions]
RecursiveArrayToolsFastBroadcastExt = "FastBroadcast"
Expand Down Expand Up @@ -1556,9 +1556,9 @@ version = "3.43.0+0"

[[deps.SciMLBase]]
deps = ["ADTypes", "ArrayInterface", "CommonSolve", "ConstructionBase", "Distributed", "DocStringExtensions", "EnumX", "FillArrays", "FunctionWrappersWrappers", "IteratorInterfaceExtensions", "LinearAlgebra", "Logging", "Markdown", "PrecompileTools", "Preferences", "Printf", "RecipesBase", "RecursiveArrayTools", "Reexport", "RuntimeGeneratedFunctions", "SciMLOperators", "StaticArraysCore", "Statistics", "SymbolicIndexingInterface", "Tables", "TruncatedStacktraces"]
git-tree-sha1 = "b2714ddd879525c825f427e861f5059a96b287f7"
git-tree-sha1 = "de41474ac529bf81598e064587421cc5ebc28fa0"
uuid = "0bca4576-84f4-4d90-8ffe-ffa030f20462"
version = "2.18.0"
version = "2.20.0"

[deps.SciMLBase.extensions]
SciMLBaseChainRulesCoreExt = "ChainRulesCore"
Expand Down Expand Up @@ -1609,16 +1609,18 @@ deps = ["Distributed", "Mmap", "Random", "Serialization"]
uuid = "1a1011a3-84de-559e-8e89-a11a2f7dc383"

[[deps.SimpleNonlinearSolve]]
deps = ["ADTypes", "ArrayInterface", "ConcreteStructs", "DiffEqBase", "FiniteDiff", "ForwardDiff", "LinearAlgebra", "MaybeInplace", "PrecompileTools", "Reexport", "SciMLBase", "StaticArraysCore"]
git-tree-sha1 = "8d672bd91dc432fb286b6d4bcf1a5dc417e932a3"
deps = ["ADTypes", "ArrayInterface", "ConcreteStructs", "DiffEqBase", "FastClosures", "FiniteDiff", "ForwardDiff", "LinearAlgebra", "MaybeInplace", "PrecompileTools", "Reexport", "SciMLBase", "StaticArraysCore"]
git-tree-sha1 = "470c5f97af31fa35926b45eb01e53a46c8d7d35f"
uuid = "727e6d20-b764-4bd8-a329-72de5adea6c7"
version = "1.2.0"
version = "1.3.1"

[deps.SimpleNonlinearSolve.extensions]
SimpleNonlinearSolvePolyesterForwardDiffExt = "PolyesterForwardDiff"
SimpleNonlinearSolveStaticArraysExt = "StaticArrays"

[deps.SimpleNonlinearSolve.weakdeps]
PolyesterForwardDiff = "98d1487c-24ca-40b6-b7ab-df2af84e126b"
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"

[[deps.SimpleTraits]]
deps = ["InteractiveUtils", "MacroTools"]
Expand Down Expand Up @@ -1653,17 +1655,19 @@ version = "1.10.0"

[[deps.SparseDiffTools]]
deps = ["ADTypes", "Adapt", "ArrayInterface", "Compat", "DataStructures", "FiniteDiff", "ForwardDiff", "Graphs", "LinearAlgebra", "PackageExtensionCompat", "Random", "Reexport", "SciMLOperators", "Setfield", "SparseArrays", "StaticArrayInterface", "StaticArrays", "Tricks", "UnPack", "VertexSafeGraphs"]
git-tree-sha1 = "c281e11db4eacb36a292a054bac83c5a0aca2a26"
git-tree-sha1 = "3b38ae7a1cbe9b8b1344359599753957644b03d4"
uuid = "47a9eef4-7e08-11e9-0b38-333d64bd3804"
version = "2.15.0"
version = "2.16.0"

[deps.SparseDiffTools.extensions]
SparseDiffToolsEnzymeExt = "Enzyme"
SparseDiffToolsPolyesterForwardDiffExt = "PolyesterForwardDiff"
SparseDiffToolsSymbolicsExt = "Symbolics"
SparseDiffToolsZygoteExt = "Zygote"

[deps.SparseDiffTools.weakdeps]
Enzyme = "7da242da-08ed-463a-9acd-ee780be4f1d9"
PolyesterForwardDiff = "98d1487c-24ca-40b6-b7ab-df2af84e126b"
Symbolics = "0c5d862f-8b57-4792-8d23-62f2024744c7"
Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f"

Expand Down Expand Up @@ -1708,9 +1712,9 @@ weakdeps = ["OffsetArrays", "StaticArrays"]

[[deps.StaticArrays]]
deps = ["LinearAlgebra", "PrecompileTools", "Random", "StaticArraysCore"]
git-tree-sha1 = "4e17a790909b17f7bf1496e3aec138cf01b60b3b"
git-tree-sha1 = "f68dd04d131d9a8a8eb836173ee8f105c360b0c5"
uuid = "90137ffa-7385-5640-81b9-e52037218182"
version = "1.9.0"
version = "1.9.1"
weakdeps = ["ChainRulesCore", "Statistics"]

[deps.StaticArrays.extensions]
Expand Down Expand Up @@ -1747,9 +1751,9 @@ version = "0.3.4"

[[deps.StructArrays]]
deps = ["Adapt", "ConstructionBase", "DataAPI", "GPUArraysCore", "StaticArraysCore", "Tables"]
git-tree-sha1 = "0a3db38e4cce3c54fe7a71f831cd7b6194a54213"
git-tree-sha1 = "1b0b1205a56dc288b71b1961d48e351520702e24"
uuid = "09ab397b-f2b6-538f-b94a-2f83cf4a842a"
version = "0.6.16"
version = "0.6.17"

[[deps.StructTypes]]
deps = ["Dates", "UUIDs"]
Expand Down
8 changes: 7 additions & 1 deletion build/libribasim/src/libribasim.jl
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,12 @@ Base.@ccallable function update_until(time::Cdouble)::Cint
end
end

Base.@ccallable function update_subgrid_level()::Cint
@try_c begin
Ribasim.update_subgrid_level(model)
end
end

Base.@ccallable function get_current_time(time::Ptr{Cdouble})::Cint
@try_c begin
t = BMI.get_current_time(model)
Expand Down Expand Up @@ -169,7 +175,7 @@ end

Base.@ccallable function get_version(version::Cstring)::Cint
@try_c_uninitialized begin
ribasim_version = pkgversion(Ribasim)
ribasim_version = Ribasim.pkgversion(Ribasim)
unsafe_write_to_cstring!(version, string(ribasim_version))
end
end
Expand Down
2 changes: 1 addition & 1 deletion core/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name = "Ribasim"
uuid = "aac5e3d9-0b8f-4d4f-8241-b1a7a9632635"
authors = ["Deltares and contributors <[email protected]>"]
manifest = "../Manifest.toml"
version = "0.6.0"
version = "0.7.0"

[deps]
Accessors = "7d9f7c33-5ae7-4f3b-8dc6-eff91059b697"
Expand Down
9 changes: 7 additions & 2 deletions core/src/bmi.jl
Original file line number Diff line number Diff line change
Expand Up @@ -634,9 +634,9 @@ function update_tabulated_rating_curve!(integrator)::Nothing
# update the existing LinearInterpolation
id = first(group).node_id
level = [row.level for row in group]
discharge = [row.discharge for row in group]
flow_rate = [row.flow_rate for row in group]
i = searchsortedfirst(node_id, NodeID(id))
tables[i] = LinearInterpolation(discharge, level; extrapolate = true)
tables[i] = LinearInterpolation(flow_rate, level; extrapolate = true)
end
return nothing
end
Expand All @@ -660,6 +660,11 @@ function BMI.update_until(model::Model, time)::Model
return model
end

function update_subgrid_level(model::Model)::Model
update_subgrid_level!(model.integrator)
return model
end

function BMI.get_value_ptr(model::Model, name::AbstractString)
if name == "volume"
model.integrator.u.storage
Expand Down
Loading

0 comments on commit e2a94e8

Please sign in to comment.