-
Notifications
You must be signed in to change notification settings - Fork 135
(Linear) Matrix operator for efficient IMEX #2674
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
Open
DanielDoehring
wants to merge
105
commits into
trixi-framework:main
Choose a base branch
from
DanielDoehring:MatrixOperatorIMEX
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 45 commits
Commits
Show all changes
105 commits
Select commit
Hold shift + click to select a range
c364bc4
Use SciMLOperators for IMEX with linear part
DanielDoehring ebd5b2f
test
DanielDoehring 47dd6a2
bf
DanielDoehring 2b4678b
Merge branch 'main' into MatrixOperatorIMEX
DanielDoehring d467843
cp
DanielDoehring 9c3ba03
Merge branch 'MatrixOperatorIMEX' of github.com:DanielDoehring/Trixi.…
DanielDoehring cf59962
compat
DanielDoehring ecbf0d3
sciml base
DanielDoehring ac63659
cp
DanielDoehring 7fe1660
cp
DanielDoehring bac340c
cp
DanielDoehring 61d375f
revert
DanielDoehring 3ef1310
f
DanielDoehring be88afe
cp
DanielDoehring 83b2dad
cp
DanielDoehring 236c5f8
cp
DanielDoehring 9120892
cp
DanielDoehring 4db9379
cp
DanielDoehring 2ced411
cp
DanielDoehring 006eb6b
Apply suggestions from code review
DanielDoehring 885644f
Update test/Project.toml
DanielDoehring 3897d6c
restrict sciml compact bounds
DanielDoehring 376e451
relieve
DanielDoehring 5bfc670
v
DanielDoehring 66d8cfc
up
DanielDoehring 5da16ce
up
DanielDoehring 33748a3
up
DanielDoehring 585e95d
rev
DanielDoehring 042b1df
1
DanielDoehring 5e1c5e2
cp
DanielDoehring d41294f
add base explicitly
DanielDoehring ad10cfd
Update src/semidiscretization/semidiscretization_hyperbolic_parabolic.jl
DanielDoehring d5cf05c
rev
DanielDoehring 6646b37
rev
DanielDoehring d92804c
compat
DanielDoehring 02d6fb5
Merge branch 'MatrixOperatorIMEX' of github.com:DanielDoehring/Trixi.…
DanielDoehring 2c78429
Merge branch 'main' into MatrixOperatorIMEX
DanielDoehring b903d31
rm
DanielDoehring c3fe575
Merge branch 'MatrixOperatorIMEX' of github.com:DanielDoehring/Trixi.…
DanielDoehring 8917be3
rev
DanielDoehring 5f4d595
cp
DanielDoehring f391536
rev
DanielDoehring 5392ac1
cp
DanielDoehring 46123e1
up
DanielDoehring 68602a0
Update examples/tree_2d_dgsem/elixir_advection_diffusion_imex_operato…
DanielDoehring 6e0264b
Update examples/tree_2d_dgsem/elixir_advection_diffusion_imex_operato…
DanielDoehring dfbe22e
Merge branch 'main' into MatrixOperatorIMEX
DanielDoehring 4c10ef5
Merge branch 'main' into MatrixOperatorIMEX
DanielDoehring d01ac3f
Update test/Project.toml
DanielDoehring a73c0f1
Merge branch 'main' into MatrixOperatorIMEX
DanielDoehring 446f643
Merge branch 'main' into MatrixOperatorIMEX
DanielDoehring fb9c973
reduce changes
DanielDoehring 0c2229f
Merge branch 'MatrixOperatorIMEX' of github.com:DanielDoehring/Trixi.…
DanielDoehring 96360a3
try
DanielDoehring b0f1342
bump rat
DanielDoehring 462d5a8
bump
DanielDoehring 11fa94e
fix
DanielDoehring ed58b54
bump
DanielDoehring 24a2e43
sbp
DanielDoehring 46c74f4
cb
DanielDoehring 1171f1f
dg
DanielDoehring 6bbd558
hdf5
DanielDoehring 7be2b94
8
DanielDoehring b9765be
lv
DanielDoehring 69ce7c3
pref
DanielDoehring 94d5c16
up
DanielDoehring 7686ec5
up
DanielDoehring 814bcff
cm
DanielDoehring 107fa72
DS
DanielDoehring be86246
adt
DanielDoehring 6220f4b
static
DanielDoehring c03ff9b
mk
DanielDoehring d92bc16
ka
DanielDoehring 88ecc02
FA
DanielDoehring 60d5531
p
DanielDoehring 4787762
mpi
DanielDoehring 5e873ad
doc
DanielDoehring dc63b53
Update src/equations/equations_parabolic.jl
DanielDoehring 4a7b9ae
Merge branch 'main' into MatrixOperatorIMEX
DanielDoehring bee8a9b
Merge branch 'main' into MatrixOperatorIMEX
DanielDoehring 58fa6b4
Merge branch 'main' into MatrixOperatorIMEX
DanielDoehring 30859e0
Merge branch 'main' into MatrixOperatorIMEX
DanielDoehring 3da48f3
Update src/Trixi.jl
DanielDoehring 54e87f3
be precise
DanielDoehring 73fb5fa
rwrite
DanielDoehring afe59d1
adapt
DanielDoehring 00f525f
Update src/semidiscretization/semidiscretization_hyperbolic_parabolic.jl
DanielDoehring 439e8da
fmt
DanielDoehring e4dce4a
Merge branch 'MatrixOperatorIMEX' of https://github.com/DanielDoehrin…
DanielDoehring 4c7ca5e
Apply suggestions from code review
DanielDoehring 775db13
revert
DanielDoehring 9036f62
Merge branch 'MatrixOperatorIMEX' of https://github.com/DanielDoehrin…
DanielDoehring 5057d40
Update Project.toml
DanielDoehring 3d6bd2a
Update test/Project.toml
DanielDoehring 6f714e2
core
DanielDoehring 0a71bf4
Merge branch 'MatrixOperatorIMEX' of https://github.com/DanielDoehrin…
DanielDoehring 2d4e9a3
bump
DanielDoehring 0934c06
bump
DanielDoehring 34f904e
base
DanielDoehring b4eb001
bp
DanielDoehring 8251d4f
up
DanielDoehring d0ec119
bump
DanielDoehring 7afb8e3
try
DanielDoehring 7f9e250
bump
DanielDoehring a0b2027
fix
DanielDoehring File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 74 additions & 0 deletions
74
examples/tree_2d_dgsem/elixir_advection_diffusion_imex_operator.jl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| using OrdinaryDiffEqSDIRK | ||
| using SciMLBase, SciMLOperators, SparseArrays | ||
| using Trixi | ||
|
|
||
| ############################################################################### | ||
| # semidiscretization of the linear advection-diffusion equation | ||
|
|
||
| advection_velocity = (1.5, 1.0) | ||
| equations = LinearScalarAdvectionEquation2D(advection_velocity) | ||
| diffusivity() = 5.0e-1 | ||
| equations_parabolic = LaplaceDiffusion2D(diffusivity(), equations) | ||
|
|
||
| solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs) | ||
|
|
||
| coordinates_min = (-1.0, -1.0) | ||
| coordinates_max = (1.0, 1.0) | ||
|
|
||
| mesh = TreeMesh(coordinates_min, coordinates_max, | ||
| initial_refinement_level = 4, | ||
| periodicity = true, | ||
| n_cells_max = 30_000) | ||
|
|
||
| function initial_condition_diffusive_convergence_test(x, t, | ||
| equation::LinearScalarAdvectionEquation2D) | ||
| # Store translated coordinate for easy use of exact solution | ||
| RealT = eltype(x) | ||
| x_trans = x - equation.advection_velocity * t | ||
|
|
||
| nu = diffusivity() | ||
| c = 1 | ||
| A = 0.5f0 | ||
| L = 2 | ||
| f = 1.0f0 / L | ||
| omega = 2 * convert(RealT, pi) * f | ||
| scalar = c + A * sin(omega * sum(x_trans)) * exp(-2 * nu * omega^2 * t) | ||
| return SVector(scalar) | ||
| end | ||
| initial_condition = initial_condition_diffusive_convergence_test | ||
|
|
||
| semi = SemidiscretizationHyperbolicParabolic(mesh, | ||
| (equations, equations_parabolic), | ||
| initial_condition, solver) | ||
|
|
||
| ############################################################################### | ||
| # ODE setup | ||
|
|
||
| tspan = (0.0, 0.5) | ||
| ode = semidiscretize(semi, tspan) # For accessing the initial condition u0 only | ||
|
|
||
| D_map, _ = linear_structure_parabolic(semi) | ||
| # Cannot directly construct `MatrixOperator` from `LinearMap`, need detour via sparse matrix | ||
| opD = MatrixOperator(sparse(D_map)) | ||
|
|
||
| split_func = SplitFunction(opD, Trixi.rhs!) | ||
DanielDoehring marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| ode_operator = SplitODEProblem{true}(split_func, ode.u0, tspan, semi) | ||
|
|
||
| ############################################################################### | ||
| # Callbacks | ||
|
|
||
| summary_callback = SummaryCallback() | ||
|
|
||
| analysis_interval = 1000 | ||
| analysis_callback = AnalysisCallback(semi, interval = analysis_interval) | ||
|
|
||
| alive_callback = AliveCallback(analysis_interval = analysis_interval) | ||
|
|
||
| callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback) | ||
|
|
||
| ############################################################################### | ||
| # run the simulation | ||
|
|
||
| sol = solve(ode_operator, KenCarp4(); | ||
| adaptive = false, dt = 1e-2, | ||
| ode_default_options()..., callback = callbacks) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.