Skip to content

Commit

Permalink
Merge pull request #723 from LilithHafner/lh/format
Browse files Browse the repository at this point in the history
Run JuliaFormatter.format()
  • Loading branch information
ChrisRackauckas authored Feb 15, 2024
2 parents 4b0cbe7 + d9da5ac commit eea65cd
Show file tree
Hide file tree
Showing 13 changed files with 41 additions and 32 deletions.
9 changes: 5 additions & 4 deletions docs/make.jl
Original file line number Diff line number Diff line change
@@ -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)
Expand All @@ -11,7 +11,8 @@ ENV["GKSwstype"] = "100"

include("pages.jl")

makedocs(modules = [
makedocs(
modules = [
DiffEqBase,
SciMLBase,
ODEProblemLibrary,
Expand All @@ -20,7 +21,7 @@ makedocs(modules = [
DAEProblemLibrary,
BVProblemLibrary,
OrdinaryDiffEq,
Sundials, DASKR,
Sundials, DASKR
],
linkcheck = true,
linkcheck_ignore = ["https://www.izhikevich.org/publications/spikes.htm",
Expand All @@ -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],
Expand Down
3 changes: 2 additions & 1 deletion docs/pages.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
3 changes: 2 additions & 1 deletion docs/src/examples/beeler_reuter.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
13 changes: 7 additions & 6 deletions docs/src/examples/outer_solar_system.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
```

Expand All @@ -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)
```

Expand Down
9 changes: 5 additions & 4 deletions docs/src/extras/timestepping.md
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -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
Expand Down
14 changes: 7 additions & 7 deletions docs/src/getting_started.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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).
or [come have an informal discussion at the Julia Zulip chatroom](https://julialang.zulipchat.com/#narrow/stream/279055-sciml-bridged).
2 changes: 1 addition & 1 deletion docs/src/solvers/bvp_solve.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
- `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.
1 change: 1 addition & 0 deletions docs/src/solvers/dae_solve.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
6 changes: 5 additions & 1 deletion docs/src/tutorials/advanced_ode_example.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions docs/src/tutorials/bvp_example.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
```
Expand All @@ -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))`.

4 changes: 2 additions & 2 deletions docs/src/tutorials/dae_example.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion docs/src/tutorials/sde_example.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions docs/src/types/sdae_types.md
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down

0 comments on commit eea65cd

Please sign in to comment.