Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/github_actions/codecov/codecov-ac…
Browse files Browse the repository at this point in the history
…tion-4
  • Loading branch information
ranocha committed Mar 23, 2024
2 parents 0dd398c + 8edf2e2 commit f8549b8
Show file tree
Hide file tree
Showing 12 changed files with 259 additions and 54 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:
- shell: bash
run: |
cp ./lcov.info ./lcov-${{ matrix.version }}-${{ github.run_id }}.info
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: lcov-${{ matrix.version }}-${{ github.run_id }}
path: ./lcov-${{ matrix.version }}-${{ github.run_id }}.info
Expand All @@ -82,7 +82,7 @@ jobs:
# At first, we check out the repository and download all artifacts
# (and list files for debugging).
- uses: actions/checkout@v4
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
- run: ls -R
# Next, we merge the individual coverage files and upload
# the combined results to Coveralls.
Expand All @@ -106,7 +106,7 @@ jobs:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: ./lcov.info
# Upload merged coverage data as artifact for debugging
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: lcov
path: ./lcov.info
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/Documenter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
with:
version: '1'
show-versioninfo: true
- uses: actions/cache@v3
- uses: actions/cache@v4
env:
cache-name: cache-artifacts
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/FormatCheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
#
# julia -e 'using Pkg; Pkg.add(PackageSpec(name="JuliaFormatter", version="0.13.0"))'
run: |
julia -e 'using Pkg; Pkg.add(PackageSpec(name = "JuliaFormatter"))'
julia -e 'using Pkg; Pkg.add(PackageSpec(name = "JuliaFormatter", version="1.0.45"))'
julia -e 'using JuliaFormatter; format(".", verbose = true)'
- name: Format check
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/SpellCheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ jobs:
- name: Checkout Actions Repository
uses: actions/checkout@v4
- name: Check spelling
uses: crate-ci/typos@v1.16.23
uses: crate-ci/typos@v1.18.2
3 changes: 2 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
LinearSolve = "7ed4a6bd-45f5-4d41-b270-4a48e9bafcae"
MuladdMacro = "46d2c3a1-f734-5fdb-9937-b9b9aeba4221"
OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
Reexport = "189a3867-3050-52da-a836-e630ba90ab69"
SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462"
SimpleUnPack = "ce78b400-467f-4804-87d8-8f486da07d0a"
Expand All @@ -29,4 +28,6 @@ Reexport = "1"
SciMLBase = "2"
SimpleUnPack = "1"
SparseArrays = "1.7"
StaticArrays = "1.5"
SymbolicIndexingInterface = "0.2, 0.3"
julia = "1.7"
2 changes: 1 addition & 1 deletion docs/src/index.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# PositiveIntegrators.jl

