forked from gfrd/gfrd.github.com
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvisualization.html
167 lines (129 loc) · 6.77 KB
/
visualization.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
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>eGFRD visualization</title>
<link rel="stylesheet" href="/css/reset.css" type="text/css"/>
<link rel="stylesheet" href="/css/style.css" type="text/css"/>
<link rel="stylesheet" href="/css/syntax.css" type="text/css"/>
<link rel="stylesheet" href="/css/menu.css" type="text/css"/>
<link rel="stylesheet" href="/css/footer.css" type="text/css"/>
<!--[if lt IE 9]>
<script src="/ie7/IE9.js"></script>
<![endif]-->
</head>
<body>
<div id="globalheader">
<!--googleoff: all-->
<ul id="globalnav">
<li id="gn-home"><a href="/">Home</a></li>
<li id="gn-algorithm"><a href="/algorithm">Algorithm</a></li>
<li id="gn-background"><a href="/background">Background</a></li>
<li id="gn-downloads"><a href="/downloads">Downloads</a></li>
<li id="gn-documentation"><a href="/documentation">Documentation</a></li>
<li id="gn-support"><a href="/support">Support</a></li>
<li class="gn-empty"><a></a></li>
</ul>
<!--googleon: all-->
<div id="lastbutton"> </div>
</div>
<h1>Visualization</h1>
<div id="container">
<p>This same information can also be found in the file
<a href="http://github.com/gfrd/gfrd/tree/develop/doc/visualization.txt">visualization.txt</a>.</p>
<h2>Setting up the simulation</h2>
<ul>
<li>Setup the vtklogger like this in your simulation script (also see
<egfrdDirectory>/samples/example/example.py):</li>
</ul>
<div class="highlight"><pre><code class="python"><span class="n">s</span><span class="o">.</span><span class="n">initialize</span><span class="p">()</span>
<span class="n">vtklogger</span> <span class="o">=</span> <span class="n">VTKLogger</span><span class="p">(</span><span class="n">s</span><span class="p">,</span> <span class="s">'<mySimulationDataDirectory>'</span><span class="p">)</span>
<span class="k">while</span><span class="p">(</span><span class="bp">True</span><span class="p">):</span>
<span class="k">try</span><span class="p">:</span>
<span class="n">vtklogger</span><span class="o">.</span><span class="n">log</span><span class="p">()</span>
<span class="n">s</span><span class="o">.</span><span class="n">step</span><span class="p">()</span>
<span class="k">except</span> <span class="ne">RuntimeError</span><span class="p">,</span> <span class="n">message</span><span class="p">:</span>
<span class="k">print</span> <span class="s">'Error.'</span><span class="p">,</span> <span class="n">message</span>
<span class="k">break</span>
<span class="n">vtklogger</span><span class="o">.</span><span class="n">stop</span><span class="p">()</span>
<span class="n">s</span><span class="o">.</span><span class="n">stop</span><span class="p">(</span><span class="n">s</span><span class="o">.</span><span class="n">t</span><span class="p">)</span>
</code></pre>
</div>
<ul>
<li>Replace ‘<mySimulationDataDirectory>’ by a descriptive name for each
simulation that you run. It can be a nested directory structure, like
‘data/10000steps/run1’, and is automatically created inside the directory
that contains your simulation script.</li>
</ul>
<h2>Configuration options to VTKLogger</h2>
<div class="highlight"><pre><code class="python"><span class="n">bufferSize</span><span class="o">=</span><span class="bp">None</span>
</code></pre>
</div>
<p>By default the simulation data files are written directly during the
simulation. By specifying a bufferSize, all data is stored in a buffer during
the simulation, and the VTKLogger only writes the data for the last
‘bufferSize’ simulation steps after the simulation has finished.</p>
<div class="highlight"><pre><code class="python"><span class="n">brownian</span><span class="o">=</span><span class="bp">False</span>
</code></pre>
</div>
<p>If brownian is set to True, no shell data is written.</p>
<div class="highlight"><pre><code class="python"><span class="n">extraParticleStep</span><span class="o">=</span><span class="bp">True</span>
</code></pre>
</div>
<p>By default the VTKLogger writes 2 visualization steps for each simulation
step. In the first visualization step only the active particle is updated, in
the second visualization step the active shell is updated (and the next shell
changes to blue). If extraParticleStep is set to False, these two steps are
combined into one.</p>
<h2>Running the simulation</h2>
<ul>
<li>Run the simulation script.</li>
</ul>
<div class="highlight"><pre><code class="python"><span class="n">PYTHONPATH</span><span class="o">=../../</span> <span class="n">python</span> <span class="n">run</span><span class="o">.</span><span class="n">py</span>
</code></pre>
</div>
<ul>
<li><p>This should produce the files static.pvd and files.pvd inside the
simulation data directory specified in your simulation script. The former
contains static information about the surfaces you defined in your
simulation. The latter contains a list of references to .vtu files. For each
timestep there is a .vtu file that contains information about the particles,
a .vtu file for the sphericle shells, and a .vtu file for all the
cylindrical shells.</p></li>
<li><p>When not using a buffer, i.e. option 2, the .vtu files are created during
the simulation. However, we have to wait for the simulation to finish before
we can visualize the data using Paraview. It is not till the call to
vtklogger.stop() that files.pvd is created with an overview of all .vtu
files. For this reason the visualization can not be shown real-time
at the moment.</p></li>
</ul>
<h2>Visualizing the data</h2>
<ul>
<li><p>In the file <egfrdDirectory>/paraview/visualization.py change the variable
paraview_scripts_directory to ‘<egfrdDirectory>/paraview’ and the variable
simulation_data_directory to the location of your simulation data as
specified in your simulation script. These need to be absolute paths.</p></li>
<li><p>Start Paraview.</p></li>
<li><p>Go to Tools > Python Shell.</p></li>
<li><p>Click ‘Run Script’.</p></li>
<li><p>Select <egfrdDirectory>/paraview/visualization.py.</p></li>
<li><p>You should see a pipeline being build up.</p></li>
<li><p>Click the play button. You should see an animation of your simulation.</p></li>
</ul>
<h2>Rerunning a simulation</h2>
<ul>
<li>If you run a new simulation that writes to the same simulation data
directory, usually Paraview will reload the new data correctly. There can be
a problem if you increase or decrease the number of timesteps. If so, rerun
the Python script that builds the pipeline (see above).</li>
</ul>
</div>
<div id="globalfooter">
<p>Copyright © 2012 FOM institute AMOLF</p>
<ul class="piped">
<li><a href="/about">About</a></li>
<li><a href="/credits">Credits</a></li>
</ul>
</div>
</body>
</html>