Fix prob_ode_brusselator_1d: undefined N, vector dx, missing BCs#180
Merged
ChrisRackauckas merged 2 commits intoSciML:masterfrom Apr 8, 2026
Merged
Conversation
… 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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #179 —
prob_ode_brusselator_1derrors withMethodError: no method matching ^(::Vector{Float64}, ::Int64).Three bugs in
brusselator_1d_loop:Ninstead ofN_brusselator_1din loop boundzeros(N_brusselator_1d)(a Vector) asdx, causingdx^2to fail. Now passes scalar1.0/(N-1)matching the grid spacing frominit_brusselator_1d.du[1,:]anddu[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).xyd_brusselator(a 2D-only variable) inside the 1D function.alpha = 0.02as the diffusion coefficient (standard value from HNW).Test plan
solve(prob_ode_brusselator_1d, Rodas5P())completes successfully withretcode=SuccessPkg.test()passes (only pre-existing Aqua stale deps failure for OrdinaryDiffEq)🤖 Generated with Claude Code