Skip to content

Fix prob_ode_brusselator_1d: undefined N, vector dx, missing BCs#180

Merged
ChrisRackauckas merged 2 commits intoSciML:masterfrom
ChrisRackauckas-Claude:fix-brusselator-1d
Apr 8, 2026
Merged

Fix prob_ode_brusselator_1d: undefined N, vector dx, missing BCs#180
ChrisRackauckas merged 2 commits intoSciML:masterfrom
ChrisRackauckas-Claude:fix-brusselator-1d

Conversation

@ChrisRackauckas-Claude
Copy link
Copy Markdown
Contributor

Summary

Fixes #179prob_ode_brusselator_1d errors with MethodError: no method matching ^(::Vector{Float64}, ::Int64).

Three bugs in brusselator_1d_loop:

  • Used undefined N instead of N_brusselator_1d in loop bound
  • Problem parameters passed zeros(N_brusselator_1d) (a Vector) as dx, causing dx^2 to fail. Now passes scalar 1.0/(N-1) matching the grid spacing from init_brusselator_1d.
  • Boundary derivatives du[1,:] and du[N,:] were never zeroed for the Dirichlet boundary conditions (u(0,t)=1, v(0,t)=3, u(1,t)=1, v(1,t)=3).
  • Also removed stale reference to xyd_brusselator (a 2D-only variable) inside the 1D function.
  • Set alpha = 0.02 as the diffusion coefficient (standard value from HNW).

Test plan

  • solve(prob_ode_brusselator_1d, Rodas5P()) completes successfully with retcode=Success
  • Pkg.test() passes (only pre-existing Aqua stale deps failure for OrdinaryDiffEq)
  • Runic formatting check passes

🤖 Generated with Claude Code

ChrisRackauckas and others added 2 commits April 8, 2026 10:35
… conditions

Three bugs in brusselator_1d_loop:
1. Used undefined `N` instead of `N_brusselator_1d` in loop bound
2. Problem parameters passed `zeros(N_brusselator_1d)` (a Vector) as `dx`,
   causing `dx^2` to error with MethodError. Now passes scalar `1/(N-1)`.
3. Boundary derivatives du[1,:] and du[N,:] were never zeroed for the
   Dirichlet boundary conditions.

Also removed stale reference to `xyd_brusselator` (2D-only variable).

Fixes SciML#179

Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Loop over all N points using the existing `limit` function for index
wrapping (consistent with the 2D brusselator). Update dx to 1/N and
fix docstring to document periodic BCs.

Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@ChrisRackauckas ChrisRackauckas merged commit 58707bb into SciML:master Apr 8, 2026
18 of 19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

prob_ode_brusselator_1d is broken

2 participants