Skip to content

Commit 1853c7f

Browse files
MarcoArtianovchuravyranocha
authored
Add Rosenbrock (#31)
Co-authored-by: Valentin Churavy <[email protected]> Co-authored-by: Hendrik Ranocha <[email protected]>
1 parent a7d2dc3 commit 1853c7f

File tree

10 files changed

+522
-57
lines changed

10 files changed

+522
-57
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
**/Manifest.toml
2+
**/*.h5

.pre-commit-config.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
repos:
22
- repo: https://github.com/fredrikekre/runic-pre-commit
3-
rev: v1.0.0
3+
rev: v2.0.1
44
hooks:
55
- id: runic
6+
additional_dependencies:
7+

examples/Project.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ Ariadne = "0be81120-40bf-4f8b-adf0-26103efb66f1"
33
CairoMakie = "13f3f980-e62b-5c42-98c6-ff1f3baf88f0"
44
DifferentiationInterface = "a0c0ee7d-e4b9-4e03-894e-1c5f64a51d63"
55
Enzyme = "7da242da-08ed-463a-9acd-ee780be4f1d9"
6-
Theseus = "7f538e44-2768-4ef2-af90-2110c0378286"
76
KernelAbstractions = "63c18a36-062a-441e-b654-da1e3ab1ce7c"
87
Krylov = "ba0b0d4f-ebba-5204-a429-3ac8c609bfb7"
98
KrylovPreconditioners = "45d422c2-293f-44ce-8315-2cb988662dec"
@@ -15,12 +14,13 @@ OrdinaryDiffEqSDIRK = "2d112036-d095-4a1e-ab9a-08536f3ecdbf"
1514
OrdinaryDiffEqSSPRK = "669c94d9-1f4b-4b64-b377-1aa079aa2388"
1615
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
1716
SummationByPartsOperators = "9f78cca6-572e-554e-b819-917d2f1cf240"
17+
Theseus = "7f538e44-2768-4ef2-af90-2110c0378286"
1818
Trixi = "a7f1ee26-1774-49b1-8366-f1abc58fbfcb"
1919

2020
[sources]
2121
Ariadne = {path = ".."}
2222
Theseus = {path = "../libs/Theseus"}
2323

2424
[compat]
25-
julia = "1.10"
2625
Trixi = "0.13.1"
26+
julia = "1.10"

examples/trixi_rosenbrock.jl

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# # Using a linearly implicit Rosenbrock solver based on Ariadne with Trixi.jl
2+
3+
using Trixi
4+
using Theseus
5+
using CairoMakie
6+
7+
# Notes:
8+
# You must disable both Polyester and LoopVectorization for Enzyme to be able to differentiate Trixi.jl.
9+
#
10+
# LocalPreferences.jl
11+
# ```toml
12+
# [Trixi]
13+
# loop_vectorization = false
14+
# backend = "static"
15+
# ```
16+
17+
@assert Trixi._PREFERENCE_THREADING !== :polyester
18+
@assert !Trixi._PREFERENCE_LOOPVECTORIZATION
19+
20+
trixi_include(@__MODULE__, joinpath(examples_dir(), "tree_2d_dgsem", "elixir_advection_basic.jl"), cfl = 10.0, sol = nothing);
21+
22+
###############################################################################
23+
# run the simulation
24+
25+
sol = solve(
26+
ode, Theseus.SSPKnoth();
27+
dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
28+
ode_default_options()..., callback = callbacks,
29+
# verbose=1,
30+
krylov_algo = :gmres,
31+
);
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# # Using a linearly implicit Rosenbrock solver based on Ariadne with Trixi.jl
2+
3+
using Trixi
4+
using Theseus
5+
using CairoMakie
6+
7+
# Notes:
8+
# You must disable both Polyester and LoopVectorization for Enzyme to be able to differentiate Trixi.jl.
9+
#
10+
# LocalPreferences.jl
11+
# ```toml
12+
# [Trixi]
13+
# loop_vectorization = false
14+
# backend = "static"
15+
# ```
16+
17+
@assert Trixi._PREFERENCE_THREADING !== :polyester
18+
@assert !Trixi._PREFERENCE_LOOPVECTORIZATION
19+
20+
trixi_include(@__MODULE__, joinpath(examples_dir(), "tree_2d_dgsem", "elixir_euler_blast_wave.jl"), cfl = 1.0, sol = nothing);
21+
22+
###############################################################################
23+
# run the simulation
24+
25+
sol = solve(
26+
ode, Theseus.ROS2();
27+
dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
28+
ode_default_options()..., callback = callbacks,
29+
# verbose=1,
30+
krylov_algo = :gmres,
31+
assume_p_const = false,
32+
);
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# # Using a linearly implicit Rosenbrock solver based on Ariadne with Trixi.jl
2+
3+
using Trixi
4+
using Theseus
5+
using CairoMakie
6+
7+
# Notes:
8+
# You must disable both Polyester and LoopVectorization for Enzyme to be able to differentiate Trixi.jl.
9+
#
10+
# LocalPreferences.jl
11+
# ```toml
12+
# [Trixi]
13+
# loop_vectorization = false
14+
# backend = "static"
15+
# ```
16+
17+
@assert Trixi._PREFERENCE_THREADING !== :polyester
18+
@assert !Trixi._PREFERENCE_LOOPVECTORIZATION
19+
20+
trixi_include(@__MODULE__, joinpath(examples_dir(), "tree_2d_dgsem", "elixir_euler_warm_bubble.jl"), cfl = 1.0, sol = nothing);
21+
22+
###############################################################################
23+
# run the simulation
24+
25+
sol = solve(
26+
ode, Theseus.ROS2();
27+
dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
28+
ode_default_options()..., callback = callbacks,
29+
# verbose=1,
30+
krylov_algo = :gmres,
31+
assume_p_const = false,
32+
);

libs/Theseus/Project.toml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,20 @@ authors = ["Valentin Churavy <[email protected]>"]
44
version = "0.1.0"
55

66
[deps]
7-
DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e"
87
Ariadne = "0be81120-40bf-4f8b-adf0-26103efb66f1"
8+
DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e"
9+
Krylov = "ba0b0d4f-ebba-5204-a429-3ac8c609bfb7"
10+
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
911
SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462"
1012
UnPack = "3a884ed6-31ef-47d7-9d2a-63182c4928ed"
1113

1214
[sources]
1315
Ariadne = {path = "../.."}
1416

1517
[compat]
16-
DiffEqBase = "6.174.0"
1718
Ariadne = "0.1.0"
19+
DiffEqBase = "6.174.0"
20+
Krylov = "0.10.1"
21+
LinearAlgebra = "1"
1822
SciMLBase = "2.91.0"
1923
UnPack = "1.0.2"

0 commit comments

Comments
 (0)