Skip to content

Commit 3f05d77

Browse files
committed
Run JuliaFormatter on docs/src
1 parent 97961dd commit 3f05d77

File tree

6 files changed

+56
-55
lines changed

6 files changed

+56
-55
lines changed

docs/src/basics/problem.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,8 @@ A general syntax of `remake` is
111111
modified_problem = remake(original_problem;
112112
field_1 = value_1,
113113
field_2 = value_2,
114-
...)
114+
# ...
115+
)
115116
```
116117

117118
where `field_N` and `value_N` are renamed to appropriate field names

docs/src/examples/outer_solar_system.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,4 +92,3 @@ for i in 1:N
9292
end
9393
Plots.plot!(plt; xlab = "x", ylab = "y", zlab = "z", title = "Outer solar system")
9494
```
95-

docs/src/extras/timestepping.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ for explicit solvers, and it's applied by default to the Rosenbrock methods
6767
as well. The form for the updates is:
6868

6969
```julia
70-
EEst, beta1, q11, qold, beta2 = integrator.EEst, integrator.opts.beta1, integrator.q11,
71-
integrator.qold, integrator.opts.beta2
70+
(; EEst, q11, qold) = integrator
71+
(; beta1, beta2) = integrator.opts
7272
@fastmath q11 = EEst^beta1
7373
@fastmath q = q11 / (qold^beta2)
7474
integrator.q11 = q11
@@ -169,15 +169,15 @@ and overload
169169

170170
```julia
171171
function stepsize_controller!(integrator, controller::CustomController, alg)
172-
...
172+
# ...
173173
nothing
174174
end
175175
function step_accept_controller!(integrator, controller::CustomController, alg)
176-
...
176+
# ...
177177
nothing
178178
end
179179
function step_reject_controller!(integrator, controller::CustomController, alg)
180-
...
180+
# ...
181181
nothing
182182
end
183183
```

docs/src/features/dae_initialization.md

Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ DiffEqBase.ShampineCollocationInit
4040
- Any issues opened that are using `NoInit()` will be immediately closed
4141
- Allowing incorrect initializations is not a supported part of the system
4242
- Using `NoInit()` with inconsistent conditions can lead to:
43-
- Solver instability and crashes
44-
- Incorrect results that may appear plausible
45-
- Undefined behavior in the numerical algorithms
46-
- Silent corruption of the solution
43+
+ Solver instability and crashes
44+
+ Incorrect results that may appear plausible
45+
+ Undefined behavior in the numerical algorithms
46+
+ Silent corruption of the solution
4747

4848
**When to use `CheckInit()` instead:**
4949
- When you believe your initial conditions are consistent
@@ -54,14 +54,14 @@ DiffEqBase.ShampineCollocationInit
5454

5555
## Algorithm Selection Guide
5656

57-
| Algorithm | When to Use | Modifies Variables |
58-
|-----------|-------------|-------------------|
59-
| `DefaultInit()` | Default choice - automatically selects appropriate method | Depends on selection |
60-
| `CheckInit()` | When you've computed consistent conditions yourself | No (verification only) |
61-
| `NoInit()` | ⚠️ **AVOID** - Only for verified consistent conditions | No |
62-
| `OverrideInit()` | With ModelingToolkit problems | Yes (uses custom problem) |
63-
| `BrownFullBasicInit()` | For index-1 DAEs with `differential_vars` | Algebraic variables only |
64-
| `ShampineCollocationInit()` | For general DAEs without structure information | All variables |
57+
| Algorithm | When to Use | Modifies Variables |
58+
|:--------------------------- |:--------------------------------------------------------- |:------------------------- |
59+
| `DefaultInit()` | Default choice - automatically selects appropriate method | Depends on selection |
60+
| `CheckInit()` | When you've computed consistent conditions yourself | No (verification only) |
61+
| `NoInit()` | ⚠️ **AVOID** - Only for verified consistent conditions | No |
62+
| `OverrideInit()` | With ModelingToolkit problems | Yes (uses custom problem) |
63+
| `BrownFullBasicInit()` | For index-1 DAEs with `differential_vars` | Algebraic variables only |
64+
| `ShampineCollocationInit()` | For general DAEs without structure information | All variables |
6565

6666
## Examples
6767

@@ -86,7 +86,7 @@ p = [9.81, 1.0] # g, L
8686
tspan = (0.0, 10.0)
8787

8888
prob = DAEProblem(pendulum!, du0, u0, tspan, p,
89-
differential_vars = [true, true, false])
89+
differential_vars = [true, true, false])
9090

9191
# BrownFullBasicInit will fix the inconsistent du0
9292
sol = solve(prob, DFBDF(), initializealg = BrownFullBasicInit())
@@ -100,7 +100,7 @@ u0_consistent = [1.0, 0.0, 0.0]
100100
du0_consistent = [0.0, -1.0, compute_tension(u0_consistent, p)]
101101

102102
prob2 = DAEProblem(pendulum!, du0_consistent, u0_consistent, tspan, p,
103-
differential_vars = [true, true, false])
103+
differential_vars = [true, true, false])
104104

105105
# RECOMMENDED: Verify they're consistent with CheckInit
106106
sol = solve(prob2, DFBDF(), initializealg = CheckInit())
@@ -169,48 +169,48 @@ sol = solve(prob, IDA(), initializealg = CheckInit()) # Sundials
169169
### Common Issues and Solutions
170170

171171
1. **"Initial conditions are not consistent" error**
172-
- Ensure your `du0` satisfies the DAE constraints at `t0`
173-
- Try using `BrownFullBasicInit()` or `ShampineCollocationInit()` instead of `CheckInit()`
174-
- Check that `differential_vars` correctly identifies differential vs algebraic variables
172+
+ Ensure your `du0` satisfies the DAE constraints at `t0`
173+
+ Try using `BrownFullBasicInit()` or `ShampineCollocationInit()` instead of `CheckInit()`
174+
+ Check that `differential_vars` correctly identifies differential vs algebraic variables
175175

176176
2. **Initialization fails to converge**
177-
- Relax tolerances if using extended versions
178-
- Try a different initialization algorithm
179-
- Provide a better initial guess for algebraic variables
180-
- **Check if your DAE is index-1**: The system may be higher-index (see below)
177+
+ Relax tolerances if using extended versions
178+
+ Try a different initialization algorithm
179+
+ Provide a better initial guess for algebraic variables
180+
+ **Check if your DAE is index-1**: The system may be higher-index (see below)
181181

182182
3. **Solver fails immediately after initialization**
183-
- The initialization might have found a consistent but numerically unstable point
184-
- Try tightening initialization tolerances
185-
- Check problem scaling and consider non-dimensionalization
183+
+ The initialization might have found a consistent but numerically unstable point
184+
+ Try tightening initialization tolerances
185+
+ Check problem scaling and consider non-dimensionalization
186186

187187
4. **DAE is not index-1 (higher-index DAE)**
188-
- Many initialization algorithms only work reliably for index-1 DAEs
189-
- **To check if your DAE is index-1**: The Jacobian of the algebraic equations with respect to the algebraic variables must be non-singular
190-
- **Solution**: Use ModelingToolkit.jl to analyze and potentially reduce the index:
191-
```julia
192-
using ModelingToolkit
188+
+ Many initialization algorithms only work reliably for index-1 DAEs
189+
+ **To check if your DAE is index-1**: The Jacobian of the algebraic equations with respect to the algebraic variables must be non-singular
190+
+ **Solution**: Use ModelingToolkit.jl to analyze and potentially reduce the index:
191+
```julia
192+
using ModelingToolkit
193193

194-
# Define your system with ModelingToolkit
195-
@named sys = ODESystem(eqs, t, vars, params)
194+
# Define your system with ModelingToolkit
195+
@named sys = ODESystem(eqs, t, vars, params)
196196

197-
# Analyze and reduce the index (structural_simplify handles this in v10+)
198-
sys_reduced = structural_simplify(sys)
197+
# Analyze and reduce the index (structural_simplify handles this in v10+)
198+
sys_reduced = structural_simplify(sys)
199199

200-
# The reduced system will be index-1 and easier to initialize
201-
prob = DAEProblem(sys_reduced, [], (0.0, 10.0), params)
202-
```
203-
- ModelingToolkit can automatically detect the index and apply appropriate transformations
204-
- After index reduction, standard initialization algorithms will work more reliably
200+
# The reduced system will be index-1 and easier to initialize
201+
prob = DAEProblem(sys_reduced, [], (0.0, 10.0), params)
202+
```
203+
+ ModelingToolkit can automatically detect the index and apply appropriate transformations
204+
+ After index reduction, standard initialization algorithms will work more reliably
205205

206206
## Performance Tips
207207

208-
1. **Use `differential_vars` when possible**: This helps initialization algorithms understand problem structure
209-
2. **Provide good initial guesses**: Even when using automatic initialization, starting closer to the solution helps
210-
3. **Consider problem-specific initialization**: For complex systems, custom initialization procedures may be more efficient
211-
4. **Use `CheckInit()` when appropriate**: If you know conditions are consistent, skip unnecessary computation
208+
1. **Use `differential_vars` when possible**: This helps initialization algorithms understand problem structure
209+
2. **Provide good initial guesses**: Even when using automatic initialization, starting closer to the solution helps
210+
3. **Consider problem-specific initialization**: For complex systems, custom initialization procedures may be more efficient
211+
4. **Use `CheckInit()` when appropriate**: If you know conditions are consistent, skip unnecessary computation
212212

213213
## References
214214

215-
- Brown, P. N., Hindmarsh, A. C., & Petzold, L. R. (1998). Consistent initial condition calculation for differential-algebraic systems. SIAM Journal on Scientific Computing, 19(5), 1495-1512.
216-
- Shampine, L. F. (2002). Consistent initial condition for differential-algebraic systems. SIAM Journal on Scientific Computing, 22(6), 2007-2026.
215+
- Brown, P. N., Hindmarsh, A. C., & Petzold, L. R. (1998). Consistent initial condition calculation for differential-algebraic systems. SIAM Journal on Scientific Computing, 19(5), 1495-1512.
216+
- Shampine, L. F. (2002). Consistent initial condition for differential-algebraic systems. SIAM Journal on Scientific Computing, 22(6), 2007-2026.

docs/src/tutorials/bvp_example.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,9 @@ end
132132
u0 = [1.0, 1.0, 1.0]
133133
tspan = (0.0, 1.0)
134134
prob = BVP.SecondOrderBVProblem(f!, bc!, u0, tspan)
135-
sol = BVP.solve(prob, BVP.MIRKN4(;
136-
jac_alg = BVP.BVPJacobianAlgorithm(BVP.AutoForwardDiff())); dt = 0.01)
135+
sol = BVP.solve(
136+
prob, BVP.MIRKN4(;
137+
jac_alg = BVP.BVPJacobianAlgorithm(BVP.AutoForwardDiff())); dt = 0.01)
137138
```
138139