The [Julia]() library
[PositiveIntegrators.jl](https://github.com/ranocha/PositiveIntegrators.jl)
[PositiveIntegrators.jl](https://github.com/SKopecz/PositiveIntegrators.jl)
provides several time integration methods developed to preserve the positivity
of numerical solutions.

Expand Down
2 changes: 1 addition & 1 deletion examples/03_example_mprk22.jl
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ plot(p1, p2, p3, plot_title = "oop")
# convergence order
using DiffEqDevTools
using PrettyTables
convergence_tab_plot(linmod_op, [MPE(); MPRK22(0.5); MPRK22(1.0)])
convergence_tab_plot(linmod_op, [MPE(); MPRK22(0.5); MPRK22(1.0)]; analytic = true)

# in-place implementation
function linmodP!(P, u, p, t)
Expand Down
60 changes: 30 additions & 30 deletions examples/04_example_problemlibrary.jl
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,16 @@ plot!(sol_linmod_MPE, idxs = (f2, 0, 1, 2))

# convergence order
# error based on analytic solution
convergence_tab_plot(prob_pds_linmod, [MPE(), Euler()]; dts = 0.5 .^ (3:18),
analytic = true, order_plot = true)
savefig("figs/error_linmod_analytic.svg")
sims = convergence_tab_plot(prob_pds_linmod, [MPE(), Euler()]; dts = 0.5 .^ (3:18),
analytic = true, order_plot = true);
@assert sims[1].𝒪est[:l∞] > 0.9
#savefig("figs/error_linmod_analytic.svg")
# error based on reference solution
test_setup = Dict(:alg => Vern9(), :reltol => 1e-14, :abstol => 1e-14);
convergence_tab_plot(prob_pds_linmod, [MPE(), Euler()], test_setup; dts = 0.5 .^ (3:18),
order_plot = true)
savefig("figs/error_linmod_reference.svg")
sims = convergence_tab_plot(prob_pds_linmod, [MPE(), Euler()], test_setup;
dts = 0.5 .^ (3:18), order_plot = true);
@assert sims[1].𝒪est[:l∞] > 0.9
#savefig("figs/error_linmod_reference.svg")

## nonlinear model ########################################################
sol_nonlinmod = solve(prob_pds_nonlinmod, Tsit5());
Expand All @@ -49,10 +51,11 @@ plot(sol_nonlinmod, legend = :right)
myplot!(sol_nonlinmod_MPE, "MPE")
plot!(sol_nonlinmod_MPE, idxs = (f3, 0, 1, 2, 3))

# convergence order
# convergence order
test_setup = Dict(:alg => Vern9(), :reltol => 1e-14, :abstol => 1e-14)
convergence_tab_plot(prob_pds_nonlinmod, [MPE(), Euler()], test_setup; dts = 0.5 .^ (3:17),
order_plot = true)
sims = convergence_tab_plot(prob_pds_nonlinmod, [MPE(), Euler()], test_setup;
dts = 0.5 .^ (3:17), order_plot = true);
@assert sims[1].𝒪est[:l∞] > 0.9

## robertson problem ######################################################
sol_robertson = solve(prob_pds_robertson, Rosenbrock23());
Expand All @@ -74,10 +77,11 @@ myplot!(sol_brusselator_MPE, "MPE")
plot!(sol_brusselator_MPE, idxs = (f_brusselator, 0, 1, 2, 3, 4, 5, 6),
label = "f_brusselator")

# convergence order
# convergence order
test_setup = Dict(:alg => Vern9(), :reltol => 1e-14, :abstol => 1e-14)
convergence_tab_plot(prob_pds_brusselator, [MPE()], test_setup; dts = 0.5 .^ (3:17),
order_plot = true)
sims = convergence_tab_plot(prob_pds_brusselator, [MPE()], test_setup; dts = 0.5 .^ (3:17),
order_plot = true);
@assert sims[1].𝒪est[:l∞] > 0.9

## SIR model ##############################################################
sol_sir = solve(prob_pds_sir, Tsit5());
Expand All @@ -93,22 +97,23 @@ myplot!(sol_sir_Euler, "Euler")
plot!(sol_sir_Euler, idxs = (f3, 0, 1, 2, 3), label = "f3")
plot(p1, p2)

# convergence order
# convergence order
test_setup = Dict(:alg => Vern9(), :reltol => 1e-14, :abstol => 1e-14)
convergence_tab_plot(prob_pds_sir, [MPE(), Euler()], test_setup; dts = 0.5 .^ (1:15),
order_plot = true)
sims = convergence_tab_plot(prob_pds_sir, [MPE(), Euler()], test_setup; dts = 0.5 .^ (1:15),
order_plot = true);
@assert sims[1].𝒪est[:l∞] > 0.9

## bertolazzi problem #####################################################
sol_bertolazzi = solve(prob_pds_bertolazzi, TRBDF2());
sol_bertolazzi_MPE = solve(prob_pds_bertolazzi, MPE(), dt = 0.01);

# plot
# plot
plot(sol_bertolazzi, legend = :right)
myplot!(sol_bertolazzi_MPE, "MPE")
ylims!((-0.5, 3.5))
plot!(sol_bertolazzi_MPE, idxs = (f3, 0, 1, 2, 3))

# convergence order
# convergence order
test_setup = Dict(:alg => Rosenbrock23(), :reltol => 1e-8, :abstol => 1e-8)
convergence_tab_plot(prob_pds_bertolazzi, [MPE(), ImplicitEuler()], test_setup;
dts = 0.5 .^ (10:15), order_plot = true)
Expand All @@ -123,16 +128,16 @@ myplot!(sol_npzd_MPE, "MPE")
plot!(sol_npzd_MPE, idxs = (f_npzd, 0, 1, 2, 3, 4), label = "f_npzd")
plot!(legend = :bottomright)

# convergence order
# error should take all time steps into account, not only the final time!
# convergence order
# error should take all time steps into account, not only the final time!
test_setup = Dict(:alg => Rosenbrock23(), :reltol => 1e-14, :abstol => 1e-14)
convergence_tab_plot(prob_pds_npzd, [MPE(), ImplicitEuler()], test_setup;
dts = 0.5 .^ (5:17), order_plot = true)
sims = convergence_tab_plot(prob_pds_npzd, [MPE(), ImplicitEuler()], test_setup;
dts = 0.5 .^ (5:17), order_plot = true);
@assert sims[1].𝒪est[:l∞] > 0.9

### strat reac problem ####################################################
### stratospheric reaction problem ####################################################
sol_stratreac = solve(prob_pds_stratreac, TRBDF2(autodiff = false));
#sol_stratreac_MPE = solve(prob_pds_stratreac, MPE(), dt = 25920.0);
#tmp = reduce(hcat, sol_stratreac_MPE.u)
# currently no solver for non-conservative PDS implemented

tspan = prob_pds_stratreac.tspan
u0 = prob_pds_stratreac.u0
Expand Down Expand Up @@ -171,12 +176,7 @@ ylims!((1.08e9, 1.1e9))

p7 = plot(sol_stratreac, idxs = (g1, 0, 1, 2, 3, 4, 5, 6), xticks = [tspan[1], tspan[2]],
legend = :outertop)
#plot!(sol_stratreac_MPE.t,
# vec(mapslices((x) -> abs(x[1] + x[2] + 3 * x[3] + 2 * x[4] + x[5] + 2 * x[6] - linear_invariant_1) /
# linear_invariant_1, tmp, dims = 1)))
p8 = plot(sol_stratreac, idxs = (g2, 0, 1, 2, 3, 4, 5, 6),
xticks = [tspan[1], tspan[2]], legend = :outertop)
#plot!(sol_stratreac_MPE.t,
# vec(mapslices((x) -> abs(x[5] + x[6] - linear_invariant_2) / linear_invariant_2, tmp,
# dims = 1)))

plot(p1, p2, p3, p4, p5, p6, p7, p8)
3 changes: 3 additions & 0 deletions examples/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
PositiveIntegrators = "d1b20bf0-b083-4985-a874-dc5121669aa5"
PrettyTables = "08abe8d2-0d0c-5749-adfa-8a2ac140af0d"
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
SymbolicIndexingInterface = "2efcf032-c050-4f8e-a9bb-153293bab1f5"

[compat]
Expand All @@ -17,3 +18,5 @@ LinearSolve = "2"
OrdinaryDiffEq = "6"
Plots = "1"
PrettyTables = "2"
StaticArrays = "1.5"
SymbolicIndexingInterface = "0.2, 0.3"
Loading

0 comments on commit f8549b8

Please sign in to comment.