Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make examples runnable #2464

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
6 changes: 5 additions & 1 deletion .github/workflows/Documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@ jobs:
Pkg.develop(map(path ->Pkg.PackageSpec.(;path="$(@__DIR__)/lib/$(path)"), readdir("./lib")));
'
- name: Install dependencies
run: julia --project=docs/ -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate()'
run: julia --project=docs/ -e '
using Pkg;
Pkg.develop(PackageSpec(path=pwd()));
Pkg.develop(map(path ->Pkg.PackageSpec.(;path="$(@__DIR__)/lib/$(path)"), readdir("./lib")));
Pkg.instantiate()'
- name: Build and deploy
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # For authentication with GitHub Actions token
Expand Down
30 changes: 30 additions & 0 deletions docs/Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,36 @@
[deps]
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed"
OrdinaryDiffEqAdamsBashforthMoulton = "89bda076-bce5-4f1c-845f-551c83cdda9a"
OrdinaryDiffEqBDF = "6ad6398a-0878-4a85-9266-38940aa047c8"
OrdinaryDiffEqCore = "bbf590c4-e513-4bbe-9b18-05decba2e5d8"
OrdinaryDiffEqDefault = "50262376-6c5a-4cf5-baba-aaf4f84d72d7"
OrdinaryDiffEqDifferentiation = "4302a76b-040a-498a-8c04-15b101fed76b"
OrdinaryDiffEqExplicitRK = "9286f039-9fbf-40e8-bf65-aa933bdc4db0"
OrdinaryDiffEqExponentialRK = "e0540318-69ee-4070-8777-9e2de6de23de"
OrdinaryDiffEqExtrapolation = "becaefa8-8ca2-5cf9-886d-c06f3d2bd2c4"
OrdinaryDiffEqFIRK = "5960d6e9-dd7a-4743-88e7-cf307b64f125"
OrdinaryDiffEqFeagin = "101fe9f7-ebb6-4678-b671-3a81e7194747"
OrdinaryDiffEqFunctionMap = "d3585ca7-f5d3-4ba6-8057-292ed1abd90f"
OrdinaryDiffEqHighOrderRK = "d28bc4f8-55e1-4f49-af69-84c1a99f0f58"
OrdinaryDiffEqIMEXMultistep = "9f002381-b378-40b7-97a6-27a27c83f129"
OrdinaryDiffEqLinear = "521117fe-8c41-49f8-b3b6-30780b3f0fb5"
OrdinaryDiffEqLowOrderRK = "1344f307-1e59-4825-a18e-ace9aa3fa4c6"
OrdinaryDiffEqLowStorageRK = "b0944070-b475-4768-8dec-fb6eb410534d"
OrdinaryDiffEqNonlinearSolve = "127b3ac7-2247-4354-8eb6-78cf4e7c58e8"
OrdinaryDiffEqNordsieck = "c9986a66-5c92-4813-8696-a7ec84c806c8"
OrdinaryDiffEqPDIRK = "5dd0a6cf-3d4b-4314-aa06-06d4e299bc89"
OrdinaryDiffEqPRK = "5b33eab2-c0f1-4480-b2c3-94bc1e80bda1"
OrdinaryDiffEqQPRK = "04162be5-8125-4266-98ed-640baecc6514"
OrdinaryDiffEqRKN = "af6ede74-add8-4cfd-b1df-9a4dbb109d7a"
OrdinaryDiffEqRosenbrock = "43230ef6-c299-4910-a778-202eb28ce4ce"
OrdinaryDiffEqSDIRK = "2d112036-d095-4a1e-ab9a-08536f3ecdbf"
OrdinaryDiffEqSSPRK = "669c94d9-1f4b-4b64-b377-1aa079aa2388"
OrdinaryDiffEqStabilizedIRK = "e3e12d00-db14-5390-b879-ac3dd2ef6296"
OrdinaryDiffEqStabilizedRK = "358294b1-0aab-51c3-aafe-ad5ab194a2ad"
OrdinaryDiffEqSymplecticRK = "fa646aed-7ef9-47eb-84c4-9443fc8cbfa8"
OrdinaryDiffEqTsit5 = "b1df2697-797e-41e3-8120-5422d3b24e4a"
OrdinaryDiffEqVerner = "79d7bb75-1356-48c1-b8c0-6832512096c2"

