Skip to content

Commit 2211dd3

Browse files
Update brusselator_prob.jl
1 parent 2a81b87 commit 2211dd3

File tree

1 file changed

+56
-54
lines changed

1 file changed

+56
-54
lines changed

src/ode/brusselator_prob.jl

Lines changed: 56 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,3 @@
1-
"""
2-
2D Brusselator
3-
4-
```math
5-
\\begin{align}
6-
\\frac{\\partial u}{\\partial t} &= 1 + u^2v - 4.4u + \\alpha(\frac{\\partial^2 u}{\\partial x^2} + \frac{\\partial^2 u}{\\partial y^2}) + f(x, y, t)
7-
\\frac{\\partial v}{\\partial t} &= 3.4u - u^2v + \\alpha(\frac{\\partial^2 u}{\\partial x^2} + \frac{\\partial^2 u}{\\partial y^2})
8-
\\end{align}
9-
```
10-
11-
where
12-
13-
```math
14-
f(x, y, t) = \\begin{cases}
15-
5 & \\quad \\text{if } (x-0.3)^2+(y-0.6)^2 ≤ 0.1^2 \\text{ and } t ≥ 1.1 \\\\
16-
0 & \\quad \\text{else}
17-
\\end{cases}
18-
```
19-
20-
and the initial conditions are
21-
22-
```math
23-
\\begin{align}
24-
u(x, y, 0) &= 22\\cdot y(1-y)^{3/2} \\\\
25-
v(x, y, 0) &= 27\\cdot x(1-x)^{3/2}
26-
\\end{align}
27-
```
28-
29-
with the periodic boundary condition
30-
31-
```math
32-
\\begin{align}
33-
u(x+1,y,t) &= u(x,y,t) \\\\
34-
u(x,y+1,t) &= u(x,y,t)
35-
\\end{align}
36-
```
37-
38-
From Hairer Norsett Wanner Solving Ordinary Differential Equations II - Stiff and Differential-Algebraic Problems Page 152
39-
"""
401
brusselator_f(x, y, t) = ifelse((((x-0.3)^2 + (y-0.6)^2) <= 0.1^2) &&
412
(t >= 1.1), 5., 0.)
423
function limit(a, N)
@@ -88,43 +49,53 @@ function init_brusselator_2d(xyd)
8849
u
8950
end
9051
xyd_brusselator = linspace(0,1,32)
91-
prob_ode_brusselator_2d = ODEProblem(brusselator_2d_loop,
92-
init_brusselator_2d(xyd_brusselator),
93-
(0.,11.5),
94-
(3.4, 1., 10.,
95-
xyd_brusselator, step(xyd_brusselator),
96-
length(xyd_brusselator)))
9752

9853
"""
99-
1D Brusselator
54+
2D Brusselator
10055
10156
```math
10257
\\begin{align}
103-
\\frac{\\partial u}{\\partial t} &= A + u^2v - (B+1)u + \\alpha\frac{\\partial^2 u}{\\partial x^2}
104-
\\frac{\\partial v}{\\partial t} &= Bu - u^2v + \\alpha\frac{\\partial^2 u}{\\partial x^2}
58+
\\frac{\\partial u}{\\partial t} &= 1 + u^2v - 4.4u + \\alpha(\frac{\\partial^2 u}{\\partial x^2} + \frac{\\partial^2 u}{\\partial y^2}) + f(x, y, t)
59+
\\frac{\\partial v}{\\partial t} &= 3.4u - u^2v + \\alpha(\frac{\\partial^2 u}{\\partial x^2} + \frac{\\partial^2 u}{\\partial y^2})
10560
\\end{align}
10661
```
10762
63+
where
64+
65+
```math
66+
f(x, y, t) = \\begin{cases}
67+
5 & \\quad \\text{if } (x-0.3)^2+(y-0.6)^2 ≤ 0.1^2 \\text{ and } t ≥ 1.1 \\\\
68+
0 & \\quad \\text{else}
69+
\\end{cases}
70+
```
71+
10872
and the initial conditions are
10973
11074
```math
11175
\\begin{align}
112-
u(x,0) &= 1+\\sin(2π x) \\\\
113-
v(x,0) &= 3
76+
u(x, y, 0) &= 22\\cdot y(1-y)^{3/2} \\\\
77+
v(x, y, 0) &= 27\\cdot x(1-x)^{3/2}
11478
\\end{align}
11579
```
11680
117-
with the boundary condition
81+
with the periodic boundary condition
11882
11983
```math
12084
\\begin{align}
121-
u(0,t) &= u(1,t) = 1 \\\\
122-
v(0,t) &= v(1,t) = 3
85+
u(x+1,y,t) &= u(x,y,t) \\\\
86+
u(x,y+1,t) &= u(x,y,t)
12387
\\end{align}
12488
```
12589
126-
From Hairer Norsett Wanner Solving Ordinary Differential Equations II - Stiff and Differential-Algebraic Problems Page 6
90+
From Hairer Norsett Wanner Solving Ordinary Differential Equations II - Stiff and Differential-Algebraic Problems Page 152
12791
"""
92+
prob_ode_brusselator_2d = ODEProblem(brusselator_2d_loop,
93+
init_brusselator_2d(xyd_brusselator),
94+
(0.,11.5),
95+
(3.4, 1., 10.,
96+
xyd_brusselator, step(xyd_brusselator),
97+
length(xyd_brusselator)))
98+
12899
const N_brusselator_1d = 40
129100
const D_brusselator_u = DerivativeOperator{Float64}(2,2,1/(N_brusselator_1d-1),
130101
N_brusselator_1d,
@@ -156,6 +127,37 @@ function init_brusselator_1d(N)
156127
end
157128
u
158129
end
130+
131+
"""
132+
1D Brusselator
133+
134+
```math
135+
\\begin{align}
136+
\\frac{\\partial u}{\\partial t} &= A + u^2v - (B+1)u + \\alpha\frac{\\partial^2 u}{\\partial x^2}
137+
\\frac{\\partial v}{\\partial t} &= Bu - u^2v + \\alpha\frac{\\partial^2 u}{\\partial x^2}
138+
\\end{align}
139+
```
140+
141+
and the initial conditions are
142+
143+
```math
144+
\\begin{align}
145+
u(x,0) &= 1+\\sin(2π x) \\\\
146+
v(x,0) &= 3
147+
\\end{align}
148+
```
149+
150+
with the boundary condition
151+
152+
```math
153+
\\begin{align}
154+
u(0,t) &= u(1,t) = 1 \\\\
155+
v(0,t) &= v(1,t) = 3
156+
\\end{align}
157+
```
158+
159+
From Hairer Norsett Wanner Solving Ordinary Differential Equations II - Stiff and Differential-Algebraic Problems Page 6
160+
"""
159161
prob_ode_brusselator_1d = ODEProblem(brusselator_1d,
160162
init_brusselator_1d(N_brusselator_1d),
161163
(0.,10.),

0 commit comments

Comments
 (0)