PETScDiffEq.jl
PETScDiffEq.jl contains bindings for the PETSc TS time integrators to allow them to be used with the SciML common interface. PETSc's linear and nonlinear solvers are already reachable from SciML through LinearSolve.jl and NonlinearSolve.jl; this package covers the third layer, TS.
Installation
using Pkg
Pkg.add("PETScDiffEq")Precompiling the package runs a few small solves through PETSc, so that the first solve of a session compiles much less. To precompile without them:
using PETScDiffEq, Preferences
set_preferences!(PETScDiffEq, "precompile_workload" => false; force = true)Precompiling under mpiexec or srun skips these solves, and later sessions reuse that build until the package or one of its dependencies changes, so load the package once without the launcher before the first parallel run.
Common API Usage
This library adds the common interface to PETSc's TS solvers, documented in the DifferentialEquations.jl documentation. Following the Lorenz example from the ODE tutorial:
using PETScDiffEq, SciMLBase
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 = SciMLBase.ODEProblem(lorenz, u0, tspan)
sol = SciMLBase.solve(prob, TSRK("5dp"); dt = 0.01, abstol = 1e-8, reltol = 1e-8)dt sets the first step. An adaptive solve can leave it out, and the first step is then Hairer and Wanner's estimate as OrdinaryDiffEq uses it, taken with the abstol and reltol keywords (SciML's defaults, abstol = 1e-6 and reltol = 1e-3, when not given). DAE and mass-matrix problems start from a small step instead. A solve PETSc steps at a fixed size needs dt: adaptive = false, -ts_adapt_type none, the fixed-step families (TSImplicit and TSDAE other than bdf, TSIRK, TSMPRK), and subtypes registered without an embedded error estimate. What counts is the type PETSc runs after petsc_options: TSImplicit("beuler", ["-ts_type", "bdf"]) runs without dt and TSImplicit("bdf", ["-ts_type", "beuler"]) needs it. A TSGeneric naming a type no other constructor covers needs it too, since whether that type adapts is not known here.
Reproducibility
The documentation of this SciML package was built using these direct dependencies,
Status `~/work/PETScDiffEq.jl/PETScDiffEq.jl/docs/Project.toml`
[e30172f5] Documenter v1.19.0
[0a65194f] PETScDiffEq v0.9.9 `~/work/PETScDiffEq.jl/PETScDiffEq.jl`and using this machine and Julia version.
Julia Version 1.13.1
Commit 96ca370cf0e (2026-09-25 19:34 UTC)
Build Info:
Official https://julialang.org release
Platform Info:
OS: Linux (x86_64-linux-gnu)
CPU: 4 × AMD EPYC 7763 64-Core Processor
WORD_SIZE: 64
LLVM: libLLVM-20.1.8 (ORCJIT, znver3)
GC: Built with stock GC
Threads: 1 default, 1 interactive, 1 GC (on 4 virtual cores)A more complete overview of all dependencies and their versions is also provided.
Status `~/work/PETScDiffEq.jl/PETScDiffEq.jl/docs/Manifest.toml`
[47edcb42] ADTypes v1.24.0
[a4c015fc] ANSIColoredPrinters v0.0.1
[1520ce14] AbstractTrees v0.4.5
[7d9f7c33] Accessors v0.1.45
[79e6a3ab] Adapt v4.7.1
[4fba245c] ArrayInterface v7.30.2
[70df07ce] BracketingNonlinearSolve v1.12.8
[944b1d66] CodecZlib v0.7.9
[38540f10] CommonSolve v0.2.14
[bbf7d656] CommonSubexpressions v0.3.1
[34da2185] Compat v4.18.1
[a33af91c] CompositionsBase v0.1.2
[2569d6c7] ConcreteStructs v0.2.8
[187b0558] ConstructionBase v1.6.0
[a8cc5b0e] Crayons v4.2.0
[9a962f9c] DataAPI v1.16.0
[e2d170a0] DataValueInterfaces v1.0.0
[2b5f629d] DiffEqBase v7.21.3
[163ba53b] DiffResults v1.1.0
[b552c78f] DiffRules v1.16.0
[a0c0ee7d] DifferentiationInterface v0.7.21
[ffbed154] DocStringExtensions v0.9.5
[e30172f5] Documenter v1.19.0
[4e289a0a] EnumX v1.0.7
[f151be2c] EnzymeCore v0.8.21
[e2ba6199] ExprTools v0.1.11
[7034ab61] FastBroadcast v1.4.0
[9aa1b823] FastClosures v0.3.2
[a4df4552] FastPower v1.5.0
[64ca27bc] FindFirstFunctions v3.4.0
[f6369f11] ForwardDiff v1.4.6
[069b7b12] FunctionWrappers v1.1.3
[77dc65aa] FunctionWrappersWrappers v1.13.0
[46192b85] GPUArraysCore v0.2.1
[d7ba0133] Git v1.5.0
[b5f81e59] IOCapture v1.0.0
[3587e190] InverseFunctions v0.1.17
[92d709cd] IrrationalConstants v0.2.6
[82899510] IteratorInterfaceExtensions v1.0.0
[692b3bcd] JLLWrappers v1.8.0
[682c06a0] JSON v1.10.0
[b964fa9f] LaTeXStrings v1.4.1
[0e77f7df] LazilyInitializedFields v1.3.0
[2ab3a3ac] LogExpFunctions v1.0.2
[e6f89c97] LoggingExtras v1.2.0
[da04e1cc] MPI v0.20.27
[3da0fdf6] MPIPreferences v0.1.12
[1914dd2f] MacroTools v0.5.16
[d0879d2d] MarkdownAST v0.1.3
[bb5d69b7] MaybeInplace v0.1.8
[46d2c3a1] MuladdMacro v0.2.7
[77ba4419] NaNMath v1.1.4
[be0214bd] NonlinearSolveBase v2.54.1
[6fe1bfb0] OffsetArrays v1.17.0
[bac558e1] OrderedCollections v2.0.1
[ace2c81b] PETSc v0.5.2
[0a65194f] PETScDiffEq v0.9.9 `~/work/PETScDiffEq.jl/PETScDiffEq.jl`
[69de0a69] Parsers v3.0.0
[eebad327] PkgVersion v0.3.3
[d236fae5] PreallocationTools v1.7.1
[aea7be01] PrecompileTools v1.3.4
[21216c6a] Preferences v1.6.0
[08abe8d2] PrettyTables v3.5.0
[3cdcf5f2] RecipesBase v1.4.0
[731186ca] RecursiveArrayTools v4.5.3
[189a3867] Reexport v1.2.2
[2792f1a3] RegistryInstances v0.1.0
[9fe22ead] RespecializeParams v1.3.0
[7e49a35a] RuntimeGeneratedFunctions v0.5.27
[0bca4576] SciMLBase v3.57.0
[19f34311] SciMLJacobianOperators v0.1.19
[a6db7da4] SciMLLogging v2.1.0
[c0aeaf25] SciMLOperators v1.30.2
[431bcebd] SciMLPublic v1.3.0
[53ae85a6] SciMLStructures v1.10.5
[efcf1570] Setfield v1.1.2
[0a514795] SparseMatrixColorings v0.4.28
[276daf66] SpecialFunctions v2.9.0
[1e83bf80] StaticArraysCore v1.4.4
[10745b16] Statistics v1.11.5
[892a3eda] StringManipulation v0.6.1
[ec057cc2] StructUtils v2.9.2
[2efcf032] SymbolicIndexingInterface v0.3.55
[3783bdb8] TableTraits v1.0.1
[bd369af6] Tables v1.14.0
[a759f4b9] TimerOutputs v1.2.2
[3bb67fe8] TranscodingStreams v0.11.3
[781d530d] TruncatedStacktraces v1.4.0
[6e34b625] Bzip2_jll v1.0.9+0
[2e619515] Expat_jll v2.8.4+0
[020c3dae] Git_LFS_jll v3.7.1+0
[f8c6e375] Git_jll v2.56.0+0
[0234f1f7] HDF5_jll v2.2.2+0
[5bee2580] HYPRE64_jll v3.1.0+3
[0a602bbd] HYPRE_jll v3.1.2+0
[e33a78d0] Hwloc_jll v2.14.1+0
[1d63c593] LLVMOpenMP_jll v23.1.1+0
[94ce4f54] Libiconv_jll v1.18.0+0
[d00139f3] METIS_jll v5.1.4+0
[b5ada748] MPIABI_jll v1.0.1+0
[7cb0a576] MPICH_jll v5.0.2+0
[f1f71cc9] MPItrampoline_jll v5.5.6+0
[ca64183c] MUMPS_jll v5.9.4+0
[9237b28f] MicrosoftMPI_jll v10.1.4+3
[656ef2d0] OpenBLAS32_jll v0.3.34+0
[fe0851c0] OpenMPI_jll v5.0.12+0
[9bd350c2] OpenSSH_jll v10.5.1+0
[efe28fd5] OpenSpecFun_jll v0.5.6+0
[b247a4be] PARMETIS_jll v4.0.9+0
[8fa3689e] PETSc_jll v3.25.4+0
[aabda75e] SCALAPACK32_jll v2.2.302+0
[a8d0f55d] SCOTCH_jll v7.0.11+0
[9a1356b0] SuperLU_DIST_jll v9.2.3+0
[b47fdcd6] TetGen_jll v1.6.1+0
[5639c1d2] Triangle_jll v1.6.3+2
[02c8fc9c] XML2_jll v2.15.4+0
[ffd25f8a] XZ_jll v5.8.4+0
[a65dc6b1] Xorg_libpciaccess_jll v0.19.0+0
⌅ [2b3700d1] aws_c_auth_jll v0.9.6+0
⌅ [70f11efc] aws_c_cal_jll v0.9.13+0
⌅ [73048d1d] aws_c_common_jll v0.12.6+0
⌅ [73a04cd5] aws_c_compression_jll v0.3.2+0
⌅ [3254fc65] aws_c_http_jll v0.10.15+0
⌅ [13c41daa] aws_c_io_jll v0.26.3+0
⌅ [bd1f34fb] aws_c_s3_jll v0.11.5+0
⌅ [1282aa60] aws_c_sdkutils_jll v0.2.4+1
⌅ [b2a88e68] aws_checksums_jll v0.2.10+0
[c4b69c83] dlfcn_win32_jll v1.4.2+0
[477f73a3] libaec_jll v1.1.7+0
[9aeb927a] mpif_jll v1.0.0+0
[cddc5d3d] s2n_tls_jll v1.7.10+0
[0dad84c5] ArgTools v1.1.2
[56f22d72] Artifacts v1.11.0
[2a0f44e3] Base64 v1.11.0
[ade2ca70] Dates v1.11.0
[8ba89e20] Distributed v1.11.0
[f43a241f] Downloads v1.7.0
[7b1f6079] FileWatching v1.11.0
[9fa8497b] Future v1.11.0
[b77e0a4c] InteractiveUtils v1.11.0
[ac6e5ff7] JuliaSyntaxHighlighting v1.12.0
[4af54fe1] LazyArtifacts v1.11.0
[b27032c2] LibCURL v1.0.0
[76f85450] LibGit2 v1.11.0
[8f399da3] Libdl v1.11.0
[37e2e46d] LinearAlgebra v1.13.0
[56ddb016] Logging v1.11.0
[d6f4376e] Markdown v1.11.0
[ca575930] NetworkOptions v1.3.0
[44cfe95a] Pkg v1.13.0
[de0858da] Printf v1.11.0
[3fa0cd96] REPL v1.11.0
[9a3f8284] Random v1.11.0
[ea8e919c] SHA v1.0.0
[9e88b42a] Serialization v1.11.0
[6462fe0b] Sockets v1.11.0
[2f01184e] SparseArrays v1.13.0
[f489334b] StyledStrings v1.11.0
[fa267f1f] TOML v1.0.3
[a4e569a6] Tar v1.10.0
[8dfed614] Test v1.11.0
[cf7118a7] UUIDs v1.11.0
[4ec0a83e] Unicode v1.11.0
[e66e0078] CompilerSupportLibraries_jll v1.5.5+2
[deac9b47] LibCURL_jll v8.18.0+1
[e37daf67] LibGit2_jll v1.9.1+0
[29816b5a] LibSSH2_jll v1.11.104+0
[14a3606d] MozillaCACerts_jll v2026.8.13
[4536629a] OpenBLAS_jll v0.3.30+0
[05823500] OpenLibm_jll v0.8.7+0
[458c3c95] OpenSSL_jll v3.5.6+0
[efcefdf7] PCRE2_jll v10.46.0+0
[bea87d4a] SuiteSparse_jll v7.10.1+0
[83775a58] Zlib_jll v1.3.1+2
[3161d3a3] Zstd_jll v1.5.7+1
[8e850b90] libblastrampoline_jll v5.15.0+0
[8e850ede] nghttp2_jll v1.67.1+0
[3f19e933] p7zip_jll v17.8.2+0
Info Packages marked with ⌅ have new versions available but compatibility constraints restrict them from upgrading. To see why use `status --outdated -m`