Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
168 lines (129 sloc) 6.77 KB
<!DOCTYPE html>
<html xmlns="">
<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>
<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>
<!--googleon: all-->
<div id="lastbutton"> </div>
<div id="container">
<p>This same information can also be found in the file
<a href="">visualization.txt</a>.</p>
<h2>Setting up the simulation</h2>
<li>Setup the vtklogger like this in your simulation script (also see
<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">&#39;&lt;mySimulationDataDirectory&gt;&#39;</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">&#39;Error.&#39;</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>
<li>Replace &lsquo;&lt;mySimulationDataDirectory>&rsquo; by a descriptive name for each
simulation that you run. It can be a nested directory structure, like
&lsquo;data/10000steps/run1&rsquo;, and is automatically created inside the directory
that contains your simulation script.</li>
<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>
<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
&lsquo;bufferSize&rsquo; 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>
<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>
<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>
<li>Run the simulation script.</li>
<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>
<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>
<h2>Visualizing the data</h2>
<li><p>In the file &lt;egfrdDirectory>/paraview/ change the variable
paraview_scripts_directory to &lsquo;&lt;egfrdDirectory>/paraview&rsquo; 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 &lsquo;Run Script&rsquo;.</p></li>
<li><p>Select &lt;egfrdDirectory>/paraview/</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>
<h2>Rerunning a simulation</h2>
<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>
<div id="globalfooter">
<p>Copyright &copy; 2010 FOM institute AMOLF</p>
<ul class="piped">
<li><a href="/about">About</a></li>
<li><a href="/credits">Credits</a></li>