Advectra is a Two-Dimensional Bi-Spectral Advection Diffusion Solver written in Julia. The code solves generic partial differential-equations (PDEs) of the form:
where
The package attempts to make solving the differential equations in spectral space as
trivial as possible through the use of SpectralOperators so that the user does not
need to translate the equations to their spectral counterpart themselves. In addition,
the package support solving multiple nested PDEs simultanously. While the code is
specialized towards solving plasma fluid equations, it is also well suited for generic
advection diffusion problems.
The code features:
- A bi-periodic
Domain SpectralOperatorsto compute spatial derivatives in spectral space- Mixed Stiffly-Stable (
MSS) time integrators; up to third order HDF5data output for binary format storage withBlosccompression- Pseudospectral methods for non-linear terms using FFTs (
FFTW) - 2/3-
dealiasingoff quadratic terms and non-linear functions Diagnostic's for sampling at high frequencies with minimal storage- GPU support (
CUDA,AMD) - Easy construction of canonical
initial conditionsfor PDEs - Option to
remove modesof interest
Advectra.jl will soon be installable through the Julia package manager. From the Julia REPL,
type ] to enter the Pkg REPL mode and run:
pkg> add Advectra
Or, equivalently, via the Pkg API:
julia> import Pkg; Pkg.add("Advectra")Say you want to evolve the following system of coupled partial differential-equations (model from Garcia et al.):
where
The diffusive terms lead to the following Linear operator:
function Linear(du, u, operators, p, t)
@unpack ν, μ = p
n, Ω = eachslice(u; dims=3)
dn, dΩ = eachslice(du; dims=3)
@unpack laplacian = operators
dn .= ν .* laplacian(n)
dΩ .= μ .* laplacian(Ω)
endwhere most of the function is just unpacking, while the actual computations happen at the
last two lines. To compute the Laplacian operator (laplacian method for each field. Note the use of broadcasting for writing in-place.
Similarly, the advective terms lead to the following NonLinear operator:
function NonLinear(du, u, operators, p, t)
n, Ω = eachslice(u; dims=3)
dn, dΩ = eachslice(du; dims=3)
@unpack diff_y, poisson_bracket, solve_phi = operators
ϕ = solve_phi(n, Ω)
dn .= poisson_bracket(n, ϕ)
dΩ .= poisson_bracket(Ω, ϕ) - diff_y(n)
endwhich is a bit more complicated, as the laplacian has to be inversed using the solve_phi
method. Other than that the derivative in y is computed using diff_y and the Poisson
bracket is computed using the poisson_bracketmethod.
The right hand sides needs to be collected in a SpectralODEProblem:
prob = SpectralODEProblem(Linear, NonLinear, u0, domain, time_span; p=parameters, dt=2.5e-3, diagnostics=diagnostics)alongside the initial state u0, the simulation Domain, the time_span to integrate
over, the parameters of the system and a Vector of Diagnostics to be performed.
To solve the system, use the following method:
sol = spectral_solve(prob, MSS3(), output;)where MMS3 is the time integration scheme and output is a constructed Output.
See the example file for more details.
Advectra.jl attempts to supports the use of all AbstractArray types, but can only confirm
that the following third-party types are supported:
CuArray(CUDA.jl)ROCArray(AMDGPU.jl)ComponentArrays(ComponentArrays.jl)
See the documentation for how to use these Array types.
In addition the code supports the sending of mails throught the SMTPClient extension:
send_mail(subject::AbstractString; attachment=""),
which is enabled by including the package
using SMTPClientIssues and contributions through pull requests are welcome. Please consult the contributor guide before submitting a pull request.
If you use Advectra.jl in your research, teaching, or other activities, please cite this repository using the following:
@software{Advectra,
author = {Johannes Mørkrid and contributors},
title = {Advectra},
year = {2026},
url = {https://github.com/JohannesMorkrid/Advectra.jl},
version = {0.1.0},
license = {MIT},
note = {GitHub repository},
}Copyright (c) 2026 Johannes Mørkrid (johannes.e.morkrid@uit.no) and contributors for Advectra.jl
Software licensed under the MIT License.
