Skip to content

Boundary value problem (BVP) solvers for scientific machine learning (SciML)

License

Notifications You must be signed in to change notification settings

JuDO-dev/BoundaryValueDiffEq.jl

 
 

Repository files navigation

BoundaryValueDiffEq

Join the chat at https://julialang.zulipchat.com #sciml-bridged Global Docs

Build Status codecov Package Downloads Aqua QA

ColPrac: Contributor's Guide on Collaborative Practices for Community Packages SciML Code Style

BoundaryValueDiffEq.jl is a component package in the DifferentialEquations ecosystem. It holds the boundary value problem solvers and utilities. While completely independent and usable on its own, users interested in using this functionality should check out DifferentialEquations.jl.

API

BoundaryValueDiffEq.jl is part of the JuliaDiffEq common interface, but can be used independently of DifferentialEquations.jl. The only requirement is that the user passes a BoundaryValueDiffEq.jl algorithm to solve. For example, we can solve the BVP tutorial from the documentation using the MIRK4() algorithm:

using BoundaryValueDiffEq
tspan = (0.0, pi / 2)
function simplependulum!(du, u, p, t)
    θ = u[1]
    dθ = u[2]
    du[1] = dθ
    du[2] = -9.81 * sin(θ)
end
function bc!(residual, u, p, t)
    residual[1] = u[end ÷ 2][1] + pi / 2
    residual[2] = u[end][1] - pi / 2
end
prob = BVProblem(simplependulum!, bc!, [pi / 2, pi / 2], tspan)
sol = solve(prob, MIRK4(), dt = 0.05)

Available Solvers

For the list of available solvers, please refer to the DifferentialEquations.jl BVP Solvers page. For options for the solve command, see the common solver options page.

Controlling Precompilation

Precompilation can be controlled via Preferences.jl

  • PrecompileMIRK -- Precompile the MIRK2 - MIRK6 algorithms (default: true).
  • PrecompileShooting -- Precompile the single shooting algorithms (default: false). This is triggered when OrdinaryDiffEq is loaded.
  • PrecompileMultipleShooting -- Precompile the multiple shooting algorithms (default: false). This is triggered when OrdinaryDiffEq is loaded.
  • PrecompileMIRKNLLS -- Precompile the MIRK2 - MIRK6 algorithms for under-determined and over-determined BVPs (default: false).
  • PrecompileShootingNLLS -- Precompile the single shooting algorithms for under-determined and over-determined BVPs (default: false). This is triggered when OrdinaryDiffEq is loaded.
  • PrecompileMultipleShootingNLLS -- Precompile the multiple shooting algorithms for under-determined and over-determined BVPs (default: false ). This is triggered when OrdinaryDiffEq is loaded.

To set these preferences before loading the package, do the following (replacing PrecompileShooting with the preference you want to set, or pass in multiple pairs to set them together):

using Preferences, UUIDs
Preferences.set_preferences!(UUID("764a87c0-6b3e-53db-9096-fe964310641d"),
    "PrecompileShooting" => false)

Running Benchmarks Locally

We include a small set of benchmarks in the benchmarks folder. These are not extensive and mainly used to track regressions during development. For more extensive benchmarks, see the SciMLBenchmarks repository.

To run benchmarks locally install AirspeedVelocity.jl and run the following command in the package directory:

benchpkg BoundaryValueDiffEq --rev="master,<git sha for your commit>" --bench-on="master"

About

Boundary value problem (BVP) solvers for scientific machine learning (SciML)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Julia 100.0%