|
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 | | -""" |
40 | 1 | brusselator_f(x, y, t) = ifelse((((x-0.3)^2 + (y-0.6)^2) <= 0.1^2) && |
41 | 2 | (t >= 1.1), 5., 0.) |
42 | 3 | function limit(a, N) |
@@ -88,43 +49,53 @@ function init_brusselator_2d(xyd) |
88 | 49 | u |
89 | 50 | end |
90 | 51 | 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))) |
97 | 52 |
|
98 | 53 | """ |
99 | | -1D Brusselator |
| 54 | +2D Brusselator |
100 | 55 |
|
101 | 56 | ```math |
102 | 57 | \\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}) |
105 | 60 | \\end{align} |
106 | 61 | ``` |
107 | 62 |
|
| 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 | +
|
108 | 72 | and the initial conditions are |
109 | 73 |
|
110 | 74 | ```math |
111 | 75 | \\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} |
114 | 78 | \\end{align} |
115 | 79 | ``` |
116 | 80 |
|
117 | | -with the boundary condition |
| 81 | +with the periodic boundary condition |
118 | 82 |
|
119 | 83 | ```math |
120 | 84 | \\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) |
123 | 87 | \\end{align} |
124 | 88 | ``` |
125 | 89 |
|
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 |
127 | 91 | """ |
| 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 | + |
128 | 99 | const N_brusselator_1d = 40 |
129 | 100 | const D_brusselator_u = DerivativeOperator{Float64}(2,2,1/(N_brusselator_1d-1), |
130 | 101 | N_brusselator_1d, |
@@ -156,6 +127,37 @@ function init_brusselator_1d(N) |
156 | 127 | end |
157 | 128 | u |
158 | 129 | 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 | +""" |
159 | 161 | prob_ode_brusselator_1d = ODEProblem(brusselator_1d, |
160 | 162 | init_brusselator_1d(N_brusselator_1d), |
161 | 163 | (0.,10.), |
|
0 commit comments