-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathEulerSolver.html
175 lines (160 loc) · 9.23 KB
/
EulerSolver.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
<!DOCTYPE html>
<html>
<head>
<title>Numerical simulation of reaction diffusion systems</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script src="http://code.jquery.com/jquery.js"></script>
<link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css" rel="stylesheet">
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.0/js/bootstrap.min.js"></script>
<script type="text/javascript"
src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>
<script src="compat.js"></script>
<script src="EulerSolver.js"></script>
<script>
function simulationStart() {
window.myG = new EulerSolver;
myG.runSimulation = false;
myG.loopSimulation();
myG.loopVisualization();
}
</script>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','http://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-49634332-1', 'subquantum.tk');
ga('send', 'pageview');
</script>
<style>
html, body {
height: 100%;
}
html {
display: table;
margin: auto;
}
body {
display: table-cell;
vertical-align: middle;
}
.reaconsts > div{
width: 30px;
display:inline-block;
}
</style>
</head>
<body onload="simulationStart();" style="">
<div>
<h3>Visualizing reaction diffusion systems</h3>
</div>
<div>
<canvas id="c" width="500" height="500" style="border:1px solid graytext; background-color: blanchedalmond">Your browser does not support the HTML5 canvas tag.</canvas>
</div>
<div>
Numerical simulation of reaction diffusion systems with an Euler solver.
</div>
<div>
<span class="simulationStatus" style="width: 80px; display: inline-block; background-color: tomato">STOPPED</span>
<button type="button" onclick="if(!myG.runSimulation) {myG.runSimulation = true; myG.loopSimulation(); myG.showStatus('RUNNING', 'greenyellow');}">Start or resume simulation</button>
<button type="button" onclick="if(myG.runSimulation) {myG.runSimulation = false; myG.showStatus('STOPPED', 'rgb(255, 168, 168)');}">Pause simulation</button>
</div>
<div class="runStatus">
Iteration <span class="calcStepIteration" style="width: 80px; display: inline-block;"></span> done in
<span class="calcStepDuration" style="width: 80px; display: inline-block;"></span> milliseconds.
</div>
<div class="equations" style="width: 500px; text-align: left;">
$$ \begin{align}
\\ \frac{\partial G}{\partial t} & = k_1A -k_2G + k_{-2}X + D_g \nabla^2 G
\\ \frac{\partial X}{\partial t} & = k_2G +k_4X^2Y - k_{3}BX - k_5X + D_x \nabla^2 X
\\ \frac{\partial Y}{\partial t} & = k_3BX -k_4X^2Y + D_y \nabla^2 Y
\end{align}
$$
</div>
<div class="loadedGparams btn btn-success pull-right" style="display: none">
<h3>Currently active values</h3>
Initial values and boundary values <br />
A = <input class="A" disabled type="number" style="width: 50px;">
B = <input class="B" disabled type="number" style="width: 50px;">
G = <input class="G" disabled type="number" style="width: 50px;">
X = <input class="X" disabled type="number" style="width: 50px;">
Y = <input class="Y" disabled type="number" style="width: 50px;">
Z = <input class="Z" disabled type="number" style="width: 50px;">
Omega = <input class="Omega" disabled type="number" style="width: 50px;"> <br />
Diffusion constants<br/>
DG = <input class="DG" disabled type="number" style="width: 50px;">
DX = <input class="DX" disabled type="number" style="width: 50px;">
DY = <input class="DY" disabled type="number" style="width: 50px;"> <br />
Reaction constants <br/>
k<sub>1</sub> = <input class="k1" disabled type="number" style="width: 50px;">
k<sub>2</sub> = <input class="k2" disabled type="number" style="width: 50px;">
k<sub>3</sub> = <input class="k3" disabled type="number" style="width: 50px;">
k<sub>4</sub> = <input class="k4" disabled type="number" style="width: 50px;">
k<sub>5</sub> = <input class="k5" disabled type="number" style="width: 50px;"><br />
k<sub>-1</sub> = <input class="k_1" disabled type="number" style="width: 50px;">
k<sub>-2</sub> = <input class="k_2" disabled type="number" style="width: 50px;">
k<sub>-3</sub> = <input class="k_3" disabled type="number" style="width: 50px;">
k<sub>-4</sub> = <input class="k_4" disabled type="number" style="width: 50px;">
k<sub>-5</sub> = <input class="k_5" disabled type="number" style="width: 50px;"><br />
Time resolution dt = <input class="dt" disabled type="number" style="width: 50px;"><br />
Simulation dimensions <br />
width = <input class="width" disabled type="number" value="500" style="width: 50px;">
height = <input class="height" disabled type="number" value="500" style="width: 50px;"><br />
</div>
<div class="newGparams">
<h3>Changeable values</h3>
Initial values and boundary values <br />
A = <input class="A" type="number" style="width: 50px;">
B = <input class="B" type="number" style="width: 50px;">
G = <input class="G" type="number" style="width: 50px;">
X = <input class="X" type="number" style="width: 50px;">
Y = <input class="Y" type="number" style="width: 50px;">
Z = <input class="Z" type="number" style="width: 50px;">
Omega = <input class="Omega" type="number" style="width: 50px;"> <br />
Diffusion constants <br/>
DG = <input class="DG" type="number" style="width: 50px;">
DX = <input class="DX" type="number" style="width: 50px;">
DY = <input class="DY" type="number" style="width: 50px;"> <br />
Reaction constants<br/>
<div class="reaconsts">
<div>k<sub>1</sub> = </div> <input class="k1" type="number" style="width: 50px;">
<div>k<sub>2</sub> = </div> <input class="k2" type="number" style="width: 50px;">
<div>k<sub>3</sub> = </div> <input class="k3" type="number" style="width: 50px;">
<div>k<sub>4</sub> = </div> <input class="k4" type="number" style="width: 50px;">
<div>k<sub>5</sub> = </div> <input class="k5" type="number" style="width: 50px;"><br />
<div>k<sub>-1</sub> = </div> <input class="k_1" type="number" style="width: 50px;">
<div>k<sub>-2</sub> = </div> <input class="k_2" type="number" style="width: 50px;">
<div>k<sub>-3</sub> = </div> <input class="k_3" type="number" style="width: 50px;">
<div>k<sub>-4</sub> = </div> <input class="k_4" type="number" style="width: 50px;">
<div>k<sub>-5</sub> = </div> <input class="k_5" type="number" style="width: 50px;"><br />
</div>
Time resolution dt = <input class="dt" type="number" style="width: 50px;"><br />
Simulation dimensions <br />
width = <input class="width" type="number" value="500" style="width: 50px;">
height = <input class="height" type="number" value="500" style="width: 50px;"><br />
Boundary periodic topology: Horizontal: <input class="periodicH" type="checkbox">,
Vertical: <input class="periodicV" type="checkbox"><br />
Boundary shapes <select name="select" class="maskSelect" onchange="myG.mask = this.value;">
<option selected>none</option>
<option>elliptic</option>
<option>vertical</option>
<option>horizontal</option>
<option>rhombic</option>
<option>triangle</option>
<option>innerElliptic</option>
</select>. Boundary shape size <span id="boundaryShapeSize"></span>
<input type="range" class="shapeSize" min="0" max="1" step="0.0001"
oninput= "myG.maskParam = parseFloat(this.value);document.getElementById('boundaryShapeSize').innerHTML = this.value"
onchange="myG.maskParam = parseFloat(this.value);document.getElementById('boundaryShapeSize').innerHTML = this.value">
</div>
<div>
<button type="button" onclick="myG.loadNewParamsFromView();">Use values in simulation</button>
<button type="button" onclick="myG.initializeArrays();">Initialize simulation array</button>
</div>
<div>
<hr>
Made by David Jonsson [email protected] 2014, 2015
</div>
</body>
</html>