[compat]
Documenter = "0.27, 1"
Expand Down
80 changes: 66 additions & 14 deletions docs/common_first_steps.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,25 @@
using Markdown
function first_steps(name, solver)
Markdown.parse("""## Installation
function first_steps(name, solver; fixed_timesteps = false)
sym_name = Symbol(name)
sym_solver = Symbol(solver)
@eval begin
using $sym_name
function lorenz!(du, u, p, t)
du[1] = 10.0 * (u[2] - u[1])
du[2] = u[1] * (28.0 - u[3]) - u[2]
du[3] = u[1] * u[2] - (8 / 3) * u[3]
end
u0 = [1.0; 0.0; 0.0]
tspan = (0.0, 100.0)
prob = ODEProblem(lorenz!, u0, tspan)
if !($fixed_timesteps)
sol = solve(prob, ($sym_solver)())
else
sol = solve(prob, ($sym_solver)(), dt = 1/100)
end
sol_end = sol[end]
end
installation = """## Installation
To be able to access the solvers in `$name`, you must first install them use the Julia package manager:

```julia
Expand All @@ -10,20 +29,53 @@ function first_steps(name, solver)
This will only install the solvers listed at the bottom of this page.
If you want to explore other solvers for your problem,
you will need to install some of the other libraries listed in the navigation bar on the left.
"""
example = if !fixed_timesteps
"""

## Example usage
## Example usage

```julia
using $name
```julia
using $name

function lorenz!(du, u, p, t)
du[1] = 10.0 * (u[2] - u[1])
u[2] = u[1] * (28.0 - u[3]) - u[2]
du[3] = u[1] * u[2] - (8 / 3) * u[3]
function lorenz!(du, u, p, t)
du[1] = 10.0 * (u[2] - u[1])
du[2] = u[1] * (28.0 - u[3]) - u[2]
du[3] = u[1] * u[2] - (8 / 3) * u[3]
end
u0 = [1.0; 0.0; 0.0]
tspan = (0.0, 100.0)
prob = ODEProblem(lorenz!, u0, tspan)
sol = solve(prob, $solver())
sol[end]
```
```julia
$sol_end
```
"""
else
"""

## Example usage

```julia
using $name

function lorenz!(du, u, p, t)
du[1] = 10.0 * (u[2] - u[1])
du[2] = u[1] * (28.0 - u[3]) - u[2]
du[3] = u[1] * u[2] - (8 / 3) * u[3]
end
u0 = [1.0; 0.0; 0.0]
tspan = (0.0, 100.0)
prob = ODEProblem(lorenz!, u0, tspan)
sol = solve(prob, $solver(), dt=1/100)
sol[end]
```
```julia
$sol_end
```
"""
end
u0 = [1.0; 0.0; 0.0]
tspan = (0.0, 100.0)
prob = ODEProblem(lorenz!, u0, tspan)
sol = solve(prob, $solver())
```""")
Markdown.parse(installation*example)
end
2 changes: 1 addition & 1 deletion docs/src/explicit/LowStorageRK.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ are generally only recommended in situations which are RAM bound, like large-sca

```@eval
first_steps = evalfile("./common_first_steps.jl")
first_steps("OrdinaryDiffEqLowStorageRK", "CarpenterKennedy2N54")
first_steps("OrdinaryDiffEqLowStorageRK", "CKLLSRK43_2")
```

## Full list of solvers
Expand Down
2 changes: 1 addition & 1 deletion docs/src/explicit/PRK.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Explicit solvers optimized for a certain number of parallel calls of the system

```@eval
first_steps = evalfile("./common_first_steps.jl")
first_steps("OrdinaryDiffEqPRK", "KuttaPRK2p5")
first_steps("OrdinaryDiffEqPRK", "KuttaPRK2p5", fixed_timesteps = true)
```

## Full list of solvers
Expand Down
2 changes: 1 addition & 1 deletion docs/src/explicit/SSPRK.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Note that for SSPRK methods, a algorithm utility `OrdinaryDiffEqCore.ssp_coeffic

```@eval
first_steps = evalfile("./common_first_steps.jl")
first_steps("OrdinaryDiffEqSSPRK", "SSPRK22")
first_steps("OrdinaryDiffEqSSPRK", "SSPRK432")
```

## Full list of solvers
Expand Down
2 changes: 1 addition & 1 deletion docs/src/implicit/PDIRK.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ which is why these are the parallel DIRK methods.

```@eval
first_steps = evalfile("./common_first_steps.jl")
first_steps("OrdinaryDiffEqPDIRK", "PDIRK44")
first_steps("OrdinaryDiffEqPDIRK", "PDIRK44", fixed_timesteps = true)
```

## Full list of solvers
Expand Down
2 changes: 1 addition & 1 deletion docs/src/implicit/SDIRK.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ This article is a stub.

```@eval
first_steps = evalfile("./common_first_steps.jl")
first_steps("OrdinaryDiffEqSDIRK", "PDIRK44")
first_steps("OrdinaryDiffEqSDIRK", "KenCarp3")
```

## Full list of solvers
Expand Down
2 changes: 1 addition & 1 deletion docs/src/semiimplicit/ExponentialRK.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ you will need to install some of the other libraries listed in the navigation ba

```@eval
first_steps = evalfile("./common_first_steps.jl")
first_steps("OrdinaryDiffEqExponentialRK", "EPIRK5s3")
first_steps("OrdinaryDiffEqExponentialRK", "Exprb43", fixed_timesteps = true)
```

## Full list of solvers
Expand Down
Loading