diff --git a/docs/make.jl b/docs/make.jl index e32384fd5..f178dbb6f 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -1,4 +1,5 @@ -using Documenter, DiffEqBase, SciMLBase, OrdinaryDiffEq, OrdinaryDiffEqBDF, OrdinaryDiffEqCore, StochasticDiffEq, DelayDiffEq, SteadyStateDiffEq, DiffEqCallbacks +using Documenter, DiffEqBase, SciMLBase, OrdinaryDiffEq, OrdinaryDiffEqBDF, + OrdinaryDiffEqCore, StochasticDiffEq, DelayDiffEq, SteadyStateDiffEq, DiffEqCallbacks import ODEProblemLibrary, SDEProblemLibrary, DDEProblemLibrary, DAEProblemLibrary, BVProblemLibrary using Sundials, DASKR @@ -18,19 +19,19 @@ if isdir(ordinartdiffeq_docs_path) # Create the OrdinaryDiffEq API directory in the docs ordinary_diffeq_dest = joinpath(@__DIR__, "src", "api", "ordinarydiffeq") mkpath(dirname(ordinary_diffeq_dest)) - + # Copy all the docs from OrdinaryDiffEq.jl - cp(ordinartdiffeq_docs_path, ordinary_diffeq_dest, force=true) - + cp(ordinartdiffeq_docs_path, ordinary_diffeq_dest, force = true) + # Copy the pages.jl file from OrdinaryDiffEq.jl ordinary_diffeq_pages_dest = joinpath(@__DIR__, "ordinarydiffeq_pages.jl") ordinary_diffeq_pages_file = joinpath(ordinartdiffeq_docs_root, "pages.jl") - cp(ordinary_diffeq_pages_file, ordinary_diffeq_pages_dest, force=true) - + cp(ordinary_diffeq_pages_file, ordinary_diffeq_pages_dest, force = true) + # Copy the common_first_steps.jl file from OrdinaryDiffEq.jl common_first_steps_dest = joinpath(@__DIR__, "common_first_steps.jl") common_first_steps_file = joinpath(ordinartdiffeq_docs_root, "common_first_steps.jl") - cp(common_first_steps_file, common_first_steps_dest, force=true) + cp(common_first_steps_file, common_first_steps_dest, force = true) end # Copy StochasticDiffEq.jl documentation @@ -40,14 +41,14 @@ if isdir(stochasticdiffeq_docs_path) # Create the StochasticDiffEq API directory in the docs stochastic_diffeq_dest = joinpath(@__DIR__, "src", "api", "stochasticdiffeq") mkpath(dirname(stochastic_diffeq_dest)) - + # Copy all the docs from StochasticDiffEq.jl - cp(stochasticdiffeq_docs_path, stochastic_diffeq_dest, force=true) - + cp(stochasticdiffeq_docs_path, stochastic_diffeq_dest, force = true) + # Copy the pages.jl file from StochasticDiffEq.jl stochastic_diffeq_pages_dest = joinpath(@__DIR__, "stochasticdiffeq_pages.jl") stochastic_diffeq_pages_file = joinpath(stochasticdiffeq_docs_root, "pages.jl") - cp(stochastic_diffeq_pages_file, stochastic_diffeq_pages_dest, force=true) + cp(stochastic_diffeq_pages_file, stochastic_diffeq_pages_dest, force = true) end ENV["PLOTS_TEST"] = "true" @@ -118,13 +119,13 @@ makedocs( "https://github.com/SciML/ColPrac/blob/master/README.md", "https://github.com/SciML/DiffEqDevTools.jl/blob/master/src/ode_tableaus.jl", "https://github.com/SciML/DiffEqProblemLibrary.jl/blob/master/lib/BVProblemLibrary/src/BVProblemLibrary.jl", - "https://github.com/SciML/DiffEqProblemLibrary.jl/blob/master/lib/DDEProblemLibrary/src/DDEProblemLibrary.jl", + "https://github.com/SciML/DiffEqProblemLibrary.jl/blob/master/lib/DDEProblemLibrary/src/DDEProblemLibrary.jl" ], doctest = false, clean = true, warnonly = [:missing_docs, :docs_block], format = Documenter.HTML(assets = ["assets/favicon.ico"], canonical = "https://docs.sciml.ai/DiffEqDocs/stable/", - size_threshold = 500 * 2^10), + size_threshold = 500 * 2^10), sitename = "DifferentialEquations.jl", authors = "Chris Rackauckas", pages = pages) diff --git a/docs/pages.jl b/docs/pages.jl index e0d80229f..2b394edf0 100644 --- a/docs/pages.jl +++ b/docs/pages.jl @@ -31,7 +31,7 @@ stochastic_diffeq_pages_file = joinpath(@__DIR__, "stochasticdiffeq_pages.jl") stochastic_diffeq_pages = [] if isfile(stochastic_diffeq_pages_file) include(stochastic_diffeq_pages_file) - + # Transform StochasticDiffEq pages to have the api/stochasticdiffeq prefix function transform_stochasticdiffeq_pages(pages_array) transformed = [] @@ -49,77 +49,83 @@ if isfile(stochastic_diffeq_pages_file) end return transformed end - + stochastic_diffeq_pages = transform_stochasticdiffeq_pages(pages) end pages = Any["index.md", - "getting_started.md", - "Tutorials" => Any["tutorials/faster_ode_example.md", - "tutorials/advanced_ode_example.md", - "tutorials/sde_example.md", - "tutorials/rode_example.md", - "tutorials/dde_example.md", - "tutorials/dae_example.md", - "tutorials/jump_diffusion.md", - "tutorials/bvp_example.md"], - "Examples" => Any[ - "Beginner" => Any["examples/classical_physics.md", - "examples/conditional_dosing.md", - "examples/kepler_problem.md", - "examples/outer_solar_system.md", - "examples/min_and_max.md"], - "Advanced" => Any["examples/spiking_neural_systems.md", - "examples/beeler_reuter.md", - "examples/diffusion_implicit_heat_equation.md"]], - "Basics" => Any["basics/overview.md", - "basics/common_solver_opts.md", - "basics/solution.md", - "basics/plot.md", - "basics/integrator.md", - "basics/problem.md", - "basics/faq.md", - "basics/compatibility_chart.md"], - "Problem Types" => Any["types/discrete_types.md", - "types/ode_types.md", - "types/nonautonomous_linear_ode.md", - "types/dynamical_types.md", - "types/split_ode_types.md", - "types/steady_state_types.md", - "types/bvp_types.md", - "types/sde_types.md", - "types/sdae_types.md", - "types/rode_types.md", - "types/dde_types.md", - "types/sdde_types.md", - "types/dae_types.md"], - "Solver Algorithms" => Any["solvers/discrete_solve.md", - "solvers/ode_solve.md", - "solvers/nonautonomous_linear_ode.md", - "solvers/dynamical_solve.md", - "solvers/split_ode_solve.md", - "solvers/steady_state_solve.md", - "solvers/bvp_solve.md", - "solvers/sde_solve.md", - "solvers/sdae_solve.md", - "solvers/rode_solve.md", - "solvers/dde_solve.md", - "solvers/sdde_solve.md", - "solvers/dae_solve.md", - "solvers/benchmarks.md"], - "Additional Features" => Any["features/performance_overloads.md", - "features/diffeq_arrays.md", - "features/diffeq_operator.md", - "features/noise_process.md", - "features/linear_nonlinear.md", - "features/callback_functions.md", - "features/callback_library.md", - "features/ensemble.md", - "features/io.md", - "features/low_dep.md", - "features/progress_bar.md"], - "External Solver APIs" => Any["api/sundials.md", - "api/daskr.md"], - "OrdinaryDiffEq.jl API" => ordinary_diffeq_pages, - "StochasticDiffEq.jl API" => stochastic_diffeq_pages, - "Extra Details" => Any["extras/timestepping.md"]] +"getting_started.md", +"Tutorials" => Any[ + "tutorials/faster_ode_example.md", + "tutorials/advanced_ode_example.md", + "tutorials/sde_example.md", + "tutorials/rode_example.md", + "tutorials/dde_example.md", + "tutorials/dae_example.md", + "tutorials/jump_diffusion.md", + "tutorials/bvp_example.md"], +"Examples" => Any[ + "Beginner" => Any["examples/classical_physics.md", + "examples/conditional_dosing.md", + "examples/kepler_problem.md", + "examples/outer_solar_system.md", + "examples/min_and_max.md"], + "Advanced" => Any["examples/spiking_neural_systems.md", + "examples/beeler_reuter.md", + "examples/diffusion_implicit_heat_equation.md"]], +"Basics" => Any[ + "basics/overview.md", + "basics/common_solver_opts.md", + "basics/solution.md", + "basics/plot.md", + "basics/integrator.md", + "basics/problem.md", + "basics/faq.md", + "basics/compatibility_chart.md"], +"Problem Types" => Any[ + "types/discrete_types.md", + "types/ode_types.md", + "types/nonautonomous_linear_ode.md", + "types/dynamical_types.md", + "types/split_ode_types.md", + "types/steady_state_types.md", + "types/bvp_types.md", + "types/sde_types.md", + "types/sdae_types.md", + "types/rode_types.md", + "types/dde_types.md", + "types/sdde_types.md", + "types/dae_types.md"], +"Solver Algorithms" => Any[ + "solvers/discrete_solve.md", + "solvers/ode_solve.md", + "solvers/nonautonomous_linear_ode.md", + "solvers/dynamical_solve.md", + "solvers/split_ode_solve.md", + "solvers/steady_state_solve.md", + "solvers/bvp_solve.md", + "solvers/sde_solve.md", + "solvers/sdae_solve.md", + "solvers/rode_solve.md", + "solvers/dde_solve.md", + "solvers/sdde_solve.md", + "solvers/dae_solve.md", + "solvers/benchmarks.md"], +"Additional Features" => Any[ + "features/performance_overloads.md", + "features/diffeq_arrays.md", + "features/diffeq_operator.md", + "features/noise_process.md", + "features/linear_nonlinear.md", + "features/callback_functions.md", + "features/callback_library.md", + "features/ensemble.md", + "features/io.md", + "features/low_dep.md", + "features/progress_bar.md"], +"External Solver APIs" => Any[ + "api/sundials.md", + "api/daskr.md"], +"OrdinaryDiffEq.jl API" => ordinary_diffeq_pages, +"StochasticDiffEq.jl API" => stochastic_diffeq_pages, +"Extra Details" => Any["extras/timestepping.md"]] diff --git a/docs/src/basics/faq.md b/docs/src/basics/faq.md index cddb03e1f..61e8edd0b 100644 --- a/docs/src/basics/faq.md +++ b/docs/src/basics/faq.md @@ -12,9 +12,9 @@ For guidelines on debugging ODE solve issues, see First of all, don't panic. You may have experienced one of the following warnings: > dt <= dtmin. Aborting. There is either an error in your model specification or the true solution is unstable. -> +> > NaN dt detected. Likely a NaN value in the state, parameters, or derivative value caused this outcome. -> +> > Instability detected. Aborting These are all pointing to a similar behavior: for some reason or another, the @@ -572,7 +572,8 @@ though, an `Error: SingularException` is also possible if the linear solver fail ```julia import DifferentialEquations as DE, OrdinaryDiffEq as ODE, LinearSolve -DE.solve(prob, ODE.Rodas4(linsolve = LinearSolve.KLUFactorization(; reuse_symbolic = false))) +DE.solve(prob, ODE.Rodas4(linsolve = LinearSolve.KLUFactorization(; + reuse_symbolic = false))) ``` For more details about possible linear solvers, consult the [LinearSolve.jl documentation](https://docs.sciml.ai/LinearSolve/stable/) diff --git a/docs/src/basics/integrator.md b/docs/src/basics/integrator.md index 3b970c878..694a6824f 100644 --- a/docs/src/basics/integrator.md +++ b/docs/src/basics/integrator.md @@ -250,7 +250,8 @@ For example, if one wants to iterate but only stop at specific values, one can choose: ```julia -integrator = DE.init(prob, DE.Tsit5(); dt = 1 // 2^(4), tstops = [0.5], advance_to_tstop = true) +integrator = DE.init( + prob, DE.Tsit5(); dt = 1 // 2^(4), tstops = [0.5], advance_to_tstop = true) for (u, t) in tuples(integrator) @test t ∈ [0.5, 1.0] end diff --git a/docs/src/basics/plot.md b/docs/src/basics/plot.md index 0ed9170e4..7fe43dab6 100644 --- a/docs/src/basics/plot.md +++ b/docs/src/basics/plot.md @@ -160,7 +160,8 @@ xy = Plots.plot(sol, plotdensity = 10000, idxs = (1, 2)) xz = Plots.plot(sol, plotdensity = 10000, idxs = (1, 3)) yz = Plots.plot(sol, plotdensity = 10000, idxs = (2, 3)) xyz = Plots.plot(sol, plotdensity = 10000, idxs = (1, 2, 3)) -Plots.plot(Plots.plot(xyzt, xyz), Plots.plot(xy, xz, yz, layout = (1, 3), w = 1), layout = (2, 1)) +Plots.plot(Plots.plot(xyzt, xyz), Plots.plot(xy, xz, yz, layout = (1, 3), w = 1), layout = ( + 2, 1)) ``` An example using the functions: diff --git a/docs/src/basics/solution.md b/docs/src/basics/solution.md index 21795804a..a7b97785a 100644 --- a/docs/src/basics/solution.md +++ b/docs/src/basics/solution.md @@ -1,6 +1,6 @@ # [Solution Handling](@id solution) -The solution is an `RecursiveArrayTools.AbstractDiffEqArray`. +The solution is an `RecursiveArrayTools.AbstractDiffEqArray`. [See RecursiveArrayTools.jl for more information on the interface](https://docs.sciml.ai/RecursiveArrayTools/stable/). The following is a more DiffEq-centric explanation of the interface. @@ -19,7 +19,7 @@ derivative at each timestep `du` or the spatial discretization `x`, `y`, etc. ## Array Interface !!! note - + In 2023 the linear indexing `sol[i]` was deprecated. It previously had the behavior that `sol[i] = sol.u[i]`. However, this is incompatible with standard `AbstractArray` interfaces, Since if `A = VectorOfArray([[1,2],[3,4]])` and `A` is supposed to act like `[1 3; 2 4]`, @@ -50,7 +50,7 @@ will address first by component and lastly by time, and thus sol[i, j] ``` -will be the `i`th component at timestep `j`. Hence, `sol[j][i] == sol[i, j]`. This is done because Julia is column-major, +will be the `i`th component at timestep `j`. Hence, `sol[j][i] == sol[i, j]`. This is done because Julia is column-major, so the leading dimension should be contiguous in memory. If the independent variables had shape (for example, was a matrix), then `i` is the linear index. We can also access solutions with shape: @@ -186,12 +186,14 @@ error state of the solution. Return codes are now implemented as an enum using E rather than symbols. To check if a solution was successful, use: + ```julia SciMLBase.successful_retcode(sol) ``` !!! warning - Previous iterations of the interface suggested using `sol.retcode == :Success`, + + Previous iterations of the interface suggested using `sol.retcode == :Success`, however, that is now not advised because there are more than one return code that can be interpreted as successful. For example, `Terminated` is a successful run to a manual termination, and would be missed if only checking for Success. Therefore we highly recommend you use `SciMLBase.successful_retcode(sol)` instead. @@ -214,7 +216,7 @@ following are major return codes to know: - `ConvergenceFailure`: The internal implicit solvers failed to converge. - `Failure`: General uncategorized failures or errors. -For a complete list of return codes and their properties, see the +For a complete list of return codes and their properties, see the [SciMLBase ReturnCode documentation](https://docs.sciml.ai/SciMLBase/stable/interfaces/Solutions/#retcodes). ## Problem-Specific Features diff --git a/docs/src/examples/beeler_reuter.md b/docs/src/examples/beeler_reuter.md index 2d147c3c3..c579ec32d 100644 --- a/docs/src/examples/beeler_reuter.md +++ b/docs/src/examples/beeler_reuter.md @@ -93,8 +93,9 @@ end The finite-difference Laplacian is calculated in-place by a 5-point stencil. The Neumann boundary condition is enforced. !!! note - For more complex PDE discretizations, consider using [MethodOfLines.jl](https://docs.sciml.ai/MethodOfLines/stable/) - which can automatically generate finite difference discretizations, or [SciMLOperators.jl](https://docs.sciml.ai/SciMLOperators/stable/) + + For more complex PDE discretizations, consider using [MethodOfLines.jl](https://docs.sciml.ai/MethodOfLines/stable/) + which can automatically generate finite difference discretizations, or [SciMLOperators.jl](https://docs.sciml.ai/SciMLOperators/stable/) for defining matrix-free linear operators. ```julia @@ -632,7 +633,7 @@ function (f::BeelerReuterGpu)(du, u, p, t) ny, nx = size(u) if Δt != 0 || t == 0 - @cuda blocks=(ny ÷ L, nx ÷ L) threads=(L, L) update_gates_gpu(f.d_u, f.d_XI, f.d_M, + @cuda blocks=(ny÷L, nx÷L) threads=(L, L) update_gates_gpu(f.d_u, f.d_XI, f.d_M, f.d_H, f.d_J, f.d_D, f.d_F, f.d_C, Δt) f.t = t @@ -641,7 +642,7 @@ 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( + @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/classical_physics.md b/docs/src/examples/classical_physics.md index bc569aea4..8cfc8f67d 100644 --- a/docs/src/examples/classical_physics.md +++ b/docs/src/examples/classical_physics.md @@ -382,7 +382,8 @@ Notice that we get the same results: ```@example physics # Plot the orbit -Plots.plot(sol2, idxs = (3, 4), title = "The orbit of the Hénon-Heiles system", xaxis = "x", +Plots.plot( + sol2, idxs = (3, 4), title = "The orbit of the Hénon-Heiles system", xaxis = "x", yaxis = "y", leg = false) ``` diff --git a/docs/src/examples/kepler_problem.md b/docs/src/examples/kepler_problem.md index 3f9d493ab..e24992832 100644 --- a/docs/src/examples/kepler_problem.md +++ b/docs/src/examples/kepler_problem.md @@ -33,7 +33,9 @@ sol = ODE.solve(prob, ODE.KahanLi6(), dt = 1 // 10); Let's plot the orbit and check the energy and angular momentum variation. We know that energy and angular momentum should be constant, and they are also called first integrals. ```@example kepler -plot_orbit(sol) = Plots.plot(sol, idxs = (3, 4), lab = "Orbit", title = "Kepler Problem Solution") +function plot_orbit(sol) + Plots.plot(sol, idxs = (3, 4), lab = "Orbit", title = "Kepler Problem Solution") +end function plot_first_integrals(sol, H, L) Plots.plot(initial_first_integrals[1] .- map(u -> H(u.x[2], u.x[1]), sol.u), diff --git a/docs/src/features/ensemble.md b/docs/src/features/ensemble.md index 3d26e81ed..437068d29 100644 --- a/docs/src/features/ensemble.md +++ b/docs/src/features/ensemble.md @@ -574,7 +574,7 @@ compute covariance matrices similarly: ```@example ensemble4 DE.EnsembleAnalysis.timeseries_steps_meancov(sim) # Use the time steps, assume fixed dt -DE.EnsembleAnalysis.timeseries_point_meancov(sim, 0:(1 // 2^(3)):1, 0:(1 // 2^(3)):1) # Use time points, interpolate +DE.EnsembleAnalysis.timeseries_point_meancov(sim, 0:(1 // 2 ^ (3)):1, 0:(1 // 2 ^ (3)):1) # Use time points, interpolate ``` For general analysis, we can build a `EnsembleSummary` type. diff --git a/docs/src/getting_started.md b/docs/src/getting_started.md index ff0f5fcd6..1c0b5ac24 100644 --- a/docs/src/getting_started.md +++ b/docs/src/getting_started.md @@ -404,7 +404,8 @@ M = t -> 0.1sin(t) # external torque [Nm] prob = DE.ODEProblem(pendulum!, u₀, tspan, M) sol = DE.solve(prob) -Plots.plot(sol, linewidth = 2, xaxis = "t", label = ["θ [rad]" "ω [rad/s]"], layout = (2, 1)) +Plots.plot( + sol, linewidth = 2, xaxis = "t", label = ["θ [rad]" "ω [rad/s]"], layout = (2, 1)) ``` Note how the external **time-varying** torque `M` is introduced as a **parameter** in the `pendulum!` function. Indeed, as a general principle the parameters can be any type; here we specify `M` as time-varying by representing it by a function, which is expressed by appending the dependence on time `(t)` to the name of the parameter. @@ -458,9 +459,9 @@ above, with the only change being the type for the initial condition and constan ```@example ODE4 import StaticArrays A = StaticArrays.@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 = StaticArrays.@SMatrix rand(4, 2) tspan = (0.0, 1.0) f2(u, p, t) = A * u diff --git a/docs/src/index.md b/docs/src/index.md index ae1530130..8ac405a81 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -67,7 +67,7 @@ Additionally, DifferentialEquations.jl comes with built-in analysis features, in for guidance on PRs, issues, and other matters relating to contributing to SciML. - See the [SciML Style Guide](https://github.com/SciML/SciMLStyle) for common coding practices and other style decisions. - There are a few community forums: - + + The #diffeq-bridged and #sciml-bridged channels in the [Julia Slack](https://julialang.org/slack/) + The #diffeq-bridged and #sciml-bridged channels in the diff --git a/docs/src/solvers/ode_solve.md b/docs/src/solvers/ode_solve.md index d4de69a25..e609e327d 100644 --- a/docs/src/solvers/ode_solve.md +++ b/docs/src/solvers/ode_solve.md @@ -960,22 +960,22 @@ import IRKGaussLegendre `IRKGL16(;kwargs...)` has the following arguments: - second_order_ode (boolean): - + + =false (default): for a ODEProblem type + =true: for a second-order differential equation - simd (boolean): - + + =true: SIMD-vectorized implementation only available for Float32 or Float64 computations + =false (default): generic implementation that can use with arbitrary Julia-defined number systems - mstep: output saved at every 'mstep' steps. Default 1. - initial_extrapolation: initialization method for stages. - + + =false: simplest initialization + =true (default): extrapolation from the stage values of previous step - maxtrials: maximum number of attempts to accept adaptive step size - threading - + + =false (default): sequential execution of the numerical integration + =true: computations using threads (shared memory multi-threading) for stage-wise parallelization diff --git a/docs/src/tutorials/advanced_ode_example.md b/docs/src/tutorials/advanced_ode_example.md index 9c9fe8841..f410f9813 100644 --- a/docs/src/tutorials/advanced_ode_example.md +++ b/docs/src/tutorials/advanced_ode_example.md @@ -86,7 +86,8 @@ function brusselator_2d_loop(du, u, p, t) @inbounds for I in CartesianIndices((N, N)) i, j = Tuple(I) x, y = xyd_brusselator[I[1]], xyd_brusselator[I[2]] - ip1, im1, jp1, jm1 = limit(i + 1, N), limit(i - 1, N), limit(j + 1, N), + ip1, im1, jp1, + jm1 = limit(i + 1, N), limit(i - 1, N), limit(j + 1, N), limit(j - 1, N) du[i, j, 1] = alpha * (u[im1, j, 1] + u[ip1, j, 1] + u[i, jp1, 1] + u[i, jm1, 1] - 4u[i, j, 1]) + @@ -186,7 +187,8 @@ Now let's see how the version with sparsity compares to the version without: import BenchmarkTools as BT # for @btime BT.@btime DE.solve(prob_ode_brusselator_2d, DE.TRBDF2(); save_everystep = false); BT.@btime DE.solve(prob_ode_brusselator_2d_sparse, DE.TRBDF2(); save_everystep = false); -BT.@btime DE.solve(prob_ode_brusselator_2d_sparse, DE.KenCarp47(; linsolve = DE.KLUFactorization()); +BT.@btime DE.solve( + prob_ode_brusselator_2d_sparse, DE.KenCarp47(; linsolve = DE.KLUFactorization()); save_everystep = false); nothing # hide ``` @@ -332,7 +334,8 @@ Newton Krylov (with numerical differentiation). Thus, on this problem we could d import Sundials BT.@btime DE.solve(prob_ode_brusselator_2d, Sundials.CVODE_BDF(); save_everystep = false); # Simplest speedup: use :LapackDense -BT.@btime DE.solve(prob_ode_brusselator_2d, Sundials.CVODE_BDF(; linear_solver = :LapackDense); +BT.@btime DE.solve( + prob_ode_brusselator_2d, Sundials.CVODE_BDF(; linear_solver = :LapackDense); save_everystep = false); # GMRES Version: Doesn't require any extra stuff! BT.@btime DE.solve(prob_ode_brusselator_2d, Sundials.CVODE_BDF(; linear_solver = :GMRES); @@ -428,7 +431,8 @@ function psetupamg(p, t, u, du, jok, jcurPtr, gamma) @. @view(W[idxs]) = @view(W[idxs]) + 1 # Build preconditioner on W - preccache2[] = AlgebraicMultigrid.aspreconditioner(AlgebraicMultigrid.ruge_stuben(W, + preccache2[] = AlgebraicMultigrid.aspreconditioner(AlgebraicMultigrid.ruge_stuben( + W, presmoother = AlgebraicMultigrid.Jacobi(rand(size(W, 1))), postsmoother = AlgebraicMultigrid.Jacobi(rand(size(W, diff --git a/docs/src/tutorials/bvp_example.md b/docs/src/tutorials/bvp_example.md index b99d3b731..5fb93439a 100644 --- a/docs/src/tutorials/bvp_example.md +++ b/docs/src/tutorials/bvp_example.md @@ -132,7 +132,8 @@ end u0 = [1.0, 1.0, 1.0] tspan = (0.0, 1.0) prob = BVP.SecondOrderBVProblem(f!, bc!, u0, tspan) -sol = BVP.solve(prob, BVP.MIRKN4(; jac_alg = BVP.BVPJacobianAlgorithm(BVP.AutoForwardDiff())); dt = 0.01) +sol = BVP.solve(prob, BVP.MIRKN4(; + jac_alg = BVP.BVPJacobianAlgorithm(BVP.AutoForwardDiff())); dt = 0.01) ``` ## Example 3: Semi-Explicit Boundary Value Differential-Algebraic Equations diff --git a/docs/src/tutorials/faster_ode_example.md b/docs/src/tutorials/faster_ode_example.md index dcc30b1ec..05f07270a 100644 --- a/docs/src/tutorials/faster_ode_example.md +++ b/docs/src/tutorials/faster_ode_example.md @@ -537,6 +537,7 @@ function fast_gm!(du, u, p, t) a, α, ubar, β, D1, D2, N = p @inbounds for j in 2:(N - 1), i in 2:(N - 1) + du[i, j, 1] = D1 * (u[i - 1, j, 1] + u[i + 1, j, 1] + u[i, j + 1, 1] + u[i, j - 1, 1] - 4u[i, j, 1]) + @@ -544,6 +545,7 @@ function fast_gm!(du, u, p, t) end @inbounds for j in 2:(N - 1), i in 2:(N - 1) + du[i, j, 2] = D2 * (u[i - 1, j, 2] + u[i + 1, j, 2] + u[i, j + 1, 2] + u[i, j - 1, 2] - 4u[i, j, 2]) + diff --git a/docs/src/tutorials/sde_example.md b/docs/src/tutorials/sde_example.md index a392e0084..66ae2bf5d 100644 --- a/docs/src/tutorials/sde_example.md +++ b/docs/src/tutorials/sde_example.md @@ -164,7 +164,7 @@ In general, a system of SDEs du = f(u,p,t)dt + g(u,p,t)dW, ``` -where `u` is now a vector of variables, `f` is a vector, and `g` is a matrix, is numerically integrated in the same way as ODEs. A common scenario, which is the default for DifferentialEquations.jl, is that every variable in the system gets a different random kick. This is the case when `g` is a diagonal matrix. Correspondingly, we say that we have a diagonal noise. +where `u` is now a vector of variables, `f` is a vector, and `g` is a matrix, is numerically integrated in the same way as ODEs. A common scenario, which is the default for DifferentialEquations.jl, is that every variable in the system gets a different random kick. This is the case when `g` is a diagonal matrix. Correspondingly, we say that we have a diagonal noise. We handle this in a simple manner by defining the deterministic part `f!(du,u,p,t)` and the stochastic part `g!(du2,u,p,t)` as in-place functions, but note that our convention is that the function `g!` only defines and modifies the diagonal entries of `g` matrix. diff --git a/docs/src/types/dde_types.md b/docs/src/types/dde_types.md index 1732323a3..d4cac9a2e 100644 --- a/docs/src/types/dde_types.md +++ b/docs/src/types/dde_types.md @@ -10,7 +10,7 @@ SciMLBase.DDEFunction `DDEProblem` solutions return an `ODESolution`. For more information, see the [ODE problem definition page](@ref ode_prob) for the `ODESolution` docstring. -## Alias Specifier +## Alias Specifier ```@docs SciMLBase.DDEAliasSpecifier diff --git a/docs/src/types/rode_types.md b/docs/src/types/rode_types.md index a04398437..de76afa9a 100644 --- a/docs/src/types/rode_types.md +++ b/docs/src/types/rode_types.md @@ -15,4 +15,4 @@ SciMLBase.RODESolution ```@docs SciMLBase.RODEAliasSpecifier -``` \ No newline at end of file +``` diff --git a/docs/src/types/sdde_types.md b/docs/src/types/sdde_types.md index 0c477e3d6..7b2883a6d 100644 --- a/docs/src/types/sdde_types.md +++ b/docs/src/types/sdde_types.md @@ -10,9 +10,8 @@ SciMLBase.SDDEFunction `SDDEProblem` solutions return an `RODESolution`. For more information, see the [RODE problem definition page](@ref rode_problem) for the `RODESolution` docstring. - ## Alias Specifier ```@docs SciMLBase.SDDEAliasSpecifier -``` \ No newline at end of file +```