139140
## Example 3: Semi-Explicit Boundary Value Differential-Algebraic Equations

docs/src/tutorials/dae_example.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,15 +186,15 @@ u₀_inconsistent = [1.0, 0.0, 0.5] # Sum is 1.5, not 1!
186186
du₀_inconsistent = [-0.04, 0.04, 0.0]
187187
188188
prob_inconsistent = DE.DAEProblem(f2, du₀_inconsistent, u₀_inconsistent, tspan,
189-
differential_vars = differential_vars)
189+
differential_vars = differential_vars)
190190
191191
# This would error with CheckInit() because conditions are inconsistent:
192192
# sol_error = DE.solve(prob_inconsistent, Sundials.IDA(),
193193
# initializealg = DiffEqBase.CheckInit())
194194
195195
# But BrownFullBasicInit() will fix the inconsistency automatically:
196196
sol_fixed = DE.solve(prob_inconsistent, Sundials.IDA(),
197-
initializealg = DiffEqBase.BrownFullBasicInit())
197+
initializealg = DiffEqBase.BrownFullBasicInit())
198198
199199
println("Original (inconsistent) y₃ = ", u₀_inconsistent[3])
200200
println("Corrected y₃ after initialization = ", sol_fixed.u[1][3])

0 commit comments

Comments
 (0)