diff --git a/docs/make.jl b/docs/make.jl index 602122801..d598de8c4 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -1,6 +1,6 @@ using Documenter, DiffEqBase, SciMLBase, OrdinaryDiffEq import ODEProblemLibrary, - SDEProblemLibrary, DDEProblemLibrary, DAEProblemLibrary, BVProblemLibrary + SDEProblemLibrary, DDEProblemLibrary, DAEProblemLibrary, BVProblemLibrary using Sundials, DASKR cp("./docs/Manifest.toml", "./docs/src/assets/Manifest.toml", force = true) @@ -11,7 +11,8 @@ ENV["GKSwstype"] = "100" include("pages.jl") -makedocs(modules = [ +makedocs( + modules = [ DiffEqBase, SciMLBase, ODEProblemLibrary, @@ -20,7 +21,7 @@ makedocs(modules = [ DAEProblemLibrary, BVProblemLibrary, OrdinaryDiffEq, - Sundials, DASKR, + Sundials, DASKR ], linkcheck = true, linkcheck_ignore = ["https://www.izhikevich.org/publications/spikes.htm", @@ -33,7 +34,7 @@ makedocs(modules = [ "https://www.sciencedirect.com/science/article/abs/pii/S0375960109009591", "https://www.sciencedirect.com/science/article/abs/pii/0375960176901018", "https://www.worldscientific.com/doi/abs/10.1142/S0218127499001024", - "https://www.worldscientific.com/doi/abs/10.1142/S0218127499001383", + "https://www.worldscientific.com/doi/abs/10.1142/S0218127499001383" ], doctest = false, clean = true, warnonly = [:missing_docs], diff --git a/docs/pages.jl b/docs/pages.jl index 42314978b..e39612a0d 100644 --- a/docs/pages.jl +++ b/docs/pages.jl @@ -8,7 +8,8 @@ pages = Any["index.md", "tutorials/dae_example.md", "tutorials/jump_diffusion.md", "tutorials/bvp_example.md"], - "Examples" => Any["Beginner" => Any["examples/classical_physics.md", + "Examples" => Any[ + "Beginner" => Any["examples/classical_physics.md", "examples/conditional_dosing.md", "examples/kepler_problem.md", "examples/outer_solar_system.md", diff --git a/docs/src/examples/beeler_reuter.md b/docs/src/examples/beeler_reuter.md index 45a32b865..0df956341 100644 --- a/docs/src/examples/beeler_reuter.md +++ b/docs/src/examples/beeler_reuter.md @@ -636,7 +636,8 @@ function (f::BeelerReuterGpu)(du, u, p, t) laplacian(f.Δv, u) # calculate the reaction portion - @cuda blocks=(ny ÷ L, nx ÷ L) threads=(L, L) update_du_gpu(f.d_du, f.d_u, f.d_XI, f.d_M, + @cuda blocks=(ny ÷ L, nx ÷ L) threads=(L, L) update_du_gpu( + f.d_du, f.d_u, f.d_XI, f.d_M, f.d_H, f.d_J, f.d_D, f.d_F, f.d_C) diff --git a/docs/src/examples/outer_solar_system.md b/docs/src/examples/outer_solar_system.md index f6898d12f..64e85fb5a 100644 --- a/docs/src/examples/outer_solar_system.md +++ b/docs/src/examples/outer_solar_system.md @@ -25,16 +25,16 @@ M = [ 0.000285583733151, 0.0000437273164546, 0.0000517759138449, - 1 / 1.3e8, + 1 / 1.3e8 ] planets = ["Sun", "Jupiter", "Saturn", "Uranus", "Neptune", "Pluto"] pos = [0.0 -3.5023653 9.0755314 8.310142 11.4707666 -15.5387357 - 0.0 -3.8169847 -3.0458353 -16.2901086 -25.7294829 -25.2225594 - 0.0 -1.5507963 -1.6483708 -7.2521278 -10.8169456 -3.1902382] + 0.0 -3.8169847 -3.0458353 -16.2901086 -25.7294829 -25.2225594 + 0.0 -1.5507963 -1.6483708 -7.2521278 -10.8169456 -3.1902382] vel = [0.0 0.00565429 0.00168318 0.00354178 0.0028893 0.00276725 - 0.0 -0.0041249 0.00483525 0.00137102 0.00114527 -0.00170702 - 0.0 -0.00190589 0.00192462 0.00055029 0.00039677 -0.00136504] + 0.0 -0.0041249 0.00483525 0.00137102 0.00114527 -0.00170702 + 0.0 -0.00190589 0.00192462 0.00055029 0.00039677 -0.00136504] tspan = (0.0, 200_000.0) ``` @@ -51,7 +51,8 @@ const N = 6 u = collect(u) D = Differential(t) potential = -G * - ∑(i -> ∑(j -> (M[i] * M[j]) / √(∑(k -> (u[k, i] - u[k, j])^2, 1:3)), 1:(i - 1)), + ∑( + i -> ∑(j -> (M[i] * M[j]) / √(∑(k -> (u[k, i] - u[k, j])^2, 1:3)), 1:(i - 1)), 2:N) ``` diff --git a/docs/src/extras/timestepping.md b/docs/src/extras/timestepping.md index 5dcac5f18..a7311747a 100644 --- a/docs/src/extras/timestepping.md +++ b/docs/src/extras/timestepping.md @@ -189,7 +189,7 @@ struct CustomController <: StochasticDiffEq.AbstractController end function StochasticDiffEq.stepsize_controller!(integrator::StochasticDiffEq.SDEIntegrator, - controller::CustomController, alg) + controller::CustomController, alg) integrator.q11 = DiffEqBase.value(DiffEqBase.fastpow(integrator.EEst, controller.beta1)) integrator.q = DiffEqBase.value(integrator.q11 / DiffEqBase.fastpow(integrator.qold, controller.beta2)) @@ -199,15 +199,16 @@ function StochasticDiffEq.stepsize_controller!(integrator::StochasticDiffEq.SDEI nothing end -function StochasticDiffEq.step_accept_controller!(integrator::StochasticDiffEq.SDEIntegrator, - controller::CustomController, alg) +function StochasticDiffEq.step_accept_controller!( + integrator::StochasticDiffEq.SDEIntegrator, + controller::CustomController, alg) integrator.dtnew = DiffEqBase.value(integrator.dt / integrator.q) * oneunit(integrator.dt) nothing end function step_reject_controller!(integrator::StochasticDiffEq.SDEIntegrator, - controller::CustomController, alg) + controller::CustomController, alg) integrator.dtnew = integrator.dt / min(inv(integrator.opts.qmin), integrator.q11 / integrator.opts.gamma) end diff --git a/docs/src/getting_started.md b/docs/src/getting_started.md index f7cac6f15..c8f9e62e9 100644 --- a/docs/src/getting_started.md +++ b/docs/src/getting_started.md @@ -403,9 +403,9 @@ We can define a matrix of linear ODEs as follows: using DifferentialEquations using Plots A = [1.0 0 0 -5 - 4 -2 4 -3 - -4 0 0 1 - 5 -2 2 3] + 4 -2 4 -3 + -4 0 0 1 + 5 -2 2 3] u0 = rand(4, 2) tspan = (0.0, 1.0) f(u, p, t) = A * u @@ -438,9 +438,9 @@ above, with the only change being the type for the initial condition and constan ```@example ODE4 using StaticArrays A = @SMatrix [1.0 0.0 0.0 -5.0 - 4.0 -2.0 4.0 -3.0 - -4.0 0.0 0.0 1.0 - 5.0 -2.0 2.0 3.0] + 4.0 -2.0 4.0 -3.0 + -4.0 0.0 0.0 1.0 + 5.0 -2.0 2.0 3.0] u0 = @SMatrix rand(4, 2) tspan = (0.0, 1.0) f2(u, p, t) = A * u @@ -504,4 +504,4 @@ Many more are defined in the relevant sections of the docs. Please explore the r of the documentation, including tutorials for getting started with other types of equations. In addition, to get help, please either [file an issue at the main repository](https://github.com/SciML/DifferentialEquations.jl) -or [come have an informal discussion at the Julia Zulip chatroom](https://julialang.zulipchat.com/#narrow/stream/279055-sciml-bridged). \ No newline at end of file +or [come have an informal discussion at the Julia Zulip chatroom](https://julialang.zulipchat.com/#narrow/stream/279055-sciml-bridged). diff --git a/docs/src/solvers/bvp_solve.md b/docs/src/solvers/bvp_solve.md index dd3b3a420..3873c602b 100644 --- a/docs/src/solvers/bvp_solve.md +++ b/docs/src/solvers/bvp_solve.md @@ -30,4 +30,4 @@ off via the keyword argument `adaptive = false`. ODEInterface.jl can be used seamlessly with BoundaryValueDiffEq.jl, after we define our model using `BVProblem` or `TwoPointBVProblem`, we can directly call the solvers from ODEInterface.jl. - `BVPM2` - FORTRAN code for solving two-point boundary value problems. `BVPM2` is only compatible with `TwoPointBVProblem`. - - `BVPSOL` - FORTRAN77 code which solves highly nonlinear two point boundary value problems using a local linear solver (condensing algorithm) or a global sparse linear solver for the solution of the arising linear subproblems, by Peter Deuflhard, Georg Bader, Lutz Weimann. `BVPSOL` should be used with `TwoPointBVProblem` and initial guess. \ No newline at end of file + - `BVPSOL` - FORTRAN77 code which solves highly nonlinear two point boundary value problems using a local linear solver (condensing algorithm) or a global sparse linear solver for the solution of the arising linear subproblems, by Peter Deuflhard, Georg Bader, Lutz Weimann. `BVPSOL` should be used with `TwoPointBVProblem` and initial guess. diff --git a/docs/src/solvers/dae_solve.md b/docs/src/solvers/dae_solve.md index 6fdb6e013..793f2fa6b 100644 --- a/docs/src/solvers/dae_solve.md +++ b/docs/src/solvers/dae_solve.md @@ -92,6 +92,7 @@ extra options for the solvers, see the ODE solver page. - `ROS34PW3` - A 4th order strongly A-stable (Rinf~0.63) Rosenbrock-W method. !!! note + `Rosenbrock23` and `Rosenbrock32` have a stiff-aware interpolation but this interpolation is not safe for the algebraic variables. Thus use the interpolation (and therefore `saveat`) with caution if the default Hermite interpolation is used. diff --git a/docs/src/tutorials/advanced_ode_example.md b/docs/src/tutorials/advanced_ode_example.md index aca6cdbb1..2c5c7dcc2 100644 --- a/docs/src/tutorials/advanced_ode_example.md +++ b/docs/src/tutorials/advanced_ode_example.md @@ -39,13 +39,16 @@ f(x, y, t) = \begin{cases} 0 & \quad \text{else} \end{cases}, \mathrm{and} ``` + $\nabla^2 = \frac{\partial^2}{\partial x^2} + \frac{\partial^2}{\partial y^2}$ is the two dimensional Laplacian operator. The above equations are to be solved for a time interval $t \in [0, 11.5]$ subject to the initial conditions + ```math \begin{align} U(x, y, 0) &= 22\cdot (y(1-y))^{3/2} \\ V(x, y, 0) &= 27\cdot (x(1-x))^{3/2} \end{align}, ``` + and the periodic boundary conditions ```math @@ -336,7 +339,8 @@ function. We will use [ModelingToolkit.jl](https://mtk.sciml.ai/dev/)'s ```@example stiff1 using ModelingToolkit -prob_ode_brusselator_2d_mtk = ODEProblem(modelingtoolkitize(prob_ode_brusselator_2d_sparse), +prob_ode_brusselator_2d_mtk = ODEProblem( + modelingtoolkitize(prob_ode_brusselator_2d_sparse), [], (0.0, 11.5), jac = true, sparse = true); # @btime solve(prob_ode_brusselator_2d_mtk,CVODE_BDF(linear_solver=:KLU),save_everystep=false); # compiles very slowly nothing # hide diff --git a/docs/src/tutorials/bvp_example.md b/docs/src/tutorials/bvp_example.md index 0def7b924..b55f1ab42 100644 --- a/docs/src/tutorials/bvp_example.md +++ b/docs/src/tutorials/bvp_example.md @@ -91,7 +91,7 @@ function bc2b!(resid_b, u_b, p) # u_b is at the ending of the time span resid_b[1] = u_b[1] - pi / 2 # the solution at the end of the time span should be pi/2 end bvp2 = TwoPointBVProblem(simplependulum!, (bc2a!, bc2b!), [pi / 2, pi / 2], tspan; - bcresid_prototype = (zeros(1), zeros(1))) + bcresid_prototype = (zeros(1), zeros(1))) sol2 = solve(bvp2, MIRK4(), dt = 0.05) plot(sol2) ``` @@ -101,4 +101,3 @@ for the final time point. `bcresid_prototype` is a prototype array which is pass `resid_a` and `resid_b`. In this case, we have one residual term for the start and one for the final time point, and thus we have `bcresid_prototype = (zeros(1), zeros(1))`. If we wanted to only have boundary conditions at the final time, we could instead have done `bcresid_prototype = (zeros(0), zeros(2))`. - diff --git a/docs/src/tutorials/dae_example.md b/docs/src/tutorials/dae_example.md index f02e6d8e5..8ef1f93fb 100644 --- a/docs/src/tutorials/dae_example.md +++ b/docs/src/tutorials/dae_example.md @@ -56,8 +56,8 @@ function rober(du, u, p, t) nothing end M = [1.0 0 0 - 0 1.0 0 - 0 0 0] + 0 1.0 0 + 0 0 0] f = ODEFunction(rober, mass_matrix = M) prob_mm = ODEProblem(f, [1.0, 0.0, 0.0], (0.0, 1e5), (0.04, 3e7, 1e4)) sol = solve(prob_mm, Rodas5(), reltol = 1e-8, abstol = 1e-8) diff --git a/docs/src/tutorials/sde_example.md b/docs/src/tutorials/sde_example.md index 899bba38d..6b6bcf391 100644 --- a/docs/src/tutorials/sde_example.md +++ b/docs/src/tutorials/sde_example.md @@ -45,7 +45,7 @@ plot(sol) ### Using Higher Order Methods One unique feature of DifferentialEquations.jl is that higher-order methods for -stochastic differential equations are included. To illustrate it, let us compare the +stochastic differential equations are included. To illustrate it, let us compare the accuracy of the `EM()` method and a higher-order method `SRIW1()` with the analytical solution. This is a good way to judge the accuracy of a given algorithm, and is also useful to test convergence of new methods being developed. To setup our problem, we define diff --git a/docs/src/types/sdae_types.md b/docs/src/types/sdae_types.md index 6cafbb9dc..9d29b596a 100644 --- a/docs/src/types/sdae_types.md +++ b/docs/src/types/sdae_types.md @@ -23,8 +23,8 @@ DAE. ```julia const mm_A = [-2.0 1 4 - 4 -2 1 - 0 0 0] + 4 -2 1 + 0 0 0] function f!(du, u, p, t) du[1] = u[1] du[2] = u[2]