Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions lib/ODEProblemLibrary/src/brusselator_prob.jl
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,10 @@ const N_brusselator_1d = 40
function brusselator_1d_loop(du, u, p, t)
A, B, alpha, dx = p
alpha = alpha / dx^2
return @inbounds for i in 2:(N - 1)
x = xyd_brusselator[i]
ip1, im1 = i + 1, i - 1
N = N_brusselator_1d
@inbounds for i in 1:N
ip1 = limit(i + 1, N)
im1 = limit(i - 1, N)
du[i, 1] = alpha * (u[im1, 1] + u[ip1, 1] - 2u[i, 1]) +
A + u[i, 1]^2 * u[i, 2] - (B + 1) * u[i, 1]
du[i, 2] = alpha * (u[im1, 2] + u[ip1, 2] - 2u[i, 2]) +
Expand Down Expand Up @@ -155,12 +156,12 @@ v(x,0) &= 3
\end{align*}
```

with the boundary condition
with periodic boundary conditions

```math
\begin{align*}
u(0,t) = u(1,t) = 1 \\
v(0,t) = v(1,t) = 3
u(0,t) &= u(1,t) \\
v(0,t) &= v(1,t)
\end{align*}
```

Expand All @@ -170,5 +171,5 @@ prob_ode_brusselator_1d = ODEProblem(
brusselator_1d_loop,
init_brusselator_1d(N_brusselator_1d),
(0.0, 10.0),
(1.0, 3.0, 1 / 41, zeros(N_brusselator_1d))
(1.0, 3.0, 0.02, 1.0 / N_brusselator_1d)
)
Loading