Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
3 changes: 2 additions & 1 deletion docs/src/examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,8 @@ Now we solve and plot the solution.
```julia
using OrdinaryDiffEq
using LinearSolve
sol = solve(prob, TRBDF2(linsolve = KLUFactorization()), saveat = 0.001)
sol = solve(prob, TRBDF2(linsolve = KLUFactorization()), saveat = 0.001,
abstol = 1.0e-10, reltol = 1.0e-8)

using CairoMakie
let t_range = LinRange(0.0, final_time, 250)
Expand Down
Binary file modified docs/src/figures/dirichlet_source_surface.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/src/figures/porous_surface.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/src/figures/robin_diffusion_surface.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/precompilation.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using PrecompileTools
using PrecompileTools: @setup_workload, @compile_workload

@setup_workload begin
# Minimal setup - these are lightweight and don't add much to precompilation time
Expand Down
1 change: 1 addition & 0 deletions test/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ MethodOfLines = "94925ecb-adb7-4558-8ed8-f975c56a0bf4"
ModelingToolkit = "961ee093-0014-501f-94e3-6117800e7a78"
NonlinearSolve = "8913a72c-1f9b-4ce2-8d82-65094dcecaec"
OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed"
OrdinaryDiffEqSDIRK = "2d112036-d095-4a1e-ab9a-08536f3ecdbf"
ReferenceTests = "324d217c-45ce-50fc-942e-d289b448e8cf"
SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f"
SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462"
Expand Down
8 changes: 6 additions & 2 deletions test/dirichlet_source.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ using ..FiniteVolumeMethod1D
using LinearAlgebra
using LinearSolve
using OrdinaryDiffEq
using OrdinaryDiffEqSDIRK
using CairoMakie
using ReferenceTests

Expand Down Expand Up @@ -32,8 +33,11 @@ prob = FVMProblem(
initial_condition,
final_time
)
sol = solve(prob, TRBDF2(linsolve = KLUFactorization()), saveat = 0.001)
exact_sol = [exact_u.(mesh_points, sol.t[i]) for i in eachindex(sol)]
sol = solve(
prob, TRBDF2(linsolve = KLUFactorization()),
saveat = 0.001, abstol = 1.0e-10, reltol = 1.0e-8
)
exact_sol = [exact_u.(mesh_points, sol.t[i]) for i in eachindex(sol.t)]
@test reduce(hcat, sol.u) ≈ reduce(hcat, exact_sol) rtol = 1.0e-1

let t_range = LinRange(0.0, final_time, 250)
Expand Down
1 change: 1 addition & 0 deletions test/fisher.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using ..FiniteVolumeMethod1D
using MethodOfLines
using OrdinaryDiffEq
using OrdinaryDiffEqSDIRK
using ReferenceTests
using CairoMakie
using ModelingToolkit
Expand Down
3 changes: 2 additions & 1 deletion test/heat.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using ..FiniteVolumeMethod1D
using OrdinaryDiffEq
using OrdinaryDiffEqSDIRK
using ReferenceTests
using CairoMakie
using LinearSolve
Expand Down Expand Up @@ -27,7 +28,7 @@ prob = FVMProblem(
)

sol = solve(prob, TRBDF2(linsolve = KLUFactorization()))
exact_sol = [exact2.(mesh_points, sol.t[i]) for i in eachindex(sol)]
exact_sol = [exact2.(mesh_points, sol.t[i]) for i in eachindex(sol.t)]
@test reduce(hcat, sol.u) ≈ reduce(hcat, exact_sol) rtol = 1.0e-2

let t_range = LinRange(0.0, final_time, 250)
Expand Down
9 changes: 5 additions & 4 deletions test/porous_medium.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using ..FiniteVolumeMethod1D
using OrdinaryDiffEq
using OrdinaryDiffEqSDIRK
using CairoMakie
using ReferenceTests
using SpecialFunctions
Expand Down Expand Up @@ -42,7 +43,7 @@ prob = FVMProblem(
reaction_function = (u, x, t, p) -> zero(u)
)
sol = solve(prob, TRBDF2(); saveat = saveat)
exact = [exact_solution.(mesh_points, sol.t[i]) for i in eachindex(sol)]
exact = [exact_solution.(mesh_points, sol.t[i]) for i in eachindex(sol.t)]
@test exact ≈ sol.u rtol = 1.0e-1

fig = Figure(size = (2150, 460), fontsize = 34)
Expand All @@ -51,14 +52,14 @@ ax = Axis(
titlealign = :left, width = 600, height = 300
)
colors = [:red, :black, :blue, :darkgreen, :magenta, :orange]
[lines!(ax, mesh_points, sol.u[i], color = colors[i]) for i in eachindex(sol)]
[lines!(ax, mesh_points, sol.u[i], color = colors[i]) for i in eachindex(sol.t)]
ylims!(ax, -1.0e-6, 5)
xlims!(ax, -1, 1)
ax = Axis(
fig[1, 2], xlabel = L"x", ylabel = L"u(x)", title = L"(b):$ $ Exact solution",
titlealign = :left, width = 600, height = 300
)
[lines!(ax, mesh_points, exact[i], color = colors[i]) for i in eachindex(sol)]
[lines!(ax, mesh_points, exact[i], color = colors[i]) for i in eachindex(sol.t)]
ylims!(ax, -1.0e-6, 5)
xlims!(ax, -1, 1)
ax = Axis(
Expand All @@ -67,7 +68,7 @@ ax = Axis(
)
[
lines!(ax, mesh_points, abs.(exact[i] .- sol.u[i]), color = colors[i])
for i in eachindex(sol)
for i in eachindex(sol.t)
]
ylims!(ax, -1.0e-6, 0.5)
xlims!(ax, -1, 1)
Expand Down
3 changes: 2 additions & 1 deletion test/robin_diffusion.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ using ..FiniteVolumeMethod1D
using LinearAlgebra
using LinearSolve
using OrdinaryDiffEq
using OrdinaryDiffEqSDIRK
using NonlinearSolve
using CairoMakie
using ReferenceTests
Expand Down Expand Up @@ -49,7 +50,7 @@ prob = FVMProblem(
sol = solve(prob, TRBDF2(linsolve = KLUFactorization()), saveat = 0.01)

μ = compute_μₙ.(1:100)
exact_sol = [exact_u.(mesh_points, sol.t[i], Ref(μ)) for i in eachindex(sol)]
exact_sol = [exact_u.(mesh_points, sol.t[i], Ref(μ)) for i in eachindex(sol.t)]
@test reduce(hcat, sol.u) ≈ reduce(hcat, exact_sol) rtol = 1.0e-2

let t_range = LinRange(0.0, final_time, 250)
Expand Down
Loading