7 Commits

Author SHA1 Message Date
c799d8e19f Add seaborn 2023-10-24 22:44:55 +02:00
df38780e69 Add docs for Python 2023-10-24 21:49:26 +02:00
36ee519964 Update docs 2023-10-24 21:49:13 +02:00
bd67af34c0 Update doc 2023-10-24 21:33:44 +02:00
111d267385 Exclude Python scripts 2023-10-24 21:33:30 +02:00
e4e608248f Fix some things for the long program 2023-10-24 21:25:41 +02:00
95af969987 Add batch system 2023-10-24 21:24:27 +02:00
85 changed files with 4197 additions and 1802 deletions

1
.gitignore vendored
View File

@@ -37,7 +37,6 @@
*.out
*.synctex.gz
*.bbl
*.blg
latex/mainNotes.bib

View File

@@ -81,6 +81,29 @@ If you have any problems running the scripts, you might have to run this instead
python3 scripts/<script-name>
```
### Batch system
For the **frequency_narrow_sweeps_long** program, the is a script called
**job.script** that comes along with it. This is to be able to run it on a
batch system using Slurm if you have access to one.
This is the recommended way to use this program as it takes approximately 90
minutes to complete when using 16 cores.
If you happen to have such a system available to you, then you should clone
this repo on that system, then compile it by running:
```shell
make frequency_narrow_sweeps_long
```
You might have to load the Armadillo library before compiling.
After compiling, you can schedule it by running:
```shell
sbatch job.script
```
## Performance
This section aims to give an idea to the time it takes for the program to

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 MiB

After

Width:  |  Height:  |  Size: 2.0 MiB

View File

@@ -113,7 +113,7 @@ $(document).ready(function(){initNavTree('Particle_8cpp.html',''); initResizable
<dd>
Janita Ovidie Sandtrøen Willumsen (janitaws)</dd></dl>
<dl class="section version"><dt>Version</dt><dd>1.0</dd></dl>
<dl class="bug"><dt><b><a class="el" href="bug.html#_bug000007">Bug:</a></b></dt><dd>No known bugs </dd></dl>
<dl class="bug"><dt><b><a class="el" href="bug.html#_bug000008">Bug:</a></b></dt><dd>No known bugs </dd></dl>
<p class="definition">Definition in file <a class="el" href="Particle_8cpp_source.html">Particle.cpp</a>.</p>
</div></div><!-- contents -->

View File

@@ -104,12 +104,12 @@ $(document).ready(function(){initNavTree('PenningTrap_8cpp.html',''); initResiza
<p>The implementation of the <a class="el" href="classPenningTrap.html" title="A class that simulates a Penning trap.">PenningTrap</a> class.
<a href="#details">More...</a></p>
<div class="textblock"><code>#include &quot;<a class="el" href="PenningTrap_8hpp_source.html">PenningTrap.hpp</a>&quot;</code><br />
<code>#include &quot;<a class="el" href="typedefs_8hpp_source.html">typedefs.hpp</a>&quot;</code><br />
<code>#include &lt;algorithm&gt;</code><br />
<div class="textblock"><code>#include &lt;algorithm&gt;</code><br />
<code>#include &lt;functional&gt;</code><br />
<code>#include &lt;sys/types.h&gt;</code><br />
<code>#include &lt;vector&gt;</code><br />
<code>#include &quot;<a class="el" href="PenningTrap_8hpp_source.html">PenningTrap.hpp</a>&quot;</code><br />
<code>#include &quot;<a class="el" href="typedefs_8hpp_source.html">typedefs.hpp</a>&quot;</code><br />
</div>
<p><a href="PenningTrap_8cpp_source.html">Go to the source code of this file.</a></p>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
@@ -118,7 +118,7 @@ $(document).ready(function(){initNavTree('PenningTrap_8cpp.html',''); initResiza
<dd>
Janita Ovidie Sandtrøen Willumsen (janitaws)</dd></dl>
<dl class="section version"><dt>Version</dt><dd>1.0</dd></dl>
<dl class="bug"><dt><b><a class="el" href="bug.html#_bug000008">Bug:</a></b></dt><dd>No known bugs </dd></dl>
<dl class="bug"><dt><b><a class="el" href="bug.html#_bug000009">Bug:</a></b></dt><dd>No known bugs </dd></dl>
<p class="definition">Definition in file <a class="el" href="PenningTrap_8cpp_source.html">PenningTrap.cpp</a>.</p>
</div></div><!-- contents -->

View File

@@ -102,351 +102,367 @@ $(document).ready(function(){initNavTree('PenningTrap_8cpp_source.html',''); ini
</div><!--header-->
<div class="contents">
<a href="PenningTrap_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a id="l00001" name="l00001"></a><span class="lineno"> 1</span> </div>
<div class="line"><a id="l00013" name="l00013"></a><span class="lineno"> 13</span><span class="preprocessor">#include &quot;<a class="code" href="PenningTrap_8hpp.html">PenningTrap.hpp</a>&quot;</span></div>
<div class="line"><a id="l00014" name="l00014"></a><span class="lineno"> 14</span><span class="preprocessor">#include &quot;<a class="code" href="typedefs_8hpp.html">typedefs.hpp</a>&quot;</span></div>
<div class="line"><a id="l00015" name="l00015"></a><span class="lineno"> 15</span><span class="preprocessor">#include &lt;algorithm&gt;</span></div>
<div class="line"><a id="l00016" name="l00016"></a><span class="lineno"> 16</span><span class="preprocessor">#include &lt;functional&gt;</span></div>
<div class="line"><a id="l00017" name="l00017"></a><span class="lineno"> 17</span><span class="preprocessor">#include &lt;sys/types.h&gt;</span></div>
<div class="line"><a id="l00018" name="l00018"></a><span class="lineno"> 18</span><span class="preprocessor">#include &lt;vector&gt;</span></div>
<div class="line"><a id="l00019" name="l00019"></a><span class="lineno"> 19</span> </div>
<div class="line"><a id="l00020" name="l00020"></a><span class="lineno"><a class="line" href="classPenningTrap.html#a3c0a44e4e0a94366ff609e81fe463fa2"> 20</a></span><a class="code hl_typedef" href="typedefs_8hpp.html#a3bdfb73a02f88ae32b6128ef747c4aea">vec3</a> <a class="code hl_function" href="classPenningTrap.html#a3c0a44e4e0a94366ff609e81fe463fa2">PenningTrap::v_func</a>(uint i, uint j, <span class="keywordtype">double</span> dt)</div>
<div class="line"><a id="l00021" name="l00021"></a><span class="lineno"> 21</span>{</div>
<div class="line"><a id="l00022" name="l00022"></a><span class="lineno"> 22</span> <span class="keywordflow">switch</span> (i) {</div>
<div class="line"><a id="l00023" name="l00023"></a><span class="lineno"> 23</span> <span class="keywordflow">case</span> 0:</div>
<div class="line"><a id="l00024" name="l00024"></a><span class="lineno"> 24</span> <span class="keywordflow">return</span> .5 * dt * this-&gt;<a class="code hl_variable" href="classPenningTrap.html#ae9b5afdaa5cd366e94bd294452a1eed4">k_v</a>[0][j];</div>
<div class="line"><a id="l00025" name="l00025"></a><span class="lineno"> 25</span> <span class="keywordflow">case</span> 1:</div>
<div class="line"><a id="l00026" name="l00026"></a><span class="lineno"> 26</span> <span class="keywordflow">return</span> .5 * dt * this-&gt;k_v[1][j];</div>
<div class="line"><a id="l00027" name="l00027"></a><span class="lineno"> 27</span> <span class="keywordflow">case</span> 2:</div>
<div class="line"><a id="l00028" name="l00028"></a><span class="lineno"> 28</span> <span class="keywordflow">return</span> dt * this-&gt;k_v[2][j];</div>
<div class="line"><a id="l00029" name="l00029"></a><span class="lineno"> 29</span> <span class="keywordflow">case</span> 3:</div>
<div class="line"><a id="l00030" name="l00030"></a><span class="lineno"> 30</span> <span class="keywordflow">return</span> <a class="code hl_typedef" href="typedefs_8hpp.html#a3bdfb73a02f88ae32b6128ef747c4aea">vec3</a>((dt / 6.)</div>
<div class="line"><a id="l00031" name="l00031"></a><span class="lineno"> 31</span> * (this-&gt;k_v[0][j] + 2. * this-&gt;k_v[1][j]</div>
<div class="line"><a id="l00032" name="l00032"></a><span class="lineno"> 32</span> + 2. * this-&gt;k_v[2][j] + this-&gt;k_v[3][j]));</div>
<div class="line"><a id="l00033" name="l00033"></a><span class="lineno"> 33</span> <span class="keywordflow">default</span>:</div>
<div class="line"><a id="l00034" name="l00034"></a><span class="lineno"> 34</span> std::cout &lt;&lt; <span class="stringliteral">&quot;Not valid!&quot;</span> &lt;&lt; std::endl;</div>
<div class="line"><a id="l00035" name="l00035"></a><span class="lineno"> 35</span> abort();</div>
<div class="line"><a id="l00036" name="l00036"></a><span class="lineno"> 36</span> }</div>
<div class="line"><a id="l00037" name="l00037"></a><span class="lineno"> 37</span>}</div>
<div class="line"><a id="l00038" name="l00038"></a><span class="lineno"> 38</span> </div>
<div class="line"><a id="l00039" name="l00039"></a><span class="lineno"><a class="line" href="classPenningTrap.html#a826b7fa8e709d481eb1dee7d0c2cdc08"> 39</a></span><a class="code hl_typedef" href="typedefs_8hpp.html#a3bdfb73a02f88ae32b6128ef747c4aea">vec3</a> <a class="code hl_function" href="classPenningTrap.html#a826b7fa8e709d481eb1dee7d0c2cdc08">PenningTrap::r_func</a>(uint i, uint j, <span class="keywordtype">double</span> dt)</div>
<div class="line"><a id="l00040" name="l00040"></a><span class="lineno"> 40</span>{</div>
<div class="line"><a id="l00041" name="l00041"></a><span class="lineno"> 41</span> <span class="keywordflow">switch</span> (i) {</div>
<div class="line"><a id="l00042" name="l00042"></a><span class="lineno"> 42</span> <span class="keywordflow">case</span> 0:</div>
<div class="line"><a id="l00043" name="l00043"></a><span class="lineno"> 43</span> <span class="keywordflow">return</span> .5 * dt * this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a2f168622587709b9e3c49077f0b9a640">k_r</a>[0][j];</div>
<div class="line"><a id="l00044" name="l00044"></a><span class="lineno"> 44</span> <span class="keywordflow">case</span> 1:</div>
<div class="line"><a id="l00045" name="l00045"></a><span class="lineno"> 45</span> <span class="keywordflow">return</span> .5 * dt * this-&gt;k_r[1][j];</div>
<div class="line"><a id="l00046" name="l00046"></a><span class="lineno"> 46</span> <span class="keywordflow">case</span> 2:</div>
<div class="line"><a id="l00047" name="l00047"></a><span class="lineno"> 47</span> <span class="keywordflow">return</span> dt * this-&gt;k_r[2][j];</div>
<div class="line"><a id="l00048" name="l00048"></a><span class="lineno"> 48</span> <span class="keywordflow">case</span> 3:</div>
<div class="line"><a id="l00049" name="l00049"></a><span class="lineno"> 49</span> <span class="keywordflow">return</span> <a class="code hl_typedef" href="typedefs_8hpp.html#a3bdfb73a02f88ae32b6128ef747c4aea">vec3</a>((dt / 6.)</div>
<div class="line"><a id="l00050" name="l00050"></a><span class="lineno"> 50</span> * (this-&gt;k_r[0][j] + 2. * this-&gt;k_r[1][j]</div>
<div class="line"><a id="l00051" name="l00051"></a><span class="lineno"> 51</span> + 2. * this-&gt;k_r[2][j] + this-&gt;k_r[3][j]));</div>
<div class="line"><a id="l00052" name="l00052"></a><span class="lineno"> 52</span> <span class="keywordflow">default</span>:</div>
<div class="line"><a id="l00053" name="l00053"></a><span class="lineno"> 53</span> std::cout &lt;&lt; <span class="stringliteral">&quot;Not valid!&quot;</span> &lt;&lt; std::endl;</div>
<div class="line"><a id="l00054" name="l00054"></a><span class="lineno"> 54</span> abort();</div>
<div class="line"><a id="l00055" name="l00055"></a><span class="lineno"> 55</span> }</div>
<div class="line"><a id="l00056" name="l00056"></a><span class="lineno"> 56</span>}</div>
<div class="line"><a id="l00057" name="l00057"></a><span class="lineno"> 57</span> </div>
<div class="line"><a id="l00058" name="l00058"></a><span class="lineno"><a class="line" href="classPenningTrap.html#a5846c8f75cdc543fd9cf0b2185a3ef22"> 58</a></span><a class="code hl_typedef" href="typedefs_8hpp.html#a3bdfb73a02f88ae32b6128ef747c4aea">vec3</a> <a class="code hl_function" href="classPenningTrap.html#a5846c8f75cdc543fd9cf0b2185a3ef22">PenningTrap::external_E_field</a>(<a class="code hl_typedef" href="typedefs_8hpp.html#a3bdfb73a02f88ae32b6128ef747c4aea">vec3</a> r)</div>
<div class="line"><a id="l00059" name="l00059"></a><span class="lineno"> 59</span>{</div>
<div class="line"><a id="l00060" name="l00060"></a><span class="lineno"> 60</span> r(2) *= -2.;</div>
<div class="line"><a id="l00061" name="l00061"></a><span class="lineno"> 61</span> </div>
<div class="line"><a id="l00062" name="l00062"></a><span class="lineno"> 62</span> <span class="keywordflow">return</span> <a class="code hl_typedef" href="typedefs_8hpp.html#a3bdfb73a02f88ae32b6128ef747c4aea">vec3</a>((this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a715329844d75ec4c04f8391421fb4e89">V_0</a> * this-&gt;<a class="code hl_variable" href="classPenningTrap.html#ae915f6ad0eef1fb46530e836b6e071e5">perturbation</a>(this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a8ca4e21291f60fde619c14099d8c4e8e">t</a>) / (this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a66dfe89c68716b9502927b97f59c27d2">d</a> * this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a66dfe89c68716b9502927b97f59c27d2">d</a>))</div>
<div class="line"><a id="l00063" name="l00063"></a><span class="lineno"> 63</span> * r);</div>
<div class="line"><a id="l00064" name="l00064"></a><span class="lineno"> 64</span>}</div>
<div class="line"><a id="l00065" name="l00065"></a><span class="lineno"> 65</span> </div>
<div class="line"><a id="l00066" name="l00066"></a><span class="lineno"><a class="line" href="classPenningTrap.html#a361f2c4862c90b5e8e2a2f50c6a95655"> 66</a></span><a class="code hl_typedef" href="typedefs_8hpp.html#a3bdfb73a02f88ae32b6128ef747c4aea">vec3</a> <a class="code hl_function" href="classPenningTrap.html#a361f2c4862c90b5e8e2a2f50c6a95655">PenningTrap::external_B_field</a>(<a class="code hl_typedef" href="typedefs_8hpp.html#a3bdfb73a02f88ae32b6128ef747c4aea">vec3</a> r)</div>
<div class="line"><a id="l00067" name="l00067"></a><span class="lineno"> 67</span>{</div>
<div class="line"><a id="l00068" name="l00068"></a><span class="lineno"> 68</span> <span class="keywordflow">return</span> <a class="code hl_typedef" href="typedefs_8hpp.html#a3bdfb73a02f88ae32b6128ef747c4aea">vec3</a>{0., 0., this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a0cac3509aa96e71a26d3b2c902e27716">B_0</a>};</div>
<div class="line"><a id="l00069" name="l00069"></a><span class="lineno"> 69</span>}</div>
<div class="line"><a id="l00070" name="l00070"></a><span class="lineno"> 70</span> </div>
<div class="line"><a id="l00071" name="l00071"></a><span class="lineno"><a class="line" href="classPenningTrap.html#a7f210bb2768a5d79ced4b0df0df97598"> 71</a></span><a class="code hl_typedef" href="typedefs_8hpp.html#a3bdfb73a02f88ae32b6128ef747c4aea">vec3</a> <a class="code hl_function" href="classPenningTrap.html#a7f210bb2768a5d79ced4b0df0df97598">PenningTrap::force_on_particle</a>(uint i, uint j)</div>
<div class="line"><a id="l00072" name="l00072"></a><span class="lineno"> 72</span>{</div>
<div class="line"><a id="l00073" name="l00073"></a><span class="lineno"> 73</span> <span class="comment">// Calculate the difference between the particles&#39; position</span></div>
<div class="line"><a id="l00074" name="l00074"></a><span class="lineno"> 74</span> <a class="code hl_typedef" href="typedefs_8hpp.html#a3bdfb73a02f88ae32b6128ef747c4aea">vec3</a> res = this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a0112525d9e79a472e761f8ef402a339f">particles</a>[i].r_vec - this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a0112525d9e79a472e761f8ef402a339f">particles</a>[j].r_vec;</div>
<div class="line"><a id="l00075" name="l00075"></a><span class="lineno"> 75</span> </div>
<div class="line"><a id="l00076" name="l00076"></a><span class="lineno"> 76</span> <span class="comment">// Get the distance between the particles</span></div>
<div class="line"><a id="l00077" name="l00077"></a><span class="lineno"> 77</span> <span class="keywordtype">double</span> norm = arma::norm(res, 2);</div>
<div class="line"><a id="l00078" name="l00078"></a><span class="lineno"> 78</span> </div>
<div class="line"><a id="l00079" name="l00079"></a><span class="lineno"> 79</span> <span class="keywordflow">return</span> <a class="code hl_typedef" href="typedefs_8hpp.html#a3bdfb73a02f88ae32b6128ef747c4aea">vec3</a>((this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a0112525d9e79a472e761f8ef402a339f">particles</a>[j].q / (norm * norm * norm)) * res);</div>
<div class="line"><a id="l00080" name="l00080"></a><span class="lineno"> 80</span>}</div>
<div class="line"><a id="l00081" name="l00081"></a><span class="lineno"> 81</span> </div>
<div class="line"><a id="l00082" name="l00082"></a><span class="lineno"><a class="line" href="classPenningTrap.html#a2c01108b52c8e2a003cf9170da9e7682"> 82</a></span><a class="code hl_typedef" href="typedefs_8hpp.html#a3bdfb73a02f88ae32b6128ef747c4aea">vec3</a> <a class="code hl_function" href="classPenningTrap.html#a2c01108b52c8e2a003cf9170da9e7682">PenningTrap::total_force_external</a>(uint i)</div>
<div class="line"><a id="l00083" name="l00083"></a><span class="lineno"> 83</span>{</div>
<div class="line"><a id="l00084" name="l00084"></a><span class="lineno"> 84</span> <a class="code hl_class" href="classParticle.html">Particle</a> *p = &amp;this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a0112525d9e79a472e761f8ef402a339f">particles</a>[i];</div>
<div class="line"><a id="l00085" name="l00085"></a><span class="lineno"> 85</span> </div>
<div class="line"><a id="l00086" name="l00086"></a><span class="lineno"> 86</span> <span class="keywordflow">if</span> (arma::norm(p-&gt;<a class="code hl_variable" href="classParticle.html#a1c59101411db43624828b766f87ad460">r_vec</a>) &gt; this-&gt;d) {</div>
<div class="line"><a id="l00087" name="l00087"></a><span class="lineno"> 87</span> <span class="keywordflow">return</span> <a class="code hl_typedef" href="typedefs_8hpp.html#a3bdfb73a02f88ae32b6128ef747c4aea">vec3</a>{0., 0., 0.};</div>
<div class="line"><a id="l00088" name="l00088"></a><span class="lineno"> 88</span> }</div>
<div class="line"><a id="l00089" name="l00089"></a><span class="lineno"> 89</span> </div>
<div class="line"><a id="l00090" name="l00090"></a><span class="lineno"> 90</span> <span class="keywordflow">return</span> <a class="code hl_typedef" href="typedefs_8hpp.html#a3bdfb73a02f88ae32b6128ef747c4aea">vec3</a>(p-&gt;<a class="code hl_variable" href="classParticle.html#a566dcc1de4bdc01251776948798ea8e1">q</a></div>
<div class="line"><a id="l00091" name="l00091"></a><span class="lineno"> 91</span> * (this-&gt;external_E_field(p-&gt;<a class="code hl_variable" href="classParticle.html#a1c59101411db43624828b766f87ad460">r_vec</a>)</div>
<div class="line"><a id="l00092" name="l00092"></a><span class="lineno"> 92</span> + arma::cross(p-&gt;<a class="code hl_variable" href="classParticle.html#a3a10400add8dd22b8031330c2aafb6fe">v_vec</a>, this-&gt;external_B_field(p-&gt;<a class="code hl_variable" href="classParticle.html#a1c59101411db43624828b766f87ad460">r_vec</a>))));</div>
<div class="line"><a id="l00093" name="l00093"></a><span class="lineno"> 93</span>}</div>
<div class="line"><a id="l00094" name="l00094"></a><span class="lineno"> 94</span> </div>
<div class="line"><a id="l00095" name="l00095"></a><span class="lineno"><a class="line" href="classPenningTrap.html#a2fe1cefbae18fa5808155ee0d2df713c"> 95</a></span><a class="code hl_typedef" href="typedefs_8hpp.html#a3bdfb73a02f88ae32b6128ef747c4aea">vec3</a> <a class="code hl_function" href="classPenningTrap.html#a2fe1cefbae18fa5808155ee0d2df713c">PenningTrap::total_force_particles</a>(uint i)</div>
<div class="line"><a id="l00096" name="l00096"></a><span class="lineno"> 96</span>{</div>
<div class="line"><a id="l00097" name="l00097"></a><span class="lineno"> 97</span> <a class="code hl_typedef" href="typedefs_8hpp.html#a3bdfb73a02f88ae32b6128ef747c4aea">vec3</a> res;</div>
<div class="line"><a id="l00098" name="l00098"></a><span class="lineno"> 98</span> </div>
<div class="line"><a id="l00099" name="l00099"></a><span class="lineno"> 99</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> j = 0; j &lt; this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a0112525d9e79a472e761f8ef402a339f">particles</a>.size(); j++) {</div>
<div class="line"><a id="l00100" name="l00100"></a><span class="lineno"> 100</span> <span class="keywordflow">if</span> (i != j)</div>
<div class="line"><a id="l00101" name="l00101"></a><span class="lineno"> 101</span> res += this-&gt;<a class="code hl_function" href="classPenningTrap.html#a7f210bb2768a5d79ced4b0df0df97598">force_on_particle</a>(i, j);</div>
<div class="line"><a id="l00102" name="l00102"></a><span class="lineno"> 102</span> }</div>
<div class="line"><a id="l00013" name="l00013"></a><span class="lineno"> 13</span><span class="preprocessor">#include &lt;algorithm&gt;</span></div>
<div class="line"><a id="l00014" name="l00014"></a><span class="lineno"> 14</span><span class="preprocessor">#include &lt;functional&gt;</span></div>
<div class="line"><a id="l00015" name="l00015"></a><span class="lineno"> 15</span><span class="preprocessor">#include &lt;sys/types.h&gt;</span></div>
<div class="line"><a id="l00016" name="l00016"></a><span class="lineno"> 16</span><span class="preprocessor">#include &lt;vector&gt;</span></div>
<div class="line"><a id="l00017" name="l00017"></a><span class="lineno"> 17</span> </div>
<div class="line"><a id="l00018" name="l00018"></a><span class="lineno"> 18</span><span class="preprocessor">#include &quot;<a class="code" href="PenningTrap_8hpp.html">PenningTrap.hpp</a>&quot;</span></div>
<div class="line"><a id="l00019" name="l00019"></a><span class="lineno"> 19</span><span class="preprocessor">#include &quot;<a class="code" href="typedefs_8hpp.html">typedefs.hpp</a>&quot;</span></div>
<div class="line"><a id="l00020" name="l00020"></a><span class="lineno"> 20</span> </div>
<div class="line"><a id="l00021" name="l00021"></a><span class="lineno"><a class="line" href="classPenningTrap.html#a3c0a44e4e0a94366ff609e81fe463fa2"> 21</a></span><a class="code hl_typedef" href="typedefs_8hpp.html#a3bdfb73a02f88ae32b6128ef747c4aea">vec3</a> <a class="code hl_function" href="classPenningTrap.html#a3c0a44e4e0a94366ff609e81fe463fa2">PenningTrap::v_func</a>(uint i, uint j, <span class="keywordtype">double</span> dt)</div>
<div class="line"><a id="l00022" name="l00022"></a><span class="lineno"> 22</span>{</div>
<div class="line"><a id="l00023" name="l00023"></a><span class="lineno"> 23</span> <span class="keywordflow">switch</span> (i) {</div>
<div class="line"><a id="l00024" name="l00024"></a><span class="lineno"> 24</span> <span class="keywordflow">case</span> 0:</div>
<div class="line"><a id="l00025" name="l00025"></a><span class="lineno"> 25</span> <span class="keywordflow">return</span> .5 * dt * this-&gt;<a class="code hl_variable" href="classPenningTrap.html#ae9b5afdaa5cd366e94bd294452a1eed4">k_v</a>[0][j];</div>
<div class="line"><a id="l00026" name="l00026"></a><span class="lineno"> 26</span> <span class="keywordflow">case</span> 1:</div>
<div class="line"><a id="l00027" name="l00027"></a><span class="lineno"> 27</span> <span class="keywordflow">return</span> .5 * dt * this-&gt;k_v[1][j];</div>
<div class="line"><a id="l00028" name="l00028"></a><span class="lineno"> 28</span> <span class="keywordflow">case</span> 2:</div>
<div class="line"><a id="l00029" name="l00029"></a><span class="lineno"> 29</span> <span class="keywordflow">return</span> dt * this-&gt;k_v[2][j];</div>
<div class="line"><a id="l00030" name="l00030"></a><span class="lineno"> 30</span> <span class="keywordflow">case</span> 3:</div>
<div class="line"><a id="l00031" name="l00031"></a><span class="lineno"> 31</span> <span class="keywordflow">return</span> <a class="code hl_typedef" href="typedefs_8hpp.html#a3bdfb73a02f88ae32b6128ef747c4aea">vec3</a>((dt / 6.)</div>
<div class="line"><a id="l00032" name="l00032"></a><span class="lineno"> 32</span> * (this-&gt;k_v[0][j] + 2. * this-&gt;k_v[1][j]</div>
<div class="line"><a id="l00033" name="l00033"></a><span class="lineno"> 33</span> + 2. * this-&gt;k_v[2][j] + this-&gt;k_v[3][j]));</div>
<div class="line"><a id="l00034" name="l00034"></a><span class="lineno"> 34</span> <span class="keywordflow">default</span>:</div>
<div class="line"><a id="l00035" name="l00035"></a><span class="lineno"> 35</span> std::cout &lt;&lt; <span class="stringliteral">&quot;Not valid!&quot;</span> &lt;&lt; std::endl;</div>
<div class="line"><a id="l00036" name="l00036"></a><span class="lineno"> 36</span> abort();</div>
<div class="line"><a id="l00037" name="l00037"></a><span class="lineno"> 37</span> }</div>
<div class="line"><a id="l00038" name="l00038"></a><span class="lineno"> 38</span>}</div>
<div class="line"><a id="l00039" name="l00039"></a><span class="lineno"> 39</span> </div>
<div class="line"><a id="l00040" name="l00040"></a><span class="lineno"><a class="line" href="classPenningTrap.html#a826b7fa8e709d481eb1dee7d0c2cdc08"> 40</a></span><a class="code hl_typedef" href="typedefs_8hpp.html#a3bdfb73a02f88ae32b6128ef747c4aea">vec3</a> <a class="code hl_function" href="classPenningTrap.html#a826b7fa8e709d481eb1dee7d0c2cdc08">PenningTrap::r_func</a>(uint i, uint j, <span class="keywordtype">double</span> dt)</div>
<div class="line"><a id="l00041" name="l00041"></a><span class="lineno"> 41</span>{</div>
<div class="line"><a id="l00042" name="l00042"></a><span class="lineno"> 42</span> <span class="keywordflow">switch</span> (i) {</div>
<div class="line"><a id="l00043" name="l00043"></a><span class="lineno"> 43</span> <span class="keywordflow">case</span> 0:</div>
<div class="line"><a id="l00044" name="l00044"></a><span class="lineno"> 44</span> <span class="keywordflow">return</span> .5 * dt * this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a2f168622587709b9e3c49077f0b9a640">k_r</a>[0][j];</div>
<div class="line"><a id="l00045" name="l00045"></a><span class="lineno"> 45</span> <span class="keywordflow">case</span> 1:</div>
<div class="line"><a id="l00046" name="l00046"></a><span class="lineno"> 46</span> <span class="keywordflow">return</span> .5 * dt * this-&gt;k_r[1][j];</div>
<div class="line"><a id="l00047" name="l00047"></a><span class="lineno"> 47</span> <span class="keywordflow">case</span> 2:</div>
<div class="line"><a id="l00048" name="l00048"></a><span class="lineno"> 48</span> <span class="keywordflow">return</span> dt * this-&gt;k_r[2][j];</div>
<div class="line"><a id="l00049" name="l00049"></a><span class="lineno"> 49</span> <span class="keywordflow">case</span> 3:</div>
<div class="line"><a id="l00050" name="l00050"></a><span class="lineno"> 50</span> <span class="keywordflow">return</span> <a class="code hl_typedef" href="typedefs_8hpp.html#a3bdfb73a02f88ae32b6128ef747c4aea">vec3</a>((dt / 6.)</div>
<div class="line"><a id="l00051" name="l00051"></a><span class="lineno"> 51</span> * (this-&gt;k_r[0][j] + 2. * this-&gt;k_r[1][j]</div>
<div class="line"><a id="l00052" name="l00052"></a><span class="lineno"> 52</span> + 2. * this-&gt;k_r[2][j] + this-&gt;k_r[3][j]));</div>
<div class="line"><a id="l00053" name="l00053"></a><span class="lineno"> 53</span> <span class="keywordflow">default</span>:</div>
<div class="line"><a id="l00054" name="l00054"></a><span class="lineno"> 54</span> std::cout &lt;&lt; <span class="stringliteral">&quot;Not valid!&quot;</span> &lt;&lt; std::endl;</div>
<div class="line"><a id="l00055" name="l00055"></a><span class="lineno"> 55</span> abort();</div>
<div class="line"><a id="l00056" name="l00056"></a><span class="lineno"> 56</span> }</div>
<div class="line"><a id="l00057" name="l00057"></a><span class="lineno"> 57</span>}</div>
<div class="line"><a id="l00058" name="l00058"></a><span class="lineno"> 58</span> </div>
<div class="line"><a id="l00059" name="l00059"></a><span class="lineno"><a class="line" href="classPenningTrap.html#a5846c8f75cdc543fd9cf0b2185a3ef22"> 59</a></span><a class="code hl_typedef" href="typedefs_8hpp.html#a3bdfb73a02f88ae32b6128ef747c4aea">vec3</a> <a class="code hl_function" href="classPenningTrap.html#a5846c8f75cdc543fd9cf0b2185a3ef22">PenningTrap::external_E_field</a>(<a class="code hl_typedef" href="typedefs_8hpp.html#a3bdfb73a02f88ae32b6128ef747c4aea">vec3</a> r)</div>
<div class="line"><a id="l00060" name="l00060"></a><span class="lineno"> 60</span>{</div>
<div class="line"><a id="l00061" name="l00061"></a><span class="lineno"> 61</span> r(2) *= -2.;</div>
<div class="line"><a id="l00062" name="l00062"></a><span class="lineno"> 62</span> </div>
<div class="line"><a id="l00063" name="l00063"></a><span class="lineno"> 63</span> <span class="keywordflow">return</span> <a class="code hl_typedef" href="typedefs_8hpp.html#a3bdfb73a02f88ae32b6128ef747c4aea">vec3</a>(</div>
<div class="line"><a id="l00064" name="l00064"></a><span class="lineno"> 64</span> ((this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a715329844d75ec4c04f8391421fb4e89">V_0</a> * this-&gt;<a class="code hl_variable" href="classPenningTrap.html#ae915f6ad0eef1fb46530e836b6e071e5">perturbation</a>(this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a8ca4e21291f60fde619c14099d8c4e8e">t</a>)) / (this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a66dfe89c68716b9502927b97f59c27d2">d</a> * this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a66dfe89c68716b9502927b97f59c27d2">d</a>)) * r);</div>
<div class="line"><a id="l00065" name="l00065"></a><span class="lineno"> 65</span>}</div>
<div class="line"><a id="l00066" name="l00066"></a><span class="lineno"> 66</span> </div>
<div class="line"><a id="l00067" name="l00067"></a><span class="lineno"><a class="line" href="classPenningTrap.html#a361f2c4862c90b5e8e2a2f50c6a95655"> 67</a></span><a class="code hl_typedef" href="typedefs_8hpp.html#a3bdfb73a02f88ae32b6128ef747c4aea">vec3</a> <a class="code hl_function" href="classPenningTrap.html#a361f2c4862c90b5e8e2a2f50c6a95655">PenningTrap::external_B_field</a>(<a class="code hl_typedef" href="typedefs_8hpp.html#a3bdfb73a02f88ae32b6128ef747c4aea">vec3</a> r)</div>
<div class="line"><a id="l00068" name="l00068"></a><span class="lineno"> 68</span>{</div>
<div class="line"><a id="l00069" name="l00069"></a><span class="lineno"> 69</span> <span class="keywordflow">return</span> <a class="code hl_typedef" href="typedefs_8hpp.html#a3bdfb73a02f88ae32b6128ef747c4aea">vec3</a>{0., 0., this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a0cac3509aa96e71a26d3b2c902e27716">B_0</a>};</div>
<div class="line"><a id="l00070" name="l00070"></a><span class="lineno"> 70</span>}</div>
<div class="line"><a id="l00071" name="l00071"></a><span class="lineno"> 71</span> </div>
<div class="line"><a id="l00072" name="l00072"></a><span class="lineno"><a class="line" href="classPenningTrap.html#a7f210bb2768a5d79ced4b0df0df97598"> 72</a></span><a class="code hl_typedef" href="typedefs_8hpp.html#a3bdfb73a02f88ae32b6128ef747c4aea">vec3</a> <a class="code hl_function" href="classPenningTrap.html#a7f210bb2768a5d79ced4b0df0df97598">PenningTrap::force_on_particle</a>(uint i, uint j)</div>
<div class="line"><a id="l00073" name="l00073"></a><span class="lineno"> 73</span>{</div>
<div class="line"><a id="l00074" name="l00074"></a><span class="lineno"> 74</span> <span class="comment">// Calculate the difference between the particles&#39; position</span></div>
<div class="line"><a id="l00075" name="l00075"></a><span class="lineno"> 75</span> <a class="code hl_typedef" href="typedefs_8hpp.html#a3bdfb73a02f88ae32b6128ef747c4aea">vec3</a> res = this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a0112525d9e79a472e761f8ef402a339f">particles</a>[i].r_vec - this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a0112525d9e79a472e761f8ef402a339f">particles</a>[j].r_vec;</div>
<div class="line"><a id="l00076" name="l00076"></a><span class="lineno"> 76</span> </div>
<div class="line"><a id="l00077" name="l00077"></a><span class="lineno"> 77</span> <span class="comment">// Get the distance between the particles</span></div>
<div class="line"><a id="l00078" name="l00078"></a><span class="lineno"> 78</span> <span class="keywordtype">double</span> norm = arma::norm(res, 2);</div>
<div class="line"><a id="l00079" name="l00079"></a><span class="lineno"> 79</span> </div>
<div class="line"><a id="l00080" name="l00080"></a><span class="lineno"> 80</span> <span class="keywordflow">return</span> <a class="code hl_typedef" href="typedefs_8hpp.html#a3bdfb73a02f88ae32b6128ef747c4aea">vec3</a>((this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a0112525d9e79a472e761f8ef402a339f">particles</a>[j].q / (norm * norm * norm)) * res);</div>
<div class="line"><a id="l00081" name="l00081"></a><span class="lineno"> 81</span>}</div>
<div class="line"><a id="l00082" name="l00082"></a><span class="lineno"> 82</span> </div>
<div class="line"><a id="l00083" name="l00083"></a><span class="lineno"><a class="line" href="classPenningTrap.html#a2c01108b52c8e2a003cf9170da9e7682"> 83</a></span><a class="code hl_typedef" href="typedefs_8hpp.html#a3bdfb73a02f88ae32b6128ef747c4aea">vec3</a> <a class="code hl_function" href="classPenningTrap.html#a2c01108b52c8e2a003cf9170da9e7682">PenningTrap::total_force_external</a>(uint i)</div>
<div class="line"><a id="l00084" name="l00084"></a><span class="lineno"> 84</span>{</div>
<div class="line"><a id="l00085" name="l00085"></a><span class="lineno"> 85</span> <a class="code hl_class" href="classParticle.html">Particle</a> *p = &amp;this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a0112525d9e79a472e761f8ef402a339f">particles</a>[i];</div>
<div class="line"><a id="l00086" name="l00086"></a><span class="lineno"> 86</span> </div>
<div class="line"><a id="l00087" name="l00087"></a><span class="lineno"> 87</span> <span class="keywordflow">return</span> <a class="code hl_typedef" href="typedefs_8hpp.html#a3bdfb73a02f88ae32b6128ef747c4aea">vec3</a>(p-&gt;<a class="code hl_variable" href="classParticle.html#a566dcc1de4bdc01251776948798ea8e1">q</a></div>
<div class="line"><a id="l00088" name="l00088"></a><span class="lineno"> 88</span> * (this-&gt;external_E_field(p-&gt;<a class="code hl_variable" href="classParticle.html#a1c59101411db43624828b766f87ad460">r_vec</a>)</div>
<div class="line"><a id="l00089" name="l00089"></a><span class="lineno"> 89</span> + arma::cross(p-&gt;<a class="code hl_variable" href="classParticle.html#a3a10400add8dd22b8031330c2aafb6fe">v_vec</a>, this-&gt;external_B_field(p-&gt;<a class="code hl_variable" href="classParticle.html#a1c59101411db43624828b766f87ad460">r_vec</a>))));</div>
<div class="line"><a id="l00090" name="l00090"></a><span class="lineno"> 90</span>}</div>
<div class="line"><a id="l00091" name="l00091"></a><span class="lineno"> 91</span> </div>
<div class="line"><a id="l00092" name="l00092"></a><span class="lineno"><a class="line" href="classPenningTrap.html#a2fe1cefbae18fa5808155ee0d2df713c"> 92</a></span><a class="code hl_typedef" href="typedefs_8hpp.html#a3bdfb73a02f88ae32b6128ef747c4aea">vec3</a> <a class="code hl_function" href="classPenningTrap.html#a2fe1cefbae18fa5808155ee0d2df713c">PenningTrap::total_force_particles</a>(uint i)</div>
<div class="line"><a id="l00093" name="l00093"></a><span class="lineno"> 93</span>{</div>
<div class="line"><a id="l00094" name="l00094"></a><span class="lineno"> 94</span> <a class="code hl_typedef" href="typedefs_8hpp.html#a3bdfb73a02f88ae32b6128ef747c4aea">vec3</a> res;</div>
<div class="line"><a id="l00095" name="l00095"></a><span class="lineno"> 95</span> </div>
<div class="line"><a id="l00096" name="l00096"></a><span class="lineno"> 96</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> j = 0; j &lt; this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a0112525d9e79a472e761f8ef402a339f">particles</a>.size(); j++) {</div>
<div class="line"><a id="l00097" name="l00097"></a><span class="lineno"> 97</span> <span class="keywordflow">if</span> (i != j)</div>
<div class="line"><a id="l00098" name="l00098"></a><span class="lineno"> 98</span> res += this-&gt;<a class="code hl_function" href="classPenningTrap.html#a7f210bb2768a5d79ced4b0df0df97598">force_on_particle</a>(i, j);</div>
<div class="line"><a id="l00099" name="l00099"></a><span class="lineno"> 99</span> }</div>
<div class="line"><a id="l00100" name="l00100"></a><span class="lineno"> 100</span> </div>
<div class="line"><a id="l00101" name="l00101"></a><span class="lineno"> 101</span> <span class="keywordflow">return</span> <a class="code hl_typedef" href="typedefs_8hpp.html#a3bdfb73a02f88ae32b6128ef747c4aea">vec3</a>(res * (<a class="code hl_define" href="constants_8hpp.html#a4e451456ad7e9276ed0afa42826e7ccb">K_E</a> * this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a0112525d9e79a472e761f8ef402a339f">particles</a>[i].q));</div>
<div class="line"><a id="l00102" name="l00102"></a><span class="lineno"> 102</span>}</div>
<div class="line"><a id="l00103" name="l00103"></a><span class="lineno"> 103</span> </div>
<div class="line"><a id="l00104" name="l00104"></a><span class="lineno"> 104</span> <span class="keywordflow">return</span> <a class="code hl_typedef" href="typedefs_8hpp.html#a3bdfb73a02f88ae32b6128ef747c4aea">vec3</a>(res * (<a class="code hl_define" href="constants_8hpp.html#a4e451456ad7e9276ed0afa42826e7ccb">K_E</a> * this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a0112525d9e79a472e761f8ef402a339f">particles</a>[i].q));</div>
<div class="line"><a id="l00105" name="l00105"></a><span class="lineno"> 105</span>}</div>
<div class="line"><a id="l00106" name="l00106"></a><span class="lineno"> 106</span> </div>
<div class="line"><a id="l00107" name="l00107"></a><span class="lineno"><a class="line" href="classPenningTrap.html#a9a301b0540078c36697880ef204afdf3"> 107</a></span><a class="code hl_typedef" href="typedefs_8hpp.html#a3bdfb73a02f88ae32b6128ef747c4aea">vec3</a> <a class="code hl_function" href="classPenningTrap.html#a9a301b0540078c36697880ef204afdf3">PenningTrap::total_force</a>(uint i)</div>
<div class="line"><a id="l00108" name="l00108"></a><span class="lineno"> 108</span>{</div>
<div class="line"><a id="l00109" name="l00109"></a><span class="lineno"> 109</span> <span class="keywordflow">if</span> (arma::norm(this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a0112525d9e79a472e761f8ef402a339f">particles</a>[i].r_vec) &gt; this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a66dfe89c68716b9502927b97f59c27d2">d</a>) {</div>
<div class="line"><a id="l00110" name="l00110"></a><span class="lineno"> 110</span> <span class="keywordflow">return</span> <a class="code hl_typedef" href="typedefs_8hpp.html#a3bdfb73a02f88ae32b6128ef747c4aea">vec3</a>{0., 0., 0.};</div>
<div class="line"><a id="l00111" name="l00111"></a><span class="lineno"> 111</span> }</div>
<div class="line"><a id="l00112" name="l00112"></a><span class="lineno"> 112</span> <span class="keywordflow">return</span> <a class="code hl_typedef" href="typedefs_8hpp.html#a3bdfb73a02f88ae32b6128ef747c4aea">vec3</a>(this-&gt;<a class="code hl_function" href="classPenningTrap.html#a2c01108b52c8e2a003cf9170da9e7682">total_force_external</a>(i) - this-&gt;<a class="code hl_function" href="classPenningTrap.html#a2fe1cefbae18fa5808155ee0d2df713c">total_force_particles</a>(i));</div>
<div class="line"><a id="l00113" name="l00113"></a><span class="lineno"> 113</span>}</div>
<div class="line"><a id="l00114" name="l00114"></a><span class="lineno"> 114</span> </div>
<div class="line"><a id="l00115" name="l00115"></a><span class="lineno"><a class="line" href="classPenningTrap.html#a5b6c6d4636f3a6e279ccde59d4a345e8"> 115</a></span><a class="code hl_function" href="classPenningTrap.html#a5b6c6d4636f3a6e279ccde59d4a345e8">PenningTrap::PenningTrap</a>(<span class="keywordtype">double</span> B_0, <span class="keywordtype">double</span> V_0, <span class="keywordtype">double</span> d, <span class="keywordtype">double</span> t)</div>
<div class="line"><a id="l00116" name="l00116"></a><span class="lineno"> 116</span>{</div>
<div class="line"><a id="l00117" name="l00117"></a><span class="lineno"> 117</span> this-&gt;B_0 = <a class="code hl_variable" href="classPenningTrap.html#a0cac3509aa96e71a26d3b2c902e27716">B_0</a>;</div>
<div class="line"><a id="l00118" name="l00118"></a><span class="lineno"> 118</span> this-&gt;V_0 = <a class="code hl_variable" href="classPenningTrap.html#a715329844d75ec4c04f8391421fb4e89">V_0</a>;</div>
<div class="line"><a id="l00119" name="l00119"></a><span class="lineno"> 119</span> this-&gt;d = <a class="code hl_variable" href="classPenningTrap.html#a66dfe89c68716b9502927b97f59c27d2">d</a>;</div>
<div class="line"><a id="l00120" name="l00120"></a><span class="lineno"> 120</span> this-&gt;t = <a class="code hl_variable" href="classPenningTrap.html#a8ca4e21291f60fde619c14099d8c4e8e">t</a>;</div>
<div class="line"><a id="l00121" name="l00121"></a><span class="lineno"> 121</span> this-&gt;<a class="code hl_variable" href="classPenningTrap.html#ae915f6ad0eef1fb46530e836b6e071e5">perturbation</a> = [](<span class="keywordtype">double</span> <a class="code hl_variable" href="classPenningTrap.html#a8ca4e21291f60fde619c14099d8c4e8e">t</a>) { <span class="keywordflow">return</span> 1.; };</div>
<div class="line"><a id="l00122" name="l00122"></a><span class="lineno"> 122</span>}</div>
<div class="line"><a id="l00123" name="l00123"></a><span class="lineno"> 123</span> </div>
<div class="line"><a id="l00124" name="l00124"></a><span class="lineno"><a class="line" href="classPenningTrap.html#a830be1b8cbf59664e060b6edbeaa302f"> 124</a></span><a class="code hl_function" href="classPenningTrap.html#a5b6c6d4636f3a6e279ccde59d4a345e8">PenningTrap::PenningTrap</a>(uint i, <span class="keywordtype">double</span> B_0, <span class="keywordtype">double</span> V_0, <span class="keywordtype">double</span> d, <span class="keywordtype">double</span> t)</div>
<div class="line"><a id="l00125" name="l00125"></a><span class="lineno"> 125</span> : <a class="code hl_class" href="classPenningTrap.html">PenningTrap</a>::<a class="code hl_class" href="classPenningTrap.html">PenningTrap</a>(B_0, V_0, d)</div>
<div class="line"><a id="l00126" name="l00126"></a><span class="lineno"> 126</span>{</div>
<div class="line"><a id="l00127" name="l00127"></a><span class="lineno"> 127</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> j = 0; j &lt; i; j++) {</div>
<div class="line"><a id="l00128" name="l00128"></a><span class="lineno"> 128</span> this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a0112525d9e79a472e761f8ef402a339f">particles</a>.push_back(</div>
<div class="line"><a id="l00129" name="l00129"></a><span class="lineno"> 129</span> <a class="code hl_class" href="classParticle.html">Particle</a>(<a class="code hl_typedef" href="typedefs_8hpp.html#a3bdfb73a02f88ae32b6128ef747c4aea">vec3</a>(<a class="code hl_typedef" href="typedefs_8hpp.html#a3bdfb73a02f88ae32b6128ef747c4aea">vec3</a>().randn() * .1 * this-&gt;d),</div>
<div class="line"><a id="l00130" name="l00130"></a><span class="lineno"> 130</span> <a class="code hl_typedef" href="typedefs_8hpp.html#a3bdfb73a02f88ae32b6128ef747c4aea">vec3</a>(<a class="code hl_typedef" href="typedefs_8hpp.html#a3bdfb73a02f88ae32b6128ef747c4aea">vec3</a>().randn() * .1 * this-&gt;d)));</div>
<div class="line"><a id="l00131" name="l00131"></a><span class="lineno"> 131</span> }</div>
<div class="line"><a id="l00132" name="l00132"></a><span class="lineno"> 132</span>}</div>
<div class="line"><a id="l00133" name="l00133"></a><span class="lineno"> 133</span> </div>
<div class="line"><a id="l00134" name="l00134"></a><span class="lineno"><a class="line" href="classPenningTrap.html#addc96789dcfec07b75156e19fee82f4f"> 134</a></span><a class="code hl_function" href="classPenningTrap.html#a5b6c6d4636f3a6e279ccde59d4a345e8">PenningTrap::PenningTrap</a>(std::vector&lt;Particle&gt; particles, <span class="keywordtype">double</span> B_0,</div>
<div class="line"><a id="l00135" name="l00135"></a><span class="lineno"> 135</span> <span class="keywordtype">double</span> V_0, <span class="keywordtype">double</span> d, <span class="keywordtype">double</span> t)</div>
<div class="line"><a id="l00136" name="l00136"></a><span class="lineno"> 136</span> : <a class="code hl_class" href="classPenningTrap.html">PenningTrap</a>::<a class="code hl_class" href="classPenningTrap.html">PenningTrap</a>(B_0, V_0, d)</div>
<div class="line"><a id="l00137" name="l00137"></a><span class="lineno"> 137</span>{</div>
<div class="line"><a id="l00138" name="l00138"></a><span class="lineno"> 138</span> this-&gt;particles = <a class="code hl_variable" href="classPenningTrap.html#a0112525d9e79a472e761f8ef402a339f">particles</a>;</div>
<div class="line"><a id="l00139" name="l00139"></a><span class="lineno"> 139</span>}</div>
<div class="line"><a id="l00140" name="l00140"></a><span class="lineno"> 140</span> </div>
<div class="line"><a id="l00141" name="l00141"></a><span class="lineno"><a class="line" href="classPenningTrap.html#a9d1d8e90ca839b928aee1ad0cd4aff43"> 141</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="classPenningTrap.html#a9d1d8e90ca839b928aee1ad0cd4aff43">PenningTrap::set_pertubation</a>(<span class="keywordtype">double</span> f, <span class="keywordtype">double</span> omega_V)</div>
<div class="line"><a id="l00104" name="l00104"></a><span class="lineno"><a class="line" href="classPenningTrap.html#a9a301b0540078c36697880ef204afdf3"> 104</a></span><a class="code hl_typedef" href="typedefs_8hpp.html#a3bdfb73a02f88ae32b6128ef747c4aea">vec3</a> <a class="code hl_function" href="classPenningTrap.html#a9a301b0540078c36697880ef204afdf3">PenningTrap::total_force</a>(uint i)</div>
<div class="line"><a id="l00105" name="l00105"></a><span class="lineno"> 105</span>{</div>
<div class="line"><a id="l00106" name="l00106"></a><span class="lineno"> 106</span> <span class="keywordflow">if</span> (arma::norm(this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a0112525d9e79a472e761f8ef402a339f">particles</a>[i].r_vec) &gt; this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a66dfe89c68716b9502927b97f59c27d2">d</a>) {</div>
<div class="line"><a id="l00107" name="l00107"></a><span class="lineno"> 107</span> <span class="keywordflow">return</span> <a class="code hl_typedef" href="typedefs_8hpp.html#a3bdfb73a02f88ae32b6128ef747c4aea">vec3</a>{0., 0., 0.};</div>
<div class="line"><a id="l00108" name="l00108"></a><span class="lineno"> 108</span> }</div>
<div class="line"><a id="l00109" name="l00109"></a><span class="lineno"> 109</span> <span class="keywordflow">return</span> <a class="code hl_typedef" href="typedefs_8hpp.html#a3bdfb73a02f88ae32b6128ef747c4aea">vec3</a>(this-&gt;<a class="code hl_function" href="classPenningTrap.html#a2c01108b52c8e2a003cf9170da9e7682">total_force_external</a>(i) - this-&gt;<a class="code hl_function" href="classPenningTrap.html#a2fe1cefbae18fa5808155ee0d2df713c">total_force_particles</a>(i));</div>
<div class="line"><a id="l00110" name="l00110"></a><span class="lineno"> 110</span>}</div>
<div class="line"><a id="l00111" name="l00111"></a><span class="lineno"> 111</span> </div>
<div class="line"><a id="l00112" name="l00112"></a><span class="lineno"><a class="line" href="classPenningTrap.html#a6069f82d8dbc7cadaebd228dbcd95018"> 112</a></span><a class="code hl_typedef" href="typedefs_8hpp.html#a3bdfb73a02f88ae32b6128ef747c4aea">vec3</a> <a class="code hl_function" href="classPenningTrap.html#a6069f82d8dbc7cadaebd228dbcd95018">PenningTrap::total_force_no_interaction</a>(uint i)</div>
<div class="line"><a id="l00113" name="l00113"></a><span class="lineno"> 113</span>{</div>
<div class="line"><a id="l00114" name="l00114"></a><span class="lineno"> 114</span> <span class="keywordflow">if</span> (arma::norm(this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a0112525d9e79a472e761f8ef402a339f">particles</a>[i].r_vec) &gt; this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a66dfe89c68716b9502927b97f59c27d2">d</a>) {</div>
<div class="line"><a id="l00115" name="l00115"></a><span class="lineno"> 115</span> <span class="keywordflow">return</span> <a class="code hl_typedef" href="typedefs_8hpp.html#a3bdfb73a02f88ae32b6128ef747c4aea">vec3</a>{0., 0., 0.};</div>
<div class="line"><a id="l00116" name="l00116"></a><span class="lineno"> 116</span> }</div>
<div class="line"><a id="l00117" name="l00117"></a><span class="lineno"> 117</span> <span class="keywordflow">return</span> <a class="code hl_typedef" href="typedefs_8hpp.html#a3bdfb73a02f88ae32b6128ef747c4aea">vec3</a>(this-&gt;<a class="code hl_function" href="classPenningTrap.html#a2c01108b52c8e2a003cf9170da9e7682">total_force_external</a>(i));</div>
<div class="line"><a id="l00118" name="l00118"></a><span class="lineno"> 118</span>}</div>
<div class="line"><a id="l00119" name="l00119"></a><span class="lineno"> 119</span> </div>
<div class="line"><a id="l00120" name="l00120"></a><span class="lineno"><a class="line" href="classPenningTrap.html#a5b6c6d4636f3a6e279ccde59d4a345e8"> 120</a></span><a class="code hl_function" href="classPenningTrap.html#a5b6c6d4636f3a6e279ccde59d4a345e8">PenningTrap::PenningTrap</a>(<span class="keywordtype">double</span> B_0, <span class="keywordtype">double</span> V_0, <span class="keywordtype">double</span> d, <span class="keywordtype">double</span> t)</div>
<div class="line"><a id="l00121" name="l00121"></a><span class="lineno"> 121</span>{</div>
<div class="line"><a id="l00122" name="l00122"></a><span class="lineno"> 122</span> this-&gt;B_0 = <a class="code hl_variable" href="classPenningTrap.html#a0cac3509aa96e71a26d3b2c902e27716">B_0</a>;</div>
<div class="line"><a id="l00123" name="l00123"></a><span class="lineno"> 123</span> this-&gt;V_0 = <a class="code hl_variable" href="classPenningTrap.html#a715329844d75ec4c04f8391421fb4e89">V_0</a>;</div>
<div class="line"><a id="l00124" name="l00124"></a><span class="lineno"> 124</span> this-&gt;d = <a class="code hl_variable" href="classPenningTrap.html#a66dfe89c68716b9502927b97f59c27d2">d</a>;</div>
<div class="line"><a id="l00125" name="l00125"></a><span class="lineno"> 125</span> this-&gt;t = <a class="code hl_variable" href="classPenningTrap.html#a8ca4e21291f60fde619c14099d8c4e8e">t</a>;</div>
<div class="line"><a id="l00126" name="l00126"></a><span class="lineno"> 126</span> this-&gt;<a class="code hl_variable" href="classPenningTrap.html#ae915f6ad0eef1fb46530e836b6e071e5">perturbation</a> = [](<span class="keywordtype">double</span> <a class="code hl_variable" href="classPenningTrap.html#a8ca4e21291f60fde619c14099d8c4e8e">t</a>) { <span class="keywordflow">return</span> 1.; };</div>
<div class="line"><a id="l00127" name="l00127"></a><span class="lineno"> 127</span>}</div>
<div class="line"><a id="l00128" name="l00128"></a><span class="lineno"> 128</span> </div>
<div class="line"><a id="l00129" name="l00129"></a><span class="lineno"><a class="line" href="classPenningTrap.html#a830be1b8cbf59664e060b6edbeaa302f"> 129</a></span><a class="code hl_function" href="classPenningTrap.html#a5b6c6d4636f3a6e279ccde59d4a345e8">PenningTrap::PenningTrap</a>(uint i, <span class="keywordtype">double</span> B_0, <span class="keywordtype">double</span> V_0, <span class="keywordtype">double</span> d, <span class="keywordtype">double</span> t)</div>
<div class="line"><a id="l00130" name="l00130"></a><span class="lineno"> 130</span> : <a class="code hl_class" href="classPenningTrap.html">PenningTrap</a>::<a class="code hl_class" href="classPenningTrap.html">PenningTrap</a>(B_0, V_0, d)</div>
<div class="line"><a id="l00131" name="l00131"></a><span class="lineno"> 131</span>{</div>
<div class="line"><a id="l00132" name="l00132"></a><span class="lineno"> 132</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> j = 0; j &lt; i; j++) {</div>
<div class="line"><a id="l00133" name="l00133"></a><span class="lineno"> 133</span> this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a0112525d9e79a472e761f8ef402a339f">particles</a>.push_back(</div>
<div class="line"><a id="l00134" name="l00134"></a><span class="lineno"> 134</span> <a class="code hl_class" href="classParticle.html">Particle</a>(<a class="code hl_typedef" href="typedefs_8hpp.html#a3bdfb73a02f88ae32b6128ef747c4aea">vec3</a>(<a class="code hl_typedef" href="typedefs_8hpp.html#a3bdfb73a02f88ae32b6128ef747c4aea">vec3</a>().randn() * .1 * this-&gt;d),</div>
<div class="line"><a id="l00135" name="l00135"></a><span class="lineno"> 135</span> <a class="code hl_typedef" href="typedefs_8hpp.html#a3bdfb73a02f88ae32b6128ef747c4aea">vec3</a>(<a class="code hl_typedef" href="typedefs_8hpp.html#a3bdfb73a02f88ae32b6128ef747c4aea">vec3</a>().randn() * .1 * this-&gt;d)));</div>
<div class="line"><a id="l00136" name="l00136"></a><span class="lineno"> 136</span> }</div>
<div class="line"><a id="l00137" name="l00137"></a><span class="lineno"> 137</span>}</div>
<div class="line"><a id="l00138" name="l00138"></a><span class="lineno"> 138</span> </div>
<div class="line"><a id="l00139" name="l00139"></a><span class="lineno"><a class="line" href="classPenningTrap.html#addc96789dcfec07b75156e19fee82f4f"> 139</a></span><a class="code hl_function" href="classPenningTrap.html#a5b6c6d4636f3a6e279ccde59d4a345e8">PenningTrap::PenningTrap</a>(std::vector&lt;Particle&gt; particles, <span class="keywordtype">double</span> B_0,</div>
<div class="line"><a id="l00140" name="l00140"></a><span class="lineno"> 140</span> <span class="keywordtype">double</span> V_0, <span class="keywordtype">double</span> d, <span class="keywordtype">double</span> t)</div>
<div class="line"><a id="l00141" name="l00141"></a><span class="lineno"> 141</span> : <a class="code hl_class" href="classPenningTrap.html">PenningTrap</a>::<a class="code hl_class" href="classPenningTrap.html">PenningTrap</a>(B_0, V_0, d)</div>
<div class="line"><a id="l00142" name="l00142"></a><span class="lineno"> 142</span>{</div>
<div class="line"><a id="l00143" name="l00143"></a><span class="lineno"> 143</span> this-&gt;<a class="code hl_variable" href="classPenningTrap.html#ae915f6ad0eef1fb46530e836b6e071e5">perturbation</a> = [f, omega_V](<span class="keywordtype">double</span> <a class="code hl_variable" href="classPenningTrap.html#a8ca4e21291f60fde619c14099d8c4e8e">t</a>) {</div>
<div class="line"><a id="l00144" name="l00144"></a><span class="lineno"> 144</span> <span class="keywordflow">return</span> 1 + f * std::cos(omega_V * <a class="code hl_variable" href="classPenningTrap.html#a8ca4e21291f60fde619c14099d8c4e8e">t</a>);</div>
<div class="line"><a id="l00145" name="l00145"></a><span class="lineno"> 145</span> };</div>
<div class="line"><a id="l00146" name="l00146"></a><span class="lineno"> 146</span>}</div>
<div class="line"><a id="l00147" name="l00147"></a><span class="lineno"> 147</span> </div>
<div class="line"><a id="l00148" name="l00148"></a><span class="lineno"><a class="line" href="classPenningTrap.html#aaee129f177657455348d0c8ae1441dea"> 148</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="classPenningTrap.html#aaee129f177657455348d0c8ae1441dea">PenningTrap::reinitialize</a>(<span class="keywordtype">double</span> f, <span class="keywordtype">double</span> omega_V, <span class="keywordtype">double</span> t)</div>
<div class="line"><a id="l00149" name="l00149"></a><span class="lineno"> 149</span>{</div>
<div class="line"><a id="l00150" name="l00150"></a><span class="lineno"> 150</span> this-&gt;t = <a class="code hl_variable" href="classPenningTrap.html#a8ca4e21291f60fde619c14099d8c4e8e">t</a>;</div>
<div class="line"><a id="l00151" name="l00151"></a><span class="lineno"> 151</span> this-&gt;<a class="code hl_function" href="classPenningTrap.html#a9d1d8e90ca839b928aee1ad0cd4aff43">set_pertubation</a>(f, omega_V);</div>
<div class="line"><a id="l00143" name="l00143"></a><span class="lineno"> 143</span> this-&gt;particles = <a class="code hl_variable" href="classPenningTrap.html#a0112525d9e79a472e761f8ef402a339f">particles</a>;</div>
<div class="line"><a id="l00144" name="l00144"></a><span class="lineno"> 144</span>}</div>
<div class="line"><a id="l00145" name="l00145"></a><span class="lineno"> 145</span> </div>
<div class="line"><a id="l00146" name="l00146"></a><span class="lineno"><a class="line" href="classPenningTrap.html#a9d1d8e90ca839b928aee1ad0cd4aff43"> 146</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="classPenningTrap.html#a9d1d8e90ca839b928aee1ad0cd4aff43">PenningTrap::set_pertubation</a>(<span class="keywordtype">double</span> f, <span class="keywordtype">double</span> omega_V)</div>
<div class="line"><a id="l00147" name="l00147"></a><span class="lineno"> 147</span>{</div>
<div class="line"><a id="l00148" name="l00148"></a><span class="lineno"> 148</span> this-&gt;<a class="code hl_variable" href="classPenningTrap.html#ae915f6ad0eef1fb46530e836b6e071e5">perturbation</a> = [f, omega_V](<span class="keywordtype">double</span> <a class="code hl_variable" href="classPenningTrap.html#a8ca4e21291f60fde619c14099d8c4e8e">t</a>) {</div>
<div class="line"><a id="l00149" name="l00149"></a><span class="lineno"> 149</span> <span class="keywordflow">return</span> 1 + f * std::cos(omega_V * <a class="code hl_variable" href="classPenningTrap.html#a8ca4e21291f60fde619c14099d8c4e8e">t</a>);</div>
<div class="line"><a id="l00150" name="l00150"></a><span class="lineno"> 150</span> };</div>
<div class="line"><a id="l00151" name="l00151"></a><span class="lineno"> 151</span>}</div>
<div class="line"><a id="l00152" name="l00152"></a><span class="lineno"> 152</span> </div>
<div class="line"><a id="l00153" name="l00153"></a><span class="lineno"> 153</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i = 0; i &lt; this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a0112525d9e79a472e761f8ef402a339f">particles</a>.size(); i++) {</div>
<div class="line"><a id="l00154" name="l00154"></a><span class="lineno"> 154</span> this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a0112525d9e79a472e761f8ef402a339f">particles</a>[i].r_vec = <a class="code hl_typedef" href="typedefs_8hpp.html#a3bdfb73a02f88ae32b6128ef747c4aea">vec3</a>().randn() * .1 * this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a66dfe89c68716b9502927b97f59c27d2">d</a>;</div>
<div class="line"><a id="l00155" name="l00155"></a><span class="lineno"> 155</span> }</div>
<div class="line"><a id="l00156" name="l00156"></a><span class="lineno"> 156</span>}</div>
<div class="line"><a id="l00157" name="l00157"></a><span class="lineno"> 157</span> </div>
<div class="line"><a id="l00158" name="l00158"></a><span class="lineno"><a class="line" href="classPenningTrap.html#a6e9776ff5b149f01080800716455d7c8"> 158</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="classPenningTrap.html#a6e9776ff5b149f01080800716455d7c8">PenningTrap::add_particle</a>(<a class="code hl_class" href="classParticle.html">Particle</a> particle)</div>
<div class="line"><a id="l00159" name="l00159"></a><span class="lineno"> 159</span>{</div>
<div class="line"><a id="l00160" name="l00160"></a><span class="lineno"> 160</span> this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a0112525d9e79a472e761f8ef402a339f">particles</a>.push_back(particle);</div>
<div class="line"><a id="l00161" name="l00161"></a><span class="lineno"> 161</span>}</div>
<div class="line"><a id="l00162" name="l00162"></a><span class="lineno"> 162</span> </div>
<div class="line"><a id="l00163" name="l00163"></a><span class="lineno"><a class="line" href="classPenningTrap.html#a36946152fd951b1f7c346c51ff900d8e"> 163</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="classPenningTrap.html#a36946152fd951b1f7c346c51ff900d8e">PenningTrap::evolve_RK4</a>(<span class="keywordtype">double</span> dt, <span class="keywordtype">bool</span> particle_interaction)</div>
<div class="line"><a id="l00164" name="l00164"></a><span class="lineno"> 164</span>{</div>
<div class="line"><a id="l00153" name="l00153"></a><span class="lineno"><a class="line" href="classPenningTrap.html#aaee129f177657455348d0c8ae1441dea"> 153</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="classPenningTrap.html#aaee129f177657455348d0c8ae1441dea">PenningTrap::reinitialize</a>(<span class="keywordtype">double</span> f, <span class="keywordtype">double</span> omega_V, <span class="keywordtype">double</span> t)</div>
<div class="line"><a id="l00154" name="l00154"></a><span class="lineno"> 154</span>{</div>
<div class="line"><a id="l00155" name="l00155"></a><span class="lineno"> 155</span> this-&gt;t = <a class="code hl_variable" href="classPenningTrap.html#a8ca4e21291f60fde619c14099d8c4e8e">t</a>;</div>
<div class="line"><a id="l00156" name="l00156"></a><span class="lineno"> 156</span> this-&gt;<a class="code hl_function" href="classPenningTrap.html#a9d1d8e90ca839b928aee1ad0cd4aff43">set_pertubation</a>(f, omega_V);</div>
<div class="line"><a id="l00157" name="l00157"></a><span class="lineno"> 157</span> <a class="code hl_class" href="classParticle.html">Particle</a> *p;</div>
<div class="line"><a id="l00158" name="l00158"></a><span class="lineno"> 158</span> </div>
<div class="line"><a id="l00159" name="l00159"></a><span class="lineno"> 159</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i = 0; i &lt; this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a0112525d9e79a472e761f8ef402a339f">particles</a>.size(); i++) {</div>
<div class="line"><a id="l00160" name="l00160"></a><span class="lineno"> 160</span> p = &amp;this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a0112525d9e79a472e761f8ef402a339f">particles</a>[i];</div>
<div class="line"><a id="l00161" name="l00161"></a><span class="lineno"> 161</span> p-&gt;<a class="code hl_variable" href="classParticle.html#a1c59101411db43624828b766f87ad460">r_vec</a> = <a class="code hl_typedef" href="typedefs_8hpp.html#a3bdfb73a02f88ae32b6128ef747c4aea">vec3</a>().randn() * .1 * this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a66dfe89c68716b9502927b97f59c27d2">d</a>;</div>
<div class="line"><a id="l00162" name="l00162"></a><span class="lineno"> 162</span> p-&gt;<a class="code hl_variable" href="classParticle.html#a3a10400add8dd22b8031330c2aafb6fe">v_vec</a> = <a class="code hl_typedef" href="typedefs_8hpp.html#a3bdfb73a02f88ae32b6128ef747c4aea">vec3</a>().randn() * .1 * this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a66dfe89c68716b9502927b97f59c27d2">d</a>;</div>
<div class="line"><a id="l00163" name="l00163"></a><span class="lineno"> 163</span> }</div>
<div class="line"><a id="l00164" name="l00164"></a><span class="lineno"> 164</span>}</div>
<div class="line"><a id="l00165" name="l00165"></a><span class="lineno"> 165</span> </div>
<div class="line"><a id="l00166" name="l00166"></a><span class="lineno"> 166</span> std::vector&lt;Particle&gt; original_particles = this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a0112525d9e79a472e761f8ef402a339f">particles</a>;</div>
<div class="line"><a id="l00167" name="l00167"></a><span class="lineno"> 167</span> std::vector&lt;Particle&gt; tmp_particles = this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a0112525d9e79a472e761f8ef402a339f">particles</a>;</div>
<div class="line"><a id="l00168" name="l00168"></a><span class="lineno"> 168</span> </div>
<div class="line"><a id="l00169" name="l00169"></a><span class="lineno"> 169</span> <a class="code hl_typedef" href="typedefs_8hpp.html#a3bdfb73a02f88ae32b6128ef747c4aea">vec3</a> (<a class="code hl_class" href="classPenningTrap.html">PenningTrap</a>::*force)(uint) = particle_interaction</div>
<div class="line"><a id="l00170" name="l00170"></a><span class="lineno"> 170</span> ? &amp;<a class="code hl_function" href="classPenningTrap.html#a9a301b0540078c36697880ef204afdf3">PenningTrap::total_force</a></div>
<div class="line"><a id="l00171" name="l00171"></a><span class="lineno"> 171</span> : &amp;<a class="code hl_function" href="classPenningTrap.html#a2c01108b52c8e2a003cf9170da9e7682">PenningTrap::total_force_external</a>;</div>
<div class="line"><a id="l00172" name="l00172"></a><span class="lineno"> 172</span> </div>
<div class="line"><a id="l00173" name="l00173"></a><span class="lineno"> 173</span> <span class="keywordtype">size_t</span> size = this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a0112525d9e79a472e761f8ef402a339f">particles</a>.size();</div>
<div class="line"><a id="l00166" name="l00166"></a><span class="lineno"><a class="line" href="classPenningTrap.html#a6e9776ff5b149f01080800716455d7c8"> 166</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="classPenningTrap.html#a6e9776ff5b149f01080800716455d7c8">PenningTrap::add_particle</a>(<a class="code hl_class" href="classParticle.html">Particle</a> particle)</div>
<div class="line"><a id="l00167" name="l00167"></a><span class="lineno"> 167</span>{</div>
<div class="line"><a id="l00168" name="l00168"></a><span class="lineno"> 168</span> this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a0112525d9e79a472e761f8ef402a339f">particles</a>.push_back(particle);</div>
<div class="line"><a id="l00169" name="l00169"></a><span class="lineno"> 169</span>}</div>
<div class="line"><a id="l00170" name="l00170"></a><span class="lineno"> 170</span> </div>
<div class="line"><a id="l00171" name="l00171"></a><span class="lineno"><a class="line" href="classPenningTrap.html#a36946152fd951b1f7c346c51ff900d8e"> 171</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="classPenningTrap.html#a36946152fd951b1f7c346c51ff900d8e">PenningTrap::evolve_RK4</a>(<span class="keywordtype">double</span> dt, <span class="keywordtype">bool</span> particle_interaction)</div>
<div class="line"><a id="l00172" name="l00172"></a><span class="lineno"> 172</span>{</div>
<div class="line"><a id="l00173" name="l00173"></a><span class="lineno"> 173</span> <a class="code hl_class" href="classParticle.html">Particle</a> *p;</div>
<div class="line"><a id="l00174" name="l00174"></a><span class="lineno"> 174</span> </div>
<div class="line"><a id="l00175" name="l00175"></a><span class="lineno"> 175</span> <span class="comment">// Allocating takes a long time, so reuse sim_arr if possible</span></div>
<div class="line"><a id="l00176" name="l00176"></a><span class="lineno"> 176</span> <span class="keywordflow">if</span> (this-&gt;<a class="code hl_variable" href="classPenningTrap.html#ae9b5afdaa5cd366e94bd294452a1eed4">k_v</a>.size() != 4 || this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a2f168622587709b9e3c49077f0b9a640">k_r</a>.size() != 4</div>
<div class="line"><a id="l00177" name="l00177"></a><span class="lineno"> 177</span> || this-&gt;<a class="code hl_variable" href="classPenningTrap.html#ae9b5afdaa5cd366e94bd294452a1eed4">k_v</a>[0].size() != size || this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a2f168622587709b9e3c49077f0b9a640">k_r</a>[0].size() != size) {</div>
<div class="line"><a id="l00178" name="l00178"></a><span class="lineno"> 178</span> this-&gt;<a class="code hl_variable" href="classPenningTrap.html#ae9b5afdaa5cd366e94bd294452a1eed4">k_v</a> = <a class="code hl_typedef" href="typedefs_8hpp.html#aec69d34220fff45de238b9e01f2686af">sim_arr</a>(4, <a class="code hl_typedef" href="typedefs_8hpp.html#a46482a2697556c00556c9d73f461784f">sim_cols</a>(size));</div>
<div class="line"><a id="l00179" name="l00179"></a><span class="lineno"> 179</span> this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a2f168622587709b9e3c49077f0b9a640">k_r</a> = <a class="code hl_typedef" href="typedefs_8hpp.html#aec69d34220fff45de238b9e01f2686af">sim_arr</a>(4, <a class="code hl_typedef" href="typedefs_8hpp.html#a46482a2697556c00556c9d73f461784f">sim_cols</a>(size));</div>
<div class="line"><a id="l00180" name="l00180"></a><span class="lineno"> 180</span> }</div>
<div class="line"><a id="l00181" name="l00181"></a><span class="lineno"> 181</span> </div>
<div class="line"><a id="l00182" name="l00182"></a><span class="lineno"> 182</span> <span class="comment">// Each k_{i+1} is dependent on k_i, so outer loop is not parallelizable</span></div>
<div class="line"><a id="l00183" name="l00183"></a><span class="lineno"> 183</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i = 0; i &lt; 4; i++) {</div>
<div class="line"><a id="l00184" name="l00184"></a><span class="lineno"> 184</span> <span class="comment">// Inner loop is able to be parallelized</span></div>
<div class="line"><a id="l00185" name="l00185"></a><span class="lineno"> 185</span><span class="preprocessor">#pragma omp parallel for</span></div>
<div class="line"><a id="l00186" name="l00186"></a><span class="lineno"> 186</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> j = 0; j &lt; size; j++) {</div>
<div class="line"><a id="l00187" name="l00187"></a><span class="lineno"> 187</span> this-&gt;<a class="code hl_variable" href="classPenningTrap.html#ae9b5afdaa5cd366e94bd294452a1eed4">k_v</a>[i][j] = (this-&gt;*force)(j) / this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a0112525d9e79a472e761f8ef402a339f">particles</a>[j].m;</div>
<div class="line"><a id="l00188" name="l00188"></a><span class="lineno"> 188</span> this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a2f168622587709b9e3c49077f0b9a640">k_r</a>[i][j] = this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a0112525d9e79a472e761f8ef402a339f">particles</a>[j].v_vec;</div>
<div class="line"><a id="l00189" name="l00189"></a><span class="lineno"> 189</span> </div>
<div class="line"><a id="l00190" name="l00190"></a><span class="lineno"> 190</span> tmp_particles[j].v_vec =</div>
<div class="line"><a id="l00191" name="l00191"></a><span class="lineno"> 191</span> original_particles[j].v_vec + this-&gt;<a class="code hl_function" href="classPenningTrap.html#a3c0a44e4e0a94366ff609e81fe463fa2">v_func</a>(i, j, dt);</div>
<div class="line"><a id="l00192" name="l00192"></a><span class="lineno"> 192</span> tmp_particles[j].r_vec =</div>
<div class="line"><a id="l00193" name="l00193"></a><span class="lineno"> 193</span> original_particles[j].r_vec + this-&gt;<a class="code hl_function" href="classPenningTrap.html#a826b7fa8e709d481eb1dee7d0c2cdc08">r_func</a>(i, j, dt);</div>
<div class="line"><a id="l00194" name="l00194"></a><span class="lineno"> 194</span> }</div>
<div class="line"><a id="l00195" name="l00195"></a><span class="lineno"> 195</span> this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a0112525d9e79a472e761f8ef402a339f">particles</a> = tmp_particles;</div>
<div class="line"><a id="l00196" name="l00196"></a><span class="lineno"> 196</span> }</div>
<div class="line"><a id="l00197" name="l00197"></a><span class="lineno"> 197</span> </div>
<div class="line"><a id="l00198" name="l00198"></a><span class="lineno"> 198</span> this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a8ca4e21291f60fde619c14099d8c4e8e">t</a> += dt;</div>
<div class="line"><a id="l00199" name="l00199"></a><span class="lineno"> 199</span>}</div>
<div class="line"><a id="l00200" name="l00200"></a><span class="lineno"> 200</span> </div>
<div class="line"><a id="l00201" name="l00201"></a><span class="lineno"><a class="line" href="classPenningTrap.html#ab9ea97a406534bbe621a95215144875e"> 201</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="classPenningTrap.html#ab9ea97a406534bbe621a95215144875e">PenningTrap::evolve_forward_euler</a>(<span class="keywordtype">double</span> dt, <span class="keywordtype">bool</span> particle_interaction)</div>
<div class="line"><a id="l00202" name="l00202"></a><span class="lineno"> 202</span>{</div>
<div class="line"><a id="l00203" name="l00203"></a><span class="lineno"> 203</span> <span class="keywordtype">size_t</span> size = this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a0112525d9e79a472e761f8ef402a339f">particles</a>.size();</div>
<div class="line"><a id="l00204" name="l00204"></a><span class="lineno"> 204</span> <a class="code hl_typedef" href="typedefs_8hpp.html#a3bdfb73a02f88ae32b6128ef747c4aea">vec3</a> force_res[size];</div>
<div class="line"><a id="l00205" name="l00205"></a><span class="lineno"> 205</span> </div>
<div class="line"><a id="l00206" name="l00206"></a><span class="lineno"> 206</span> <a class="code hl_typedef" href="typedefs_8hpp.html#a3bdfb73a02f88ae32b6128ef747c4aea">vec3</a> (<a class="code hl_class" href="classPenningTrap.html">PenningTrap</a>::*force)(uint) = particle_interaction</div>
<div class="line"><a id="l00207" name="l00207"></a><span class="lineno"> 207</span> ? &amp;<a class="code hl_function" href="classPenningTrap.html#a9a301b0540078c36697880ef204afdf3">PenningTrap::total_force</a></div>
<div class="line"><a id="l00208" name="l00208"></a><span class="lineno"> 208</span> : &amp;<a class="code hl_function" href="classPenningTrap.html#a2c01108b52c8e2a003cf9170da9e7682">PenningTrap::total_force_external</a>;</div>
<div class="line"><a id="l00209" name="l00209"></a><span class="lineno"> 209</span> </div>
<div class="line"><a id="l00210" name="l00210"></a><span class="lineno"> 210</span> <span class="comment">// Calculating the force for each particle is independent and therefore</span></div>
<div class="line"><a id="l00211" name="l00211"></a><span class="lineno"> 211</span> <span class="comment">// a good candidate for parallel execution</span></div>
<div class="line"><a id="l00212" name="l00212"></a><span class="lineno"> 212</span><span class="preprocessor">#pragma omp parallel for</span></div>
<div class="line"><a id="l00213" name="l00213"></a><span class="lineno"> 213</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i = 0; i &lt; size; i++) {</div>
<div class="line"><a id="l00214" name="l00214"></a><span class="lineno"> 214</span> force_res[i] = (this-&gt;*force)(i);</div>
<div class="line"><a id="l00215" name="l00215"></a><span class="lineno"> 215</span> }</div>
<div class="line"><a id="l00175" name="l00175"></a><span class="lineno"> 175</span> <span class="comment">// Keep original particles</span></div>
<div class="line"><a id="l00176" name="l00176"></a><span class="lineno"> 176</span> std::vector&lt;Particle&gt; original_particles = this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a0112525d9e79a472e761f8ef402a339f">particles</a>;</div>
<div class="line"><a id="l00177" name="l00177"></a><span class="lineno"> 177</span> std::vector&lt;Particle&gt; tmp_particles = this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a0112525d9e79a472e761f8ef402a339f">particles</a>;</div>
<div class="line"><a id="l00178" name="l00178"></a><span class="lineno"> 178</span> </div>
<div class="line"><a id="l00179" name="l00179"></a><span class="lineno"> 179</span> <a class="code hl_typedef" href="typedefs_8hpp.html#a3bdfb73a02f88ae32b6128ef747c4aea">vec3</a> (<a class="code hl_class" href="classPenningTrap.html">PenningTrap</a>::*force)(uint) =</div>
<div class="line"><a id="l00180" name="l00180"></a><span class="lineno"> 180</span> particle_interaction ? &amp;<a class="code hl_function" href="classPenningTrap.html#a9a301b0540078c36697880ef204afdf3">PenningTrap::total_force</a></div>
<div class="line"><a id="l00181" name="l00181"></a><span class="lineno"> 181</span> : &amp;<a class="code hl_function" href="classPenningTrap.html#a6069f82d8dbc7cadaebd228dbcd95018">PenningTrap::total_force_no_interaction</a>;</div>
<div class="line"><a id="l00182" name="l00182"></a><span class="lineno"> 182</span> </div>
<div class="line"><a id="l00183" name="l00183"></a><span class="lineno"> 183</span> <span class="keywordtype">size_t</span> size = this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a0112525d9e79a472e761f8ef402a339f">particles</a>.size();</div>
<div class="line"><a id="l00184" name="l00184"></a><span class="lineno"> 184</span> </div>
<div class="line"><a id="l00185" name="l00185"></a><span class="lineno"> 185</span> <span class="comment">// Allocating takes a long time, so reuse sim_arr if possible</span></div>
<div class="line"><a id="l00186" name="l00186"></a><span class="lineno"> 186</span> <span class="keywordflow">if</span> (this-&gt;<a class="code hl_variable" href="classPenningTrap.html#ae9b5afdaa5cd366e94bd294452a1eed4">k_v</a>.size() != 4 || this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a2f168622587709b9e3c49077f0b9a640">k_r</a>.size() != 4</div>
<div class="line"><a id="l00187" name="l00187"></a><span class="lineno"> 187</span> || this-&gt;<a class="code hl_variable" href="classPenningTrap.html#ae9b5afdaa5cd366e94bd294452a1eed4">k_v</a>[0].size() != size || this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a2f168622587709b9e3c49077f0b9a640">k_r</a>[0].size() != size) {</div>
<div class="line"><a id="l00188" name="l00188"></a><span class="lineno"> 188</span> this-&gt;<a class="code hl_variable" href="classPenningTrap.html#ae9b5afdaa5cd366e94bd294452a1eed4">k_v</a> = <a class="code hl_typedef" href="typedefs_8hpp.html#aec69d34220fff45de238b9e01f2686af">sim_arr</a>(4, <a class="code hl_typedef" href="typedefs_8hpp.html#a46482a2697556c00556c9d73f461784f">sim_cols</a>(size));</div>
<div class="line"><a id="l00189" name="l00189"></a><span class="lineno"> 189</span> this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a2f168622587709b9e3c49077f0b9a640">k_r</a> = <a class="code hl_typedef" href="typedefs_8hpp.html#aec69d34220fff45de238b9e01f2686af">sim_arr</a>(4, <a class="code hl_typedef" href="typedefs_8hpp.html#a46482a2697556c00556c9d73f461784f">sim_cols</a>(size));</div>
<div class="line"><a id="l00190" name="l00190"></a><span class="lineno"> 190</span> }</div>
<div class="line"><a id="l00191" name="l00191"></a><span class="lineno"> 191</span> </div>
<div class="line"><a id="l00192" name="l00192"></a><span class="lineno"> 192</span> <span class="comment">// Each k_{i+1} is dependent on k_i, so outer loop is not parallelizable</span></div>
<div class="line"><a id="l00193" name="l00193"></a><span class="lineno"> 193</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i = 0; i &lt; 4; i++) {</div>
<div class="line"><a id="l00194" name="l00194"></a><span class="lineno"> 194</span> <span class="comment">// Inner loop is able to be parallelized</span></div>
<div class="line"><a id="l00195" name="l00195"></a><span class="lineno"> 195</span><span class="preprocessor">#pragma omp parallel for private(p)</span></div>
<div class="line"><a id="l00196" name="l00196"></a><span class="lineno"> 196</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> j = 0; j &lt; size; j++) {</div>
<div class="line"><a id="l00197" name="l00197"></a><span class="lineno"> 197</span> this-&gt;<a class="code hl_variable" href="classPenningTrap.html#ae9b5afdaa5cd366e94bd294452a1eed4">k_v</a>[i][j] = (this-&gt;*force)(j) / this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a0112525d9e79a472e761f8ef402a339f">particles</a>[j].m;</div>
<div class="line"><a id="l00198" name="l00198"></a><span class="lineno"> 198</span> this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a2f168622587709b9e3c49077f0b9a640">k_r</a>[i][j] = this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a0112525d9e79a472e761f8ef402a339f">particles</a>[j].v_vec;</div>
<div class="line"><a id="l00199" name="l00199"></a><span class="lineno"> 199</span> </div>
<div class="line"><a id="l00200" name="l00200"></a><span class="lineno"> 200</span> p = &amp;tmp_particles[j];</div>
<div class="line"><a id="l00201" name="l00201"></a><span class="lineno"> 201</span> </div>
<div class="line"><a id="l00202" name="l00202"></a><span class="lineno"> 202</span> p-&gt;<a class="code hl_variable" href="classParticle.html#a3a10400add8dd22b8031330c2aafb6fe">v_vec</a> = original_particles[j].v_vec + this-&gt;<a class="code hl_function" href="classPenningTrap.html#a3c0a44e4e0a94366ff609e81fe463fa2">v_func</a>(i, j, dt);</div>
<div class="line"><a id="l00203" name="l00203"></a><span class="lineno"> 203</span> p-&gt;<a class="code hl_variable" href="classParticle.html#a1c59101411db43624828b766f87ad460">r_vec</a> = original_particles[j].r_vec + this-&gt;<a class="code hl_function" href="classPenningTrap.html#a826b7fa8e709d481eb1dee7d0c2cdc08">r_func</a>(i, j, dt);</div>
<div class="line"><a id="l00204" name="l00204"></a><span class="lineno"> 204</span> }</div>
<div class="line"><a id="l00205" name="l00205"></a><span class="lineno"> 205</span> this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a0112525d9e79a472e761f8ef402a339f">particles</a> = tmp_particles;</div>
<div class="line"><a id="l00206" name="l00206"></a><span class="lineno"> 206</span> }</div>
<div class="line"><a id="l00207" name="l00207"></a><span class="lineno"> 207</span> </div>
<div class="line"><a id="l00208" name="l00208"></a><span class="lineno"> 208</span> this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a8ca4e21291f60fde619c14099d8c4e8e">t</a> += dt;</div>
<div class="line"><a id="l00209" name="l00209"></a><span class="lineno"> 209</span>}</div>
<div class="line"><a id="l00210" name="l00210"></a><span class="lineno"> 210</span> </div>
<div class="line"><a id="l00211" name="l00211"></a><span class="lineno"><a class="line" href="classPenningTrap.html#ab9ea97a406534bbe621a95215144875e"> 211</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="classPenningTrap.html#ab9ea97a406534bbe621a95215144875e">PenningTrap::evolve_forward_euler</a>(<span class="keywordtype">double</span> dt, <span class="keywordtype">bool</span> particle_interaction)</div>
<div class="line"><a id="l00212" name="l00212"></a><span class="lineno"> 212</span>{</div>
<div class="line"><a id="l00213" name="l00213"></a><span class="lineno"> 213</span> <span class="keywordtype">size_t</span> size = this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a0112525d9e79a472e761f8ef402a339f">particles</a>.size();</div>
<div class="line"><a id="l00214" name="l00214"></a><span class="lineno"> 214</span> <a class="code hl_typedef" href="typedefs_8hpp.html#a3bdfb73a02f88ae32b6128ef747c4aea">vec3</a> force_res[size];</div>
<div class="line"><a id="l00215" name="l00215"></a><span class="lineno"> 215</span> <a class="code hl_class" href="classParticle.html">Particle</a> *p;</div>
<div class="line"><a id="l00216" name="l00216"></a><span class="lineno"> 216</span> </div>
<div class="line"><a id="l00217" name="l00217"></a><span class="lineno"> 217</span> <span class="comment">// Updating the particles is also independent, so we can parallelize</span></div>
<div class="line"><a id="l00218" name="l00218"></a><span class="lineno"> 218</span> <span class="comment">// this as well</span></div>
<div class="line"><a id="l00219" name="l00219"></a><span class="lineno"> 219</span><span class="preprocessor">#pragma omp parallel for</span></div>
<div class="line"><a id="l00220" name="l00220"></a><span class="lineno"> 220</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i = 0; i &lt; size; i++) {</div>
<div class="line"><a id="l00221" name="l00221"></a><span class="lineno"> 221</span> this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a0112525d9e79a472e761f8ef402a339f">particles</a>[i].r_vec += dt * this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a0112525d9e79a472e761f8ef402a339f">particles</a>[i].v_vec;</div>
<div class="line"><a id="l00222" name="l00222"></a><span class="lineno"> 222</span> this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a0112525d9e79a472e761f8ef402a339f">particles</a>[i].v_vec += dt * force_res[i] / this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a0112525d9e79a472e761f8ef402a339f">particles</a>[i].m;</div>
<div class="line"><a id="l00223" name="l00223"></a><span class="lineno"> 223</span> }</div>
<div class="line"><a id="l00224" name="l00224"></a><span class="lineno"> 224</span> </div>
<div class="line"><a id="l00225" name="l00225"></a><span class="lineno"> 225</span> this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a8ca4e21291f60fde619c14099d8c4e8e">t</a> += dt;</div>
<div class="line"><a id="l00226" name="l00226"></a><span class="lineno"> 226</span>}</div>
<div class="line"><a id="l00217" name="l00217"></a><span class="lineno"> 217</span> <a class="code hl_typedef" href="typedefs_8hpp.html#a3bdfb73a02f88ae32b6128ef747c4aea">vec3</a> (<a class="code hl_class" href="classPenningTrap.html">PenningTrap</a>::*force)(uint) =</div>
<div class="line"><a id="l00218" name="l00218"></a><span class="lineno"> 218</span> particle_interaction ? &amp;<a class="code hl_function" href="classPenningTrap.html#a9a301b0540078c36697880ef204afdf3">PenningTrap::total_force</a></div>
<div class="line"><a id="l00219" name="l00219"></a><span class="lineno"> 219</span> : &amp;<a class="code hl_function" href="classPenningTrap.html#a6069f82d8dbc7cadaebd228dbcd95018">PenningTrap::total_force_no_interaction</a>;</div>
<div class="line"><a id="l00220" name="l00220"></a><span class="lineno"> 220</span> </div>
<div class="line"><a id="l00221" name="l00221"></a><span class="lineno"> 221</span> <span class="comment">// Calculating the force for each particle is independent and therefore</span></div>
<div class="line"><a id="l00222" name="l00222"></a><span class="lineno"> 222</span> <span class="comment">// a good candidate for parallel execution</span></div>
<div class="line"><a id="l00223" name="l00223"></a><span class="lineno"> 223</span><span class="preprocessor">#pragma omp parallel for</span></div>
<div class="line"><a id="l00224" name="l00224"></a><span class="lineno"> 224</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i = 0; i &lt; size; i++) {</div>
<div class="line"><a id="l00225" name="l00225"></a><span class="lineno"> 225</span> force_res[i] = (this-&gt;*force)(i);</div>
<div class="line"><a id="l00226" name="l00226"></a><span class="lineno"> 226</span> }</div>
<div class="line"><a id="l00227" name="l00227"></a><span class="lineno"> 227</span> </div>
<div class="line"><a id="l00228" name="l00228"></a><span class="lineno"><a class="line" href="classPenningTrap.html#a7a1d9f0528a12308de25bc30718da20a"> 228</a></span><a class="code hl_struct" href="structsimulation.html">simulation_t</a> <a class="code hl_function" href="classPenningTrap.html#a7a1d9f0528a12308de25bc30718da20a">PenningTrap::simulate</a>(<span class="keywordtype">double</span> time, uint steps, std::string method,</div>
<div class="line"><a id="l00229" name="l00229"></a><span class="lineno"> 229</span> <span class="keywordtype">bool</span> particle_interaction)</div>
<div class="line"><a id="l00230" name="l00230"></a><span class="lineno"> 230</span>{</div>
<div class="line"><a id="l00231" name="l00231"></a><span class="lineno"> 231</span> <span class="keywordtype">double</span> dt = time / (double)steps;</div>
<div class="line"><a id="l00232" name="l00232"></a><span class="lineno"> 232</span> </div>
<div class="line"><a id="l00233" name="l00233"></a><span class="lineno"> 233</span> uint size = this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a0112525d9e79a472e761f8ef402a339f">particles</a>.size();</div>
<div class="line"><a id="l00234" name="l00234"></a><span class="lineno"> 234</span> </div>
<div class="line"><a id="l00235" name="l00235"></a><span class="lineno"> 235</span> <a class="code hl_struct" href="structsimulation.html">simulation_t</a> res{<a class="code hl_typedef" href="typedefs_8hpp.html#aec69d34220fff45de238b9e01f2686af">sim_arr</a>(size, <a class="code hl_typedef" href="typedefs_8hpp.html#a46482a2697556c00556c9d73f461784f">sim_cols</a>(steps)),</div>
<div class="line"><a id="l00236" name="l00236"></a><span class="lineno"> 236</span> <a class="code hl_typedef" href="typedefs_8hpp.html#aec69d34220fff45de238b9e01f2686af">sim_arr</a>(size, <a class="code hl_typedef" href="typedefs_8hpp.html#a46482a2697556c00556c9d73f461784f">sim_cols</a>(steps))};</div>
<div class="line"><a id="l00237" name="l00237"></a><span class="lineno"> 237</span> </div>
<div class="line"><a id="l00238" name="l00238"></a><span class="lineno"> 238</span> void (<a class="code hl_class" href="classPenningTrap.html">PenningTrap</a>::*func)(double, bool);</div>
<div class="line"><a id="l00239" name="l00239"></a><span class="lineno"> 239</span> <span class="keywordflow">if</span> (method == <span class="stringliteral">&quot;rk4&quot;</span>) {</div>
<div class="line"><a id="l00240" name="l00240"></a><span class="lineno"> 240</span> func = &amp;<a class="code hl_function" href="classPenningTrap.html#a36946152fd951b1f7c346c51ff900d8e">PenningTrap::evolve_RK4</a>;</div>
<div class="line"><a id="l00241" name="l00241"></a><span class="lineno"> 241</span> } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (method == <span class="stringliteral">&quot;euler&quot;</span>) {</div>
<div class="line"><a id="l00242" name="l00242"></a><span class="lineno"> 242</span> func = &amp;<a class="code hl_function" href="classPenningTrap.html#ab9ea97a406534bbe621a95215144875e">PenningTrap::evolve_forward_euler</a>;</div>
<div class="line"><a id="l00243" name="l00243"></a><span class="lineno"> 243</span> } <span class="keywordflow">else</span> {</div>
<div class="line"><a id="l00244" name="l00244"></a><span class="lineno"> 244</span> std::cout &lt;&lt; <span class="stringliteral">&quot;Not a valid method!&quot;</span> &lt;&lt; std::endl;</div>
<div class="line"><a id="l00245" name="l00245"></a><span class="lineno"> 245</span> abort();</div>
<div class="line"><a id="l00246" name="l00246"></a><span class="lineno"> 246</span> }</div>
<div class="line"><a id="l00228" name="l00228"></a><span class="lineno"> 228</span> <span class="comment">// Updating the particles is also independent, so we can parallelize</span></div>
<div class="line"><a id="l00229" name="l00229"></a><span class="lineno"> 229</span> <span class="comment">// this as well</span></div>
<div class="line"><a id="l00230" name="l00230"></a><span class="lineno"> 230</span><span class="preprocessor">#pragma omp parallel for</span></div>
<div class="line"><a id="l00231" name="l00231"></a><span class="lineno"> 231</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i = 0; i &lt; size; i++) {</div>
<div class="line"><a id="l00232" name="l00232"></a><span class="lineno"> 232</span> p = &amp;this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a0112525d9e79a472e761f8ef402a339f">particles</a>[i];</div>
<div class="line"><a id="l00233" name="l00233"></a><span class="lineno"> 233</span> p-&gt;<a class="code hl_variable" href="classParticle.html#a1c59101411db43624828b766f87ad460">r_vec</a> += dt * p-&gt;<a class="code hl_variable" href="classParticle.html#a3a10400add8dd22b8031330c2aafb6fe">v_vec</a>;</div>
<div class="line"><a id="l00234" name="l00234"></a><span class="lineno"> 234</span> p-&gt;<a class="code hl_variable" href="classParticle.html#a3a10400add8dd22b8031330c2aafb6fe">v_vec</a> += dt * force_res[i] / p-&gt;<a class="code hl_variable" href="classParticle.html#aedcc7e1bc53b0e2b1a4a07c9a1b47563">m</a>;</div>
<div class="line"><a id="l00235" name="l00235"></a><span class="lineno"> 235</span> }</div>
<div class="line"><a id="l00236" name="l00236"></a><span class="lineno"> 236</span> </div>
<div class="line"><a id="l00237" name="l00237"></a><span class="lineno"> 237</span> this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a8ca4e21291f60fde619c14099d8c4e8e">t</a> += dt;</div>
<div class="line"><a id="l00238" name="l00238"></a><span class="lineno"> 238</span>}</div>
<div class="line"><a id="l00239" name="l00239"></a><span class="lineno"> 239</span> </div>
<div class="line"><a id="l00240" name="l00240"></a><span class="lineno"><a class="line" href="classPenningTrap.html#a7a1d9f0528a12308de25bc30718da20a"> 240</a></span><a class="code hl_struct" href="structsimulation.html">simulation_t</a> <a class="code hl_function" href="classPenningTrap.html#a7a1d9f0528a12308de25bc30718da20a">PenningTrap::simulate</a>(<span class="keywordtype">double</span> time, uint steps, std::string method,</div>
<div class="line"><a id="l00241" name="l00241"></a><span class="lineno"> 241</span> <span class="keywordtype">bool</span> particle_interaction)</div>
<div class="line"><a id="l00242" name="l00242"></a><span class="lineno"> 242</span>{</div>
<div class="line"><a id="l00243" name="l00243"></a><span class="lineno"> 243</span> <a class="code hl_class" href="classParticle.html">Particle</a> *p;</div>
<div class="line"><a id="l00244" name="l00244"></a><span class="lineno"> 244</span> <span class="keywordtype">double</span> dt = time / (double)steps;</div>
<div class="line"><a id="l00245" name="l00245"></a><span class="lineno"> 245</span> </div>
<div class="line"><a id="l00246" name="l00246"></a><span class="lineno"> 246</span> uint size = this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a0112525d9e79a472e761f8ef402a339f">particles</a>.size();</div>
<div class="line"><a id="l00247" name="l00247"></a><span class="lineno"> 247</span> </div>
<div class="line"><a id="l00248" name="l00248"></a><span class="lineno"> 248</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> j = 0; j &lt; steps; j++) {</div>
<div class="line"><a id="l00249" name="l00249"></a><span class="lineno"> 249</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i = 0; i &lt; size; i++) {</div>
<div class="line"><a id="l00250" name="l00250"></a><span class="lineno"> 250</span> res.r_vecs[i][j] = this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a0112525d9e79a472e761f8ef402a339f">particles</a>[i].r_vec;</div>
<div class="line"><a id="l00251" name="l00251"></a><span class="lineno"> 251</span> res.v_vecs[i][j] = this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a0112525d9e79a472e761f8ef402a339f">particles</a>[i].v_vec;</div>
<div class="line"><a id="l00252" name="l00252"></a><span class="lineno"> 252</span> }</div>
<div class="line"><a id="l00253" name="l00253"></a><span class="lineno"> 253</span> (this-&gt;*func)(dt, particle_interaction);</div>
<div class="line"><a id="l00254" name="l00254"></a><span class="lineno"> 254</span> }</div>
<div class="line"><a id="l00255" name="l00255"></a><span class="lineno"> 255</span> </div>
<div class="line"><a id="l00256" name="l00256"></a><span class="lineno"> 256</span> <span class="keywordflow">return</span> res;</div>
<div class="line"><a id="l00257" name="l00257"></a><span class="lineno"> 257</span>}</div>
<div class="line"><a id="l00258" name="l00258"></a><span class="lineno"> 258</span> </div>
<div class="line"><a id="l00259" name="l00259"></a><span class="lineno"><a class="line" href="classPenningTrap.html#ad8bc4df7ab3eed53b16cfdff38e7760b"> 259</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="classPenningTrap.html#ad8bc4df7ab3eed53b16cfdff38e7760b">PenningTrap::write_simulation_to_dir</a>(std::string path, <span class="keywordtype">double</span> time,</div>
<div class="line"><a id="l00260" name="l00260"></a><span class="lineno"> 260</span> uint steps, std::string method,</div>
<div class="line"><a id="l00261" name="l00261"></a><span class="lineno"> 261</span> <span class="keywordtype">bool</span> particle_interaction)</div>
<div class="line"><a id="l00262" name="l00262"></a><span class="lineno"> 262</span>{</div>
<div class="line"><a id="l00263" name="l00263"></a><span class="lineno"> 263</span> <span class="keywordflow">if</span> (path.back() != <span class="charliteral">&#39;/&#39;</span>) {</div>
<div class="line"><a id="l00264" name="l00264"></a><span class="lineno"> 264</span> path += <span class="charliteral">&#39;/&#39;</span>;</div>
<div class="line"><a id="l00265" name="l00265"></a><span class="lineno"> 265</span> }</div>
<div class="line"><a id="l00266" name="l00266"></a><span class="lineno"> 266</span> <span class="keywordflow">if</span> (<a class="code hl_function" href="utils_8hpp.html#a6fdd7217b750aff5b6295ece7cbdeffa">mkpath</a>(path, 0777) != 0) {</div>
<div class="line"><a id="l00267" name="l00267"></a><span class="lineno"> 267</span> std::cout &lt;&lt; <span class="stringliteral">&quot;Failed to make path&quot;</span> &lt;&lt; std::endl;</div>
<div class="line"><a id="l00268" name="l00268"></a><span class="lineno"> 268</span> abort();</div>
<div class="line"><a id="l00269" name="l00269"></a><span class="lineno"> 269</span> }</div>
<div class="line"><a id="l00270" name="l00270"></a><span class="lineno"> 270</span> </div>
<div class="line"><a id="l00271" name="l00271"></a><span class="lineno"> 271</span> <a class="code hl_struct" href="structsimulation.html">simulation_t</a> res =</div>
<div class="line"><a id="l00272" name="l00272"></a><span class="lineno"> 272</span> this-&gt;<a class="code hl_function" href="classPenningTrap.html#a7a1d9f0528a12308de25bc30718da20a">simulate</a>(time, steps, method, particle_interaction);</div>
<div class="line"><a id="l00273" name="l00273"></a><span class="lineno"> 273</span> </div>
<div class="line"><a id="l00274" name="l00274"></a><span class="lineno"> 274</span> std::ofstream ofile;</div>
<div class="line"><a id="l00275" name="l00275"></a><span class="lineno"> 275</span> </div>
<div class="line"><a id="l00276" name="l00276"></a><span class="lineno"> 276</span> <span class="comment">// Writing each particle to its own file is independent and can be run in</span></div>
<div class="line"><a id="l00277" name="l00277"></a><span class="lineno"> 277</span> <span class="comment">// parallel.</span></div>
<div class="line"><a id="l00278" name="l00278"></a><span class="lineno"> 278</span><span class="preprocessor">#pragma omp parallel for private(ofile)</span></div>
<div class="line"><a id="l00279" name="l00279"></a><span class="lineno"> 279</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i = 0; i &lt; this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a0112525d9e79a472e761f8ef402a339f">particles</a>.size(); i++) {</div>
<div class="line"><a id="l00280" name="l00280"></a><span class="lineno"> 280</span> ofile.open(path + <span class="stringliteral">&quot;particle_&quot;</span> + std::to_string(i) + <span class="stringliteral">&quot;_r.txt&quot;</span>);</div>
<div class="line"><a id="l00281" name="l00281"></a><span class="lineno"> 281</span> <span class="keywordflow">for</span> (<a class="code hl_typedef" href="typedefs_8hpp.html#a3bdfb73a02f88ae32b6128ef747c4aea">vec3</a> &amp;vec : res.r_vecs[i]) {</div>
<div class="line"><a id="l00282" name="l00282"></a><span class="lineno"> 282</span> ofile &lt;&lt; <a class="code hl_function" href="utils_8hpp.html#adfb618b2fdff47ef30a4a2b62c04f384">scientific_format</a>(vec(0), 10, 8) &lt;&lt; <span class="charliteral">&#39;,&#39;</span></div>
<div class="line"><a id="l00283" name="l00283"></a><span class="lineno"> 283</span> &lt;&lt; <a class="code hl_function" href="utils_8hpp.html#adfb618b2fdff47ef30a4a2b62c04f384">scientific_format</a>(vec(1), 10, 8) &lt;&lt; <span class="charliteral">&#39;,&#39;</span></div>
<div class="line"><a id="l00284" name="l00284"></a><span class="lineno"> 284</span> &lt;&lt; <a class="code hl_function" href="utils_8hpp.html#adfb618b2fdff47ef30a4a2b62c04f384">scientific_format</a>(vec(2), 10, 8) &lt;&lt; <span class="charliteral">&#39;\n&#39;</span>;</div>
<div class="line"><a id="l00285" name="l00285"></a><span class="lineno"> 285</span> }</div>
<div class="line"><a id="l00286" name="l00286"></a><span class="lineno"> 286</span> ofile.close();</div>
<div class="line"><a id="l00287" name="l00287"></a><span class="lineno"> 287</span> ofile.open(path + <span class="stringliteral">&quot;particle_&quot;</span> + std::to_string(i) + <span class="stringliteral">&quot;_v.txt&quot;</span>);</div>
<div class="line"><a id="l00288" name="l00288"></a><span class="lineno"> 288</span> <span class="keywordflow">for</span> (<a class="code hl_typedef" href="typedefs_8hpp.html#a3bdfb73a02f88ae32b6128ef747c4aea">vec3</a> &amp;vec : res.v_vecs[i]) {</div>
<div class="line"><a id="l00289" name="l00289"></a><span class="lineno"> 289</span> ofile &lt;&lt; <a class="code hl_function" href="utils_8hpp.html#adfb618b2fdff47ef30a4a2b62c04f384">scientific_format</a>(vec(0), 10, 8) &lt;&lt; <span class="charliteral">&#39;,&#39;</span></div>
<div class="line"><a id="l00290" name="l00290"></a><span class="lineno"> 290</span> &lt;&lt; <a class="code hl_function" href="utils_8hpp.html#adfb618b2fdff47ef30a4a2b62c04f384">scientific_format</a>(vec(1), 10, 8) &lt;&lt; <span class="charliteral">&#39;,&#39;</span></div>
<div class="line"><a id="l00291" name="l00291"></a><span class="lineno"> 291</span> &lt;&lt; <a class="code hl_function" href="utils_8hpp.html#adfb618b2fdff47ef30a4a2b62c04f384">scientific_format</a>(vec(2), 10, 8) &lt;&lt; <span class="charliteral">&#39;\n&#39;</span>;</div>
<div class="line"><a id="l00292" name="l00292"></a><span class="lineno"> 292</span> }</div>
<div class="line"><a id="l00293" name="l00293"></a><span class="lineno"> 293</span> ofile.close();</div>
<div class="line"><a id="l00294" name="l00294"></a><span class="lineno"> 294</span> }</div>
<div class="line"><a id="l00295" name="l00295"></a><span class="lineno"> 295</span>}</div>
<div class="line"><a id="l00296" name="l00296"></a><span class="lineno"> 296</span> </div>
<div class="line"><a id="l00297" name="l00297"></a><span class="lineno"><a class="line" href="classPenningTrap.html#ac529aa26c288f34eae184a67e6bac41f"> 297</a></span><span class="keywordtype">double</span> <a class="code hl_function" href="classPenningTrap.html#ac529aa26c288f34eae184a67e6bac41f">PenningTrap::fraction_of_particles_left</a>(<span class="keywordtype">double</span> time, uint steps,</div>
<div class="line"><a id="l00298" name="l00298"></a><span class="lineno"> 298</span> std::string method,</div>
<div class="line"><a id="l00299" name="l00299"></a><span class="lineno"> 299</span> <span class="keywordtype">bool</span> particle_interaction)</div>
<div class="line"><a id="l00300" name="l00300"></a><span class="lineno"> 300</span>{</div>
<div class="line"><a id="l00301" name="l00301"></a><span class="lineno"> 301</span> <span class="keywordtype">double</span> dt = time / (double)steps;</div>
<div class="line"><a id="l00302" name="l00302"></a><span class="lineno"> 302</span> </div>
<div class="line"><a id="l00303" name="l00303"></a><span class="lineno"> 303</span> void (<a class="code hl_class" href="classPenningTrap.html">PenningTrap</a>::*func)(double, bool);</div>
<div class="line"><a id="l00304" name="l00304"></a><span class="lineno"> 304</span> <span class="keywordflow">if</span> (method == <span class="stringliteral">&quot;rk4&quot;</span>) {</div>
<div class="line"><a id="l00305" name="l00305"></a><span class="lineno"> 305</span> func = &amp;<a class="code hl_function" href="classPenningTrap.html#a36946152fd951b1f7c346c51ff900d8e">PenningTrap::evolve_RK4</a>;</div>
<div class="line"><a id="l00306" name="l00306"></a><span class="lineno"> 306</span> } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (method == <span class="stringliteral">&quot;euler&quot;</span>) {</div>
<div class="line"><a id="l00307" name="l00307"></a><span class="lineno"> 307</span> func = &amp;<a class="code hl_function" href="classPenningTrap.html#ab9ea97a406534bbe621a95215144875e">PenningTrap::evolve_forward_euler</a>;</div>
<div class="line"><a id="l00308" name="l00308"></a><span class="lineno"> 308</span> } <span class="keywordflow">else</span> {</div>
<div class="line"><a id="l00309" name="l00309"></a><span class="lineno"> 309</span> std::cout &lt;&lt; <span class="stringliteral">&quot;Not a valid method!&quot;</span> &lt;&lt; std::endl;</div>
<div class="line"><a id="l00310" name="l00310"></a><span class="lineno"> 310</span> abort();</div>
<div class="line"><a id="l00311" name="l00311"></a><span class="lineno"> 311</span> }</div>
<div class="line"><a id="l00312" name="l00312"></a><span class="lineno"> 312</span> </div>
<div class="line"><a id="l00313" name="l00313"></a><span class="lineno"> 313</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> j = 0; j &lt; steps; j++) {</div>
<div class="line"><a id="l00314" name="l00314"></a><span class="lineno"> 314</span> (this-&gt;*func)(dt, particle_interaction);</div>
<div class="line"><a id="l00315" name="l00315"></a><span class="lineno"> 315</span> }</div>
<div class="line"><a id="l00248" name="l00248"></a><span class="lineno"> 248</span> <a class="code hl_struct" href="structsimulation.html">simulation_t</a> res{<a class="code hl_typedef" href="typedefs_8hpp.html#aec69d34220fff45de238b9e01f2686af">sim_arr</a>(size, <a class="code hl_typedef" href="typedefs_8hpp.html#a46482a2697556c00556c9d73f461784f">sim_cols</a>(steps)),</div>
<div class="line"><a id="l00249" name="l00249"></a><span class="lineno"> 249</span> <a class="code hl_typedef" href="typedefs_8hpp.html#aec69d34220fff45de238b9e01f2686af">sim_arr</a>(size, <a class="code hl_typedef" href="typedefs_8hpp.html#a46482a2697556c00556c9d73f461784f">sim_cols</a>(steps))};</div>
<div class="line"><a id="l00250" name="l00250"></a><span class="lineno"> 250</span> </div>
<div class="line"><a id="l00251" name="l00251"></a><span class="lineno"> 251</span> void (<a class="code hl_class" href="classPenningTrap.html">PenningTrap</a>::*func)(double, bool);</div>
<div class="line"><a id="l00252" name="l00252"></a><span class="lineno"> 252</span> <span class="keywordflow">if</span> (method == <span class="stringliteral">&quot;rk4&quot;</span>) {</div>
<div class="line"><a id="l00253" name="l00253"></a><span class="lineno"> 253</span> func = &amp;<a class="code hl_function" href="classPenningTrap.html#a36946152fd951b1f7c346c51ff900d8e">PenningTrap::evolve_RK4</a>;</div>
<div class="line"><a id="l00254" name="l00254"></a><span class="lineno"> 254</span> } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (method == <span class="stringliteral">&quot;euler&quot;</span>) {</div>
<div class="line"><a id="l00255" name="l00255"></a><span class="lineno"> 255</span> func = &amp;<a class="code hl_function" href="classPenningTrap.html#ab9ea97a406534bbe621a95215144875e">PenningTrap::evolve_forward_euler</a>;</div>
<div class="line"><a id="l00256" name="l00256"></a><span class="lineno"> 256</span> } <span class="keywordflow">else</span> {</div>
<div class="line"><a id="l00257" name="l00257"></a><span class="lineno"> 257</span> std::cout &lt;&lt; <span class="stringliteral">&quot;Not a valid method!&quot;</span> &lt;&lt; std::endl;</div>
<div class="line"><a id="l00258" name="l00258"></a><span class="lineno"> 258</span> abort();</div>
<div class="line"><a id="l00259" name="l00259"></a><span class="lineno"> 259</span> }</div>
<div class="line"><a id="l00260" name="l00260"></a><span class="lineno"> 260</span> </div>
<div class="line"><a id="l00261" name="l00261"></a><span class="lineno"> 261</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> j = 0; j &lt; steps; j++) {</div>
<div class="line"><a id="l00262" name="l00262"></a><span class="lineno"> 262</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i = 0; i &lt; size; i++) {</div>
<div class="line"><a id="l00263" name="l00263"></a><span class="lineno"> 263</span> p = &amp;this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a0112525d9e79a472e761f8ef402a339f">particles</a>[i];</div>
<div class="line"><a id="l00264" name="l00264"></a><span class="lineno"> 264</span> res.r_vecs[i][j] = p-&gt;<a class="code hl_variable" href="classParticle.html#a1c59101411db43624828b766f87ad460">r_vec</a>;</div>
<div class="line"><a id="l00265" name="l00265"></a><span class="lineno"> 265</span> res.v_vecs[i][j] = p-&gt;<a class="code hl_variable" href="classParticle.html#a3a10400add8dd22b8031330c2aafb6fe">v_vec</a>;</div>
<div class="line"><a id="l00266" name="l00266"></a><span class="lineno"> 266</span> }</div>
<div class="line"><a id="l00267" name="l00267"></a><span class="lineno"> 267</span> (this-&gt;*func)(dt, particle_interaction);</div>
<div class="line"><a id="l00268" name="l00268"></a><span class="lineno"> 268</span> }</div>
<div class="line"><a id="l00269" name="l00269"></a><span class="lineno"> 269</span> </div>
<div class="line"><a id="l00270" name="l00270"></a><span class="lineno"> 270</span> <span class="keywordflow">return</span> res;</div>
<div class="line"><a id="l00271" name="l00271"></a><span class="lineno"> 271</span>}</div>
<div class="line"><a id="l00272" name="l00272"></a><span class="lineno"> 272</span> </div>
<div class="line"><a id="l00273" name="l00273"></a><span class="lineno"><a class="line" href="classPenningTrap.html#ad8bc4df7ab3eed53b16cfdff38e7760b"> 273</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="classPenningTrap.html#ad8bc4df7ab3eed53b16cfdff38e7760b">PenningTrap::write_simulation_to_dir</a>(std::string path, <span class="keywordtype">double</span> time,</div>
<div class="line"><a id="l00274" name="l00274"></a><span class="lineno"> 274</span> uint steps, std::string method,</div>
<div class="line"><a id="l00275" name="l00275"></a><span class="lineno"> 275</span> <span class="keywordtype">bool</span> particle_interaction)</div>
<div class="line"><a id="l00276" name="l00276"></a><span class="lineno"> 276</span>{</div>
<div class="line"><a id="l00277" name="l00277"></a><span class="lineno"> 277</span> <span class="keywordflow">if</span> (path.back() != <span class="charliteral">&#39;/&#39;</span>) {</div>
<div class="line"><a id="l00278" name="l00278"></a><span class="lineno"> 278</span> path += <span class="charliteral">&#39;/&#39;</span>;</div>
<div class="line"><a id="l00279" name="l00279"></a><span class="lineno"> 279</span> }</div>
<div class="line"><a id="l00280" name="l00280"></a><span class="lineno"> 280</span> <span class="keywordflow">if</span> (<a class="code hl_function" href="utils_8hpp.html#a6fdd7217b750aff5b6295ece7cbdeffa">mkpath</a>(path, 0777) != 0) {</div>
<div class="line"><a id="l00281" name="l00281"></a><span class="lineno"> 281</span> std::cout &lt;&lt; <span class="stringliteral">&quot;Failed to make path&quot;</span> &lt;&lt; std::endl;</div>
<div class="line"><a id="l00282" name="l00282"></a><span class="lineno"> 282</span> abort();</div>
<div class="line"><a id="l00283" name="l00283"></a><span class="lineno"> 283</span> }</div>
<div class="line"><a id="l00284" name="l00284"></a><span class="lineno"> 284</span> </div>
<div class="line"><a id="l00285" name="l00285"></a><span class="lineno"> 285</span> <a class="code hl_struct" href="structsimulation.html">simulation_t</a> res =</div>
<div class="line"><a id="l00286" name="l00286"></a><span class="lineno"> 286</span> this-&gt;<a class="code hl_function" href="classPenningTrap.html#a7a1d9f0528a12308de25bc30718da20a">simulate</a>(time, steps, method, particle_interaction);</div>
<div class="line"><a id="l00287" name="l00287"></a><span class="lineno"> 287</span> </div>
<div class="line"><a id="l00288" name="l00288"></a><span class="lineno"> 288</span> std::ofstream ofile;</div>
<div class="line"><a id="l00289" name="l00289"></a><span class="lineno"> 289</span> </div>
<div class="line"><a id="l00290" name="l00290"></a><span class="lineno"> 290</span> <span class="comment">// Writing each particle to its own file is independent and can be run in</span></div>
<div class="line"><a id="l00291" name="l00291"></a><span class="lineno"> 291</span> <span class="comment">// parallel.</span></div>
<div class="line"><a id="l00292" name="l00292"></a><span class="lineno"> 292</span><span class="preprocessor">#pragma omp parallel for private(ofile)</span></div>
<div class="line"><a id="l00293" name="l00293"></a><span class="lineno"> 293</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i = 0; i &lt; this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a0112525d9e79a472e761f8ef402a339f">particles</a>.size(); i++) {</div>
<div class="line"><a id="l00294" name="l00294"></a><span class="lineno"> 294</span> ofile.open(path + <span class="stringliteral">&quot;particle_&quot;</span> + std::to_string(i) + <span class="stringliteral">&quot;_r.txt&quot;</span>);</div>
<div class="line"><a id="l00295" name="l00295"></a><span class="lineno"> 295</span> <span class="keywordflow">for</span> (<a class="code hl_typedef" href="typedefs_8hpp.html#a3bdfb73a02f88ae32b6128ef747c4aea">vec3</a> &amp;vec : res.r_vecs[i]) {</div>
<div class="line"><a id="l00296" name="l00296"></a><span class="lineno"> 296</span> ofile &lt;&lt; <a class="code hl_function" href="utils_8hpp.html#adfb618b2fdff47ef30a4a2b62c04f384">scientific_format</a>(vec(0), 10, 8) &lt;&lt; <span class="charliteral">&#39;,&#39;</span></div>
<div class="line"><a id="l00297" name="l00297"></a><span class="lineno"> 297</span> &lt;&lt; <a class="code hl_function" href="utils_8hpp.html#adfb618b2fdff47ef30a4a2b62c04f384">scientific_format</a>(vec(1), 10, 8) &lt;&lt; <span class="charliteral">&#39;,&#39;</span></div>
<div class="line"><a id="l00298" name="l00298"></a><span class="lineno"> 298</span> &lt;&lt; <a class="code hl_function" href="utils_8hpp.html#adfb618b2fdff47ef30a4a2b62c04f384">scientific_format</a>(vec(2), 10, 8) &lt;&lt; <span class="charliteral">&#39;\n&#39;</span>;</div>
<div class="line"><a id="l00299" name="l00299"></a><span class="lineno"> 299</span> }</div>
<div class="line"><a id="l00300" name="l00300"></a><span class="lineno"> 300</span> ofile.close();</div>
<div class="line"><a id="l00301" name="l00301"></a><span class="lineno"> 301</span> ofile.open(path + <span class="stringliteral">&quot;particle_&quot;</span> + std::to_string(i) + <span class="stringliteral">&quot;_v.txt&quot;</span>);</div>
<div class="line"><a id="l00302" name="l00302"></a><span class="lineno"> 302</span> <span class="keywordflow">for</span> (<a class="code hl_typedef" href="typedefs_8hpp.html#a3bdfb73a02f88ae32b6128ef747c4aea">vec3</a> &amp;vec : res.v_vecs[i]) {</div>
<div class="line"><a id="l00303" name="l00303"></a><span class="lineno"> 303</span> ofile &lt;&lt; <a class="code hl_function" href="utils_8hpp.html#adfb618b2fdff47ef30a4a2b62c04f384">scientific_format</a>(vec(0), 10, 8) &lt;&lt; <span class="charliteral">&#39;,&#39;</span></div>
<div class="line"><a id="l00304" name="l00304"></a><span class="lineno"> 304</span> &lt;&lt; <a class="code hl_function" href="utils_8hpp.html#adfb618b2fdff47ef30a4a2b62c04f384">scientific_format</a>(vec(1), 10, 8) &lt;&lt; <span class="charliteral">&#39;,&#39;</span></div>
<div class="line"><a id="l00305" name="l00305"></a><span class="lineno"> 305</span> &lt;&lt; <a class="code hl_function" href="utils_8hpp.html#adfb618b2fdff47ef30a4a2b62c04f384">scientific_format</a>(vec(2), 10, 8) &lt;&lt; <span class="charliteral">&#39;\n&#39;</span>;</div>
<div class="line"><a id="l00306" name="l00306"></a><span class="lineno"> 306</span> }</div>
<div class="line"><a id="l00307" name="l00307"></a><span class="lineno"> 307</span> ofile.close();</div>
<div class="line"><a id="l00308" name="l00308"></a><span class="lineno"> 308</span> }</div>
<div class="line"><a id="l00309" name="l00309"></a><span class="lineno"> 309</span>}</div>
<div class="line"><a id="l00310" name="l00310"></a><span class="lineno"> 310</span> </div>
<div class="line"><a id="l00311" name="l00311"></a><span class="lineno"><a class="line" href="classPenningTrap.html#ac529aa26c288f34eae184a67e6bac41f"> 311</a></span><span class="keywordtype">double</span> <a class="code hl_function" href="classPenningTrap.html#ac529aa26c288f34eae184a67e6bac41f">PenningTrap::fraction_of_particles_left</a>(<span class="keywordtype">double</span> time, uint steps,</div>
<div class="line"><a id="l00312" name="l00312"></a><span class="lineno"> 312</span> std::string method,</div>
<div class="line"><a id="l00313" name="l00313"></a><span class="lineno"> 313</span> <span class="keywordtype">bool</span> particle_interaction)</div>
<div class="line"><a id="l00314" name="l00314"></a><span class="lineno"> 314</span>{</div>
<div class="line"><a id="l00315" name="l00315"></a><span class="lineno"> 315</span> <span class="keywordtype">double</span> dt = time / (double)steps;</div>
<div class="line"><a id="l00316" name="l00316"></a><span class="lineno"> 316</span> </div>
<div class="line"><a id="l00317" name="l00317"></a><span class="lineno"> 317</span> <span class="keywordtype">int</span> particles_left = 0;</div>
<div class="line"><a id="l00318" name="l00318"></a><span class="lineno"> 318</span> </div>
<div class="line"><a id="l00319" name="l00319"></a><span class="lineno"> 319</span> <span class="comment">// A reduction is perfect here</span></div>
<div class="line"><a id="l00320" name="l00320"></a><span class="lineno"> 320</span><span class="preprocessor">#pragma omp parallel for reduction(+ : particles_left)</span></div>
<div class="line"><a id="l00321" name="l00321"></a><span class="lineno"> 321</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i = 0; i &lt; this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a0112525d9e79a472e761f8ef402a339f">particles</a>.size(); i++) {</div>
<div class="line"><a id="l00322" name="l00322"></a><span class="lineno"> 322</span> <span class="keywordflow">if</span> (arma::norm(this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a0112525d9e79a472e761f8ef402a339f">particles</a>[i].r_vec) &lt; this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a66dfe89c68716b9502927b97f59c27d2">d</a>) {</div>
<div class="line"><a id="l00323" name="l00323"></a><span class="lineno"> 323</span> particles_left++;</div>
<div class="line"><a id="l00324" name="l00324"></a><span class="lineno"> 324</span> }</div>
<div class="line"><a id="l00317" name="l00317"></a><span class="lineno"> 317</span> void (<a class="code hl_class" href="classPenningTrap.html">PenningTrap</a>::*func)(double, bool);</div>
<div class="line"><a id="l00318" name="l00318"></a><span class="lineno"> 318</span> <span class="keywordflow">if</span> (method == <span class="stringliteral">&quot;rk4&quot;</span>) {</div>
<div class="line"><a id="l00319" name="l00319"></a><span class="lineno"> 319</span> func = &amp;<a class="code hl_function" href="classPenningTrap.html#a36946152fd951b1f7c346c51ff900d8e">PenningTrap::evolve_RK4</a>;</div>
<div class="line"><a id="l00320" name="l00320"></a><span class="lineno"> 320</span> } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (method == <span class="stringliteral">&quot;euler&quot;</span>) {</div>
<div class="line"><a id="l00321" name="l00321"></a><span class="lineno"> 321</span> func = &amp;<a class="code hl_function" href="classPenningTrap.html#ab9ea97a406534bbe621a95215144875e">PenningTrap::evolve_forward_euler</a>;</div>
<div class="line"><a id="l00322" name="l00322"></a><span class="lineno"> 322</span> } <span class="keywordflow">else</span> {</div>
<div class="line"><a id="l00323" name="l00323"></a><span class="lineno"> 323</span> std::cout &lt;&lt; <span class="stringliteral">&quot;Not a valid method!&quot;</span> &lt;&lt; std::endl;</div>
<div class="line"><a id="l00324" name="l00324"></a><span class="lineno"> 324</span> abort();</div>
<div class="line"><a id="l00325" name="l00325"></a><span class="lineno"> 325</span> }</div>
<div class="line"><a id="l00326" name="l00326"></a><span class="lineno"> 326</span> </div>
<div class="line"><a id="l00327" name="l00327"></a><span class="lineno"> 327</span> <span class="keywordflow">return</span> (<span class="keywordtype">double</span>)particles_left / (double)this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a0112525d9e79a472e761f8ef402a339f">particles</a>.size();</div>
<div class="line"><a id="l00328" name="l00328"></a><span class="lineno"> 328</span>}</div>
<div class="line"><a id="l00327" name="l00327"></a><span class="lineno"> 327</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> j = 0; j &lt; steps; j++) {</div>
<div class="line"><a id="l00328" name="l00328"></a><span class="lineno"> 328</span> (this-&gt;*func)(dt, particle_interaction);</div>
<div class="line"><a id="l00329" name="l00329"></a><span class="lineno"> 329</span> }</div>
<div class="line"><a id="l00330" name="l00330"></a><span class="lineno"> 330</span> </div>
<div class="line"><a id="l00331" name="l00331"></a><span class="lineno"> 331</span> <span class="keywordtype">int</span> particles_left = 0;</div>
<div class="line"><a id="l00332" name="l00332"></a><span class="lineno"> 332</span> </div>
<div class="line"><a id="l00333" name="l00333"></a><span class="lineno"> 333</span> <span class="comment">// A reduction is perfect here</span></div>
<div class="line"><a id="l00334" name="l00334"></a><span class="lineno"> 334</span><span class="preprocessor">#pragma omp parallel for reduction(+ : particles_left)</span></div>
<div class="line"><a id="l00335" name="l00335"></a><span class="lineno"> 335</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i = 0; i &lt; this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a0112525d9e79a472e761f8ef402a339f">particles</a>.size(); i++) {</div>
<div class="line"><a id="l00336" name="l00336"></a><span class="lineno"> 336</span> <span class="keywordflow">if</span> (arma::norm(this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a0112525d9e79a472e761f8ef402a339f">particles</a>[i].r_vec) &lt; this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a66dfe89c68716b9502927b97f59c27d2">d</a>) {</div>
<div class="line"><a id="l00337" name="l00337"></a><span class="lineno"> 337</span> particles_left++;</div>
<div class="line"><a id="l00338" name="l00338"></a><span class="lineno"> 338</span> }</div>
<div class="line"><a id="l00339" name="l00339"></a><span class="lineno"> 339</span> }</div>
<div class="line"><a id="l00340" name="l00340"></a><span class="lineno"> 340</span> </div>
<div class="line"><a id="l00341" name="l00341"></a><span class="lineno"> 341</span> <span class="keywordflow">return</span> (<span class="keywordtype">double</span>)particles_left / (double)this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a0112525d9e79a472e761f8ef402a339f">particles</a>.size();</div>
<div class="line"><a id="l00342" name="l00342"></a><span class="lineno"> 342</span>}</div>
<div class="ttc" id="aPenningTrap_8hpp_html"><div class="ttname"><a href="PenningTrap_8hpp.html">PenningTrap.hpp</a></div><div class="ttdoc">A class for simulating a Penning trap.</div></div>
<div class="ttc" id="aclassParticle_html"><div class="ttname"><a href="classParticle.html">Particle</a></div><div class="ttdoc">A class that holds attributes of a particle.</div><div class="ttdef"><b>Definition:</b> <a href="Particle_8hpp_source.html#l00022">Particle.hpp:23</a></div></div>
<div class="ttc" id="aclassParticle_html_a1c59101411db43624828b766f87ad460"><div class="ttname"><a href="classParticle.html#a1c59101411db43624828b766f87ad460">Particle::r_vec</a></div><div class="ttdeci">vec3 r_vec</div><div class="ttdoc">position</div><div class="ttdef"><b>Definition:</b> <a href="Particle_8hpp_source.html#l00025">Particle.hpp:25</a></div></div>
<div class="ttc" id="aclassParticle_html_a3a10400add8dd22b8031330c2aafb6fe"><div class="ttname"><a href="classParticle.html#a3a10400add8dd22b8031330c2aafb6fe">Particle::v_vec</a></div><div class="ttdeci">vec3 v_vec</div><div class="ttdoc">velocity</div><div class="ttdef"><b>Definition:</b> <a href="Particle_8hpp_source.html#l00026">Particle.hpp:26</a></div></div>
<div class="ttc" id="aclassParticle_html_a566dcc1de4bdc01251776948798ea8e1"><div class="ttname"><a href="classParticle.html#a566dcc1de4bdc01251776948798ea8e1">Particle::q</a></div><div class="ttdeci">double q</div><div class="ttdoc">Charge.</div><div class="ttdef"><b>Definition:</b> <a href="Particle_8hpp_source.html#l00027">Particle.hpp:27</a></div></div>
<div class="ttc" id="aclassParticle_html_aedcc7e1bc53b0e2b1a4a07c9a1b47563"><div class="ttname"><a href="classParticle.html#aedcc7e1bc53b0e2b1a4a07c9a1b47563">Particle::m</a></div><div class="ttdeci">double m</div><div class="ttdoc">Mass.</div><div class="ttdef"><b>Definition:</b> <a href="Particle_8hpp_source.html#l00028">Particle.hpp:28</a></div></div>
<div class="ttc" id="aclassPenningTrap_html"><div class="ttname"><a href="classPenningTrap.html">PenningTrap</a></div><div class="ttdoc">A class that simulates a Penning trap.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8hpp_source.html#l00031">PenningTrap.hpp:32</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a0112525d9e79a472e761f8ef402a339f"><div class="ttname"><a href="classPenningTrap.html#a0112525d9e79a472e761f8ef402a339f">PenningTrap::particles</a></div><div class="ttdeci">std::vector&lt; Particle &gt; particles</div><div class="ttdoc">The particles in the Penning trap.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8hpp_source.html#l00042">PenningTrap.hpp:42</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a0cac3509aa96e71a26d3b2c902e27716"><div class="ttname"><a href="classPenningTrap.html#a0cac3509aa96e71a26d3b2c902e27716">PenningTrap::B_0</a></div><div class="ttdeci">double B_0</div><div class="ttdoc">Magnetic field strength.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8hpp_source.html#l00037">PenningTrap.hpp:37</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a2c01108b52c8e2a003cf9170da9e7682"><div class="ttname"><a href="classPenningTrap.html#a2c01108b52c8e2a003cf9170da9e7682">PenningTrap::total_force_external</a></div><div class="ttdeci">vec3 total_force_external(uint i)</div><div class="ttdoc">Calculate the total external force on a particle.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00082">PenningTrap.cpp:82</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a2c01108b52c8e2a003cf9170da9e7682"><div class="ttname"><a href="classPenningTrap.html#a2c01108b52c8e2a003cf9170da9e7682">PenningTrap::total_force_external</a></div><div class="ttdeci">vec3 total_force_external(uint i)</div><div class="ttdoc">Calculate the total external force on a particle.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00083">PenningTrap.cpp:83</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a2f168622587709b9e3c49077f0b9a640"><div class="ttname"><a href="classPenningTrap.html#a2f168622587709b9e3c49077f0b9a640">PenningTrap::k_r</a></div><div class="ttdeci">sim_arr k_r</div><div class="ttdoc">A 2D vector containing all where is the index of a particle.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8hpp_source.html#l00052">PenningTrap.hpp:52</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a2fe1cefbae18fa5808155ee0d2df713c"><div class="ttname"><a href="classPenningTrap.html#a2fe1cefbae18fa5808155ee0d2df713c">PenningTrap::total_force_particles</a></div><div class="ttdeci">vec3 total_force_particles(uint i)</div><div class="ttdoc">Calculate the total force on a particle p_i from other particles.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00095">PenningTrap.cpp:95</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a361f2c4862c90b5e8e2a2f50c6a95655"><div class="ttname"><a href="classPenningTrap.html#a361f2c4862c90b5e8e2a2f50c6a95655">PenningTrap::external_B_field</a></div><div class="ttdeci">vec3 external_B_field(vec3 r)</div><div class="ttdoc">Calculate B at point r.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00066">PenningTrap.cpp:66</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a36946152fd951b1f7c346c51ff900d8e"><div class="ttname"><a href="classPenningTrap.html#a36946152fd951b1f7c346c51ff900d8e">PenningTrap::evolve_RK4</a></div><div class="ttdeci">void evolve_RK4(double dt, bool particle_interaction=true)</div><div class="ttdoc">Go forward one timestep using the RK4 method.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00163">PenningTrap.cpp:163</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a3c0a44e4e0a94366ff609e81fe463fa2"><div class="ttname"><a href="classPenningTrap.html#a3c0a44e4e0a94366ff609e81fe463fa2">PenningTrap::v_func</a></div><div class="ttdeci">vec3 v_func(uint i, uint j, double dt)</div><div class="ttdoc">Helper for evolve_RK4 when calculating values.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00020">PenningTrap.cpp:20</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a5846c8f75cdc543fd9cf0b2185a3ef22"><div class="ttname"><a href="classPenningTrap.html#a5846c8f75cdc543fd9cf0b2185a3ef22">PenningTrap::external_E_field</a></div><div class="ttdeci">vec3 external_E_field(vec3 r)</div><div class="ttdoc">Calculate E at point r.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00058">PenningTrap.cpp:58</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a5b6c6d4636f3a6e279ccde59d4a345e8"><div class="ttname"><a href="classPenningTrap.html#a5b6c6d4636f3a6e279ccde59d4a345e8">PenningTrap::PenningTrap</a></div><div class="ttdeci">PenningTrap(double B_0=T, double V_0=(25. *V)/1000., double d=500., double t=0.)</div><div class="ttdoc">Constructor for the PenningTrap class.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00115">PenningTrap.cpp:115</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a2fe1cefbae18fa5808155ee0d2df713c"><div class="ttname"><a href="classPenningTrap.html#a2fe1cefbae18fa5808155ee0d2df713c">PenningTrap::total_force_particles</a></div><div class="ttdeci">vec3 total_force_particles(uint i)</div><div class="ttdoc">Calculate the total force on a particle p_i from other particles.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00092">PenningTrap.cpp:92</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a361f2c4862c90b5e8e2a2f50c6a95655"><div class="ttname"><a href="classPenningTrap.html#a361f2c4862c90b5e8e2a2f50c6a95655">PenningTrap::external_B_field</a></div><div class="ttdeci">vec3 external_B_field(vec3 r)</div><div class="ttdoc">Calculate B at point r.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00067">PenningTrap.cpp:67</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a36946152fd951b1f7c346c51ff900d8e"><div class="ttname"><a href="classPenningTrap.html#a36946152fd951b1f7c346c51ff900d8e">PenningTrap::evolve_RK4</a></div><div class="ttdeci">void evolve_RK4(double dt, bool particle_interaction=true)</div><div class="ttdoc">Go forward one timestep using the RK4 method.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00171">PenningTrap.cpp:171</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a3c0a44e4e0a94366ff609e81fe463fa2"><div class="ttname"><a href="classPenningTrap.html#a3c0a44e4e0a94366ff609e81fe463fa2">PenningTrap::v_func</a></div><div class="ttdeci">vec3 v_func(uint i, uint j, double dt)</div><div class="ttdoc">Helper for evolve_RK4 when calculating values.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00021">PenningTrap.cpp:21</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a5846c8f75cdc543fd9cf0b2185a3ef22"><div class="ttname"><a href="classPenningTrap.html#a5846c8f75cdc543fd9cf0b2185a3ef22">PenningTrap::external_E_field</a></div><div class="ttdeci">vec3 external_E_field(vec3 r)</div><div class="ttdoc">Calculate E at point r.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00059">PenningTrap.cpp:59</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a5b6c6d4636f3a6e279ccde59d4a345e8"><div class="ttname"><a href="classPenningTrap.html#a5b6c6d4636f3a6e279ccde59d4a345e8">PenningTrap::PenningTrap</a></div><div class="ttdeci">PenningTrap(double B_0=T, double V_0=(25. *V)/1000., double d=500., double t=0.)</div><div class="ttdoc">Constructor for the PenningTrap class.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00120">PenningTrap.cpp:120</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a6069f82d8dbc7cadaebd228dbcd95018"><div class="ttname"><a href="classPenningTrap.html#a6069f82d8dbc7cadaebd228dbcd95018">PenningTrap::total_force_no_interaction</a></div><div class="ttdeci">vec3 total_force_no_interaction(uint i)</div><div class="ttdoc">calculate the total force on a particle p_i without interaction</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00112">PenningTrap.cpp:112</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a66dfe89c68716b9502927b97f59c27d2"><div class="ttname"><a href="classPenningTrap.html#a66dfe89c68716b9502927b97f59c27d2">PenningTrap::d</a></div><div class="ttdeci">double d</div><div class="ttdoc">Characteristic dimension.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8hpp_source.html#l00040">PenningTrap.hpp:40</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a6e9776ff5b149f01080800716455d7c8"><div class="ttname"><a href="classPenningTrap.html#a6e9776ff5b149f01080800716455d7c8">PenningTrap::add_particle</a></div><div class="ttdeci">void add_particle(Particle particle)</div><div class="ttdoc">Add a particle to the system.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00158">PenningTrap.cpp:158</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a6e9776ff5b149f01080800716455d7c8"><div class="ttname"><a href="classPenningTrap.html#a6e9776ff5b149f01080800716455d7c8">PenningTrap::add_particle</a></div><div class="ttdeci">void add_particle(Particle particle)</div><div class="ttdoc">Add a particle to the system.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00166">PenningTrap.cpp:166</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a715329844d75ec4c04f8391421fb4e89"><div class="ttname"><a href="classPenningTrap.html#a715329844d75ec4c04f8391421fb4e89">PenningTrap::V_0</a></div><div class="ttdeci">double V_0</div><div class="ttdoc">Applied potential.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8hpp_source.html#l00038">PenningTrap.hpp:38</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a7a1d9f0528a12308de25bc30718da20a"><div class="ttname"><a href="classPenningTrap.html#a7a1d9f0528a12308de25bc30718da20a">PenningTrap::simulate</a></div><div class="ttdeci">simulation_t simulate(double time, uint steps, std::string method=&quot;rk4&quot;, bool particle_interaction=true)</div><div class="ttdoc">Simulate the particle system inside the Penning trap over a certain amount of time.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00228">PenningTrap.cpp:228</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a7f210bb2768a5d79ced4b0df0df97598"><div class="ttname"><a href="classPenningTrap.html#a7f210bb2768a5d79ced4b0df0df97598">PenningTrap::force_on_particle</a></div><div class="ttdeci">vec3 force_on_particle(uint i, uint j)</div><div class="ttdoc">Calculate the force between 2 particles.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00071">PenningTrap.cpp:71</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a826b7fa8e709d481eb1dee7d0c2cdc08"><div class="ttname"><a href="classPenningTrap.html#a826b7fa8e709d481eb1dee7d0c2cdc08">PenningTrap::r_func</a></div><div class="ttdeci">vec3 r_func(uint i, uint j, double dt)</div><div class="ttdoc">Helper for evolve_RK4 when calculating values.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00039">PenningTrap.cpp:39</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a7a1d9f0528a12308de25bc30718da20a"><div class="ttname"><a href="classPenningTrap.html#a7a1d9f0528a12308de25bc30718da20a">PenningTrap::simulate</a></div><div class="ttdeci">simulation_t simulate(double time, uint steps, std::string method=&quot;rk4&quot;, bool particle_interaction=true)</div><div class="ttdoc">Simulate the particle system inside the Penning trap over a certain amount of time.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00240">PenningTrap.cpp:240</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a7f210bb2768a5d79ced4b0df0df97598"><div class="ttname"><a href="classPenningTrap.html#a7f210bb2768a5d79ced4b0df0df97598">PenningTrap::force_on_particle</a></div><div class="ttdeci">vec3 force_on_particle(uint i, uint j)</div><div class="ttdoc">Calculate the force between 2 particles.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00072">PenningTrap.cpp:72</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a826b7fa8e709d481eb1dee7d0c2cdc08"><div class="ttname"><a href="classPenningTrap.html#a826b7fa8e709d481eb1dee7d0c2cdc08">PenningTrap::r_func</a></div><div class="ttdeci">vec3 r_func(uint i, uint j, double dt)</div><div class="ttdoc">Helper for evolve_RK4 when calculating values.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00040">PenningTrap.cpp:40</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a8ca4e21291f60fde619c14099d8c4e8e"><div class="ttname"><a href="classPenningTrap.html#a8ca4e21291f60fde619c14099d8c4e8e">PenningTrap::t</a></div><div class="ttdeci">double t</div><div class="ttdoc">Current time.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8hpp_source.html#l00041">PenningTrap.hpp:41</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a9a301b0540078c36697880ef204afdf3"><div class="ttname"><a href="classPenningTrap.html#a9a301b0540078c36697880ef204afdf3">PenningTrap::total_force</a></div><div class="ttdeci">vec3 total_force(uint i)</div><div class="ttdoc">calculate the total force on a particle p_i.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00107">PenningTrap.cpp:107</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a9d1d8e90ca839b928aee1ad0cd4aff43"><div class="ttname"><a href="classPenningTrap.html#a9d1d8e90ca839b928aee1ad0cd4aff43">PenningTrap::set_pertubation</a></div><div class="ttdeci">void set_pertubation(double f, double omega_V)</div><div class="ttdoc">Time dependent perturbation to V_0.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00141">PenningTrap.cpp:141</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_aaee129f177657455348d0c8ae1441dea"><div class="ttname"><a href="classPenningTrap.html#aaee129f177657455348d0c8ae1441dea">PenningTrap::reinitialize</a></div><div class="ttdeci">void reinitialize(double f, double omega_V, double t=0.)</div><div class="ttdoc">Give all particles new positions and velocities, and change t and V_0.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00148">PenningTrap.cpp:148</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_ab9ea97a406534bbe621a95215144875e"><div class="ttname"><a href="classPenningTrap.html#ab9ea97a406534bbe621a95215144875e">PenningTrap::evolve_forward_euler</a></div><div class="ttdeci">void evolve_forward_euler(double dt, bool particle_interaction=true)</div><div class="ttdoc">Go forward one timestep using the forward Euler method.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00201">PenningTrap.cpp:201</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_ac529aa26c288f34eae184a67e6bac41f"><div class="ttname"><a href="classPenningTrap.html#ac529aa26c288f34eae184a67e6bac41f">PenningTrap::fraction_of_particles_left</a></div><div class="ttdeci">double fraction_of_particles_left(double time, uint steps, std::string method=&quot;rk4&quot;, bool particle_interaction=true)</div><div class="ttdoc">Simulate and calculate what fraction of particles are still left inside the Penning trap after the si...</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00297">PenningTrap.cpp:297</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_ad8bc4df7ab3eed53b16cfdff38e7760b"><div class="ttname"><a href="classPenningTrap.html#ad8bc4df7ab3eed53b16cfdff38e7760b">PenningTrap::write_simulation_to_dir</a></div><div class="ttdeci">void write_simulation_to_dir(std::string path, double time, uint steps, std::string method=&quot;rk4&quot;, bool particle_interaction=true)</div><div class="ttdoc">Simulate and write the displacement of all particles to files.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00259">PenningTrap.cpp:259</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a9a301b0540078c36697880ef204afdf3"><div class="ttname"><a href="classPenningTrap.html#a9a301b0540078c36697880ef204afdf3">PenningTrap::total_force</a></div><div class="ttdeci">vec3 total_force(uint i)</div><div class="ttdoc">calculate the total force on a particle p_i.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00104">PenningTrap.cpp:104</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a9d1d8e90ca839b928aee1ad0cd4aff43"><div class="ttname"><a href="classPenningTrap.html#a9d1d8e90ca839b928aee1ad0cd4aff43">PenningTrap::set_pertubation</a></div><div class="ttdeci">void set_pertubation(double f, double omega_V)</div><div class="ttdoc">Time dependent perturbation to V_0.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00146">PenningTrap.cpp:146</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_aaee129f177657455348d0c8ae1441dea"><div class="ttname"><a href="classPenningTrap.html#aaee129f177657455348d0c8ae1441dea">PenningTrap::reinitialize</a></div><div class="ttdeci">void reinitialize(double f, double omega_V, double t=0.)</div><div class="ttdoc">Give all particles new positions and velocities, and change t and V_0.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00153">PenningTrap.cpp:153</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_ab9ea97a406534bbe621a95215144875e"><div class="ttname"><a href="classPenningTrap.html#ab9ea97a406534bbe621a95215144875e">PenningTrap::evolve_forward_euler</a></div><div class="ttdeci">void evolve_forward_euler(double dt, bool particle_interaction=true)</div><div class="ttdoc">Go forward one timestep using the forward Euler method.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00211">PenningTrap.cpp:211</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_ac529aa26c288f34eae184a67e6bac41f"><div class="ttname"><a href="classPenningTrap.html#ac529aa26c288f34eae184a67e6bac41f">PenningTrap::fraction_of_particles_left</a></div><div class="ttdeci">double fraction_of_particles_left(double time, uint steps, std::string method=&quot;rk4&quot;, bool particle_interaction=true)</div><div class="ttdoc">Simulate and calculate what fraction of particles are still left inside the Penning trap after the si...</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00311">PenningTrap.cpp:311</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_ad8bc4df7ab3eed53b16cfdff38e7760b"><div class="ttname"><a href="classPenningTrap.html#ad8bc4df7ab3eed53b16cfdff38e7760b">PenningTrap::write_simulation_to_dir</a></div><div class="ttdeci">void write_simulation_to_dir(std::string path, double time, uint steps, std::string method=&quot;rk4&quot;, bool particle_interaction=true)</div><div class="ttdoc">Simulate and write the displacement of all particles to files.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00273">PenningTrap.cpp:273</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_ae915f6ad0eef1fb46530e836b6e071e5"><div class="ttname"><a href="classPenningTrap.html#ae915f6ad0eef1fb46530e836b6e071e5">PenningTrap::perturbation</a></div><div class="ttdeci">std::function&lt; double(double)&gt; perturbation</div><div class="ttdoc">Time-dependent perturbation.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8hpp_source.html#l00039">PenningTrap.hpp:39</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_ae9b5afdaa5cd366e94bd294452a1eed4"><div class="ttname"><a href="classPenningTrap.html#ae9b5afdaa5cd366e94bd294452a1eed4">PenningTrap::k_v</a></div><div class="ttdeci">sim_arr k_v</div><div class="ttdoc">A 2D vector containing all where is the index of a particle.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8hpp_source.html#l00047">PenningTrap.hpp:47</a></div></div>
<div class="ttc" id="aconstants_8hpp_html_a4e451456ad7e9276ed0afa42826e7ccb"><div class="ttname"><a href="constants_8hpp.html#a4e451456ad7e9276ed0afa42826e7ccb">K_E</a></div><div class="ttdeci">#define K_E</div><div class="ttdoc">Coulomb constant. unit: .</div><div class="ttdef"><b>Definition:</b> <a href="constants_8hpp_source.html#l00017">constants.hpp:17</a></div></div>

View File

@@ -147,66 +147,69 @@ $(document).ready(function(){initNavTree('PenningTrap_8hpp_source.html',''); ini
<div class="line"><a id="l00125" name="l00125"></a><span class="lineno"> 125</span> </div>
<div class="line"><a id="l00132" name="l00132"></a><span class="lineno"> 132</span> <a class="code hl_typedef" href="typedefs_8hpp.html#a3bdfb73a02f88ae32b6128ef747c4aea">vec3</a> <a class="code hl_function" href="classPenningTrap.html#a9a301b0540078c36697880ef204afdf3">total_force</a>(uint i);</div>
<div class="line"><a id="l00133" name="l00133"></a><span class="lineno"> 133</span> </div>
<div class="line"><a id="l00134" name="l00134"></a><span class="lineno"> 134</span><span class="keyword">public</span>:</div>
<div class="line"><a id="l00142" name="l00142"></a><span class="lineno"> 142</span> <a class="code hl_class" href="classPenningTrap.html">PenningTrap</a>(<span class="keywordtype">double</span> <a class="code hl_variable" href="classPenningTrap.html#a0cac3509aa96e71a26d3b2c902e27716">B_0</a> = <a class="code hl_define" href="constants_8hpp.html#a0acb682b8260ab1c60b918599864e2e5">T</a>, <span class="keywordtype">double</span> <a class="code hl_variable" href="classPenningTrap.html#a715329844d75ec4c04f8391421fb4e89">V_0</a> = (25. * <a class="code hl_define" href="constants_8hpp.html#af40a326b23c68a27cebe60f16634a2cb">V</a>) / 1000., <span class="keywordtype">double</span> <a class="code hl_variable" href="classPenningTrap.html#a66dfe89c68716b9502927b97f59c27d2">d</a> = 500.,</div>
<div class="line"><a id="l00143" name="l00143"></a><span class="lineno"> 143</span> <span class="keywordtype">double</span> <a class="code hl_variable" href="classPenningTrap.html#a8ca4e21291f60fde619c14099d8c4e8e">t</a> = 0.);</div>
<div class="line"><a id="l00144" name="l00144"></a><span class="lineno"> 144</span> </div>
<div class="line"><a id="l00153" name="l00153"></a><span class="lineno"> 153</span> <a class="code hl_class" href="classPenningTrap.html">PenningTrap</a>(uint i, <span class="keywordtype">double</span> <a class="code hl_variable" href="classPenningTrap.html#a0cac3509aa96e71a26d3b2c902e27716">B_0</a> = <a class="code hl_define" href="constants_8hpp.html#a0acb682b8260ab1c60b918599864e2e5">T</a>, <span class="keywordtype">double</span> <a class="code hl_variable" href="classPenningTrap.html#a715329844d75ec4c04f8391421fb4e89">V_0</a> = (25. * <a class="code hl_define" href="constants_8hpp.html#af40a326b23c68a27cebe60f16634a2cb">V</a>) / 1000.,</div>
<div class="line"><a id="l00154" name="l00154"></a><span class="lineno"> 154</span> <span class="keywordtype">double</span> <a class="code hl_variable" href="classPenningTrap.html#a66dfe89c68716b9502927b97f59c27d2">d</a> = 500., <span class="keywordtype">double</span> <a class="code hl_variable" href="classPenningTrap.html#a8ca4e21291f60fde619c14099d8c4e8e">t</a> = 0.);</div>
<div class="line"><a id="l00155" name="l00155"></a><span class="lineno"> 155</span> </div>
<div class="line"><a id="l00164" name="l00164"></a><span class="lineno"> 164</span> <a class="code hl_class" href="classPenningTrap.html">PenningTrap</a>(std::vector&lt;Particle&gt; <a class="code hl_variable" href="classPenningTrap.html#a0112525d9e79a472e761f8ef402a339f">particles</a>, <span class="keywordtype">double</span> <a class="code hl_variable" href="classPenningTrap.html#a0cac3509aa96e71a26d3b2c902e27716">B_0</a> = <a class="code hl_define" href="constants_8hpp.html#a0acb682b8260ab1c60b918599864e2e5">T</a>,</div>
<div class="line"><a id="l00165" name="l00165"></a><span class="lineno"> 165</span> <span class="keywordtype">double</span> <a class="code hl_variable" href="classPenningTrap.html#a715329844d75ec4c04f8391421fb4e89">V_0</a> = (25. * <a class="code hl_define" href="constants_8hpp.html#af40a326b23c68a27cebe60f16634a2cb">V</a>) / 1000., <span class="keywordtype">double</span> <a class="code hl_variable" href="classPenningTrap.html#a66dfe89c68716b9502927b97f59c27d2">d</a> = 500., <span class="keywordtype">double</span> <a class="code hl_variable" href="classPenningTrap.html#a8ca4e21291f60fde619c14099d8c4e8e">t</a> = 0.);</div>
<div class="line"><a id="l00166" name="l00166"></a><span class="lineno"> 166</span> </div>
<div class="line"><a id="l00172" name="l00172"></a><span class="lineno"> 172</span> <span class="keywordtype">void</span> <a class="code hl_function" href="classPenningTrap.html#a9d1d8e90ca839b928aee1ad0cd4aff43">set_pertubation</a>(<span class="keywordtype">double</span> f, <span class="keywordtype">double</span> omega_V);</div>
<div class="line"><a id="l00173" name="l00173"></a><span class="lineno"> 173</span> </div>
<div class="line"><a id="l00180" name="l00180"></a><span class="lineno"> 180</span> <span class="keywordtype">void</span> <a class="code hl_function" href="classPenningTrap.html#aaee129f177657455348d0c8ae1441dea">reinitialize</a>(<span class="keywordtype">double</span> f, <span class="keywordtype">double</span> omega_V, <span class="keywordtype">double</span> <a class="code hl_variable" href="classPenningTrap.html#a8ca4e21291f60fde619c14099d8c4e8e">t</a> = 0.);</div>
<div class="line"><a id="l00140" name="l00140"></a><span class="lineno"> 140</span> <a class="code hl_typedef" href="typedefs_8hpp.html#a3bdfb73a02f88ae32b6128ef747c4aea">vec3</a> <a class="code hl_function" href="classPenningTrap.html#a6069f82d8dbc7cadaebd228dbcd95018">total_force_no_interaction</a>(uint i);</div>
<div class="line"><a id="l00141" name="l00141"></a><span class="lineno"> 141</span> </div>
<div class="line"><a id="l00142" name="l00142"></a><span class="lineno"> 142</span><span class="keyword">public</span>:</div>
<div class="line"><a id="l00150" name="l00150"></a><span class="lineno"> 150</span> <a class="code hl_class" href="classPenningTrap.html">PenningTrap</a>(<span class="keywordtype">double</span> <a class="code hl_variable" href="classPenningTrap.html#a0cac3509aa96e71a26d3b2c902e27716">B_0</a> = <a class="code hl_define" href="constants_8hpp.html#a0acb682b8260ab1c60b918599864e2e5">T</a>, <span class="keywordtype">double</span> <a class="code hl_variable" href="classPenningTrap.html#a715329844d75ec4c04f8391421fb4e89">V_0</a> = (25. * <a class="code hl_define" href="constants_8hpp.html#af40a326b23c68a27cebe60f16634a2cb">V</a>) / 1000., <span class="keywordtype">double</span> <a class="code hl_variable" href="classPenningTrap.html#a66dfe89c68716b9502927b97f59c27d2">d</a> = 500.,</div>
<div class="line"><a id="l00151" name="l00151"></a><span class="lineno"> 151</span> <span class="keywordtype">double</span> <a class="code hl_variable" href="classPenningTrap.html#a8ca4e21291f60fde619c14099d8c4e8e">t</a> = 0.);</div>
<div class="line"><a id="l00152" name="l00152"></a><span class="lineno"> 152</span> </div>
<div class="line"><a id="l00161" name="l00161"></a><span class="lineno"> 161</span> <a class="code hl_class" href="classPenningTrap.html">PenningTrap</a>(uint i, <span class="keywordtype">double</span> <a class="code hl_variable" href="classPenningTrap.html#a0cac3509aa96e71a26d3b2c902e27716">B_0</a> = <a class="code hl_define" href="constants_8hpp.html#a0acb682b8260ab1c60b918599864e2e5">T</a>, <span class="keywordtype">double</span> <a class="code hl_variable" href="classPenningTrap.html#a715329844d75ec4c04f8391421fb4e89">V_0</a> = (25. * <a class="code hl_define" href="constants_8hpp.html#af40a326b23c68a27cebe60f16634a2cb">V</a>) / 1000.,</div>
<div class="line"><a id="l00162" name="l00162"></a><span class="lineno"> 162</span> <span class="keywordtype">double</span> <a class="code hl_variable" href="classPenningTrap.html#a66dfe89c68716b9502927b97f59c27d2">d</a> = 500., <span class="keywordtype">double</span> <a class="code hl_variable" href="classPenningTrap.html#a8ca4e21291f60fde619c14099d8c4e8e">t</a> = 0.);</div>
<div class="line"><a id="l00163" name="l00163"></a><span class="lineno"> 163</span> </div>
<div class="line"><a id="l00172" name="l00172"></a><span class="lineno"> 172</span> <a class="code hl_class" href="classPenningTrap.html">PenningTrap</a>(std::vector&lt;Particle&gt; <a class="code hl_variable" href="classPenningTrap.html#a0112525d9e79a472e761f8ef402a339f">particles</a>, <span class="keywordtype">double</span> <a class="code hl_variable" href="classPenningTrap.html#a0cac3509aa96e71a26d3b2c902e27716">B_0</a> = <a class="code hl_define" href="constants_8hpp.html#a0acb682b8260ab1c60b918599864e2e5">T</a>,</div>
<div class="line"><a id="l00173" name="l00173"></a><span class="lineno"> 173</span> <span class="keywordtype">double</span> <a class="code hl_variable" href="classPenningTrap.html#a715329844d75ec4c04f8391421fb4e89">V_0</a> = (25. * <a class="code hl_define" href="constants_8hpp.html#af40a326b23c68a27cebe60f16634a2cb">V</a>) / 1000., <span class="keywordtype">double</span> <a class="code hl_variable" href="classPenningTrap.html#a66dfe89c68716b9502927b97f59c27d2">d</a> = 500., <span class="keywordtype">double</span> <a class="code hl_variable" href="classPenningTrap.html#a8ca4e21291f60fde619c14099d8c4e8e">t</a> = 0.);</div>
<div class="line"><a id="l00174" name="l00174"></a><span class="lineno"> 174</span> </div>
<div class="line"><a id="l00180" name="l00180"></a><span class="lineno"> 180</span> <span class="keywordtype">void</span> <a class="code hl_function" href="classPenningTrap.html#a9d1d8e90ca839b928aee1ad0cd4aff43">set_pertubation</a>(<span class="keywordtype">double</span> f, <span class="keywordtype">double</span> omega_V);</div>
<div class="line"><a id="l00181" name="l00181"></a><span class="lineno"> 181</span> </div>
<div class="line"><a id="l00186" name="l00186"></a><span class="lineno"> 186</span> <span class="keywordtype">void</span> <a class="code hl_function" href="classPenningTrap.html#a6e9776ff5b149f01080800716455d7c8">add_particle</a>(<a class="code hl_class" href="classParticle.html">Particle</a> particle);</div>
<div class="line"><a id="l00187" name="l00187"></a><span class="lineno"> 187</span> </div>
<div class="line"><a id="l00193" name="l00193"></a><span class="lineno"> 193</span> <span class="keywordtype">void</span> <a class="code hl_function" href="classPenningTrap.html#a36946152fd951b1f7c346c51ff900d8e">evolve_RK4</a>(<span class="keywordtype">double</span> dt, <span class="keywordtype">bool</span> particle_interaction = <span class="keyword">true</span>);</div>
<div class="line"><a id="l00194" name="l00194"></a><span class="lineno"> 194</span> </div>
<div class="line"><a id="l00200" name="l00200"></a><span class="lineno"> 200</span> <span class="keywordtype">void</span> <a class="code hl_function" href="classPenningTrap.html#ab9ea97a406534bbe621a95215144875e">evolve_forward_euler</a>(<span class="keywordtype">double</span> dt, <span class="keywordtype">bool</span> particle_interaction = <span class="keyword">true</span>);</div>
<div class="line"><a id="l00201" name="l00201"></a><span class="lineno"> 201</span> </div>
<div class="line"><a id="l00212" name="l00212"></a><span class="lineno"> 212</span> <a class="code hl_struct" href="structsimulation.html">simulation_t</a> <a class="code hl_function" href="classPenningTrap.html#a7a1d9f0528a12308de25bc30718da20a">simulate</a>(<span class="keywordtype">double</span> time, uint steps, std::string method = <span class="stringliteral">&quot;rk4&quot;</span>,</div>
<div class="line"><a id="l00213" name="l00213"></a><span class="lineno"> 213</span> <span class="keywordtype">bool</span> particle_interaction = <span class="keyword">true</span>);</div>
<div class="line"><a id="l00214" name="l00214"></a><span class="lineno"> 214</span> </div>
<div class="line"><a id="l00223" name="l00223"></a><span class="lineno"> 223</span> <span class="keywordtype">void</span> <a class="code hl_function" href="classPenningTrap.html#ad8bc4df7ab3eed53b16cfdff38e7760b">write_simulation_to_dir</a>(std::string path, <span class="keywordtype">double</span> time, uint steps,</div>
<div class="line"><a id="l00224" name="l00224"></a><span class="lineno"> 224</span> std::string method = <span class="stringliteral">&quot;rk4&quot;</span>,</div>
<div class="line"><a id="l00225" name="l00225"></a><span class="lineno"> 225</span> <span class="keywordtype">bool</span> particle_interaction = <span class="keyword">true</span>);</div>
<div class="line"><a id="l00226" name="l00226"></a><span class="lineno"> 226</span> </div>
<div class="line"><a id="l00237" name="l00237"></a><span class="lineno"> 237</span> <span class="keywordtype">double</span> <a class="code hl_function" href="classPenningTrap.html#ac529aa26c288f34eae184a67e6bac41f">fraction_of_particles_left</a>(<span class="keywordtype">double</span> time, uint steps,</div>
<div class="line"><a id="l00238" name="l00238"></a><span class="lineno"> 238</span> std::string method = <span class="stringliteral">&quot;rk4&quot;</span>,</div>
<div class="line"><a id="l00239" name="l00239"></a><span class="lineno"> 239</span> <span class="keywordtype">bool</span> particle_interaction = <span class="keyword">true</span>);</div>
<div class="line"><a id="l00240" name="l00240"></a><span class="lineno"> 240</span> </div>
<div class="line"><a id="l00241" name="l00241"></a><span class="lineno"> 241</span>};</div>
<div class="line"><a id="l00242" name="l00242"></a><span class="lineno"> 242</span> </div>
<div class="line"><a id="l00243" name="l00243"></a><span class="lineno"> 243</span><span class="preprocessor">#endif</span></div>
<div class="line"><a id="l00188" name="l00188"></a><span class="lineno"> 188</span> <span class="keywordtype">void</span> <a class="code hl_function" href="classPenningTrap.html#aaee129f177657455348d0c8ae1441dea">reinitialize</a>(<span class="keywordtype">double</span> f, <span class="keywordtype">double</span> omega_V, <span class="keywordtype">double</span> <a class="code hl_variable" href="classPenningTrap.html#a8ca4e21291f60fde619c14099d8c4e8e">t</a> = 0.);</div>
<div class="line"><a id="l00189" name="l00189"></a><span class="lineno"> 189</span> </div>
<div class="line"><a id="l00194" name="l00194"></a><span class="lineno"> 194</span> <span class="keywordtype">void</span> <a class="code hl_function" href="classPenningTrap.html#a6e9776ff5b149f01080800716455d7c8">add_particle</a>(<a class="code hl_class" href="classParticle.html">Particle</a> particle);</div>
<div class="line"><a id="l00195" name="l00195"></a><span class="lineno"> 195</span> </div>
<div class="line"><a id="l00201" name="l00201"></a><span class="lineno"> 201</span> <span class="keywordtype">void</span> <a class="code hl_function" href="classPenningTrap.html#a36946152fd951b1f7c346c51ff900d8e">evolve_RK4</a>(<span class="keywordtype">double</span> dt, <span class="keywordtype">bool</span> particle_interaction = <span class="keyword">true</span>);</div>
<div class="line"><a id="l00202" name="l00202"></a><span class="lineno"> 202</span> </div>
<div class="line"><a id="l00208" name="l00208"></a><span class="lineno"> 208</span> <span class="keywordtype">void</span> <a class="code hl_function" href="classPenningTrap.html#ab9ea97a406534bbe621a95215144875e">evolve_forward_euler</a>(<span class="keywordtype">double</span> dt, <span class="keywordtype">bool</span> particle_interaction = <span class="keyword">true</span>);</div>
<div class="line"><a id="l00209" name="l00209"></a><span class="lineno"> 209</span> </div>
<div class="line"><a id="l00220" name="l00220"></a><span class="lineno"> 220</span> <a class="code hl_struct" href="structsimulation.html">simulation_t</a> <a class="code hl_function" href="classPenningTrap.html#a7a1d9f0528a12308de25bc30718da20a">simulate</a>(<span class="keywordtype">double</span> time, uint steps, std::string method = <span class="stringliteral">&quot;rk4&quot;</span>,</div>
<div class="line"><a id="l00221" name="l00221"></a><span class="lineno"> 221</span> <span class="keywordtype">bool</span> particle_interaction = <span class="keyword">true</span>);</div>
<div class="line"><a id="l00222" name="l00222"></a><span class="lineno"> 222</span> </div>
<div class="line"><a id="l00231" name="l00231"></a><span class="lineno"> 231</span> <span class="keywordtype">void</span> <a class="code hl_function" href="classPenningTrap.html#ad8bc4df7ab3eed53b16cfdff38e7760b">write_simulation_to_dir</a>(std::string path, <span class="keywordtype">double</span> time, uint steps,</div>
<div class="line"><a id="l00232" name="l00232"></a><span class="lineno"> 232</span> std::string method = <span class="stringliteral">&quot;rk4&quot;</span>,</div>
<div class="line"><a id="l00233" name="l00233"></a><span class="lineno"> 233</span> <span class="keywordtype">bool</span> particle_interaction = <span class="keyword">true</span>);</div>
<div class="line"><a id="l00234" name="l00234"></a><span class="lineno"> 234</span> </div>
<div class="line"><a id="l00245" name="l00245"></a><span class="lineno"> 245</span> <span class="keywordtype">double</span> <a class="code hl_function" href="classPenningTrap.html#ac529aa26c288f34eae184a67e6bac41f">fraction_of_particles_left</a>(<span class="keywordtype">double</span> time, uint steps,</div>
<div class="line"><a id="l00246" name="l00246"></a><span class="lineno"> 246</span> std::string method = <span class="stringliteral">&quot;rk4&quot;</span>,</div>
<div class="line"><a id="l00247" name="l00247"></a><span class="lineno"> 247</span> <span class="keywordtype">bool</span> particle_interaction = <span class="keyword">true</span>);</div>
<div class="line"><a id="l00248" name="l00248"></a><span class="lineno"> 248</span> </div>
<div class="line"><a id="l00249" name="l00249"></a><span class="lineno"> 249</span>};</div>
<div class="line"><a id="l00250" name="l00250"></a><span class="lineno"> 250</span> </div>
<div class="line"><a id="l00251" name="l00251"></a><span class="lineno"> 251</span><span class="preprocessor">#endif</span></div>
<div class="ttc" id="aParticle_8hpp_html"><div class="ttname"><a href="Particle_8hpp.html">Particle.hpp</a></div><div class="ttdoc">A class that holds the properties of a particle.</div></div>
<div class="ttc" id="aclassParticle_html"><div class="ttname"><a href="classParticle.html">Particle</a></div><div class="ttdoc">A class that holds attributes of a particle.</div><div class="ttdef"><b>Definition:</b> <a href="Particle_8hpp_source.html#l00022">Particle.hpp:23</a></div></div>
<div class="ttc" id="aclassPenningTrapTest_html"><div class="ttname"><a href="classPenningTrapTest.html">PenningTrapTest</a></div><div class="ttdoc">Test class for the Penning trap.</div><div class="ttdef"><b>Definition:</b> <a href="test__suite_8cpp_source.html#l00023">test_suite.cpp:24</a></div></div>
<div class="ttc" id="aclassPenningTrap_html"><div class="ttname"><a href="classPenningTrap.html">PenningTrap</a></div><div class="ttdoc">A class that simulates a Penning trap.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8hpp_source.html#l00031">PenningTrap.hpp:32</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a0112525d9e79a472e761f8ef402a339f"><div class="ttname"><a href="classPenningTrap.html#a0112525d9e79a472e761f8ef402a339f">PenningTrap::particles</a></div><div class="ttdeci">std::vector&lt; Particle &gt; particles</div><div class="ttdoc">The particles in the Penning trap.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8hpp_source.html#l00042">PenningTrap.hpp:42</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a0cac3509aa96e71a26d3b2c902e27716"><div class="ttname"><a href="classPenningTrap.html#a0cac3509aa96e71a26d3b2c902e27716">PenningTrap::B_0</a></div><div class="ttdeci">double B_0</div><div class="ttdoc">Magnetic field strength.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8hpp_source.html#l00037">PenningTrap.hpp:37</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a2c01108b52c8e2a003cf9170da9e7682"><div class="ttname"><a href="classPenningTrap.html#a2c01108b52c8e2a003cf9170da9e7682">PenningTrap::total_force_external</a></div><div class="ttdeci">vec3 total_force_external(uint i)</div><div class="ttdoc">Calculate the total external force on a particle.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00082">PenningTrap.cpp:82</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a2c01108b52c8e2a003cf9170da9e7682"><div class="ttname"><a href="classPenningTrap.html#a2c01108b52c8e2a003cf9170da9e7682">PenningTrap::total_force_external</a></div><div class="ttdeci">vec3 total_force_external(uint i)</div><div class="ttdoc">Calculate the total external force on a particle.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00083">PenningTrap.cpp:83</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a2f168622587709b9e3c49077f0b9a640"><div class="ttname"><a href="classPenningTrap.html#a2f168622587709b9e3c49077f0b9a640">PenningTrap::k_r</a></div><div class="ttdeci">sim_arr k_r</div><div class="ttdoc">A 2D vector containing all where is the index of a particle.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8hpp_source.html#l00052">PenningTrap.hpp:52</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a2fe1cefbae18fa5808155ee0d2df713c"><div class="ttname"><a href="classPenningTrap.html#a2fe1cefbae18fa5808155ee0d2df713c">PenningTrap::total_force_particles</a></div><div class="ttdeci">vec3 total_force_particles(uint i)</div><div class="ttdoc">Calculate the total force on a particle p_i from other particles.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00095">PenningTrap.cpp:95</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a361f2c4862c90b5e8e2a2f50c6a95655"><div class="ttname"><a href="classPenningTrap.html#a361f2c4862c90b5e8e2a2f50c6a95655">PenningTrap::external_B_field</a></div><div class="ttdeci">vec3 external_B_field(vec3 r)</div><div class="ttdoc">Calculate B at point r.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00066">PenningTrap.cpp:66</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a36946152fd951b1f7c346c51ff900d8e"><div class="ttname"><a href="classPenningTrap.html#a36946152fd951b1f7c346c51ff900d8e">PenningTrap::evolve_RK4</a></div><div class="ttdeci">void evolve_RK4(double dt, bool particle_interaction=true)</div><div class="ttdoc">Go forward one timestep using the RK4 method.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00163">PenningTrap.cpp:163</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a3c0a44e4e0a94366ff609e81fe463fa2"><div class="ttname"><a href="classPenningTrap.html#a3c0a44e4e0a94366ff609e81fe463fa2">PenningTrap::v_func</a></div><div class="ttdeci">vec3 v_func(uint i, uint j, double dt)</div><div class="ttdoc">Helper for evolve_RK4 when calculating values.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00020">PenningTrap.cpp:20</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a5846c8f75cdc543fd9cf0b2185a3ef22"><div class="ttname"><a href="classPenningTrap.html#a5846c8f75cdc543fd9cf0b2185a3ef22">PenningTrap::external_E_field</a></div><div class="ttdeci">vec3 external_E_field(vec3 r)</div><div class="ttdoc">Calculate E at point r.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00058">PenningTrap.cpp:58</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a2fe1cefbae18fa5808155ee0d2df713c"><div class="ttname"><a href="classPenningTrap.html#a2fe1cefbae18fa5808155ee0d2df713c">PenningTrap::total_force_particles</a></div><div class="ttdeci">vec3 total_force_particles(uint i)</div><div class="ttdoc">Calculate the total force on a particle p_i from other particles.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00092">PenningTrap.cpp:92</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a361f2c4862c90b5e8e2a2f50c6a95655"><div class="ttname"><a href="classPenningTrap.html#a361f2c4862c90b5e8e2a2f50c6a95655">PenningTrap::external_B_field</a></div><div class="ttdeci">vec3 external_B_field(vec3 r)</div><div class="ttdoc">Calculate B at point r.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00067">PenningTrap.cpp:67</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a36946152fd951b1f7c346c51ff900d8e"><div class="ttname"><a href="classPenningTrap.html#a36946152fd951b1f7c346c51ff900d8e">PenningTrap::evolve_RK4</a></div><div class="ttdeci">void evolve_RK4(double dt, bool particle_interaction=true)</div><div class="ttdoc">Go forward one timestep using the RK4 method.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00171">PenningTrap.cpp:171</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a3c0a44e4e0a94366ff609e81fe463fa2"><div class="ttname"><a href="classPenningTrap.html#a3c0a44e4e0a94366ff609e81fe463fa2">PenningTrap::v_func</a></div><div class="ttdeci">vec3 v_func(uint i, uint j, double dt)</div><div class="ttdoc">Helper for evolve_RK4 when calculating values.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00021">PenningTrap.cpp:21</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a5846c8f75cdc543fd9cf0b2185a3ef22"><div class="ttname"><a href="classPenningTrap.html#a5846c8f75cdc543fd9cf0b2185a3ef22">PenningTrap::external_E_field</a></div><div class="ttdeci">vec3 external_E_field(vec3 r)</div><div class="ttdoc">Calculate E at point r.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00059">PenningTrap.cpp:59</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a6069f82d8dbc7cadaebd228dbcd95018"><div class="ttname"><a href="classPenningTrap.html#a6069f82d8dbc7cadaebd228dbcd95018">PenningTrap::total_force_no_interaction</a></div><div class="ttdeci">vec3 total_force_no_interaction(uint i)</div><div class="ttdoc">calculate the total force on a particle p_i without interaction</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00112">PenningTrap.cpp:112</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a66dfe89c68716b9502927b97f59c27d2"><div class="ttname"><a href="classPenningTrap.html#a66dfe89c68716b9502927b97f59c27d2">PenningTrap::d</a></div><div class="ttdeci">double d</div><div class="ttdoc">Characteristic dimension.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8hpp_source.html#l00040">PenningTrap.hpp:40</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a6e9776ff5b149f01080800716455d7c8"><div class="ttname"><a href="classPenningTrap.html#a6e9776ff5b149f01080800716455d7c8">PenningTrap::add_particle</a></div><div class="ttdeci">void add_particle(Particle particle)</div><div class="ttdoc">Add a particle to the system.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00158">PenningTrap.cpp:158</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a6e9776ff5b149f01080800716455d7c8"><div class="ttname"><a href="classPenningTrap.html#a6e9776ff5b149f01080800716455d7c8">PenningTrap::add_particle</a></div><div class="ttdeci">void add_particle(Particle particle)</div><div class="ttdoc">Add a particle to the system.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00166">PenningTrap.cpp:166</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a715329844d75ec4c04f8391421fb4e89"><div class="ttname"><a href="classPenningTrap.html#a715329844d75ec4c04f8391421fb4e89">PenningTrap::V_0</a></div><div class="ttdeci">double V_0</div><div class="ttdoc">Applied potential.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8hpp_source.html#l00038">PenningTrap.hpp:38</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a7a1d9f0528a12308de25bc30718da20a"><div class="ttname"><a href="classPenningTrap.html#a7a1d9f0528a12308de25bc30718da20a">PenningTrap::simulate</a></div><div class="ttdeci">simulation_t simulate(double time, uint steps, std::string method=&quot;rk4&quot;, bool particle_interaction=true)</div><div class="ttdoc">Simulate the particle system inside the Penning trap over a certain amount of time.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00228">PenningTrap.cpp:228</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a7f210bb2768a5d79ced4b0df0df97598"><div class="ttname"><a href="classPenningTrap.html#a7f210bb2768a5d79ced4b0df0df97598">PenningTrap::force_on_particle</a></div><div class="ttdeci">vec3 force_on_particle(uint i, uint j)</div><div class="ttdoc">Calculate the force between 2 particles.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00071">PenningTrap.cpp:71</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a826b7fa8e709d481eb1dee7d0c2cdc08"><div class="ttname"><a href="classPenningTrap.html#a826b7fa8e709d481eb1dee7d0c2cdc08">PenningTrap::r_func</a></div><div class="ttdeci">vec3 r_func(uint i, uint j, double dt)</div><div class="ttdoc">Helper for evolve_RK4 when calculating values.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00039">PenningTrap.cpp:39</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a7a1d9f0528a12308de25bc30718da20a"><div class="ttname"><a href="classPenningTrap.html#a7a1d9f0528a12308de25bc30718da20a">PenningTrap::simulate</a></div><div class="ttdeci">simulation_t simulate(double time, uint steps, std::string method=&quot;rk4&quot;, bool particle_interaction=true)</div><div class="ttdoc">Simulate the particle system inside the Penning trap over a certain amount of time.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00240">PenningTrap.cpp:240</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a7f210bb2768a5d79ced4b0df0df97598"><div class="ttname"><a href="classPenningTrap.html#a7f210bb2768a5d79ced4b0df0df97598">PenningTrap::force_on_particle</a></div><div class="ttdeci">vec3 force_on_particle(uint i, uint j)</div><div class="ttdoc">Calculate the force between 2 particles.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00072">PenningTrap.cpp:72</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a826b7fa8e709d481eb1dee7d0c2cdc08"><div class="ttname"><a href="classPenningTrap.html#a826b7fa8e709d481eb1dee7d0c2cdc08">PenningTrap::r_func</a></div><div class="ttdeci">vec3 r_func(uint i, uint j, double dt)</div><div class="ttdoc">Helper for evolve_RK4 when calculating values.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00040">PenningTrap.cpp:40</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a8ca4e21291f60fde619c14099d8c4e8e"><div class="ttname"><a href="classPenningTrap.html#a8ca4e21291f60fde619c14099d8c4e8e">PenningTrap::t</a></div><div class="ttdeci">double t</div><div class="ttdoc">Current time.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8hpp_source.html#l00041">PenningTrap.hpp:41</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a9a301b0540078c36697880ef204afdf3"><div class="ttname"><a href="classPenningTrap.html#a9a301b0540078c36697880ef204afdf3">PenningTrap::total_force</a></div><div class="ttdeci">vec3 total_force(uint i)</div><div class="ttdoc">calculate the total force on a particle p_i.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00107">PenningTrap.cpp:107</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a9d1d8e90ca839b928aee1ad0cd4aff43"><div class="ttname"><a href="classPenningTrap.html#a9d1d8e90ca839b928aee1ad0cd4aff43">PenningTrap::set_pertubation</a></div><div class="ttdeci">void set_pertubation(double f, double omega_V)</div><div class="ttdoc">Time dependent perturbation to V_0.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00141">PenningTrap.cpp:141</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_aaee129f177657455348d0c8ae1441dea"><div class="ttname"><a href="classPenningTrap.html#aaee129f177657455348d0c8ae1441dea">PenningTrap::reinitialize</a></div><div class="ttdeci">void reinitialize(double f, double omega_V, double t=0.)</div><div class="ttdoc">Give all particles new positions and velocities, and change t and V_0.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00148">PenningTrap.cpp:148</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_ab9ea97a406534bbe621a95215144875e"><div class="ttname"><a href="classPenningTrap.html#ab9ea97a406534bbe621a95215144875e">PenningTrap::evolve_forward_euler</a></div><div class="ttdeci">void evolve_forward_euler(double dt, bool particle_interaction=true)</div><div class="ttdoc">Go forward one timestep using the forward Euler method.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00201">PenningTrap.cpp:201</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_ac529aa26c288f34eae184a67e6bac41f"><div class="ttname"><a href="classPenningTrap.html#ac529aa26c288f34eae184a67e6bac41f">PenningTrap::fraction_of_particles_left</a></div><div class="ttdeci">double fraction_of_particles_left(double time, uint steps, std::string method=&quot;rk4&quot;, bool particle_interaction=true)</div><div class="ttdoc">Simulate and calculate what fraction of particles are still left inside the Penning trap after the si...</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00297">PenningTrap.cpp:297</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_ad8bc4df7ab3eed53b16cfdff38e7760b"><div class="ttname"><a href="classPenningTrap.html#ad8bc4df7ab3eed53b16cfdff38e7760b">PenningTrap::write_simulation_to_dir</a></div><div class="ttdeci">void write_simulation_to_dir(std::string path, double time, uint steps, std::string method=&quot;rk4&quot;, bool particle_interaction=true)</div><div class="ttdoc">Simulate and write the displacement of all particles to files.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00259">PenningTrap.cpp:259</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a9a301b0540078c36697880ef204afdf3"><div class="ttname"><a href="classPenningTrap.html#a9a301b0540078c36697880ef204afdf3">PenningTrap::total_force</a></div><div class="ttdeci">vec3 total_force(uint i)</div><div class="ttdoc">calculate the total force on a particle p_i.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00104">PenningTrap.cpp:104</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a9d1d8e90ca839b928aee1ad0cd4aff43"><div class="ttname"><a href="classPenningTrap.html#a9d1d8e90ca839b928aee1ad0cd4aff43">PenningTrap::set_pertubation</a></div><div class="ttdeci">void set_pertubation(double f, double omega_V)</div><div class="ttdoc">Time dependent perturbation to V_0.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00146">PenningTrap.cpp:146</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_aaee129f177657455348d0c8ae1441dea"><div class="ttname"><a href="classPenningTrap.html#aaee129f177657455348d0c8ae1441dea">PenningTrap::reinitialize</a></div><div class="ttdeci">void reinitialize(double f, double omega_V, double t=0.)</div><div class="ttdoc">Give all particles new positions and velocities, and change t and V_0.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00153">PenningTrap.cpp:153</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_ab9ea97a406534bbe621a95215144875e"><div class="ttname"><a href="classPenningTrap.html#ab9ea97a406534bbe621a95215144875e">PenningTrap::evolve_forward_euler</a></div><div class="ttdeci">void evolve_forward_euler(double dt, bool particle_interaction=true)</div><div class="ttdoc">Go forward one timestep using the forward Euler method.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00211">PenningTrap.cpp:211</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_ac529aa26c288f34eae184a67e6bac41f"><div class="ttname"><a href="classPenningTrap.html#ac529aa26c288f34eae184a67e6bac41f">PenningTrap::fraction_of_particles_left</a></div><div class="ttdeci">double fraction_of_particles_left(double time, uint steps, std::string method=&quot;rk4&quot;, bool particle_interaction=true)</div><div class="ttdoc">Simulate and calculate what fraction of particles are still left inside the Penning trap after the si...</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00311">PenningTrap.cpp:311</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_ad8bc4df7ab3eed53b16cfdff38e7760b"><div class="ttname"><a href="classPenningTrap.html#ad8bc4df7ab3eed53b16cfdff38e7760b">PenningTrap::write_simulation_to_dir</a></div><div class="ttdeci">void write_simulation_to_dir(std::string path, double time, uint steps, std::string method=&quot;rk4&quot;, bool particle_interaction=true)</div><div class="ttdoc">Simulate and write the displacement of all particles to files.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00273">PenningTrap.cpp:273</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_ae915f6ad0eef1fb46530e836b6e071e5"><div class="ttname"><a href="classPenningTrap.html#ae915f6ad0eef1fb46530e836b6e071e5">PenningTrap::perturbation</a></div><div class="ttdeci">std::function&lt; double(double)&gt; perturbation</div><div class="ttdoc">Time-dependent perturbation.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8hpp_source.html#l00039">PenningTrap.hpp:39</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_ae9b5afdaa5cd366e94bd294452a1eed4"><div class="ttname"><a href="classPenningTrap.html#ae9b5afdaa5cd366e94bd294452a1eed4">PenningTrap::k_v</a></div><div class="ttdeci">sim_arr k_v</div><div class="ttdoc">A 2D vector containing all where is the index of a particle.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8hpp_source.html#l00047">PenningTrap.hpp:47</a></div></div>
<div class="ttc" id="aconstants_8hpp_html"><div class="ttname"><a href="constants_8hpp.html">constants.hpp</a></div><div class="ttdoc">Library of constants.</div></div>

View File

@@ -0,0 +1,216 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.9.6"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Penning Trap Simulation: src/scripts/animate_100_particles.py File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
extensions: ["tex2jax.js"],
jax: ["input/TeX","output/HTML-CSS"],
});
</script>
<script type="text/javascript" async="async" src="https://cdn.jsdelivr.net/npm/mathjax@2/MathJax.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="doxygen-awesome.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr id="projectrow">
<td id="projectalign">
<div id="projectname">Penning Trap Simulation
</div>
<div id="projectbrief">Simulate particle behavior inside a Penning Trap</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.6 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search/",'.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(document).ready(function(){initNavTree('animate__100__particles_8py.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<div id="MSearchResults">
<div class="SRPage">
<div id="SRIndex">
<div id="SRResults"></div>
<div class="SRStatus" id="Loading">Loading...</div>
<div class="SRStatus" id="Searching">Searching...</div>
<div class="SRStatus" id="NoMatches">No Matches</div>
</div>
</div>
</div>
</div>
<div class="header">
<div class="summary">
<a href="#func-members">Functions</a> </div>
<div class="headertitle"><div class="title">animate_100_particles.py File Reference</div></div>
</div><!--header-->
<div class="contents">
<p>Animate 100 particles.
<a href="#details">More...</a></p>
<p><a href="animate__100__particles_8py_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="func-members" name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:a88563d050144188c2c625a1063f9b4f8"><td class="memItemLeft" align="right" valign="top">def&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="animate__100__particles_8py.html#a88563d050144188c2c625a1063f9b4f8">animate_100_particles.get_data</a> (files)</td></tr>
<tr class="separator:a88563d050144188c2c625a1063f9b4f8"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a8b3fbca78794cb9cd04d6059d8b63624"><td class="memItemLeft" align="right" valign="top">def&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="animate__100__particles_8py.html#a8b3fbca78794cb9cd04d6059d8b63624">animate_100_particles.update</a> (num, lines, arr)</td></tr>
<tr class="separator:a8b3fbca78794cb9cd04d6059d8b63624"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ab5a461adc32af6d9bc9475cd6be309ca"><td class="memItemLeft" align="right" valign="top">def&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="animate__100__particles_8py.html#ab5a461adc32af6d9bc9475cd6be309ca">animate_100_particles.animate</a> ()</td></tr>
<tr class="separator:ab5a461adc32af6d9bc9475cd6be309ca"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Animate 100 particles. </p>
<dl class="section author"><dt>Author</dt><dd>Cory Alexander Balaton (coryab) </dd>
<dd>
Janita Ovidie Sandtrøen Willumsen (janitaws)</dd></dl>
<dl class="section version"><dt>Version</dt><dd>1.0</dd></dl>
<dl class="bug"><dt><b><a class="el" href="bug.html#_bug000012">Bug:</a></b></dt><dd>No known bugs </dd></dl>
<p class="definition">Definition in file <a class="el" href="animate__100__particles_8py_source.html">animate_100_particles.py</a>.</p>
</div><h2 class="groupheader">Function Documentation</h2>
<a id="ab5a461adc32af6d9bc9475cd6be309ca" name="ab5a461adc32af6d9bc9475cd6be309ca"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ab5a461adc32af6d9bc9475cd6be309ca">&#9670;&#160;</a></span>animate()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">def animate_100_particles.animate </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p class="definition">Definition at line <a class="el" href="animate__100__particles_8py_source.html#l00041">41</a> of file <a class="el" href="animate__100__particles_8py_source.html">animate_100_particles.py</a>.</p>
</div>
</div>
<a id="a88563d050144188c2c625a1063f9b4f8" name="a88563d050144188c2c625a1063f9b4f8"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a88563d050144188c2c625a1063f9b4f8">&#9670;&#160;</a></span>get_data()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">def animate_100_particles.get_data </td>
<td>(</td>
<td class="paramtype">&#160;</td>
<td class="paramname"><em>files</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p class="definition">Definition at line <a class="el" href="animate__100__particles_8py_source.html#l00018">18</a> of file <a class="el" href="animate__100__particles_8py_source.html">animate_100_particles.py</a>.</p>
</div>
</div>
<a id="a8b3fbca78794cb9cd04d6059d8b63624" name="a8b3fbca78794cb9cd04d6059d8b63624"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a8b3fbca78794cb9cd04d6059d8b63624">&#9670;&#160;</a></span>update()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">def animate_100_particles.update </td>
<td>(</td>
<td class="paramtype">&#160;</td>
<td class="paramname"><em>num</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">&#160;</td>
<td class="paramname"><em>lines</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">&#160;</td>
<td class="paramname"><em>arr</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p class="definition">Definition at line <a class="el" href="animate__100__particles_8py_source.html#l00035">35</a> of file <a class="el" href="animate__100__particles_8py_source.html">animate_100_particles.py</a>.</p>
</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li><li class="navelem"><a class="el" href="dir_634e799a3947388232110823971192a8.html">scripts</a></li><li class="navelem"><a class="el" href="animate__100__particles_8py.html">animate_100_particles.py</a></li>
<li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.6 </li>
</ul>
</div>
</body>
</html>

View File

@@ -101,83 +101,84 @@ $(document).ready(function(){initNavTree('animate__100__particles_8py_source.htm
<div class="headertitle"><div class="title">animate_100_particles.py</div></div>
</div><!--header-->
<div class="contents">
<div class="fragment"><div class="line"><a id="l00001" name="l00001"></a><span class="lineno"> 1</span><span class="keyword">import</span> matplotlib.pyplot <span class="keyword">as</span> plt</div>
<div class="line"><a id="l00002" name="l00002"></a><span class="lineno"> 2</span><span class="keyword">import</span> numpy <span class="keyword">as</span> np</div>
<div class="line"><a id="l00003" name="l00003"></a><span class="lineno"> 3</span><span class="keyword">from</span> matplotlib <span class="keyword">import</span> animation</div>
<div class="line"><a id="l00004" name="l00004"></a><span class="lineno"> 4</span><span class="keyword">from</span> mpl_toolkits.mplot3d <span class="keyword">import</span> Axes3D</div>
<div class="line"><a id="l00005" name="l00005"></a><span class="lineno"> 5</span> </div>
<div class="line"><a id="l00006" name="l00006"></a><span class="lineno"> 6</span> </div>
<div class="line"><a id="l00007" name="l00007"></a><span class="lineno"> 7</span><span class="keyword">def </span>get_data(files):</div>
<div class="line"><a id="l00008" name="l00008"></a><span class="lineno"> 8</span> res = []</div>
<div class="line"><a id="l00009" name="l00009"></a><span class="lineno"> 9</span> <span class="keywordflow">for</span> file <span class="keywordflow">in</span> files:</div>
<div class="line"><a id="l00010" name="l00010"></a><span class="lineno"> 10</span> arr = [[], [], []]</div>
<div class="line"><a id="l00011" name="l00011"></a><span class="lineno"> 11</span> <span class="keyword">with</span> open(file, encoding=<span class="stringliteral">&quot;utf8&quot;</span>) <span class="keyword">as</span> f:</div>
<div class="line"><a id="l00012" name="l00012"></a><span class="lineno"> 12</span> lines = f.readlines()</div>
<div class="line"><a id="l00013" name="l00013"></a><span class="lineno"> 13</span> </div>
<div class="line"><a id="l00014" name="l00014"></a><span class="lineno"> 14</span> <span class="keywordflow">for</span> line <span class="keywordflow">in</span> lines:</div>
<div class="line"><a id="l00015" name="l00015"></a><span class="lineno"> 15</span> xi, yi, zi = map(float, line.strip().split(<span class="stringliteral">&quot;,&quot;</span>))</div>
<div class="line"><a id="l00016" name="l00016"></a><span class="lineno"> 16</span> arr[0].append(xi)</div>
<div class="line"><a id="l00017" name="l00017"></a><span class="lineno"> 17</span> arr[1].append(yi)</div>
<div class="line"><a id="l00018" name="l00018"></a><span class="lineno"> 18</span> arr[2].append(zi)</div>
<div class="line"><a id="l00019" name="l00019"></a><span class="lineno"> 19</span> res.append(arr)</div>
<div class="line"><a id="l00020" name="l00020"></a><span class="lineno"> 20</span> </div>
<div class="line"><a id="l00021" name="l00021"></a><span class="lineno"> 21</span> <span class="keywordflow">return</span> np.array(res)</div>
<div class="line"><a id="l00022" name="l00022"></a><span class="lineno"> 22</span> </div>
<div class="line"><a id="l00023" name="l00023"></a><span class="lineno"> 23</span> </div>
<div class="line"><a id="l00024" name="l00024"></a><span class="lineno"> 24</span><span class="keyword">def </span>update(num, lines, arr):</div>
<div class="line"><a id="l00025" name="l00025"></a><span class="lineno"> 25</span> <span class="keywordflow">for</span> line, a <span class="keywordflow">in</span> zip(lines, arr):</div>
<div class="line"><a id="l00026" name="l00026"></a><span class="lineno"> 26</span> line.set_data(a[:2, num - 1 : num])</div>
<div class="line"><a id="l00027" name="l00027"></a><span class="lineno"> 27</span> line.set_3d_properties(a[2, num])</div>
<div class="line"><a id="l00028" name="l00028"></a><span class="lineno"> 28</span> </div>
<div class="line"><a id="l00029" name="l00029"></a><span class="lineno"> 29</span> </div>
<div class="line"><a id="l00030" name="l00030"></a><span class="lineno"> 30</span><span class="keyword">def </span>animate():</div>
<div class="line"><a id="l00031" name="l00031"></a><span class="lineno"> 31</span> plt.style.use(<span class="stringliteral">&quot;dark_background&quot;</span>)</div>
<div class="line"><a id="l00032" name="l00032"></a><span class="lineno"> 32</span> fig = plt.figure()</div>
<div class="line"><a id="l00033" name="l00033"></a><span class="lineno"> 33</span> ax = fig.add_subplot(projection=<span class="stringliteral">&quot;3d&quot;</span>)</div>
<a href="animate__100__particles_8py.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a id="l00001" name="l00001"></a><span class="lineno"> 1</span> </div>
<div class="line"><a id="l00011" name="l00011"></a><span class="lineno"> 11</span> </div>
<div class="line"><a id="l00012" name="l00012"></a><span class="lineno"> 12</span><span class="keyword">import</span> matplotlib.pyplot <span class="keyword">as</span> plt</div>
<div class="line"><a id="l00013" name="l00013"></a><span class="lineno"> 13</span><span class="keyword">import</span> numpy <span class="keyword">as</span> np</div>
<div class="line"><a id="l00014" name="l00014"></a><span class="lineno"> 14</span><span class="keyword">from</span> matplotlib <span class="keyword">import</span> animation</div>
<div class="line"><a id="l00015" name="l00015"></a><span class="lineno"> 15</span><span class="keyword">from</span> mpl_toolkits.mplot3d <span class="keyword">import</span> Axes3D</div>
<div class="line"><a id="l00016" name="l00016"></a><span class="lineno"> 16</span> </div>
<div class="line"><a id="l00017" name="l00017"></a><span class="lineno"> 17</span> </div>
<div class="line"><a id="l00018" name="l00018"></a><span class="lineno"> 18</span><span class="keyword">def </span>get_data(files):</div>
<div class="line"><a id="l00019" name="l00019"></a><span class="lineno"> 19</span> res = []</div>
<div class="line"><a id="l00020" name="l00020"></a><span class="lineno"> 20</span> <span class="keywordflow">for</span> file <span class="keywordflow">in</span> files:</div>
<div class="line"><a id="l00021" name="l00021"></a><span class="lineno"> 21</span> arr = [[], [], []]</div>
<div class="line"><a id="l00022" name="l00022"></a><span class="lineno"> 22</span> <span class="keyword">with</span> open(file, encoding=<span class="stringliteral">&quot;utf8&quot;</span>) <span class="keyword">as</span> f:</div>
<div class="line"><a id="l00023" name="l00023"></a><span class="lineno"> 23</span> lines = f.readlines()</div>
<div class="line"><a id="l00024" name="l00024"></a><span class="lineno"> 24</span> </div>
<div class="line"><a id="l00025" name="l00025"></a><span class="lineno"> 25</span> <span class="keywordflow">for</span> line <span class="keywordflow">in</span> lines:</div>
<div class="line"><a id="l00026" name="l00026"></a><span class="lineno"> 26</span> xi, yi, zi = map(float, line.strip().split(<span class="stringliteral">&quot;,&quot;</span>))</div>
<div class="line"><a id="l00027" name="l00027"></a><span class="lineno"> 27</span> arr[0].append(xi)</div>
<div class="line"><a id="l00028" name="l00028"></a><span class="lineno"> 28</span> arr[1].append(yi)</div>
<div class="line"><a id="l00029" name="l00029"></a><span class="lineno"> 29</span> arr[2].append(zi)</div>
<div class="line"><a id="l00030" name="l00030"></a><span class="lineno"> 30</span> res.append(arr)</div>
<div class="line"><a id="l00031" name="l00031"></a><span class="lineno"> 31</span> </div>
<div class="line"><a id="l00032" name="l00032"></a><span class="lineno"> 32</span> <span class="keywordflow">return</span> np.array(res)</div>
<div class="line"><a id="l00033" name="l00033"></a><span class="lineno"> 33</span> </div>
<div class="line"><a id="l00034" name="l00034"></a><span class="lineno"> 34</span> </div>
<div class="line"><a id="l00035" name="l00035"></a><span class="lineno"> 35</span> arr = get_data([f<span class="stringliteral">&quot;output/simulate_100_particles/particle_{i}_r.txt&quot;</span> <span class="keywordflow">for</span> i <span class="keywordflow">in</span> range(100)])</div>
<div class="line"><a id="l00036" name="l00036"></a><span class="lineno"> 36</span> </div>
<div class="line"><a id="l00037" name="l00037"></a><span class="lineno"> 37</span> arr = arr[:, :, ::10]</div>
<div class="line"><a id="l00038" name="l00038"></a><span class="lineno"> 38</span> </div>
<div class="line"><a id="l00039" name="l00039"></a><span class="lineno"> 39</span> N = len(arr[0][0])</div>
<div class="line"><a id="l00035" name="l00035"></a><span class="lineno"> 35</span><span class="keyword">def </span>update(num, lines, arr):</div>
<div class="line"><a id="l00036" name="l00036"></a><span class="lineno"> 36</span> <span class="keywordflow">for</span> line, a <span class="keywordflow">in</span> zip(lines, arr):</div>
<div class="line"><a id="l00037" name="l00037"></a><span class="lineno"> 37</span> line.set_data(a[:2, num - 1 : num])</div>
<div class="line"><a id="l00038" name="l00038"></a><span class="lineno"> 38</span> line.set_3d_properties(a[2, num])</div>
<div class="line"><a id="l00039" name="l00039"></a><span class="lineno"> 39</span> </div>
<div class="line"><a id="l00040" name="l00040"></a><span class="lineno"> 40</span> </div>
<div class="line"><a id="l00041" name="l00041"></a><span class="lineno"> 41</span> lines = [ax.plot(*a[:, 1], <span class="stringliteral">&quot;o&quot;</span>)[0] <span class="keywordflow">for</span> a <span class="keywordflow">in</span> arr]</div>
<div class="line"><a id="l00042" name="l00042"></a><span class="lineno"> 42</span> </div>
<div class="line"><a id="l00043" name="l00043"></a><span class="lineno"> 43</span> ax.set_title(<span class="stringliteral">&quot;100 particles inside a Penning trap&quot;</span>)</div>
<div class="line"><a id="l00044" name="l00044"></a><span class="lineno"> 44</span> plt.figtext(</div>
<div class="line"><a id="l00045" name="l00045"></a><span class="lineno"> 45</span> 0.5,</div>
<div class="line"><a id="l00046" name="l00046"></a><span class="lineno"> 46</span> 0.01,</div>
<div class="line"><a id="l00047" name="l00047"></a><span class="lineno"> 47</span> <span class="stringliteral">&quot;100 randomly generated particles &quot;</span></div>
<div class="line"><a id="l00048" name="l00048"></a><span class="lineno"> 48</span> <span class="stringliteral">&quot;evolving over a time of 50 microseconds.&quot;</span>,</div>
<div class="line"><a id="l00049" name="l00049"></a><span class="lineno"> 49</span> fontsize=12,</div>
<div class="line"><a id="l00050" name="l00050"></a><span class="lineno"> 50</span> horizontalalignment=<span class="stringliteral">&quot;center&quot;</span>,</div>
<div class="line"><a id="l00051" name="l00051"></a><span class="lineno"> 51</span> )</div>
<div class="line"><a id="l00052" name="l00052"></a><span class="lineno"> 52</span> </div>
<div class="line"><a id="l00053" name="l00053"></a><span class="lineno"> 53</span> ax.set_xlim3d([-500.0, 500.0])</div>
<div class="line"><a id="l00054" name="l00054"></a><span class="lineno"> 54</span> ax.set_xlabel(<span class="stringliteral">&quot;X (micrometers)&quot;</span>)</div>
<div class="line"><a id="l00055" name="l00055"></a><span class="lineno"> 55</span> </div>
<div class="line"><a id="l00056" name="l00056"></a><span class="lineno"> 56</span> ax.set_ylim3d([-500.0, 500.0])</div>
<div class="line"><a id="l00057" name="l00057"></a><span class="lineno"> 57</span> ax.set_ylabel(<span class="stringliteral">&quot;Y (micrometers)&quot;</span>)</div>
<div class="line"><a id="l00058" name="l00058"></a><span class="lineno"> 58</span> </div>
<div class="line"><a id="l00059" name="l00059"></a><span class="lineno"> 59</span> ax.set_zlim3d([-500.0, 500.0])</div>
<div class="line"><a id="l00060" name="l00060"></a><span class="lineno"> 60</span> ax.set_zlabel(<span class="stringliteral">&quot;Z (micrometers)&quot;</span>)</div>
<div class="line"><a id="l00061" name="l00061"></a><span class="lineno"> 61</span> </div>
<div class="line"><a id="l00062" name="l00062"></a><span class="lineno"> 62</span> ani = animation.FuncAnimation(</div>
<div class="line"><a id="l00063" name="l00063"></a><span class="lineno"> 63</span> fig, update, N, fargs=(lines, arr), interval=1, blit=<span class="keyword">False</span></div>
<div class="line"><a id="l00064" name="l00064"></a><span class="lineno"> 64</span> )</div>
<div class="line"><a id="l00065" name="l00065"></a><span class="lineno"> 65</span> </div>
<div class="line"><a id="l00066" name="l00066"></a><span class="lineno"> 66</span> <span class="comment"># ani.save(&quot;../images/100_particles.gif&quot;, writer=animation.FFMpegFileWriter(fps=50))</span></div>
<div class="line"><a id="l00067" name="l00067"></a><span class="lineno"> 67</span> plt.show()</div>
<div class="line"><a id="l00068" name="l00068"></a><span class="lineno"> 68</span> </div>
<div class="line"><a id="l00041" name="l00041"></a><span class="lineno"> 41</span><span class="keyword">def </span>animate():</div>
<div class="line"><a id="l00042" name="l00042"></a><span class="lineno"> 42</span> plt.style.use(<span class="stringliteral">&quot;dark_background&quot;</span>)</div>
<div class="line"><a id="l00043" name="l00043"></a><span class="lineno"> 43</span> fig = plt.figure()</div>
<div class="line"><a id="l00044" name="l00044"></a><span class="lineno"> 44</span> ax = fig.add_subplot(projection=<span class="stringliteral">&quot;3d&quot;</span>)</div>
<div class="line"><a id="l00045" name="l00045"></a><span class="lineno"> 45</span> </div>
<div class="line"><a id="l00046" name="l00046"></a><span class="lineno"> 46</span> arr = get_data([f<span class="stringliteral">&quot;output/simulate_100_particles/particle_{i}_r.txt&quot;</span> <span class="keywordflow">for</span> i <span class="keywordflow">in</span> range(100)])</div>
<div class="line"><a id="l00047" name="l00047"></a><span class="lineno"> 47</span> </div>
<div class="line"><a id="l00048" name="l00048"></a><span class="lineno"> 48</span> arr = arr[:, :, ::40]</div>
<div class="line"><a id="l00049" name="l00049"></a><span class="lineno"> 49</span> </div>
<div class="line"><a id="l00050" name="l00050"></a><span class="lineno"> 50</span> N = len(arr[0][0])</div>
<div class="line"><a id="l00051" name="l00051"></a><span class="lineno"> 51</span> </div>
<div class="line"><a id="l00052" name="l00052"></a><span class="lineno"> 52</span> lines = [ax.plot(*a[:, 1], <span class="stringliteral">&quot;o&quot;</span>)[0] <span class="keywordflow">for</span> a <span class="keywordflow">in</span> arr]</div>
<div class="line"><a id="l00053" name="l00053"></a><span class="lineno"> 53</span> </div>
<div class="line"><a id="l00054" name="l00054"></a><span class="lineno"> 54</span> ax.set_title(<span class="stringliteral">&quot;100 particles inside a Penning trap&quot;</span>)</div>
<div class="line"><a id="l00055" name="l00055"></a><span class="lineno"> 55</span> plt.figtext(</div>
<div class="line"><a id="l00056" name="l00056"></a><span class="lineno"> 56</span> 0.5,</div>
<div class="line"><a id="l00057" name="l00057"></a><span class="lineno"> 57</span> 0.01,</div>
<div class="line"><a id="l00058" name="l00058"></a><span class="lineno"> 58</span> <span class="stringliteral">&quot;100 randomly generated particles &quot;</span></div>
<div class="line"><a id="l00059" name="l00059"></a><span class="lineno"> 59</span> <span class="stringliteral">&quot;evolving over a time of 50 microseconds.&quot;</span>,</div>
<div class="line"><a id="l00060" name="l00060"></a><span class="lineno"> 60</span> fontsize=12,</div>
<div class="line"><a id="l00061" name="l00061"></a><span class="lineno"> 61</span> horizontalalignment=<span class="stringliteral">&quot;center&quot;</span>,</div>
<div class="line"><a id="l00062" name="l00062"></a><span class="lineno"> 62</span> )</div>
<div class="line"><a id="l00063" name="l00063"></a><span class="lineno"> 63</span> </div>
<div class="line"><a id="l00064" name="l00064"></a><span class="lineno"> 64</span> ax.set_xlim3d([-500.0, 500.0])</div>
<div class="line"><a id="l00065" name="l00065"></a><span class="lineno"> 65</span> ax.set_xlabel(<span class="stringliteral">&quot;X (micrometers)&quot;</span>)</div>
<div class="line"><a id="l00066" name="l00066"></a><span class="lineno"> 66</span> </div>
<div class="line"><a id="l00067" name="l00067"></a><span class="lineno"> 67</span> ax.set_ylim3d([-500.0, 500.0])</div>
<div class="line"><a id="l00068" name="l00068"></a><span class="lineno"> 68</span> ax.set_ylabel(<span class="stringliteral">&quot;Y (micrometers)&quot;</span>)</div>
<div class="line"><a id="l00069" name="l00069"></a><span class="lineno"> 69</span> </div>
<div class="line"><a id="l00070" name="l00070"></a><span class="lineno"> 70</span><span class="keywordflow">if</span> __name__ == <span class="stringliteral">&quot;__main__&quot;</span>:</div>
<div class="line"><a id="l00071" name="l00071"></a><span class="lineno"> 71</span> animate()</div>
<div class="line"><a id="l00070" name="l00070"></a><span class="lineno"> 70</span> ax.set_zlim3d([-500.0, 500.0])</div>
<div class="line"><a id="l00071" name="l00071"></a><span class="lineno"> 71</span> ax.set_zlabel(<span class="stringliteral">&quot;Z (micrometers)&quot;</span>)</div>
<div class="line"><a id="l00072" name="l00072"></a><span class="lineno"> 72</span> </div>
<div class="line"><a id="l00073" name="l00073"></a><span class="lineno"> 73</span> ani = animation.FuncAnimation(</div>
<div class="line"><a id="l00074" name="l00074"></a><span class="lineno"> 74</span> fig, update, N, fargs=(lines, arr), interval=1, blit=<span class="keyword">False</span></div>
<div class="line"><a id="l00075" name="l00075"></a><span class="lineno"> 75</span> )</div>
<div class="line"><a id="l00076" name="l00076"></a><span class="lineno"> 76</span> </div>
<div class="line"><a id="l00077" name="l00077"></a><span class="lineno"> 77</span> ani.save(<span class="stringliteral">&quot;../images/100_particles.gif&quot;</span>, writer=animation.FFMpegFileWriter(fps=50))</div>
<div class="line"><a id="l00078" name="l00078"></a><span class="lineno"> 78</span> </div>
<div class="line"><a id="l00079" name="l00079"></a><span class="lineno"> 79</span> </div>
<div class="line"><a id="l00080" name="l00080"></a><span class="lineno"> 80</span><span class="keywordflow">if</span> __name__ == <span class="stringliteral">&quot;__main__&quot;</span>:</div>
<div class="line"><a id="l00081" name="l00081"></a><span class="lineno"> 81</span> animate()</div>
</div><!-- fragment --></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li><li class="navelem"><a class="el" href="dir_634e799a3947388232110823971192a8.html">scripts</a></li><li class="navelem"><b>animate_100_particles.py</b></li>
<li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li><li class="navelem"><a class="el" href="dir_634e799a3947388232110823971192a8.html">scripts</a></li><li class="navelem"><a class="el" href="animate__100__particles_8py.html">animate_100_particles.py</a></li>
<li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.6 </li>
</ul>
</div>

View File

@@ -102,24 +102,40 @@ $(document).ready(function(){initNavTree('bug.html',''); initResizable(); });
</div><!--header-->
<div class="contents">
<div class="textblock"><dl class="reflist">
<dt>File <a class="el" href="animate__100__particles_8py.html">animate_100_particles.py</a> </dt>
<dd><a class="anchor" id="_bug000012"></a>No known bugs </dd>
<dt>File <a class="el" href="constants_8hpp.html">constants.hpp</a> </dt>
<dd><a class="anchor" id="_bug000001"></a>No known bugs </dd>
<dt>File <a class="el" href="main_8cpp.html">main.cpp</a> </dt>
<dt>File <a class="el" href="frequency__narrow__sweeps__long_8cpp.html">frequency_narrow_sweeps_long.cpp</a> </dt>
<dd><a class="anchor" id="_bug000006"></a>No known bugs </dd>
<dt>File <a class="el" href="Particle_8cpp.html">Particle.cpp</a> </dt>
<dt>File <a class="el" href="main_8cpp.html">main.cpp</a> </dt>
<dd><a class="anchor" id="_bug000007"></a>No known bugs </dd>
<dt>File <a class="el" href="Particle_8cpp.html">Particle.cpp</a> </dt>
<dd><a class="anchor" id="_bug000008"></a>No known bugs </dd>
<dt>File <a class="el" href="Particle_8hpp.html">Particle.hpp</a> </dt>
<dd><a class="anchor" id="_bug000002"></a>No known bugs </dd>
<dt>File <a class="el" href="PenningTrap_8cpp.html">PenningTrap.cpp</a> </dt>
<dd><a class="anchor" id="_bug000008"></a>No known bugs </dd>
<dd><a class="anchor" id="_bug000009"></a>No known bugs </dd>
<dt>File <a class="el" href="PenningTrap_8hpp.html">PenningTrap.hpp</a> </dt>
<dd><a class="anchor" id="_bug000003"></a>No known bugs </dd>
<dt>File <a class="el" href="plot__2__particles_8py.html">plot_2_particles.py</a> </dt>
<dd><a class="anchor" id="_bug000013"></a>No known bugs </dd>
<dt>File <a class="el" href="plot__3d_8py.html">plot_3d.py</a> </dt>
<dd><a class="anchor" id="_bug000014"></a>No known bugs </dd>
<dt>File <a class="el" href="plot__particles__left_8py.html">plot_particles_left.py</a> </dt>
<dd><a class="anchor" id="_bug000015"></a>No known bugs </dd>
<dt>File <a class="el" href="plot__phase__space_8py.html">plot_phase_space.py</a> </dt>
<dd><a class="anchor" id="_bug000016"></a>No known bugs </dd>
<dt>File <a class="el" href="plot__relative__error_8py.html">plot_relative_error.py</a> </dt>
<dd><a class="anchor" id="_bug000017"></a>No known bugs </dd>
<dt>File <a class="el" href="plot__single__particle_8py.html">plot_single_particle.py</a> </dt>
<dd><a class="anchor" id="_bug000018"></a>No known bugs </dd>
<dt>File <a class="el" href="test__suite_8cpp.html">test_suite.cpp</a> </dt>
<dd><a class="anchor" id="_bug000009"></a>No known bugs </dd>
<dd><a class="anchor" id="_bug000010"></a>No known bugs </dd>
<dt>File <a class="el" href="typedefs_8hpp.html">typedefs.hpp</a> </dt>
<dd><a class="anchor" id="_bug000004"></a>No known bugs </dd>
<dt>File <a class="el" href="utils_8cpp.html">utils.cpp</a> </dt>
<dd><a class="anchor" id="_bug000010"></a>No known bugs </dd>
<dd><a class="anchor" id="_bug000011"></a>No known bugs </dd>
<dt>File <a class="el" href="utils_8hpp.html">utils.hpp</a> </dt>
<dd><a class="anchor" id="_bug000005"></a>No known bugs </dd>
</dl>

View File

@@ -128,10 +128,11 @@ $(document).ready(function(){initNavTree('classPenningTrap.html',''); initResiza
<tr class="odd"><td class="entry"><a class="el" href="classPenningTrap.html#a8ca4e21291f60fde619c14099d8c4e8e">t</a></td><td class="entry"><a class="el" href="classPenningTrap.html">PenningTrap</a></td><td class="entry"><span class="mlabel">private</span></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classPenningTrap.html#a9a301b0540078c36697880ef204afdf3">total_force</a>(uint i)</td><td class="entry"><a class="el" href="classPenningTrap.html">PenningTrap</a></td><td class="entry"><span class="mlabel">private</span></td></tr>
<tr class="odd"><td class="entry"><a class="el" href="classPenningTrap.html#a2c01108b52c8e2a003cf9170da9e7682">total_force_external</a>(uint i)</td><td class="entry"><a class="el" href="classPenningTrap.html">PenningTrap</a></td><td class="entry"><span class="mlabel">private</span></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classPenningTrap.html#a2fe1cefbae18fa5808155ee0d2df713c">total_force_particles</a>(uint i)</td><td class="entry"><a class="el" href="classPenningTrap.html">PenningTrap</a></td><td class="entry"><span class="mlabel">private</span></td></tr>
<tr class="odd"><td class="entry"><a class="el" href="classPenningTrap.html#a715329844d75ec4c04f8391421fb4e89">V_0</a></td><td class="entry"><a class="el" href="classPenningTrap.html">PenningTrap</a></td><td class="entry"><span class="mlabel">private</span></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classPenningTrap.html#a3c0a44e4e0a94366ff609e81fe463fa2">v_func</a>(uint i, uint j, double dt)</td><td class="entry"><a class="el" href="classPenningTrap.html">PenningTrap</a></td><td class="entry"><span class="mlabel">private</span></td></tr>
<tr class="odd"><td class="entry"><a class="el" href="classPenningTrap.html#ad8bc4df7ab3eed53b16cfdff38e7760b">write_simulation_to_dir</a>(std::string path, double time, uint steps, std::string method=&quot;rk4&quot;, bool particle_interaction=true)</td><td class="entry"><a class="el" href="classPenningTrap.html">PenningTrap</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classPenningTrap.html#a6069f82d8dbc7cadaebd228dbcd95018">total_force_no_interaction</a>(uint i)</td><td class="entry"><a class="el" href="classPenningTrap.html">PenningTrap</a></td><td class="entry"><span class="mlabel">private</span></td></tr>
<tr class="odd"><td class="entry"><a class="el" href="classPenningTrap.html#a2fe1cefbae18fa5808155ee0d2df713c">total_force_particles</a>(uint i)</td><td class="entry"><a class="el" href="classPenningTrap.html">PenningTrap</a></td><td class="entry"><span class="mlabel">private</span></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classPenningTrap.html#a715329844d75ec4c04f8391421fb4e89">V_0</a></td><td class="entry"><a class="el" href="classPenningTrap.html">PenningTrap</a></td><td class="entry"><span class="mlabel">private</span></td></tr>
<tr class="odd"><td class="entry"><a class="el" href="classPenningTrap.html#a3c0a44e4e0a94366ff609e81fe463fa2">v_func</a>(uint i, uint j, double dt)</td><td class="entry"><a class="el" href="classPenningTrap.html">PenningTrap</a></td><td class="entry"><span class="mlabel">private</span></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classPenningTrap.html#ad8bc4df7ab3eed53b16cfdff38e7760b">write_simulation_to_dir</a>(std::string path, double time, uint steps, std::string method=&quot;rk4&quot;, bool particle_interaction=true)</td><td class="entry"><a class="el" href="classPenningTrap.html">PenningTrap</a></td><td class="entry"></td></tr>
</table></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->

View File

@@ -175,6 +175,9 @@ Private Member Functions</h2></td></tr>
<tr class="memitem:a9a301b0540078c36697880ef204afdf3"><td class="memItemLeft" align="right" valign="top"><a class="el" href="typedefs_8hpp.html#a3bdfb73a02f88ae32b6128ef747c4aea">vec3</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classPenningTrap.html#a9a301b0540078c36697880ef204afdf3">total_force</a> (uint i)</td></tr>
<tr class="memdesc:a9a301b0540078c36697880ef204afdf3"><td class="mdescLeft">&#160;</td><td class="mdescRight">calculate the total force on a particle p_i. <br /></td></tr>
<tr class="separator:a9a301b0540078c36697880ef204afdf3"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a6069f82d8dbc7cadaebd228dbcd95018"><td class="memItemLeft" align="right" valign="top"><a class="el" href="typedefs_8hpp.html#a3bdfb73a02f88ae32b6128ef747c4aea">vec3</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classPenningTrap.html#a6069f82d8dbc7cadaebd228dbcd95018">total_force_no_interaction</a> (uint i)</td></tr>
<tr class="memdesc:a6069f82d8dbc7cadaebd228dbcd95018"><td class="mdescLeft">&#160;</td><td class="mdescRight">calculate the total force on a particle p_i without interaction <br /></td></tr>
<tr class="separator:a6069f82d8dbc7cadaebd228dbcd95018"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="pri-attribs" name="pri-attribs"></a>
Private Attributes</h2></td></tr>
@@ -264,7 +267,7 @@ Friends</h2></td></tr>
</dd>
</dl>
<p class="definition">Definition at line <a class="el" href="PenningTrap_8cpp_source.html#l00115">115</a> of file <a class="el" href="PenningTrap_8cpp_source.html">PenningTrap.cpp</a>.</p>
<p class="definition">Definition at line <a class="el" href="PenningTrap_8cpp_source.html#l00120">120</a> of file <a class="el" href="PenningTrap_8cpp_source.html">PenningTrap.cpp</a>.</p>
</div>
</div>
@@ -324,7 +327,7 @@ Friends</h2></td></tr>
</dd>
</dl>
<p class="definition">Definition at line <a class="el" href="PenningTrap_8cpp_source.html#l00124">124</a> of file <a class="el" href="PenningTrap_8cpp_source.html">PenningTrap.cpp</a>.</p>
<p class="definition">Definition at line <a class="el" href="PenningTrap_8cpp_source.html#l00129">129</a> of file <a class="el" href="PenningTrap_8cpp_source.html">PenningTrap.cpp</a>.</p>
</div>
</div>
@@ -384,7 +387,7 @@ Friends</h2></td></tr>
</dd>
</dl>
<p class="definition">Definition at line <a class="el" href="PenningTrap_8cpp_source.html#l00134">134</a> of file <a class="el" href="PenningTrap_8cpp_source.html">PenningTrap.cpp</a>.</p>
<p class="definition">Definition at line <a class="el" href="PenningTrap_8cpp_source.html#l00139">139</a> of file <a class="el" href="PenningTrap_8cpp_source.html">PenningTrap.cpp</a>.</p>
</div>
</div>
@@ -413,7 +416,7 @@ Friends</h2></td></tr>
</dd>
</dl>
<p class="definition">Definition at line <a class="el" href="PenningTrap_8cpp_source.html#l00158">158</a> of file <a class="el" href="PenningTrap_8cpp_source.html">PenningTrap.cpp</a>.</p>
<p class="definition">Definition at line <a class="el" href="PenningTrap_8cpp_source.html#l00166">166</a> of file <a class="el" href="PenningTrap_8cpp_source.html">PenningTrap.cpp</a>.</p>
</div>
</div>
@@ -452,7 +455,7 @@ Friends</h2></td></tr>
</dd>
</dl>
<p class="definition">Definition at line <a class="el" href="PenningTrap_8cpp_source.html#l00201">201</a> of file <a class="el" href="PenningTrap_8cpp_source.html">PenningTrap.cpp</a>.</p>
<p class="definition">Definition at line <a class="el" href="PenningTrap_8cpp_source.html#l00211">211</a> of file <a class="el" href="PenningTrap_8cpp_source.html">PenningTrap.cpp</a>.</p>
</div>
</div>
@@ -491,7 +494,7 @@ Friends</h2></td></tr>
</dd>
</dl>
<p class="definition">Definition at line <a class="el" href="PenningTrap_8cpp_source.html#l00163">163</a> of file <a class="el" href="PenningTrap_8cpp_source.html">PenningTrap.cpp</a>.</p>
<p class="definition">Definition at line <a class="el" href="PenningTrap_8cpp_source.html#l00171">171</a> of file <a class="el" href="PenningTrap_8cpp_source.html">PenningTrap.cpp</a>.</p>
</div>
</div>
@@ -528,7 +531,7 @@ Friends</h2></td></tr>
</dl>
<dl class="section return"><dt>Returns</dt><dd>vec3 </dd></dl>
<p class="definition">Definition at line <a class="el" href="PenningTrap_8cpp_source.html#l00066">66</a> of file <a class="el" href="PenningTrap_8cpp_source.html">PenningTrap.cpp</a>.</p>
<p class="definition">Definition at line <a class="el" href="PenningTrap_8cpp_source.html#l00067">67</a> of file <a class="el" href="PenningTrap_8cpp_source.html">PenningTrap.cpp</a>.</p>
</div>
</div>
@@ -565,7 +568,7 @@ Friends</h2></td></tr>
</dl>
<dl class="section return"><dt>Returns</dt><dd>vec3 </dd></dl>
<p class="definition">Definition at line <a class="el" href="PenningTrap_8cpp_source.html#l00058">58</a> of file <a class="el" href="PenningTrap_8cpp_source.html">PenningTrap.cpp</a>.</p>
<p class="definition">Definition at line <a class="el" href="PenningTrap_8cpp_source.html#l00059">59</a> of file <a class="el" href="PenningTrap_8cpp_source.html">PenningTrap.cpp</a>.</p>
</div>
</div>
@@ -614,7 +617,7 @@ Friends</h2></td></tr>
</dl>
<dl class="section return"><dt>Returns</dt><dd>vec3 </dd></dl>
<p class="definition">Definition at line <a class="el" href="PenningTrap_8cpp_source.html#l00071">71</a> of file <a class="el" href="PenningTrap_8cpp_source.html">PenningTrap.cpp</a>.</p>
<p class="definition">Definition at line <a class="el" href="PenningTrap_8cpp_source.html#l00072">72</a> of file <a class="el" href="PenningTrap_8cpp_source.html">PenningTrap.cpp</a>.</p>
</div>
</div>
@@ -668,7 +671,7 @@ Friends</h2></td></tr>
</dl>
<dl class="section return"><dt>Returns</dt><dd>double </dd></dl>
<p class="definition">Definition at line <a class="el" href="PenningTrap_8cpp_source.html#l00297">297</a> of file <a class="el" href="PenningTrap_8cpp_source.html">PenningTrap.cpp</a>.</p>
<p class="definition">Definition at line <a class="el" href="PenningTrap_8cpp_source.html#l00311">311</a> of file <a class="el" href="PenningTrap_8cpp_source.html">PenningTrap.cpp</a>.</p>
</div>
</div>
@@ -724,7 +727,7 @@ Friends</h2></td></tr>
</dl>
<dl class="section return"><dt>Returns</dt><dd>vec3 </dd></dl>
<p class="definition">Definition at line <a class="el" href="PenningTrap_8cpp_source.html#l00039">39</a> of file <a class="el" href="PenningTrap_8cpp_source.html">PenningTrap.cpp</a>.</p>
<p class="definition">Definition at line <a class="el" href="PenningTrap_8cpp_source.html#l00040">40</a> of file <a class="el" href="PenningTrap_8cpp_source.html">PenningTrap.cpp</a>.</p>
</div>
</div>
@@ -769,7 +772,7 @@ Friends</h2></td></tr>
</dd>
</dl>
<p class="definition">Definition at line <a class="el" href="PenningTrap_8cpp_source.html#l00148">148</a> of file <a class="el" href="PenningTrap_8cpp_source.html">PenningTrap.cpp</a>.</p>
<p class="definition">Definition at line <a class="el" href="PenningTrap_8cpp_source.html#l00153">153</a> of file <a class="el" href="PenningTrap_8cpp_source.html">PenningTrap.cpp</a>.</p>
</div>
</div>
@@ -807,7 +810,7 @@ Friends</h2></td></tr>
</dd>
</dl>
<p class="definition">Definition at line <a class="el" href="PenningTrap_8cpp_source.html#l00141">141</a> of file <a class="el" href="PenningTrap_8cpp_source.html">PenningTrap.cpp</a>.</p>
<p class="definition">Definition at line <a class="el" href="PenningTrap_8cpp_source.html#l00146">146</a> of file <a class="el" href="PenningTrap_8cpp_source.html">PenningTrap.cpp</a>.</p>
</div>
</div>
@@ -861,7 +864,7 @@ Friends</h2></td></tr>
</dl>
<dl class="section return"><dt>Returns</dt><dd>simulation_t </dd></dl>
<p class="definition">Definition at line <a class="el" href="PenningTrap_8cpp_source.html#l00228">228</a> of file <a class="el" href="PenningTrap_8cpp_source.html">PenningTrap.cpp</a>.</p>
<p class="definition">Definition at line <a class="el" href="PenningTrap_8cpp_source.html#l00240">240</a> of file <a class="el" href="PenningTrap_8cpp_source.html">PenningTrap.cpp</a>.</p>
</div>
</div>
@@ -898,7 +901,7 @@ Friends</h2></td></tr>
</dl>
<dl class="section return"><dt>Returns</dt><dd>vec3 </dd></dl>
<p class="definition">Definition at line <a class="el" href="PenningTrap_8cpp_source.html#l00107">107</a> of file <a class="el" href="PenningTrap_8cpp_source.html">PenningTrap.cpp</a>.</p>
<p class="definition">Definition at line <a class="el" href="PenningTrap_8cpp_source.html#l00104">104</a> of file <a class="el" href="PenningTrap_8cpp_source.html">PenningTrap.cpp</a>.</p>
</div>
</div>
@@ -936,7 +939,44 @@ Friends</h2></td></tr>
</dl>
<dl class="section return"><dt>Returns</dt><dd>vec3 </dd></dl>
<p class="definition">Definition at line <a class="el" href="PenningTrap_8cpp_source.html#l00082">82</a> of file <a class="el" href="PenningTrap_8cpp_source.html">PenningTrap.cpp</a>.</p>
<p class="definition">Definition at line <a class="el" href="PenningTrap_8cpp_source.html#l00083">83</a> of file <a class="el" href="PenningTrap_8cpp_source.html">PenningTrap.cpp</a>.</p>
</div>
</div>
<a id="a6069f82d8dbc7cadaebd228dbcd95018" name="a6069f82d8dbc7cadaebd228dbcd95018"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a6069f82d8dbc7cadaebd228dbcd95018">&#9670;&#160;</a></span>total_force_no_interaction()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="typedefs_8hpp.html#a3bdfb73a02f88ae32b6128ef747c4aea">vec3</a> PenningTrap::total_force_no_interaction </td>
<td>(</td>
<td class="paramtype">uint&#160;</td>
<td class="paramname"><em>i</em></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">private</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>calculate the total force on a particle p_i without interaction </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">i</td><td>The index of particle p_i</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>vec3 </dd></dl>
<p class="definition">Definition at line <a class="el" href="PenningTrap_8cpp_source.html#l00112">112</a> of file <a class="el" href="PenningTrap_8cpp_source.html">PenningTrap.cpp</a>.</p>
</div>
</div>
@@ -973,7 +1013,7 @@ Friends</h2></td></tr>
</dl>
<dl class="section return"><dt>Returns</dt><dd>vec3 </dd></dl>
<p class="definition">Definition at line <a class="el" href="PenningTrap_8cpp_source.html#l00095">95</a> of file <a class="el" href="PenningTrap_8cpp_source.html">PenningTrap.cpp</a>.</p>
<p class="definition">Definition at line <a class="el" href="PenningTrap_8cpp_source.html#l00092">92</a> of file <a class="el" href="PenningTrap_8cpp_source.html">PenningTrap.cpp</a>.</p>
</div>
</div>
@@ -1029,7 +1069,7 @@ Friends</h2></td></tr>
</dl>
<dl class="section return"><dt>Returns</dt><dd>vec3 </dd></dl>
<p class="definition">Definition at line <a class="el" href="PenningTrap_8cpp_source.html#l00020">20</a> of file <a class="el" href="PenningTrap_8cpp_source.html">PenningTrap.cpp</a>.</p>
<p class="definition">Definition at line <a class="el" href="PenningTrap_8cpp_source.html#l00021">21</a> of file <a class="el" href="PenningTrap_8cpp_source.html">PenningTrap.cpp</a>.</p>
</div>
</div>
@@ -1089,7 +1129,7 @@ Friends</h2></td></tr>
</dd>
</dl>
<p class="definition">Definition at line <a class="el" href="PenningTrap_8cpp_source.html#l00259">259</a> of file <a class="el" href="PenningTrap_8cpp_source.html">PenningTrap.cpp</a>.</p>
<p class="definition">Definition at line <a class="el" href="PenningTrap_8cpp_source.html#l00273">273</a> of file <a class="el" href="PenningTrap_8cpp_source.html">PenningTrap.cpp</a>.</p>
</div>
</div>

View File

@@ -16,6 +16,7 @@ var classPenningTrap =
[ "simulate", "classPenningTrap.html#a7a1d9f0528a12308de25bc30718da20a", null ],
[ "total_force", "classPenningTrap.html#a9a301b0540078c36697880ef204afdf3", null ],
[ "total_force_external", "classPenningTrap.html#a2c01108b52c8e2a003cf9170da9e7682", null ],
[ "total_force_no_interaction", "classPenningTrap.html#a6069f82d8dbc7cadaebd228dbcd95018", null ],
[ "total_force_particles", "classPenningTrap.html#a2fe1cefbae18fa5808155ee0d2df713c", null ],
[ "v_func", "classPenningTrap.html#a3c0a44e4e0a94366ff609e81fe463fa2", null ],
[ "write_simulation_to_dir", "classPenningTrap.html#ad8bc4df7ab3eed53b16cfdff38e7760b", null ],

View File

@@ -104,19 +104,26 @@ $(document).ready(function(){initNavTree('dir_634e799a3947388232110823971192a8.h
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="files" name="files"></a>
Files</h2></td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">file &#160;</td><td class="memItemRight" valign="bottom"><b>animate_100_particles.py</b> <a href="animate__100__particles_8py_source.html">[code]</a></td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">file &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="animate__100__particles_8py.html">animate_100_particles.py</a> <a href="animate__100__particles_8py_source.html">[code]</a></td></tr>
<tr class="memdesc:animate__100__particles_8py"><td class="mdescLeft">&#160;</td><td class="mdescRight">Animate 100 particles. <br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">file &#160;</td><td class="memItemRight" valign="bottom"><b>plot_2_particles.py</b> <a href="plot__2__particles_8py_source.html">[code]</a></td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">file &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="plot__2__particles_8py.html">plot_2_particles.py</a> <a href="plot__2__particles_8py_source.html">[code]</a></td></tr>
<tr class="memdesc:plot__2__particles_8py"><td class="mdescLeft">&#160;</td><td class="mdescRight">Plot 2 particles with and without particle interactions in the xy-plane. <br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">file &#160;</td><td class="memItemRight" valign="bottom"><b>plot_3d.py</b> <a href="plot__3d_8py_source.html">[code]</a></td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">file &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="plot__3d_8py.html">plot_3d.py</a> <a href="plot__3d_8py_source.html">[code]</a></td></tr>
<tr class="memdesc:plot__3d_8py"><td class="mdescLeft">&#160;</td><td class="mdescRight">Plot 2 particles with and without particle interactions in 3D. <br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">file &#160;</td><td class="memItemRight" valign="bottom"><b>plot_particles_left.py</b> <a href="plot__particles__left_8py_source.html">[code]</a></td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">file &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="plot__particles__left_8py.html">plot_particles_left.py</a> <a href="plot__particles__left_8py_source.html">[code]</a></td></tr>
<tr class="memdesc:plot__particles__left_8py"><td class="mdescLeft">&#160;</td><td class="mdescRight">Plot how many particles are left after 500 microseconds using different angular frequencies. <br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">file &#160;</td><td class="memItemRight" valign="bottom"><b>plot_phase_space.py</b> <a href="plot__phase__space_8py_source.html">[code]</a></td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">file &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="plot__phase__space_8py.html">plot_phase_space.py</a> <a href="plot__phase__space_8py_source.html">[code]</a></td></tr>
<tr class="memdesc:plot__phase__space_8py"><td class="mdescLeft">&#160;</td><td class="mdescRight">Plot the phase space for 2 particles in the x and z direction, with and without particle interactions. <br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">file &#160;</td><td class="memItemRight" valign="bottom"><b>plot_relative_error.py</b> <a href="plot__relative__error_8py_source.html">[code]</a></td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">file &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="plot__relative__error_8py.html">plot_relative_error.py</a> <a href="plot__relative__error_8py_source.html">[code]</a></td></tr>
<tr class="memdesc:plot__relative__error_8py"><td class="mdescLeft">&#160;</td><td class="mdescRight">Plot the relative error for forward Euler and RK4 method. <br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">file &#160;</td><td class="memItemRight" valign="bottom"><b>plot_single_particle.py</b> <a href="plot__single__particle_8py_source.html">[code]</a></td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">file &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="plot__single__particle_8py.html">plot_single_particle.py</a> <a href="plot__single__particle_8py_source.html">[code]</a></td></tr>
<tr class="memdesc:plot__single__particle_8py"><td class="mdescLeft">&#160;</td><td class="mdescRight">Plot the approximation and analytical solution for one particle in the z axis. <br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
</div><!-- contents -->

View File

@@ -1,10 +1,10 @@
var dir_634e799a3947388232110823971192a8 =
[
[ "animate_100_particles.py", "animate__100__particles_8py_source.html", null ],
[ "plot_2_particles.py", "plot__2__particles_8py_source.html", null ],
[ "plot_3d.py", "plot__3d_8py_source.html", null ],
[ "plot_particles_left.py", "plot__particles__left_8py_source.html", null ],
[ "plot_phase_space.py", "plot__phase__space_8py_source.html", null ],
[ "plot_relative_error.py", "plot__relative__error_8py_source.html", null ],
[ "plot_single_particle.py", "plot__single__particle_8py_source.html", null ]
[ "animate_100_particles.py", "animate__100__particles_8py.html", null ],
[ "plot_2_particles.py", "plot__2__particles_8py.html", null ],
[ "plot_3d.py", "plot__3d_8py.html", null ],
[ "plot_particles_left.py", "plot__particles__left_8py.html", null ],
[ "plot_phase_space.py", "plot__phase__space_8py.html", null ],
[ "plot_relative_error.py", "plot__relative__error_8py.html", null ],
[ "plot_single_particle.py", "plot__single__particle_8py.html", null ]
];

View File

@@ -109,6 +109,9 @@ Directories</h2></td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="files" name="files"></a>
Files</h2></td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">file &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="frequency__narrow__sweeps__long_8cpp.html">frequency_narrow_sweeps_long.cpp</a> <a href="frequency__narrow__sweeps__long_8cpp_source.html">[code]</a></td></tr>
<tr class="memdesc:frequency__narrow__sweeps__long_8cpp"><td class="mdescLeft">&#160;</td><td class="mdescRight">Sweep of the frequencies from 1.1 to 1.7 using a small time step. <br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">file &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="main_8cpp.html">main.cpp</a> <a href="main_8cpp_source.html">[code]</a></td></tr>
<tr class="memdesc:main_8cpp"><td class="mdescLeft">&#160;</td><td class="mdescRight">The main program for this project. <br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>

View File

@@ -1,6 +1,7 @@
var dir_68267d1309a1af8e8297ef4c3efbcdba =
[
[ "scripts", "dir_634e799a3947388232110823971192a8.html", "dir_634e799a3947388232110823971192a8" ],
[ "frequency_narrow_sweeps_long.cpp", "frequency__narrow__sweeps__long_8cpp.html", "frequency__narrow__sweeps__long_8cpp" ],
[ "main.cpp", "main_8cpp.html", "main_8cpp" ],
[ "Particle.cpp", "Particle_8cpp.html", null ],
[ "PenningTrap.cpp", "PenningTrap_8cpp.html", null ],

View File

@@ -111,18 +111,19 @@ $(document).ready(function(){initNavTree('files.html',''); initResizable(); });
<tr id="row_0_4_" class="odd"><td class="entry"><span style="width:32px;display:inline-block;">&#160;</span><a href="utils_8hpp_source.html"><span class="icondoc"></span></a><a class="el" href="utils_8hpp.html" target="_self">utils.hpp</a></td><td class="desc">Function prototypes and macros that are useful </td></tr>
<tr id="row_1_" class="even"><td class="entry"><span style="width:0px;display:inline-block;">&#160;</span><span id="arr_1_" class="arrow" onclick="toggleFolder('1_')">&#9660;</span><span id="img_1_" class="iconfopen" onclick="toggleFolder('1_')">&#160;</span><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html" target="_self">src</a></td><td class="desc"></td></tr>
<tr id="row_1_0_" class="odd"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><span id="arr_1_0_" class="arrow" onclick="toggleFolder('1_0_')">&#9660;</span><span id="img_1_0_" class="iconfopen" onclick="toggleFolder('1_0_')">&#160;</span><a class="el" href="dir_634e799a3947388232110823971192a8.html" target="_self">scripts</a></td><td class="desc"></td></tr>
<tr id="row_1_0_0_" class="even"><td class="entry"><span style="width:48px;display:inline-block;">&#160;</span><a href="animate__100__particles_8py_source.html"><span class="icondoc"></span></a><b>animate_100_particles.py</b></td><td class="desc"></td></tr>
<tr id="row_1_0_1_" class="odd"><td class="entry"><span style="width:48px;display:inline-block;">&#160;</span><a href="plot__2__particles_8py_source.html"><span class="icondoc"></span></a><b>plot_2_particles.py</b></td><td class="desc"></td></tr>
<tr id="row_1_0_2_" class="even"><td class="entry"><span style="width:48px;display:inline-block;">&#160;</span><a href="plot__3d_8py_source.html"><span class="icondoc"></span></a><b>plot_3d.py</b></td><td class="desc"></td></tr>
<tr id="row_1_0_3_" class="odd"><td class="entry"><span style="width:48px;display:inline-block;">&#160;</span><a href="plot__particles__left_8py_source.html"><span class="icondoc"></span></a><b>plot_particles_left.py</b></td><td class="desc"></td></tr>
<tr id="row_1_0_4_" class="even"><td class="entry"><span style="width:48px;display:inline-block;">&#160;</span><a href="plot__phase__space_8py_source.html"><span class="icondoc"></span></a><b>plot_phase_space.py</b></td><td class="desc"></td></tr>
<tr id="row_1_0_5_" class="odd"><td class="entry"><span style="width:48px;display:inline-block;">&#160;</span><a href="plot__relative__error_8py_source.html"><span class="icondoc"></span></a><b>plot_relative_error.py</b></td><td class="desc"></td></tr>
<tr id="row_1_0_6_" class="even"><td class="entry"><span style="width:48px;display:inline-block;">&#160;</span><a href="plot__single__particle_8py_source.html"><span class="icondoc"></span></a><b>plot_single_particle.py</b></td><td class="desc"></td></tr>
<tr id="row_1_1_" class="odd"><td class="entry"><span style="width:32px;display:inline-block;">&#160;</span><a href="main_8cpp_source.html"><span class="icondoc"></span></a><a class="el" href="main_8cpp.html" target="_self">main.cpp</a></td><td class="desc">The main program for this project </td></tr>
<tr id="row_1_2_" class="even"><td class="entry"><span style="width:32px;display:inline-block;">&#160;</span><a href="Particle_8cpp_source.html"><span class="icondoc"></span></a><a class="el" href="Particle_8cpp.html" target="_self">Particle.cpp</a></td><td class="desc">The implementation of the <a class="el" href="classParticle.html" title="A class that holds attributes of a particle.">Particle</a> class </td></tr>
<tr id="row_1_3_" class="odd"><td class="entry"><span style="width:32px;display:inline-block;">&#160;</span><a href="PenningTrap_8cpp_source.html"><span class="icondoc"></span></a><a class="el" href="PenningTrap_8cpp.html" target="_self">PenningTrap.cpp</a></td><td class="desc">The implementation of the <a class="el" href="classPenningTrap.html" title="A class that simulates a Penning trap.">PenningTrap</a> class </td></tr>
<tr id="row_1_4_" class="even"><td class="entry"><span style="width:32px;display:inline-block;">&#160;</span><a href="test__suite_8cpp_source.html"><span class="icondoc"></span></a><a class="el" href="test__suite_8cpp.html" target="_self">test_suite.cpp</a></td><td class="desc">The test suite for the project </td></tr>
<tr id="row_1_5_" class="odd"><td class="entry"><span style="width:32px;display:inline-block;">&#160;</span><a href="utils_8cpp_source.html"><span class="icondoc"></span></a><a class="el" href="utils_8cpp.html" target="_self">utils.cpp</a></td><td class="desc">Implementation of the utils </td></tr>
<tr id="row_1_0_0_" class="even"><td class="entry"><span style="width:48px;display:inline-block;">&#160;</span><a href="animate__100__particles_8py_source.html"><span class="icondoc"></span></a><a class="el" href="animate__100__particles_8py.html" target="_self">animate_100_particles.py</a></td><td class="desc">Animate 100 particles </td></tr>
<tr id="row_1_0_1_" class="odd"><td class="entry"><span style="width:48px;display:inline-block;">&#160;</span><a href="plot__2__particles_8py_source.html"><span class="icondoc"></span></a><a class="el" href="plot__2__particles_8py.html" target="_self">plot_2_particles.py</a></td><td class="desc">Plot 2 particles with and without particle interactions in the xy-plane </td></tr>
<tr id="row_1_0_2_" class="even"><td class="entry"><span style="width:48px;display:inline-block;">&#160;</span><a href="plot__3d_8py_source.html"><span class="icondoc"></span></a><a class="el" href="plot__3d_8py.html" target="_self">plot_3d.py</a></td><td class="desc">Plot 2 particles with and without particle interactions in 3D </td></tr>
<tr id="row_1_0_3_" class="odd"><td class="entry"><span style="width:48px;display:inline-block;">&#160;</span><a href="plot__particles__left_8py_source.html"><span class="icondoc"></span></a><a class="el" href="plot__particles__left_8py.html" target="_self">plot_particles_left.py</a></td><td class="desc">Plot how many particles are left after 500 microseconds using different angular frequencies </td></tr>
<tr id="row_1_0_4_" class="even"><td class="entry"><span style="width:48px;display:inline-block;">&#160;</span><a href="plot__phase__space_8py_source.html"><span class="icondoc"></span></a><a class="el" href="plot__phase__space_8py.html" target="_self">plot_phase_space.py</a></td><td class="desc">Plot the phase space for 2 particles in the x and z direction, with and without particle interactions </td></tr>
<tr id="row_1_0_5_" class="odd"><td class="entry"><span style="width:48px;display:inline-block;">&#160;</span><a href="plot__relative__error_8py_source.html"><span class="icondoc"></span></a><a class="el" href="plot__relative__error_8py.html" target="_self">plot_relative_error.py</a></td><td class="desc">Plot the relative error for forward Euler and RK4 method </td></tr>
<tr id="row_1_0_6_" class="even"><td class="entry"><span style="width:48px;display:inline-block;">&#160;</span><a href="plot__single__particle_8py_source.html"><span class="icondoc"></span></a><a class="el" href="plot__single__particle_8py.html" target="_self">plot_single_particle.py</a></td><td class="desc">Plot the approximation and analytical solution for one particle in the z axis </td></tr>
<tr id="row_1_1_" class="odd"><td class="entry"><span style="width:32px;display:inline-block;">&#160;</span><a href="frequency__narrow__sweeps__long_8cpp_source.html"><span class="icondoc"></span></a><a class="el" href="frequency__narrow__sweeps__long_8cpp.html" target="_self">frequency_narrow_sweeps_long.cpp</a></td><td class="desc">Sweep of the frequencies from 1.1 to 1.7 using a small time step </td></tr>
<tr id="row_1_2_" class="even"><td class="entry"><span style="width:32px;display:inline-block;">&#160;</span><a href="main_8cpp_source.html"><span class="icondoc"></span></a><a class="el" href="main_8cpp.html" target="_self">main.cpp</a></td><td class="desc">The main program for this project </td></tr>
<tr id="row_1_3_" class="odd"><td class="entry"><span style="width:32px;display:inline-block;">&#160;</span><a href="Particle_8cpp_source.html"><span class="icondoc"></span></a><a class="el" href="Particle_8cpp.html" target="_self">Particle.cpp</a></td><td class="desc">The implementation of the <a class="el" href="classParticle.html" title="A class that holds attributes of a particle.">Particle</a> class </td></tr>
<tr id="row_1_4_" class="even"><td class="entry"><span style="width:32px;display:inline-block;">&#160;</span><a href="PenningTrap_8cpp_source.html"><span class="icondoc"></span></a><a class="el" href="PenningTrap_8cpp.html" target="_self">PenningTrap.cpp</a></td><td class="desc">The implementation of the <a class="el" href="classPenningTrap.html" title="A class that simulates a Penning trap.">PenningTrap</a> class </td></tr>
<tr id="row_1_5_" class="odd"><td class="entry"><span style="width:32px;display:inline-block;">&#160;</span><a href="test__suite_8cpp_source.html"><span class="icondoc"></span></a><a class="el" href="test__suite_8cpp.html" target="_self">test_suite.cpp</a></td><td class="desc">The test suite for the project </td></tr>
<tr id="row_1_6_" class="even"><td class="entry"><span style="width:32px;display:inline-block;">&#160;</span><a href="utils_8cpp_source.html"><span class="icondoc"></span></a><a class="el" href="utils_8cpp.html" target="_self">utils.cpp</a></td><td class="desc">Implementation of the utils </td></tr>
</table>
</div><!-- directory -->
</div><!-- contents -->

View File

@@ -0,0 +1,256 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.9.6"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Penning Trap Simulation: src/frequency_narrow_sweeps_long.cpp File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
extensions: ["tex2jax.js"],
jax: ["input/TeX","output/HTML-CSS"],
});
</script>
<script type="text/javascript" async="async" src="https://cdn.jsdelivr.net/npm/mathjax@2/MathJax.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="doxygen-awesome.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr id="projectrow">
<td id="projectalign">
<div id="projectname">Penning Trap Simulation
</div>
<div id="projectbrief">Simulate particle behavior inside a Penning Trap</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.6 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search/",'.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(document).ready(function(){initNavTree('frequency__narrow__sweeps__long_8cpp.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<div id="MSearchResults">
<div class="SRPage">
<div id="SRIndex">
<div id="SRResults"></div>
<div class="SRStatus" id="Loading">Loading...</div>
<div class="SRStatus" id="Searching">Searching...</div>
<div class="SRStatus" id="NoMatches">No Matches</div>
</div>
</div>
</div>
</div>
<div class="header">
<div class="summary">
<a href="#define-members">Macros</a> &#124;
<a href="#func-members">Functions</a> </div>
<div class="headertitle"><div class="title">frequency_narrow_sweeps_long.cpp File Reference</div></div>
</div><!--header-->
<div class="contents">
<p>Sweep of the frequencies from 1.1 to 1.7 using a small time step.
<a href="#details">More...</a></p>
<div class="textblock"><code>#include &lt;cmath&gt;</code><br />
<code>#include &lt;complex&gt;</code><br />
<code>#include &lt;fstream&gt;</code><br />
<code>#include &lt;omp.h&gt;</code><br />
<code>#include &lt;string&gt;</code><br />
<code>#include &lt;vector&gt;</code><br />
<code>#include &quot;<a class="el" href="PenningTrap_8hpp_source.html">PenningTrap.hpp</a>&quot;</code><br />
<code>#include &quot;<a class="el" href="constants_8hpp_source.html">constants.hpp</a>&quot;</code><br />
<code>#include &quot;<a class="el" href="utils_8hpp_source.html">utils.hpp</a>&quot;</code><br />
</div>
<p><a href="frequency__narrow__sweeps__long_8cpp_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="define-members" name="define-members"></a>
Macros</h2></td></tr>
<tr class="memitem:a7b24a37e8ce9d243351bfc9b24945e63"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="frequency__narrow__sweeps__long_8cpp.html#a7b24a37e8ce9d243351bfc9b24945e63">PARTICLES</a>&#160;&#160;&#160;100</td></tr>
<tr class="separator:a7b24a37e8ce9d243351bfc9b24945e63"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a0240ac851181b84ac374872dc5434ee4"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="frequency__narrow__sweeps__long_8cpp.html#a0240ac851181b84ac374872dc5434ee4">N</a>&#160;&#160;&#160;40000</td></tr>
<tr class="separator:a0240ac851181b84ac374872dc5434ee4"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="func-members" name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:a33d9b1c76c3c80902f89a58b1a6d96ea"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="frequency__narrow__sweeps__long_8cpp.html#a33d9b1c76c3c80902f89a58b1a6d96ea">potential_resonance_narrow_sweep</a> ()</td></tr>
<tr class="memdesc:a33d9b1c76c3c80902f89a58b1a6d96ea"><td class="mdescLeft">&#160;</td><td class="mdescRight">Simulate 100 particles over 500 \( \mu s \) using a time dependent potential. <br /></td></tr>
<tr class="separator:a33d9b1c76c3c80902f89a58b1a6d96ea"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac1816f70ec612edc27848ef7f0875fdb"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="frequency__narrow__sweeps__long_8cpp.html#ac1816f70ec612edc27848ef7f0875fdb">potential_resonance_narrow_sweep_interaction</a> ()</td></tr>
<tr class="memdesc:ac1816f70ec612edc27848ef7f0875fdb"><td class="mdescLeft">&#160;</td><td class="mdescRight">Simulate 100 particles over 500 \( \mu s \) using a time dependent potential. <br /></td></tr>
<tr class="separator:ac1816f70ec612edc27848ef7f0875fdb"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae66f6b31b5ad750f1fe042a706a4e3d4"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="frequency__narrow__sweeps__long_8cpp.html#ae66f6b31b5ad750f1fe042a706a4e3d4">main</a> ()</td></tr>
<tr class="separator:ae66f6b31b5ad750f1fe042a706a4e3d4"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Sweep of the frequencies from 1.1 to 1.7 using a small time step. </p>
<dl class="section author"><dt>Author</dt><dd>Cory Alexander Balaton (coryab) </dd>
<dd>
Janita Ovidie Sandtrøen Willumsen (janitaws)</dd></dl>
<dl class="section version"><dt>Version</dt><dd>1.0</dd></dl>
<dl class="bug"><dt><b><a class="el" href="bug.html#_bug000006">Bug:</a></b></dt><dd>No known bugs </dd></dl>
<p class="definition">Definition in file <a class="el" href="frequency__narrow__sweeps__long_8cpp_source.html">frequency_narrow_sweeps_long.cpp</a>.</p>
</div><h2 class="groupheader">Macro Definition Documentation</h2>
<a id="a0240ac851181b84ac374872dc5434ee4" name="a0240ac851181b84ac374872dc5434ee4"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a0240ac851181b84ac374872dc5434ee4">&#9670;&#160;</a></span>N</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define N&#160;&#160;&#160;40000</td>
</tr>
</table>
</div><div class="memdoc">
<p class="definition">Definition at line <a class="el" href="frequency__narrow__sweeps__long_8cpp_source.html#l00025">25</a> of file <a class="el" href="frequency__narrow__sweeps__long_8cpp_source.html">frequency_narrow_sweeps_long.cpp</a>.</p>
</div>
</div>
<a id="a7b24a37e8ce9d243351bfc9b24945e63" name="a7b24a37e8ce9d243351bfc9b24945e63"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a7b24a37e8ce9d243351bfc9b24945e63">&#9670;&#160;</a></span>PARTICLES</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define PARTICLES&#160;&#160;&#160;100</td>
</tr>
</table>
</div><div class="memdoc">
<p class="definition">Definition at line <a class="el" href="frequency__narrow__sweeps__long_8cpp_source.html#l00024">24</a> of file <a class="el" href="frequency__narrow__sweeps__long_8cpp_source.html">frequency_narrow_sweeps_long.cpp</a>.</p>
</div>
</div>
<h2 class="groupheader">Function Documentation</h2>
<a id="ae66f6b31b5ad750f1fe042a706a4e3d4" name="ae66f6b31b5ad750f1fe042a706a4e3d4"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ae66f6b31b5ad750f1fe042a706a4e3d4">&#9670;&#160;</a></span>main()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int main </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p class="definition">Definition at line <a class="el" href="frequency__narrow__sweeps__long_8cpp_source.html#l00139">139</a> of file <a class="el" href="frequency__narrow__sweeps__long_8cpp_source.html">frequency_narrow_sweeps_long.cpp</a>.</p>
</div>
</div>
<a id="a33d9b1c76c3c80902f89a58b1a6d96ea" name="a33d9b1c76c3c80902f89a58b1a6d96ea"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a33d9b1c76c3c80902f89a58b1a6d96ea">&#9670;&#160;</a></span>potential_resonance_narrow_sweep()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void potential_resonance_narrow_sweep </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Simulate 100 particles over 500 \( \mu s \) using a time dependent potential. </p>
<p>The simulation sweeps over different frequencies in [1., 1.7] MHz. </p>
<p class="definition">Definition at line <a class="el" href="frequency__narrow__sweeps__long_8cpp_source.html#l00034">34</a> of file <a class="el" href="frequency__narrow__sweeps__long_8cpp_source.html">frequency_narrow_sweeps_long.cpp</a>.</p>
</div>
</div>
<a id="ac1816f70ec612edc27848ef7f0875fdb" name="ac1816f70ec612edc27848ef7f0875fdb"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ac1816f70ec612edc27848ef7f0875fdb">&#9670;&#160;</a></span>potential_resonance_narrow_sweep_interaction()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void potential_resonance_narrow_sweep_interaction </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Simulate 100 particles over 500 \( \mu s \) using a time dependent potential. </p>
<p>The simulation sweeps over different frequencies in [1., 1.7] MHz. </p>
<p class="definition">Definition at line <a class="el" href="frequency__narrow__sweeps__long_8cpp_source.html#l00091">91</a> of file <a class="el" href="frequency__narrow__sweeps__long_8cpp_source.html">frequency_narrow_sweeps_long.cpp</a>.</p>
</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li><li class="navelem"><a class="el" href="frequency__narrow__sweeps__long_8cpp.html">frequency_narrow_sweeps_long.cpp</a></li>
<li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.6 </li>
</ul>
</div>
</body>
</html>

View File

@@ -0,0 +1,5 @@
var frequency__narrow__sweeps__long_8cpp =
[
[ "potential_resonance_narrow_sweep", "frequency__narrow__sweeps__long_8cpp.html#a33d9b1c76c3c80902f89a58b1a6d96ea", null ],
[ "potential_resonance_narrow_sweep_interaction", "frequency__narrow__sweeps__long_8cpp.html#ac1816f70ec612edc27848ef7f0875fdb", null ]
];

View File

@@ -0,0 +1,252 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.9.6"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Penning Trap Simulation: src/frequency_narrow_sweeps_long.cpp Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
extensions: ["tex2jax.js"],
jax: ["input/TeX","output/HTML-CSS"],
});
</script>
<script type="text/javascript" async="async" src="https://cdn.jsdelivr.net/npm/mathjax@2/MathJax.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="doxygen-awesome.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr id="projectrow">
<td id="projectalign">
<div id="projectname">Penning Trap Simulation
</div>
<div id="projectbrief">Simulate particle behavior inside a Penning Trap</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.6 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search/",'.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(document).ready(function(){initNavTree('frequency__narrow__sweeps__long_8cpp_source.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<div id="MSearchResults">
<div class="SRPage">
<div id="SRIndex">
<div id="SRResults"></div>
<div class="SRStatus" id="Loading">Loading...</div>
<div class="SRStatus" id="Searching">Searching...</div>
<div class="SRStatus" id="NoMatches">No Matches</div>
</div>
</div>
</div>
</div>
<div class="header">
<div class="headertitle"><div class="title">frequency_narrow_sweeps_long.cpp</div></div>
</div><!--header-->
<div class="contents">
<a href="frequency__narrow__sweeps__long_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a id="l00001" name="l00001"></a><span class="lineno"> 1</span> </div>
<div class="line"><a id="l00013" name="l00013"></a><span class="lineno"> 13</span><span class="preprocessor">#include &lt;cmath&gt;</span></div>
<div class="line"><a id="l00014" name="l00014"></a><span class="lineno"> 14</span><span class="preprocessor">#include &lt;complex&gt;</span></div>
<div class="line"><a id="l00015" name="l00015"></a><span class="lineno"> 15</span><span class="preprocessor">#include &lt;fstream&gt;</span></div>
<div class="line"><a id="l00016" name="l00016"></a><span class="lineno"> 16</span><span class="preprocessor">#include &lt;omp.h&gt;</span></div>
<div class="line"><a id="l00017" name="l00017"></a><span class="lineno"> 17</span><span class="preprocessor">#include &lt;string&gt;</span></div>
<div class="line"><a id="l00018" name="l00018"></a><span class="lineno"> 18</span><span class="preprocessor">#include &lt;vector&gt;</span></div>
<div class="line"><a id="l00019" name="l00019"></a><span class="lineno"> 19</span> </div>
<div class="line"><a id="l00020" name="l00020"></a><span class="lineno"> 20</span><span class="preprocessor">#include &quot;<a class="code" href="PenningTrap_8hpp.html">PenningTrap.hpp</a>&quot;</span></div>
<div class="line"><a id="l00021" name="l00021"></a><span class="lineno"> 21</span><span class="preprocessor">#include &quot;<a class="code" href="constants_8hpp.html">constants.hpp</a>&quot;</span></div>
<div class="line"><a id="l00022" name="l00022"></a><span class="lineno"> 22</span><span class="preprocessor">#include &quot;<a class="code" href="utils_8hpp.html">utils.hpp</a>&quot;</span></div>
<div class="line"><a id="l00023" name="l00023"></a><span class="lineno"> 23</span> </div>
<div class="line"><a id="l00024" name="l00024"></a><span class="lineno"> 24</span><span class="preprocessor">#define PARTICLES 100</span></div>
<div class="line"><a id="l00025" name="l00025"></a><span class="lineno"> 25</span><span class="preprocessor">#define N 40000</span></div>
<div class="line"><a id="l00026" name="l00026"></a><span class="lineno"> 26</span> </div>
<div class="line"><a id="l00034" name="l00034"></a><span class="lineno"><a class="line" href="frequency__narrow__sweeps__long_8cpp.html#a33d9b1c76c3c80902f89a58b1a6d96ea"> 34</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="frequency__narrow__sweeps__long_8cpp.html#a33d9b1c76c3c80902f89a58b1a6d96ea">potential_resonance_narrow_sweep</a>()</div>
<div class="line"><a id="l00035" name="l00035"></a><span class="lineno"> 35</span>{</div>
<div class="line"><a id="l00036" name="l00036"></a><span class="lineno"> 36</span> <span class="keywordtype">double</span> time = 500.;</div>
<div class="line"><a id="l00037" name="l00037"></a><span class="lineno"> 37</span> </div>
<div class="line"><a id="l00038" name="l00038"></a><span class="lineno"> 38</span> <span class="keywordtype">double</span> amplitudes[]{.1, .4, .7};</div>
<div class="line"><a id="l00039" name="l00039"></a><span class="lineno"> 39</span> </div>
<div class="line"><a id="l00040" name="l00040"></a><span class="lineno"> 40</span> <span class="keywordtype">double</span> freq_start = 1.1;</div>
<div class="line"><a id="l00041" name="l00041"></a><span class="lineno"> 41</span> <span class="keywordtype">double</span> freq_end = 1.7;</div>
<div class="line"><a id="l00042" name="l00042"></a><span class="lineno"> 42</span> <span class="keywordtype">double</span> freq_increment = .0005;</div>
<div class="line"><a id="l00043" name="l00043"></a><span class="lineno"> 43</span> <span class="keywordtype">size_t</span> freq_iterations =</div>
<div class="line"><a id="l00044" name="l00044"></a><span class="lineno"> 44</span> (size_t)((freq_end - freq_start) / freq_increment) + 1;</div>
<div class="line"><a id="l00045" name="l00045"></a><span class="lineno"> 45</span> </div>
<div class="line"><a id="l00046" name="l00046"></a><span class="lineno"> 46</span> <span class="keywordtype">double</span> res[4][freq_iterations];</div>
<div class="line"><a id="l00047" name="l00047"></a><span class="lineno"> 47</span> </div>
<div class="line"><a id="l00048" name="l00048"></a><span class="lineno"> 48</span> std::string path = <span class="stringliteral">&quot;output/time_dependent_potential/&quot;</span>;</div>
<div class="line"><a id="l00049" name="l00049"></a><span class="lineno"> 49</span> <a class="code hl_function" href="utils_8hpp.html#a6fdd7217b750aff5b6295ece7cbdeffa">mkpath</a>(path);</div>
<div class="line"><a id="l00050" name="l00050"></a><span class="lineno"> 50</span> </div>
<div class="line"><a id="l00051" name="l00051"></a><span class="lineno"> 51</span> std::ofstream ofile;</div>
<div class="line"><a id="l00052" name="l00052"></a><span class="lineno"> 52</span> </div>
<div class="line"><a id="l00053" name="l00053"></a><span class="lineno"> 53</span><span class="preprocessor">#pragma omp parallel for</span></div>
<div class="line"><a id="l00054" name="l00054"></a><span class="lineno"> 54</span> <span class="comment">// Insert frequencies</span></div>
<div class="line"><a id="l00055" name="l00055"></a><span class="lineno"> 55</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i = 0; i &lt; freq_iterations; i++) {</div>
<div class="line"><a id="l00056" name="l00056"></a><span class="lineno"> 56</span> res[0][i] = freq_start + freq_increment * i;</div>
<div class="line"><a id="l00057" name="l00057"></a><span class="lineno"> 57</span> }</div>
<div class="line"><a id="l00058" name="l00058"></a><span class="lineno"> 58</span> </div>
<div class="line"><a id="l00059" name="l00059"></a><span class="lineno"> 59</span><span class="preprocessor">#pragma omp parallel</span></div>
<div class="line"><a id="l00060" name="l00060"></a><span class="lineno"> 60</span> {</div>
<div class="line"><a id="l00061" name="l00061"></a><span class="lineno"> 61</span> <span class="comment">// Each thread creates a PenningTrap instance and reuses it throughout</span></div>
<div class="line"><a id="l00062" name="l00062"></a><span class="lineno"> 62</span> <span class="comment">// the sweep.</span></div>
<div class="line"><a id="l00063" name="l00063"></a><span class="lineno"> 63</span> <a class="code hl_class" href="classPenningTrap.html">PenningTrap</a> trap((uint)PARTICLES);</div>
<div class="line"><a id="l00064" name="l00064"></a><span class="lineno"> 64</span><span class="preprocessor">#pragma omp for collapse(2)</span></div>
<div class="line"><a id="l00065" name="l00065"></a><span class="lineno"> 65</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i = 0; i &lt; 3; i++) {</div>
<div class="line"><a id="l00066" name="l00066"></a><span class="lineno"> 66</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> j = 0; j &lt; freq_iterations; j++) {</div>
<div class="line"><a id="l00067" name="l00067"></a><span class="lineno"> 67</span> <span class="comment">// Reset particles and give new time dependent potential.</span></div>
<div class="line"><a id="l00068" name="l00068"></a><span class="lineno"> 68</span> trap.<a class="code hl_function" href="classPenningTrap.html#aaee129f177657455348d0c8ae1441dea">reinitialize</a>(amplitudes[i], res[0][j]);</div>
<div class="line"><a id="l00069" name="l00069"></a><span class="lineno"> 69</span> res[i + 1][j] =</div>
<div class="line"><a id="l00070" name="l00070"></a><span class="lineno"> 70</span> trap.<a class="code hl_function" href="classPenningTrap.html#ac529aa26c288f34eae184a67e6bac41f">fraction_of_particles_left</a>(time, N, <span class="stringliteral">&quot;rk4&quot;</span>, <span class="keyword">false</span>);</div>
<div class="line"><a id="l00071" name="l00071"></a><span class="lineno"> 71</span> }</div>
<div class="line"><a id="l00072" name="l00072"></a><span class="lineno"> 72</span> }</div>
<div class="line"><a id="l00073" name="l00073"></a><span class="lineno"> 73</span> }</div>
<div class="line"><a id="l00074" name="l00074"></a><span class="lineno"> 74</span> </div>
<div class="line"><a id="l00075" name="l00075"></a><span class="lineno"> 75</span> <span class="comment">// Write results to file</span></div>
<div class="line"><a id="l00076" name="l00076"></a><span class="lineno"> 76</span> ofile.open(path + <span class="stringliteral">&quot;narrow_sweep_fine.txt&quot;</span>);</div>
<div class="line"><a id="l00077" name="l00077"></a><span class="lineno"> 77</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i = 0; i &lt; freq_iterations; i++) {</div>
<div class="line"><a id="l00078" name="l00078"></a><span class="lineno"> 78</span> ofile &lt;&lt; res[0][i] &lt;&lt; <span class="charliteral">&#39;,&#39;</span> &lt;&lt; res[1][i] &lt;&lt; <span class="charliteral">&#39;,&#39;</span> &lt;&lt; res[2][i] &lt;&lt; <span class="charliteral">&#39;,&#39;</span></div>
<div class="line"><a id="l00079" name="l00079"></a><span class="lineno"> 79</span> &lt;&lt; res[3][i] &lt;&lt; <span class="charliteral">&#39;\n&#39;</span>;</div>
<div class="line"><a id="l00080" name="l00080"></a><span class="lineno"> 80</span> }</div>
<div class="line"><a id="l00081" name="l00081"></a><span class="lineno"> 81</span> ofile.close();</div>
<div class="line"><a id="l00082" name="l00082"></a><span class="lineno"> 82</span>}</div>
<div class="line"><a id="l00083" name="l00083"></a><span class="lineno"> 83</span> </div>
<div class="line"><a id="l00091" name="l00091"></a><span class="lineno"><a class="line" href="frequency__narrow__sweeps__long_8cpp.html#ac1816f70ec612edc27848ef7f0875fdb"> 91</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="frequency__narrow__sweeps__long_8cpp.html#ac1816f70ec612edc27848ef7f0875fdb">potential_resonance_narrow_sweep_interaction</a>()</div>
<div class="line"><a id="l00092" name="l00092"></a><span class="lineno"> 92</span>{</div>
<div class="line"><a id="l00093" name="l00093"></a><span class="lineno"> 93</span> <span class="keywordtype">double</span> time = 500.;</div>
<div class="line"><a id="l00094" name="l00094"></a><span class="lineno"> 94</span> </div>
<div class="line"><a id="l00095" name="l00095"></a><span class="lineno"> 95</span> <span class="keywordtype">double</span> amplitudes[]{.1, .4, .7};</div>
<div class="line"><a id="l00096" name="l00096"></a><span class="lineno"> 96</span> </div>
<div class="line"><a id="l00097" name="l00097"></a><span class="lineno"> 97</span> <span class="keywordtype">double</span> freq_start = 1.1;</div>
<div class="line"><a id="l00098" name="l00098"></a><span class="lineno"> 98</span> <span class="keywordtype">double</span> freq_end = 1.7;</div>
<div class="line"><a id="l00099" name="l00099"></a><span class="lineno"> 99</span> <span class="keywordtype">double</span> freq_increment = .0005;</div>
<div class="line"><a id="l00100" name="l00100"></a><span class="lineno"> 100</span> <span class="keywordtype">size_t</span> freq_iterations =</div>
<div class="line"><a id="l00101" name="l00101"></a><span class="lineno"> 101</span> (size_t)((freq_end - freq_start) / freq_increment) + 1;</div>
<div class="line"><a id="l00102" name="l00102"></a><span class="lineno"> 102</span> </div>
<div class="line"><a id="l00103" name="l00103"></a><span class="lineno"> 103</span> <span class="keywordtype">double</span> res[4][freq_iterations];</div>
<div class="line"><a id="l00104" name="l00104"></a><span class="lineno"> 104</span> </div>
<div class="line"><a id="l00105" name="l00105"></a><span class="lineno"> 105</span> std::string path = <span class="stringliteral">&quot;output/time_dependent_potential/&quot;</span>;</div>
<div class="line"><a id="l00106" name="l00106"></a><span class="lineno"> 106</span> <a class="code hl_function" href="utils_8hpp.html#a6fdd7217b750aff5b6295ece7cbdeffa">mkpath</a>(path);</div>
<div class="line"><a id="l00107" name="l00107"></a><span class="lineno"> 107</span> </div>
<div class="line"><a id="l00108" name="l00108"></a><span class="lineno"> 108</span> std::ofstream ofile;</div>
<div class="line"><a id="l00109" name="l00109"></a><span class="lineno"> 109</span> </div>
<div class="line"><a id="l00110" name="l00110"></a><span class="lineno"> 110</span><span class="preprocessor">#pragma omp parallel for</span></div>
<div class="line"><a id="l00111" name="l00111"></a><span class="lineno"> 111</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i = 0; i &lt; freq_iterations; i++) {</div>
<div class="line"><a id="l00112" name="l00112"></a><span class="lineno"> 112</span> res[0][i] = freq_start + freq_increment * i;</div>
<div class="line"><a id="l00113" name="l00113"></a><span class="lineno"> 113</span> }</div>
<div class="line"><a id="l00114" name="l00114"></a><span class="lineno"> 114</span> </div>
<div class="line"><a id="l00115" name="l00115"></a><span class="lineno"> 115</span><span class="preprocessor">#pragma omp parallel</span></div>
<div class="line"><a id="l00116" name="l00116"></a><span class="lineno"> 116</span> {</div>
<div class="line"><a id="l00117" name="l00117"></a><span class="lineno"> 117</span> <span class="comment">// Each thread creates a PenningTrap instance and reuses it throughout</span></div>
<div class="line"><a id="l00118" name="l00118"></a><span class="lineno"> 118</span> <span class="comment">// the sweep.</span></div>
<div class="line"><a id="l00119" name="l00119"></a><span class="lineno"> 119</span> <a class="code hl_class" href="classPenningTrap.html">PenningTrap</a> trap((uint)PARTICLES);</div>
<div class="line"><a id="l00120" name="l00120"></a><span class="lineno"> 120</span><span class="preprocessor">#pragma omp for collapse(2)</span></div>
<div class="line"><a id="l00121" name="l00121"></a><span class="lineno"> 121</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i = 0; i &lt; 3; i++) {</div>
<div class="line"><a id="l00122" name="l00122"></a><span class="lineno"> 122</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> j = 0; j &lt; freq_iterations; j++) {</div>
<div class="line"><a id="l00123" name="l00123"></a><span class="lineno"> 123</span> <span class="comment">// Reset particles and give new time dependent potential.</span></div>
<div class="line"><a id="l00124" name="l00124"></a><span class="lineno"> 124</span> trap.<a class="code hl_function" href="classPenningTrap.html#aaee129f177657455348d0c8ae1441dea">reinitialize</a>(amplitudes[i], res[0][j]);</div>
<div class="line"><a id="l00125" name="l00125"></a><span class="lineno"> 125</span> res[i + 1][j] = trap.<a class="code hl_function" href="classPenningTrap.html#ac529aa26c288f34eae184a67e6bac41f">fraction_of_particles_left</a>(time, N);</div>
<div class="line"><a id="l00126" name="l00126"></a><span class="lineno"> 126</span> }</div>
<div class="line"><a id="l00127" name="l00127"></a><span class="lineno"> 127</span> }</div>
<div class="line"><a id="l00128" name="l00128"></a><span class="lineno"> 128</span> }</div>
<div class="line"><a id="l00129" name="l00129"></a><span class="lineno"> 129</span> </div>
<div class="line"><a id="l00130" name="l00130"></a><span class="lineno"> 130</span> <span class="comment">// Write results to file</span></div>
<div class="line"><a id="l00131" name="l00131"></a><span class="lineno"> 131</span> ofile.open(path + <span class="stringliteral">&quot;narrow_sweep_interactions_fine.txt&quot;</span>);</div>
<div class="line"><a id="l00132" name="l00132"></a><span class="lineno"> 132</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i = 0; i &lt; freq_iterations; i++) {</div>
<div class="line"><a id="l00133" name="l00133"></a><span class="lineno"> 133</span> ofile &lt;&lt; res[0][i] &lt;&lt; <span class="charliteral">&#39;,&#39;</span> &lt;&lt; res[1][i] &lt;&lt; <span class="charliteral">&#39;,&#39;</span> &lt;&lt; res[2][i] &lt;&lt; <span class="charliteral">&#39;,&#39;</span></div>
<div class="line"><a id="l00134" name="l00134"></a><span class="lineno"> 134</span> &lt;&lt; res[3][i] &lt;&lt; <span class="charliteral">&#39;\n&#39;</span>;</div>
<div class="line"><a id="l00135" name="l00135"></a><span class="lineno"> 135</span> }</div>
<div class="line"><a id="l00136" name="l00136"></a><span class="lineno"> 136</span> ofile.close();</div>
<div class="line"><a id="l00137" name="l00137"></a><span class="lineno"> 137</span>}</div>
<div class="line"><a id="l00138" name="l00138"></a><span class="lineno"> 138</span> </div>
<div class="line"><a id="l00139" name="l00139"></a><span class="lineno"> 139</span><span class="keywordtype">int</span> main()</div>
<div class="line"><a id="l00140" name="l00140"></a><span class="lineno"> 140</span>{</div>
<div class="line"><a id="l00141" name="l00141"></a><span class="lineno"> 141</span> <span class="keywordtype">double</span> start, end;</div>
<div class="line"><a id="l00142" name="l00142"></a><span class="lineno"> 142</span> </div>
<div class="line"><a id="l00143" name="l00143"></a><span class="lineno"> 143</span> start = omp_get_wtime();</div>
<div class="line"><a id="l00144" name="l00144"></a><span class="lineno"> 144</span> </div>
<div class="line"><a id="l00145" name="l00145"></a><span class="lineno"> 145</span> <a class="code hl_function" href="frequency__narrow__sweeps__long_8cpp.html#a33d9b1c76c3c80902f89a58b1a6d96ea">potential_resonance_narrow_sweep</a>();</div>
<div class="line"><a id="l00146" name="l00146"></a><span class="lineno"> 146</span> </div>
<div class="line"><a id="l00147" name="l00147"></a><span class="lineno"> 147</span> <a class="code hl_function" href="frequency__narrow__sweeps__long_8cpp.html#ac1816f70ec612edc27848ef7f0875fdb">potential_resonance_narrow_sweep_interaction</a>();</div>
<div class="line"><a id="l00148" name="l00148"></a><span class="lineno"> 148</span> </div>
<div class="line"><a id="l00149" name="l00149"></a><span class="lineno"> 149</span> end = omp_get_wtime();</div>
<div class="line"><a id="l00150" name="l00150"></a><span class="lineno"> 150</span> </div>
<div class="line"><a id="l00151" name="l00151"></a><span class="lineno"> 151</span> std::cout &lt;&lt; <span class="stringliteral">&quot;Time: &quot;</span> &lt;&lt; end - start &lt;&lt; <span class="stringliteral">&quot; seconds&quot;</span> &lt;&lt; std::endl;</div>
<div class="line"><a id="l00152" name="l00152"></a><span class="lineno"> 152</span> </div>
<div class="line"><a id="l00153" name="l00153"></a><span class="lineno"> 153</span> <span class="keywordflow">return</span> 0;</div>
<div class="line"><a id="l00154" name="l00154"></a><span class="lineno"> 154</span>}</div>
<div class="ttc" id="aPenningTrap_8hpp_html"><div class="ttname"><a href="PenningTrap_8hpp.html">PenningTrap.hpp</a></div><div class="ttdoc">A class for simulating a Penning trap.</div></div>
<div class="ttc" id="aclassPenningTrap_html"><div class="ttname"><a href="classPenningTrap.html">PenningTrap</a></div><div class="ttdoc">A class that simulates a Penning trap.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8hpp_source.html#l00031">PenningTrap.hpp:32</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_aaee129f177657455348d0c8ae1441dea"><div class="ttname"><a href="classPenningTrap.html#aaee129f177657455348d0c8ae1441dea">PenningTrap::reinitialize</a></div><div class="ttdeci">void reinitialize(double f, double omega_V, double t=0.)</div><div class="ttdoc">Give all particles new positions and velocities, and change t and V_0.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00153">PenningTrap.cpp:153</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_ac529aa26c288f34eae184a67e6bac41f"><div class="ttname"><a href="classPenningTrap.html#ac529aa26c288f34eae184a67e6bac41f">PenningTrap::fraction_of_particles_left</a></div><div class="ttdeci">double fraction_of_particles_left(double time, uint steps, std::string method=&quot;rk4&quot;, bool particle_interaction=true)</div><div class="ttdoc">Simulate and calculate what fraction of particles are still left inside the Penning trap after the si...</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00311">PenningTrap.cpp:311</a></div></div>
<div class="ttc" id="aconstants_8hpp_html"><div class="ttname"><a href="constants_8hpp.html">constants.hpp</a></div><div class="ttdoc">Library of constants.</div></div>
<div class="ttc" id="afrequency__narrow__sweeps__long_8cpp_html_a33d9b1c76c3c80902f89a58b1a6d96ea"><div class="ttname"><a href="frequency__narrow__sweeps__long_8cpp.html#a33d9b1c76c3c80902f89a58b1a6d96ea">potential_resonance_narrow_sweep</a></div><div class="ttdeci">void potential_resonance_narrow_sweep()</div><div class="ttdoc">Simulate 100 particles over 500 using a time dependent potential.</div><div class="ttdef"><b>Definition:</b> <a href="frequency__narrow__sweeps__long_8cpp_source.html#l00034">frequency_narrow_sweeps_long.cpp:34</a></div></div>
<div class="ttc" id="afrequency__narrow__sweeps__long_8cpp_html_ac1816f70ec612edc27848ef7f0875fdb"><div class="ttname"><a href="frequency__narrow__sweeps__long_8cpp.html#ac1816f70ec612edc27848ef7f0875fdb">potential_resonance_narrow_sweep_interaction</a></div><div class="ttdeci">void potential_resonance_narrow_sweep_interaction()</div><div class="ttdoc">Simulate 100 particles over 500 using a time dependent potential.</div><div class="ttdef"><b>Definition:</b> <a href="frequency__narrow__sweeps__long_8cpp_source.html#l00091">frequency_narrow_sweeps_long.cpp:91</a></div></div>
<div class="ttc" id="autils_8hpp_html"><div class="ttname"><a href="utils_8hpp.html">utils.hpp</a></div><div class="ttdoc">Function prototypes and macros that are useful.</div></div>
<div class="ttc" id="autils_8hpp_html_a6fdd7217b750aff5b6295ece7cbdeffa"><div class="ttname"><a href="utils_8hpp.html#a6fdd7217b750aff5b6295ece7cbdeffa">mkpath</a></div><div class="ttdeci">bool mkpath(std::string path, int mode=0777)</div><div class="ttdoc">Make path given.</div><div class="ttdef"><b>Definition:</b> <a href="utils_8cpp_source.html#l00072">utils.cpp:72</a></div></div>
</div><!-- fragment --></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li><li class="navelem"><a class="el" href="frequency__narrow__sweeps__long_8cpp.html">frequency_narrow_sweeps_long.cpp</a></li>
<li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.6 </li>
</ul>
</div>
</body>
</html>

View File

@@ -176,6 +176,7 @@ $(document).ready(function(){initNavTree('functions.html',''); initResizable();
<li>test_total_force_particles()&#160;:&#160;<a class="el" href="classPenningTrapTest.html#a68449d508e66205bc8b27fa5f60db508">PenningTrapTest</a></li>
<li>total_force()&#160;:&#160;<a class="el" href="classPenningTrap.html#a9a301b0540078c36697880ef204afdf3">PenningTrap</a></li>
<li>total_force_external()&#160;:&#160;<a class="el" href="classPenningTrap.html#a2c01108b52c8e2a003cf9170da9e7682">PenningTrap</a></li>
<li>total_force_no_interaction()&#160;:&#160;<a class="el" href="classPenningTrap.html#a6069f82d8dbc7cadaebd228dbcd95018">PenningTrap</a></li>
<li>total_force_particles()&#160;:&#160;<a class="el" href="classPenningTrap.html#a2fe1cefbae18fa5808155ee0d2df713c">PenningTrap</a></li>
</ul>

View File

@@ -119,6 +119,7 @@ $(document).ready(function(){initNavTree('functions_func.html',''); initResizabl
<li>test_total_force_particles()&#160;:&#160;<a class="el" href="classPenningTrapTest.html#a68449d508e66205bc8b27fa5f60db508">PenningTrapTest</a></li>
<li>total_force()&#160;:&#160;<a class="el" href="classPenningTrap.html#a9a301b0540078c36697880ef204afdf3">PenningTrap</a></li>
<li>total_force_external()&#160;:&#160;<a class="el" href="classPenningTrap.html#a2c01108b52c8e2a003cf9170da9e7682">PenningTrap</a></li>
<li>total_force_no_interaction()&#160;:&#160;<a class="el" href="classPenningTrap.html#a6069f82d8dbc7cadaebd228dbcd95018">PenningTrap</a></li>
<li>total_force_particles()&#160;:&#160;<a class="el" href="classPenningTrap.html#a2fe1cefbae18fa5808155ee0d2df713c">PenningTrap</a></li>
<li>v_func()&#160;:&#160;<a class="el" href="classPenningTrap.html#a3c0a44e4e0a94366ff609e81fe463fa2">PenningTrap</a></li>
<li>write_simulation_to_dir()&#160;:&#160;<a class="el" href="classPenningTrap.html#ad8bc4df7ab3eed53b16cfdff38e7760b">PenningTrap</a></li>

View File

@@ -137,8 +137,8 @@ $(document).ready(function(){initNavTree('globals.html',''); initResizable(); })
<h3><a id="index_p" name="index_p"></a>- p -</h3><ul>
<li>p1&#160;:&#160;<a class="el" href="main_8cpp.html#a2efa69bb9d93049429ce4637075f1d30">main.cpp</a></li>
<li>p2&#160;:&#160;<a class="el" href="main_8cpp.html#ac70b61df65f4336f57ea9b4c35250df7">main.cpp</a></li>
<li>potential_resonance_narrow_sweep()&#160;:&#160;<a class="el" href="main_8cpp.html#a33d9b1c76c3c80902f89a58b1a6d96ea">main.cpp</a></li>
<li>potential_resonance_narrow_sweep_interaction()&#160;:&#160;<a class="el" href="main_8cpp.html#ac1816f70ec612edc27848ef7f0875fdb">main.cpp</a></li>
<li>potential_resonance_narrow_sweep()&#160;:&#160;<a class="el" href="frequency__narrow__sweeps__long_8cpp.html#a33d9b1c76c3c80902f89a58b1a6d96ea">frequency_narrow_sweeps_long.cpp</a>, <a class="el" href="main_8cpp.html#a33d9b1c76c3c80902f89a58b1a6d96ea">main.cpp</a></li>
<li>potential_resonance_narrow_sweep_interaction()&#160;:&#160;<a class="el" href="frequency__narrow__sweeps__long_8cpp.html#ac1816f70ec612edc27848ef7f0875fdb">frequency_narrow_sweeps_long.cpp</a>, <a class="el" href="main_8cpp.html#ac1816f70ec612edc27848ef7f0875fdb">main.cpp</a></li>
<li>potential_resonance_wide_sweep()&#160;:&#160;<a class="el" href="main_8cpp.html#a6b38b477c18e2f4268779751a88edab1">main.cpp</a></li>
</ul>

View File

@@ -103,8 +103,8 @@ $(document).ready(function(){initNavTree('globals_func.html',''); initResizable(
<li>close_to()&#160;:&#160;<a class="el" href="utils_8hpp.html#ab3e0cf669bddc59bd53998490ffb68b9">utils.hpp</a>, <a class="el" href="utils_8cpp.html#a6be6f938bcbb235ebb6a2ed9d08411b2">utils.cpp</a></li>
<li>m_assert()&#160;:&#160;<a class="el" href="utils_8hpp.html#a2cc3a2cdb635bac3c8b02e89d4d6af38">utils.hpp</a>, <a class="el" href="utils_8cpp.html#aff5e07c3c1d321709b0cc38e999f427b">utils.cpp</a></li>
<li>mkpath()&#160;:&#160;<a class="el" href="utils_8hpp.html#a6fdd7217b750aff5b6295ece7cbdeffa">utils.hpp</a>, <a class="el" href="utils_8cpp.html#acf13f4e492199cb7231bfa646dbd08de">utils.cpp</a></li>
<li>potential_resonance_narrow_sweep()&#160;:&#160;<a class="el" href="main_8cpp.html#a33d9b1c76c3c80902f89a58b1a6d96ea">main.cpp</a></li>
<li>potential_resonance_narrow_sweep_interaction()&#160;:&#160;<a class="el" href="main_8cpp.html#ac1816f70ec612edc27848ef7f0875fdb">main.cpp</a></li>
<li>potential_resonance_narrow_sweep()&#160;:&#160;<a class="el" href="frequency__narrow__sweeps__long_8cpp.html#a33d9b1c76c3c80902f89a58b1a6d96ea">frequency_narrow_sweeps_long.cpp</a>, <a class="el" href="main_8cpp.html#a33d9b1c76c3c80902f89a58b1a6d96ea">main.cpp</a></li>
<li>potential_resonance_narrow_sweep_interaction()&#160;:&#160;<a class="el" href="frequency__narrow__sweeps__long_8cpp.html#ac1816f70ec612edc27848ef7f0875fdb">frequency_narrow_sweeps_long.cpp</a>, <a class="el" href="main_8cpp.html#ac1816f70ec612edc27848ef7f0875fdb">main.cpp</a></li>
<li>potential_resonance_wide_sweep()&#160;:&#160;<a class="el" href="main_8cpp.html#a6b38b477c18e2f4268779751a88edab1">main.cpp</a></li>
<li>scientific_format()&#160;:&#160;<a class="el" href="utils_8hpp.html#adfb618b2fdff47ef30a4a2b62c04f384">utils.hpp</a>, <a class="el" href="utils_8cpp.html#acd2a9c7a7d5a7fe9163be8c4cc110746">utils.cpp</a></li>
<li>simulate_100_particles()&#160;:&#160;<a class="el" href="main_8cpp.html#a213713d6ecc02a32b588ffd179dc7513">main.cpp</a></li>

View File

@@ -126,6 +126,16 @@ Operating systems</h2>
</li>
</ul>
<h2><a class="anchor" id="autotoc_md3"></a>
Tools</h2>
<ul>
<li>Profiling<ul>
<li><a href="https://ftp.gnu.org/old-gnu/Manuals/gprof-2.9.1/html_mono/gprof.html">gprof</a></li>
<li><a href="https://www.scalasca.org/">scalasca</a></li>
<li><a href="https://www.vi-hps.org/projects/score-p">score-p</a></li>
</ul>
</li>
</ul>
<h2><a class="anchor" id="autotoc_md4"></a>
Libraries</h2>
<ul>
<li>Python<ul>
@@ -139,30 +149,65 @@ Libraries</h2>
</ul>
</li>
</ul>
<h1><a class="anchor" id="autotoc_md4"></a>
<h1><a class="anchor" id="autotoc_md5"></a>
Compiling</h1>
<p>Compiling is as easy as running this command while being inside the src directory:</p>
<div class="fragment"><div class="line">make</div>
</div><!-- fragment --><h1><a class="anchor" id="autotoc_md5"></a>
</div><!-- fragment --><h1><a class="anchor" id="autotoc_md6"></a>
Running programs</h1>
<h2><a class="anchor" id="autotoc_md6"></a>
<h2><a class="anchor" id="autotoc_md7"></a>
C++ binaries</h2>
<p>To run <b>main</b> or <b>test_suite</b>, just run this command while being inside src:</p>
<div class="fragment"><div class="line">./&lt;program-name&gt;</div>
</div><!-- fragment --><h2><a class="anchor" id="autotoc_md7"></a>
</div><!-- fragment --><h2><a class="anchor" id="autotoc_md8"></a>
Python scripts</h2>
<h3><a class="anchor" id="autotoc_md8"></a>
<h3><a class="anchor" id="autotoc_md9"></a>
Install libraries</h3>
<p>Before running the scripts, make sure that all libraries are installed. Using pip, you can install all requirements like this:</p>
<div class="fragment"><div class="line">pip install -r requirements.txt</div>
</div><!-- fragment --><p>This recursively install all the packages that are listed in <b>requirements.txt</b>.</p>
<h3><a class="anchor" id="autotoc_md9"></a>
<h3><a class="anchor" id="autotoc_md10"></a>
Running scripts</h3>
<p>For the Python scripts, run them from the src directory like this:</p>
<div class="fragment"><div class="line">python scripts/&lt;script-name&gt;</div>
</div><!-- fragment --><p>If you have any problems running the scripts, you might have to run this instead:</p>
<div class="fragment"><div class="line">python3 scripts/&lt;script-name&gt;</div>
</div><!-- fragment --><h1><a class="anchor" id="autotoc_md10"></a>
</div><!-- fragment --><h2><a class="anchor" id="autotoc_md11"></a>
Batch system</h2>
<p>For the <b>frequency_narrow_sweeps_long</b> program, the is a script called <b>job.script</b> that comes along with it. This is to be able to run it on a batch system using Slurm if you have access to one. This is the recommended way to use this program as it takes approximately 90 minutes to complete when using 16 cores.</p>
<p>If you happen to have such a system available to you, then you should clone this repo on that system, then compile it by running:</p>
<div class="fragment"><div class="line">make frequency_narrow_sweeps_long</div>
</div><!-- fragment --><p>You might have to load the Armadillo library before compiling.</p>
<p>After compiling, you can schedule it by running:</p>
<div class="fragment"><div class="line">sbatch job.script</div>
</div><!-- fragment --><h1><a class="anchor" id="autotoc_md12"></a>
Performance</h1>
<p>This section aims to give an idea to the time it takes for the program to run so that you know a bit what to expect if you decide to run it for yourself.</p>
<h2><a class="anchor" id="autotoc_md13"></a>
CPU</h2>
<p>The times mentioned here are times achieved on a computer with these specifications:</p>
<ul>
<li>CPU model<ul>
<li>Intel i7-9850H</li>
</ul>
</li>
<li>Threads<ul>
<li>12</li>
</ul>
</li>
<li>Clock speed<ul>
<li>4.6GHz</li>
</ul>
</li>
</ul>
<h2><a class="anchor" id="autotoc_md14"></a>
Times</h2>
<p>All times mentioned use the <b>evolve_RK4</b> method.</p>
<p>Running a simulation with 100 particles without particle interactions over 40000 steps takes around 1.8 seconds. With particle interactions, it takes around 4.8 seconds.</p>
<p><b>potential_resonance_wide_sweep</b> takes around 56 seconds to complete.</p>
<p><b>potential_resonance_narrow_sweep</b> takes around 172 seconds to complete.</p>
<p><b>potential_resonance_narrow_sweep_interaction</b> takes around 936 seconds to complete.</p>
<h1><a class="anchor" id="autotoc_md15"></a>
Credits</h1>
<p>The Doxygen theme used here is <a href="https://github.com/jothepro/doxygen-awesome-css">doxygen-awesome-css</a>. </p>
</div></div><!-- PageDoc -->

View File

@@ -173,7 +173,7 @@ Variables</h2></td></tr>
<dd>
Janita Ovidie Sandtrøen Willumsen (janitaws)</dd></dl>
<dl class="section version"><dt>Version</dt><dd>1.0</dd></dl>
<dl class="bug"><dt><b><a class="el" href="bug.html#_bug000006">Bug:</a></b></dt><dd>No known bugs </dd></dl>
<dl class="bug"><dt><b><a class="el" href="bug.html#_bug000007">Bug:</a></b></dt><dd>No known bugs </dd></dl>
<p class="definition">Definition in file <a class="el" href="main_8cpp_source.html">main.cpp</a>.</p>
</div><h2 class="groupheader">Macro Definition Documentation</h2>
@@ -254,7 +254,7 @@ Janita Ovidie Sandtrøen Willumsen (janitaws)</dd></dl>
</table>
</div><div class="memdoc">
<p class="definition">Definition at line <a class="el" href="main_8cpp_source.html#l00309">309</a> of file <a class="el" href="main_8cpp_source.html">main.cpp</a>.</p>
<p class="definition">Definition at line <a class="el" href="main_8cpp_source.html#l00314">314</a> of file <a class="el" href="main_8cpp_source.html">main.cpp</a>.</p>
</div>
</div>
@@ -276,7 +276,7 @@ Janita Ovidie Sandtrøen Willumsen (janitaws)</dd></dl>
<p>Simulate 100 particles over 500 \( \mu s \) using a time dependent potential. </p>
<p>The simulation sweeps over different frequencies in [1., 1.7] MHz. </p>
<p class="definition">Definition at line <a class="el" href="main_8cpp_source.html#l00206">206</a> of file <a class="el" href="main_8cpp_source.html">main.cpp</a>.</p>
<p class="definition">Definition at line <a class="el" href="main_8cpp_source.html#l00209">209</a> of file <a class="el" href="main_8cpp_source.html">main.cpp</a>.</p>
</div>
</div>
@@ -298,7 +298,7 @@ Janita Ovidie Sandtrøen Willumsen (janitaws)</dd></dl>
<p>Simulate 100 particles over 500 \( \mu s \) using a time dependent potential. </p>
<p>The simulation sweeps over different frequencies in [1., 1.7] MHz. </p>
<p class="definition">Definition at line <a class="el" href="main_8cpp_source.html#l00262">262</a> of file <a class="el" href="main_8cpp_source.html">main.cpp</a>.</p>
<p class="definition">Definition at line <a class="el" href="main_8cpp_source.html#l00266">266</a> of file <a class="el" href="main_8cpp_source.html">main.cpp</a>.</p>
</div>
</div>
@@ -320,7 +320,7 @@ Janita Ovidie Sandtrøen Willumsen (janitaws)</dd></dl>
<p>Simulate 100 particles over 500 \( \mu s \) using a time dependent potential. </p>
<p>The simulation sweeps over different frequencies in [0.2, 2.5] MHz. </p>
<p class="definition">Definition at line <a class="el" href="main_8cpp_source.html#l00149">149</a> of file <a class="el" href="main_8cpp_source.html">main.cpp</a>.</p>
<p class="definition">Definition at line <a class="el" href="main_8cpp_source.html#l00152">152</a> of file <a class="el" href="main_8cpp_source.html">main.cpp</a>.</p>
</div>
</div>
@@ -341,7 +341,7 @@ Janita Ovidie Sandtrøen Willumsen (janitaws)</dd></dl>
<p>Simulate 100 particles over 50 \( \mu s \). </p>
<p class="definition">Definition at line <a class="el" href="main_8cpp_source.html#l00132">132</a> of file <a class="el" href="main_8cpp_source.html">main.cpp</a>.</p>
<p class="definition">Definition at line <a class="el" href="main_8cpp_source.html#l00134">134</a> of file <a class="el" href="main_8cpp_source.html">main.cpp</a>.</p>
</div>
</div>
@@ -362,7 +362,7 @@ Janita Ovidie Sandtrøen Willumsen (janitaws)</dd></dl>
<p>Simulate a single particle over the period of 50 \( \mu s \). </p>
<p class="definition">Definition at line <a class="el" href="main_8cpp_source.html#l00054">54</a> of file <a class="el" href="main_8cpp_source.html">main.cpp</a>.</p>
<p class="definition">Definition at line <a class="el" href="main_8cpp_source.html#l00055">55</a> of file <a class="el" href="main_8cpp_source.html">main.cpp</a>.</p>
</div>
</div>
@@ -383,7 +383,7 @@ Janita Ovidie Sandtrøen Willumsen (janitaws)</dd></dl>
<p>Simulate a single particle over 50 \( \mu s \) using different amount of steps and different methods. </p>
<p class="definition">Definition at line <a class="el" href="main_8cpp_source.html#l00087">87</a> of file <a class="el" href="main_8cpp_source.html">main.cpp</a>.</p>
<p class="definition">Definition at line <a class="el" href="main_8cpp_source.html#l00088">88</a> of file <a class="el" href="main_8cpp_source.html">main.cpp</a>.</p>
</div>
</div>
@@ -404,7 +404,7 @@ Janita Ovidie Sandtrøen Willumsen (janitaws)</dd></dl>
<p>Simulate 2 particles over the period of 50 \( \mu s \) with and without particle interactions. </p>
<p class="definition">Definition at line <a class="el" href="main_8cpp_source.html#l00069">69</a> of file <a class="el" href="main_8cpp_source.html">main.cpp</a>.</p>
<p class="definition">Definition at line <a class="el" href="main_8cpp_source.html#l00070">70</a> of file <a class="el" href="main_8cpp_source.html">main.cpp</a>.</p>
</div>
</div>

View File

@@ -128,317 +128,367 @@ $(document).ready(function(){initNavTree('main_8cpp_source.html',''); initResiza
<div class="line"><a id="l00042" name="l00042"></a><span class="lineno"> 42</span> <span class="keywordtype">double</span> w_n = (w_0 - std::sqrt(w_0 * w_0 - 2. * w_z2)) / 2.;</div>
<div class="line"><a id="l00043" name="l00043"></a><span class="lineno"> 43</span> <span class="keywordtype">double</span> A_p = (25. + w_n * 20.) / (w_n - w_p);</div>
<div class="line"><a id="l00044" name="l00044"></a><span class="lineno"> 44</span> <span class="keywordtype">double</span> A_n = -(25. + w_p * 20.) / (w_n - w_p);</div>
<div class="line"><a id="l00045" name="l00045"></a><span class="lineno"> 45</span> std::complex&lt;double&gt; f =</div>
<div class="line"><a id="l00046" name="l00046"></a><span class="lineno"> 46</span> A_p * std::exp(std::complex&lt;double&gt;(0., -w_p * t))</div>
<div class="line"><a id="l00047" name="l00047"></a><span class="lineno"> 47</span> + A_n * std::exp(std::complex&lt;double&gt;(0., -w_n * t));</div>
<div class="line"><a id="l00048" name="l00048"></a><span class="lineno"> 48</span> <a class="code hl_typedef" href="typedefs_8hpp.html#a3bdfb73a02f88ae32b6128ef747c4aea">vec3</a> res{std::real(f), std::imag(f), 20. * std::cos(std::sqrt(w_z2) * t)};</div>
<div class="line"><a id="l00049" name="l00049"></a><span class="lineno"> 49</span> <span class="keywordflow">return</span> res;</div>
<div class="line"><a id="l00050" name="l00050"></a><span class="lineno"> 50</span>}</div>
<div class="line"><a id="l00051" name="l00051"></a><span class="lineno"> 51</span> </div>
<div class="line"><a id="l00054" name="l00054"></a><span class="lineno"><a class="line" href="main_8cpp.html#a8fdbe2d5a872e50ef5ec1263243589d6"> 54</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="main_8cpp.html#a8fdbe2d5a872e50ef5ec1263243589d6">simulate_single_particle</a>()</div>
<div class="line"><a id="l00055" name="l00055"></a><span class="lineno"> 55</span>{</div>
<div class="line"><a id="l00056" name="l00056"></a><span class="lineno"> 56</span> <span class="comment">// Initialize trap with particle 1</span></div>
<div class="line"><a id="l00057" name="l00057"></a><span class="lineno"> 57</span> <a class="code hl_class" href="classPenningTrap.html">PenningTrap</a> trap(std::vector&lt;Particle&gt;{<a class="code hl_variable" href="main_8cpp.html#a2efa69bb9d93049429ce4637075f1d30">p1</a>});</div>
<div class="line"><a id="l00058" name="l00058"></a><span class="lineno"> 58</span> </div>
<div class="line"><a id="l00059" name="l00059"></a><span class="lineno"> 59</span> <span class="keywordtype">double</span> time = 50.; <span class="comment">// microseconds</span></div>
<div class="line"><a id="l00060" name="l00060"></a><span class="lineno"> 60</span> </div>
<div class="line"><a id="l00061" name="l00061"></a><span class="lineno"> 61</span> <span class="comment">// Simulate and write results to file</span></div>
<div class="line"><a id="l00062" name="l00062"></a><span class="lineno"> 62</span> trap.<a class="code hl_function" href="classPenningTrap.html#ad8bc4df7ab3eed53b16cfdff38e7760b">write_simulation_to_dir</a>(<span class="stringliteral">&quot;output/simulate_single_particle&quot;</span>, time, N,</div>
<div class="line"><a id="l00063" name="l00063"></a><span class="lineno"> 63</span> <span class="stringliteral">&quot;rk4&quot;</span>, <span class="keyword">false</span>);</div>
<div class="line"><a id="l00064" name="l00064"></a><span class="lineno"> 64</span>}</div>
<div class="line"><a id="l00065" name="l00065"></a><span class="lineno"> 65</span> </div>
<div class="line"><a id="l00069" name="l00069"></a><span class="lineno"><a class="line" href="main_8cpp.html#a783789519f97c6430081171cacb0ffb1"> 69</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="main_8cpp.html#a783789519f97c6430081171cacb0ffb1">simulate_two_particles</a>()</div>
<div class="line"><a id="l00070" name="l00070"></a><span class="lineno"> 70</span>{</div>
<div class="line"><a id="l00071" name="l00071"></a><span class="lineno"> 71</span> <span class="comment">// Initialize traps with particles</span></div>
<div class="line"><a id="l00072" name="l00072"></a><span class="lineno"> 72</span> <a class="code hl_class" href="classPenningTrap.html">PenningTrap</a> trap_no_interaction(std::vector&lt;Particle&gt;{<a class="code hl_variable" href="main_8cpp.html#a2efa69bb9d93049429ce4637075f1d30">p1</a>, <a class="code hl_variable" href="main_8cpp.html#ac70b61df65f4336f57ea9b4c35250df7">p2</a>});</div>
<div class="line"><a id="l00073" name="l00073"></a><span class="lineno"> 73</span> <a class="code hl_class" href="classPenningTrap.html">PenningTrap</a> trap_with_interaction(std::vector&lt;Particle&gt;{<a class="code hl_variable" href="main_8cpp.html#a2efa69bb9d93049429ce4637075f1d30">p1</a>, <a class="code hl_variable" href="main_8cpp.html#ac70b61df65f4336f57ea9b4c35250df7">p2</a>});</div>
<div class="line"><a id="l00074" name="l00074"></a><span class="lineno"> 74</span> </div>
<div class="line"><a id="l00075" name="l00075"></a><span class="lineno"> 75</span> <span class="keywordtype">double</span> time = 50.; <span class="comment">// microseconds</span></div>
<div class="line"><a id="l00076" name="l00076"></a><span class="lineno"> 76</span> </div>
<div class="line"><a id="l00077" name="l00077"></a><span class="lineno"> 77</span> <span class="comment">// Simulate and write results to files</span></div>
<div class="line"><a id="l00078" name="l00078"></a><span class="lineno"> 78</span> trap_no_interaction.<a class="code hl_function" href="classPenningTrap.html#ad8bc4df7ab3eed53b16cfdff38e7760b">write_simulation_to_dir</a>(</div>
<div class="line"><a id="l00079" name="l00079"></a><span class="lineno"> 79</span> <span class="stringliteral">&quot;output/simulate_2_particles/no_interaction&quot;</span>, time, N, <span class="stringliteral">&quot;rk4&quot;</span>, <span class="keyword">false</span>);</div>
<div class="line"><a id="l00080" name="l00080"></a><span class="lineno"> 80</span> trap_with_interaction.write_simulation_to_dir(</div>
<div class="line"><a id="l00081" name="l00081"></a><span class="lineno"> 81</span> <span class="stringliteral">&quot;output/simulate_2_particles/with_interaction&quot;</span>, time, N);</div>
<div class="line"><a id="l00082" name="l00082"></a><span class="lineno"> 82</span>}</div>
<div class="line"><a id="l00083" name="l00083"></a><span class="lineno"> 83</span> </div>
<div class="line"><a id="l00087" name="l00087"></a><span class="lineno"><a class="line" href="main_8cpp.html#ac67e0d59227856c4d42e7d01c75e0ad2"> 87</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="main_8cpp.html#ac67e0d59227856c4d42e7d01c75e0ad2">simulate_single_particle_with_different_steps</a>()</div>
<div class="line"><a id="l00088" name="l00088"></a><span class="lineno"> 88</span>{</div>
<div class="line"><a id="l00089" name="l00089"></a><span class="lineno"> 89</span> <span class="keywordtype">double</span> time = 50.; <span class="comment">// microseconds</span></div>
<div class="line"><a id="l00090" name="l00090"></a><span class="lineno"> 90</span> </div>
<div class="line"><a id="l00091" name="l00091"></a><span class="lineno"> 91</span> std::ofstream ofile;</div>
<div class="line"><a id="l00092" name="l00092"></a><span class="lineno"> 92</span> </div>
<div class="line"><a id="l00093" name="l00093"></a><span class="lineno"> 93</span> <span class="comment">// Calculate relative error for RK4</span></div>
<div class="line"><a id="l00094" name="l00094"></a><span class="lineno"> 94</span> std::string path = <span class="stringliteral">&quot;output/relative_error/RK4/&quot;</span>;</div>
<div class="line"><a id="l00095" name="l00095"></a><span class="lineno"> 95</span> <a class="code hl_function" href="utils_8hpp.html#a6fdd7217b750aff5b6295ece7cbdeffa">mkpath</a>(path);</div>
<div class="line"><a id="l00096" name="l00096"></a><span class="lineno"> 96</span><span class="preprocessor">#pragma omp parallel for</span></div>
<div class="line"><a id="l00097" name="l00097"></a><span class="lineno"> 97</span> <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; 4; i++) {</div>
<div class="line"><a id="l00098" name="l00098"></a><span class="lineno"> 98</span> <span class="keywordtype">int</span> steps = 4000 * std::pow(2, i);</div>
<div class="line"><a id="l00099" name="l00099"></a><span class="lineno"> 99</span> <span class="keywordtype">double</span> dt = time / (double)steps;</div>
<div class="line"><a id="l00100" name="l00100"></a><span class="lineno"> 100</span> ofile.open(path + std::to_string(steps) + <span class="stringliteral">&quot;_steps.txt&quot;</span>);</div>
<div class="line"><a id="l00101" name="l00101"></a><span class="lineno"> 101</span> <a class="code hl_class" href="classPenningTrap.html">PenningTrap</a> trap(std::vector&lt;Particle&gt;{<a class="code hl_variable" href="main_8cpp.html#a2efa69bb9d93049429ce4637075f1d30">p1</a>});</div>
<div class="line"><a id="l00102" name="l00102"></a><span class="lineno"> 102</span> <a class="code hl_struct" href="structsimulation.html">simulation_t</a> res = trap.simulate(time, steps, <span class="stringliteral">&quot;rk4&quot;</span>, <span class="keyword">false</span>);</div>
<div class="line"><a id="l00103" name="l00103"></a><span class="lineno"> 103</span> <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; steps; i++) {</div>
<div class="line"><a id="l00104" name="l00104"></a><span class="lineno"> 104</span> ofile &lt;&lt; arma::norm(res.r_vecs[0][i]</div>
<div class="line"><a id="l00105" name="l00105"></a><span class="lineno"> 105</span> - <a class="code hl_function" href="main_8cpp.html#a8d92fb2ad085065fbd14718647551657">analytical_solution_particle_1</a>(dt * i))</div>
<div class="line"><a id="l00106" name="l00106"></a><span class="lineno"> 106</span> &lt;&lt; <span class="charliteral">&#39;\n&#39;</span>;</div>
<div class="line"><a id="l00107" name="l00107"></a><span class="lineno"> 107</span> }</div>
<div class="line"><a id="l00108" name="l00108"></a><span class="lineno"> 108</span> ofile.close();</div>
<div class="line"><a id="l00045" name="l00045"></a><span class="lineno"> 45</span> std::cout &lt;&lt; A_p &lt;&lt; <span class="stringliteral">&quot;,&quot;</span> &lt;&lt; A_n &lt;&lt; std::endl;</div>
<div class="line"><a id="l00046" name="l00046"></a><span class="lineno"> 46</span> std::complex&lt;double&gt; f =</div>
<div class="line"><a id="l00047" name="l00047"></a><span class="lineno"> 47</span> A_p * std::exp(std::complex&lt;double&gt;(0., -w_p * t))</div>
<div class="line"><a id="l00048" name="l00048"></a><span class="lineno"> 48</span> + A_n * std::exp(std::complex&lt;double&gt;(0., -w_n * t));</div>
<div class="line"><a id="l00049" name="l00049"></a><span class="lineno"> 49</span> <a class="code hl_typedef" href="typedefs_8hpp.html#a3bdfb73a02f88ae32b6128ef747c4aea">vec3</a> res{std::real(f), std::imag(f), 20. * std::cos(std::sqrt(w_z2) * t)};</div>
<div class="line"><a id="l00050" name="l00050"></a><span class="lineno"> 50</span> <span class="keywordflow">return</span> res;</div>
<div class="line"><a id="l00051" name="l00051"></a><span class="lineno"> 51</span>}</div>
<div class="line"><a id="l00052" name="l00052"></a><span class="lineno"> 52</span> </div>
<div class="line"><a id="l00055" name="l00055"></a><span class="lineno"><a class="line" href="main_8cpp.html#a8fdbe2d5a872e50ef5ec1263243589d6"> 55</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="main_8cpp.html#a8fdbe2d5a872e50ef5ec1263243589d6">simulate_single_particle</a>()</div>
<div class="line"><a id="l00056" name="l00056"></a><span class="lineno"> 56</span>{</div>
<div class="line"><a id="l00057" name="l00057"></a><span class="lineno"> 57</span> <span class="comment">// Initialize trap with particle 1</span></div>
<div class="line"><a id="l00058" name="l00058"></a><span class="lineno"> 58</span> <a class="code hl_class" href="classPenningTrap.html">PenningTrap</a> trap(std::vector&lt;Particle&gt;{<a class="code hl_variable" href="main_8cpp.html#a2efa69bb9d93049429ce4637075f1d30">p1</a>});</div>
<div class="line"><a id="l00059" name="l00059"></a><span class="lineno"> 59</span> </div>
<div class="line"><a id="l00060" name="l00060"></a><span class="lineno"> 60</span> <span class="keywordtype">double</span> time = 50.; <span class="comment">// microseconds</span></div>
<div class="line"><a id="l00061" name="l00061"></a><span class="lineno"> 61</span> </div>
<div class="line"><a id="l00062" name="l00062"></a><span class="lineno"> 62</span> <span class="comment">// Simulate and write results to file</span></div>
<div class="line"><a id="l00063" name="l00063"></a><span class="lineno"> 63</span> trap.<a class="code hl_function" href="classPenningTrap.html#ad8bc4df7ab3eed53b16cfdff38e7760b">write_simulation_to_dir</a>(<span class="stringliteral">&quot;output/simulate_single_particle&quot;</span>, time, N,</div>
<div class="line"><a id="l00064" name="l00064"></a><span class="lineno"> 64</span> <span class="stringliteral">&quot;rk4&quot;</span>, <span class="keyword">false</span>);</div>
<div class="line"><a id="l00065" name="l00065"></a><span class="lineno"> 65</span>}</div>
<div class="line"><a id="l00066" name="l00066"></a><span class="lineno"> 66</span> </div>
<div class="line"><a id="l00070" name="l00070"></a><span class="lineno"><a class="line" href="main_8cpp.html#a783789519f97c6430081171cacb0ffb1"> 70</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="main_8cpp.html#a783789519f97c6430081171cacb0ffb1">simulate_two_particles</a>()</div>
<div class="line"><a id="l00071" name="l00071"></a><span class="lineno"> 71</span>{</div>
<div class="line"><a id="l00072" name="l00072"></a><span class="lineno"> 72</span> <span class="comment">// Initialize traps with particles</span></div>
<div class="line"><a id="l00073" name="l00073"></a><span class="lineno"> 73</span> <a class="code hl_class" href="classPenningTrap.html">PenningTrap</a> trap_no_interaction(std::vector&lt;Particle&gt;{<a class="code hl_variable" href="main_8cpp.html#a2efa69bb9d93049429ce4637075f1d30">p1</a>, <a class="code hl_variable" href="main_8cpp.html#ac70b61df65f4336f57ea9b4c35250df7">p2</a>});</div>
<div class="line"><a id="l00074" name="l00074"></a><span class="lineno"> 74</span> <a class="code hl_class" href="classPenningTrap.html">PenningTrap</a> trap_with_interaction(std::vector&lt;Particle&gt;{<a class="code hl_variable" href="main_8cpp.html#a2efa69bb9d93049429ce4637075f1d30">p1</a>, <a class="code hl_variable" href="main_8cpp.html#ac70b61df65f4336f57ea9b4c35250df7">p2</a>});</div>
<div class="line"><a id="l00075" name="l00075"></a><span class="lineno"> 75</span> </div>
<div class="line"><a id="l00076" name="l00076"></a><span class="lineno"> 76</span> <span class="keywordtype">double</span> time = 50.; <span class="comment">// microseconds</span></div>
<div class="line"><a id="l00077" name="l00077"></a><span class="lineno"> 77</span> </div>
<div class="line"><a id="l00078" name="l00078"></a><span class="lineno"> 78</span> <span class="comment">// Simulate and write results to files</span></div>
<div class="line"><a id="l00079" name="l00079"></a><span class="lineno"> 79</span> trap_no_interaction.<a class="code hl_function" href="classPenningTrap.html#ad8bc4df7ab3eed53b16cfdff38e7760b">write_simulation_to_dir</a>(</div>
<div class="line"><a id="l00080" name="l00080"></a><span class="lineno"> 80</span> <span class="stringliteral">&quot;output/simulate_2_particles/no_interaction&quot;</span>, time, N, <span class="stringliteral">&quot;rk4&quot;</span>, <span class="keyword">false</span>);</div>
<div class="line"><a id="l00081" name="l00081"></a><span class="lineno"> 81</span> trap_with_interaction.write_simulation_to_dir(</div>
<div class="line"><a id="l00082" name="l00082"></a><span class="lineno"> 82</span> <span class="stringliteral">&quot;output/simulate_2_particles/with_interaction&quot;</span>, time, N);</div>
<div class="line"><a id="l00083" name="l00083"></a><span class="lineno"> 83</span>}</div>
<div class="line"><a id="l00084" name="l00084"></a><span class="lineno"> 84</span> </div>
<div class="line"><a id="l00088" name="l00088"></a><span class="lineno"><a class="line" href="main_8cpp.html#ac67e0d59227856c4d42e7d01c75e0ad2"> 88</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="main_8cpp.html#ac67e0d59227856c4d42e7d01c75e0ad2">simulate_single_particle_with_different_steps</a>()</div>
<div class="line"><a id="l00089" name="l00089"></a><span class="lineno"> 89</span>{</div>
<div class="line"><a id="l00090" name="l00090"></a><span class="lineno"> 90</span> <span class="keywordtype">double</span> time = 50.; <span class="comment">// microseconds</span></div>
<div class="line"><a id="l00091" name="l00091"></a><span class="lineno"> 91</span> </div>
<div class="line"><a id="l00092" name="l00092"></a><span class="lineno"> 92</span> std::ofstream ofile;</div>
<div class="line"><a id="l00093" name="l00093"></a><span class="lineno"> 93</span> </div>
<div class="line"><a id="l00094" name="l00094"></a><span class="lineno"> 94</span> <span class="comment">// Calculate relative error for RK4</span></div>
<div class="line"><a id="l00095" name="l00095"></a><span class="lineno"> 95</span> std::string path = <span class="stringliteral">&quot;output/relative_error/RK4/&quot;</span>;</div>
<div class="line"><a id="l00096" name="l00096"></a><span class="lineno"> 96</span> <a class="code hl_function" href="utils_8hpp.html#a6fdd7217b750aff5b6295ece7cbdeffa">mkpath</a>(path);</div>
<div class="line"><a id="l00097" name="l00097"></a><span class="lineno"> 97</span><span class="preprocessor">#pragma omp parallel for private(ofile)</span></div>
<div class="line"><a id="l00098" name="l00098"></a><span class="lineno"> 98</span> <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; 4; i++) {</div>
<div class="line"><a id="l00099" name="l00099"></a><span class="lineno"> 99</span> <span class="keywordtype">int</span> steps = 4000 * std::pow(2, i);</div>
<div class="line"><a id="l00100" name="l00100"></a><span class="lineno"> 100</span> std::cout &lt;&lt; steps &lt;&lt; std::endl;</div>
<div class="line"><a id="l00101" name="l00101"></a><span class="lineno"> 101</span> <span class="keywordtype">double</span> dt = time / (double)steps;</div>
<div class="line"><a id="l00102" name="l00102"></a><span class="lineno"> 102</span> ofile.open(path + std::to_string(steps) + <span class="stringliteral">&quot;_steps.txt&quot;</span>);</div>
<div class="line"><a id="l00103" name="l00103"></a><span class="lineno"> 103</span> <a class="code hl_class" href="classPenningTrap.html">PenningTrap</a> trap(std::vector&lt;Particle&gt;{<a class="code hl_variable" href="main_8cpp.html#a2efa69bb9d93049429ce4637075f1d30">p1</a>});</div>
<div class="line"><a id="l00104" name="l00104"></a><span class="lineno"> 104</span> <a class="code hl_struct" href="structsimulation.html">simulation_t</a> res = trap.simulate(time, steps, <span class="stringliteral">&quot;rk4&quot;</span>, <span class="keyword">false</span>);</div>
<div class="line"><a id="l00105" name="l00105"></a><span class="lineno"> 105</span> <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; steps; i++) {</div>
<div class="line"><a id="l00106" name="l00106"></a><span class="lineno"> 106</span> ofile &lt;&lt; arma::norm(res.r_vecs[0][i]</div>
<div class="line"><a id="l00107" name="l00107"></a><span class="lineno"> 107</span> - <a class="code hl_function" href="main_8cpp.html#a8d92fb2ad085065fbd14718647551657">analytical_solution_particle_1</a>(dt * i))</div>
<div class="line"><a id="l00108" name="l00108"></a><span class="lineno"> 108</span> &lt;&lt; <span class="charliteral">&#39;\n&#39;</span>;</div>
<div class="line"><a id="l00109" name="l00109"></a><span class="lineno"> 109</span> }</div>
<div class="line"><a id="l00110" name="l00110"></a><span class="lineno"> 110</span> </div>
<div class="line"><a id="l00111" name="l00111"></a><span class="lineno"> 111</span> <span class="comment">// Calculate relative error for forward Euler</span></div>
<div class="line"><a id="l00112" name="l00112"></a><span class="lineno"> 112</span> path = <span class="stringliteral">&quot;output/relative_error/euler/&quot;</span>;</div>
<div class="line"><a id="l00113" name="l00113"></a><span class="lineno"> 113</span> <a class="code hl_function" href="utils_8hpp.html#a6fdd7217b750aff5b6295ece7cbdeffa">mkpath</a>(path);</div>
<div class="line"><a id="l00114" name="l00114"></a><span class="lineno"> 114</span><span class="preprocessor">#pragma omp parallel for</span></div>
<div class="line"><a id="l00115" name="l00115"></a><span class="lineno"> 115</span> <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; 4; i++) {</div>
<div class="line"><a id="l00116" name="l00116"></a><span class="lineno"> 116</span> <span class="keywordtype">int</span> steps = 4000 * std::pow(2, i);</div>
<div class="line"><a id="l00117" name="l00117"></a><span class="lineno"> 117</span> <span class="keywordtype">double</span> dt = time / (double)steps;</div>
<div class="line"><a id="l00118" name="l00118"></a><span class="lineno"> 118</span> ofile.open(path + std::to_string(steps) + <span class="stringliteral">&quot;_steps.txt&quot;</span>);</div>
<div class="line"><a id="l00119" name="l00119"></a><span class="lineno"> 119</span> <a class="code hl_class" href="classPenningTrap.html">PenningTrap</a> trap(std::vector&lt;Particle&gt;{<a class="code hl_variable" href="main_8cpp.html#a2efa69bb9d93049429ce4637075f1d30">p1</a>});</div>
<div class="line"><a id="l00120" name="l00120"></a><span class="lineno"> 120</span> <a class="code hl_struct" href="structsimulation.html">simulation_t</a> res = trap.simulate(time, steps, <span class="stringliteral">&quot;euler&quot;</span>, <span class="keyword">false</span>);</div>
<div class="line"><a id="l00121" name="l00121"></a><span class="lineno"> 121</span> <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; steps; i++) {</div>
<div class="line"><a id="l00122" name="l00122"></a><span class="lineno"> 122</span> ofile &lt;&lt; arma::norm(res.r_vecs[0][i]</div>
<div class="line"><a id="l00123" name="l00123"></a><span class="lineno"> 123</span> - <a class="code hl_function" href="main_8cpp.html#a8d92fb2ad085065fbd14718647551657">analytical_solution_particle_1</a>(dt * i))</div>
<div class="line"><a id="l00124" name="l00124"></a><span class="lineno"> 124</span> &lt;&lt; <span class="charliteral">&#39;\n&#39;</span>;</div>
<div class="line"><a id="l00125" name="l00125"></a><span class="lineno"> 125</span> }</div>
<div class="line"><a id="l00126" name="l00126"></a><span class="lineno"> 126</span> ofile.close();</div>
<div class="line"><a id="l00110" name="l00110"></a><span class="lineno"> 110</span> ofile.close();</div>
<div class="line"><a id="l00111" name="l00111"></a><span class="lineno"> 111</span> }</div>
<div class="line"><a id="l00112" name="l00112"></a><span class="lineno"> 112</span> </div>
<div class="line"><a id="l00113" name="l00113"></a><span class="lineno"> 113</span> <span class="comment">// Calculate relative error for forward Euler</span></div>
<div class="line"><a id="l00114" name="l00114"></a><span class="lineno"> 114</span> path = <span class="stringliteral">&quot;output/relative_error/euler/&quot;</span>;</div>
<div class="line"><a id="l00115" name="l00115"></a><span class="lineno"> 115</span> <a class="code hl_function" href="utils_8hpp.html#a6fdd7217b750aff5b6295ece7cbdeffa">mkpath</a>(path);</div>
<div class="line"><a id="l00116" name="l00116"></a><span class="lineno"> 116</span><span class="preprocessor">#pragma omp parallel for private(ofile)</span></div>
<div class="line"><a id="l00117" name="l00117"></a><span class="lineno"> 117</span> <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; 4; i++) {</div>
<div class="line"><a id="l00118" name="l00118"></a><span class="lineno"> 118</span> <span class="keywordtype">int</span> steps = 4000 * std::pow(2, i);</div>
<div class="line"><a id="l00119" name="l00119"></a><span class="lineno"> 119</span> <span class="keywordtype">double</span> dt = time / (double)steps;</div>
<div class="line"><a id="l00120" name="l00120"></a><span class="lineno"> 120</span> ofile.open(path + std::to_string(steps) + <span class="stringliteral">&quot;_steps.txt&quot;</span>);</div>
<div class="line"><a id="l00121" name="l00121"></a><span class="lineno"> 121</span> <a class="code hl_class" href="classPenningTrap.html">PenningTrap</a> trap(std::vector&lt;Particle&gt;{<a class="code hl_variable" href="main_8cpp.html#a2efa69bb9d93049429ce4637075f1d30">p1</a>});</div>
<div class="line"><a id="l00122" name="l00122"></a><span class="lineno"> 122</span> <a class="code hl_struct" href="structsimulation.html">simulation_t</a> res = trap.simulate(time, steps, <span class="stringliteral">&quot;euler&quot;</span>, <span class="keyword">false</span>);</div>
<div class="line"><a id="l00123" name="l00123"></a><span class="lineno"> 123</span> <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; steps; i++) {</div>
<div class="line"><a id="l00124" name="l00124"></a><span class="lineno"> 124</span> ofile &lt;&lt; arma::norm(res.r_vecs[0][i]</div>
<div class="line"><a id="l00125" name="l00125"></a><span class="lineno"> 125</span> - <a class="code hl_function" href="main_8cpp.html#a8d92fb2ad085065fbd14718647551657">analytical_solution_particle_1</a>(dt * i))</div>
<div class="line"><a id="l00126" name="l00126"></a><span class="lineno"> 126</span> &lt;&lt; <span class="charliteral">&#39;\n&#39;</span>;</div>
<div class="line"><a id="l00127" name="l00127"></a><span class="lineno"> 127</span> }</div>
<div class="line"><a id="l00128" name="l00128"></a><span class="lineno"> 128</span>}</div>
<div class="line"><a id="l00129" name="l00129"></a><span class="lineno"> 129</span> </div>
<div class="line"><a id="l00132" name="l00132"></a><span class="lineno"><a class="line" href="main_8cpp.html#a213713d6ecc02a32b588ffd179dc7513"> 132</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="main_8cpp.html#a213713d6ecc02a32b588ffd179dc7513">simulate_100_particles</a>()</div>
<div class="line"><a id="l00133" name="l00133"></a><span class="lineno"> 133</span>{</div>
<div class="line"><a id="l00134" name="l00134"></a><span class="lineno"> 134</span> <a class="code hl_class" href="classPenningTrap.html">PenningTrap</a> trap((<span class="keywordtype">unsigned</span>)100);</div>
<div class="line"><a id="l00135" name="l00135"></a><span class="lineno"> 135</span> </div>
<div class="line"><a id="l00136" name="l00136"></a><span class="lineno"> 136</span> <span class="keywordtype">double</span> time = 50.; <span class="comment">// microseconds</span></div>
<div class="line"><a id="l00128" name="l00128"></a><span class="lineno"> 128</span> ofile.close();</div>
<div class="line"><a id="l00129" name="l00129"></a><span class="lineno"> 129</span> }</div>
<div class="line"><a id="l00130" name="l00130"></a><span class="lineno"> 130</span>}</div>
<div class="line"><a id="l00131" name="l00131"></a><span class="lineno"> 131</span> </div>
<div class="line"><a id="l00134" name="l00134"></a><span class="lineno"><a class="line" href="main_8cpp.html#a213713d6ecc02a32b588ffd179dc7513"> 134</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="main_8cpp.html#a213713d6ecc02a32b588ffd179dc7513">simulate_100_particles</a>()</div>
<div class="line"><a id="l00135" name="l00135"></a><span class="lineno"> 135</span>{</div>
<div class="line"><a id="l00136" name="l00136"></a><span class="lineno"> 136</span> <a class="code hl_class" href="classPenningTrap.html">PenningTrap</a> trap((<span class="keywordtype">unsigned</span>)100);</div>
<div class="line"><a id="l00137" name="l00137"></a><span class="lineno"> 137</span> </div>
<div class="line"><a id="l00138" name="l00138"></a><span class="lineno"> 138</span> trap.<a class="code hl_function" href="classPenningTrap.html#ad8bc4df7ab3eed53b16cfdff38e7760b">write_simulation_to_dir</a>(<span class="stringliteral">&quot;output/simulate_100_particles&quot;</span>, time, N,</div>
<div class="line"><a id="l00139" name="l00139"></a><span class="lineno"> 139</span> <span class="stringliteral">&quot;rk4&quot;</span>, <span class="keyword">false</span>);</div>
<div class="line"><a id="l00140" name="l00140"></a><span class="lineno"> 140</span>}</div>
<div class="line"><a id="l00141" name="l00141"></a><span class="lineno"> 141</span> </div>
<div class="line"><a id="l00149" name="l00149"></a><span class="lineno"><a class="line" href="main_8cpp.html#a6b38b477c18e2f4268779751a88edab1"> 149</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="main_8cpp.html#a6b38b477c18e2f4268779751a88edab1">potential_resonance_wide_sweep</a>()</div>
<div class="line"><a id="l00150" name="l00150"></a><span class="lineno"> 150</span>{</div>
<div class="line"><a id="l00151" name="l00151"></a><span class="lineno"> 151</span> <span class="keywordtype">double</span> time = 500.;</div>
<div class="line"><a id="l00152" name="l00152"></a><span class="lineno"> 152</span> </div>
<div class="line"><a id="l00153" name="l00153"></a><span class="lineno"> 153</span> <span class="keywordtype">double</span> amplitudes[]{.1, .4, .7};</div>
<div class="line"><a id="l00154" name="l00154"></a><span class="lineno"> 154</span> </div>
<div class="line"><a id="l00155" name="l00155"></a><span class="lineno"> 155</span> <span class="keywordtype">double</span> freq_start = .2;</div>
<div class="line"><a id="l00156" name="l00156"></a><span class="lineno"> 156</span> <span class="keywordtype">double</span> freq_end = 2.5;</div>
<div class="line"><a id="l00157" name="l00157"></a><span class="lineno"> 157</span> <span class="keywordtype">double</span> freq_increment = .02;</div>
<div class="line"><a id="l00158" name="l00158"></a><span class="lineno"> 158</span> <span class="keywordtype">size_t</span> freq_iterations =</div>
<div class="line"><a id="l00159" name="l00159"></a><span class="lineno"> 159</span> (size_t)((freq_end - freq_start) / freq_increment) + 1;</div>
<div class="line"><a id="l00160" name="l00160"></a><span class="lineno"> 160</span> </div>
<div class="line"><a id="l00161" name="l00161"></a><span class="lineno"> 161</span> <span class="keywordtype">double</span> res[4][freq_iterations];</div>
<div class="line"><a id="l00162" name="l00162"></a><span class="lineno"> 162</span> </div>
<div class="line"><a id="l00163" name="l00163"></a><span class="lineno"> 163</span> std::string path = <span class="stringliteral">&quot;output/time_dependent_potential/&quot;</span>;</div>
<div class="line"><a id="l00164" name="l00164"></a><span class="lineno"> 164</span> <a class="code hl_function" href="utils_8hpp.html#a6fdd7217b750aff5b6295ece7cbdeffa">mkpath</a>(path);</div>
<div class="line"><a id="l00138" name="l00138"></a><span class="lineno"> 138</span> <span class="keywordtype">double</span> time = 50.; <span class="comment">// microseconds</span></div>
<div class="line"><a id="l00139" name="l00139"></a><span class="lineno"> 139</span> </div>
<div class="line"><a id="l00140" name="l00140"></a><span class="lineno"> 140</span> <span class="comment">// trap.write_simulation_to_dir(&quot;output/simulate_100_particles&quot;, time, N,</span></div>
<div class="line"><a id="l00141" name="l00141"></a><span class="lineno"> 141</span> <span class="comment">//&quot;rk4&quot;, false);</span></div>
<div class="line"><a id="l00142" name="l00142"></a><span class="lineno"> 142</span> trap.<a class="code hl_function" href="classPenningTrap.html#a7a1d9f0528a12308de25bc30718da20a">simulate</a>(time, N, <span class="stringliteral">&quot;rk4&quot;</span>, <span class="keyword">true</span>);</div>
<div class="line"><a id="l00143" name="l00143"></a><span class="lineno"> 143</span>}</div>
<div class="line"><a id="l00144" name="l00144"></a><span class="lineno"> 144</span> </div>
<div class="line"><a id="l00152" name="l00152"></a><span class="lineno"><a class="line" href="main_8cpp.html#a6b38b477c18e2f4268779751a88edab1"> 152</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="main_8cpp.html#a6b38b477c18e2f4268779751a88edab1">potential_resonance_wide_sweep</a>()</div>
<div class="line"><a id="l00153" name="l00153"></a><span class="lineno"> 153</span>{</div>
<div class="line"><a id="l00154" name="l00154"></a><span class="lineno"> 154</span> <span class="keywordtype">double</span> time = 500.;</div>
<div class="line"><a id="l00155" name="l00155"></a><span class="lineno"> 155</span> </div>
<div class="line"><a id="l00156" name="l00156"></a><span class="lineno"> 156</span> <span class="keywordtype">double</span> amplitudes[]{.1, .4, .7};</div>
<div class="line"><a id="l00157" name="l00157"></a><span class="lineno"> 157</span> </div>
<div class="line"><a id="l00158" name="l00158"></a><span class="lineno"> 158</span> <span class="keywordtype">double</span> freq_start = .2;</div>
<div class="line"><a id="l00159" name="l00159"></a><span class="lineno"> 159</span> <span class="keywordtype">double</span> freq_end = 2.5;</div>
<div class="line"><a id="l00160" name="l00160"></a><span class="lineno"> 160</span> <span class="keywordtype">double</span> freq_increment = .02;</div>
<div class="line"><a id="l00161" name="l00161"></a><span class="lineno"> 161</span> <span class="keywordtype">size_t</span> freq_iterations =</div>
<div class="line"><a id="l00162" name="l00162"></a><span class="lineno"> 162</span> (size_t)((freq_end - freq_start) / freq_increment) + 1;</div>
<div class="line"><a id="l00163" name="l00163"></a><span class="lineno"> 163</span> </div>
<div class="line"><a id="l00164" name="l00164"></a><span class="lineno"> 164</span> <span class="keywordtype">double</span> res[4][freq_iterations];</div>
<div class="line"><a id="l00165" name="l00165"></a><span class="lineno"> 165</span> </div>
<div class="line"><a id="l00166" name="l00166"></a><span class="lineno"> 166</span> std::ofstream ofile;</div>
<div class="line"><a id="l00167" name="l00167"></a><span class="lineno"> 167</span> </div>
<div class="line"><a id="l00168" name="l00168"></a><span class="lineno"> 168</span><span class="preprocessor">#pragma omp parallel for</span></div>
<div class="line"><a id="l00169" name="l00169"></a><span class="lineno"> 169</span> <span class="comment">// Insert frequencies</span></div>
<div class="line"><a id="l00170" name="l00170"></a><span class="lineno"> 170</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i = 0; i &lt; freq_iterations; i++) {</div>
<div class="line"><a id="l00171" name="l00171"></a><span class="lineno"> 171</span> res[0][i] = freq_start + freq_increment * i;</div>
<div class="line"><a id="l00172" name="l00172"></a><span class="lineno"> 172</span> }</div>
<div class="line"><a id="l00173" name="l00173"></a><span class="lineno"> 173</span> </div>
<div class="line"><a id="l00174" name="l00174"></a><span class="lineno"> 174</span><span class="preprocessor">#pragma omp parallel</span></div>
<div class="line"><a id="l00175" name="l00175"></a><span class="lineno"> 175</span> {</div>
<div class="line"><a id="l00176" name="l00176"></a><span class="lineno"> 176</span> <span class="comment">// Each thread creates a PenningTrap instance and reuses it throughout</span></div>
<div class="line"><a id="l00177" name="l00177"></a><span class="lineno"> 177</span> <span class="comment">// the sweep.</span></div>
<div class="line"><a id="l00178" name="l00178"></a><span class="lineno"> 178</span> <a class="code hl_class" href="classPenningTrap.html">PenningTrap</a> trap((uint)100);</div>
<div class="line"><a id="l00179" name="l00179"></a><span class="lineno"> 179</span><span class="preprocessor">#pragma omp for collapse(2)</span></div>
<div class="line"><a id="l00180" name="l00180"></a><span class="lineno"> 180</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i = 0; i &lt; 3; i++) {</div>
<div class="line"><a id="l00181" name="l00181"></a><span class="lineno"> 181</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> j = 0; j &lt; freq_iterations; j++) {</div>
<div class="line"><a id="l00182" name="l00182"></a><span class="lineno"> 182</span> <span class="comment">// Reset particles and give new time dependent potential.</span></div>
<div class="line"><a id="l00183" name="l00183"></a><span class="lineno"> 183</span> trap.<a class="code hl_function" href="classPenningTrap.html#aaee129f177657455348d0c8ae1441dea">reinitialize</a>(amplitudes[i], res[0][j]);</div>
<div class="line"><a id="l00184" name="l00184"></a><span class="lineno"> 184</span> res[i + 1][j] =</div>
<div class="line"><a id="l00185" name="l00185"></a><span class="lineno"> 185</span> trap.<a class="code hl_function" href="classPenningTrap.html#ac529aa26c288f34eae184a67e6bac41f">fraction_of_particles_left</a>(time, N, <span class="stringliteral">&quot;rk4&quot;</span>, <span class="keyword">false</span>);</div>
<div class="line"><a id="l00186" name="l00186"></a><span class="lineno"> 186</span> }</div>
<div class="line"><a id="l00187" name="l00187"></a><span class="lineno"> 187</span> }</div>
<div class="line"><a id="l00188" name="l00188"></a><span class="lineno"> 188</span> }</div>
<div class="line"><a id="l00189" name="l00189"></a><span class="lineno"> 189</span> </div>
<div class="line"><a id="l00190" name="l00190"></a><span class="lineno"> 190</span> <span class="comment">// Write results to file</span></div>
<div class="line"><a id="l00191" name="l00191"></a><span class="lineno"> 191</span> ofile.open(path + <span class="stringliteral">&quot;wide_sweep.txt&quot;</span>);</div>
<div class="line"><a id="l00192" name="l00192"></a><span class="lineno"> 192</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i = 0; i &lt; freq_iterations; i++) {</div>
<div class="line"><a id="l00193" name="l00193"></a><span class="lineno"> 193</span> ofile &lt;&lt; res[0][i] &lt;&lt; <span class="charliteral">&#39;,&#39;</span> &lt;&lt; res[1][i] &lt;&lt; <span class="charliteral">&#39;,&#39;</span> &lt;&lt; res[2][i] &lt;&lt; <span class="charliteral">&#39;,&#39;</span></div>
<div class="line"><a id="l00194" name="l00194"></a><span class="lineno"> 194</span> &lt;&lt; res[3][i] &lt;&lt; <span class="charliteral">&#39;\n&#39;</span>;</div>
<div class="line"><a id="l00195" name="l00195"></a><span class="lineno"> 195</span> }</div>
<div class="line"><a id="l00196" name="l00196"></a><span class="lineno"> 196</span> ofile.close();</div>
<div class="line"><a id="l00197" name="l00197"></a><span class="lineno"> 197</span>}</div>
<div class="line"><a id="l00198" name="l00198"></a><span class="lineno"> 198</span> </div>
<div class="line"><a id="l00206" name="l00206"></a><span class="lineno"><a class="line" href="main_8cpp.html#a33d9b1c76c3c80902f89a58b1a6d96ea"> 206</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="main_8cpp.html#a33d9b1c76c3c80902f89a58b1a6d96ea">potential_resonance_narrow_sweep</a>()</div>
<div class="line"><a id="l00207" name="l00207"></a><span class="lineno"> 207</span>{</div>
<div class="line"><a id="l00208" name="l00208"></a><span class="lineno"> 208</span> <span class="keywordtype">double</span> time = 500.;</div>
<div class="line"><a id="l00209" name="l00209"></a><span class="lineno"> 209</span> </div>
<div class="line"><a id="l00210" name="l00210"></a><span class="lineno"> 210</span> <span class="keywordtype">double</span> amplitudes[]{.1, .4, .7};</div>
<div class="line"><a id="l00211" name="l00211"></a><span class="lineno"> 211</span> </div>
<div class="line"><a id="l00212" name="l00212"></a><span class="lineno"> 212</span> <span class="keywordtype">double</span> freq_start = 1.;</div>
<div class="line"><a id="l00213" name="l00213"></a><span class="lineno"> 213</span> <span class="keywordtype">double</span> freq_end = 1.7;</div>
<div class="line"><a id="l00214" name="l00214"></a><span class="lineno"> 214</span> <span class="keywordtype">double</span> freq_increment = .002;</div>
<div class="line"><a id="l00215" name="l00215"></a><span class="lineno"> 215</span> <span class="keywordtype">size_t</span> freq_iterations = (size_t)((freq_end - freq_start) / freq_increment);</div>
<div class="line"><a id="l00216" name="l00216"></a><span class="lineno"> 216</span> </div>
<div class="line"><a id="l00217" name="l00217"></a><span class="lineno"> 217</span> <span class="keywordtype">double</span> res[4][freq_iterations];</div>
<div class="line"><a id="l00218" name="l00218"></a><span class="lineno"> 218</span> </div>
<div class="line"><a id="l00219" name="l00219"></a><span class="lineno"> 219</span> std::string path = <span class="stringliteral">&quot;output/time_dependent_potential/&quot;</span>;</div>
<div class="line"><a id="l00220" name="l00220"></a><span class="lineno"> 220</span> <a class="code hl_function" href="utils_8hpp.html#a6fdd7217b750aff5b6295ece7cbdeffa">mkpath</a>(path);</div>
<div class="line"><a id="l00221" name="l00221"></a><span class="lineno"> 221</span> </div>
<div class="line"><a id="l00222" name="l00222"></a><span class="lineno"> 222</span> std::ofstream ofile;</div>
<div class="line"><a id="l00223" name="l00223"></a><span class="lineno"> 223</span> </div>
<div class="line"><a id="l00224" name="l00224"></a><span class="lineno"> 224</span><span class="preprocessor">#pragma omp parallel for</span></div>
<div class="line"><a id="l00225" name="l00225"></a><span class="lineno"> 225</span> <span class="comment">// Insert frequencies</span></div>
<div class="line"><a id="l00226" name="l00226"></a><span class="lineno"> 226</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i = 0; i &lt; freq_iterations; i++) {</div>
<div class="line"><a id="l00227" name="l00227"></a><span class="lineno"> 227</span> res[0][i] = freq_start + freq_increment * i;</div>
<div class="line"><a id="l00228" name="l00228"></a><span class="lineno"> 228</span> }</div>
<div class="line"><a id="l00229" name="l00229"></a><span class="lineno"> 229</span> </div>
<div class="line"><a id="l00230" name="l00230"></a><span class="lineno"> 230</span><span class="preprocessor">#pragma omp parallel</span></div>
<div class="line"><a id="l00231" name="l00231"></a><span class="lineno"> 231</span> {</div>
<div class="line"><a id="l00232" name="l00232"></a><span class="lineno"> 232</span> <span class="comment">// Each thread creates a PenningTrap instance and reuses it throughout</span></div>
<div class="line"><a id="l00233" name="l00233"></a><span class="lineno"> 233</span> <span class="comment">// the sweep.</span></div>
<div class="line"><a id="l00234" name="l00234"></a><span class="lineno"> 234</span> <a class="code hl_class" href="classPenningTrap.html">PenningTrap</a> trap((uint)100);</div>
<div class="line"><a id="l00235" name="l00235"></a><span class="lineno"> 235</span><span class="preprocessor">#pragma omp for collapse(2)</span></div>
<div class="line"><a id="l00236" name="l00236"></a><span class="lineno"> 236</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i = 0; i &lt; 3; i++) {</div>
<div class="line"><a id="l00237" name="l00237"></a><span class="lineno"> 237</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> j = 0; j &lt; freq_iterations; j++) {</div>
<div class="line"><a id="l00238" name="l00238"></a><span class="lineno"> 238</span> <span class="comment">// Reset particles and give new time dependent potential.</span></div>
<div class="line"><a id="l00239" name="l00239"></a><span class="lineno"> 239</span> trap.<a class="code hl_function" href="classPenningTrap.html#aaee129f177657455348d0c8ae1441dea">reinitialize</a>(amplitudes[i], res[0][j]);</div>
<div class="line"><a id="l00240" name="l00240"></a><span class="lineno"> 240</span> res[i + 1][j] =</div>
<div class="line"><a id="l00241" name="l00241"></a><span class="lineno"> 241</span> trap.<a class="code hl_function" href="classPenningTrap.html#ac529aa26c288f34eae184a67e6bac41f">fraction_of_particles_left</a>(time, N, <span class="stringliteral">&quot;rk4&quot;</span>, <span class="keyword">false</span>);</div>
<div class="line"><a id="l00242" name="l00242"></a><span class="lineno"> 242</span> }</div>
<div class="line"><a id="l00243" name="l00243"></a><span class="lineno"> 243</span> }</div>
<div class="line"><a id="l00244" name="l00244"></a><span class="lineno"> 244</span> }</div>
<div class="line"><a id="l00245" name="l00245"></a><span class="lineno"> 245</span> </div>
<div class="line"><a id="l00246" name="l00246"></a><span class="lineno"> 246</span> <span class="comment">// Write results to file</span></div>
<div class="line"><a id="l00247" name="l00247"></a><span class="lineno"> 247</span> ofile.open(path + <span class="stringliteral">&quot;narrow_sweep.txt&quot;</span>);</div>
<div class="line"><a id="l00248" name="l00248"></a><span class="lineno"> 248</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i = 0; i &lt; freq_iterations; i++) {</div>
<div class="line"><a id="l00249" name="l00249"></a><span class="lineno"> 249</span> ofile &lt;&lt; res[0][i] &lt;&lt; <span class="charliteral">&#39;,&#39;</span> &lt;&lt; res[1][i] &lt;&lt; <span class="charliteral">&#39;,&#39;</span> &lt;&lt; res[2][i] &lt;&lt; <span class="charliteral">&#39;,&#39;</span></div>
<div class="line"><a id="l00250" name="l00250"></a><span class="lineno"> 250</span> &lt;&lt; res[3][i] &lt;&lt; <span class="charliteral">&#39;\n&#39;</span>;</div>
<div class="line"><a id="l00251" name="l00251"></a><span class="lineno"> 251</span> }</div>
<div class="line"><a id="l00252" name="l00252"></a><span class="lineno"> 252</span> ofile.close();</div>
<div class="line"><a id="l00253" name="l00253"></a><span class="lineno"> 253</span>}</div>
<div class="line"><a id="l00254" name="l00254"></a><span class="lineno"> 254</span> </div>
<div class="line"><a id="l00262" name="l00262"></a><span class="lineno"><a class="line" href="main_8cpp.html#ac1816f70ec612edc27848ef7f0875fdb"> 262</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="main_8cpp.html#ac1816f70ec612edc27848ef7f0875fdb">potential_resonance_narrow_sweep_interaction</a>()</div>
<div class="line"><a id="l00263" name="l00263"></a><span class="lineno"> 263</span>{</div>
<div class="line"><a id="l00264" name="l00264"></a><span class="lineno"> 264</span> <span class="keywordtype">double</span> time = 500.;</div>
<div class="line"><a id="l00265" name="l00265"></a><span class="lineno"> 265</span> </div>
<div class="line"><a id="l00266" name="l00266"></a><span class="lineno"> 266</span> <span class="keywordtype">double</span> amplitudes[]{.1, .4, .7};</div>
<div class="line"><a id="l00267" name="l00267"></a><span class="lineno"> 267</span> </div>
<div class="line"><a id="l00268" name="l00268"></a><span class="lineno"> 268</span> <span class="keywordtype">double</span> freq_start = 1.;</div>
<div class="line"><a id="l00269" name="l00269"></a><span class="lineno"> 269</span> <span class="keywordtype">double</span> freq_end = 1.7;</div>
<div class="line"><a id="l00270" name="l00270"></a><span class="lineno"> 270</span> <span class="keywordtype">double</span> freq_increment = .002;</div>
<div class="line"><a id="l00271" name="l00271"></a><span class="lineno"> 271</span> <span class="keywordtype">size_t</span> freq_iterations = (size_t)((freq_end - freq_start) / freq_increment);</div>
<div class="line"><a id="l00272" name="l00272"></a><span class="lineno"> 272</span> </div>
<div class="line"><a id="l00273" name="l00273"></a><span class="lineno"> 273</span> <span class="keywordtype">double</span> res[4][freq_iterations];</div>
<div class="line"><a id="l00274" name="l00274"></a><span class="lineno"> 274</span> </div>
<div class="line"><a id="l00275" name="l00275"></a><span class="lineno"> 275</span> std::string path = <span class="stringliteral">&quot;output/time_dependent_potential/&quot;</span>;</div>
<div class="line"><a id="l00276" name="l00276"></a><span class="lineno"> 276</span> <a class="code hl_function" href="utils_8hpp.html#a6fdd7217b750aff5b6295ece7cbdeffa">mkpath</a>(path);</div>
<div class="line"><a id="l00166" name="l00166"></a><span class="lineno"> 166</span> std::string path = <span class="stringliteral">&quot;output/time_dependent_potential/&quot;</span>;</div>
<div class="line"><a id="l00167" name="l00167"></a><span class="lineno"> 167</span> <a class="code hl_function" href="utils_8hpp.html#a6fdd7217b750aff5b6295ece7cbdeffa">mkpath</a>(path);</div>
<div class="line"><a id="l00168" name="l00168"></a><span class="lineno"> 168</span> </div>
<div class="line"><a id="l00169" name="l00169"></a><span class="lineno"> 169</span> std::ofstream ofile;</div>
<div class="line"><a id="l00170" name="l00170"></a><span class="lineno"> 170</span> </div>
<div class="line"><a id="l00171" name="l00171"></a><span class="lineno"> 171</span><span class="preprocessor">#pragma omp parallel for</span></div>
<div class="line"><a id="l00172" name="l00172"></a><span class="lineno"> 172</span> <span class="comment">// Insert frequencies</span></div>
<div class="line"><a id="l00173" name="l00173"></a><span class="lineno"> 173</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i = 0; i &lt; freq_iterations; i++) {</div>
<div class="line"><a id="l00174" name="l00174"></a><span class="lineno"> 174</span> res[0][i] = freq_start + freq_increment * i;</div>
<div class="line"><a id="l00175" name="l00175"></a><span class="lineno"> 175</span> }</div>
<div class="line"><a id="l00176" name="l00176"></a><span class="lineno"> 176</span> </div>
<div class="line"><a id="l00177" name="l00177"></a><span class="lineno"> 177</span><span class="preprocessor">#pragma omp parallel</span></div>
<div class="line"><a id="l00178" name="l00178"></a><span class="lineno"> 178</span> {</div>
<div class="line"><a id="l00179" name="l00179"></a><span class="lineno"> 179</span> <span class="comment">// Each thread creates a PenningTrap instance and reuses it throughout</span></div>
<div class="line"><a id="l00180" name="l00180"></a><span class="lineno"> 180</span> <span class="comment">// the sweep.</span></div>
<div class="line"><a id="l00181" name="l00181"></a><span class="lineno"> 181</span> <a class="code hl_class" href="classPenningTrap.html">PenningTrap</a> trap((uint)100);</div>
<div class="line"><a id="l00182" name="l00182"></a><span class="lineno"> 182</span><span class="preprocessor">#pragma omp for collapse(2)</span></div>
<div class="line"><a id="l00183" name="l00183"></a><span class="lineno"> 183</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i = 0; i &lt; 3; i++) {</div>
<div class="line"><a id="l00184" name="l00184"></a><span class="lineno"> 184</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> j = 0; j &lt; freq_iterations; j++) {</div>
<div class="line"><a id="l00185" name="l00185"></a><span class="lineno"> 185</span> <span class="comment">// Reset particles and give new time dependent potential.</span></div>
<div class="line"><a id="l00186" name="l00186"></a><span class="lineno"> 186</span> trap.<a class="code hl_function" href="classPenningTrap.html#aaee129f177657455348d0c8ae1441dea">reinitialize</a>(amplitudes[i], res[0][j]);</div>
<div class="line"><a id="l00187" name="l00187"></a><span class="lineno"> 187</span> res[i + 1][j] =</div>
<div class="line"><a id="l00188" name="l00188"></a><span class="lineno"> 188</span> trap.<a class="code hl_function" href="classPenningTrap.html#ac529aa26c288f34eae184a67e6bac41f">fraction_of_particles_left</a>(time, N, <span class="stringliteral">&quot;rk4&quot;</span>, <span class="keyword">false</span>);</div>
<div class="line"><a id="l00189" name="l00189"></a><span class="lineno"> 189</span> }</div>
<div class="line"><a id="l00190" name="l00190"></a><span class="lineno"> 190</span> }</div>
<div class="line"><a id="l00191" name="l00191"></a><span class="lineno"> 191</span> }</div>
<div class="line"><a id="l00192" name="l00192"></a><span class="lineno"> 192</span> </div>
<div class="line"><a id="l00193" name="l00193"></a><span class="lineno"> 193</span> <span class="comment">// Write results to file</span></div>
<div class="line"><a id="l00194" name="l00194"></a><span class="lineno"> 194</span> ofile.open(path + <span class="stringliteral">&quot;wide_sweep.txt&quot;</span>);</div>
<div class="line"><a id="l00195" name="l00195"></a><span class="lineno"> 195</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i = 0; i &lt; freq_iterations; i++) {</div>
<div class="line"><a id="l00196" name="l00196"></a><span class="lineno"> 196</span> ofile &lt;&lt; res[0][i] &lt;&lt; <span class="charliteral">&#39;,&#39;</span> &lt;&lt; res[1][i] &lt;&lt; <span class="charliteral">&#39;,&#39;</span> &lt;&lt; res[2][i] &lt;&lt; <span class="charliteral">&#39;,&#39;</span></div>
<div class="line"><a id="l00197" name="l00197"></a><span class="lineno"> 197</span> &lt;&lt; res[3][i] &lt;&lt; <span class="charliteral">&#39;\n&#39;</span>;</div>
<div class="line"><a id="l00198" name="l00198"></a><span class="lineno"> 198</span> }</div>
<div class="line"><a id="l00199" name="l00199"></a><span class="lineno"> 199</span> ofile.close();</div>
<div class="line"><a id="l00200" name="l00200"></a><span class="lineno"> 200</span>}</div>
<div class="line"><a id="l00201" name="l00201"></a><span class="lineno"> 201</span> </div>
<div class="line"><a id="l00209" name="l00209"></a><span class="lineno"><a class="line" href="main_8cpp.html#a33d9b1c76c3c80902f89a58b1a6d96ea"> 209</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="main_8cpp.html#a33d9b1c76c3c80902f89a58b1a6d96ea">potential_resonance_narrow_sweep</a>()</div>
<div class="line"><a id="l00210" name="l00210"></a><span class="lineno"> 210</span>{</div>
<div class="line"><a id="l00211" name="l00211"></a><span class="lineno"> 211</span> <span class="keywordtype">double</span> time = 500.;</div>
<div class="line"><a id="l00212" name="l00212"></a><span class="lineno"> 212</span> </div>
<div class="line"><a id="l00213" name="l00213"></a><span class="lineno"> 213</span> <span class="keywordtype">double</span> amplitudes[]{.1, .4, .7};</div>
<div class="line"><a id="l00214" name="l00214"></a><span class="lineno"> 214</span> </div>
<div class="line"><a id="l00215" name="l00215"></a><span class="lineno"> 215</span> <span class="keywordtype">double</span> freq_start = 1.1;</div>
<div class="line"><a id="l00216" name="l00216"></a><span class="lineno"> 216</span> <span class="keywordtype">double</span> freq_end = 1.7;</div>
<div class="line"><a id="l00217" name="l00217"></a><span class="lineno"> 217</span> <span class="keywordtype">double</span> freq_increment = .002;</div>
<div class="line"><a id="l00218" name="l00218"></a><span class="lineno"> 218</span> <span class="keywordtype">size_t</span> freq_iterations =</div>
<div class="line"><a id="l00219" name="l00219"></a><span class="lineno"> 219</span> (size_t)((freq_end - freq_start) / freq_increment) + 1;</div>
<div class="line"><a id="l00220" name="l00220"></a><span class="lineno"> 220</span> </div>
<div class="line"><a id="l00221" name="l00221"></a><span class="lineno"> 221</span> <span class="keywordtype">double</span> res[4][freq_iterations];</div>
<div class="line"><a id="l00222" name="l00222"></a><span class="lineno"> 222</span> </div>
<div class="line"><a id="l00223" name="l00223"></a><span class="lineno"> 223</span> std::string path = <span class="stringliteral">&quot;output/time_dependent_potential/&quot;</span>;</div>
<div class="line"><a id="l00224" name="l00224"></a><span class="lineno"> 224</span> <a class="code hl_function" href="utils_8hpp.html#a6fdd7217b750aff5b6295ece7cbdeffa">mkpath</a>(path);</div>
<div class="line"><a id="l00225" name="l00225"></a><span class="lineno"> 225</span> </div>
<div class="line"><a id="l00226" name="l00226"></a><span class="lineno"> 226</span> std::ofstream ofile;</div>
<div class="line"><a id="l00227" name="l00227"></a><span class="lineno"> 227</span> </div>
<div class="line"><a id="l00228" name="l00228"></a><span class="lineno"> 228</span><span class="preprocessor">#pragma omp parallel for</span></div>
<div class="line"><a id="l00229" name="l00229"></a><span class="lineno"> 229</span> <span class="comment">// Insert frequencies</span></div>
<div class="line"><a id="l00230" name="l00230"></a><span class="lineno"> 230</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i = 0; i &lt; freq_iterations; i++) {</div>
<div class="line"><a id="l00231" name="l00231"></a><span class="lineno"> 231</span> res[0][i] = freq_start + freq_increment * i;</div>
<div class="line"><a id="l00232" name="l00232"></a><span class="lineno"> 232</span> }</div>
<div class="line"><a id="l00233" name="l00233"></a><span class="lineno"> 233</span> </div>
<div class="line"><a id="l00234" name="l00234"></a><span class="lineno"> 234</span><span class="preprocessor">#pragma omp parallel</span></div>
<div class="line"><a id="l00235" name="l00235"></a><span class="lineno"> 235</span> {</div>
<div class="line"><a id="l00236" name="l00236"></a><span class="lineno"> 236</span> <span class="comment">// Each thread creates a PenningTrap instance and reuses it throughout</span></div>
<div class="line"><a id="l00237" name="l00237"></a><span class="lineno"> 237</span> <span class="comment">// the sweep.</span></div>
<div class="line"><a id="l00238" name="l00238"></a><span class="lineno"> 238</span> <a class="code hl_class" href="classPenningTrap.html">PenningTrap</a> trap((uint)100);</div>
<div class="line"><a id="l00239" name="l00239"></a><span class="lineno"> 239</span><span class="preprocessor">#pragma omp for collapse(2)</span></div>
<div class="line"><a id="l00240" name="l00240"></a><span class="lineno"> 240</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i = 0; i &lt; 3; i++) {</div>
<div class="line"><a id="l00241" name="l00241"></a><span class="lineno"> 241</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> j = 0; j &lt; freq_iterations; j++) {</div>
<div class="line"><a id="l00242" name="l00242"></a><span class="lineno"> 242</span> <span class="comment">// Reset particles and give new time dependent potential.</span></div>
<div class="line"><a id="l00243" name="l00243"></a><span class="lineno"> 243</span> trap.<a class="code hl_function" href="classPenningTrap.html#aaee129f177657455348d0c8ae1441dea">reinitialize</a>(amplitudes[i], res[0][j]);</div>
<div class="line"><a id="l00244" name="l00244"></a><span class="lineno"> 244</span> res[i + 1][j] =</div>
<div class="line"><a id="l00245" name="l00245"></a><span class="lineno"> 245</span> trap.<a class="code hl_function" href="classPenningTrap.html#ac529aa26c288f34eae184a67e6bac41f">fraction_of_particles_left</a>(time, N, <span class="stringliteral">&quot;rk4&quot;</span>, <span class="keyword">false</span>);</div>
<div class="line"><a id="l00246" name="l00246"></a><span class="lineno"> 246</span> }</div>
<div class="line"><a id="l00247" name="l00247"></a><span class="lineno"> 247</span> }</div>
<div class="line"><a id="l00248" name="l00248"></a><span class="lineno"> 248</span> }</div>
<div class="line"><a id="l00249" name="l00249"></a><span class="lineno"> 249</span> </div>
<div class="line"><a id="l00250" name="l00250"></a><span class="lineno"> 250</span> <span class="comment">// Write results to file</span></div>
<div class="line"><a id="l00251" name="l00251"></a><span class="lineno"> 251</span> ofile.open(path + <span class="stringliteral">&quot;narrow_sweep.txt&quot;</span>);</div>
<div class="line"><a id="l00252" name="l00252"></a><span class="lineno"> 252</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i = 0; i &lt; freq_iterations; i++) {</div>
<div class="line"><a id="l00253" name="l00253"></a><span class="lineno"> 253</span> ofile &lt;&lt; res[0][i] &lt;&lt; <span class="charliteral">&#39;,&#39;</span> &lt;&lt; res[1][i] &lt;&lt; <span class="charliteral">&#39;,&#39;</span> &lt;&lt; res[2][i] &lt;&lt; <span class="charliteral">&#39;,&#39;</span></div>
<div class="line"><a id="l00254" name="l00254"></a><span class="lineno"> 254</span> &lt;&lt; res[3][i] &lt;&lt; <span class="charliteral">&#39;\n&#39;</span>;</div>
<div class="line"><a id="l00255" name="l00255"></a><span class="lineno"> 255</span> }</div>
<div class="line"><a id="l00256" name="l00256"></a><span class="lineno"> 256</span> ofile.close();</div>
<div class="line"><a id="l00257" name="l00257"></a><span class="lineno"> 257</span>}</div>
<div class="line"><a id="l00258" name="l00258"></a><span class="lineno"> 258</span> </div>
<div class="line"><a id="l00266" name="l00266"></a><span class="lineno"><a class="line" href="main_8cpp.html#ac1816f70ec612edc27848ef7f0875fdb"> 266</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="main_8cpp.html#ac1816f70ec612edc27848ef7f0875fdb">potential_resonance_narrow_sweep_interaction</a>()</div>
<div class="line"><a id="l00267" name="l00267"></a><span class="lineno"> 267</span>{</div>
<div class="line"><a id="l00268" name="l00268"></a><span class="lineno"> 268</span> <span class="keywordtype">double</span> time = 500.;</div>
<div class="line"><a id="l00269" name="l00269"></a><span class="lineno"> 269</span> </div>
<div class="line"><a id="l00270" name="l00270"></a><span class="lineno"> 270</span> <span class="keywordtype">double</span> amplitudes[]{.1, .4, .7};</div>
<div class="line"><a id="l00271" name="l00271"></a><span class="lineno"> 271</span> </div>
<div class="line"><a id="l00272" name="l00272"></a><span class="lineno"> 272</span> <span class="keywordtype">double</span> freq_start = 1.1;</div>
<div class="line"><a id="l00273" name="l00273"></a><span class="lineno"> 273</span> <span class="keywordtype">double</span> freq_end = 1.7;</div>
<div class="line"><a id="l00274" name="l00274"></a><span class="lineno"> 274</span> <span class="keywordtype">double</span> freq_increment = .002;</div>
<div class="line"><a id="l00275" name="l00275"></a><span class="lineno"> 275</span> <span class="keywordtype">size_t</span> freq_iterations =</div>
<div class="line"><a id="l00276" name="l00276"></a><span class="lineno"> 276</span> (size_t)((freq_end - freq_start) / freq_increment) + 1;</div>
<div class="line"><a id="l00277" name="l00277"></a><span class="lineno"> 277</span> </div>
<div class="line"><a id="l00278" name="l00278"></a><span class="lineno"> 278</span> std::ofstream ofile;</div>
<div class="line"><a id="l00278" name="l00278"></a><span class="lineno"> 278</span> <span class="keywordtype">double</span> res[4][freq_iterations];</div>
<div class="line"><a id="l00279" name="l00279"></a><span class="lineno"> 279</span> </div>
<div class="line"><a id="l00280" name="l00280"></a><span class="lineno"> 280</span><span class="preprocessor">#pragma omp parallel for</span></div>
<div class="line"><a id="l00281" name="l00281"></a><span class="lineno"> 281</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i = 0; i &lt; freq_iterations; i++) {</div>
<div class="line"><a id="l00282" name="l00282"></a><span class="lineno"> 282</span> res[0][i] = freq_start + freq_increment * i;</div>
<div class="line"><a id="l00283" name="l00283"></a><span class="lineno"> 283</span> }</div>
<div class="line"><a id="l00280" name="l00280"></a><span class="lineno"> 280</span> std::string path = <span class="stringliteral">&quot;output/time_dependent_potential/&quot;</span>;</div>
<div class="line"><a id="l00281" name="l00281"></a><span class="lineno"> 281</span> <a class="code hl_function" href="utils_8hpp.html#a6fdd7217b750aff5b6295ece7cbdeffa">mkpath</a>(path);</div>
<div class="line"><a id="l00282" name="l00282"></a><span class="lineno"> 282</span> </div>
<div class="line"><a id="l00283" name="l00283"></a><span class="lineno"> 283</span> std::ofstream ofile;</div>
<div class="line"><a id="l00284" name="l00284"></a><span class="lineno"> 284</span> </div>
<div class="line"><a id="l00285" name="l00285"></a><span class="lineno"> 285</span><span class="preprocessor">#pragma omp parallel</span></div>
<div class="line"><a id="l00286" name="l00286"></a><span class="lineno"> 286</span> {</div>
<div class="line"><a id="l00287" name="l00287"></a><span class="lineno"> 287</span> <span class="comment">// Each thread creates a PenningTrap instance and reuses it throughout</span></div>
<div class="line"><a id="l00288" name="l00288"></a><span class="lineno"> 288</span> <span class="comment">// the sweep.</span></div>
<div class="line"><a id="l00289" name="l00289"></a><span class="lineno"> 289</span> <a class="code hl_class" href="classPenningTrap.html">PenningTrap</a> trap((uint)100);</div>
<div class="line"><a id="l00290" name="l00290"></a><span class="lineno"> 290</span><span class="preprocessor">#pragma omp for collapse(2)</span></div>
<div class="line"><a id="l00291" name="l00291"></a><span class="lineno"> 291</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i = 0; i &lt; 3; i++) {</div>
<div class="line"><a id="l00292" name="l00292"></a><span class="lineno"> 292</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> j = 0; j &lt; freq_iterations; j++) {</div>
<div class="line"><a id="l00293" name="l00293"></a><span class="lineno"> 293</span> <span class="comment">// Reset particles and give new time dependent potential.</span></div>
<div class="line"><a id="l00294" name="l00294"></a><span class="lineno"> 294</span> trap.<a class="code hl_function" href="classPenningTrap.html#aaee129f177657455348d0c8ae1441dea">reinitialize</a>(amplitudes[i], res[0][j]);</div>
<div class="line"><a id="l00295" name="l00295"></a><span class="lineno"> 295</span> res[i + 1][j] = trap.<a class="code hl_function" href="classPenningTrap.html#ac529aa26c288f34eae184a67e6bac41f">fraction_of_particles_left</a>(time, N);</div>
<div class="line"><a id="l00296" name="l00296"></a><span class="lineno"> 296</span> }</div>
<div class="line"><a id="l00297" name="l00297"></a><span class="lineno"> 297</span> }</div>
<div class="line"><a id="l00298" name="l00298"></a><span class="lineno"> 298</span> }</div>
<div class="line"><a id="l00299" name="l00299"></a><span class="lineno"> 299</span> </div>
<div class="line"><a id="l00300" name="l00300"></a><span class="lineno"> 300</span> <span class="comment">// Write results to file</span></div>
<div class="line"><a id="l00301" name="l00301"></a><span class="lineno"> 301</span> ofile.open(path + <span class="stringliteral">&quot;narrow_sweep_interactions.txt&quot;</span>);</div>
<div class="line"><a id="l00302" name="l00302"></a><span class="lineno"> 302</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i = 0; i &lt; freq_iterations; i++) {</div>
<div class="line"><a id="l00303" name="l00303"></a><span class="lineno"> 303</span> ofile &lt;&lt; res[0][i] &lt;&lt; <span class="charliteral">&#39;,&#39;</span> &lt;&lt; res[1][i] &lt;&lt; <span class="charliteral">&#39;,&#39;</span> &lt;&lt; res[2][i] &lt;&lt; <span class="charliteral">&#39;,&#39;</span></div>
<div class="line"><a id="l00304" name="l00304"></a><span class="lineno"> 304</span> &lt;&lt; res[3][i] &lt;&lt; <span class="charliteral">&#39;\n&#39;</span>;</div>
<div class="line"><a id="l00305" name="l00305"></a><span class="lineno"> 305</span> }</div>
<div class="line"><a id="l00306" name="l00306"></a><span class="lineno"> 306</span> ofile.close();</div>
<div class="line"><a id="l00307" name="l00307"></a><span class="lineno"> 307</span>}</div>
<div class="line"><a id="l00308" name="l00308"></a><span class="lineno"> 308</span> </div>
<div class="line"><a id="l00309" name="l00309"></a><span class="lineno"> 309</span><span class="keywordtype">int</span> main()</div>
<div class="line"><a id="l00310" name="l00310"></a><span class="lineno"> 310</span>{</div>
<div class="line"><a id="l00311" name="l00311"></a><span class="lineno"> 311</span> <span class="keywordtype">double</span> start, end, t1, t2;</div>
<div class="line"><a id="l00312" name="l00312"></a><span class="lineno"> 312</span> start = omp_get_wtime();</div>
<div class="line"><a id="l00285" name="l00285"></a><span class="lineno"> 285</span><span class="preprocessor">#pragma omp parallel for</span></div>
<div class="line"><a id="l00286" name="l00286"></a><span class="lineno"> 286</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i = 0; i &lt; freq_iterations; i++) {</div>
<div class="line"><a id="l00287" name="l00287"></a><span class="lineno"> 287</span> res[0][i] = freq_start + freq_increment * i;</div>
<div class="line"><a id="l00288" name="l00288"></a><span class="lineno"> 288</span> }</div>
<div class="line"><a id="l00289" name="l00289"></a><span class="lineno"> 289</span> </div>
<div class="line"><a id="l00290" name="l00290"></a><span class="lineno"> 290</span><span class="preprocessor">#pragma omp parallel</span></div>
<div class="line"><a id="l00291" name="l00291"></a><span class="lineno"> 291</span> {</div>
<div class="line"><a id="l00292" name="l00292"></a><span class="lineno"> 292</span> <span class="comment">// Each thread creates a PenningTrap instance and reuses it throughout</span></div>
<div class="line"><a id="l00293" name="l00293"></a><span class="lineno"> 293</span> <span class="comment">// the sweep.</span></div>
<div class="line"><a id="l00294" name="l00294"></a><span class="lineno"> 294</span> <a class="code hl_class" href="classPenningTrap.html">PenningTrap</a> trap((uint)100);</div>
<div class="line"><a id="l00295" name="l00295"></a><span class="lineno"> 295</span><span class="preprocessor">#pragma omp for collapse(2)</span></div>
<div class="line"><a id="l00296" name="l00296"></a><span class="lineno"> 296</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i = 0; i &lt; 3; i++) {</div>
<div class="line"><a id="l00297" name="l00297"></a><span class="lineno"> 297</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> j = 0; j &lt; freq_iterations; j++) {</div>
<div class="line"><a id="l00298" name="l00298"></a><span class="lineno"> 298</span> <span class="comment">// Reset particles and give new time dependent potential.</span></div>
<div class="line"><a id="l00299" name="l00299"></a><span class="lineno"> 299</span> trap.<a class="code hl_function" href="classPenningTrap.html#aaee129f177657455348d0c8ae1441dea">reinitialize</a>(amplitudes[i], res[0][j]);</div>
<div class="line"><a id="l00300" name="l00300"></a><span class="lineno"> 300</span> res[i + 1][j] = trap.<a class="code hl_function" href="classPenningTrap.html#ac529aa26c288f34eae184a67e6bac41f">fraction_of_particles_left</a>(time, N);</div>
<div class="line"><a id="l00301" name="l00301"></a><span class="lineno"> 301</span> }</div>
<div class="line"><a id="l00302" name="l00302"></a><span class="lineno"> 302</span> }</div>
<div class="line"><a id="l00303" name="l00303"></a><span class="lineno"> 303</span> }</div>
<div class="line"><a id="l00304" name="l00304"></a><span class="lineno"> 304</span> </div>
<div class="line"><a id="l00305" name="l00305"></a><span class="lineno"> 305</span> <span class="comment">// Write results to file</span></div>
<div class="line"><a id="l00306" name="l00306"></a><span class="lineno"> 306</span> ofile.open(path + <span class="stringliteral">&quot;narrow_sweep_interactions.txt&quot;</span>);</div>
<div class="line"><a id="l00307" name="l00307"></a><span class="lineno"> 307</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i = 0; i &lt; freq_iterations; i++) {</div>
<div class="line"><a id="l00308" name="l00308"></a><span class="lineno"> 308</span> ofile &lt;&lt; res[0][i] &lt;&lt; <span class="charliteral">&#39;,&#39;</span> &lt;&lt; res[1][i] &lt;&lt; <span class="charliteral">&#39;,&#39;</span> &lt;&lt; res[2][i] &lt;&lt; <span class="charliteral">&#39;,&#39;</span></div>
<div class="line"><a id="l00309" name="l00309"></a><span class="lineno"> 309</span> &lt;&lt; res[3][i] &lt;&lt; <span class="charliteral">&#39;\n&#39;</span>;</div>
<div class="line"><a id="l00310" name="l00310"></a><span class="lineno"> 310</span> }</div>
<div class="line"><a id="l00311" name="l00311"></a><span class="lineno"> 311</span> ofile.close();</div>
<div class="line"><a id="l00312" name="l00312"></a><span class="lineno"> 312</span>}</div>
<div class="line"><a id="l00313" name="l00313"></a><span class="lineno"> 313</span> </div>
<div class="line"><a id="l00314" name="l00314"></a><span class="lineno"> 314</span> <a class="code hl_function" href="main_8cpp.html#a8fdbe2d5a872e50ef5ec1263243589d6">simulate_single_particle</a>();</div>
<div class="line"><a id="l00315" name="l00315"></a><span class="lineno"> 315</span> </div>
<div class="line"><a id="l00316" name="l00316"></a><span class="lineno"> 316</span> <a class="code hl_function" href="main_8cpp.html#a783789519f97c6430081171cacb0ffb1">simulate_two_particles</a>();</div>
<div class="line"><a id="l00317" name="l00317"></a><span class="lineno"> 317</span> </div>
<div class="line"><a id="l00318" name="l00318"></a><span class="lineno"> 318</span> <a class="code hl_function" href="main_8cpp.html#ac67e0d59227856c4d42e7d01c75e0ad2">simulate_single_particle_with_different_steps</a>();</div>
<div class="line"><a id="l00319" name="l00319"></a><span class="lineno"> 319</span> </div>
<div class="line"><a id="l00320" name="l00320"></a><span class="lineno"> 320</span> t2 = omp_get_wtime();</div>
<div class="line"><a id="l00321" name="l00321"></a><span class="lineno"> 321</span> </div>
<div class="line"><a id="l00322" name="l00322"></a><span class="lineno"> 322</span> std::cout &lt;&lt; <span class="stringliteral">&quot;Time single and double : &quot;</span> &lt;&lt; (t2 - start)</div>
<div class="line"><a id="l00323" name="l00323"></a><span class="lineno"> 323</span> &lt;&lt; <span class="stringliteral">&quot; seconds&quot;</span> &lt;&lt; std::endl;</div>
<div class="line"><a id="l00324" name="l00324"></a><span class="lineno"> 324</span> </div>
<div class="line"><a id="l00325" name="l00325"></a><span class="lineno"> 325</span> t1 = omp_get_wtime();</div>
<div class="line"><a id="l00326" name="l00326"></a><span class="lineno"> 326</span> </div>
<div class="line"><a id="l00327" name="l00327"></a><span class="lineno"> 327</span> <a class="code hl_function" href="main_8cpp.html#a213713d6ecc02a32b588ffd179dc7513">simulate_100_particles</a>();</div>
<div class="line"><a id="l00328" name="l00328"></a><span class="lineno"> 328</span> </div>
<div class="line"><a id="l00329" name="l00329"></a><span class="lineno"> 329</span> t2 = omp_get_wtime();</div>
<div class="line"><a id="l00330" name="l00330"></a><span class="lineno"> 330</span> </div>
<div class="line"><a id="l00331" name="l00331"></a><span class="lineno"> 331</span> std::cout &lt;&lt; <span class="stringliteral">&quot;Time 100 particles : &quot;</span> &lt;&lt; (t2 - t1)</div>
<div class="line"><a id="l00332" name="l00332"></a><span class="lineno"> 332</span> &lt;&lt; <span class="stringliteral">&quot; seconds&quot;</span> &lt;&lt; std::endl;</div>
<div class="line"><a id="l00333" name="l00333"></a><span class="lineno"> 333</span> </div>
<div class="line"><a id="l00334" name="l00334"></a><span class="lineno"> 334</span> t1 = omp_get_wtime();</div>
<div class="line"><a id="l00335" name="l00335"></a><span class="lineno"> 335</span> </div>
<div class="line"><a id="l00336" name="l00336"></a><span class="lineno"> 336</span> <a class="code hl_function" href="main_8cpp.html#a6b38b477c18e2f4268779751a88edab1">potential_resonance_wide_sweep</a>();</div>
<div class="line"><a id="l00337" name="l00337"></a><span class="lineno"> 337</span> </div>
<div class="line"><a id="l00338" name="l00338"></a><span class="lineno"> 338</span> t2 = omp_get_wtime();</div>
<div class="line"><a id="l00339" name="l00339"></a><span class="lineno"> 339</span> </div>
<div class="line"><a id="l00340" name="l00340"></a><span class="lineno"> 340</span> std::cout &lt;&lt; <span class="stringliteral">&quot;Time wide sweep : &quot;</span> &lt;&lt; (t2 - t1)</div>
<div class="line"><a id="l00341" name="l00341"></a><span class="lineno"> 341</span> &lt;&lt; <span class="stringliteral">&quot; seconds&quot;</span> &lt;&lt; std::endl;</div>
<div class="line"><a id="l00342" name="l00342"></a><span class="lineno"> 342</span> </div>
<div class="line"><a id="l00343" name="l00343"></a><span class="lineno"> 343</span> t1 = omp_get_wtime();</div>
<div class="line"><a id="l00344" name="l00344"></a><span class="lineno"> 344</span> </div>
<div class="line"><a id="l00345" name="l00345"></a><span class="lineno"> 345</span> <a class="code hl_function" href="main_8cpp.html#a33d9b1c76c3c80902f89a58b1a6d96ea">potential_resonance_narrow_sweep</a>();</div>
<div class="line"><a id="l00346" name="l00346"></a><span class="lineno"> 346</span> </div>
<div class="line"><a id="l00347" name="l00347"></a><span class="lineno"> 347</span> t2 = omp_get_wtime();</div>
<div class="line"><a id="l00348" name="l00348"></a><span class="lineno"> 348</span> </div>
<div class="line"><a id="l00349" name="l00349"></a><span class="lineno"> 349</span> std::cout &lt;&lt; <span class="stringliteral">&quot;Time narrow sweep no interaction : &quot;</span> &lt;&lt; (t2 - t1)</div>
<div class="line"><a id="l00350" name="l00350"></a><span class="lineno"> 350</span> &lt;&lt; <span class="stringliteral">&quot; seconds&quot;</span> &lt;&lt; std::endl;</div>
<div class="line"><a id="l00351" name="l00351"></a><span class="lineno"> 351</span> </div>
<div class="line"><a id="l00352" name="l00352"></a><span class="lineno"> 352</span> t1 = omp_get_wtime();</div>
<div class="line"><a id="l00314" name="l00314"></a><span class="lineno"> 314</span><span class="keywordtype">int</span> main()</div>
<div class="line"><a id="l00315" name="l00315"></a><span class="lineno"> 315</span>{</div>
<div class="line"><a id="l00316" name="l00316"></a><span class="lineno"> 316</span> <span class="keywordtype">int</span> option = 1;</div>
<div class="line"><a id="l00317" name="l00317"></a><span class="lineno"> 317</span> <span class="keywordtype">bool</span> chosen = <span class="keyword">false</span>;</div>
<div class="line"><a id="l00318" name="l00318"></a><span class="lineno"> 318</span> </div>
<div class="line"><a id="l00319" name="l00319"></a><span class="lineno"> 319</span> system(<span class="stringliteral">&quot;clear&quot;</span>);</div>
<div class="line"><a id="l00320" name="l00320"></a><span class="lineno"> 320</span> std::cout &lt;&lt; <span class="stringliteral">&quot;(1) All (default)\n&quot;</span></div>
<div class="line"><a id="l00321" name="l00321"></a><span class="lineno"> 321</span> &lt;&lt; <span class="stringliteral">&quot;(2) Simulate single particle\n&quot;</span></div>
<div class="line"><a id="l00322" name="l00322"></a><span class="lineno"> 322</span> &lt;&lt; <span class="stringliteral">&quot;(3) simulate 2 particles\n&quot;</span></div>
<div class="line"><a id="l00323" name="l00323"></a><span class="lineno"> 323</span> &lt;&lt; <span class="stringliteral">&quot;(4) Simulate single particle with different time steps\n&quot;</span></div>
<div class="line"><a id="l00324" name="l00324"></a><span class="lineno"> 324</span> &lt;&lt; <span class="stringliteral">&quot;(5) Simulate 100 particles\n&quot;</span></div>
<div class="line"><a id="l00325" name="l00325"></a><span class="lineno"> 325</span> &lt;&lt; <span class="stringliteral">&quot;(6) Potential resonance wide sweep\n&quot;</span></div>
<div class="line"><a id="l00326" name="l00326"></a><span class="lineno"> 326</span> &lt;&lt; <span class="stringliteral">&quot;(7) Potential resonance narrow sweep without particle &quot;</span></div>
<div class="line"><a id="l00327" name="l00327"></a><span class="lineno"> 327</span> <span class="stringliteral">&quot;interactions\n&quot;</span></div>
<div class="line"><a id="l00328" name="l00328"></a><span class="lineno"> 328</span> &lt;&lt; <span class="stringliteral">&quot;(8) Potential resonance narrow sweep with particle &quot;</span></div>
<div class="line"><a id="l00329" name="l00329"></a><span class="lineno"> 329</span> <span class="stringliteral">&quot;interaction\n&quot;</span></div>
<div class="line"><a id="l00330" name="l00330"></a><span class="lineno"> 330</span> &lt;&lt; <span class="stringliteral">&quot;Select what to run: &quot;</span>;</div>
<div class="line"><a id="l00331" name="l00331"></a><span class="lineno"> 331</span> std::cin &gt;&gt; std::noskipws;</div>
<div class="line"><a id="l00332" name="l00332"></a><span class="lineno"> 332</span> <span class="keywordflow">do</span> {</div>
<div class="line"><a id="l00333" name="l00333"></a><span class="lineno"> 333</span> <span class="keywordflow">if</span> (!(std::cin &gt;&gt; option) || option &lt; 1 || option &gt; 8) {</div>
<div class="line"><a id="l00334" name="l00334"></a><span class="lineno"> 334</span> std::cin.clear();</div>
<div class="line"><a id="l00335" name="l00335"></a><span class="lineno"> 335</span> std::cin.ignore(std::numeric_limits&lt;std::streamsize&gt;::max(), <span class="charliteral">&#39;\n&#39;</span>);</div>
<div class="line"><a id="l00336" name="l00336"></a><span class="lineno"> 336</span> system(<span class="stringliteral">&quot;clear&quot;</span>);</div>
<div class="line"><a id="l00337" name="l00337"></a><span class="lineno"> 337</span> std::cout</div>
<div class="line"><a id="l00338" name="l00338"></a><span class="lineno"> 338</span> &lt;&lt; <span class="stringliteral">&quot;(1) All (default)\n&quot;</span></div>
<div class="line"><a id="l00339" name="l00339"></a><span class="lineno"> 339</span> &lt;&lt; <span class="stringliteral">&quot;(2) Simulate single particle\n&quot;</span></div>
<div class="line"><a id="l00340" name="l00340"></a><span class="lineno"> 340</span> &lt;&lt; <span class="stringliteral">&quot;(3) simulate 2 particles\n&quot;</span></div>
<div class="line"><a id="l00341" name="l00341"></a><span class="lineno"> 341</span> &lt;&lt; <span class="stringliteral">&quot;(4) Simulate single particle with different time steps\n&quot;</span></div>
<div class="line"><a id="l00342" name="l00342"></a><span class="lineno"> 342</span> &lt;&lt; <span class="stringliteral">&quot;(5) Simulate 100 particles\n&quot;</span></div>
<div class="line"><a id="l00343" name="l00343"></a><span class="lineno"> 343</span> &lt;&lt; <span class="stringliteral">&quot;(6) Potential resonance wide sweep\n&quot;</span></div>
<div class="line"><a id="l00344" name="l00344"></a><span class="lineno"> 344</span> &lt;&lt; <span class="stringliteral">&quot;(7) Potential resonance narrow sweep without particle &quot;</span></div>
<div class="line"><a id="l00345" name="l00345"></a><span class="lineno"> 345</span> <span class="stringliteral">&quot;interactions\n&quot;</span></div>
<div class="line"><a id="l00346" name="l00346"></a><span class="lineno"> 346</span> &lt;&lt; <span class="stringliteral">&quot;(8) Potential resonance narrow sweep with particle &quot;</span></div>
<div class="line"><a id="l00347" name="l00347"></a><span class="lineno"> 347</span> <span class="stringliteral">&quot;interaction\n&quot;</span></div>
<div class="line"><a id="l00348" name="l00348"></a><span class="lineno"> 348</span> &lt;&lt; <span class="stringliteral">&quot;Not a valid option, please enter a valid number: &quot;</span>;</div>
<div class="line"><a id="l00349" name="l00349"></a><span class="lineno"> 349</span> } <span class="keywordflow">else</span> {</div>
<div class="line"><a id="l00350" name="l00350"></a><span class="lineno"> 350</span> chosen = <span class="keyword">true</span>;</div>
<div class="line"><a id="l00351" name="l00351"></a><span class="lineno"> 351</span> }</div>
<div class="line"><a id="l00352" name="l00352"></a><span class="lineno"> 352</span> } <span class="keywordflow">while</span> (!chosen);</div>
<div class="line"><a id="l00353" name="l00353"></a><span class="lineno"> 353</span> </div>
<div class="line"><a id="l00354" name="l00354"></a><span class="lineno"> 354</span> <a class="code hl_function" href="main_8cpp.html#ac1816f70ec612edc27848ef7f0875fdb">potential_resonance_narrow_sweep_interaction</a>();</div>
<div class="line"><a id="l00354" name="l00354"></a><span class="lineno"> 354</span> <span class="keywordtype">double</span> start, end;</div>
<div class="line"><a id="l00355" name="l00355"></a><span class="lineno"> 355</span> </div>
<div class="line"><a id="l00356" name="l00356"></a><span class="lineno"> 356</span> t2 = omp_get_wtime();</div>
<div class="line"><a id="l00356" name="l00356"></a><span class="lineno"> 356</span> system(<span class="stringliteral">&quot;clear&quot;</span>);</div>
<div class="line"><a id="l00357" name="l00357"></a><span class="lineno"> 357</span> </div>
<div class="line"><a id="l00358" name="l00358"></a><span class="lineno"> 358</span> std::cout &lt;&lt; <span class="stringliteral">&quot;Time narrow sweep with interaction: &quot;</span> &lt;&lt; (t2 - t1)</div>
<div class="line"><a id="l00359" name="l00359"></a><span class="lineno"> 359</span> &lt;&lt; <span class="stringliteral">&quot; seconds&quot;</span> &lt;&lt; std::endl;</div>
<div class="line"><a id="l00360" name="l00360"></a><span class="lineno"> 360</span> </div>
<div class="line"><a id="l00361" name="l00361"></a><span class="lineno"> 361</span> end = omp_get_wtime();</div>
<div class="line"><a id="l00362" name="l00362"></a><span class="lineno"> 362</span> </div>
<div class="line"><a id="l00363" name="l00363"></a><span class="lineno"> 363</span> std::cout &lt;&lt; <span class="stringliteral">&quot;Time : &quot;</span> &lt;&lt; (end - start)</div>
<div class="line"><a id="l00364" name="l00364"></a><span class="lineno"> 364</span> &lt;&lt; <span class="stringliteral">&quot; seconds&quot;</span> &lt;&lt; std::endl;</div>
<div class="line"><a id="l00365" name="l00365"></a><span class="lineno"> 365</span> </div>
<div class="line"><a id="l00366" name="l00366"></a><span class="lineno"> 366</span> <span class="keywordflow">return</span> 0;</div>
<div class="line"><a id="l00367" name="l00367"></a><span class="lineno"> 367</span>}</div>
<div class="line"><a id="l00358" name="l00358"></a><span class="lineno"> 358</span> start = omp_get_wtime();</div>
<div class="line"><a id="l00359" name="l00359"></a><span class="lineno"> 359</span> <span class="keywordflow">switch</span> (option) {</div>
<div class="line"><a id="l00360" name="l00360"></a><span class="lineno"> 360</span> <span class="keywordflow">case</span> 1:</div>
<div class="line"><a id="l00361" name="l00361"></a><span class="lineno"> 361</span> std::cout &lt;&lt; <span class="stringliteral">&quot;Running simulate_single_particle\n&quot;</span>;</div>
<div class="line"><a id="l00362" name="l00362"></a><span class="lineno"> 362</span> <a class="code hl_function" href="main_8cpp.html#a8fdbe2d5a872e50ef5ec1263243589d6">simulate_single_particle</a>();</div>
<div class="line"><a id="l00363" name="l00363"></a><span class="lineno"> 363</span> </div>
<div class="line"><a id="l00364" name="l00364"></a><span class="lineno"> 364</span> std::cout &lt;&lt; <span class="stringliteral">&quot;Running simulate_two_particles\n&quot;</span>;</div>
<div class="line"><a id="l00365" name="l00365"></a><span class="lineno"> 365</span> <a class="code hl_function" href="main_8cpp.html#a783789519f97c6430081171cacb0ffb1">simulate_two_particles</a>();</div>
<div class="line"><a id="l00366" name="l00366"></a><span class="lineno"> 366</span> </div>
<div class="line"><a id="l00367" name="l00367"></a><span class="lineno"> 367</span> std::cout &lt;&lt; <span class="stringliteral">&quot;Running simulate_single_particle_with_different_steps\n&quot;</span>;</div>
<div class="line"><a id="l00368" name="l00368"></a><span class="lineno"> 368</span> <a class="code hl_function" href="main_8cpp.html#ac67e0d59227856c4d42e7d01c75e0ad2">simulate_single_particle_with_different_steps</a>();</div>
<div class="line"><a id="l00369" name="l00369"></a><span class="lineno"> 369</span> </div>
<div class="line"><a id="l00370" name="l00370"></a><span class="lineno"> 370</span> std::cout &lt;&lt; <span class="stringliteral">&quot;Running simulate_100_particles\n&quot;</span>;</div>
<div class="line"><a id="l00371" name="l00371"></a><span class="lineno"> 371</span> <a class="code hl_function" href="main_8cpp.html#a213713d6ecc02a32b588ffd179dc7513">simulate_100_particles</a>();</div>
<div class="line"><a id="l00372" name="l00372"></a><span class="lineno"> 372</span> </div>
<div class="line"><a id="l00373" name="l00373"></a><span class="lineno"> 373</span> std::cout &lt;&lt; <span class="stringliteral">&quot;Running potential_resonance_wide_sweep\n&quot;</span>;</div>
<div class="line"><a id="l00374" name="l00374"></a><span class="lineno"> 374</span> <a class="code hl_function" href="main_8cpp.html#a6b38b477c18e2f4268779751a88edab1">potential_resonance_wide_sweep</a>();</div>
<div class="line"><a id="l00375" name="l00375"></a><span class="lineno"> 375</span> </div>
<div class="line"><a id="l00376" name="l00376"></a><span class="lineno"> 376</span> std::cout &lt;&lt; <span class="stringliteral">&quot;Running potential_resonance_narrow_sweep\n&quot;</span>;</div>
<div class="line"><a id="l00377" name="l00377"></a><span class="lineno"> 377</span> <a class="code hl_function" href="main_8cpp.html#a33d9b1c76c3c80902f89a58b1a6d96ea">potential_resonance_narrow_sweep</a>();</div>
<div class="line"><a id="l00378" name="l00378"></a><span class="lineno"> 378</span> </div>
<div class="line"><a id="l00379" name="l00379"></a><span class="lineno"> 379</span> std::cout &lt;&lt; <span class="stringliteral">&quot;Running potential_resonance_narrow_sweep_interaction\n&quot;</span>;</div>
<div class="line"><a id="l00380" name="l00380"></a><span class="lineno"> 380</span> <a class="code hl_function" href="main_8cpp.html#ac1816f70ec612edc27848ef7f0875fdb">potential_resonance_narrow_sweep_interaction</a>();</div>
<div class="line"><a id="l00381" name="l00381"></a><span class="lineno"> 381</span> <span class="keywordflow">break</span>;</div>
<div class="line"><a id="l00382" name="l00382"></a><span class="lineno"> 382</span> <span class="keywordflow">case</span> 2:</div>
<div class="line"><a id="l00383" name="l00383"></a><span class="lineno"> 383</span> std::cout &lt;&lt; <span class="stringliteral">&quot;Running simulate_single_particle\n&quot;</span>;</div>
<div class="line"><a id="l00384" name="l00384"></a><span class="lineno"> 384</span> <a class="code hl_function" href="main_8cpp.html#a8fdbe2d5a872e50ef5ec1263243589d6">simulate_single_particle</a>();</div>
<div class="line"><a id="l00385" name="l00385"></a><span class="lineno"> 385</span> <span class="keywordflow">break</span>;</div>
<div class="line"><a id="l00386" name="l00386"></a><span class="lineno"> 386</span> <span class="keywordflow">case</span> 3:</div>
<div class="line"><a id="l00387" name="l00387"></a><span class="lineno"> 387</span> std::cout &lt;&lt; <span class="stringliteral">&quot;Running simulate_two_particles\n&quot;</span>;</div>
<div class="line"><a id="l00388" name="l00388"></a><span class="lineno"> 388</span> <a class="code hl_function" href="main_8cpp.html#a783789519f97c6430081171cacb0ffb1">simulate_two_particles</a>();</div>
<div class="line"><a id="l00389" name="l00389"></a><span class="lineno"> 389</span> <span class="keywordflow">break</span>;</div>
<div class="line"><a id="l00390" name="l00390"></a><span class="lineno"> 390</span> <span class="keywordflow">case</span> 4:</div>
<div class="line"><a id="l00391" name="l00391"></a><span class="lineno"> 391</span> std::cout &lt;&lt; <span class="stringliteral">&quot;Running simulate_single_particle_with_different_steps\n&quot;</span>;</div>
<div class="line"><a id="l00392" name="l00392"></a><span class="lineno"> 392</span> <a class="code hl_function" href="main_8cpp.html#ac67e0d59227856c4d42e7d01c75e0ad2">simulate_single_particle_with_different_steps</a>();</div>
<div class="line"><a id="l00393" name="l00393"></a><span class="lineno"> 393</span> <span class="keywordflow">break</span>;</div>
<div class="line"><a id="l00394" name="l00394"></a><span class="lineno"> 394</span> <span class="keywordflow">case</span> 5:</div>
<div class="line"><a id="l00395" name="l00395"></a><span class="lineno"> 395</span> std::cout &lt;&lt; <span class="stringliteral">&quot;Running simulate_100_particles\n&quot;</span>;</div>
<div class="line"><a id="l00396" name="l00396"></a><span class="lineno"> 396</span> <a class="code hl_function" href="main_8cpp.html#a213713d6ecc02a32b588ffd179dc7513">simulate_100_particles</a>();</div>
<div class="line"><a id="l00397" name="l00397"></a><span class="lineno"> 397</span> <span class="keywordflow">break</span>;</div>
<div class="line"><a id="l00398" name="l00398"></a><span class="lineno"> 398</span> <span class="keywordflow">case</span> 6:</div>
<div class="line"><a id="l00399" name="l00399"></a><span class="lineno"> 399</span> std::cout &lt;&lt; <span class="stringliteral">&quot;Running potential_resonance_wide_sweep\n&quot;</span>;</div>
<div class="line"><a id="l00400" name="l00400"></a><span class="lineno"> 400</span> <a class="code hl_function" href="main_8cpp.html#a6b38b477c18e2f4268779751a88edab1">potential_resonance_wide_sweep</a>();</div>
<div class="line"><a id="l00401" name="l00401"></a><span class="lineno"> 401</span> <span class="keywordflow">break</span>;</div>
<div class="line"><a id="l00402" name="l00402"></a><span class="lineno"> 402</span> <span class="keywordflow">case</span> 7:</div>
<div class="line"><a id="l00403" name="l00403"></a><span class="lineno"> 403</span> std::cout &lt;&lt; <span class="stringliteral">&quot;Running potential_resonance_narrow_sweep\n&quot;</span>;</div>
<div class="line"><a id="l00404" name="l00404"></a><span class="lineno"> 404</span> <a class="code hl_function" href="main_8cpp.html#a33d9b1c76c3c80902f89a58b1a6d96ea">potential_resonance_narrow_sweep</a>();</div>
<div class="line"><a id="l00405" name="l00405"></a><span class="lineno"> 405</span> <span class="keywordflow">break</span>;</div>
<div class="line"><a id="l00406" name="l00406"></a><span class="lineno"> 406</span> <span class="keywordflow">case</span> 8:</div>
<div class="line"><a id="l00407" name="l00407"></a><span class="lineno"> 407</span> std::cout &lt;&lt; <span class="stringliteral">&quot;Running potential_resonance_narrow_sweep_interaction\n&quot;</span>;</div>
<div class="line"><a id="l00408" name="l00408"></a><span class="lineno"> 408</span> <a class="code hl_function" href="main_8cpp.html#ac1816f70ec612edc27848ef7f0875fdb">potential_resonance_narrow_sweep_interaction</a>();</div>
<div class="line"><a id="l00409" name="l00409"></a><span class="lineno"> 409</span> <span class="keywordflow">break</span>;</div>
<div class="line"><a id="l00410" name="l00410"></a><span class="lineno"> 410</span> }</div>
<div class="line"><a id="l00411" name="l00411"></a><span class="lineno"> 411</span> end = omp_get_wtime();</div>
<div class="line"><a id="l00412" name="l00412"></a><span class="lineno"> 412</span> </div>
<div class="line"><a id="l00413" name="l00413"></a><span class="lineno"> 413</span> std::cout &lt;&lt; <span class="stringliteral">&quot;Time: &quot;</span> &lt;&lt; end - start &lt;&lt; <span class="stringliteral">&quot; seconds&quot;</span> &lt;&lt; std::endl;</div>
<div class="line"><a id="l00414" name="l00414"></a><span class="lineno"> 414</span> </div>
<div class="line"><a id="l00415" name="l00415"></a><span class="lineno"> 415</span> <span class="keywordflow">return</span> 0;</div>
<div class="line"><a id="l00416" name="l00416"></a><span class="lineno"> 416</span>}</div>
<div class="ttc" id="aPenningTrap_8hpp_html"><div class="ttname"><a href="PenningTrap_8hpp.html">PenningTrap.hpp</a></div><div class="ttdoc">A class for simulating a Penning trap.</div></div>
<div class="ttc" id="aclassParticle_html"><div class="ttname"><a href="classParticle.html">Particle</a></div><div class="ttdoc">A class that holds attributes of a particle.</div><div class="ttdef"><b>Definition:</b> <a href="Particle_8hpp_source.html#l00022">Particle.hpp:23</a></div></div>
<div class="ttc" id="aclassPenningTrap_html"><div class="ttname"><a href="classPenningTrap.html">PenningTrap</a></div><div class="ttdoc">A class that simulates a Penning trap.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8hpp_source.html#l00031">PenningTrap.hpp:32</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_aaee129f177657455348d0c8ae1441dea"><div class="ttname"><a href="classPenningTrap.html#aaee129f177657455348d0c8ae1441dea">PenningTrap::reinitialize</a></div><div class="ttdeci">void reinitialize(double f, double omega_V, double t=0.)</div><div class="ttdoc">Give all particles new positions and velocities, and change t and V_0.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00148">PenningTrap.cpp:148</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_ac529aa26c288f34eae184a67e6bac41f"><div class="ttname"><a href="classPenningTrap.html#ac529aa26c288f34eae184a67e6bac41f">PenningTrap::fraction_of_particles_left</a></div><div class="ttdeci">double fraction_of_particles_left(double time, uint steps, std::string method=&quot;rk4&quot;, bool particle_interaction=true)</div><div class="ttdoc">Simulate and calculate what fraction of particles are still left inside the Penning trap after the si...</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00297">PenningTrap.cpp:297</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_ad8bc4df7ab3eed53b16cfdff38e7760b"><div class="ttname"><a href="classPenningTrap.html#ad8bc4df7ab3eed53b16cfdff38e7760b">PenningTrap::write_simulation_to_dir</a></div><div class="ttdeci">void write_simulation_to_dir(std::string path, double time, uint steps, std::string method=&quot;rk4&quot;, bool particle_interaction=true)</div><div class="ttdoc">Simulate and write the displacement of all particles to files.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00259">PenningTrap.cpp:259</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a7a1d9f0528a12308de25bc30718da20a"><div class="ttname"><a href="classPenningTrap.html#a7a1d9f0528a12308de25bc30718da20a">PenningTrap::simulate</a></div><div class="ttdeci">simulation_t simulate(double time, uint steps, std::string method=&quot;rk4&quot;, bool particle_interaction=true)</div><div class="ttdoc">Simulate the particle system inside the Penning trap over a certain amount of time.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00240">PenningTrap.cpp:240</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_aaee129f177657455348d0c8ae1441dea"><div class="ttname"><a href="classPenningTrap.html#aaee129f177657455348d0c8ae1441dea">PenningTrap::reinitialize</a></div><div class="ttdeci">void reinitialize(double f, double omega_V, double t=0.)</div><div class="ttdoc">Give all particles new positions and velocities, and change t and V_0.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00153">PenningTrap.cpp:153</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_ac529aa26c288f34eae184a67e6bac41f"><div class="ttname"><a href="classPenningTrap.html#ac529aa26c288f34eae184a67e6bac41f">PenningTrap::fraction_of_particles_left</a></div><div class="ttdeci">double fraction_of_particles_left(double time, uint steps, std::string method=&quot;rk4&quot;, bool particle_interaction=true)</div><div class="ttdoc">Simulate and calculate what fraction of particles are still left inside the Penning trap after the si...</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00311">PenningTrap.cpp:311</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_ad8bc4df7ab3eed53b16cfdff38e7760b"><div class="ttname"><a href="classPenningTrap.html#ad8bc4df7ab3eed53b16cfdff38e7760b">PenningTrap::write_simulation_to_dir</a></div><div class="ttdeci">void write_simulation_to_dir(std::string path, double time, uint steps, std::string method=&quot;rk4&quot;, bool particle_interaction=true)</div><div class="ttdoc">Simulate and write the displacement of all particles to files.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00273">PenningTrap.cpp:273</a></div></div>
<div class="ttc" id="aconstants_8hpp_html"><div class="ttname"><a href="constants_8hpp.html">constants.hpp</a></div><div class="ttdoc">Library of constants.</div></div>
<div class="ttc" id="aconstants_8hpp_html_a0acb682b8260ab1c60b918599864e2e5"><div class="ttname"><a href="constants_8hpp.html#a0acb682b8260ab1c60b918599864e2e5">T</a></div><div class="ttdeci">#define T</div><div class="ttdoc">1 Tesla. unit:</div><div class="ttdef"><b>Definition:</b> <a href="constants_8hpp_source.html#l00021">constants.hpp:21</a></div></div>
<div class="ttc" id="aconstants_8hpp_html_a2ff491cc7958ffd5e749c518a4a60ec8"><div class="ttname"><a href="constants_8hpp.html#a2ff491cc7958ffd5e749c518a4a60ec8">CA_MASS</a></div><div class="ttdeci">#define CA_MASS</div><div class="ttdoc">Mass of a single calcium ion. unit: amu.</div><div class="ttdef"><b>Definition:</b> <a href="constants_8hpp_source.html#l00029">constants.hpp:29</a></div></div>
<div class="ttc" id="aconstants_8hpp_html_af40a326b23c68a27cebe60f16634a2cb"><div class="ttname"><a href="constants_8hpp.html#af40a326b23c68a27cebe60f16634a2cb">V</a></div><div class="ttdeci">#define V</div><div class="ttdoc">1 Volt. unit:</div><div class="ttdef"><b>Definition:</b> <a href="constants_8hpp_source.html#l00025">constants.hpp:25</a></div></div>
<div class="ttc" id="amain_8cpp_html_a213713d6ecc02a32b588ffd179dc7513"><div class="ttname"><a href="main_8cpp.html#a213713d6ecc02a32b588ffd179dc7513">simulate_100_particles</a></div><div class="ttdeci">void simulate_100_particles()</div><div class="ttdoc">Simulate 100 particles over 50 .</div><div class="ttdef"><b>Definition:</b> <a href="main_8cpp_source.html#l00132">main.cpp:132</a></div></div>
<div class="ttc" id="amain_8cpp_html_a213713d6ecc02a32b588ffd179dc7513"><div class="ttname"><a href="main_8cpp.html#a213713d6ecc02a32b588ffd179dc7513">simulate_100_particles</a></div><div class="ttdeci">void simulate_100_particles()</div><div class="ttdoc">Simulate 100 particles over 50 .</div><div class="ttdef"><b>Definition:</b> <a href="main_8cpp_source.html#l00134">main.cpp:134</a></div></div>
<div class="ttc" id="amain_8cpp_html_a2efa69bb9d93049429ce4637075f1d30"><div class="ttname"><a href="main_8cpp.html#a2efa69bb9d93049429ce4637075f1d30">p1</a></div><div class="ttdeci">Particle p1(vec3{20., 0., 20.}, vec3{0., 25., 0.})</div><div class="ttdoc">Particle 1.</div></div>
<div class="ttc" id="amain_8cpp_html_a33d9b1c76c3c80902f89a58b1a6d96ea"><div class="ttname"><a href="main_8cpp.html#a33d9b1c76c3c80902f89a58b1a6d96ea">potential_resonance_narrow_sweep</a></div><div class="ttdeci">void potential_resonance_narrow_sweep()</div><div class="ttdoc">Simulate 100 particles over 500 using a time dependent potential.</div><div class="ttdef"><b>Definition:</b> <a href="main_8cpp_source.html#l00206">main.cpp:206</a></div></div>
<div class="ttc" id="amain_8cpp_html_a6b38b477c18e2f4268779751a88edab1"><div class="ttname"><a href="main_8cpp.html#a6b38b477c18e2f4268779751a88edab1">potential_resonance_wide_sweep</a></div><div class="ttdeci">void potential_resonance_wide_sweep()</div><div class="ttdoc">Simulate 100 particles over 500 using a time dependent potential.</div><div class="ttdef"><b>Definition:</b> <a href="main_8cpp_source.html#l00149">main.cpp:149</a></div></div>
<div class="ttc" id="amain_8cpp_html_a783789519f97c6430081171cacb0ffb1"><div class="ttname"><a href="main_8cpp.html#a783789519f97c6430081171cacb0ffb1">simulate_two_particles</a></div><div class="ttdeci">void simulate_two_particles()</div><div class="ttdoc">Simulate 2 particles over the period of 50 with and without particle interactions.</div><div class="ttdef"><b>Definition:</b> <a href="main_8cpp_source.html#l00069">main.cpp:69</a></div></div>
<div class="ttc" id="amain_8cpp_html_a33d9b1c76c3c80902f89a58b1a6d96ea"><div class="ttname"><a href="main_8cpp.html#a33d9b1c76c3c80902f89a58b1a6d96ea">potential_resonance_narrow_sweep</a></div><div class="ttdeci">void potential_resonance_narrow_sweep()</div><div class="ttdoc">Simulate 100 particles over 500 using a time dependent potential.</div><div class="ttdef"><b>Definition:</b> <a href="main_8cpp_source.html#l00209">main.cpp:209</a></div></div>
<div class="ttc" id="amain_8cpp_html_a6b38b477c18e2f4268779751a88edab1"><div class="ttname"><a href="main_8cpp.html#a6b38b477c18e2f4268779751a88edab1">potential_resonance_wide_sweep</a></div><div class="ttdeci">void potential_resonance_wide_sweep()</div><div class="ttdoc">Simulate 100 particles over 500 using a time dependent potential.</div><div class="ttdef"><b>Definition:</b> <a href="main_8cpp_source.html#l00152">main.cpp:152</a></div></div>
<div class="ttc" id="amain_8cpp_html_a783789519f97c6430081171cacb0ffb1"><div class="ttname"><a href="main_8cpp.html#a783789519f97c6430081171cacb0ffb1">simulate_two_particles</a></div><div class="ttdeci">void simulate_two_particles()</div><div class="ttdoc">Simulate 2 particles over the period of 50 with and without particle interactions.</div><div class="ttdef"><b>Definition:</b> <a href="main_8cpp_source.html#l00070">main.cpp:70</a></div></div>
<div class="ttc" id="amain_8cpp_html_a8d92fb2ad085065fbd14718647551657"><div class="ttname"><a href="main_8cpp.html#a8d92fb2ad085065fbd14718647551657">analytical_solution_particle_1</a></div><div class="ttdeci">vec3 analytical_solution_particle_1(double t)</div><div class="ttdoc">The analytical solution for particle p1.</div><div class="ttdef"><b>Definition:</b> <a href="main_8cpp_source.html#l00037">main.cpp:37</a></div></div>
<div class="ttc" id="amain_8cpp_html_a8fdbe2d5a872e50ef5ec1263243589d6"><div class="ttname"><a href="main_8cpp.html#a8fdbe2d5a872e50ef5ec1263243589d6">simulate_single_particle</a></div><div class="ttdeci">void simulate_single_particle()</div><div class="ttdoc">Simulate a single particle over the period of 50 .</div><div class="ttdef"><b>Definition:</b> <a href="main_8cpp_source.html#l00054">main.cpp:54</a></div></div>
<div class="ttc" id="amain_8cpp_html_ac1816f70ec612edc27848ef7f0875fdb"><div class="ttname"><a href="main_8cpp.html#ac1816f70ec612edc27848ef7f0875fdb">potential_resonance_narrow_sweep_interaction</a></div><div class="ttdeci">void potential_resonance_narrow_sweep_interaction()</div><div class="ttdoc">Simulate 100 particles over 500 using a time dependent potential.</div><div class="ttdef"><b>Definition:</b> <a href="main_8cpp_source.html#l00262">main.cpp:262</a></div></div>
<div class="ttc" id="amain_8cpp_html_ac67e0d59227856c4d42e7d01c75e0ad2"><div class="ttname"><a href="main_8cpp.html#ac67e0d59227856c4d42e7d01c75e0ad2">simulate_single_particle_with_different_steps</a></div><div class="ttdeci">void simulate_single_particle_with_different_steps()</div><div class="ttdoc">Simulate a single particle over 50 using different amount of steps and different methods.</div><div class="ttdef"><b>Definition:</b> <a href="main_8cpp_source.html#l00087">main.cpp:87</a></div></div>
<div class="ttc" id="amain_8cpp_html_a8fdbe2d5a872e50ef5ec1263243589d6"><div class="ttname"><a href="main_8cpp.html#a8fdbe2d5a872e50ef5ec1263243589d6">simulate_single_particle</a></div><div class="ttdeci">void simulate_single_particle()</div><div class="ttdoc">Simulate a single particle over the period of 50 .</div><div class="ttdef"><b>Definition:</b> <a href="main_8cpp_source.html#l00055">main.cpp:55</a></div></div>
<div class="ttc" id="amain_8cpp_html_ac1816f70ec612edc27848ef7f0875fdb"><div class="ttname"><a href="main_8cpp.html#ac1816f70ec612edc27848ef7f0875fdb">potential_resonance_narrow_sweep_interaction</a></div><div class="ttdeci">void potential_resonance_narrow_sweep_interaction()</div><div class="ttdoc">Simulate 100 particles over 500 using a time dependent potential.</div><div class="ttdef"><b>Definition:</b> <a href="main_8cpp_source.html#l00266">main.cpp:266</a></div></div>
<div class="ttc" id="amain_8cpp_html_ac67e0d59227856c4d42e7d01c75e0ad2"><div class="ttname"><a href="main_8cpp.html#ac67e0d59227856c4d42e7d01c75e0ad2">simulate_single_particle_with_different_steps</a></div><div class="ttdeci">void simulate_single_particle_with_different_steps()</div><div class="ttdoc">Simulate a single particle over 50 using different amount of steps and different methods.</div><div class="ttdef"><b>Definition:</b> <a href="main_8cpp_source.html#l00088">main.cpp:88</a></div></div>
<div class="ttc" id="amain_8cpp_html_ac70b61df65f4336f57ea9b4c35250df7"><div class="ttname"><a href="main_8cpp.html#ac70b61df65f4336f57ea9b4c35250df7">p2</a></div><div class="ttdeci">Particle p2(vec3{25., 25., 0.}, vec3{0., 40., 5.})</div><div class="ttdoc">Particle 2.</div></div>
<div class="ttc" id="astructsimulation_html"><div class="ttname"><a href="structsimulation.html">simulation</a></div><div class="ttdoc">Typedef for PenningTrap::simulation return value.</div><div class="ttdef"><b>Definition:</b> <a href="typedefs_8hpp_source.html#l00040">typedefs.hpp:40</a></div></div>
<div class="ttc" id="atypedefs_8hpp_html_a3bdfb73a02f88ae32b6128ef747c4aea"><div class="ttname"><a href="typedefs_8hpp.html#a3bdfb73a02f88ae32b6128ef747c4aea">vec3</a></div><div class="ttdeci">arma::vec::fixed&lt; 3 &gt; vec3</div><div class="ttdoc">Typedef for a fixed 3d arma vector.</div><div class="ttdef"><b>Definition:</b> <a href="typedefs_8hpp_source.html#l00023">typedefs.hpp:23</a></div></div>

177
docs/namespaceplot__3d.html Normal file
View File

@@ -0,0 +1,177 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.9.6"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Penning Trap Simulation: plot_3d Namespace Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
extensions: ["tex2jax.js"],
jax: ["input/TeX","output/HTML-CSS"],
});
</script>
<script type="text/javascript" async="async" src="https://cdn.jsdelivr.net/npm/mathjax@2/MathJax.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="doxygen-awesome.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr id="projectrow">
<td id="projectalign">
<div id="projectname">Penning Trap Simulation
</div>
<div id="projectbrief">Simulate particle behavior inside a Penning Trap</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.6 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search/",'.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(document).ready(function(){initNavTree('namespaceplot__3d.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<div id="MSearchResults">
<div class="SRPage">
<div id="SRIndex">
<div id="SRResults"></div>
<div class="SRStatus" id="Loading">Loading...</div>
<div class="SRStatus" id="Searching">Searching...</div>
<div class="SRStatus" id="NoMatches">No Matches</div>
</div>
</div>
</div>
</div>
<div class="header">
<div class="summary">
<a href="#func-members">Functions</a> &#124;
<a href="#var-members">Variables</a> </div>
<div class="headertitle"><div class="title">plot_3d Namespace Reference</div></div>
</div><!--header-->
<div class="contents">
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="func-members" name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:adb8902df55180f4ad62fb3799bc5c5a8"><td class="memItemLeft" align="right" valign="top">def&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespaceplot__3d.html#adb8902df55180f4ad62fb3799bc5c5a8">main</a> ()</td></tr>
<tr class="separator:adb8902df55180f4ad62fb3799bc5c5a8"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="var-members" name="var-members"></a>
Variables</h2></td></tr>
<tr class="memitem:a7026cb07859df7ff6b3fb60453573467"><td class="memItemLeft" align="right" valign="top">dict&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespaceplot__3d.html#a7026cb07859df7ff6b3fb60453573467">params</a></td></tr>
<tr class="separator:a7026cb07859df7ff6b3fb60453573467"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><pre class="fragment"> @package plot_3d</pre> </div><h2 class="groupheader">Function Documentation</h2>
<a id="adb8902df55180f4ad62fb3799bc5c5a8" name="adb8902df55180f4ad62fb3799bc5c5a8"></a>
<h2 class="memtitle"><span class="permalink"><a href="#adb8902df55180f4ad62fb3799bc5c5a8">&#9670;&#160;</a></span>main()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">def plot_3d.main </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p class="definition">Definition at line <a class="el" href="plot__3d_8py_source.html#l00022">22</a> of file <a class="el" href="plot__3d_8py_source.html">plot_3d.py</a>.</p>
</div>
</div>
<h2 class="groupheader">Variable Documentation</h2>
<a id="a7026cb07859df7ff6b3fb60453573467" name="a7026cb07859df7ff6b3fb60453573467"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a7026cb07859df7ff6b3fb60453573467">&#9670;&#160;</a></span>params</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">dict plot_3d.params</td>
</tr>
</table>
</div><div class="memdoc">
<b>Initial value:</b><div class="fragment"><div class="line"><span class="lineno"> 1</span>= {</div>
<div class="line"><span class="lineno"> 2</span> <span class="stringliteral">&quot;font.family&quot;</span>: <span class="stringliteral">&quot;Serif&quot;</span>,</div>
<div class="line"><span class="lineno"> 3</span> <span class="stringliteral">&quot;font.serif&quot;</span>: <span class="stringliteral">&quot;Roman&quot;</span>, </div>
<div class="line"><span class="lineno"> 4</span> <span class="stringliteral">&quot;text.usetex&quot;</span>: <span class="keyword">True</span>,</div>
<div class="line"><span class="lineno"> 5</span> <span class="stringliteral">&quot;axes.titlesize&quot;</span>: <span class="stringliteral">&quot;large&quot;</span>,</div>
<div class="line"><span class="lineno"> 6</span> <span class="stringliteral">&quot;axes.labelsize&quot;</span>: <span class="stringliteral">&quot;large&quot;</span>,</div>
<div class="line"><span class="lineno"> 7</span> <span class="stringliteral">&quot;xtick.labelsize&quot;</span>: <span class="stringliteral">&quot;large&quot;</span>,</div>
<div class="line"><span class="lineno"> 8</span> <span class="stringliteral">&quot;ytick.labelsize&quot;</span>: <span class="stringliteral">&quot;large&quot;</span>,</div>
<div class="line"><span class="lineno"> 9</span> <span class="stringliteral">&quot;legend.fontsize&quot;</span>: <span class="stringliteral">&quot;medium&quot;</span>,</div>
<div class="line"><span class="lineno"> 10</span> <span class="stringliteral">&quot;figure.autolayout&quot;</span>: <span class="keyword">True</span></div>
<div class="line"><span class="lineno"> 11</span>}</div>
</div><!-- fragment -->
<p class="definition">Definition at line <a class="el" href="plot__3d_8py_source.html#l00009">9</a> of file <a class="el" href="plot__3d_8py_source.html">plot_3d.py</a>.</p>
</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="navelem"><a class="el" href="namespaceplot__3d.html">plot_3d</a></li>
<li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.6 </li>
</ul>
</div>
</body>
</html>

118
docs/namespaces.html Normal file
View File

@@ -0,0 +1,118 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.9.6"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Penning Trap Simulation: Namespace List</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
extensions: ["tex2jax.js"],
jax: ["input/TeX","output/HTML-CSS"],
});
</script>
<script type="text/javascript" async="async" src="https://cdn.jsdelivr.net/npm/mathjax@2/MathJax.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="doxygen-awesome.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr id="projectrow">
<td id="projectalign">
<div id="projectname">Penning Trap Simulation
</div>
<div id="projectbrief">Simulate particle behavior inside a Penning Trap</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.6 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search/",'.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(document).ready(function(){initNavTree('namespaces.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<div id="MSearchResults">
<div class="SRPage">
<div id="SRIndex">
<div id="SRResults"></div>
<div class="SRStatus" id="Loading">Loading...</div>
<div class="SRStatus" id="Searching">Searching...</div>
<div class="SRStatus" id="NoMatches">No Matches</div>
</div>
</div>
</div>
</div>
<div class="header">
<div class="headertitle"><div class="title">Namespace List</div></div>
</div><!--header-->
<div class="contents">
<div class="textblock">Here is a list of all documented namespaces with brief descriptions:</div><div class="directory">
<table class="directory">
<tr id="row_0_" class="even"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><span class="icona"><span class="icon">N</span></span><a class="el" href="namespaceplot__3d.html" target="_self">plot_3d</a></td><td class="desc"></td></tr>
</table>
</div><!-- directory -->
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.6 </li>
</ul>
</div>
</body>
</html>

4
docs/namespaces_dup.js Normal file
View File

@@ -0,0 +1,4 @@
var namespaces_dup =
[
[ "plot_3d", "namespaceplot__3d.html", null ]
];

View File

@@ -27,17 +27,23 @@ var NAVTREE =
[ "Penning Trap Simulation", "index.html", [
[ "Requirements", "index.html#autotoc_md1", [
[ "Operating systems", "index.html#autotoc_md2", null ],
[ "Libraries", "index.html#autotoc_md3", null ]
[ "Tools", "index.html#autotoc_md3", null ],
[ "Libraries", "index.html#autotoc_md4", null ]
] ],
[ "Compiling", "index.html#autotoc_md4", null ],
[ "Running programs", "index.html#autotoc_md5", [
[ "C++ binaries", "index.html#autotoc_md6", null ],
[ "Python scripts", "index.html#autotoc_md7", [
[ "Install libraries", "index.html#autotoc_md8", null ],
[ "Running scripts", "index.html#autotoc_md9", null ]
] ]
[ "Compiling", "index.html#autotoc_md5", null ],
[ "Running programs", "index.html#autotoc_md6", [
[ "C++ binaries", "index.html#autotoc_md7", null ],
[ "Python scripts", "index.html#autotoc_md8", [
[ "Install libraries", "index.html#autotoc_md9", null ],
[ "Running scripts", "index.html#autotoc_md10", null ]
] ],
[ "Credits", "index.html#autotoc_md10", null ],
[ "Batch system", "index.html#autotoc_md11", null ]
] ],
[ "Performance", "index.html#autotoc_md12", [
[ "CPU", "index.html#autotoc_md13", null ],
[ "Times", "index.html#autotoc_md14", null ]
] ],
[ "Credits", "index.html#autotoc_md15", null ],
[ "Bug List", "bug.html", null ],
[ "Classes", "annotated.html", [
[ "Class List", "annotated.html", "annotated_dup" ],

View File

@@ -1,134 +1,151 @@
var NAVTREEINDEX0 =
{
"Particle_8cpp.html":[6,0,1,2],
"Particle_8cpp_source.html":[6,0,1,2],
"Particle_8hpp.html":[6,0,0,1],
"Particle_8hpp_source.html":[6,0,0,1],
"PenningTrap_8cpp.html":[6,0,1,3],
"PenningTrap_8cpp_source.html":[6,0,1,3],
"PenningTrap_8hpp.html":[6,0,0,2],
"PenningTrap_8hpp_source.html":[6,0,0,2],
"animate__100__particles_8py_source.html":[6,0,1,0,0],
"annotated.html":[5,0],
"bug.html":[4],
"classParticle.html":[5,0,0],
"classParticle.html#a1c59101411db43624828b766f87ad460":[5,0,0,4],
"classParticle.html#a3a10400add8dd22b8031330c2aafb6fe":[5,0,0,5],
"classParticle.html#a566dcc1de4bdc01251776948798ea8e1":[5,0,0,3],
"classParticle.html#aa797d319549dc2a0beb06cdbfd430232":[5,0,0,1],
"classParticle.html#aedcc7e1bc53b0e2b1a4a07c9a1b47563":[5,0,0,2],
"classParticle.html#af1d7535fb8311eaa77d2b7b345882ec4":[5,0,0,0],
"classPenningTrap.html":[5,0,1],
"classPenningTrap.html#a0112525d9e79a472e761f8ef402a339f":[5,0,1,24],
"classPenningTrap.html#a0cac3509aa96e71a26d3b2c902e27716":[5,0,1,20],
"classPenningTrap.html#a2c01108b52c8e2a003cf9170da9e7682":[5,0,1,15],
"classPenningTrap.html#a2f168622587709b9e3c49077f0b9a640":[5,0,1,22],
"classPenningTrap.html#a2fe1cefbae18fa5808155ee0d2df713c":[5,0,1,16],
"classPenningTrap.html#a361f2c4862c90b5e8e2a2f50c6a95655":[5,0,1,6],
"classPenningTrap.html#a36946152fd951b1f7c346c51ff900d8e":[5,0,1,5],
"classPenningTrap.html#a3c0a44e4e0a94366ff609e81fe463fa2":[5,0,1,17],
"classPenningTrap.html#a5846c8f75cdc543fd9cf0b2185a3ef22":[5,0,1,7],
"classPenningTrap.html#a5b6c6d4636f3a6e279ccde59d4a345e8":[5,0,1,0],
"classPenningTrap.html#a66dfe89c68716b9502927b97f59c27d2":[5,0,1,21],
"classPenningTrap.html#a6e9776ff5b149f01080800716455d7c8":[5,0,1,3],
"classPenningTrap.html#a715329844d75ec4c04f8391421fb4e89":[5,0,1,27],
"classPenningTrap.html#a7a1d9f0528a12308de25bc30718da20a":[5,0,1,13],
"classPenningTrap.html#a7f210bb2768a5d79ced4b0df0df97598":[5,0,1,8],
"classPenningTrap.html#a826b7fa8e709d481eb1dee7d0c2cdc08":[5,0,1,10],
"classPenningTrap.html#a830be1b8cbf59664e060b6edbeaa302f":[5,0,1,1],
"classPenningTrap.html#a869f032f37d0569ed16f224b4c4356ae":[5,0,1,19],
"classPenningTrap.html#a8ca4e21291f60fde619c14099d8c4e8e":[5,0,1,26],
"classPenningTrap.html#a9a301b0540078c36697880ef204afdf3":[5,0,1,14],
"classPenningTrap.html#a9d1d8e90ca839b928aee1ad0cd4aff43":[5,0,1,12],
"classPenningTrap.html#aaee129f177657455348d0c8ae1441dea":[5,0,1,11],
"classPenningTrap.html#ab9ea97a406534bbe621a95215144875e":[5,0,1,4],
"classPenningTrap.html#ac529aa26c288f34eae184a67e6bac41f":[5,0,1,9],
"classPenningTrap.html#ad8bc4df7ab3eed53b16cfdff38e7760b":[5,0,1,18],
"classPenningTrap.html#addc96789dcfec07b75156e19fee82f4f":[5,0,1,2],
"classPenningTrap.html#ae915f6ad0eef1fb46530e836b6e071e5":[5,0,1,25],
"classPenningTrap.html#ae9b5afdaa5cd366e94bd294452a1eed4":[5,0,1,23],
"classPenningTrapTest.html":[5,0,2],
"classPenningTrapTest.html#a5f4f0b150e54ce463bb29f76d49883f9":[5,0,2,2],
"classPenningTrapTest.html#a68449d508e66205bc8b27fa5f60db508":[5,0,2,4],
"classPenningTrapTest.html#a6a303be62039ca2ecccd8252744d4dc8":[5,0,2,1],
"classPenningTrapTest.html#ad668d7d875bdc1909a42426bf9dead9e":[5,0,2,0],
"classPenningTrapTest.html#ae6d0c8e0d80338fb7c7edefc97331046":[5,0,2,3],
"classes.html":[5,1],
"constants_8hpp.html":[6,0,0,0],
"constants_8hpp.html#a0acb682b8260ab1c60b918599864e2e5":[6,0,0,0,3],
"constants_8hpp.html#a2ff491cc7958ffd5e749c518a4a60ec8":[6,0,0,0,1],
"constants_8hpp.html#a4e451456ad7e9276ed0afa42826e7ccb":[6,0,0,0,2],
"constants_8hpp.html#af40a326b23c68a27cebe60f16634a2cb":[6,0,0,0,4],
"constants_8hpp.html#af7602a3a314957137ad1cd719aa23789":[6,0,0,0,0],
"constants_8hpp_source.html":[6,0,0,0],
"dir_634e799a3947388232110823971192a8.html":[6,0,1,0],
"dir_68267d1309a1af8e8297ef4c3efbcdba.html":[6,0,1],
"dir_d44c64559bbebec7f509842c48db8b23.html":[6,0,0],
"files.html":[6,0],
"functions.html":[5,2,0],
"functions_func.html":[5,2,1],
"functions_rela.html":[5,2,3],
"functions_vars.html":[5,2,2],
"globals.html":[6,1,0],
"globals_defs.html":[6,1,4],
"globals_func.html":[6,1,1],
"globals_type.html":[6,1,3],
"globals_vars.html":[6,1,2],
"Particle_8cpp.html":[7,0,1,3],
"Particle_8cpp_source.html":[7,0,1,3],
"Particle_8hpp.html":[7,0,0,1],
"Particle_8hpp_source.html":[7,0,0,1],
"PenningTrap_8cpp.html":[7,0,1,4],
"PenningTrap_8cpp_source.html":[7,0,1,4],
"PenningTrap_8hpp.html":[7,0,0,2],
"PenningTrap_8hpp_source.html":[7,0,0,2],
"animate__100__particles_8py.html":[7,0,1,0,0],
"animate__100__particles_8py_source.html":[7,0,1,0,0],
"annotated.html":[6,0],
"bug.html":[5],
"classParticle.html":[6,0,0],
"classParticle.html#a1c59101411db43624828b766f87ad460":[6,0,0,4],
"classParticle.html#a3a10400add8dd22b8031330c2aafb6fe":[6,0,0,5],
"classParticle.html#a566dcc1de4bdc01251776948798ea8e1":[6,0,0,3],
"classParticle.html#aa797d319549dc2a0beb06cdbfd430232":[6,0,0,1],
"classParticle.html#aedcc7e1bc53b0e2b1a4a07c9a1b47563":[6,0,0,2],
"classParticle.html#af1d7535fb8311eaa77d2b7b345882ec4":[6,0,0,0],
"classPenningTrap.html":[6,0,1],
"classPenningTrap.html#a0112525d9e79a472e761f8ef402a339f":[6,0,1,25],
"classPenningTrap.html#a0cac3509aa96e71a26d3b2c902e27716":[6,0,1,21],
"classPenningTrap.html#a2c01108b52c8e2a003cf9170da9e7682":[6,0,1,15],
"classPenningTrap.html#a2f168622587709b9e3c49077f0b9a640":[6,0,1,23],
"classPenningTrap.html#a2fe1cefbae18fa5808155ee0d2df713c":[6,0,1,17],
"classPenningTrap.html#a361f2c4862c90b5e8e2a2f50c6a95655":[6,0,1,6],
"classPenningTrap.html#a36946152fd951b1f7c346c51ff900d8e":[6,0,1,5],
"classPenningTrap.html#a3c0a44e4e0a94366ff609e81fe463fa2":[6,0,1,18],
"classPenningTrap.html#a5846c8f75cdc543fd9cf0b2185a3ef22":[6,0,1,7],
"classPenningTrap.html#a5b6c6d4636f3a6e279ccde59d4a345e8":[6,0,1,0],
"classPenningTrap.html#a6069f82d8dbc7cadaebd228dbcd95018":[6,0,1,16],
"classPenningTrap.html#a66dfe89c68716b9502927b97f59c27d2":[6,0,1,22],
"classPenningTrap.html#a6e9776ff5b149f01080800716455d7c8":[6,0,1,3],
"classPenningTrap.html#a715329844d75ec4c04f8391421fb4e89":[6,0,1,28],
"classPenningTrap.html#a7a1d9f0528a12308de25bc30718da20a":[6,0,1,13],
"classPenningTrap.html#a7f210bb2768a5d79ced4b0df0df97598":[6,0,1,8],
"classPenningTrap.html#a826b7fa8e709d481eb1dee7d0c2cdc08":[6,0,1,10],
"classPenningTrap.html#a830be1b8cbf59664e060b6edbeaa302f":[6,0,1,1],
"classPenningTrap.html#a869f032f37d0569ed16f224b4c4356ae":[6,0,1,20],
"classPenningTrap.html#a8ca4e21291f60fde619c14099d8c4e8e":[6,0,1,27],
"classPenningTrap.html#a9a301b0540078c36697880ef204afdf3":[6,0,1,14],
"classPenningTrap.html#a9d1d8e90ca839b928aee1ad0cd4aff43":[6,0,1,12],
"classPenningTrap.html#aaee129f177657455348d0c8ae1441dea":[6,0,1,11],
"classPenningTrap.html#ab9ea97a406534bbe621a95215144875e":[6,0,1,4],
"classPenningTrap.html#ac529aa26c288f34eae184a67e6bac41f":[6,0,1,9],
"classPenningTrap.html#ad8bc4df7ab3eed53b16cfdff38e7760b":[6,0,1,19],
"classPenningTrap.html#addc96789dcfec07b75156e19fee82f4f":[6,0,1,2],
"classPenningTrap.html#ae915f6ad0eef1fb46530e836b6e071e5":[6,0,1,26],
"classPenningTrap.html#ae9b5afdaa5cd366e94bd294452a1eed4":[6,0,1,24],
"classPenningTrapTest.html":[6,0,2],
"classPenningTrapTest.html#a5f4f0b150e54ce463bb29f76d49883f9":[6,0,2,2],
"classPenningTrapTest.html#a68449d508e66205bc8b27fa5f60db508":[6,0,2,4],
"classPenningTrapTest.html#a6a303be62039ca2ecccd8252744d4dc8":[6,0,2,1],
"classPenningTrapTest.html#ad668d7d875bdc1909a42426bf9dead9e":[6,0,2,0],
"classPenningTrapTest.html#ae6d0c8e0d80338fb7c7edefc97331046":[6,0,2,3],
"classes.html":[6,1],
"constants_8hpp.html":[7,0,0,0],
"constants_8hpp.html#a0acb682b8260ab1c60b918599864e2e5":[7,0,0,0,3],
"constants_8hpp.html#a2ff491cc7958ffd5e749c518a4a60ec8":[7,0,0,0,1],
"constants_8hpp.html#a4e451456ad7e9276ed0afa42826e7ccb":[7,0,0,0,2],
"constants_8hpp.html#af40a326b23c68a27cebe60f16634a2cb":[7,0,0,0,4],
"constants_8hpp.html#af7602a3a314957137ad1cd719aa23789":[7,0,0,0,0],
"constants_8hpp_source.html":[7,0,0,0],
"dir_634e799a3947388232110823971192a8.html":[7,0,1,0],
"dir_68267d1309a1af8e8297ef4c3efbcdba.html":[7,0,1],
"dir_d44c64559bbebec7f509842c48db8b23.html":[7,0,0],
"files.html":[7,0],
"frequency__narrow__sweeps__long_8cpp.html":[7,0,1,1],
"frequency__narrow__sweeps__long_8cpp.html#a33d9b1c76c3c80902f89a58b1a6d96ea":[7,0,1,1,0],
"frequency__narrow__sweeps__long_8cpp.html#ac1816f70ec612edc27848ef7f0875fdb":[7,0,1,1,1],
"frequency__narrow__sweeps__long_8cpp_source.html":[7,0,1,1],
"functions.html":[6,2,0],
"functions_func.html":[6,2,1],
"functions_rela.html":[6,2,3],
"functions_vars.html":[6,2,2],
"globals.html":[7,1,0],
"globals_defs.html":[7,1,4],
"globals_func.html":[7,1,1],
"globals_type.html":[7,1,3],
"globals_vars.html":[7,1,2],
"index.html":[],
"index.html#autotoc_md1":[0],
"index.html#autotoc_md10":[3],
"index.html#autotoc_md10":[2,1,1],
"index.html#autotoc_md11":[2,2],
"index.html#autotoc_md12":[3],
"index.html#autotoc_md13":[3,0],
"index.html#autotoc_md14":[3,1],
"index.html#autotoc_md15":[4],
"index.html#autotoc_md2":[0,0],
"index.html#autotoc_md3":[0,1],
"index.html#autotoc_md4":[1],
"index.html#autotoc_md5":[2],
"index.html#autotoc_md6":[2,0],
"index.html#autotoc_md7":[2,1],
"index.html#autotoc_md8":[2,1,0],
"index.html#autotoc_md9":[2,1,1],
"main_8cpp.html":[6,0,1,1],
"main_8cpp.html#a213713d6ecc02a32b588ffd179dc7513":[6,0,1,1,4],
"main_8cpp.html#a2efa69bb9d93049429ce4637075f1d30":[6,0,1,1,8],
"main_8cpp.html#a33d9b1c76c3c80902f89a58b1a6d96ea":[6,0,1,1,1],
"main_8cpp.html#a6b38b477c18e2f4268779751a88edab1":[6,0,1,1,3],
"main_8cpp.html#a783789519f97c6430081171cacb0ffb1":[6,0,1,1,7],
"main_8cpp.html#a8d92fb2ad085065fbd14718647551657":[6,0,1,1,0],
"main_8cpp.html#a8fdbe2d5a872e50ef5ec1263243589d6":[6,0,1,1,5],
"main_8cpp.html#ac1816f70ec612edc27848ef7f0875fdb":[6,0,1,1,2],
"main_8cpp.html#ac67e0d59227856c4d42e7d01c75e0ad2":[6,0,1,1,6],
"main_8cpp.html#ac70b61df65f4336f57ea9b4c35250df7":[6,0,1,1,9],
"main_8cpp_source.html":[6,0,1,1],
"index.html#autotoc_md4":[0,2],
"index.html#autotoc_md5":[1],
"index.html#autotoc_md6":[2],
"index.html#autotoc_md7":[2,0],
"index.html#autotoc_md8":[2,1],
"index.html#autotoc_md9":[2,1,0],
"main_8cpp.html":[7,0,1,2],
"main_8cpp.html#a213713d6ecc02a32b588ffd179dc7513":[7,0,1,2,4],
"main_8cpp.html#a2efa69bb9d93049429ce4637075f1d30":[7,0,1,2,8],
"main_8cpp.html#a33d9b1c76c3c80902f89a58b1a6d96ea":[7,0,1,2,1],
"main_8cpp.html#a6b38b477c18e2f4268779751a88edab1":[7,0,1,2,3],
"main_8cpp.html#a783789519f97c6430081171cacb0ffb1":[7,0,1,2,7],
"main_8cpp.html#a8d92fb2ad085065fbd14718647551657":[7,0,1,2,0],
"main_8cpp.html#a8fdbe2d5a872e50ef5ec1263243589d6":[7,0,1,2,5],
"main_8cpp.html#ac1816f70ec612edc27848ef7f0875fdb":[7,0,1,2,2],
"main_8cpp.html#ac67e0d59227856c4d42e7d01c75e0ad2":[7,0,1,2,6],
"main_8cpp.html#ac70b61df65f4336f57ea9b4c35250df7":[7,0,1,2,9],
"main_8cpp_source.html":[7,0,1,2],
"pages.html":[],
"plot__2__particles_8py_source.html":[6,0,1,0,1],
"plot__3d_8py_source.html":[6,0,1,0,2],
"plot__particles__left_8py_source.html":[6,0,1,0,3],
"plot__phase__space_8py_source.html":[6,0,1,0,4],
"plot__relative__error_8py_source.html":[6,0,1,0,5],
"plot__single__particle_8py_source.html":[6,0,1,0,6],
"structsimulation.html":[5,0,3],
"test__suite_8cpp.html":[6,0,1,4],
"test__suite_8cpp_source.html":[6,0,1,4],
"typedefs_8hpp.html":[6,0,0,3],
"typedefs_8hpp.html#a33418f31f28663b8414c8f7182998c22":[6,0,0,3,3],
"typedefs_8hpp.html#a3bdfb73a02f88ae32b6128ef747c4aea":[6,0,0,3,5],
"typedefs_8hpp.html#a46482a2697556c00556c9d73f461784f":[6,0,0,3,2],
"typedefs_8hpp.html#a784799c37b5e4fb8bf4f6368e004dec6":[6,0,0,3,4],
"typedefs_8hpp.html#aec69d34220fff45de238b9e01f2686af":[6,0,0,3,1],
"typedefs_8hpp_source.html":[6,0,0,3],
"utils_8cpp.html":[6,0,1,5],
"utils_8cpp.html#a58565270b643b24e3132f38c653e0199":[6,0,1,5,3],
"utils_8cpp.html#a6be6f938bcbb235ebb6a2ed9d08411b2":[6,0,1,5,0],
"utils_8cpp.html#acd2a9c7a7d5a7fe9163be8c4cc110746":[6,0,1,5,4],
"utils_8cpp.html#acf13f4e492199cb7231bfa646dbd08de":[6,0,1,5,2],
"utils_8cpp.html#aff5e07c3c1d321709b0cc38e999f427b":[6,0,1,5,1],
"utils_8cpp_source.html":[6,0,1,5],
"utils_8hpp.html":[6,0,0,4],
"utils_8hpp.html#a2cc3a2cdb635bac3c8b02e89d4d6af38":[6,0,0,4,4],
"utils_8hpp.html#a60dca3177fb9cb5256609adc7af55168":[6,0,0,4,0],
"utils_8hpp.html#a6fdd7217b750aff5b6295ece7cbdeffa":[6,0,0,4,5],
"utils_8hpp.html#a73d4f21ad937dbc50a0c0538c78fd4f9":[6,0,0,4,1],
"utils_8hpp.html#ab3e0cf669bddc59bd53998490ffb68b9":[6,0,0,4,3],
"utils_8hpp.html#ad54b96a1074f9df4dc892a41d115b72d":[6,0,0,4,6],
"utils_8hpp.html#adfb618b2fdff47ef30a4a2b62c04f384":[6,0,0,4,7],
"utils_8hpp.html#aecc1f7a8a2493b9e021e5bff76a00a5b":[6,0,0,4,2],
"utils_8hpp_source.html":[6,0,0,4]
"plot__2__particles_8py.html":[7,0,1,0,1],
"plot__2__particles_8py_source.html":[7,0,1,0,1],
"plot__3d_8py.html":[7,0,1,0,2],
"plot__3d_8py_source.html":[7,0,1,0,2],
"plot__particles__left_8py.html":[7,0,1,0,3],
"plot__particles__left_8py_source.html":[7,0,1,0,3],
"plot__phase__space_8py.html":[7,0,1,0,4],
"plot__phase__space_8py_source.html":[7,0,1,0,4],
"plot__relative__error_8py.html":[7,0,1,0,5],
"plot__relative__error_8py_source.html":[7,0,1,0,5],
"plot__single__particle_8py.html":[7,0,1,0,6],
"plot__single__particle_8py_source.html":[7,0,1,0,6],
"structsimulation.html":[6,0,3],
"test__suite_8cpp.html":[7,0,1,5],
"test__suite_8cpp_source.html":[7,0,1,5],
"typedefs_8hpp.html":[7,0,0,3],
"typedefs_8hpp.html#a33418f31f28663b8414c8f7182998c22":[7,0,0,3,3],
"typedefs_8hpp.html#a3bdfb73a02f88ae32b6128ef747c4aea":[7,0,0,3,5],
"typedefs_8hpp.html#a46482a2697556c00556c9d73f461784f":[7,0,0,3,2],
"typedefs_8hpp.html#a784799c37b5e4fb8bf4f6368e004dec6":[7,0,0,3,4],
"typedefs_8hpp.html#aec69d34220fff45de238b9e01f2686af":[7,0,0,3,1],
"typedefs_8hpp_source.html":[7,0,0,3],
"utils_8cpp.html":[7,0,1,6],
"utils_8cpp.html#a58565270b643b24e3132f38c653e0199":[7,0,1,6,3],
"utils_8cpp.html#a6be6f938bcbb235ebb6a2ed9d08411b2":[7,0,1,6,0],
"utils_8cpp.html#acd2a9c7a7d5a7fe9163be8c4cc110746":[7,0,1,6,4],
"utils_8cpp.html#acf13f4e492199cb7231bfa646dbd08de":[7,0,1,6,2],
"utils_8cpp.html#aff5e07c3c1d321709b0cc38e999f427b":[7,0,1,6,1],
"utils_8cpp_source.html":[7,0,1,6],
"utils_8hpp.html":[7,0,0,4],
"utils_8hpp.html#a2cc3a2cdb635bac3c8b02e89d4d6af38":[7,0,0,4,4],
"utils_8hpp.html#a60dca3177fb9cb5256609adc7af55168":[7,0,0,4,0],
"utils_8hpp.html#a6fdd7217b750aff5b6295ece7cbdeffa":[7,0,0,4,5],
"utils_8hpp.html#a73d4f21ad937dbc50a0c0538c78fd4f9":[7,0,0,4,1],
"utils_8hpp.html#ab3e0cf669bddc59bd53998490ffb68b9":[7,0,0,4,3],
"utils_8hpp.html#ad54b96a1074f9df4dc892a41d115b72d":[7,0,0,4,6],
"utils_8hpp.html#adfb618b2fdff47ef30a4a2b62c04f384":[7,0,0,4,7],
"utils_8hpp.html#aecc1f7a8a2493b9e021e5bff76a00a5b":[7,0,0,4,2],
"utils_8hpp_source.html":[7,0,0,4]
};

View File

@@ -0,0 +1,189 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.9.6"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Penning Trap Simulation: src/scripts/plot_2_particles.py File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
extensions: ["tex2jax.js"],
jax: ["input/TeX","output/HTML-CSS"],
});
</script>
<script type="text/javascript" async="async" src="https://cdn.jsdelivr.net/npm/mathjax@2/MathJax.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="doxygen-awesome.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr id="projectrow">
<td id="projectalign">
<div id="projectname">Penning Trap Simulation
</div>
<div id="projectbrief">Simulate particle behavior inside a Penning Trap</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.6 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search/",'.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(document).ready(function(){initNavTree('plot__2__particles_8py.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<div id="MSearchResults">
<div class="SRPage">
<div id="SRIndex">
<div id="SRResults"></div>
<div class="SRStatus" id="Loading">Loading...</div>
<div class="SRStatus" id="Searching">Searching...</div>
<div class="SRStatus" id="NoMatches">No Matches</div>
</div>
</div>
</div>
</div>
<div class="header">
<div class="summary">
<a href="#func-members">Functions</a> &#124;
<a href="#var-members">Variables</a> </div>
<div class="headertitle"><div class="title">plot_2_particles.py File Reference</div></div>
</div><!--header-->
<div class="contents">
<p>Plot 2 particles with and without particle interactions in the xy-plane.
<a href="#details">More...</a></p>
<p><a href="plot__2__particles_8py_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="func-members" name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:a8863a67cb3a33d1a522efae56b05d37d"><td class="memItemLeft" align="right" valign="top">def&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="plot__2__particles_8py.html#a8863a67cb3a33d1a522efae56b05d37d">plot_2_particles.main</a> ()</td></tr>
<tr class="separator:a8863a67cb3a33d1a522efae56b05d37d"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="var-members" name="var-members"></a>
Variables</h2></td></tr>
<tr class="memitem:a65096b5c625338aed999b0be51846e3a"><td class="memItemLeft" align="right" valign="top">dict&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="plot__2__particles_8py.html#a65096b5c625338aed999b0be51846e3a">plot_2_particles.params</a></td></tr>
<tr class="separator:a65096b5c625338aed999b0be51846e3a"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Plot 2 particles with and without particle interactions in the xy-plane. </p>
<dl class="section author"><dt>Author</dt><dd>Cory Alexander Balaton (coryab) </dd>
<dd>
Janita Ovidie Sandtrøen Willumsen (janitaws)</dd></dl>
<dl class="section version"><dt>Version</dt><dd>1.0</dd></dl>
<dl class="bug"><dt><b><a class="el" href="bug.html#_bug000013">Bug:</a></b></dt><dd>No known bugs </dd></dl>
<p class="definition">Definition in file <a class="el" href="plot__2__particles_8py_source.html">plot_2_particles.py</a>.</p>
</div><h2 class="groupheader">Function Documentation</h2>
<a id="a8863a67cb3a33d1a522efae56b05d37d" name="a8863a67cb3a33d1a522efae56b05d37d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a8863a67cb3a33d1a522efae56b05d37d">&#9670;&#160;</a></span>main()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">def plot_2_particles.main </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p class="definition">Definition at line <a class="el" href="plot__2__particles_8py_source.html#l00030">30</a> of file <a class="el" href="plot__2__particles_8py_source.html">plot_2_particles.py</a>.</p>
</div>
</div>
<h2 class="groupheader">Variable Documentation</h2>
<a id="a65096b5c625338aed999b0be51846e3a" name="a65096b5c625338aed999b0be51846e3a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a65096b5c625338aed999b0be51846e3a">&#9670;&#160;</a></span>params</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">dict plot_2_particles.params</td>
</tr>
</table>
</div><div class="memdoc">
<b>Initial value:</b><div class="fragment"><div class="line"><span class="lineno"> 1</span>= {</div>
<div class="line"><span class="lineno"> 2</span> <span class="stringliteral">&quot;font.family&quot;</span>: <span class="stringliteral">&quot;Serif&quot;</span>,</div>
<div class="line"><span class="lineno"> 3</span> <span class="stringliteral">&quot;font.serif&quot;</span>: <span class="stringliteral">&quot;Roman&quot;</span>, </div>
<div class="line"><span class="lineno"> 4</span> <span class="stringliteral">&quot;text.usetex&quot;</span>: <span class="keyword">True</span>,</div>
<div class="line"><span class="lineno"> 5</span> <span class="stringliteral">&quot;axes.titlesize&quot;</span>: <span class="stringliteral">&quot;large&quot;</span>,</div>
<div class="line"><span class="lineno"> 6</span> <span class="stringliteral">&quot;axes.labelsize&quot;</span>: <span class="stringliteral">&quot;large&quot;</span>,</div>
<div class="line"><span class="lineno"> 7</span> <span class="stringliteral">&quot;xtick.labelsize&quot;</span>: <span class="stringliteral">&quot;large&quot;</span>,</div>
<div class="line"><span class="lineno"> 8</span> <span class="stringliteral">&quot;ytick.labelsize&quot;</span>: <span class="stringliteral">&quot;large&quot;</span>,</div>
<div class="line"><span class="lineno"> 9</span> <span class="stringliteral">&quot;legend.fontsize&quot;</span>: <span class="stringliteral">&quot;medium&quot;</span></div>
<div class="line"><span class="lineno"> 10</span>}</div>
</div><!-- fragment -->
<p class="definition">Definition at line <a class="el" href="plot__2__particles_8py_source.html#l00018">18</a> of file <a class="el" href="plot__2__particles_8py_source.html">plot_2_particles.py</a>.</p>
</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li><li class="navelem"><a class="el" href="dir_634e799a3947388232110823971192a8.html">scripts</a></li><li class="navelem"><a class="el" href="plot__2__particles_8py.html">plot_2_particles.py</a></li>
<li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.6 </li>
</ul>
</div>
</body>
</html>

View File

@@ -101,51 +101,77 @@ $(document).ready(function(){initNavTree('plot__2__particles_8py_source.html',''
<div class="headertitle"><div class="title">plot_2_particles.py</div></div>
</div><!--header-->
<div class="contents">
<div class="fragment"><div class="line"><a id="l00001" name="l00001"></a><span class="lineno"> 1</span><span class="keyword">import</span> matplotlib.pyplot <span class="keyword">as</span> plt</div>
<div class="line"><a id="l00002" name="l00002"></a><span class="lineno"> 2</span><span class="keyword">import</span> numpy <span class="keyword">as</span> np</div>
<div class="line"><a id="l00003" name="l00003"></a><span class="lineno"> 3</span> </div>
<div class="line"><a id="l00004" name="l00004"></a><span class="lineno"> 4</span><span class="keyword">def </span>main():</div>
<div class="line"><a id="l00005" name="l00005"></a><span class="lineno"> 5</span> files = [</div>
<div class="line"><a id="l00006" name="l00006"></a><span class="lineno"> 6</span> <span class="stringliteral">&quot;output/simulate_2_particles/no_interaction/particle_0_r.txt&quot;</span>,</div>
<div class="line"><a id="l00007" name="l00007"></a><span class="lineno"> 7</span> <span class="stringliteral">&quot;output/simulate_2_particles/no_interaction/particle_1_r.txt&quot;</span>,</div>
<div class="line"><a id="l00008" name="l00008"></a><span class="lineno"> 8</span> <span class="stringliteral">&quot;output/simulate_2_particles/with_interaction/particle_0_r.txt&quot;</span>,</div>
<div class="line"><a id="l00009" name="l00009"></a><span class="lineno"> 9</span> <span class="stringliteral">&quot;output/simulate_2_particles/with_interaction/particle_1_r.txt&quot;</span></div>
<div class="line"><a id="l00010" name="l00010"></a><span class="lineno"> 10</span> ]</div>
<div class="line"><a id="l00011" name="l00011"></a><span class="lineno"> 11</span> labels = [</div>
<div class="line"><a id="l00012" name="l00012"></a><span class="lineno"> 12</span> <span class="stringliteral">&quot;particle 1 no interaction&quot;</span>,</div>
<div class="line"><a id="l00013" name="l00013"></a><span class="lineno"> 13</span> <span class="stringliteral">&quot;particle 2 no interaction&quot;</span>,</div>
<div class="line"><a id="l00014" name="l00014"></a><span class="lineno"> 14</span> <span class="stringliteral">&quot;particle 1 with interaction&quot;</span>,</div>
<div class="line"><a id="l00015" name="l00015"></a><span class="lineno"> 15</span> <span class="stringliteral">&quot;particle 2 with interaction&quot;</span>,</div>
<div class="line"><a id="l00016" name="l00016"></a><span class="lineno"> 16</span> ]</div>
<div class="line"><a id="l00017" name="l00017"></a><span class="lineno"> 17</span> colors = [</div>
<div class="line"><a id="l00018" name="l00018"></a><span class="lineno"> 18</span> <span class="stringliteral">&quot;lightskyblue&quot;</span>,</div>
<div class="line"><a id="l00019" name="l00019"></a><span class="lineno"> 19</span> <span class="stringliteral">&quot;lightskyblue&quot;</span>,</div>
<div class="line"><a id="l00020" name="l00020"></a><span class="lineno"> 20</span> <span class="stringliteral">&quot;salmon&quot;</span>,</div>
<div class="line"><a id="l00021" name="l00021"></a><span class="lineno"> 21</span> <span class="stringliteral">&quot;salmon&quot;</span></div>
<div class="line"><a id="l00022" name="l00022"></a><span class="lineno"> 22</span> ]</div>
<div class="line"><a id="l00023" name="l00023"></a><span class="lineno"> 23</span> <span class="keywordflow">for</span> label, color, file <span class="keywordflow">in</span> zip(labels, colors, files):</div>
<div class="line"><a id="l00024" name="l00024"></a><span class="lineno"> 24</span> <span class="keyword">with</span> open(file) <span class="keyword">as</span> f:</div>
<div class="line"><a id="l00025" name="l00025"></a><span class="lineno"> 25</span> lines = f.readlines()</div>
<div class="line"><a id="l00026" name="l00026"></a><span class="lineno"> 26</span> t = np.linspace(0, 50, len(lines))</div>
<div class="line"><a id="l00027" name="l00027"></a><span class="lineno"> 27</span> r = np.array([list(map(float, line.strip().split(<span class="stringliteral">&quot;,&quot;</span>))) <span class="keywordflow">for</span> line <span class="keywordflow">in</span> lines])</div>
<div class="line"><a id="l00028" name="l00028"></a><span class="lineno"> 28</span> plt.plot(r[:,0], r[:,1], label=label, color=color)</div>
<a href="plot__2__particles_8py.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a id="l00001" name="l00001"></a><span class="lineno"> 1</span> </div>
<div class="line"><a id="l00012" name="l00012"></a><span class="lineno"> 12</span> </div>
<div class="line"><a id="l00013" name="l00013"></a><span class="lineno"> 13</span><span class="keyword">import</span> matplotlib.pyplot <span class="keyword">as</span> plt</div>
<div class="line"><a id="l00014" name="l00014"></a><span class="lineno"> 14</span><span class="keyword">import</span> numpy <span class="keyword">as</span> np</div>
<div class="line"><a id="l00015" name="l00015"></a><span class="lineno"> 15</span><span class="keyword">import</span> seaborn <span class="keyword">as</span> sns</div>
<div class="line"><a id="l00016" name="l00016"></a><span class="lineno"> 16</span> </div>
<div class="line"><a id="l00017" name="l00017"></a><span class="lineno"> 17</span>sns.set_theme()</div>
<div class="line"><a id="l00018" name="l00018"></a><span class="lineno"> 18</span>params = {</div>
<div class="line"><a id="l00019" name="l00019"></a><span class="lineno"> 19</span> <span class="stringliteral">&quot;font.family&quot;</span>: <span class="stringliteral">&quot;Serif&quot;</span>,</div>
<div class="line"><a id="l00020" name="l00020"></a><span class="lineno"> 20</span> <span class="stringliteral">&quot;font.serif&quot;</span>: <span class="stringliteral">&quot;Roman&quot;</span>, </div>
<div class="line"><a id="l00021" name="l00021"></a><span class="lineno"> 21</span> <span class="stringliteral">&quot;text.usetex&quot;</span>: <span class="keyword">True</span>,</div>
<div class="line"><a id="l00022" name="l00022"></a><span class="lineno"> 22</span> <span class="stringliteral">&quot;axes.titlesize&quot;</span>: <span class="stringliteral">&quot;large&quot;</span>,</div>
<div class="line"><a id="l00023" name="l00023"></a><span class="lineno"> 23</span> <span class="stringliteral">&quot;axes.labelsize&quot;</span>: <span class="stringliteral">&quot;large&quot;</span>,</div>
<div class="line"><a id="l00024" name="l00024"></a><span class="lineno"> 24</span> <span class="stringliteral">&quot;xtick.labelsize&quot;</span>: <span class="stringliteral">&quot;large&quot;</span>,</div>
<div class="line"><a id="l00025" name="l00025"></a><span class="lineno"> 25</span> <span class="stringliteral">&quot;ytick.labelsize&quot;</span>: <span class="stringliteral">&quot;large&quot;</span>,</div>
<div class="line"><a id="l00026" name="l00026"></a><span class="lineno"> 26</span> <span class="stringliteral">&quot;legend.fontsize&quot;</span>: <span class="stringliteral">&quot;medium&quot;</span></div>
<div class="line"><a id="l00027" name="l00027"></a><span class="lineno"> 27</span>}</div>
<div class="line"><a id="l00028" name="l00028"></a><span class="lineno"> 28</span>plt.rcParams.update(params)</div>
<div class="line"><a id="l00029" name="l00029"></a><span class="lineno"> 29</span> </div>
<div class="line"><a id="l00030" name="l00030"></a><span class="lineno"> 30</span> plt.xlabel(<span class="stringliteral">r&quot;x $(\mu m)$&quot;</span>)</div>
<div class="line"><a id="l00031" name="l00031"></a><span class="lineno"> 31</span> plt.ylabel(<span class="stringliteral">r&quot;y $(\mu m)$&quot;</span>)</div>
<div class="line"><a id="l00032" name="l00032"></a><span class="lineno"> 32</span> plt.title(<span class="stringliteral">r&quot;2 particles with and without interactions.&quot;</span>)</div>
<div class="line"><a id="l00033" name="l00033"></a><span class="lineno"> 33</span> <span class="comment"># plt.legend()</span></div>
<div class="line"><a id="l00034" name="l00034"></a><span class="lineno"> 34</span> <span class="comment"># plt.show()</span></div>
<div class="line"><a id="l00035" name="l00035"></a><span class="lineno"> 35</span> plt.savefig(<span class="stringliteral">&quot;../latex/images/plot_2_particles_xy.pdf&quot;</span>)</div>
<div class="line"><a id="l00036" name="l00036"></a><span class="lineno"> 36</span> </div>
<div class="line"><a id="l00037" name="l00037"></a><span class="lineno"> 37</span> </div>
<div class="line"><a id="l00038" name="l00038"></a><span class="lineno"> 38</span><span class="keywordflow">if</span> __name__ == <span class="stringliteral">&quot;__main__&quot;</span>:</div>
<div class="line"><a id="l00039" name="l00039"></a><span class="lineno"> 39</span> main()</div>
<div class="line"><a id="l00030" name="l00030"></a><span class="lineno"> 30</span><span class="keyword">def </span>main():</div>
<div class="line"><a id="l00031" name="l00031"></a><span class="lineno"> 31</span> directories = {</div>
<div class="line"><a id="l00032" name="l00032"></a><span class="lineno"> 32</span> <span class="stringliteral">&quot;output/simulate_2_particles/no_interaction/&quot;</span>,</div>
<div class="line"><a id="l00033" name="l00033"></a><span class="lineno"> 33</span> <span class="stringliteral">&quot;output/simulate_2_particles/with_interaction/&quot;</span>,</div>
<div class="line"><a id="l00034" name="l00034"></a><span class="lineno"> 34</span> }</div>
<div class="line"><a id="l00035" name="l00035"></a><span class="lineno"> 35</span> files = [</div>
<div class="line"><a id="l00036" name="l00036"></a><span class="lineno"> 36</span> <span class="stringliteral">&quot;particle_0_r.txt&quot;</span>,</div>
<div class="line"><a id="l00037" name="l00037"></a><span class="lineno"> 37</span> <span class="stringliteral">&quot;particle_1_r.txt&quot;</span>,</div>
<div class="line"><a id="l00038" name="l00038"></a><span class="lineno"> 38</span> ]</div>
<div class="line"><a id="l00039" name="l00039"></a><span class="lineno"> 39</span> outputs = [</div>
<div class="line"><a id="l00040" name="l00040"></a><span class="lineno"> 40</span> <span class="stringliteral">&quot;../latex/images/simulate_2_particles_no_interaction_xy.pdf&quot;</span>,</div>
<div class="line"><a id="l00041" name="l00041"></a><span class="lineno"> 41</span> <span class="stringliteral">&quot;../latex/images/simulate_2_particles_interaction_xy.pdf&quot;</span>,</div>
<div class="line"><a id="l00042" name="l00042"></a><span class="lineno"> 42</span> ]</div>
<div class="line"><a id="l00043" name="l00043"></a><span class="lineno"> 43</span> labels = [</div>
<div class="line"><a id="l00044" name="l00044"></a><span class="lineno"> 44</span> <span class="stringliteral">r&quot;$p_1$&quot;</span>,</div>
<div class="line"><a id="l00045" name="l00045"></a><span class="lineno"> 45</span> <span class="stringliteral">r&quot;$p_2$&quot;</span>,</div>
<div class="line"><a id="l00046" name="l00046"></a><span class="lineno"> 46</span> <span class="stringliteral">r&quot;$\hat{p}_1$&quot;</span>,</div>
<div class="line"><a id="l00047" name="l00047"></a><span class="lineno"> 47</span> <span class="stringliteral">r&quot;$\hat{p}_2$&quot;</span>,</div>
<div class="line"><a id="l00048" name="l00048"></a><span class="lineno"> 48</span> ]</div>
<div class="line"><a id="l00049" name="l00049"></a><span class="lineno"> 49</span> colors = [</div>
<div class="line"><a id="l00050" name="l00050"></a><span class="lineno"> 50</span> <span class="stringliteral">&quot;seagreen&quot;</span>,</div>
<div class="line"><a id="l00051" name="l00051"></a><span class="lineno"> 51</span> <span class="stringliteral">&quot;darkred&quot;</span></div>
<div class="line"><a id="l00052" name="l00052"></a><span class="lineno"> 52</span> ]</div>
<div class="line"><a id="l00053" name="l00053"></a><span class="lineno"> 53</span> start_pos = set()</div>
<div class="line"><a id="l00054" name="l00054"></a><span class="lineno"> 54</span> <span class="keywordflow">for</span> dir, output <span class="keywordflow">in</span> zip(directories, outputs):</div>
<div class="line"><a id="l00055" name="l00055"></a><span class="lineno"> 55</span> fig, ax = plt.subplots()</div>
<div class="line"><a id="l00056" name="l00056"></a><span class="lineno"> 56</span> <span class="keywordflow">for</span> label, color, file <span class="keywordflow">in</span> zip(labels, colors, files):</div>
<div class="line"><a id="l00057" name="l00057"></a><span class="lineno"> 57</span> <span class="keyword">with</span> open(dir+file) <span class="keyword">as</span> f:</div>
<div class="line"><a id="l00058" name="l00058"></a><span class="lineno"> 58</span> lines = f.readlines()</div>
<div class="line"><a id="l00059" name="l00059"></a><span class="lineno"> 59</span> t = np.linspace(0, 50, len(lines))</div>
<div class="line"><a id="l00060" name="l00060"></a><span class="lineno"> 60</span> r = np.array([list(map(float, line.strip().split(<span class="stringliteral">&quot;,&quot;</span>))) <span class="keywordflow">for</span> line <span class="keywordflow">in</span> lines])</div>
<div class="line"><a id="l00061" name="l00061"></a><span class="lineno"> 61</span> ax.plot(r[:,0], r[:,1], label=label, color=color)</div>
<div class="line"><a id="l00062" name="l00062"></a><span class="lineno"> 62</span> start_pos.add((r[0,0],r[0,1]))</div>
<div class="line"><a id="l00063" name="l00063"></a><span class="lineno"> 63</span> </div>
<div class="line"><a id="l00064" name="l00064"></a><span class="lineno"> 64</span> <span class="keywordflow">for</span> pos <span class="keywordflow">in</span> start_pos:</div>
<div class="line"><a id="l00065" name="l00065"></a><span class="lineno"> 65</span> ax.plot(*pos, <span class="stringliteral">&quot;o&quot;</span>, color=<span class="stringliteral">&quot;black&quot;</span>)</div>
<div class="line"><a id="l00066" name="l00066"></a><span class="lineno"> 66</span> </div>
<div class="line"><a id="l00067" name="l00067"></a><span class="lineno"> 67</span> ax.set_xlabel(<span class="stringliteral">r&quot;x $(\mu m)$&quot;</span>)</div>
<div class="line"><a id="l00068" name="l00068"></a><span class="lineno"> 68</span> ax.set_ylabel(<span class="stringliteral">r&quot;y $(\mu m)$&quot;</span>)</div>
<div class="line"><a id="l00069" name="l00069"></a><span class="lineno"> 69</span> ax.legend(loc=<span class="stringliteral">&quot;upper right&quot;</span>)</div>
<div class="line"><a id="l00070" name="l00070"></a><span class="lineno"> 70</span> ax.axis(<span class="stringliteral">&quot;equal&quot;</span>)</div>
<div class="line"><a id="l00071" name="l00071"></a><span class="lineno"> 71</span> fig.savefig(output, bbox_inches=<span class="stringliteral">&quot;tight&quot;</span>)</div>
<div class="line"><a id="l00072" name="l00072"></a><span class="lineno"> 72</span> </div>
<div class="line"><a id="l00073" name="l00073"></a><span class="lineno"> 73</span> </div>
<div class="line"><a id="l00074" name="l00074"></a><span class="lineno"> 74</span><span class="keywordflow">if</span> __name__ == <span class="stringliteral">&quot;__main__&quot;</span>:</div>
<div class="line"><a id="l00075" name="l00075"></a><span class="lineno"> 75</span> main()</div>
</div><!-- fragment --></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li><li class="navelem"><a class="el" href="dir_634e799a3947388232110823971192a8.html">scripts</a></li><li class="navelem"><b>plot_2_particles.py</b></li>
<li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li><li class="navelem"><a class="el" href="dir_634e799a3947388232110823971192a8.html">scripts</a></li><li class="navelem"><a class="el" href="plot__2__particles_8py.html">plot_2_particles.py</a></li>
<li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.6 </li>
</ul>
</div>

190
docs/plot__3d_8py.html Normal file
View File

@@ -0,0 +1,190 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.9.6"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Penning Trap Simulation: src/scripts/plot_3d.py File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
extensions: ["tex2jax.js"],
jax: ["input/TeX","output/HTML-CSS"],
});
</script>
<script type="text/javascript" async="async" src="https://cdn.jsdelivr.net/npm/mathjax@2/MathJax.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="doxygen-awesome.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr id="projectrow">
<td id="projectalign">
<div id="projectname">Penning Trap Simulation
</div>
<div id="projectbrief">Simulate particle behavior inside a Penning Trap</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.6 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search/",'.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(document).ready(function(){initNavTree('plot__3d_8py.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<div id="MSearchResults">
<div class="SRPage">
<div id="SRIndex">
<div id="SRResults"></div>
<div class="SRStatus" id="Loading">Loading...</div>
<div class="SRStatus" id="Searching">Searching...</div>
<div class="SRStatus" id="NoMatches">No Matches</div>
</div>
</div>
</div>
</div>
<div class="header">
<div class="summary">
<a href="#func-members">Functions</a> &#124;
<a href="#var-members">Variables</a> </div>
<div class="headertitle"><div class="title">plot_3d.py File Reference</div></div>
</div><!--header-->
<div class="contents">
<p>Plot 2 particles with and without particle interactions in 3D.
<a href="#details">More...</a></p>
<p><a href="plot__3d_8py_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="func-members" name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:adb8902df55180f4ad62fb3799bc5c5a8"><td class="memItemLeft" align="right" valign="top">def&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="plot__3d_8py.html#adb8902df55180f4ad62fb3799bc5c5a8">plot_3d.main</a> ()</td></tr>
<tr class="separator:adb8902df55180f4ad62fb3799bc5c5a8"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="var-members" name="var-members"></a>
Variables</h2></td></tr>
<tr class="memitem:a7026cb07859df7ff6b3fb60453573467"><td class="memItemLeft" align="right" valign="top">dict&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="plot__3d_8py.html#a7026cb07859df7ff6b3fb60453573467">plot_3d.params</a></td></tr>
<tr class="separator:a7026cb07859df7ff6b3fb60453573467"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Plot 2 particles with and without particle interactions in 3D. </p>
<dl class="section author"><dt>Author</dt><dd>Cory Alexander Balaton (coryab) </dd>
<dd>
Janita Ovidie Sandtrøen Willumsen (janitaws)</dd></dl>
<dl class="section version"><dt>Version</dt><dd>1.0</dd></dl>
<dl class="bug"><dt><b><a class="el" href="bug.html#_bug000014">Bug:</a></b></dt><dd>No known bugs </dd></dl>
<p class="definition">Definition in file <a class="el" href="plot__3d_8py_source.html">plot_3d.py</a>.</p>
</div><h2 class="groupheader">Function Documentation</h2>
<a id="adb8902df55180f4ad62fb3799bc5c5a8" name="adb8902df55180f4ad62fb3799bc5c5a8"></a>
<h2 class="memtitle"><span class="permalink"><a href="#adb8902df55180f4ad62fb3799bc5c5a8">&#9670;&#160;</a></span>main()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">def plot_3d.main </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p class="definition">Definition at line <a class="el" href="plot__3d_8py_source.html#l00030">30</a> of file <a class="el" href="plot__3d_8py_source.html">plot_3d.py</a>.</p>
</div>
</div>
<h2 class="groupheader">Variable Documentation</h2>
<a id="a7026cb07859df7ff6b3fb60453573467" name="a7026cb07859df7ff6b3fb60453573467"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a7026cb07859df7ff6b3fb60453573467">&#9670;&#160;</a></span>params</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">dict plot_3d.params</td>
</tr>
</table>
</div><div class="memdoc">
<b>Initial value:</b><div class="fragment"><div class="line"><span class="lineno"> 1</span>= {</div>
<div class="line"><span class="lineno"> 2</span> <span class="stringliteral">&quot;font.family&quot;</span>: <span class="stringliteral">&quot;Serif&quot;</span>,</div>
<div class="line"><span class="lineno"> 3</span> <span class="stringliteral">&quot;font.serif&quot;</span>: <span class="stringliteral">&quot;Roman&quot;</span>, </div>
<div class="line"><span class="lineno"> 4</span> <span class="stringliteral">&quot;text.usetex&quot;</span>: <span class="keyword">True</span>,</div>
<div class="line"><span class="lineno"> 5</span> <span class="stringliteral">&quot;axes.titlesize&quot;</span>: <span class="stringliteral">&quot;large&quot;</span>,</div>
<div class="line"><span class="lineno"> 6</span> <span class="stringliteral">&quot;axes.labelsize&quot;</span>: <span class="stringliteral">&quot;large&quot;</span>,</div>
<div class="line"><span class="lineno"> 7</span> <span class="stringliteral">&quot;xtick.labelsize&quot;</span>: <span class="stringliteral">&quot;large&quot;</span>,</div>
<div class="line"><span class="lineno"> 8</span> <span class="stringliteral">&quot;ytick.labelsize&quot;</span>: <span class="stringliteral">&quot;large&quot;</span>,</div>
<div class="line"><span class="lineno"> 9</span> <span class="stringliteral">&quot;legend.fontsize&quot;</span>: <span class="stringliteral">&quot;medium&quot;</span>,</div>
<div class="line"><span class="lineno"> 10</span> <span class="stringliteral">&quot;figure.autolayout&quot;</span>: <span class="keyword">True</span></div>
<div class="line"><span class="lineno"> 11</span>}</div>
</div><!-- fragment -->
<p class="definition">Definition at line <a class="el" href="plot__3d_8py_source.html#l00017">17</a> of file <a class="el" href="plot__3d_8py_source.html">plot_3d.py</a>.</p>
</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li><li class="navelem"><a class="el" href="dir_634e799a3947388232110823971192a8.html">scripts</a></li><li class="navelem"><a class="el" href="plot__3d_8py.html">plot_3d.py</a></li>
<li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.6 </li>
</ul>
</div>
</body>
</html>

View File

@@ -101,52 +101,70 @@ $(document).ready(function(){initNavTree('plot__3d_8py_source.html',''); initRes
<div class="headertitle"><div class="title">plot_3d.py</div></div>
</div><!--header-->
<div class="contents">
<div class="fragment"><div class="line"><a id="l00001" name="l00001"></a><span class="lineno"> 1</span><span class="keyword">import</span> matplotlib.pyplot <span class="keyword">as</span> plt</div>
<div class="line"><a id="l00002" name="l00002"></a><span class="lineno"> 2</span><span class="keyword">import</span> numpy <span class="keyword">as</span> np</div>
<div class="line"><a id="l00003" name="l00003"></a><span class="lineno"> 3</span> </div>
<div class="line"><a id="l00004" name="l00004"></a><span class="lineno"> 4</span><span class="keyword">def </span>main():</div>
<div class="line"><a id="l00005" name="l00005"></a><span class="lineno"> 5</span> files = [</div>
<div class="line"><a id="l00006" name="l00006"></a><span class="lineno"> 6</span> <span class="stringliteral">&quot;output/simulate_2_particles/no_interaction/particle_0_r.txt&quot;</span>,</div>
<div class="line"><a id="l00007" name="l00007"></a><span class="lineno"> 7</span> <span class="stringliteral">&quot;output/simulate_2_particles/no_interaction/particle_1_r.txt&quot;</span>,</div>
<div class="line"><a id="l00008" name="l00008"></a><span class="lineno"> 8</span> <span class="stringliteral">&quot;output/simulate_2_particles/with_interaction/particle_0_r.txt&quot;</span>,</div>
<div class="line"><a id="l00009" name="l00009"></a><span class="lineno"> 9</span> <span class="stringliteral">&quot;output/simulate_2_particles/with_interaction/particle_1_r.txt&quot;</span></div>
<div class="line"><a id="l00010" name="l00010"></a><span class="lineno"> 10</span> ]</div>
<div class="line"><a id="l00011" name="l00011"></a><span class="lineno"> 11</span> labels = [</div>
<div class="line"><a id="l00012" name="l00012"></a><span class="lineno"> 12</span> <span class="stringliteral">&quot;particle 1 no interaction&quot;</span>,</div>
<div class="line"><a id="l00013" name="l00013"></a><span class="lineno"> 13</span> <span class="stringliteral">&quot;particle 2 no interaction&quot;</span>,</div>
<div class="line"><a id="l00014" name="l00014"></a><span class="lineno"> 14</span> <span class="stringliteral">&quot;particle 1 with interaction&quot;</span>,</div>
<div class="line"><a id="l00015" name="l00015"></a><span class="lineno"> 15</span> <span class="stringliteral">&quot;particle 2 with interaction&quot;</span>,</div>
<div class="line"><a id="l00016" name="l00016"></a><span class="lineno"> 16</span> ]</div>
<div class="line"><a id="l00017" name="l00017"></a><span class="lineno"> 17</span> colors = [</div>
<div class="line"><a id="l00018" name="l00018"></a><span class="lineno"> 18</span> <span class="stringliteral">&quot;lightskyblue&quot;</span>,</div>
<div class="line"><a id="l00019" name="l00019"></a><span class="lineno"> 19</span> <span class="stringliteral">&quot;deepskyblue&quot;</span>,</div>
<div class="line"><a id="l00020" name="l00020"></a><span class="lineno"> 20</span> <span class="stringliteral">&quot;salmon&quot;</span>,</div>
<div class="line"><a id="l00021" name="l00021"></a><span class="lineno"> 21</span> <span class="stringliteral">&quot;darkred&quot;</span></div>
<div class="line"><a id="l00022" name="l00022"></a><span class="lineno"> 22</span> ]</div>
<div class="line"><a id="l00023" name="l00023"></a><span class="lineno"> 23</span> ax = plt.figure().add_subplot(projection=<span class="stringliteral">&quot;3d&quot;</span>)</div>
<div class="line"><a id="l00024" name="l00024"></a><span class="lineno"> 24</span> <span class="keywordflow">for</span> label, color, file <span class="keywordflow">in</span> zip(labels, colors, files):</div>
<div class="line"><a id="l00025" name="l00025"></a><span class="lineno"> 25</span> <span class="keyword">with</span> open(file) <span class="keyword">as</span> f:</div>
<div class="line"><a id="l00026" name="l00026"></a><span class="lineno"> 26</span> lines = f.readlines()</div>
<div class="line"><a id="l00027" name="l00027"></a><span class="lineno"> 27</span> t = np.linspace(0, 50, len(lines))</div>
<div class="line"><a id="l00028" name="l00028"></a><span class="lineno"> 28</span> r = np.array([list(map(float, line.strip().split(<span class="stringliteral">&quot;,&quot;</span>))) <span class="keywordflow">for</span> line <span class="keywordflow">in</span> lines])</div>
<div class="line"><a id="l00029" name="l00029"></a><span class="lineno"> 29</span> ax.plot(r[:,0], r[:,1], r[:,2], label=label, color=color)</div>
<div class="line"><a id="l00030" name="l00030"></a><span class="lineno"> 30</span> </div>
<div class="line"><a id="l00031" name="l00031"></a><span class="lineno"> 31</span> ax.set_xlabel(<span class="stringliteral">r&quot;x $(\mu m)$&quot;</span>)</div>
<div class="line"><a id="l00032" name="l00032"></a><span class="lineno"> 32</span> ax.set_ylabel(<span class="stringliteral">r&quot;y $(\mu m)$&quot;</span>)</div>
<div class="line"><a id="l00033" name="l00033"></a><span class="lineno"> 33</span> ax.set_zlabel(<span class="stringliteral">r&quot;z $(\mu m)$&quot;</span>)</div>
<div class="line"><a id="l00034" name="l00034"></a><span class="lineno"> 34</span> plt.title(<span class="stringliteral">r&quot;2 particles with and without interactions.&quot;</span>)</div>
<div class="line"><a id="l00035" name="l00035"></a><span class="lineno"> 35</span> plt.legend()</div>
<div class="line"><a id="l00036" name="l00036"></a><span class="lineno"> 36</span> plt.savefig(<span class="stringliteral">&quot;../latex/images/3d_plot.pdf&quot;</span>)</div>
<div class="line"><a id="l00037" name="l00037"></a><span class="lineno"> 37</span> </div>
<div class="line"><a id="l00038" name="l00038"></a><span class="lineno"> 38</span> </div>
<div class="line"><a id="l00039" name="l00039"></a><span class="lineno"> 39</span><span class="keywordflow">if</span> __name__ == <span class="stringliteral">&quot;__main__&quot;</span>:</div>
<div class="line"><a id="l00040" name="l00040"></a><span class="lineno"> 40</span> main()</div>
<a href="plot__3d_8py.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a id="l00001" name="l00001"></a><span class="lineno"> 1</span> </div>
<div class="line"><a id="l00011" name="l00011"></a><span class="lineno"> 11</span> </div>
<div class="line"><a id="l00012" name="l00012"></a><span class="lineno"> 12</span><span class="keyword">import</span> matplotlib.pyplot <span class="keyword">as</span> plt</div>
<div class="line"><a id="l00013" name="l00013"></a><span class="lineno"> 13</span><span class="keyword">import</span> numpy <span class="keyword">as</span> np</div>
<div class="line"><a id="l00014" name="l00014"></a><span class="lineno"> 14</span><span class="keyword">import</span> seaborn <span class="keyword">as</span> sns</div>
<div class="line"><a id="l00015" name="l00015"></a><span class="lineno"> 15</span> </div>
<div class="line"><a id="l00016" name="l00016"></a><span class="lineno"> 16</span>sns.set_theme()</div>
<div class="line"><a id="l00017" name="l00017"></a><span class="lineno"> 17</span>params = {</div>
<div class="line"><a id="l00018" name="l00018"></a><span class="lineno"> 18</span> <span class="stringliteral">&quot;font.family&quot;</span>: <span class="stringliteral">&quot;Serif&quot;</span>,</div>
<div class="line"><a id="l00019" name="l00019"></a><span class="lineno"> 19</span> <span class="stringliteral">&quot;font.serif&quot;</span>: <span class="stringliteral">&quot;Roman&quot;</span>, </div>
<div class="line"><a id="l00020" name="l00020"></a><span class="lineno"> 20</span> <span class="stringliteral">&quot;text.usetex&quot;</span>: <span class="keyword">True</span>,</div>
<div class="line"><a id="l00021" name="l00021"></a><span class="lineno"> 21</span> <span class="stringliteral">&quot;axes.titlesize&quot;</span>: <span class="stringliteral">&quot;large&quot;</span>,</div>
<div class="line"><a id="l00022" name="l00022"></a><span class="lineno"> 22</span> <span class="stringliteral">&quot;axes.labelsize&quot;</span>: <span class="stringliteral">&quot;large&quot;</span>,</div>
<div class="line"><a id="l00023" name="l00023"></a><span class="lineno"> 23</span> <span class="stringliteral">&quot;xtick.labelsize&quot;</span>: <span class="stringliteral">&quot;large&quot;</span>,</div>
<div class="line"><a id="l00024" name="l00024"></a><span class="lineno"> 24</span> <span class="stringliteral">&quot;ytick.labelsize&quot;</span>: <span class="stringliteral">&quot;large&quot;</span>,</div>
<div class="line"><a id="l00025" name="l00025"></a><span class="lineno"> 25</span> <span class="stringliteral">&quot;legend.fontsize&quot;</span>: <span class="stringliteral">&quot;medium&quot;</span>,</div>
<div class="line"><a id="l00026" name="l00026"></a><span class="lineno"> 26</span> <span class="stringliteral">&quot;figure.autolayout&quot;</span>: <span class="keyword">True</span></div>
<div class="line"><a id="l00027" name="l00027"></a><span class="lineno"> 27</span>}</div>
<div class="line"><a id="l00028" name="l00028"></a><span class="lineno"> 28</span>plt.rcParams.update(params)</div>
<div class="line"><a id="l00029" name="l00029"></a><span class="lineno"> 29</span> </div>
<div class="line"><a id="l00030" name="l00030"></a><span class="lineno"> 30</span><span class="keyword">def </span>main():</div>
<div class="line"><a id="l00031" name="l00031"></a><span class="lineno"> 31</span> files = [</div>
<div class="line"><a id="l00032" name="l00032"></a><span class="lineno"> 32</span> <span class="stringliteral">&quot;output/simulate_2_particles/no_interaction/particle_0_r.txt&quot;</span>,</div>
<div class="line"><a id="l00033" name="l00033"></a><span class="lineno"> 33</span> <span class="stringliteral">&quot;output/simulate_2_particles/no_interaction/particle_1_r.txt&quot;</span>,</div>
<div class="line"><a id="l00034" name="l00034"></a><span class="lineno"> 34</span> <span class="stringliteral">&quot;output/simulate_2_particles/with_interaction/particle_0_r.txt&quot;</span>,</div>
<div class="line"><a id="l00035" name="l00035"></a><span class="lineno"> 35</span> <span class="stringliteral">&quot;output/simulate_2_particles/with_interaction/particle_1_r.txt&quot;</span></div>
<div class="line"><a id="l00036" name="l00036"></a><span class="lineno"> 36</span> ]</div>
<div class="line"><a id="l00037" name="l00037"></a><span class="lineno"> 37</span> labels = [</div>
<div class="line"><a id="l00038" name="l00038"></a><span class="lineno"> 38</span> <span class="stringliteral">r&quot;$p_1$&quot;</span>,</div>
<div class="line"><a id="l00039" name="l00039"></a><span class="lineno"> 39</span> <span class="stringliteral">r&quot;$p_2$&quot;</span>,</div>
<div class="line"><a id="l00040" name="l00040"></a><span class="lineno"> 40</span> <span class="stringliteral">r&quot;$\hat{p}_1$&quot;</span>,</div>
<div class="line"><a id="l00041" name="l00041"></a><span class="lineno"> 41</span> <span class="stringliteral">r&quot;$\hat{p}_2$&quot;</span>,</div>
<div class="line"><a id="l00042" name="l00042"></a><span class="lineno"> 42</span> ]</div>
<div class="line"><a id="l00043" name="l00043"></a><span class="lineno"> 43</span> colors = [</div>
<div class="line"><a id="l00044" name="l00044"></a><span class="lineno"> 44</span> <span class="stringliteral">&quot;mediumaquamarine&quot;</span>,</div>
<div class="line"><a id="l00045" name="l00045"></a><span class="lineno"> 45</span> <span class="stringliteral">&quot;salmon&quot;</span>,</div>
<div class="line"><a id="l00046" name="l00046"></a><span class="lineno"> 46</span> <span class="stringliteral">&quot;seagreen&quot;</span>,</div>
<div class="line"><a id="l00047" name="l00047"></a><span class="lineno"> 47</span> <span class="stringliteral">&quot;darkred&quot;</span></div>
<div class="line"><a id="l00048" name="l00048"></a><span class="lineno"> 48</span> ]</div>
<div class="line"><a id="l00049" name="l00049"></a><span class="lineno"> 49</span> ax = plt.figure().add_subplot(projection=<span class="stringliteral">&quot;3d&quot;</span>)</div>
<div class="line"><a id="l00050" name="l00050"></a><span class="lineno"> 50</span> <span class="keywordflow">for</span> label, color, file <span class="keywordflow">in</span> zip(labels, colors, files):</div>
<div class="line"><a id="l00051" name="l00051"></a><span class="lineno"> 51</span> <span class="keyword">with</span> open(file) <span class="keyword">as</span> f:</div>
<div class="line"><a id="l00052" name="l00052"></a><span class="lineno"> 52</span> lines = f.readlines()</div>
<div class="line"><a id="l00053" name="l00053"></a><span class="lineno"> 53</span> t = np.linspace(0, 50, len(lines))</div>
<div class="line"><a id="l00054" name="l00054"></a><span class="lineno"> 54</span> r = np.array([list(map(float, line.strip().split(<span class="stringliteral">&quot;,&quot;</span>))) <span class="keywordflow">for</span> line <span class="keywordflow">in</span> lines])</div>
<div class="line"><a id="l00055" name="l00055"></a><span class="lineno"> 55</span> ax.plot(r[:,0], r[:,1], r[:,2], label=label, color=color)</div>
<div class="line"><a id="l00056" name="l00056"></a><span class="lineno"> 56</span> </div>
<div class="line"><a id="l00057" name="l00057"></a><span class="lineno"> 57</span> ax.set_xlabel(<span class="stringliteral">r&quot;x $(\mu m)$&quot;</span>)</div>
<div class="line"><a id="l00058" name="l00058"></a><span class="lineno"> 58</span> ax.set_ylabel(<span class="stringliteral">r&quot;y $(\mu m)$&quot;</span>)</div>
<div class="line"><a id="l00059" name="l00059"></a><span class="lineno"> 59</span> ax.set_zlabel(<span class="stringliteral">r&quot;z $(\mu m)$&quot;</span>)</div>
<div class="line"><a id="l00060" name="l00060"></a><span class="lineno"> 60</span> ax.view_init(10,-35)</div>
<div class="line"><a id="l00061" name="l00061"></a><span class="lineno"> 61</span> </div>
<div class="line"><a id="l00062" name="l00062"></a><span class="lineno"> 62</span> plt.legend()</div>
<div class="line"><a id="l00063" name="l00063"></a><span class="lineno"> 63</span> plt.savefig(<span class="stringliteral">&quot;../latex/images/3d_plot.pdf&quot;</span>)</div>
<div class="line"><a id="l00064" name="l00064"></a><span class="lineno"> 64</span> </div>
<div class="line"><a id="l00065" name="l00065"></a><span class="lineno"> 65</span> </div>
<div class="line"><a id="l00066" name="l00066"></a><span class="lineno"> 66</span><span class="keywordflow">if</span> __name__ == <span class="stringliteral">&quot;__main__&quot;</span>:</div>
<div class="line"><a id="l00067" name="l00067"></a><span class="lineno"> 67</span> main()</div>
</div><!-- fragment --></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li><li class="navelem"><a class="el" href="dir_634e799a3947388232110823971192a8.html">scripts</a></li><li class="navelem"><b>plot_3d.py</b></li>
<li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li><li class="navelem"><a class="el" href="dir_634e799a3947388232110823971192a8.html">scripts</a></li><li class="navelem"><a class="el" href="plot__3d_8py.html">plot_3d.py</a></li>
<li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.6 </li>
</ul>
</div>

View File

@@ -0,0 +1,189 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.9.6"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Penning Trap Simulation: src/scripts/plot_particles_left.py File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
extensions: ["tex2jax.js"],
jax: ["input/TeX","output/HTML-CSS"],
});
</script>
<script type="text/javascript" async="async" src="https://cdn.jsdelivr.net/npm/mathjax@2/MathJax.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="doxygen-awesome.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr id="projectrow">
<td id="projectalign">
<div id="projectname">Penning Trap Simulation
</div>
<div id="projectbrief">Simulate particle behavior inside a Penning Trap</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.6 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search/",'.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(document).ready(function(){initNavTree('plot__particles__left_8py.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<div id="MSearchResults">
<div class="SRPage">
<div id="SRIndex">
<div id="SRResults"></div>
<div class="SRStatus" id="Loading">Loading...</div>
<div class="SRStatus" id="Searching">Searching...</div>
<div class="SRStatus" id="NoMatches">No Matches</div>
</div>
</div>
</div>
</div>
<div class="header">
<div class="summary">
<a href="#func-members">Functions</a> &#124;
<a href="#var-members">Variables</a> </div>
<div class="headertitle"><div class="title">plot_particles_left.py File Reference</div></div>
</div><!--header-->
<div class="contents">
<p>Plot how many particles are left after 500 microseconds using different angular frequencies.
<a href="#details">More...</a></p>
<p><a href="plot__particles__left_8py_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="func-members" name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:abec6efa92c9e476e2e3a403dac12ea1c"><td class="memItemLeft" align="right" valign="top">def&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="plot__particles__left_8py.html#abec6efa92c9e476e2e3a403dac12ea1c">plot_particles_left.main</a> ()</td></tr>
<tr class="separator:abec6efa92c9e476e2e3a403dac12ea1c"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="var-members" name="var-members"></a>
Variables</h2></td></tr>
<tr class="memitem:aad2ff4255461cc187b87065843d0b391"><td class="memItemLeft" align="right" valign="top">dict&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="plot__particles__left_8py.html#aad2ff4255461cc187b87065843d0b391">plot_particles_left.params</a></td></tr>
<tr class="separator:aad2ff4255461cc187b87065843d0b391"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Plot how many particles are left after 500 microseconds using different angular frequencies. </p>
<dl class="section author"><dt>Author</dt><dd>Cory Alexander Balaton (coryab) </dd>
<dd>
Janita Ovidie Sandtrøen Willumsen (janitaws)</dd></dl>
<dl class="section version"><dt>Version</dt><dd>1.0</dd></dl>
<dl class="bug"><dt><b><a class="el" href="bug.html#_bug000015">Bug:</a></b></dt><dd>No known bugs </dd></dl>
<p class="definition">Definition in file <a class="el" href="plot__particles__left_8py_source.html">plot_particles_left.py</a>.</p>
</div><h2 class="groupheader">Function Documentation</h2>
<a id="abec6efa92c9e476e2e3a403dac12ea1c" name="abec6efa92c9e476e2e3a403dac12ea1c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#abec6efa92c9e476e2e3a403dac12ea1c">&#9670;&#160;</a></span>main()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">def plot_particles_left.main </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p class="definition">Definition at line <a class="el" href="plot__particles__left_8py_source.html#l00029">29</a> of file <a class="el" href="plot__particles__left_8py_source.html">plot_particles_left.py</a>.</p>
</div>
</div>
<h2 class="groupheader">Variable Documentation</h2>
<a id="aad2ff4255461cc187b87065843d0b391" name="aad2ff4255461cc187b87065843d0b391"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aad2ff4255461cc187b87065843d0b391">&#9670;&#160;</a></span>params</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">dict plot_particles_left.params</td>
</tr>
</table>
</div><div class="memdoc">
<b>Initial value:</b><div class="fragment"><div class="line"><span class="lineno"> 1</span>= {</div>
<div class="line"><span class="lineno"> 2</span> <span class="stringliteral">&quot;font.family&quot;</span>: <span class="stringliteral">&quot;Serif&quot;</span>,</div>
<div class="line"><span class="lineno"> 3</span> <span class="stringliteral">&quot;font.serif&quot;</span>: <span class="stringliteral">&quot;Roman&quot;</span>, </div>
<div class="line"><span class="lineno"> 4</span> <span class="stringliteral">&quot;text.usetex&quot;</span>: <span class="keyword">True</span>,</div>
<div class="line"><span class="lineno"> 5</span> <span class="stringliteral">&quot;axes.titlesize&quot;</span>: <span class="stringliteral">&quot;large&quot;</span>,</div>
<div class="line"><span class="lineno"> 6</span> <span class="stringliteral">&quot;axes.labelsize&quot;</span>: <span class="stringliteral">&quot;large&quot;</span>,</div>
<div class="line"><span class="lineno"> 7</span> <span class="stringliteral">&quot;xtick.labelsize&quot;</span>: <span class="stringliteral">&quot;large&quot;</span>,</div>
<div class="line"><span class="lineno"> 8</span> <span class="stringliteral">&quot;ytick.labelsize&quot;</span>: <span class="stringliteral">&quot;large&quot;</span>,</div>
<div class="line"><span class="lineno"> 9</span> <span class="stringliteral">&quot;legend.fontsize&quot;</span>: <span class="stringliteral">&quot;medium&quot;</span></div>
<div class="line"><span class="lineno"> 10</span>}</div>
</div><!-- fragment -->
<p class="definition">Definition at line <a class="el" href="plot__particles__left_8py_source.html#l00017">17</a> of file <a class="el" href="plot__particles__left_8py_source.html">plot_particles_left.py</a>.</p>
</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li><li class="navelem"><a class="el" href="dir_634e799a3947388232110823971192a8.html">scripts</a></li><li class="navelem"><a class="el" href="plot__particles__left_8py.html">plot_particles_left.py</a></li>
<li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.6 </li>
</ul>
</div>
</body>
</html>

View File

@@ -101,80 +101,83 @@ $(document).ready(function(){initNavTree('plot__particles__left_8py_source.html'
<div class="headertitle"><div class="title">plot_particles_left.py</div></div>
</div><!--header-->
<div class="contents">
<div class="fragment"><div class="line"><a id="l00001" name="l00001"></a><span class="lineno"> 1</span><span class="keyword">import</span> matplotlib.pyplot <span class="keyword">as</span> plt</div>
<div class="line"><a id="l00002" name="l00002"></a><span class="lineno"> 2</span><span class="keyword">import</span> seaborn <span class="keyword">as</span> sns</div>
<div class="line"><a id="l00003" name="l00003"></a><span class="lineno"> 3</span> </div>
<div class="line"><a id="l00004" name="l00004"></a><span class="lineno"> 4</span>sns.set_theme()</div>
<div class="line"><a id="l00005" name="l00005"></a><span class="lineno"> 5</span>params = {</div>
<div class="line"><a id="l00006" name="l00006"></a><span class="lineno"> 6</span> <span class="stringliteral">&quot;font.family&quot;</span>: <span class="stringliteral">&quot;Serif&quot;</span>,</div>
<div class="line"><a id="l00007" name="l00007"></a><span class="lineno"> 7</span> <span class="stringliteral">&quot;font.serif&quot;</span>: <span class="stringliteral">&quot;Roman&quot;</span>, </div>
<div class="line"><a id="l00008" name="l00008"></a><span class="lineno"> 8</span> <span class="stringliteral">&quot;text.usetex&quot;</span>: <span class="keyword">True</span>,</div>
<div class="line"><a id="l00009" name="l00009"></a><span class="lineno"> 9</span> <span class="stringliteral">&quot;axes.titlesize&quot;</span>: <span class="stringliteral">&quot;large&quot;</span>,</div>
<div class="line"><a id="l00010" name="l00010"></a><span class="lineno"> 10</span> <span class="stringliteral">&quot;axes.labelsize&quot;</span>: <span class="stringliteral">&quot;large&quot;</span>,</div>
<div class="line"><a id="l00011" name="l00011"></a><span class="lineno"> 11</span> <span class="stringliteral">&quot;xtick.labelsize&quot;</span>: <span class="stringliteral">&quot;large&quot;</span>,</div>
<div class="line"><a id="l00012" name="l00012"></a><span class="lineno"> 12</span> <span class="stringliteral">&quot;ytick.labelsize&quot;</span>: <span class="stringliteral">&quot;large&quot;</span>,</div>
<div class="line"><a id="l00013" name="l00013"></a><span class="lineno"> 13</span> <span class="stringliteral">&quot;legend.fontsize&quot;</span>: <span class="stringliteral">&quot;medium&quot;</span></div>
<div class="line"><a id="l00014" name="l00014"></a><span class="lineno"> 14</span>}</div>
<div class="line"><a id="l00015" name="l00015"></a><span class="lineno"> 15</span>plt.rcParams.update(params)</div>
<div class="line"><a id="l00016" name="l00016"></a><span class="lineno"> 16</span> </div>
<div class="line"><a id="l00017" name="l00017"></a><span class="lineno"> 17</span><span class="keyword">def </span>main():</div>
<div class="line"><a id="l00018" name="l00018"></a><span class="lineno"> 18</span> colors = [</div>
<div class="line"><a id="l00019" name="l00019"></a><span class="lineno"> 19</span> <span class="stringliteral">&quot;lightskyblue&quot;</span>,</div>
<div class="line"><a id="l00020" name="l00020"></a><span class="lineno"> 20</span> <span class="stringliteral">&quot;deepskyblue&quot;</span>,</div>
<div class="line"><a id="l00021" name="l00021"></a><span class="lineno"> 21</span> <span class="stringliteral">&quot;salmon&quot;</span>,</div>
<div class="line"><a id="l00022" name="l00022"></a><span class="lineno"> 22</span> <span class="stringliteral">&quot;tomato&quot;</span>,</div>
<div class="line"><a id="l00023" name="l00023"></a><span class="lineno"> 23</span> <span class="stringliteral">&quot;mediumaquamarine&quot;</span>,</div>
<div class="line"><a id="l00024" name="l00024"></a><span class="lineno"> 24</span> <span class="stringliteral">&quot;mediumseagreen&quot;</span></div>
<div class="line"><a id="l00025" name="l00025"></a><span class="lineno"> 25</span> ]</div>
<div class="line"><a id="l00026" name="l00026"></a><span class="lineno"> 26</span> files = [</div>
<div class="line"><a id="l00027" name="l00027"></a><span class="lineno"> 27</span> <span class="stringliteral">&quot;output/time_dependent_potential/wide_sweep.txt&quot;</span>,</div>
<div class="line"><a id="l00028" name="l00028"></a><span class="lineno"> 28</span> <span class="stringliteral">&quot;output/time_dependent_potential/narrow_sweep.txt&quot;</span>,</div>
<div class="line"><a id="l00029" name="l00029"></a><span class="lineno"> 29</span> <span class="stringliteral">&quot;output/time_dependent_potential/narrow_sweep_interactions.txt&quot;</span>,</div>
<div class="line"><a id="l00030" name="l00030"></a><span class="lineno"> 30</span> ]</div>
<div class="line"><a id="l00031" name="l00031"></a><span class="lineno"> 31</span> outputs = [</div>
<div class="line"><a id="l00032" name="l00032"></a><span class="lineno"> 32</span> <span class="stringliteral">&quot;../latex/images/wide_sweep.pdf&quot;</span>,</div>
<div class="line"><a id="l00033" name="l00033"></a><span class="lineno"> 33</span> <span class="stringliteral">&quot;../latex/images/narrow_sweep.pdf&quot;</span>,</div>
<div class="line"><a id="l00034" name="l00034"></a><span class="lineno"> 34</span> <span class="stringliteral">&quot;../latex/images/narrow_sweep_interactions.pdf&quot;</span>,</div>
<div class="line"><a id="l00035" name="l00035"></a><span class="lineno"> 35</span> ]</div>
<div class="line"><a id="l00036" name="l00036"></a><span class="lineno"> 36</span> <span class="keywordflow">for</span> file, output <span class="keywordflow">in</span> zip(files, outputs):</div>
<div class="line"><a id="l00037" name="l00037"></a><span class="lineno"> 37</span> <span class="keyword">with</span> open(file) <span class="keyword">as</span> f:</div>
<div class="line"><a id="l00038" name="l00038"></a><span class="lineno"> 38</span> lines = f.readlines()</div>
<div class="line"><a id="l00039" name="l00039"></a><span class="lineno"> 39</span> x = []</div>
<div class="line"><a id="l00040" name="l00040"></a><span class="lineno"> 40</span> y1 = []</div>
<div class="line"><a id="l00041" name="l00041"></a><span class="lineno"> 41</span> y2 = []</div>
<div class="line"><a id="l00042" name="l00042"></a><span class="lineno"> 42</span> y3 = []</div>
<div class="line"><a id="l00043" name="l00043"></a><span class="lineno"> 43</span> <span class="keywordflow">for</span> line <span class="keywordflow">in</span> lines:</div>
<div class="line"><a id="l00044" name="l00044"></a><span class="lineno"> 44</span> l = line.strip().split(<span class="stringliteral">&quot;,&quot;</span>)</div>
<div class="line"><a id="l00045" name="l00045"></a><span class="lineno"> 45</span> x.append(float(l[0]))</div>
<div class="line"><a id="l00046" name="l00046"></a><span class="lineno"> 46</span> y1.append(float(l[1]))</div>
<div class="line"><a id="l00047" name="l00047"></a><span class="lineno"> 47</span> y2.append(float(l[2]))</div>
<div class="line"><a id="l00048" name="l00048"></a><span class="lineno"> 48</span> y3.append(float(l[3]))</div>
<div class="line"><a id="l00049" name="l00049"></a><span class="lineno"> 49</span> </div>
<div class="line"><a id="l00050" name="l00050"></a><span class="lineno"> 50</span> fig, ax = plt.subplots()</div>
<div class="line"><a id="l00051" name="l00051"></a><span class="lineno"> 51</span> ax.plot(x, y1, label=<span class="stringliteral">r&quot;$f_{1} = 0.1$&quot;</span>, color=colors[0])</div>
<div class="line"><a id="l00052" name="l00052"></a><span class="lineno"> 52</span> ax.plot(x, y2, label=<span class="stringliteral">r&quot;$f_{2} = 0.4$&quot;</span>, color=colors[2])</div>
<div class="line"><a id="l00053" name="l00053"></a><span class="lineno"> 53</span> ax.plot(x, y3, label=<span class="stringliteral">r&quot;$f_{3} = 0.7$&quot;</span>, color=colors[4])</div>
<div class="line"><a id="l00054" name="l00054"></a><span class="lineno"> 54</span> </div>
<div class="line"><a id="l00055" name="l00055"></a><span class="lineno"> 55</span> ax.set_xlabel(<span class="stringliteral">r&quot;Frequency $\omega_V$ (MHz)&quot;</span>)</div>
<div class="line"><a id="l00056" name="l00056"></a><span class="lineno"> 56</span> <span class="comment"># ax.set_xlim((0, 2.8))</span></div>
<div class="line"><a id="l00057" name="l00057"></a><span class="lineno"> 57</span> ax.set_ylabel(<span class="stringliteral">r&quot;Fraction of particles left&quot;</span>)</div>
<div class="line"><a id="l00058" name="l00058"></a><span class="lineno"> 58</span> <span class="comment"># ax.set_ylim((-0.1, 1.1))</span></div>
<div class="line"><a id="l00059" name="l00059"></a><span class="lineno"> 59</span> <span class="comment"># plt.title(r&quot;The fraction of particles left in the Penning trap &quot;</span></div>
<div class="line"><a id="l00060" name="l00060"></a><span class="lineno"> 60</span> <span class="comment"># &quot;after 500 microseconds for different amplitudes and frequencies&quot;)</span></div>
<div class="line"><a id="l00061" name="l00061"></a><span class="lineno"> 61</span> </div>
<div class="line"><a id="l00062" name="l00062"></a><span class="lineno"> 62</span> ax.legend(loc=<span class="stringliteral">&quot;upper right&quot;</span>)</div>
<div class="line"><a id="l00063" name="l00063"></a><span class="lineno"> 63</span> </div>
<div class="line"><a id="l00064" name="l00064"></a><span class="lineno"> 64</span> <span class="comment"># plt.show()</span></div>
<div class="line"><a id="l00065" name="l00065"></a><span class="lineno"> 65</span> fig.savefig(output, bbox_inches=<span class="stringliteral">&quot;tight&quot;</span>)</div>
<div class="line"><a id="l00066" name="l00066"></a><span class="lineno"> 66</span> </div>
<div class="line"><a id="l00067" name="l00067"></a><span class="lineno"> 67</span><span class="keywordflow">if</span> __name__ == <span class="stringliteral">&quot;__main__&quot;</span>:</div>
<div class="line"><a id="l00068" name="l00068"></a><span class="lineno"> 68</span> main()</div>
<a href="plot__particles__left_8py.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a id="l00001" name="l00001"></a><span class="lineno"> 1</span> </div>
<div class="line"><a id="l00012" name="l00012"></a><span class="lineno"> 12</span> </div>
<div class="line"><a id="l00013" name="l00013"></a><span class="lineno"> 13</span><span class="keyword">import</span> matplotlib.pyplot <span class="keyword">as</span> plt</div>
<div class="line"><a id="l00014" name="l00014"></a><span class="lineno"> 14</span><span class="keyword">import</span> seaborn <span class="keyword">as</span> sns</div>
<div class="line"><a id="l00015" name="l00015"></a><span class="lineno"> 15</span> </div>
<div class="line"><a id="l00016" name="l00016"></a><span class="lineno"> 16</span>sns.set_theme()</div>
<div class="line"><a id="l00017" name="l00017"></a><span class="lineno"> 17</span>params = {</div>
<div class="line"><a id="l00018" name="l00018"></a><span class="lineno"> 18</span> <span class="stringliteral">&quot;font.family&quot;</span>: <span class="stringliteral">&quot;Serif&quot;</span>,</div>
<div class="line"><a id="l00019" name="l00019"></a><span class="lineno"> 19</span> <span class="stringliteral">&quot;font.serif&quot;</span>: <span class="stringliteral">&quot;Roman&quot;</span>, </div>
<div class="line"><a id="l00020" name="l00020"></a><span class="lineno"> 20</span> <span class="stringliteral">&quot;text.usetex&quot;</span>: <span class="keyword">True</span>,</div>
<div class="line"><a id="l00021" name="l00021"></a><span class="lineno"> 21</span> <span class="stringliteral">&quot;axes.titlesize&quot;</span>: <span class="stringliteral">&quot;large&quot;</span>,</div>
<div class="line"><a id="l00022" name="l00022"></a><span class="lineno"> 22</span> <span class="stringliteral">&quot;axes.labelsize&quot;</span>: <span class="stringliteral">&quot;large&quot;</span>,</div>
<div class="line"><a id="l00023" name="l00023"></a><span class="lineno"> 23</span> <span class="stringliteral">&quot;xtick.labelsize&quot;</span>: <span class="stringliteral">&quot;large&quot;</span>,</div>
<div class="line"><a id="l00024" name="l00024"></a><span class="lineno"> 24</span> <span class="stringliteral">&quot;ytick.labelsize&quot;</span>: <span class="stringliteral">&quot;large&quot;</span>,</div>
<div class="line"><a id="l00025" name="l00025"></a><span class="lineno"> 25</span> <span class="stringliteral">&quot;legend.fontsize&quot;</span>: <span class="stringliteral">&quot;medium&quot;</span></div>
<div class="line"><a id="l00026" name="l00026"></a><span class="lineno"> 26</span>}</div>
<div class="line"><a id="l00027" name="l00027"></a><span class="lineno"> 27</span>plt.rcParams.update(params)</div>
<div class="line"><a id="l00028" name="l00028"></a><span class="lineno"> 28</span> </div>
<div class="line"><a id="l00029" name="l00029"></a><span class="lineno"> 29</span><span class="keyword">def </span>main():</div>
<div class="line"><a id="l00030" name="l00030"></a><span class="lineno"> 30</span> colors = [</div>
<div class="line"><a id="l00031" name="l00031"></a><span class="lineno"> 31</span> <span class="stringliteral">&quot;mediumseagreen&quot;</span>,</div>
<div class="line"><a id="l00032" name="l00032"></a><span class="lineno"> 32</span> <span class="stringliteral">&quot;darkred&quot;</span>,</div>
<div class="line"><a id="l00033" name="l00033"></a><span class="lineno"> 33</span> <span class="stringliteral">&quot;darkgoldenrod&quot;</span></div>
<div class="line"><a id="l00034" name="l00034"></a><span class="lineno"> 34</span> ]</div>
<div class="line"><a id="l00035" name="l00035"></a><span class="lineno"> 35</span> files = [</div>
<div class="line"><a id="l00036" name="l00036"></a><span class="lineno"> 36</span> <span class="stringliteral">&quot;output/time_dependent_potential/wide_sweep.txt&quot;</span>,</div>
<div class="line"><a id="l00037" name="l00037"></a><span class="lineno"> 37</span> <span class="stringliteral">&quot;output/time_dependent_potential/narrow_sweep.txt&quot;</span>,</div>
<div class="line"><a id="l00038" name="l00038"></a><span class="lineno"> 38</span> <span class="stringliteral">&quot;output/time_dependent_potential/narrow_sweep_fine.txt&quot;</span>,</div>
<div class="line"><a id="l00039" name="l00039"></a><span class="lineno"> 39</span> <span class="stringliteral">&quot;output/time_dependent_potential/narrow_sweep_interactions.txt&quot;</span>,</div>
<div class="line"><a id="l00040" name="l00040"></a><span class="lineno"> 40</span> <span class="stringliteral">&quot;output/time_dependent_potential/narrow_sweep_interactions_fine.txt&quot;</span>,</div>
<div class="line"><a id="l00041" name="l00041"></a><span class="lineno"> 41</span> ]</div>
<div class="line"><a id="l00042" name="l00042"></a><span class="lineno"> 42</span> outputs = [</div>
<div class="line"><a id="l00043" name="l00043"></a><span class="lineno"> 43</span> <span class="stringliteral">&quot;../latex/images/particles_left_wide_sweep.pdf&quot;</span>,</div>
<div class="line"><a id="l00044" name="l00044"></a><span class="lineno"> 44</span> <span class="stringliteral">&quot;../latex/images/particles_left_narrow_sweep.pdf&quot;</span>,</div>
<div class="line"><a id="l00045" name="l00045"></a><span class="lineno"> 45</span> <span class="stringliteral">&quot;../latex/images/particles_left_narrow_sweep_fine.pdf&quot;</span>,</div>
<div class="line"><a id="l00046" name="l00046"></a><span class="lineno"> 46</span> <span class="stringliteral">&quot;../latex/images/particles_left_narrow_sweep_interactions.pdf&quot;</span>,</div>
<div class="line"><a id="l00047" name="l00047"></a><span class="lineno"> 47</span> <span class="stringliteral">&quot;../latex/images/particles_left_narrow_sweep_interactions_fine.pdf&quot;</span>,</div>
<div class="line"><a id="l00048" name="l00048"></a><span class="lineno"> 48</span> ]</div>
<div class="line"><a id="l00049" name="l00049"></a><span class="lineno"> 49</span> <span class="keywordflow">for</span> file, output <span class="keywordflow">in</span> zip(files, outputs):</div>
<div class="line"><a id="l00050" name="l00050"></a><span class="lineno"> 50</span> <span class="keyword">with</span> open(file) <span class="keyword">as</span> f:</div>
<div class="line"><a id="l00051" name="l00051"></a><span class="lineno"> 51</span> lines = f.readlines()</div>
<div class="line"><a id="l00052" name="l00052"></a><span class="lineno"> 52</span> x = []</div>
<div class="line"><a id="l00053" name="l00053"></a><span class="lineno"> 53</span> y1 = []</div>
<div class="line"><a id="l00054" name="l00054"></a><span class="lineno"> 54</span> y2 = []</div>
<div class="line"><a id="l00055" name="l00055"></a><span class="lineno"> 55</span> y3 = []</div>
<div class="line"><a id="l00056" name="l00056"></a><span class="lineno"> 56</span> <span class="keywordflow">for</span> line <span class="keywordflow">in</span> lines:</div>
<div class="line"><a id="l00057" name="l00057"></a><span class="lineno"> 57</span> l = line.strip().split(<span class="stringliteral">&quot;,&quot;</span>)</div>
<div class="line"><a id="l00058" name="l00058"></a><span class="lineno"> 58</span> x.append(float(l[0]))</div>
<div class="line"><a id="l00059" name="l00059"></a><span class="lineno"> 59</span> y1.append(float(l[1]))</div>
<div class="line"><a id="l00060" name="l00060"></a><span class="lineno"> 60</span> y2.append(float(l[2]))</div>
<div class="line"><a id="l00061" name="l00061"></a><span class="lineno"> 61</span> y3.append(float(l[3]))</div>
<div class="line"><a id="l00062" name="l00062"></a><span class="lineno"> 62</span> </div>
<div class="line"><a id="l00063" name="l00063"></a><span class="lineno"> 63</span> fig, ax = plt.subplots()</div>
<div class="line"><a id="l00064" name="l00064"></a><span class="lineno"> 64</span> ax.plot(x, y1, label=<span class="stringliteral">r&quot;$f_{1} = 0.1$&quot;</span>, color=colors[0])</div>
<div class="line"><a id="l00065" name="l00065"></a><span class="lineno"> 65</span> ax.plot(x, y2, label=<span class="stringliteral">r&quot;$f_{2} = 0.4$&quot;</span>, color=colors[1])</div>
<div class="line"><a id="l00066" name="l00066"></a><span class="lineno"> 66</span> ax.plot(x, y3, label=<span class="stringliteral">r&quot;$f_{3} = 0.7$&quot;</span>, color=colors[2])</div>
<div class="line"><a id="l00067" name="l00067"></a><span class="lineno"> 67</span> </div>
<div class="line"><a id="l00068" name="l00068"></a><span class="lineno"> 68</span> ax.set_xlabel(<span class="stringliteral">r&quot;Angular frequency $\omega_V$ (MHz)&quot;</span>)</div>
<div class="line"><a id="l00069" name="l00069"></a><span class="lineno"> 69</span> <span class="comment"># ax.set_xlim((0, 2.8))</span></div>
<div class="line"><a id="l00070" name="l00070"></a><span class="lineno"> 70</span> ax.set_ylabel(<span class="stringliteral">r&quot;Fraction of particles left&quot;</span>)</div>
<div class="line"><a id="l00071" name="l00071"></a><span class="lineno"> 71</span> <span class="comment"># ax.set_ylim((-0.1, 1.1))</span></div>
<div class="line"><a id="l00072" name="l00072"></a><span class="lineno"> 72</span> <span class="comment"># plt.title(r&quot;The fraction of particles left in the Penning trap &quot;</span></div>
<div class="line"><a id="l00073" name="l00073"></a><span class="lineno"> 73</span> <span class="comment"># &quot;after 500 microseconds for different amplitudes and frequencies&quot;)</span></div>
<div class="line"><a id="l00074" name="l00074"></a><span class="lineno"> 74</span> </div>
<div class="line"><a id="l00075" name="l00075"></a><span class="lineno"> 75</span> ax.legend(loc=<span class="stringliteral">&quot;upper right&quot;</span>)</div>
<div class="line"><a id="l00076" name="l00076"></a><span class="lineno"> 76</span> </div>
<div class="line"><a id="l00077" name="l00077"></a><span class="lineno"> 77</span> <span class="comment"># plt.show()</span></div>
<div class="line"><a id="l00078" name="l00078"></a><span class="lineno"> 78</span> fig.savefig(output, bbox_inches=<span class="stringliteral">&quot;tight&quot;</span>)</div>
<div class="line"><a id="l00079" name="l00079"></a><span class="lineno"> 79</span> </div>
<div class="line"><a id="l00080" name="l00080"></a><span class="lineno"> 80</span><span class="keywordflow">if</span> __name__ == <span class="stringliteral">&quot;__main__&quot;</span>:</div>
<div class="line"><a id="l00081" name="l00081"></a><span class="lineno"> 81</span> main()</div>
</div><!-- fragment --></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li><li class="navelem"><a class="el" href="dir_634e799a3947388232110823971192a8.html">scripts</a></li><li class="navelem"><b>plot_particles_left.py</b></li>
<li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li><li class="navelem"><a class="el" href="dir_634e799a3947388232110823971192a8.html">scripts</a></li><li class="navelem"><a class="el" href="plot__particles__left_8py.html">plot_particles_left.py</a></li>
<li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.6 </li>
</ul>
</div>

View File

@@ -0,0 +1,189 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.9.6"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Penning Trap Simulation: src/scripts/plot_phase_space.py File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
extensions: ["tex2jax.js"],
jax: ["input/TeX","output/HTML-CSS"],
});
</script>
<script type="text/javascript" async="async" src="https://cdn.jsdelivr.net/npm/mathjax@2/MathJax.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="doxygen-awesome.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr id="projectrow">
<td id="projectalign">
<div id="projectname">Penning Trap Simulation
</div>
<div id="projectbrief">Simulate particle behavior inside a Penning Trap</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.6 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search/",'.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(document).ready(function(){initNavTree('plot__phase__space_8py.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<div id="MSearchResults">
<div class="SRPage">
<div id="SRIndex">
<div id="SRResults"></div>
<div class="SRStatus" id="Loading">Loading...</div>
<div class="SRStatus" id="Searching">Searching...</div>
<div class="SRStatus" id="NoMatches">No Matches</div>
</div>
</div>
</div>
</div>
<div class="header">
<div class="summary">
<a href="#func-members">Functions</a> &#124;
<a href="#var-members">Variables</a> </div>
<div class="headertitle"><div class="title">plot_phase_space.py File Reference</div></div>
</div><!--header-->
<div class="contents">
<p>Plot the phase space for 2 particles in the x and z direction, with and without particle interactions.
<a href="#details">More...</a></p>
<p><a href="plot__phase__space_8py_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="func-members" name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:aa92530b83695dcb6ca6adff74e5088dd"><td class="memItemLeft" align="right" valign="top">def&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="plot__phase__space_8py.html#aa92530b83695dcb6ca6adff74e5088dd">plot_phase_space.main</a> ()</td></tr>
<tr class="separator:aa92530b83695dcb6ca6adff74e5088dd"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="var-members" name="var-members"></a>
Variables</h2></td></tr>
<tr class="memitem:ac5425fde52c92b301d6815f3492b713e"><td class="memItemLeft" align="right" valign="top">dict&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="plot__phase__space_8py.html#ac5425fde52c92b301d6815f3492b713e">plot_phase_space.params</a></td></tr>
<tr class="separator:ac5425fde52c92b301d6815f3492b713e"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Plot the phase space for 2 particles in the x and z direction, with and without particle interactions. </p>
<dl class="section author"><dt>Author</dt><dd>Cory Alexander Balaton (coryab) </dd>
<dd>
Janita Ovidie Sandtrøen Willumsen (janitaws)</dd></dl>
<dl class="section version"><dt>Version</dt><dd>1.0</dd></dl>
<dl class="bug"><dt><b><a class="el" href="bug.html#_bug000016">Bug:</a></b></dt><dd>No known bugs </dd></dl>
<p class="definition">Definition in file <a class="el" href="plot__phase__space_8py_source.html">plot_phase_space.py</a>.</p>
</div><h2 class="groupheader">Function Documentation</h2>
<a id="aa92530b83695dcb6ca6adff74e5088dd" name="aa92530b83695dcb6ca6adff74e5088dd"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aa92530b83695dcb6ca6adff74e5088dd">&#9670;&#160;</a></span>main()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">def plot_phase_space.main </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p class="definition">Definition at line <a class="el" href="plot__phase__space_8py_source.html#l00031">31</a> of file <a class="el" href="plot__phase__space_8py_source.html">plot_phase_space.py</a>.</p>
</div>
</div>
<h2 class="groupheader">Variable Documentation</h2>
<a id="ac5425fde52c92b301d6815f3492b713e" name="ac5425fde52c92b301d6815f3492b713e"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ac5425fde52c92b301d6815f3492b713e">&#9670;&#160;</a></span>params</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">dict plot_phase_space.params</td>
</tr>
</table>
</div><div class="memdoc">
<b>Initial value:</b><div class="fragment"><div class="line"><span class="lineno"> 1</span>= {</div>
<div class="line"><span class="lineno"> 2</span> <span class="stringliteral">&quot;font.family&quot;</span>: <span class="stringliteral">&quot;Serif&quot;</span>,</div>
<div class="line"><span class="lineno"> 3</span> <span class="stringliteral">&quot;font.serif&quot;</span>: <span class="stringliteral">&quot;Roman&quot;</span>,</div>
<div class="line"><span class="lineno"> 4</span> <span class="stringliteral">&quot;text.usetex&quot;</span>: <span class="keyword">True</span>,</div>
<div class="line"><span class="lineno"> 5</span> <span class="stringliteral">&quot;axes.titlesize&quot;</span>: <span class="stringliteral">&quot;large&quot;</span>,</div>
<div class="line"><span class="lineno"> 6</span> <span class="stringliteral">&quot;axes.labelsize&quot;</span>: <span class="stringliteral">&quot;large&quot;</span>,</div>
<div class="line"><span class="lineno"> 7</span> <span class="stringliteral">&quot;xtick.labelsize&quot;</span>: <span class="stringliteral">&quot;large&quot;</span>,</div>
<div class="line"><span class="lineno"> 8</span> <span class="stringliteral">&quot;ytick.labelsize&quot;</span>: <span class="stringliteral">&quot;large&quot;</span>,</div>
<div class="line"><span class="lineno"> 9</span> <span class="stringliteral">&quot;legend.fontsize&quot;</span>: <span class="stringliteral">&quot;medium&quot;</span>,</div>
<div class="line"><span class="lineno"> 10</span>}</div>
</div><!-- fragment -->
<p class="definition">Definition at line <a class="el" href="plot__phase__space_8py_source.html#l00018">18</a> of file <a class="el" href="plot__phase__space_8py_source.html">plot_phase_space.py</a>.</p>
</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li><li class="navelem"><a class="el" href="dir_634e799a3947388232110823971192a8.html">scripts</a></li><li class="navelem"><a class="el" href="plot__phase__space_8py.html">plot_phase_space.py</a></li>
<li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.6 </li>
</ul>
</div>
</body>
</html>

View File

@@ -101,65 +101,88 @@ $(document).ready(function(){initNavTree('plot__phase__space_8py_source.html',''
<div class="headertitle"><div class="title">plot_phase_space.py</div></div>
</div><!--header-->
<div class="contents">
<div class="fragment"><div class="line"><a id="l00001" name="l00001"></a><span class="lineno"> 1</span><span class="keyword">import</span> matplotlib.pyplot <span class="keyword">as</span> plt</div>
<div class="line"><a id="l00002" name="l00002"></a><span class="lineno"> 2</span><span class="keyword">import</span> numpy <span class="keyword">as</span> np</div>
<div class="line"><a id="l00003" name="l00003"></a><span class="lineno"> 3</span> </div>
<div class="line"><a id="l00004" name="l00004"></a><span class="lineno"> 4</span><span class="keyword">def </span>main():</div>
<div class="line"><a id="l00005" name="l00005"></a><span class="lineno"> 5</span> directories = {</div>
<div class="line"><a id="l00006" name="l00006"></a><span class="lineno"> 6</span> <span class="stringliteral">&quot;output/simulate_2_particles/no_interaction/&quot;</span>,</div>
<div class="line"><a id="l00007" name="l00007"></a><span class="lineno"> 7</span> <span class="stringliteral">&quot;output/simulate_2_particles/with_interaction/&quot;</span>,</div>
<div class="line"><a id="l00008" name="l00008"></a><span class="lineno"> 8</span> }</div>
<div class="line"><a id="l00009" name="l00009"></a><span class="lineno"> 9</span> titles = {</div>
<div class="line"><a id="l00010" name="l00010"></a><span class="lineno"> 10</span> <span class="stringliteral">&quot;particles without interaction&quot;</span>,</div>
<div class="line"><a id="l00011" name="l00011"></a><span class="lineno"> 11</span> <span class="stringliteral">&quot;particles with interaction&quot;</span></div>
<div class="line"><a id="l00012" name="l00012"></a><span class="lineno"> 12</span> }</div>
<div class="line"><a id="l00013" name="l00013"></a><span class="lineno"> 13</span> files = [</div>
<div class="line"><a id="l00014" name="l00014"></a><span class="lineno"> 14</span> <span class="stringliteral">&quot;particle_0_r.txt&quot;</span>,</div>
<div class="line"><a id="l00015" name="l00015"></a><span class="lineno"> 15</span> <span class="stringliteral">&quot;particle_0_v.txt&quot;</span>,</div>
<div class="line"><a id="l00016" name="l00016"></a><span class="lineno"> 16</span> <span class="stringliteral">&quot;particle_1_r.txt&quot;</span>,</div>
<div class="line"><a id="l00017" name="l00017"></a><span class="lineno"> 17</span> <span class="stringliteral">&quot;particle_1_v.txt&quot;</span>,</div>
<div class="line"><a id="l00018" name="l00018"></a><span class="lineno"> 18</span> ]</div>
<div class="line"><a id="l00019" name="l00019"></a><span class="lineno"> 19</span> labels = [</div>
<div class="line"><a id="l00020" name="l00020"></a><span class="lineno"> 20</span> <span class="stringliteral">r&quot;particle 1 r&quot;</span>,</div>
<div class="line"><a id="l00021" name="l00021"></a><span class="lineno"> 21</span> <span class="stringliteral">r&quot;particle 1 v&quot;</span>,</div>
<div class="line"><a id="l00022" name="l00022"></a><span class="lineno"> 22</span> <span class="stringliteral">r&quot;particle 2 r&quot;</span>,</div>
<div class="line"><a id="l00023" name="l00023"></a><span class="lineno"> 23</span> <span class="stringliteral">r&quot;particle 2 v&quot;</span>,</div>
<div class="line"><a id="l00024" name="l00024"></a><span class="lineno"> 24</span> ]</div>
<div class="line"><a id="l00025" name="l00025"></a><span class="lineno"> 25</span> colors = [</div>
<div class="line"><a id="l00026" name="l00026"></a><span class="lineno"> 26</span> <span class="stringliteral">&quot;lightskyblue&quot;</span>,</div>
<div class="line"><a id="l00027" name="l00027"></a><span class="lineno"> 27</span> <span class="stringliteral">&quot;deepskyblue&quot;</span>,</div>
<div class="line"><a id="l00028" name="l00028"></a><span class="lineno"> 28</span> <span class="stringliteral">&quot;salmon&quot;</span>,</div>
<div class="line"><a id="l00029" name="l00029"></a><span class="lineno"> 29</span> <span class="stringliteral">&quot;tomato&quot;</span>,</div>
<div class="line"><a id="l00030" name="l00030"></a><span class="lineno"> 30</span> ]</div>
<div class="line"><a id="l00031" name="l00031"></a><span class="lineno"> 31</span> fig1, axs1 = plt.subplots(2,1)</div>
<div class="line"><a id="l00032" name="l00032"></a><span class="lineno"> 32</span> fig2, axs2 = plt.subplots(2,1)</div>
<div class="line"><a id="l00033" name="l00033"></a><span class="lineno"> 33</span> <span class="keywordflow">for</span> i, (dir, title) <span class="keywordflow">in</span> enumerate(zip(directories, titles)):</div>
<div class="line"><a id="l00034" name="l00034"></a><span class="lineno"> 34</span> <span class="keywordflow">for</span> label, color, file <span class="keywordflow">in</span> zip(labels, colors, files):</div>
<div class="line"><a id="l00035" name="l00035"></a><span class="lineno"> 35</span> <span class="keyword">with</span> open(dir+file) <span class="keyword">as</span> f:</div>
<div class="line"><a id="l00036" name="l00036"></a><span class="lineno"> 36</span> lines = f.readlines()</div>
<div class="line"><a id="l00037" name="l00037"></a><span class="lineno"> 37</span> t = np.linspace(0, 50, len(lines))</div>
<div class="line"><a id="l00038" name="l00038"></a><span class="lineno"> 38</span> r = np.array([list(map(float, line.strip().split(<span class="stringliteral">&quot;,&quot;</span>))) <span class="keywordflow">for</span> line <span class="keywordflow">in</span> lines])</div>
<div class="line"><a id="l00039" name="l00039"></a><span class="lineno"> 39</span> axs1[i].plot(t, r[:,0], label=label, color=color)</div>
<div class="line"><a id="l00040" name="l00040"></a><span class="lineno"> 40</span> axs2[i].plot(t, r[:,2], label=label, color=color)</div>
<div class="line"><a id="l00041" name="l00041"></a><span class="lineno"> 41</span> </div>
<div class="line"><a id="l00042" name="l00042"></a><span class="lineno"> 42</span> axs1[i].set(xlabel=<span class="stringliteral">r&quot;t $(\mu s)$&quot;</span>, ylabel = <span class="stringliteral">r&quot;z $(\mu m)$&quot;</span>)</div>
<div class="line"><a id="l00043" name="l00043"></a><span class="lineno"> 43</span> </div>
<div class="line"><a id="l00044" name="l00044"></a><span class="lineno"> 44</span> axs1[i].legend()</div>
<div class="line"><a id="l00045" name="l00045"></a><span class="lineno"> 45</span> axs1[i].set_title(title)</div>
<div class="line"><a id="l00046" name="l00046"></a><span class="lineno"> 46</span> </div>
<div class="line"><a id="l00047" name="l00047"></a><span class="lineno"> 47</span> <span class="comment"># plt.show()</span></div>
<div class="line"><a id="l00048" name="l00048"></a><span class="lineno"> 48</span> fig1.savefig(<span class="stringliteral">&quot;../latex/images/phase_space_2_particles_x.pdf&quot;</span>)</div>
<div class="line"><a id="l00049" name="l00049"></a><span class="lineno"> 49</span> fig2.savefig(<span class="stringliteral">&quot;../latex/images/phase_space_2_particles_z.pdf&quot;</span>)</div>
<div class="line"><a id="l00050" name="l00050"></a><span class="lineno"> 50</span> </div>
<div class="line"><a id="l00051" name="l00051"></a><span class="lineno"> 51</span> </div>
<div class="line"><a id="l00052" name="l00052"></a><span class="lineno"> 52</span><span class="keywordflow">if</span> __name__ == <span class="stringliteral">&quot;__main__&quot;</span>:</div>
<div class="line"><a id="l00053" name="l00053"></a><span class="lineno"> 53</span> main()</div>
<a href="plot__phase__space_8py.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a id="l00001" name="l00001"></a><span class="lineno"> 1</span> </div>
<div class="line"><a id="l00012" name="l00012"></a><span class="lineno"> 12</span> </div>
<div class="line"><a id="l00013" name="l00013"></a><span class="lineno"> 13</span><span class="keyword">import</span> matplotlib.pyplot <span class="keyword">as</span> plt</div>
<div class="line"><a id="l00014" name="l00014"></a><span class="lineno"> 14</span><span class="keyword">import</span> numpy <span class="keyword">as</span> np</div>
<div class="line"><a id="l00015" name="l00015"></a><span class="lineno"> 15</span><span class="keyword">import</span> seaborn <span class="keyword">as</span> sns</div>
<div class="line"><a id="l00016" name="l00016"></a><span class="lineno"> 16</span> </div>
<div class="line"><a id="l00017" name="l00017"></a><span class="lineno"> 17</span>sns.set_theme()</div>
<div class="line"><a id="l00018" name="l00018"></a><span class="lineno"> 18</span>params = {</div>
<div class="line"><a id="l00019" name="l00019"></a><span class="lineno"> 19</span> <span class="stringliteral">&quot;font.family&quot;</span>: <span class="stringliteral">&quot;Serif&quot;</span>,</div>
<div class="line"><a id="l00020" name="l00020"></a><span class="lineno"> 20</span> <span class="stringliteral">&quot;font.serif&quot;</span>: <span class="stringliteral">&quot;Roman&quot;</span>,</div>
<div class="line"><a id="l00021" name="l00021"></a><span class="lineno"> 21</span> <span class="stringliteral">&quot;text.usetex&quot;</span>: <span class="keyword">True</span>,</div>
<div class="line"><a id="l00022" name="l00022"></a><span class="lineno"> 22</span> <span class="stringliteral">&quot;axes.titlesize&quot;</span>: <span class="stringliteral">&quot;large&quot;</span>,</div>
<div class="line"><a id="l00023" name="l00023"></a><span class="lineno"> 23</span> <span class="stringliteral">&quot;axes.labelsize&quot;</span>: <span class="stringliteral">&quot;large&quot;</span>,</div>
<div class="line"><a id="l00024" name="l00024"></a><span class="lineno"> 24</span> <span class="stringliteral">&quot;xtick.labelsize&quot;</span>: <span class="stringliteral">&quot;large&quot;</span>,</div>
<div class="line"><a id="l00025" name="l00025"></a><span class="lineno"> 25</span> <span class="stringliteral">&quot;ytick.labelsize&quot;</span>: <span class="stringliteral">&quot;large&quot;</span>,</div>
<div class="line"><a id="l00026" name="l00026"></a><span class="lineno"> 26</span> <span class="stringliteral">&quot;legend.fontsize&quot;</span>: <span class="stringliteral">&quot;medium&quot;</span>,</div>
<div class="line"><a id="l00027" name="l00027"></a><span class="lineno"> 27</span>}</div>
<div class="line"><a id="l00028" name="l00028"></a><span class="lineno"> 28</span>plt.rcParams.update(params)</div>
<div class="line"><a id="l00029" name="l00029"></a><span class="lineno"> 29</span> </div>
<div class="line"><a id="l00030" name="l00030"></a><span class="lineno"> 30</span> </div>
<div class="line"><a id="l00031" name="l00031"></a><span class="lineno"> 31</span><span class="keyword">def </span>main():</div>
<div class="line"><a id="l00032" name="l00032"></a><span class="lineno"> 32</span> directories = [</div>
<div class="line"><a id="l00033" name="l00033"></a><span class="lineno"> 33</span> <span class="stringliteral">&quot;output/simulate_2_particles/no_interaction/&quot;</span>,</div>
<div class="line"><a id="l00034" name="l00034"></a><span class="lineno"> 34</span> <span class="stringliteral">&quot;output/simulate_2_particles/with_interaction/&quot;</span>,</div>
<div class="line"><a id="l00035" name="l00035"></a><span class="lineno"> 35</span> ]</div>
<div class="line"><a id="l00036" name="l00036"></a><span class="lineno"> 36</span> files = [</div>
<div class="line"><a id="l00037" name="l00037"></a><span class="lineno"> 37</span> <span class="stringliteral">&quot;particle_0&quot;</span>,</div>
<div class="line"><a id="l00038" name="l00038"></a><span class="lineno"> 38</span> <span class="stringliteral">&quot;particle_1&quot;</span>,</div>
<div class="line"><a id="l00039" name="l00039"></a><span class="lineno"> 39</span> ]</div>
<div class="line"><a id="l00040" name="l00040"></a><span class="lineno"> 40</span> labels = [<span class="stringliteral">r&quot;$p_1$&quot;</span>, <span class="stringliteral">r&quot;$p_2$&quot;</span>]</div>
<div class="line"><a id="l00041" name="l00041"></a><span class="lineno"> 41</span> output = [</div>
<div class="line"><a id="l00042" name="l00042"></a><span class="lineno"> 42</span> <span class="stringliteral">&quot;../latex/images/phase_space_no_interaction&quot;</span>,</div>
<div class="line"><a id="l00043" name="l00043"></a><span class="lineno"> 43</span> <span class="stringliteral">&quot;../latex/images/phase_space_interaction&quot;</span>,</div>
<div class="line"><a id="l00044" name="l00044"></a><span class="lineno"> 44</span> ]</div>
<div class="line"><a id="l00045" name="l00045"></a><span class="lineno"> 45</span> colors = [</div>
<div class="line"><a id="l00046" name="l00046"></a><span class="lineno"> 46</span> <span class="stringliteral">&quot;seagreen&quot;</span>,</div>
<div class="line"><a id="l00047" name="l00047"></a><span class="lineno"> 47</span> <span class="stringliteral">&quot;darkred&quot;</span>,</div>
<div class="line"><a id="l00048" name="l00048"></a><span class="lineno"> 48</span> ]</div>
<div class="line"><a id="l00049" name="l00049"></a><span class="lineno"> 49</span> </div>
<div class="line"><a id="l00050" name="l00050"></a><span class="lineno"> 50</span> <span class="keywordflow">for</span> i, dir <span class="keywordflow">in</span> enumerate(directories):</div>
<div class="line"><a id="l00051" name="l00051"></a><span class="lineno"> 51</span> fig1, axs1 = plt.subplots(sharex=<span class="keyword">True</span>)</div>
<div class="line"><a id="l00052" name="l00052"></a><span class="lineno"> 52</span> fig2, axs2 = plt.subplots(sharex=<span class="keyword">True</span>)</div>
<div class="line"><a id="l00053" name="l00053"></a><span class="lineno"> 53</span> <span class="keywordflow">for</span> j, (file, label, color) <span class="keywordflow">in</span> enumerate(zip(files, labels, colors)):</div>
<div class="line"><a id="l00054" name="l00054"></a><span class="lineno"> 54</span> r = []</div>
<div class="line"><a id="l00055" name="l00055"></a><span class="lineno"> 55</span> v = []</div>
<div class="line"><a id="l00056" name="l00056"></a><span class="lineno"> 56</span> <span class="keyword">with</span> open(dir + file + <span class="stringliteral">&quot;_r.txt&quot;</span>) <span class="keyword">as</span> f:</div>
<div class="line"><a id="l00057" name="l00057"></a><span class="lineno"> 57</span> lines = f.readlines()</div>
<div class="line"><a id="l00058" name="l00058"></a><span class="lineno"> 58</span> r = np.array(</div>
<div class="line"><a id="l00059" name="l00059"></a><span class="lineno"> 59</span> [list(map(float, line.strip().split(<span class="stringliteral">&quot;,&quot;</span>))) <span class="keywordflow">for</span> line <span class="keywordflow">in</span> lines]</div>
<div class="line"><a id="l00060" name="l00060"></a><span class="lineno"> 60</span> )</div>
<div class="line"><a id="l00061" name="l00061"></a><span class="lineno"> 61</span> </div>
<div class="line"><a id="l00062" name="l00062"></a><span class="lineno"> 62</span> <span class="keyword">with</span> open(dir + file + <span class="stringliteral">&quot;_v.txt&quot;</span>) <span class="keyword">as</span> f:</div>
<div class="line"><a id="l00063" name="l00063"></a><span class="lineno"> 63</span> lines = f.readlines()</div>
<div class="line"><a id="l00064" name="l00064"></a><span class="lineno"> 64</span> v = np.array(</div>
<div class="line"><a id="l00065" name="l00065"></a><span class="lineno"> 65</span> [list(map(float, line.strip().split(<span class="stringliteral">&quot;,&quot;</span>))) <span class="keywordflow">for</span> line <span class="keywordflow">in</span> lines]</div>
<div class="line"><a id="l00066" name="l00066"></a><span class="lineno"> 66</span> )</div>
<div class="line"><a id="l00067" name="l00067"></a><span class="lineno"> 67</span> axs1.plot(r[:, 0], v[:, 0], label=label, color=color)</div>
<div class="line"><a id="l00068" name="l00068"></a><span class="lineno"> 68</span> axs1.plot(r[0,0], v[0,0], <span class="stringliteral">&quot;ko&quot;</span>)</div>
<div class="line"><a id="l00069" name="l00069"></a><span class="lineno"> 69</span> axs2.plot(r[:, 2], v[:, 2], label=label, color=color)</div>
<div class="line"><a id="l00070" name="l00070"></a><span class="lineno"> 70</span> axs2.plot(r[0,2], v[0,2], <span class="stringliteral">&quot;ko&quot;</span>)</div>
<div class="line"><a id="l00071" name="l00071"></a><span class="lineno"> 71</span> axs1.axis(<span class="stringliteral">&quot;equal&quot;</span>)</div>
<div class="line"><a id="l00072" name="l00072"></a><span class="lineno"> 72</span> axs2.axis(<span class="stringliteral">&quot;equal&quot;</span>)</div>
<div class="line"><a id="l00073" name="l00073"></a><span class="lineno"> 73</span> </div>
<div class="line"><a id="l00074" name="l00074"></a><span class="lineno"> 74</span> axs1.set(xlabel=<span class="stringliteral">r&quot;$x (\mu m)$&quot;</span>, ylabel=<span class="stringliteral">r&quot;$v_x (\mu m / \mu s)$&quot;</span>)</div>
<div class="line"><a id="l00075" name="l00075"></a><span class="lineno"> 75</span> axs2.set(xlabel=<span class="stringliteral">r&quot;$z (\mu m)$&quot;</span>, ylabel=<span class="stringliteral">r&quot;$v_z (\mu m / \mu s)$&quot;</span>)</div>
<div class="line"><a id="l00076" name="l00076"></a><span class="lineno"> 76</span> </div>
<div class="line"><a id="l00077" name="l00077"></a><span class="lineno"> 77</span> axs1.legend(loc=<span class="stringliteral">&quot;upper right&quot;</span>)</div>
<div class="line"><a id="l00078" name="l00078"></a><span class="lineno"> 78</span> axs2.legend(loc=<span class="stringliteral">&quot;upper right&quot;</span>)</div>
<div class="line"><a id="l00079" name="l00079"></a><span class="lineno"> 79</span> </div>
<div class="line"><a id="l00080" name="l00080"></a><span class="lineno"> 80</span> fig1.savefig(f<span class="stringliteral">&quot;{output[i]}_x.pdf&quot;</span>, bbox_inches=<span class="stringliteral">&quot;tight&quot;</span>)</div>
<div class="line"><a id="l00081" name="l00081"></a><span class="lineno"> 81</span> fig2.savefig(f<span class="stringliteral">&quot;{output[i]}_z.pdf&quot;</span>, bbox_inches=<span class="stringliteral">&quot;tight&quot;</span>)</div>
<div class="line"><a id="l00082" name="l00082"></a><span class="lineno"> 82</span> <span class="comment"># plt.show()</span></div>
<div class="line"><a id="l00083" name="l00083"></a><span class="lineno"> 83</span> </div>
<div class="line"><a id="l00084" name="l00084"></a><span class="lineno"> 84</span> </div>
<div class="line"><a id="l00085" name="l00085"></a><span class="lineno"> 85</span><span class="keywordflow">if</span> __name__ == <span class="stringliteral">&quot;__main__&quot;</span>:</div>
<div class="line"><a id="l00086" name="l00086"></a><span class="lineno"> 86</span> main()</div>
</div><!-- fragment --></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li><li class="navelem"><a class="el" href="dir_634e799a3947388232110823971192a8.html">scripts</a></li><li class="navelem"><b>plot_phase_space.py</b></li>
<li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li><li class="navelem"><a class="el" href="dir_634e799a3947388232110823971192a8.html">scripts</a></li><li class="navelem"><a class="el" href="plot__phase__space_8py.html">plot_phase_space.py</a></li>
<li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.6 </li>
</ul>
</div>

View File

@@ -0,0 +1,189 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.9.6"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Penning Trap Simulation: src/scripts/plot_relative_error.py File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
extensions: ["tex2jax.js"],
jax: ["input/TeX","output/HTML-CSS"],
});
</script>
<script type="text/javascript" async="async" src="https://cdn.jsdelivr.net/npm/mathjax@2/MathJax.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="doxygen-awesome.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr id="projectrow">
<td id="projectalign">
<div id="projectname">Penning Trap Simulation
</div>
<div id="projectbrief">Simulate particle behavior inside a Penning Trap</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.6 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search/",'.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(document).ready(function(){initNavTree('plot__relative__error_8py.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<div id="MSearchResults">
<div class="SRPage">
<div id="SRIndex">
<div id="SRResults"></div>
<div class="SRStatus" id="Loading">Loading...</div>
<div class="SRStatus" id="Searching">Searching...</div>
<div class="SRStatus" id="NoMatches">No Matches</div>
</div>
</div>
</div>
</div>
<div class="header">
<div class="summary">
<a href="#func-members">Functions</a> &#124;
<a href="#var-members">Variables</a> </div>
<div class="headertitle"><div class="title">plot_relative_error.py File Reference</div></div>
</div><!--header-->
<div class="contents">
<p>Plot the relative error for forward Euler and RK4 method.
<a href="#details">More...</a></p>
<p><a href="plot__relative__error_8py_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="func-members" name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:a615fd09c73966d40320e768bed20683c"><td class="memItemLeft" align="right" valign="top">def&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="plot__relative__error_8py.html#a615fd09c73966d40320e768bed20683c">plot_relative_error.main</a> ()</td></tr>
<tr class="separator:a615fd09c73966d40320e768bed20683c"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="var-members" name="var-members"></a>
Variables</h2></td></tr>
<tr class="memitem:a5cc494411e5ca543673367a938f5f160"><td class="memItemLeft" align="right" valign="top">dict&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="plot__relative__error_8py.html#a5cc494411e5ca543673367a938f5f160">plot_relative_error.params</a></td></tr>
<tr class="separator:a5cc494411e5ca543673367a938f5f160"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Plot the relative error for forward Euler and RK4 method. </p>
<dl class="section author"><dt>Author</dt><dd>Cory Alexander Balaton (coryab) </dd>
<dd>
Janita Ovidie Sandtrøen Willumsen (janitaws)</dd></dl>
<dl class="section version"><dt>Version</dt><dd>1.0</dd></dl>
<dl class="bug"><dt><b><a class="el" href="bug.html#_bug000017">Bug:</a></b></dt><dd>No known bugs </dd></dl>
<p class="definition">Definition in file <a class="el" href="plot__relative__error_8py_source.html">plot_relative_error.py</a>.</p>
</div><h2 class="groupheader">Function Documentation</h2>
<a id="a615fd09c73966d40320e768bed20683c" name="a615fd09c73966d40320e768bed20683c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a615fd09c73966d40320e768bed20683c">&#9670;&#160;</a></span>main()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">def plot_relative_error.main </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p class="definition">Definition at line <a class="el" href="plot__relative__error_8py_source.html#l00029">29</a> of file <a class="el" href="plot__relative__error_8py_source.html">plot_relative_error.py</a>.</p>
</div>
</div>
<h2 class="groupheader">Variable Documentation</h2>
<a id="a5cc494411e5ca543673367a938f5f160" name="a5cc494411e5ca543673367a938f5f160"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a5cc494411e5ca543673367a938f5f160">&#9670;&#160;</a></span>params</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">dict plot_relative_error.params</td>
</tr>
</table>
</div><div class="memdoc">
<b>Initial value:</b><div class="fragment"><div class="line"><span class="lineno"> 1</span>= {</div>
<div class="line"><span class="lineno"> 2</span> <span class="stringliteral">&quot;font.family&quot;</span>: <span class="stringliteral">&quot;Serif&quot;</span>,</div>
<div class="line"><span class="lineno"> 3</span> <span class="stringliteral">&quot;font.serif&quot;</span>: <span class="stringliteral">&quot;Roman&quot;</span>, </div>
<div class="line"><span class="lineno"> 4</span> <span class="stringliteral">&quot;text.usetex&quot;</span>: <span class="keyword">True</span>,</div>
<div class="line"><span class="lineno"> 5</span> <span class="stringliteral">&quot;axes.titlesize&quot;</span>: <span class="stringliteral">&quot;large&quot;</span>,</div>
<div class="line"><span class="lineno"> 6</span> <span class="stringliteral">&quot;axes.labelsize&quot;</span>: <span class="stringliteral">&quot;large&quot;</span>,</div>
<div class="line"><span class="lineno"> 7</span> <span class="stringliteral">&quot;xtick.labelsize&quot;</span>: <span class="stringliteral">&quot;large&quot;</span>,</div>
<div class="line"><span class="lineno"> 8</span> <span class="stringliteral">&quot;ytick.labelsize&quot;</span>: <span class="stringliteral">&quot;large&quot;</span>,</div>
<div class="line"><span class="lineno"> 9</span> <span class="stringliteral">&quot;legend.fontsize&quot;</span>: <span class="stringliteral">&quot;medium&quot;</span></div>
<div class="line"><span class="lineno"> 10</span>}</div>
</div><!-- fragment -->
<p class="definition">Definition at line <a class="el" href="plot__relative__error_8py_source.html#l00017">17</a> of file <a class="el" href="plot__relative__error_8py_source.html">plot_relative_error.py</a>.</p>
</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li><li class="navelem"><a class="el" href="dir_634e799a3947388232110823971192a8.html">scripts</a></li><li class="navelem"><a class="el" href="plot__relative__error_8py.html">plot_relative_error.py</a></li>
<li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.6 </li>
</ul>
</div>
</body>
</html>

View File

@@ -101,63 +101,86 @@ $(document).ready(function(){initNavTree('plot__relative__error_8py_source.html'
<div class="headertitle"><div class="title">plot_relative_error.py</div></div>
</div><!--header-->
<div class="contents">
<div class="fragment"><div class="line"><a id="l00001" name="l00001"></a><span class="lineno"> 1</span><span class="keyword">import</span> matplotlib.pyplot <span class="keyword">as</span> plt</div>
<div class="line"><a id="l00002" name="l00002"></a><span class="lineno"> 2</span><span class="keyword">import</span> numpy <span class="keyword">as</span> np</div>
<div class="line"><a id="l00003" name="l00003"></a><span class="lineno"> 3</span> </div>
<div class="line"><a id="l00004" name="l00004"></a><span class="lineno"> 4</span><span class="keyword">def </span>main():</div>
<div class="line"><a id="l00005" name="l00005"></a><span class="lineno"> 5</span> directories = [</div>
<div class="line"><a id="l00006" name="l00006"></a><span class="lineno"> 6</span> <span class="stringliteral">&quot;output/relative_error/RK4/&quot;</span>,</div>
<div class="line"><a id="l00007" name="l00007"></a><span class="lineno"> 7</span> <span class="stringliteral">&quot;output/relative_error/euler/&quot;</span>,</div>
<div class="line"><a id="l00008" name="l00008"></a><span class="lineno"> 8</span> ]</div>
<div class="line"><a id="l00009" name="l00009"></a><span class="lineno"> 9</span> files = [</div>
<div class="line"><a id="l00010" name="l00010"></a><span class="lineno"> 10</span> <span class="stringliteral">&quot;4000_steps.txt&quot;</span>,</div>
<div class="line"><a id="l00011" name="l00011"></a><span class="lineno"> 11</span> <span class="stringliteral">&quot;8000_steps.txt&quot;</span>,</div>
<div class="line"><a id="l00012" name="l00012"></a><span class="lineno"> 12</span> <span class="stringliteral">&quot;16000_steps.txt&quot;</span>,</div>
<div class="line"><a id="l00013" name="l00013"></a><span class="lineno"> 13</span> <span class="stringliteral">&quot;32000_steps.txt&quot;</span>,</div>
<div class="line"><a id="l00014" name="l00014"></a><span class="lineno"> 14</span> ]</div>
<div class="line"><a id="l00015" name="l00015"></a><span class="lineno"> 15</span> labels = [</div>
<div class="line"><a id="l00016" name="l00016"></a><span class="lineno"> 16</span> <span class="stringliteral">r&quot;4000 steps&quot;</span>,</div>
<div class="line"><a id="l00017" name="l00017"></a><span class="lineno"> 17</span> <span class="stringliteral">r&quot;8000 steps&quot;</span>,</div>
<div class="line"><a id="l00018" name="l00018"></a><span class="lineno"> 18</span> <span class="stringliteral">r&quot;16000 steps&quot;</span>,</div>
<div class="line"><a id="l00019" name="l00019"></a><span class="lineno"> 19</span> <span class="stringliteral">r&quot;32000 steps&quot;</span>,</div>
<div class="line"><a id="l00020" name="l00020"></a><span class="lineno"> 20</span> ]</div>
<div class="line"><a id="l00021" name="l00021"></a><span class="lineno"> 21</span> titles = [</div>
<div class="line"><a id="l00022" name="l00022"></a><span class="lineno"> 22</span> <span class="stringliteral">&quot;Relative error for the RK4 method&quot;</span>,</div>
<div class="line"><a id="l00023" name="l00023"></a><span class="lineno"> 23</span> <span class="stringliteral">&quot;Relative error for the forward Euler method&quot;</span></div>
<div class="line"><a id="l00024" name="l00024"></a><span class="lineno"> 24</span> ]</div>
<div class="line"><a id="l00025" name="l00025"></a><span class="lineno"> 25</span> methods = [</div>
<div class="line"><a id="l00026" name="l00026"></a><span class="lineno"> 26</span> <span class="stringliteral">&quot;rk4&quot;</span>,</div>
<div class="line"><a id="l00027" name="l00027"></a><span class="lineno"> 27</span> <span class="stringliteral">&quot;euler&quot;</span></div>
<div class="line"><a id="l00028" name="l00028"></a><span class="lineno"> 28</span> ]</div>
<div class="line"><a id="l00029" name="l00029"></a><span class="lineno"> 29</span> fig1, axs1 = plt.subplots(2,1)</div>
<div class="line"><a id="l00030" name="l00030"></a><span class="lineno"> 30</span> <span class="keywordflow">for</span> i, (dir, title) <span class="keywordflow">in</span> enumerate(list(zip(directories, titles))):</div>
<div class="line"><a id="l00031" name="l00031"></a><span class="lineno"> 31</span> max_err = []</div>
<div class="line"><a id="l00032" name="l00032"></a><span class="lineno"> 32</span> <span class="keywordflow">for</span> label, file <span class="keywordflow">in</span> zip(labels, files):</div>
<div class="line"><a id="l00033" name="l00033"></a><span class="lineno"> 33</span> <span class="keyword">with</span> open(dir+file) <span class="keyword">as</span> f:</div>
<div class="line"><a id="l00034" name="l00034"></a><span class="lineno"> 34</span> lines = f.readlines()</div>
<div class="line"><a id="l00035" name="l00035"></a><span class="lineno"> 35</span> t = np.linspace(0, 50, len(lines))</div>
<div class="line"><a id="l00036" name="l00036"></a><span class="lineno"> 36</span> r = np.array([float(line.strip()) <span class="keywordflow">for</span> line <span class="keywordflow">in</span> lines])</div>
<div class="line"><a id="l00037" name="l00037"></a><span class="lineno"> 37</span> max_err.append(max(r))</div>
<div class="line"><a id="l00038" name="l00038"></a><span class="lineno"> 38</span> axs1[i].plot(t, r, label=label)</div>
<div class="line"><a id="l00039" name="l00039"></a><span class="lineno"> 39</span> </div>
<div class="line"><a id="l00040" name="l00040"></a><span class="lineno"> 40</span> axs1[i].set(xlabel=<span class="stringliteral">r&quot;t $(\mu s)$&quot;</span>, ylabel = <span class="stringliteral">r&quot;relative_error $(\mu m)$&quot;</span>)</div>
<div class="line"><a id="l00041" name="l00041"></a><span class="lineno"> 41</span> axs1[i].legend()</div>
<div class="line"><a id="l00042" name="l00042"></a><span class="lineno"> 42</span> axs1[i].set_title(title)</div>
<div class="line"><a id="l00043" name="l00043"></a><span class="lineno"> 43</span> </div>
<div class="line"><a id="l00044" name="l00044"></a><span class="lineno"> 44</span> conv_rate = 1/3 * sum([np.log2(max_err[i+1]/max_err[i])/np.log2(.5) <span class="keywordflow">for</span> i <span class="keywordflow">in</span> range(3)])</div>
<div class="line"><a id="l00045" name="l00045"></a><span class="lineno"> 45</span> print(f<span class="stringliteral">&quot;{methods[i]}: {conv_rate}&quot;</span>)</div>
<div class="line"><a id="l00046" name="l00046"></a><span class="lineno"> 46</span> </div>
<div class="line"><a id="l00047" name="l00047"></a><span class="lineno"> 47</span> fig1.savefig(<span class="stringliteral">&quot;../latex/images/phase_space_2_particles_x.pdf&quot;</span>)</div>
<div class="line"><a id="l00048" name="l00048"></a><span class="lineno"> 48</span> </div>
<div class="line"><a id="l00049" name="l00049"></a><span class="lineno"> 49</span> </div>
<div class="line"><a id="l00050" name="l00050"></a><span class="lineno"> 50</span><span class="keywordflow">if</span> __name__ == <span class="stringliteral">&quot;__main__&quot;</span>:</div>
<div class="line"><a id="l00051" name="l00051"></a><span class="lineno"> 51</span> main()</div>
<a href="plot__relative__error_8py.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a id="l00001" name="l00001"></a><span class="lineno"> 1</span> </div>
<div class="line"><a id="l00011" name="l00011"></a><span class="lineno"> 11</span> </div>
<div class="line"><a id="l00012" name="l00012"></a><span class="lineno"> 12</span><span class="keyword">import</span> matplotlib.pyplot <span class="keyword">as</span> plt</div>
<div class="line"><a id="l00013" name="l00013"></a><span class="lineno"> 13</span><span class="keyword">import</span> numpy <span class="keyword">as</span> np</div>
<div class="line"><a id="l00014" name="l00014"></a><span class="lineno"> 14</span><span class="keyword">import</span> seaborn <span class="keyword">as</span> sns</div>
<div class="line"><a id="l00015" name="l00015"></a><span class="lineno"> 15</span> </div>
<div class="line"><a id="l00016" name="l00016"></a><span class="lineno"> 16</span>sns.set_theme()</div>
<div class="line"><a id="l00017" name="l00017"></a><span class="lineno"> 17</span>params = {</div>
<div class="line"><a id="l00018" name="l00018"></a><span class="lineno"> 18</span> <span class="stringliteral">&quot;font.family&quot;</span>: <span class="stringliteral">&quot;Serif&quot;</span>,</div>
<div class="line"><a id="l00019" name="l00019"></a><span class="lineno"> 19</span> <span class="stringliteral">&quot;font.serif&quot;</span>: <span class="stringliteral">&quot;Roman&quot;</span>, </div>
<div class="line"><a id="l00020" name="l00020"></a><span class="lineno"> 20</span> <span class="stringliteral">&quot;text.usetex&quot;</span>: <span class="keyword">True</span>,</div>
<div class="line"><a id="l00021" name="l00021"></a><span class="lineno"> 21</span> <span class="stringliteral">&quot;axes.titlesize&quot;</span>: <span class="stringliteral">&quot;large&quot;</span>,</div>
<div class="line"><a id="l00022" name="l00022"></a><span class="lineno"> 22</span> <span class="stringliteral">&quot;axes.labelsize&quot;</span>: <span class="stringliteral">&quot;large&quot;</span>,</div>
<div class="line"><a id="l00023" name="l00023"></a><span class="lineno"> 23</span> <span class="stringliteral">&quot;xtick.labelsize&quot;</span>: <span class="stringliteral">&quot;large&quot;</span>,</div>
<div class="line"><a id="l00024" name="l00024"></a><span class="lineno"> 24</span> <span class="stringliteral">&quot;ytick.labelsize&quot;</span>: <span class="stringliteral">&quot;large&quot;</span>,</div>
<div class="line"><a id="l00025" name="l00025"></a><span class="lineno"> 25</span> <span class="stringliteral">&quot;legend.fontsize&quot;</span>: <span class="stringliteral">&quot;medium&quot;</span></div>
<div class="line"><a id="l00026" name="l00026"></a><span class="lineno"> 26</span>}</div>
<div class="line"><a id="l00027" name="l00027"></a><span class="lineno"> 27</span>plt.rcParams.update(params)</div>
<div class="line"><a id="l00028" name="l00028"></a><span class="lineno"> 28</span> </div>
<div class="line"><a id="l00029" name="l00029"></a><span class="lineno"> 29</span><span class="keyword">def </span>main():</div>
<div class="line"><a id="l00030" name="l00030"></a><span class="lineno"> 30</span> directories = [</div>
<div class="line"><a id="l00031" name="l00031"></a><span class="lineno"> 31</span> <span class="stringliteral">&quot;output/relative_error/RK4/&quot;</span>,</div>
<div class="line"><a id="l00032" name="l00032"></a><span class="lineno"> 32</span> <span class="stringliteral">&quot;output/relative_error/euler/&quot;</span>,</div>
<div class="line"><a id="l00033" name="l00033"></a><span class="lineno"> 33</span> ]</div>
<div class="line"><a id="l00034" name="l00034"></a><span class="lineno"> 34</span> files = [</div>
<div class="line"><a id="l00035" name="l00035"></a><span class="lineno"> 35</span> <span class="stringliteral">&quot;4000_steps.txt&quot;</span>,</div>
<div class="line"><a id="l00036" name="l00036"></a><span class="lineno"> 36</span> <span class="stringliteral">&quot;8000_steps.txt&quot;</span>,</div>
<div class="line"><a id="l00037" name="l00037"></a><span class="lineno"> 37</span> <span class="stringliteral">&quot;16000_steps.txt&quot;</span>,</div>
<div class="line"><a id="l00038" name="l00038"></a><span class="lineno"> 38</span> <span class="stringliteral">&quot;32000_steps.txt&quot;</span>,</div>
<div class="line"><a id="l00039" name="l00039"></a><span class="lineno"> 39</span> ]</div>
<div class="line"><a id="l00040" name="l00040"></a><span class="lineno"> 40</span> labels = [</div>
<div class="line"><a id="l00041" name="l00041"></a><span class="lineno"> 41</span> <span class="stringliteral">r&quot;$n_1$&quot;</span>,</div>
<div class="line"><a id="l00042" name="l00042"></a><span class="lineno"> 42</span> <span class="stringliteral">r&quot;$n_2$&quot;</span>,</div>
<div class="line"><a id="l00043" name="l00043"></a><span class="lineno"> 43</span> <span class="stringliteral">r&quot;$n_3$&quot;</span>,</div>
<div class="line"><a id="l00044" name="l00044"></a><span class="lineno"> 44</span> <span class="stringliteral">r&quot;$n_4$&quot;</span>,</div>
<div class="line"><a id="l00045" name="l00045"></a><span class="lineno"> 45</span> ]</div>
<div class="line"><a id="l00046" name="l00046"></a><span class="lineno"> 46</span> titles = [</div>
<div class="line"><a id="l00047" name="l00047"></a><span class="lineno"> 47</span> <span class="stringliteral">&quot;(a)&quot;</span>,</div>
<div class="line"><a id="l00048" name="l00048"></a><span class="lineno"> 48</span> <span class="stringliteral">&quot;(b)&quot;</span></div>
<div class="line"><a id="l00049" name="l00049"></a><span class="lineno"> 49</span> ]</div>
<div class="line"><a id="l00050" name="l00050"></a><span class="lineno"> 50</span> methods = [</div>
<div class="line"><a id="l00051" name="l00051"></a><span class="lineno"> 51</span> <span class="stringliteral">&quot;rk4&quot;</span>,</div>
<div class="line"><a id="l00052" name="l00052"></a><span class="lineno"> 52</span> <span class="stringliteral">&quot;euler&quot;</span></div>
<div class="line"><a id="l00053" name="l00053"></a><span class="lineno"> 53</span> ]</div>
<div class="line"><a id="l00054" name="l00054"></a><span class="lineno"> 54</span> colors = [</div>
<div class="line"><a id="l00055" name="l00055"></a><span class="lineno"> 55</span> <span class="stringliteral">&quot;seagreen&quot;</span>,</div>
<div class="line"><a id="l00056" name="l00056"></a><span class="lineno"> 56</span> <span class="stringliteral">&quot;darkred&quot;</span>,</div>
<div class="line"><a id="l00057" name="l00057"></a><span class="lineno"> 57</span> <span class="stringliteral">&quot;darkgoldenrod&quot;</span>,</div>
<div class="line"><a id="l00058" name="l00058"></a><span class="lineno"> 58</span> <span class="stringliteral">&quot;steelblue&quot;</span></div>
<div class="line"><a id="l00059" name="l00059"></a><span class="lineno"> 59</span> ]</div>
<div class="line"><a id="l00060" name="l00060"></a><span class="lineno"> 60</span> fig1, axs1 = plt.subplots(2,1)</div>
<div class="line"><a id="l00061" name="l00061"></a><span class="lineno"> 61</span> <span class="keywordflow">for</span> i, (dir, title) <span class="keywordflow">in</span> enumerate(list(zip(directories, titles))):</div>
<div class="line"><a id="l00062" name="l00062"></a><span class="lineno"> 62</span> max_err = []</div>
<div class="line"><a id="l00063" name="l00063"></a><span class="lineno"> 63</span> <span class="keywordflow">for</span> label, file, color <span class="keywordflow">in</span> zip(labels, files, colors):</div>
<div class="line"><a id="l00064" name="l00064"></a><span class="lineno"> 64</span> <span class="keyword">with</span> open(dir+file) <span class="keyword">as</span> f:</div>
<div class="line"><a id="l00065" name="l00065"></a><span class="lineno"> 65</span> lines = f.readlines()</div>
<div class="line"><a id="l00066" name="l00066"></a><span class="lineno"> 66</span> t = np.linspace(0, 50, len(lines))</div>
<div class="line"><a id="l00067" name="l00067"></a><span class="lineno"> 67</span> r = np.array([float(line.strip()) <span class="keywordflow">for</span> line <span class="keywordflow">in</span> lines])</div>
<div class="line"><a id="l00068" name="l00068"></a><span class="lineno"> 68</span> max_err.append(max(r))</div>
<div class="line"><a id="l00069" name="l00069"></a><span class="lineno"> 69</span> axs1[i].plot(t, r, label=label, color=color)</div>
<div class="line"><a id="l00070" name="l00070"></a><span class="lineno"> 70</span> </div>
<div class="line"><a id="l00071" name="l00071"></a><span class="lineno"> 71</span> axs1[i].set(xlabel=<span class="stringliteral">r&quot;t $(\mu s)$&quot;</span>, ylabel = <span class="stringliteral">r&quot;relative error $(\mu m)$&quot;</span>)</div>
<div class="line"><a id="l00072" name="l00072"></a><span class="lineno"> 72</span> axs1[i].legend()</div>
<div class="line"><a id="l00073" name="l00073"></a><span class="lineno"> 73</span> axs1[i].set_title(title)</div>
<div class="line"><a id="l00074" name="l00074"></a><span class="lineno"> 74</span> </div>
<div class="line"><a id="l00075" name="l00075"></a><span class="lineno"> 75</span> conv_rate = 1/3 * sum([np.log2(max_err[i+1]/max_err[i])/np.log2(.5) <span class="keywordflow">for</span> i <span class="keywordflow">in</span> range(3)])</div>
<div class="line"><a id="l00076" name="l00076"></a><span class="lineno"> 76</span> print(f<span class="stringliteral">&quot;{methods[i]}: {conv_rate}&quot;</span>)</div>
<div class="line"><a id="l00077" name="l00077"></a><span class="lineno"> 77</span> </div>
<div class="line"><a id="l00078" name="l00078"></a><span class="lineno"> 78</span> plt.tight_layout()</div>
<div class="line"><a id="l00079" name="l00079"></a><span class="lineno"> 79</span> fig1.savefig(<span class="stringliteral">&quot;../latex/images/relative_error.pdf&quot;</span>, bbox_inches=<span class="stringliteral">&quot;tight&quot;</span>)</div>
<div class="line"><a id="l00080" name="l00080"></a><span class="lineno"> 80</span> </div>
<div class="line"><a id="l00081" name="l00081"></a><span class="lineno"> 81</span> </div>
<div class="line"><a id="l00082" name="l00082"></a><span class="lineno"> 82</span><span class="keywordflow">if</span> __name__ == <span class="stringliteral">&quot;__main__&quot;</span>:</div>
<div class="line"><a id="l00083" name="l00083"></a><span class="lineno"> 83</span> main()</div>
</div><!-- fragment --></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li><li class="navelem"><a class="el" href="dir_634e799a3947388232110823971192a8.html">scripts</a></li><li class="navelem"><b>plot_relative_error.py</b></li>
<li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li><li class="navelem"><a class="el" href="dir_634e799a3947388232110823971192a8.html">scripts</a></li><li class="navelem"><a class="el" href="plot__relative__error_8py.html">plot_relative_error.py</a></li>
<li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.6 </li>
</ul>
</div>

View File

@@ -0,0 +1,211 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.9.6"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Penning Trap Simulation: src/scripts/plot_single_particle.py File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
extensions: ["tex2jax.js"],
jax: ["input/TeX","output/HTML-CSS"],
});
</script>
<script type="text/javascript" async="async" src="https://cdn.jsdelivr.net/npm/mathjax@2/MathJax.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="doxygen-awesome.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr id="projectrow">
<td id="projectalign">
<div id="projectname">Penning Trap Simulation
</div>
<div id="projectbrief">Simulate particle behavior inside a Penning Trap</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.6 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search/",'.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(document).ready(function(){initNavTree('plot__single__particle_8py.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<div id="MSearchResults">
<div class="SRPage">
<div id="SRIndex">
<div id="SRResults"></div>
<div class="SRStatus" id="Loading">Loading...</div>
<div class="SRStatus" id="Searching">Searching...</div>
<div class="SRStatus" id="NoMatches">No Matches</div>
</div>
</div>
</div>
</div>
<div class="header">
<div class="summary">
<a href="#func-members">Functions</a> &#124;
<a href="#var-members">Variables</a> </div>
<div class="headertitle"><div class="title">plot_single_particle.py File Reference</div></div>
</div><!--header-->
<div class="contents">
<p>Plot the approximation and analytical solution for one particle in the z axis.
<a href="#details">More...</a></p>
<p><a href="plot__single__particle_8py_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="func-members" name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:a502c69553dc8b55651b3f0d6d06686ee"><td class="memItemLeft" align="right" valign="top">def&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="plot__single__particle_8py.html#a502c69553dc8b55651b3f0d6d06686ee">plot_single_particle.z</a> (t)</td></tr>
<tr class="separator:a502c69553dc8b55651b3f0d6d06686ee"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ab0261bc484d15ef01c27420592fadc00"><td class="memItemLeft" align="right" valign="top">def&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="plot__single__particle_8py.html#ab0261bc484d15ef01c27420592fadc00">plot_single_particle.main</a> ()</td></tr>
<tr class="separator:ab0261bc484d15ef01c27420592fadc00"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="var-members" name="var-members"></a>
Variables</h2></td></tr>
<tr class="memitem:a631948da2ca2a1f0df71e9ce6b328d71"><td class="memItemLeft" align="right" valign="top">dict&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="plot__single__particle_8py.html#a631948da2ca2a1f0df71e9ce6b328d71">plot_single_particle.params</a></td></tr>
<tr class="separator:a631948da2ca2a1f0df71e9ce6b328d71"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Plot the approximation and analytical solution for one particle in the z axis. </p>
<dl class="section author"><dt>Author</dt><dd>Cory Alexander Balaton (coryab) </dd>
<dd>
Janita Ovidie Sandtrøen Willumsen (janitaws)</dd></dl>
<dl class="section version"><dt>Version</dt><dd>1.0</dd></dl>
<dl class="bug"><dt><b><a class="el" href="bug.html#_bug000018">Bug:</a></b></dt><dd>No known bugs </dd></dl>
<p class="definition">Definition in file <a class="el" href="plot__single__particle_8py_source.html">plot_single_particle.py</a>.</p>
</div><h2 class="groupheader">Function Documentation</h2>
<a id="ab0261bc484d15ef01c27420592fadc00" name="ab0261bc484d15ef01c27420592fadc00"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ab0261bc484d15ef01c27420592fadc00">&#9670;&#160;</a></span>main()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">def plot_single_particle.main </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p class="definition">Definition at line <a class="el" href="plot__single__particle_8py_source.html#l00037">37</a> of file <a class="el" href="plot__single__particle_8py_source.html">plot_single_particle.py</a>.</p>
</div>
</div>
<a id="a502c69553dc8b55651b3f0d6d06686ee" name="a502c69553dc8b55651b3f0d6d06686ee"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a502c69553dc8b55651b3f0d6d06686ee">&#9670;&#160;</a></span>z()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">def plot_single_particle.z </td>
<td>(</td>
<td class="paramtype">&#160;</td>
<td class="paramname"><em>t</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p class="definition">Definition at line <a class="el" href="plot__single__particle_8py_source.html#l00030">30</a> of file <a class="el" href="plot__single__particle_8py_source.html">plot_single_particle.py</a>.</p>
</div>
</div>
<h2 class="groupheader">Variable Documentation</h2>
<a id="a631948da2ca2a1f0df71e9ce6b328d71" name="a631948da2ca2a1f0df71e9ce6b328d71"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a631948da2ca2a1f0df71e9ce6b328d71">&#9670;&#160;</a></span>params</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">dict plot_single_particle.params</td>
</tr>
</table>
</div><div class="memdoc">
<b>Initial value:</b><div class="fragment"><div class="line"><span class="lineno"> 1</span>= {</div>
<div class="line"><span class="lineno"> 2</span> <span class="stringliteral">&quot;font.family&quot;</span>: <span class="stringliteral">&quot;Serif&quot;</span>,</div>
<div class="line"><span class="lineno"> 3</span> <span class="stringliteral">&quot;font.serif&quot;</span>: <span class="stringliteral">&quot;Roman&quot;</span>, </div>
<div class="line"><span class="lineno"> 4</span> <span class="stringliteral">&quot;text.usetex&quot;</span>: <span class="keyword">True</span>,</div>
<div class="line"><span class="lineno"> 5</span> <span class="stringliteral">&quot;axes.titlesize&quot;</span>: <span class="stringliteral">&quot;large&quot;</span>,</div>
<div class="line"><span class="lineno"> 6</span> <span class="stringliteral">&quot;axes.labelsize&quot;</span>: <span class="stringliteral">&quot;large&quot;</span>,</div>
<div class="line"><span class="lineno"> 7</span> <span class="stringliteral">&quot;xtick.labelsize&quot;</span>: <span class="stringliteral">&quot;large&quot;</span>,</div>
<div class="line"><span class="lineno"> 8</span> <span class="stringliteral">&quot;ytick.labelsize&quot;</span>: <span class="stringliteral">&quot;large&quot;</span>,</div>
<div class="line"><span class="lineno"> 9</span> <span class="stringliteral">&quot;legend.fontsize&quot;</span>: <span class="stringliteral">&quot;medium&quot;</span></div>
<div class="line"><span class="lineno"> 10</span>}</div>
</div><!-- fragment -->
<p class="definition">Definition at line <a class="el" href="plot__single__particle_8py_source.html#l00018">18</a> of file <a class="el" href="plot__single__particle_8py_source.html">plot_single_particle.py</a>.</p>
</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li><li class="navelem"><a class="el" href="dir_634e799a3947388232110823971192a8.html">scripts</a></li><li class="navelem"><a class="el" href="plot__single__particle_8py.html">plot_single_particle.py</a></li>
<li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.6 </li>
</ul>
</div>
</body>
</html>

View File

@@ -101,42 +101,61 @@ $(document).ready(function(){initNavTree('plot__single__particle_8py_source.html
<div class="headertitle"><div class="title">plot_single_particle.py</div></div>
</div><!--header-->
<div class="contents">
<div class="fragment"><div class="line"><a id="l00001" name="l00001"></a><span class="lineno"> 1</span><span class="keyword">import</span> matplotlib.pyplot <span class="keyword">as</span> plt</div>
<div class="line"><a id="l00002" name="l00002"></a><span class="lineno"> 2</span><span class="keyword">import</span> numpy <span class="keyword">as</span> np</div>
<div class="line"><a id="l00003" name="l00003"></a><span class="lineno"> 3</span> </div>
<div class="line"><a id="l00004" name="l00004"></a><span class="lineno"> 4</span><span class="keyword">def </span>z(t):</div>
<div class="line"><a id="l00005" name="l00005"></a><span class="lineno"> 5</span> V_0 = 25.*9.64852558 * 10**4</div>
<div class="line"><a id="l00006" name="l00006"></a><span class="lineno"> 6</span> m = 40.</div>
<div class="line"><a id="l00007" name="l00007"></a><span class="lineno"> 7</span> d = 500.</div>
<div class="line"><a id="l00008" name="l00008"></a><span class="lineno"> 8</span> w_z = np.sqrt((2.*V_0)/(m*d*d))</div>
<div class="line"><a id="l00009" name="l00009"></a><span class="lineno"> 9</span> <span class="keywordflow">return</span> 20.*np.cos(w_z*t)</div>
<div class="line"><a id="l00010" name="l00010"></a><span class="lineno"> 10</span> </div>
<div class="line"><a id="l00011" name="l00011"></a><span class="lineno"> 11</span><span class="keyword">def </span>main():</div>
<div class="line"><a id="l00012" name="l00012"></a><span class="lineno"> 12</span> filename = <span class="stringliteral">&quot;output/simulate_single_particle/particle_0_r.txt&quot;</span></div>
<div class="line"><a id="l00013" name="l00013"></a><span class="lineno"> 13</span> r = t = []</div>
<div class="line"><a id="l00014" name="l00014"></a><span class="lineno"> 14</span> <span class="keyword">with</span> open(filename) <span class="keyword">as</span> f:</div>
<div class="line"><a id="l00015" name="l00015"></a><span class="lineno"> 15</span> lines = f.readlines()</div>
<div class="line"><a id="l00016" name="l00016"></a><span class="lineno"> 16</span> t = np.linspace(0, 50, len(lines))</div>
<div class="line"><a id="l00017" name="l00017"></a><span class="lineno"> 17</span> r = np.array([list(map(float, line.strip().split(<span class="stringliteral">&quot;,&quot;</span>))) <span class="keywordflow">for</span> line <span class="keywordflow">in</span> lines])</div>
<div class="line"><a id="l00018" name="l00018"></a><span class="lineno"> 18</span> </div>
<div class="line"><a id="l00019" name="l00019"></a><span class="lineno"> 19</span> plt.plot(t, r[:, 2], label=<span class="stringliteral">&quot;approximation&quot;</span>)</div>
<div class="line"><a id="l00020" name="l00020"></a><span class="lineno"> 20</span> plt.plot(t, z(t), label=<span class="stringliteral">&quot;analytical&quot;</span>)</div>
<div class="line"><a id="l00021" name="l00021"></a><span class="lineno"> 21</span> plt.xlabel(<span class="stringliteral">r&quot;time $(\mu s)$&quot;</span>)</div>
<div class="line"><a id="l00022" name="l00022"></a><span class="lineno"> 22</span> plt.ylabel(<span class="stringliteral">r&quot;z $(\mu m)$&quot;</span>)</div>
<div class="line"><a id="l00023" name="l00023"></a><span class="lineno"> 23</span> plt.title(<span class="stringliteral">r&quot;Movement of a single particle in the x direction&quot;</span>)</div>
<div class="line"><a id="l00024" name="l00024"></a><span class="lineno"> 24</span> plt.legend()</div>
<div class="line"><a id="l00025" name="l00025"></a><span class="lineno"> 25</span> <span class="comment"># plt.savefig(&quot;../latex/images/single_particle.pdf&quot;)</span></div>
<div class="line"><a id="l00026" name="l00026"></a><span class="lineno"> 26</span> plt.show()</div>
<div class="line"><a id="l00027" name="l00027"></a><span class="lineno"> 27</span> </div>
<div class="line"><a id="l00028" name="l00028"></a><span class="lineno"> 28</span> </div>
<div class="line"><a id="l00029" name="l00029"></a><span class="lineno"> 29</span><span class="keywordflow">if</span> __name__ == <span class="stringliteral">&quot;__main__&quot;</span>:</div>
<div class="line"><a id="l00030" name="l00030"></a><span class="lineno"> 30</span> main()</div>
<a href="plot__single__particle_8py.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a id="l00001" name="l00001"></a><span class="lineno"> 1</span> </div>
<div class="line"><a id="l00012" name="l00012"></a><span class="lineno"> 12</span> </div>
<div class="line"><a id="l00013" name="l00013"></a><span class="lineno"> 13</span><span class="keyword">import</span> matplotlib.pyplot <span class="keyword">as</span> plt</div>
<div class="line"><a id="l00014" name="l00014"></a><span class="lineno"> 14</span><span class="keyword">import</span> numpy <span class="keyword">as</span> np</div>
<div class="line"><a id="l00015" name="l00015"></a><span class="lineno"> 15</span><span class="keyword">import</span> seaborn <span class="keyword">as</span> sns</div>
<div class="line"><a id="l00016" name="l00016"></a><span class="lineno"> 16</span> </div>
<div class="line"><a id="l00017" name="l00017"></a><span class="lineno"> 17</span>sns.set_theme()</div>
<div class="line"><a id="l00018" name="l00018"></a><span class="lineno"> 18</span>params = {</div>
<div class="line"><a id="l00019" name="l00019"></a><span class="lineno"> 19</span> <span class="stringliteral">&quot;font.family&quot;</span>: <span class="stringliteral">&quot;Serif&quot;</span>,</div>
<div class="line"><a id="l00020" name="l00020"></a><span class="lineno"> 20</span> <span class="stringliteral">&quot;font.serif&quot;</span>: <span class="stringliteral">&quot;Roman&quot;</span>, </div>
<div class="line"><a id="l00021" name="l00021"></a><span class="lineno"> 21</span> <span class="stringliteral">&quot;text.usetex&quot;</span>: <span class="keyword">True</span>,</div>
<div class="line"><a id="l00022" name="l00022"></a><span class="lineno"> 22</span> <span class="stringliteral">&quot;axes.titlesize&quot;</span>: <span class="stringliteral">&quot;large&quot;</span>,</div>
<div class="line"><a id="l00023" name="l00023"></a><span class="lineno"> 23</span> <span class="stringliteral">&quot;axes.labelsize&quot;</span>: <span class="stringliteral">&quot;large&quot;</span>,</div>
<div class="line"><a id="l00024" name="l00024"></a><span class="lineno"> 24</span> <span class="stringliteral">&quot;xtick.labelsize&quot;</span>: <span class="stringliteral">&quot;large&quot;</span>,</div>
<div class="line"><a id="l00025" name="l00025"></a><span class="lineno"> 25</span> <span class="stringliteral">&quot;ytick.labelsize&quot;</span>: <span class="stringliteral">&quot;large&quot;</span>,</div>
<div class="line"><a id="l00026" name="l00026"></a><span class="lineno"> 26</span> <span class="stringliteral">&quot;legend.fontsize&quot;</span>: <span class="stringliteral">&quot;medium&quot;</span></div>
<div class="line"><a id="l00027" name="l00027"></a><span class="lineno"> 27</span>}</div>
<div class="line"><a id="l00028" name="l00028"></a><span class="lineno"> 28</span>plt.rcParams.update(params)</div>
<div class="line"><a id="l00029" name="l00029"></a><span class="lineno"> 29</span> </div>
<div class="line"><a id="l00030" name="l00030"></a><span class="lineno"> 30</span><span class="keyword">def </span>z(t):</div>
<div class="line"><a id="l00031" name="l00031"></a><span class="lineno"> 31</span> V_0 = 25.*9.64852558 * 10**4</div>
<div class="line"><a id="l00032" name="l00032"></a><span class="lineno"> 32</span> m = 40.</div>
<div class="line"><a id="l00033" name="l00033"></a><span class="lineno"> 33</span> d = 500.</div>
<div class="line"><a id="l00034" name="l00034"></a><span class="lineno"> 34</span> w_z = np.sqrt((2.*V_0)/(m*d*d))</div>
<div class="line"><a id="l00035" name="l00035"></a><span class="lineno"> 35</span> <span class="keywordflow">return</span> 20.*np.cos(w_z*t)</div>
<div class="line"><a id="l00036" name="l00036"></a><span class="lineno"> 36</span> </div>
<div class="line"><a id="l00037" name="l00037"></a><span class="lineno"> 37</span><span class="keyword">def </span>main():</div>
<div class="line"><a id="l00038" name="l00038"></a><span class="lineno"> 38</span> filename = <span class="stringliteral">&quot;output/simulate_single_particle/particle_0_r.txt&quot;</span></div>
<div class="line"><a id="l00039" name="l00039"></a><span class="lineno"> 39</span> r = t = []</div>
<div class="line"><a id="l00040" name="l00040"></a><span class="lineno"> 40</span> <span class="keyword">with</span> open(filename) <span class="keyword">as</span> f:</div>
<div class="line"><a id="l00041" name="l00041"></a><span class="lineno"> 41</span> lines = f.readlines()</div>
<div class="line"><a id="l00042" name="l00042"></a><span class="lineno"> 42</span> t = np.linspace(0, 50, len(lines))</div>
<div class="line"><a id="l00043" name="l00043"></a><span class="lineno"> 43</span> r = np.array([list(map(float, line.strip().split(<span class="stringliteral">&quot;,&quot;</span>))) <span class="keywordflow">for</span> line <span class="keywordflow">in</span> lines])</div>
<div class="line"><a id="l00044" name="l00044"></a><span class="lineno"> 44</span> </div>
<div class="line"><a id="l00045" name="l00045"></a><span class="lineno"> 45</span> fig, ax = plt.subplots()</div>
<div class="line"><a id="l00046" name="l00046"></a><span class="lineno"> 46</span> ax.plot(t, r[:, 2], label=<span class="stringliteral">&quot;approximation&quot;</span>, color=<span class="stringliteral">&quot;mediumseagreen&quot;</span>)</div>
<div class="line"><a id="l00047" name="l00047"></a><span class="lineno"> 47</span> ax.plot(t, z(t), label=<span class="stringliteral">&quot;analytical&quot;</span>, color=<span class="stringliteral">&quot;black&quot;</span>, linestyle=<span class="stringliteral">&quot;dotted&quot;</span>)</div>
<div class="line"><a id="l00048" name="l00048"></a><span class="lineno"> 48</span> ax.set_xlabel(<span class="stringliteral">r&quot;t $(\mu s)$&quot;</span>)</div>
<div class="line"><a id="l00049" name="l00049"></a><span class="lineno"> 49</span> ax.set_xlim((-5, 55))</div>
<div class="line"><a id="l00050" name="l00050"></a><span class="lineno"> 50</span> ax.set_ylabel(<span class="stringliteral">r&quot;z $(\mu m)$&quot;</span>)</div>
<div class="line"><a id="l00051" name="l00051"></a><span class="lineno"> 51</span> ax.set_ylim((-25, 25))</div>
<div class="line"><a id="l00052" name="l00052"></a><span class="lineno"> 52</span> <span class="comment"># plt.title(r&quot;Movement of a single particle in the x direction&quot;)</span></div>
<div class="line"><a id="l00053" name="l00053"></a><span class="lineno"> 53</span> ax.legend(loc=<span class="stringliteral">&quot;upper right&quot;</span>)</div>
<div class="line"><a id="l00054" name="l00054"></a><span class="lineno"> 54</span> fig.savefig(<span class="stringliteral">&quot;../latex/images/single_particle.pdf&quot;</span>, bbox_inches=<span class="stringliteral">&quot;tight&quot;</span>)</div>
<div class="line"><a id="l00055" name="l00055"></a><span class="lineno"> 55</span> <span class="comment"># plt.show()</span></div>
<div class="line"><a id="l00056" name="l00056"></a><span class="lineno"> 56</span> </div>
<div class="line"><a id="l00057" name="l00057"></a><span class="lineno"> 57</span> </div>
<div class="line"><a id="l00058" name="l00058"></a><span class="lineno"> 58</span><span class="keywordflow">if</span> __name__ == <span class="stringliteral">&quot;__main__&quot;</span>:</div>
<div class="line"><a id="l00059" name="l00059"></a><span class="lineno"> 59</span> main()</div>
</div><!-- fragment --></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li><li class="navelem"><a class="el" href="dir_634e799a3947388232110823971192a8.html">scripts</a></li><li class="navelem"><b>plot_single_particle.py</b></li>
<li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li><li class="navelem"><a class="el" href="dir_634e799a3947388232110823971192a8.html">scripts</a></li><li class="navelem"><a class="el" href="plot__single__particle_8py.html">plot_single_particle.py</a></li>
<li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.6 </li>
</ul>
</div>

View File

@@ -2,5 +2,6 @@ var searchData=
[
['add_5fparticle_0',['add_particle',['../classPenningTrap.html#a6e9776ff5b149f01080800716455d7c8',1,'PenningTrap']]],
['analytical_5fsolution_5fparticle_5f1_1',['analytical_solution_particle_1',['../main_8cpp.html#a8d92fb2ad085065fbd14718647551657',1,'main.cpp']]],
['assert_2',['ASSERT',['../utils_8hpp.html#a73d4f21ad937dbc50a0c0538c78fd4f9',1,'utils.hpp']]]
['animate_5f100_5fparticles_2epy_2',['animate_100_particles.py',['../animate__100__particles_8py.html',1,'']]],
['assert_3',['ASSERT',['../utils_8hpp.html#a73d4f21ad937dbc50a0c0538c78fd4f9',1,'utils.hpp']]]
];

View File

@@ -1,5 +1,6 @@
var searchData=
[
['force_5fon_5fparticle_0',['force_on_particle',['../classPenningTrap.html#a7f210bb2768a5d79ced4b0df0df97598',1,'PenningTrap']]],
['fraction_5fof_5fparticles_5fleft_1',['fraction_of_particles_left',['../classPenningTrap.html#ac529aa26c288f34eae184a67e6bac41f',1,'PenningTrap']]]
['fraction_5fof_5fparticles_5fleft_1',['fraction_of_particles_left',['../classPenningTrap.html#ac529aa26c288f34eae184a67e6bac41f',1,'PenningTrap']]],
['frequency_5fnarrow_5fsweeps_5flong_2ecpp_2',['frequency_narrow_sweeps_long.cpp',['../frequency__narrow__sweeps__long_8cpp.html',1,'']]]
];

View File

@@ -2,17 +2,23 @@ var searchData=
[
['p1_0',['p1',['../main_8cpp.html#a2efa69bb9d93049429ce4637075f1d30',1,'main.cpp']]],
['p2_1',['p2',['../main_8cpp.html#ac70b61df65f4336f57ea9b4c35250df7',1,'main.cpp']]],
['particle_2',['Particle',['../classParticle.html#af1d7535fb8311eaa77d2b7b345882ec4',1,'Particle::Particle()'],['../classParticle.html',1,'Particle']]],
['particle_2',['Particle',['../classParticle.html',1,'Particle'],['../classParticle.html#af1d7535fb8311eaa77d2b7b345882ec4',1,'Particle::Particle()']]],
['particle_2ecpp_3',['Particle.cpp',['../Particle_8cpp.html',1,'']]],
['particle_2ehpp_4',['Particle.hpp',['../Particle_8hpp.html',1,'']]],
['particles_5',['particles',['../classPenningTrap.html#a0112525d9e79a472e761f8ef402a339f',1,'PenningTrap']]],
['penning_20trap_20simulation_6',['Penning trap simulation',['../index.html',1,'']]],
['penningtrap_7',['PenningTrap',['../classPenningTrap.html#a5b6c6d4636f3a6e279ccde59d4a345e8',1,'PenningTrap::PenningTrap(double B_0=T, double V_0=(25. *V)/1000., double d=500., double t=0.)'],['../classPenningTrap.html#addc96789dcfec07b75156e19fee82f4f',1,'PenningTrap::PenningTrap(std::vector&lt; Particle &gt; particles, double B_0=T, double V_0=(25. *V)/1000., double d=500., double t=0.)'],['../classPenningTrap.html#a830be1b8cbf59664e060b6edbeaa302f',1,'PenningTrap::PenningTrap(uint i, double B_0=T, double V_0=(25. *V)/1000., double d=500., double t=0.)'],['../classParticle.html#aa797d319549dc2a0beb06cdbfd430232',1,'Particle::PenningTrap()'],['../classPenningTrap.html',1,'PenningTrap']]],
['penningtrap_7',['PenningTrap',['../classPenningTrap.html#addc96789dcfec07b75156e19fee82f4f',1,'PenningTrap::PenningTrap()'],['../classPenningTrap.html',1,'PenningTrap'],['../classPenningTrap.html#a830be1b8cbf59664e060b6edbeaa302f',1,'PenningTrap::PenningTrap(uint i, double B_0=T, double V_0=(25. *V)/1000., double d=500., double t=0.)'],['../classPenningTrap.html#a5b6c6d4636f3a6e279ccde59d4a345e8',1,'PenningTrap::PenningTrap(double B_0=T, double V_0=(25. *V)/1000., double d=500., double t=0.)'],['../classParticle.html#aa797d319549dc2a0beb06cdbfd430232',1,'Particle::PenningTrap()']]],
['penningtrap_2ecpp_8',['PenningTrap.cpp',['../PenningTrap_8cpp.html',1,'']]],
['penningtrap_2ehpp_9',['PenningTrap.hpp',['../PenningTrap_8hpp.html',1,'']]],
['penningtraptest_10',['PenningTrapTest',['../classPenningTrap.html#a869f032f37d0569ed16f224b4c4356ae',1,'PenningTrap::PenningTrapTest()'],['../classPenningTrapTest.html',1,'PenningTrapTest']]],
['perturbation_11',['perturbation',['../classPenningTrap.html#ae915f6ad0eef1fb46530e836b6e071e5',1,'PenningTrap']]],
['potential_5fresonance_5fnarrow_5fsweep_12',['potential_resonance_narrow_sweep',['../main_8cpp.html#a33d9b1c76c3c80902f89a58b1a6d96ea',1,'main.cpp']]],
['potential_5fresonance_5fnarrow_5fsweep_5finteraction_13',['potential_resonance_narrow_sweep_interaction',['../main_8cpp.html#ac1816f70ec612edc27848ef7f0875fdb',1,'main.cpp']]],
['potential_5fresonance_5fwide_5fsweep_14',['potential_resonance_wide_sweep',['../main_8cpp.html#a6b38b477c18e2f4268779751a88edab1',1,'main.cpp']]]
['plot_5f2_5fparticles_2epy_12',['plot_2_particles.py',['../plot__2__particles_8py.html',1,'']]],
['plot_5f3d_2epy_13',['plot_3d.py',['../plot__3d_8py.html',1,'']]],
['plot_5fparticles_5fleft_2epy_14',['plot_particles_left.py',['../plot__particles__left_8py.html',1,'']]],
['plot_5fphase_5fspace_2epy_15',['plot_phase_space.py',['../plot__phase__space_8py.html',1,'']]],
['plot_5frelative_5ferror_2epy_16',['plot_relative_error.py',['../plot__relative__error_8py.html',1,'']]],
['plot_5fsingle_5fparticle_2epy_17',['plot_single_particle.py',['../plot__single__particle_8py.html',1,'']]],
['potential_5fresonance_5fnarrow_5fsweep_18',['potential_resonance_narrow_sweep',['../frequency__narrow__sweeps__long_8cpp.html#a33d9b1c76c3c80902f89a58b1a6d96ea',1,'potential_resonance_narrow_sweep():&#160;frequency_narrow_sweeps_long.cpp'],['../main_8cpp.html#a33d9b1c76c3c80902f89a58b1a6d96ea',1,'potential_resonance_narrow_sweep():&#160;main.cpp']]],
['potential_5fresonance_5fnarrow_5fsweep_5finteraction_19',['potential_resonance_narrow_sweep_interaction',['../frequency__narrow__sweeps__long_8cpp.html#ac1816f70ec612edc27848ef7f0875fdb',1,'potential_resonance_narrow_sweep_interaction():&#160;frequency_narrow_sweeps_long.cpp'],['../main_8cpp.html#ac1816f70ec612edc27848ef7f0875fdb',1,'potential_resonance_narrow_sweep_interaction():&#160;main.cpp']]],
['potential_5fresonance_5fwide_5fsweep_20',['potential_resonance_wide_sweep',['../main_8cpp.html#a6b38b477c18e2f4268779751a88edab1',1,'main.cpp']]]
];

View File

@@ -10,6 +10,7 @@ var searchData=
['test_5ftotal_5fforce_5fparticles_7',['test_total_force_particles',['../classPenningTrapTest.html#a68449d508e66205bc8b27fa5f60db508',1,'PenningTrapTest']]],
['total_5fforce_8',['total_force',['../classPenningTrap.html#a9a301b0540078c36697880ef204afdf3',1,'PenningTrap']]],
['total_5fforce_5fexternal_9',['total_force_external',['../classPenningTrap.html#a2c01108b52c8e2a003cf9170da9e7682',1,'PenningTrap']]],
['total_5fforce_5fparticles_10',['total_force_particles',['../classPenningTrap.html#a2fe1cefbae18fa5808155ee0d2df713c',1,'PenningTrap']]],
['typedefs_2ehpp_11',['typedefs.hpp',['../typedefs_8hpp.html',1,'']]]
['total_5fforce_5fno_5finteraction_10',['total_force_no_interaction',['../classPenningTrap.html#a6069f82d8dbc7cadaebd228dbcd95018',1,'PenningTrap']]],
['total_5fforce_5fparticles_11',['total_force_particles',['../classPenningTrap.html#a2fe1cefbae18fa5808155ee0d2df713c',1,'PenningTrap']]],
['typedefs_2ehpp_12',['typedefs.hpp',['../typedefs_8hpp.html',1,'']]]
];

View File

@@ -1,4 +1,4 @@
var searchData=
[
['constants_2ehpp_0',['constants.hpp',['../constants_8hpp.html',1,'']]]
['animate_5f100_5fparticles_2epy_0',['animate_100_particles.py',['../animate__100__particles_8py.html',1,'']]]
];

View File

@@ -1,4 +1,4 @@
var searchData=
[
['main_2ecpp_0',['main.cpp',['../main_8cpp.html',1,'']]]
['constants_2ehpp_0',['constants.hpp',['../constants_8hpp.html',1,'']]]
];

View File

@@ -1,7 +1,4 @@
var searchData=
[
['particle_2ecpp_0',['Particle.cpp',['../Particle_8cpp.html',1,'']]],
['particle_2ehpp_1',['Particle.hpp',['../Particle_8hpp.html',1,'']]],
['penningtrap_2ecpp_2',['PenningTrap.cpp',['../PenningTrap_8cpp.html',1,'']]],
['penningtrap_2ehpp_3',['PenningTrap.hpp',['../PenningTrap_8hpp.html',1,'']]]
['frequency_5fnarrow_5fsweeps_5flong_2ecpp_0',['frequency_narrow_sweeps_long.cpp',['../frequency__narrow__sweeps__long_8cpp.html',1,'']]]
];

View File

@@ -1,5 +1,4 @@
var searchData=
[
['test_5fsuite_2ecpp_0',['test_suite.cpp',['../test__suite_8cpp.html',1,'']]],
['typedefs_2ehpp_1',['typedefs.hpp',['../typedefs_8hpp.html',1,'']]]
['main_2ecpp_0',['main.cpp',['../main_8cpp.html',1,'']]]
];

View File

@@ -1,5 +1,13 @@
var searchData=
[
['utils_2ecpp_0',['utils.cpp',['../utils_8cpp.html',1,'']]],
['utils_2ehpp_1',['utils.hpp',['../utils_8hpp.html',1,'']]]
['particle_2ecpp_0',['Particle.cpp',['../Particle_8cpp.html',1,'']]],
['particle_2ehpp_1',['Particle.hpp',['../Particle_8hpp.html',1,'']]],
['penningtrap_2ecpp_2',['PenningTrap.cpp',['../PenningTrap_8cpp.html',1,'']]],
['penningtrap_2ehpp_3',['PenningTrap.hpp',['../PenningTrap_8hpp.html',1,'']]],
['plot_5f2_5fparticles_2epy_4',['plot_2_particles.py',['../plot__2__particles_8py.html',1,'']]],
['plot_5f3d_2epy_5',['plot_3d.py',['../plot__3d_8py.html',1,'']]],
['plot_5fparticles_5fleft_2epy_6',['plot_particles_left.py',['../plot__particles__left_8py.html',1,'']]],
['plot_5fphase_5fspace_2epy_7',['plot_phase_space.py',['../plot__phase__space_8py.html',1,'']]],
['plot_5frelative_5ferror_2epy_8',['plot_relative_error.py',['../plot__relative__error_8py.html',1,'']]],
['plot_5fsingle_5fparticle_2epy_9',['plot_single_particle.py',['../plot__single__particle_8py.html',1,'']]]
];

5
docs/search/files_5.js Normal file
View File

@@ -0,0 +1,5 @@
var searchData=
[
['test_5fsuite_2ecpp_0',['test_suite.cpp',['../test__suite_8cpp.html',1,'']]],
['typedefs_2ehpp_1',['typedefs.hpp',['../typedefs_8hpp.html',1,'']]]
];

5
docs/search/files_6.js Normal file
View File

@@ -0,0 +1,5 @@
var searchData=
[
['utils_2ecpp_0',['utils.cpp',['../utils_8cpp.html',1,'']]],
['utils_2ehpp_1',['utils.hpp',['../utils_8hpp.html',1,'']]]
];

View File

@@ -2,7 +2,7 @@ var searchData=
[
['particle_0',['Particle',['../classParticle.html#af1d7535fb8311eaa77d2b7b345882ec4',1,'Particle']]],
['penningtrap_1',['PenningTrap',['../classPenningTrap.html#a5b6c6d4636f3a6e279ccde59d4a345e8',1,'PenningTrap::PenningTrap(double B_0=T, double V_0=(25. *V)/1000., double d=500., double t=0.)'],['../classPenningTrap.html#a830be1b8cbf59664e060b6edbeaa302f',1,'PenningTrap::PenningTrap(uint i, double B_0=T, double V_0=(25. *V)/1000., double d=500., double t=0.)'],['../classPenningTrap.html#addc96789dcfec07b75156e19fee82f4f',1,'PenningTrap::PenningTrap(std::vector&lt; Particle &gt; particles, double B_0=T, double V_0=(25. *V)/1000., double d=500., double t=0.)']]],
['potential_5fresonance_5fnarrow_5fsweep_2',['potential_resonance_narrow_sweep',['../main_8cpp.html#a33d9b1c76c3c80902f89a58b1a6d96ea',1,'main.cpp']]],
['potential_5fresonance_5fnarrow_5fsweep_5finteraction_3',['potential_resonance_narrow_sweep_interaction',['../main_8cpp.html#ac1816f70ec612edc27848ef7f0875fdb',1,'main.cpp']]],
['potential_5fresonance_5fnarrow_5fsweep_2',['potential_resonance_narrow_sweep',['../frequency__narrow__sweeps__long_8cpp.html#a33d9b1c76c3c80902f89a58b1a6d96ea',1,'potential_resonance_narrow_sweep():&#160;frequency_narrow_sweeps_long.cpp'],['../main_8cpp.html#a33d9b1c76c3c80902f89a58b1a6d96ea',1,'potential_resonance_narrow_sweep():&#160;main.cpp']]],
['potential_5fresonance_5fnarrow_5fsweep_5finteraction_3',['potential_resonance_narrow_sweep_interaction',['../frequency__narrow__sweeps__long_8cpp.html#ac1816f70ec612edc27848ef7f0875fdb',1,'potential_resonance_narrow_sweep_interaction():&#160;frequency_narrow_sweeps_long.cpp'],['../main_8cpp.html#ac1816f70ec612edc27848ef7f0875fdb',1,'potential_resonance_narrow_sweep_interaction():&#160;main.cpp']]],
['potential_5fresonance_5fwide_5fsweep_4',['potential_resonance_wide_sweep',['../main_8cpp.html#a6b38b477c18e2f4268779751a88edab1',1,'main.cpp']]]
];

View File

@@ -7,5 +7,6 @@ var searchData=
['test_5ftotal_5fforce_5fparticles_4',['test_total_force_particles',['../classPenningTrapTest.html#a68449d508e66205bc8b27fa5f60db508',1,'PenningTrapTest']]],
['total_5fforce_5',['total_force',['../classPenningTrap.html#a9a301b0540078c36697880ef204afdf3',1,'PenningTrap']]],
['total_5fforce_5fexternal_6',['total_force_external',['../classPenningTrap.html#a2c01108b52c8e2a003cf9170da9e7682',1,'PenningTrap']]],
['total_5fforce_5fparticles_7',['total_force_particles',['../classPenningTrap.html#a2fe1cefbae18fa5808155ee0d2df713c',1,'PenningTrap']]]
['total_5fforce_5fno_5finteraction_7',['total_force_no_interaction',['../classPenningTrap.html#a6069f82d8dbc7cadaebd228dbcd95018',1,'PenningTrap']]],
['total_5fforce_5fparticles_8',['total_force_particles',['../classPenningTrap.html#a2fe1cefbae18fa5808155ee0d2df713c',1,'PenningTrap']]]
];

View File

@@ -0,0 +1,4 @@
var searchData=
[
['plot_5f3d_0',['plot_3d',['../namespaceplot__3d.html',1,'']]]
];

View File

@@ -2,7 +2,7 @@ var indexSectionsWithContent =
{
0: "_abcdefkmpqrstuvw",
1: "ps",
2: "cmptu",
2: "acfmptu",
3: "acefmprstvw",
4: "bdkmpqrtv",
5: "sv",

View File

@@ -133,7 +133,7 @@ Functions</h2></td></tr>
<dd>
Janita Ovidie Sandtrøen Willumsen (janitaws)</dd></dl>
<dl class="section version"><dt>Version</dt><dd>1.0</dd></dl>
<dl class="bug"><dt><b><a class="el" href="bug.html#_bug000009">Bug:</a></b></dt><dd>No known bugs </dd></dl>
<dl class="bug"><dt><b><a class="el" href="bug.html#_bug000010">Bug:</a></b></dt><dd>No known bugs </dd></dl>
<p class="definition">Definition in file <a class="el" href="test__suite_8cpp_source.html">test_suite.cpp</a>.</p>
</div><h2 class="groupheader">Function Documentation</h2>

View File

@@ -239,12 +239,12 @@ $(document).ready(function(){initNavTree('test__suite_8cpp_source.html',''); ini
<div class="ttc" id="aclassPenningTrapTest_html_ad668d7d875bdc1909a42426bf9dead9e"><div class="ttname"><a href="classPenningTrapTest.html#ad668d7d875bdc1909a42426bf9dead9e">PenningTrapTest::test_external_B_field</a></div><div class="ttdeci">void test_external_B_field()</div><div class="ttdoc">Test that the external B field gives correct values.</div><div class="ttdef"><b>Definition:</b> <a href="test__suite_8cpp_source.html#l00066">test_suite.cpp:66</a></div></div>
<div class="ttc" id="aclassPenningTrapTest_html_ae6d0c8e0d80338fb7c7edefc97331046"><div class="ttname"><a href="classPenningTrapTest.html#ae6d0c8e0d80338fb7c7edefc97331046">PenningTrapTest::test_total_force_external</a></div><div class="ttdeci">void test_total_force_external()</div><div class="ttdoc">Test that the total external force returns expected results.</div><div class="ttdef"><b>Definition:</b> <a href="test__suite_8cpp_source.html#l00107">test_suite.cpp:107</a></div></div>
<div class="ttc" id="aclassPenningTrap_html"><div class="ttname"><a href="classPenningTrap.html">PenningTrap</a></div><div class="ttdoc">A class that simulates a Penning trap.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8hpp_source.html#l00031">PenningTrap.hpp:32</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a2c01108b52c8e2a003cf9170da9e7682"><div class="ttname"><a href="classPenningTrap.html#a2c01108b52c8e2a003cf9170da9e7682">PenningTrap::total_force_external</a></div><div class="ttdeci">vec3 total_force_external(uint i)</div><div class="ttdoc">Calculate the total external force on a particle.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00082">PenningTrap.cpp:82</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a2fe1cefbae18fa5808155ee0d2df713c"><div class="ttname"><a href="classPenningTrap.html#a2fe1cefbae18fa5808155ee0d2df713c">PenningTrap::total_force_particles</a></div><div class="ttdeci">vec3 total_force_particles(uint i)</div><div class="ttdoc">Calculate the total force on a particle p_i from other particles.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00095">PenningTrap.cpp:95</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a361f2c4862c90b5e8e2a2f50c6a95655"><div class="ttname"><a href="classPenningTrap.html#a361f2c4862c90b5e8e2a2f50c6a95655">PenningTrap::external_B_field</a></div><div class="ttdeci">vec3 external_B_field(vec3 r)</div><div class="ttdoc">Calculate B at point r.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00066">PenningTrap.cpp:66</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a5846c8f75cdc543fd9cf0b2185a3ef22"><div class="ttname"><a href="classPenningTrap.html#a5846c8f75cdc543fd9cf0b2185a3ef22">PenningTrap::external_E_field</a></div><div class="ttdeci">vec3 external_E_field(vec3 r)</div><div class="ttdoc">Calculate E at point r.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00058">PenningTrap.cpp:58</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a6e9776ff5b149f01080800716455d7c8"><div class="ttname"><a href="classPenningTrap.html#a6e9776ff5b149f01080800716455d7c8">PenningTrap::add_particle</a></div><div class="ttdeci">void add_particle(Particle particle)</div><div class="ttdoc">Add a particle to the system.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00158">PenningTrap.cpp:158</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a7f210bb2768a5d79ced4b0df0df97598"><div class="ttname"><a href="classPenningTrap.html#a7f210bb2768a5d79ced4b0df0df97598">PenningTrap::force_on_particle</a></div><div class="ttdeci">vec3 force_on_particle(uint i, uint j)</div><div class="ttdoc">Calculate the force between 2 particles.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00071">PenningTrap.cpp:71</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a2c01108b52c8e2a003cf9170da9e7682"><div class="ttname"><a href="classPenningTrap.html#a2c01108b52c8e2a003cf9170da9e7682">PenningTrap::total_force_external</a></div><div class="ttdeci">vec3 total_force_external(uint i)</div><div class="ttdoc">Calculate the total external force on a particle.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00083">PenningTrap.cpp:83</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a2fe1cefbae18fa5808155ee0d2df713c"><div class="ttname"><a href="classPenningTrap.html#a2fe1cefbae18fa5808155ee0d2df713c">PenningTrap::total_force_particles</a></div><div class="ttdeci">vec3 total_force_particles(uint i)</div><div class="ttdoc">Calculate the total force on a particle p_i from other particles.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00092">PenningTrap.cpp:92</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a361f2c4862c90b5e8e2a2f50c6a95655"><div class="ttname"><a href="classPenningTrap.html#a361f2c4862c90b5e8e2a2f50c6a95655">PenningTrap::external_B_field</a></div><div class="ttdeci">vec3 external_B_field(vec3 r)</div><div class="ttdoc">Calculate B at point r.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00067">PenningTrap.cpp:67</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a5846c8f75cdc543fd9cf0b2185a3ef22"><div class="ttname"><a href="classPenningTrap.html#a5846c8f75cdc543fd9cf0b2185a3ef22">PenningTrap::external_E_field</a></div><div class="ttdeci">vec3 external_E_field(vec3 r)</div><div class="ttdoc">Calculate E at point r.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00059">PenningTrap.cpp:59</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a6e9776ff5b149f01080800716455d7c8"><div class="ttname"><a href="classPenningTrap.html#a6e9776ff5b149f01080800716455d7c8">PenningTrap::add_particle</a></div><div class="ttdeci">void add_particle(Particle particle)</div><div class="ttdoc">Add a particle to the system.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00166">PenningTrap.cpp:166</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a7f210bb2768a5d79ced4b0df0df97598"><div class="ttname"><a href="classPenningTrap.html#a7f210bb2768a5d79ced4b0df0df97598">PenningTrap::force_on_particle</a></div><div class="ttdeci">vec3 force_on_particle(uint i, uint j)</div><div class="ttdoc">Calculate the force between 2 particles.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00072">PenningTrap.cpp:72</a></div></div>
<div class="ttc" id="aconstants_8hpp_html"><div class="ttname"><a href="constants_8hpp.html">constants.hpp</a></div><div class="ttdoc">Library of constants.</div></div>
<div class="ttc" id="aconstants_8hpp_html_a0acb682b8260ab1c60b918599864e2e5"><div class="ttname"><a href="constants_8hpp.html#a0acb682b8260ab1c60b918599864e2e5">T</a></div><div class="ttdeci">#define T</div><div class="ttdoc">1 Tesla. unit:</div><div class="ttdef"><b>Definition:</b> <a href="constants_8hpp_source.html#l00021">constants.hpp:21</a></div></div>
<div class="ttc" id="atypedefs_8hpp_html_a3bdfb73a02f88ae32b6128ef747c4aea"><div class="ttname"><a href="typedefs_8hpp.html#a3bdfb73a02f88ae32b6128ef747c4aea">vec3</a></div><div class="ttdeci">arma::vec::fixed&lt; 3 &gt; vec3</div><div class="ttdoc">Typedef for a fixed 3d arma vector.</div><div class="ttdef"><b>Definition:</b> <a href="typedefs_8hpp_source.html#l00023">typedefs.hpp:23</a></div></div>

View File

@@ -134,7 +134,7 @@ Functions</h2></td></tr>
<dd>
Janita Ovidie Sandtrøen Willumsen (janitaws)</dd></dl>
<dl class="section version"><dt>Version</dt><dd>1.0</dd></dl>
<dl class="bug"><dt><b><a class="el" href="bug.html#_bug000010">Bug:</a></b></dt><dd>No known bugs </dd></dl>
<dl class="bug"><dt><b><a class="el" href="bug.html#_bug000011">Bug:</a></b></dt><dd>No known bugs </dd></dl>
<p class="definition">Definition in file <a class="el" href="utils_8cpp_source.html">utils.cpp</a>.</p>
</div><h2 class="groupheader">Function Documentation</h2>

View File

@@ -1,266 +0,0 @@
\documentclass[../main.tex]{subfiles}
\graphicspath{{\subfix{../images/}}}
\begin{document}
\section{Derivation of equations}\label{sec:derivations}
% Problem 1
\subsection{Equations of motion}\label{sec:eq_motion} %
First, we need to define the velocity of the particle
\begin{align*}
\mathbf{v} \equiv \frac{d \mathbf{r}}{dt} &= \bigg( \frac{dx}{dt}, \frac{dy}{dt}, \frac{dz}{dt} \bigg).
\end{align*} %
%
We can rewrite the velocity as $\dot{r} = (\dot{x}, \dot{y}, \dot{z})$, and find the cross product
\begin{align*}
q \mathbf{v} \cross \mathbf{B} &=
q \begin{vmatrix}
\hat{e}_{x} & \hat{e}_{y} & \hat{e}_{z} \\
\dot{x} & \dot{y} & \dot{z} \\
0 & 0 & B_{0}
\end{vmatrix}
= q \big( B_{0} \dot{y}, -B_{0} \dot{x}, 0 \big).
\end{align*} %
%
We are considering an ideal Penning traps, where we define the electric potential as
\begin{align*}
V(x, y, z) &= \frac{V_{0}}{2 d^{2}}(2z^{2} - x^{2} - y^{2}).
\end{align*} %
%
The relationship between the electric field $\mathbf{E}$ and the electric potential of the field is given by
\begin{align*}
\mathbf{E} &= - \nabla V \\
&= - \bigg( \frac{dV}{dx}, \frac{dV}{dy} \frac{dV}{dz} \bigg) \\
&= \frac{V_{0}}{d^{2}} \big( x, y, -2z \big).
\end{align*} %
%
We can now express the Lorentz force as
\begin{align*}
\mathbf{F} &= q \mathbf{E} + q \mathbf{v} \cross \mathbf{B} \\
&= \frac{q V_{0}}{d^{2}} \big( x, y, -2z \big) + \big(q B_{0} \dot{y}, -q B_{0} \dot{x}, 0 \big),
\end{align*} %
%
and insert it into Newtons equation \eqref{eq:newton_second}. We get
\begin{align*}
\ddot{\mathbf{r}} &= \bigg( \frac{q V_{0}}{m d^{2}} x, \frac{q V_{0}}{m d^{2}} y, -\frac{2 q V_{0}}{m d^{2}} z \bigg) + \bigg(\frac{q B_{0}}{m} \dot{y}, -\frac{q B_{0}}{m} \dot{x}, 0 \bigg),
\end{align*} %
%
which can be written as
\begin{align*}
\ddot{x} &= \frac{q V_{0}}{m d^{2}} x + \frac{q B_{0}}{m} \dot{y}, \\
\ddot{y} &= \frac{q V_{0}}{m d^{2}} y - \frac{q B_{0}}{m} \dot{x}, \\
\ddot{z} &= -\frac{2 q V_{0}}{m d^{2}} z.
\end{align*} %
%
If we define
\begin{equation*}
\omega_{0} \equiv \frac{q B_{0}}{m}, \quad \omega_{z}^{2} \equiv \frac{2 q V_{0}}{m d^{2}},
\end{equation*} %
%
the equations of motion can be written as
\begin{align*}
\ddot{x} &= \frac{1}{2} \omega_{z}^{2} x + \omega_{0} \dot{y}, \\
\ddot{y} &= \frac{1}{2} \omega_{z}^{2} y - \omega_{0} \dot{x}, \\
\ddot{z} &= -\omega_{z}^{2} z. \\
\end{align*} %
%
\subsection{General solution}\label{sec:eq_general}
We consider the characteristic equation of a second order differential equation \cite{lindstrom:2016:ch10:5},
\begin{align*}
r^{2} + \omega_{z}^{2} &= 0 \\
r &= \pm \sqrt{- \omega_{z}^{2}}.
\end{align*} %
The characteristic equation has two complex roots
\begin{equation*}
r_{1} = - i \omega_{z}, \quad r_{2} = i \omega_{z},
\end{equation*}
which give us solutions in the general form
\begin{equation*}
z = c_{1} e^{i \omega_{z} t} + c_{2} e^{-i \omega_{z} t}.
\end{equation*}
In addition, for a complex number $z = a + ib$, we can define $e^{z} \equiv e^{a} (\cos{b} + i \sin{b})$ \cite{lindstrom:2016:ch3}. We can rewrite the general solution as
\begin{align*}
c_{1} e^{i \omega_{z} t} + c_{2} e^{-i \omega_{z} t} &= c_{1} (\cos{\omega_{z} t} + i \sin{\omega_{z} t}) \\
& \quad + c_{2} (\cos{\omega_{z} t} - i \sin{\omega_{z} t} \\
&= E \cos{\omega_{z} t} + i F \sin{\omega_{z} t}.
\end{align*} %
%
\subsection{Complex function}\label{sec:eq_complex} %
In sec. \ref{sec:eq_motion} we found the differential equations for $\ddot{x}$ and $\ddot{y}$. To derive a single differential equation, we introduce the complex function $f(t) = x(t) + iy(t)$, which gives us
\begin{align*}
0 &= \Big(\ddot{x} - \omega_{0} \dot{y} - \frac{1}{2} \omega_{z}^{2} x \Big) + i \Big(\ddot{y} + \omega_{0} \dot{x} - \frac{1}{2} \omega_{z}^{2} y \Big) \\
&= \ddot{x} - \omega_{0} \dot{y} - \frac{1}{2} \omega_{z}^{2} x + i\ddot{y} + i\omega_{0} \dot{x} - i \frac{1}{2} \omega_{z}^{2} y \\
&= \ddot{x} + i\ddot{y} + i\omega_{0} \dot{x} - \omega_{0} \dot{y} - \frac{1}{2} \omega_{z}^{2} x - i \frac{1}{2} \omega_{z}^{2} y. \\
\end{align*}
Using the definition $i = \sqrt{-1}$, we can rewrite
\begin{equation*}
i \omega_{0} \dot{x} + (-1) \omega_{0} \dot{y} = i \omega_{0} \dot{x} + i^{2} \omega_{0} \dot{y}.
\end{equation*}
This gives us a single differential equation
\begin{align*}
0 &= \ddot{x} + i\ddot{y} + i\omega_{0} (\dot{x} + i \dot{y}) - \frac{1}{2} \omega_{z}^{2} x - i \frac{1}{2} \omega_{z}^{2} y \\
&= \ddot{f} + i \omega_{0} \dot{f} - \frac{1}{2} \omega_{z}^{2} f.
\end{align*}
%
\subsection{Physical coordinates}\label{sec:eq_coord}
We can rewrite eq. \eqref{eq:general_solution}, as
\begin{align*}
f(t) &= A_{+}e^{-i(\omega_{+} t + \phi_{+})} + A_{-}e^{-i(\omega_{-} t + \phi_{-})} \\
&= A_{+}(\cos{(\omega_{+} t + \phi_{+})} - i \sin{(\omega_{+} t + \phi_{+})}) \\
% \numberthis \label{eq:general_solution_trig}
& \quad + A_{-}(\cos{(\omega_{-} t + \phi_{-})} - i \sin{(\omega_{-} t + \phi_{-})}).
\end{align*} %
%
\subsection{Upper and lower bounds}\label{sec:upper_lower_bound}
To obtain the upper and lower bounds of the particle's distance from the origin, we first find an expression for the second norm defined as $|f(t)| = \sqrt{(x(t))^{2} + (y(t))^{2}}$.
\begin{align*}
(x(t))^{2} &= \big( A_{+}\cos(\omega_{+} t + \phi_{+}) + A_{-}\cos(\omega_{-} t + \phi_{-}) \big)^{2} \\
&= A_{+}^{2} \cos^{2}(\omega_{+} t + \phi_{+}) \\
& \quad + 2 A_{+}A_{-} \cos(\omega_{+} t + \phi_{+})\cos(\omega_{-} t + \phi_{-}) \\
& \quad + A_{-}^{2}\cos^{2}(\omega_{-} t + \phi_{-}), \\
\end{align*} %
\begin{align*}
(y(t))^{2} &= \big( - A_{+} \sin(\omega_{+} t + \phi_{+}) - A_{-} \sin(\omega_{-} t + \phi_{-}) \big)^{2} \\
&= A_{+}^{2} \sin^{2}(\omega_{+} t + \phi_{+}) \\
& \quad + 2 A_{+}A_{-} \sin(\omega_{+} t + \phi_{+})\sin(\omega_{-} t + \phi_{-}) \\
& \quad + A_{-}^{2} \sin^{2}(\omega_{-} t + \phi_{-}).
\end{align*} %
We insert these expressions, and find
\begin{align*}
|f(t)| &= \sqrt{(x(t))^{2} + (y(t))^{2}} \\
&= \sqrt{A_{+}^{2} + 2 A_{+} A_{-} \cos^{2}(\alpha) + A_{-}^{2}},
\end{align*} %
where $\alpha = (\omega_{+} - \omega_{-}) t +( \phi_{+} - \phi_{-})$. If we set $\alpha = 0$ we get $\cos(0) = 1$, and obtain the upper bound
\begin{align*}
R_{+} &= \sqrt{A_{+}^{2} + 2 A_{+} A_{-} + A_{-}^{2}} \\
&= \sqrt{(A_{+} + A_{-})^{2}} \\
&= A_{+} + A_{-}.
\end{align*}
If $\alpha = \pi$ we get $\cos(\pi) = -1$, and find the lower bound
\begin{align*}
R_{-} &= \sqrt{A_{+}^{2} - 2 A_{+} A_{-} + A_{-}^{2}} \\
&= \sqrt{(A_{+} - A_{-})^{2}} \\
&= |A_{+} - A_{-}|.
\end{align*} %
%
\subsection{Bounded solution}\label{sec:bounded_solution}
To find a bounded solution, we need to consider the angular rate in eq. \eqref{eq:angular_rate}. Specifically the square-root expression
\begin{align*}
\sqrt{\omega_{0}^{2} - 2 \omega_{z}^{2}}.
\end{align*}
A bounded solution can be found when this expression is greater than zero. Meaning
\begin{align*}
\omega_{0}^{2} &> 2 \omega_{z}^{2}.
\end{align*} %
%
We can now use the definition of $\omega_{0}$ and $\omega_{z}^{2}$ to find an expression related to the Penning trap parameters, and the particle properties, to get
\begin{align*}
\Big( \frac{q B_{0}}{m} \Big)^{2} &> 2 \frac{2 q V_{0}}{m d^{2}} \\
\frac{q^{2} B_{0}^{2}}{m^{2}} &> \frac{4 q V_{0}}{m d^{2}}.
\end{align*} %
\section{Values used in simulation}
\subsection{Specific analytical solution}\label{sec:spec_analytical}
To compare our implementation of the Penning trap and particle, we have to specify initial conditions of the system to compare with the analytical solution. The initial conditions of a particle with a single positive charge, can be found in table \ref{tab:initial_particle_cond}.
\begin{table}[H]
\centering
\begin{tabular}[c]{ll}
$\mathbf{r}(0)$ & $\dot{\mathbf{r}}(0)$ \\
\hline
$x(0)$ = $x_{0}$ & $\dot{x}(0)$ = $0$ \\
$y(0)$ = $0$ & $\dot{y}(0)$ = $v_{0}$ \\
$z(0)$ = $z_{0}$ & $\dot{z}(0)$ = $0$ \\
\hline
\end{tabular}
\caption{Initial values of a particle with a single charge $q$, and mass $m$, confined in a Penning trap.}
\label{tab:initial_particle_cond}
\end{table}
\begin{table}[H]
\centering
\begin{tabular}[c]{lll}
Property & Value \\
\hline
$B_{0}$ & $1.00 T$ = $9.65 \cross 10^{1} \frac{u}{(\mu s) e}$ \\
$V_{0}$ & $25.0 mV$ = $2.41 \cross 10^{6} \frac{u (\mu m)^{2}}{(\mu s)^{2} e}$ \\
$d$ & $500 \ \mu m$ = \\
\hline
\end{tabular}
\caption{Default configuration of the Penning trap, where the value of T and V can be found in table \ref{tab:constants}.}
\label{tab:penning_config}
\end{table}
\begin{table}[H]
\centering
\begin{tabular}[c]{lll}
Property & Value \\
\hline
$q$ & $1.00 T$ & $9.65 \cross 10^{1} \frac{u}{(\mu s) e}$ \\
$m$ & $25.0 mV$ & $2.41 \cross 10^{6} \frac{u (\mu m)^{2}}{(\mu s)^{2} e}$ \\
\hline
\end{tabular}
\caption{Default configuration of the Penning trap, where the value of T and V can be found in table \ref{tab:constants}.}
\label{tab:particle_config}
\end{table}
\begin{table}[H]
\centering
\begin{tabular}[c]{lll}
$n_{k}$ & Time steps & Step size \\
\hline
$n_{1}$ & $4000$ & $0.0125$ \\
$n_{2}$ & $8000$ & $0.00625$ \\
$n_{3}$ & $16000$ & $0.003125$ \\
$n_{4}$ & $32000$ & $0.0015625$ \\
\hline
\end{tabular}
\caption{Number of steps used in a given simulation $k$, where the step size corresponds to $h_{1} = 50 / n_{k} \mu s$.}
\label{tab:time_steps}
\end{table}
\subsection{Numbers and units}\label{sec:numbers_units}
\begin{table}[H]
\centering
\begin{tabular}[c]{lll}
Constant & Value & Unit \\
\hline
$k_{e}$ (Coulomb) & $1.38935333 \cross 10^{5}$ & $\frac{u (\mu m)^{3}}{(\mu s)^{2} e^{2}}$ \\
T (Tesla) & $9.64852558 \cross 10^{1}$ & $\frac{u}{(\mu s) e}$ \\
V (Volt) & $9.64852558 \cross 10^{7}$ & $\frac{u (\mu m)^{2}}{(\mu s)^{2} e}$ \\
\hline
\end{tabular}
\caption{Value of the Coulomb constant ($k_{e}$), and the SI units for magnetic field strength ($T$) and electric potential ($V$). The base units are given by length in micrometre ($\mu m$), time in microseconds ($\mu s$), mass in ($u$), and charge in elementary charge ($e$).}
\label{tab:constants}
\end{table}
\section{Algorithm implementation and testing}\label{sec:algo}
\subsection{Forward Euler}\label{sec:algo_euler}
For a particle $i$, at time step $j$, the forward Euler method for a coupled system can be expressed as
\begin{align*}
\mathbf{r}_{i,j+1} &= \mathbf{r}_{i,j} + h \frac{d \mathbf{r}_{i,j}}{dt} = \mathbf{r}_{i,j} + h \mathbf{v}_{i,j} \\
\mathbf{v}_{i,j+1} &= \mathbf{v}_{i,j} + h \frac{\mathbf{v}_{i,j}}{dt} = \mathbf{v}_{i,j} + h \frac{\mathbf{F}(t_{j},\mathbf{v}_{i,j}, \mathbf{r}_{i,j} )}{m_{i}},
\end{align*}
$m_{i}$ is the mass of the particle, and $h$ is the step length.
\subsection{4th order Runge-Kutta}\label{sec:algo_rk4}
For a particle $i$, at time step $j$, the 4th order Runge-Kutta method for a coupled system can be expressed as
\begin{align*}
\mathbf{v}_{i,j+1} &= \mathbf{v}_{i,j} + \frac{h}{6} (\mathbf{k}_{\mathbf{v},1,i} + 2 \mathbf{k}_{\mathbf{v},2,i} + 2 \mathbf{k}_{\mathbf{v},3,i} + \mathbf{k}_{\mathbf{v},4,i} ), \\
\mathbf{r}_{i,j+1} &= \mathbf{r}_{i,j} + \frac{h}{6} (\mathbf{k}_{\mathbf{r},1,i} + 2 \mathbf{k}_{\mathbf{r},2,i} + 2\mathbf{k}_{\mathbf{r},3,i} + \mathbf{k}_{\mathbf{r},4,i}),
\end{align*}
where
\begin{align*}
\mathbf{k}_{\mathbf{v},1,i} &= \frac{\mathbf{F}_{i}(t_{j}, \mathbf{v}_{i,j}, \mathbf{r}_{i,j})}{m_{i}}, \\
\mathbf{k}_{\mathbf{r},1,i} &= \mathbf{v}_{i,j}, \\
\mathbf{k}_{\mathbf{v},2,i} &= \frac{\mathbf{F}_{i}(t_{j}+\frac{h}{2}, \mathbf{v}_{i,j} + h \frac{\mathbf{k}_{\mathbf{v},1,i}}{2}, \mathbf{r}_{i,j} + h \frac{\mathbf{k}_{\mathbf{r},1,i}}{2})}{m_{i}}, \\
\mathbf{k}_{\mathbf{r},2,i} &= \mathbf{v}_{i,j} + h \frac{\mathbf{k}_{\mathbf{v},1,i}}{2}, \\
\mathbf{k}_{\mathbf{v},3,i} &= \frac{\mathbf{F}_{i}(t_{j}+\frac{h}{2}, \mathbf{v}_{i,j} + h \frac{\mathbf{k}_{\mathbf{v},2,i}}{2}, \mathbf{r}_{i,j} + h \frac{\mathbf{k}_{\mathbf{r},2,i}}{2})}{m_{i}}, \\
\mathbf{k}_{\mathbf{r},3,i} &= \mathbf{v}_{i,j} + h \frac{\mathbf{k}_{\mathbf{v},2,i}}{2}, \\
\mathbf{k}_{\mathbf{v},4,i} &= \frac{\mathbf{F}_{i}(t_{j}+h, \mathbf{v}_{i,j} + h \mathbf{k}_{\mathbf{v},3,i}, \mathbf{r}_{i,j} + h \mathbf{k}_{\mathbf{r},3,i})}{m_{i}} \\
\mathbf{k}_{\mathbf{r},4,i} &= \mathbf{v}_{i,j} + h \frac{\mathbf{k}_{\mathbf{v},1,i}}{2}.
\end{align*}
In order to find each $\mathbf{k}_{\mathbf{r},i}$ and $\mathbf{k}_{\mathbf{v},i}$, we need to first compute all $\mathbf{k}_{\mathbf{r},i}$ and $\mathbf{k}_{\mathbf{v},i}$ for all particles, then update the particle values in order to compute $\mathbf{k}_{\mathbf{r},i+1}$ and $\mathbf{k}_{\mathbf{v},i+1}$.
\subsection{Test of implementation}\label{sec:testing}
We implemented a test suite, to validate the implementation during code development. In addition, we have implemented functionality to get informative output while testing the code. Further instructions with code can be found in the github repo \cite{github:repo}.
\end{document}

Binary file not shown.

53
latex/main.blg Normal file
View File

@@ -0,0 +1,53 @@
This is BibTeX, Version 0.99d (TeX Live 2022/CVE-2023-32700 patched)
Capacity: max_strings=200000, hash_size=200000, hash_prime=170003
The top-level auxiliary file: main.aux
The style file: unsrt.bst
Database file #1: mainNotes.bib
Database file #2: references/references.bib
Warning--entry type for "britannica:2023:matter" isn't style-file defined
--line 63 of file references/references.bib
Warning--entry type for "openmp:2018" isn't style-file defined
--line 92 of file references/references.bib
Warning--empty chapter and pages in vogel:2018:ch1
You've used 7 entries,
1791 wiz_defined-function locations,
485 strings with 4118 characters,
and the built_in function-call counts, 1494 in all, are:
= -- 143
> -- 28
< -- 2
+ -- 14
- -- 7
* -- 72
:= -- 212
add.period$ -- 19
call.type$ -- 7
change.case$ -- 7
chr.to.int$ -- 0
cite$ -- 8
duplicate$ -- 79
empty$ -- 172
format.name$ -- 7
if$ -- 355
int.to.chr$ -- 0
int.to.str$ -- 7
missing$ -- 8
newline$ -- 36
num.names$ -- 7
pop$ -- 35
preamble$ -- 1
purify$ -- 0
quote$ -- 0
skip$ -- 46
stack$ -- 0
substring$ -- 95
swap$ -- 25
text.length$ -- 2
text.prefix$ -- 0
top$ -- 0
type$ -- 0
warning$ -- 1
while$ -- 16
width$ -- 8
write$ -- 75
(There were 3 warnings)

Binary file not shown.

View File

@@ -49,7 +49,7 @@
\begin{document}
\title{Simulating Particles in an Ideal Penning Trap}
\title{Project 3} % self-explanatory
\author{Cory Alexander Balaton \& Janita Ovidie Sandtrøen Willumsen \\ \faGithub \, \url{https://github.uio.no/FYS3150-G2-2023/Project-3}} % self-explanatory
\date{\today} % self-explanatory
\noaffiliation % ignore this, but keep it.
@@ -73,13 +73,11 @@
% Conclusion
\subfile{sections/conclusion}
\newpage
\appendix
\subfile{appendix}
% \subfile{appendix/appendix_b}
% \subfile{appendix/appendix_c}
% \subfile{appendix/appendix_d}
\subfile{appendix/appendix_a}
\subfile{appendix/appendix_b}
\subfile{appendix/appendix_c}
\onecolumngrid

View File

@@ -97,32 +97,8 @@
urldate = {2023-10-22}
}
@online{penning:fig,
author = {Ludwig-Maximilians-Universität München},
title = {Penning traps},
@misc{penning:fig,
key = {something},
url = {https://www.med.physik.uni-muenchen.de/research/nuclear-science/nuclear-masses/mlltrap/layout/traps/index.html},
urldate = {2023-10-23},
note = {Configuration of a Penning trap, figure a}
}
@online{github:repo,
author = {Cory Alexander Balaton and Janita Ovidie Sandtrøen Willumsen},
url = {https://github.uio.no/FYS3150-G2-2023/Project-3},
urldate = {2023-10-24},
note = {FYS3150 Project 3 repo}
}
@online{scalasca,
author = {M. Geimer and F. Wolf and B.J.N. Wylie and E. Abraham and D. Becker and B. Mohr},
title = {Scalasca},
url = {https://www.scalasca.org/scalasca/about/about.html},
urldate = {2023-10-24},
note = {Tool to support performance optimization of parallel programs, measuring and analyzing runtime behavior.}
}
@online{scorep,
title = {Score-P: the Scalable Performance Measurement Infrastructure for Parallel Codes},
url = {https://perftools.pages.jsc.fz-juelich.de/cicd/scorep/tags/latest/html/},
urldate = {2023-10-24},
note = {Tool suite for profiling and event tracing.}
note = {Configuration figure a}
}

View File

@@ -4,7 +4,7 @@
\begin{document}
\begin{abstract}
We have studied the behavior of singly-charged Calcium ions ($\text{Ca}^{+}$), inside an ideal Penning trap. With a numerical approach, we studied the equations of motion by implementing the forward Euler method \(FE\) and the 4th order Runge-Kutta \(RK4\). We found that RK4 approximates the solution with smaller relative error than the relative error of FE. In addition, we evaluated the methods by their rate of convergence. We found that RK4 has a higher convergence rate at approx. $4.0$, compared to FE at approx. $1.4$. For particles interacting we explored angular frequencies, and amplitudes, of the time-dependent potential applied to the particles. We found that angular frequency in the range $\omega_{V} \in (1.3, 1.4)$ MHz is effective in pushing out particles, even for amplitude $f = 0.1$.
Add an abstract for the project?
\end{abstract}
\end{document}

View File

@@ -2,10 +2,11 @@
\graphicspath{{\subfix{../images/}}}
\begin{document}
\section{Conclusion}
We studied the movement of particles confined by an ideal Penning trap, where we used iterative methods to simulate the particle behavior. We included the magnetic and electric field of the Penning trap, in addition to simulating the particles behavior when interaction with other each other. When we introduced the interaction, the movement in both radial direction and z-direction changed. From a circular path, to a more elliptical path, where the particles initial condition determine how it is affecting other particles path.
We also compared iterative methods, with the analytical solution, and found that the forward Euler \(FE\) method result in an approximation with a large relative error compared to the relative error of the 4th order Runge-kutta \(RK4\) method. In addition, we also found that RK4 has a higher convergence rate at approx. $4.0$, compared to FE at approx. $1.4$. Which suggest RK4 reach the solution faster than what FE, however, when we increase the number of time steps both methods result in similar relative error. When the number of calculations increase, and the number of time steps is sufficient, FE can be the better choise to conserve computational resources.
When we explored the particles behavior at angular frequencies $\omega_{V} \in (0.2, 2.5)$ MHz, we found that particles are pushed out of the Penning trap when the amplitude of the applied time-dependent potential increase. The amplitude $f = 0.7$ result in particles being pushed out at most of the range of angular frequencies, whereas an amplitude $f = 0.1$ result in particles being pushed in a more narrow range. Since particles are being pushed out when the amplitude is low, there is likely a resonance frequency at around $1.4$ MHz.
\end{document}

View File

@@ -4,12 +4,10 @@
\begin{document}
%
\section{Introduction}
We are surrounded by matter, which are made up of elementary particles. In the field of physics we want to understand the properties of these particles, and measure their physical quantities. We want to describe the particles such that we can explain the origin of mass \cite{britannica:2023:matter}.
We are surrounded by matter, which are made up of elementary particles. In the field of physics we want to understand the properties of these particles, measure their physical quantities, not to mention explain the origin of mass \cite{britannica:2023:matter}.
However, to study a particle, it is necessary isolate and contain it over time. The Penning trap is a device, able to confine charged particles for a period of time. This concept was evolved from F. M. Penning's implementation of magnetic fields to a vaccuum gauge, and J. R. Pierce's work with electron beams, and put into practice by Hans Dehmelt. In 1973 Dehmelt and his group of researchers were able to confine a particle and store it over several months \cite{vogel:2018:ch1}.
However, to study a particle, it is necessary isolate and contain it over time. The Penning trap is a device, able to confine charged particles for a period of time. This concept was evolved from F. M. Penning's implementation of magnetic fiels to a vaccum gauge, and J. R. Pierce's work with electron beams, and put into practice by Hans Dehmelt. In 1973 Dehmelt and his group of researchers were able to confine a particle and store it over several months \cite{vogel:2018:ch1}.
In practice, a Penning trap is not easy to obtain, and an experiment would be both time consuming and expensive. A numerical approach, allow us to study the effects of the Penning trap on a charged particle, without the equipment and material cost. With ordinary differential equations (ODE) we can model the movement of particles, confined within a Penning trap.
We will study an ideal Penning trap, where an electrostatic field confines the particle in z-direction, and a magnetic field confines it in the radial direction. We will use numerical methods to model a single particle, and study the particle motion in radial direction. In addition, we will model a system of particles, and study their motion both with and without particle interaction.
In practice, a Penning trap is not easy to obtain, and an experiment is both time consuming and expensive. A numerical approach, allow us to study the effects of the Penning trap on a charged particle, without the cost. We can use ordinary differential equations to model the particle's movement, confined within an Penning trap. Our focus will be on an ideal Penning trap, where an electrostatic field confines the particle in z-direction, and a magnetic field confines it in the radial direction. We will use numerical methods to model a single particle, and study the particle motion in radial direction. In addition, we will model a system of particles, and study their motion both with and without particle interaction.
%
\end{document}

BIN
latex/sections/methods.pdf Normal file

Binary file not shown.

View File

@@ -2,48 +2,15 @@
\graphicspath{{\subfix{../images/}}}
\begin{document}
\section{Methods}\label{sec:methods}
\subsection{Theoretical background}\label{sec:theoretical_background}
In this experiment we study a particle with a charge $q$. To do so, we need to consider the forces acting on that particle. These forces are given by the Penning trap's electric field and magnetic field, an illustration can be found in fig. \ref{fig:penning_trap}.
\begin{figure}
\centering
\includegraphics[width=0.6\linewidth]{images/penning_trap.pdf}
\caption{The basic configuration of a hyperbolic Penning trap \cite{penning:fig}. Electric potential $V_{0}$ is applied to the electrodes in end caps (top and bottom), and in the ring (middle). The magnetic field is denoted as $\mathbf{B}$, the distance from the center to the end caps are denoted as $z_{0}$, and the radial distance as $r_{0}$.}
\label{fig:penning_trap}
\end{figure}
The electric field $\mathbf{E}$ in our model is related to the electric potential $V$ through
\begin{equation}\label{eq:electric_field_potential}
\mathbf{E} = - \nabla V,
\end{equation} %
\section{Methods}
% Problem 1
When we study the Penning traps effect on a particle with a charge $q$, we need to consider the forces acting on the particle. We can use Newton's second law \eqref{eq:newton_second} to determine the position of a particle as a function of time. In addition, we introduce the Lorentz force \eqref{eq:lorentz_force}, which describes the force on the particle. The position can be described by %
%
where we define the electric potential as
\begin{equation}\label{eq:electric_potential}
V(x, y, z) = \frac{V_{0}}{2 d^{2}} (2z^{2} - x^{2} - y^{2}).
\end{equation} %
%
The characteristic dimension $d = \sqrt{z_{0}^{2} + r_{0}^{2} / 2}$ determine the scale of the region between the electrodes. The magnetic field is homogeneous and defined as
\begin{equation}\label{eq:magnetic_field}
\mathbf{B} = B_{0} \hat{e}_{z} = (0, 0, B),
\end{equation} %
%
where $B_{0} > 0$ determines the strength of the field. The electric potential $V_{0}$ is applied to the electrodes, where the end caps are positively charged and the ring is negatively charged. The particle is confined by the electric field in the z-direction, however, it is not confined in the radial direction (xy-plane). The magnetic field is necessary to ensure the particle is fully confined in the Penning trap, and will force the particle to move in a circular orbit.
First, we consider Newton's second law \eqref{eq:newton_second}, to determine the position of the particle.
\begin{equation}\label{eq:newton_second}
m \ddot{\mathbf{r}} = \sum_{i} \mathbf{F}_{i}
\end{equation} %
%
In addition, we introduce the Lorentz force \eqref{eq:lorentz_force}, which describes the force acting on the particle.
\begin{equation}\label{eq:lorentz_force}
\mathbf{F} = q \mathbf{E} + q \mathbf{v} \times \mathbf{B},
\end{equation} %
%
where $\ddot{\mathbf{r}} = d^{2} \mathbf{r} / dt^{2}$. We combine eq. \eqref{eq:newton_second} and eq. \eqref{eq:lorentz_force} in
\begin{equation}\label{eq:newton_lorentz}
m \ddot{\mathbf{r}} = (q \mathbf{E} + q \mathbf{v} \times \mathbf{B}),
\end{equation} %
m \ddot{\mathbf{r}} = (q \mathbf{E} + q \mathbf{v} \times \mathbf{B}).
\end{equation}
%
and derive the differential equations in appendix \ref{sec:eq_motion}. We can rewrite and simplify these equations as
Using eq. \eqref{eq:newton_lorentz} we derive the differential equations in sec. \ref{sec:eq_motion}, and can rewrite them as
\begin{align}
\label{eq:motion_x}
\ddot{x} - \omega_{0} \dot{y} - \frac{1}{2} \omega_{z}^{2} x &= 0, \\
@@ -53,36 +20,32 @@ and derive the differential equations in appendix \ref{sec:eq_motion}. We can re
\ddot{z} + \omega_{z}^{2} z &= 0,
\end{align} %
%
where
\begin{equation*}
\omega_{0} \equiv \frac{q B_{0}}{m}, \quad \omega_{z}^{2} \equiv \frac{2 q V_{0}}{m d^{2}}.
\end{equation*} %
%
We find the general solution for eq. \eqref{eq:motion_z}
\begin{equation}\label{eq:eq_general}
z(t) = c_{1} e^{i \omega_{z} t} + c_{2} e^{-i \omega_{z} t},
\end{equation} %
derived in appendix \ref{sec:eq_general}. Continuing, we will use a Calcium ion with a single positive charge. That is, we assume the charge of the particle is $q > 0$.
derived in sec. \ref{sec:eq_general}. Continuing, we will use a Calcium ion with a single positive charge. That is, we assume the charge of the particle is $q > 0$.
Since eq. \eqref{eq:motion_x} and eq. \eqref{eq:motion_y} are coupled, we want to rewrite them as a single differential equation. We derive this in appendix \ref{sec:eq_complex}, and the resulting equation is given by
% Problem 2
Since eq. \eqref{eq:motion_x} and eq. \eqref{eq:motion_y} are coupled, we want to rewrite them as a single differential equation. We derive this in sec. \ref{sec:eq_complex}, and the resulting equation is given by
\begin{equation}\label{eq:single_differential}
\ddot{f} + i \omega_{0} \dot{f} - \frac{1}{2} \omega_{z}^{2} f = 0.
\end{equation} %
%
\end{equation}
% Problem 3
Eq. \eqref{eq:single_differential} has a general solution given by
\begin{equation}\label{eq:general_solution}
f(t) = A_{+}e^{-i(\omega_{+} t + \phi_{+})} + A_{-}e^{-i(\omega_{-} t + \phi_{-})}.
\end{equation} %
%
The amplitude $A_{+}$ and $A_{-}$ are positive, the phases $\phi_{+}$ and $\phi_{-}$ are constant, and the angular rate is given by
\begin{equation}\label{eq:angular_rate}
The amplitude $A_{+}$ and $A_{-}$ are positive, the phases $\phi_{+}$ and $\phi_{-}$ are constant, and the rate is given by
\begin{equation*}
\omega_{\pm} = \frac{\omega_{0} \pm \sqrt{\omega_{0}^{2} - 2 \omega_{z}^{2}}}{2}.
\end{equation}
\end{equation*}
We find the physical coordinates at a given time $t$ using
\begin{equation*}
x(t) = \text{Re}f(t), \quad y(t) = \text{Im}f(t),
\end{equation*} %
and eq. \eqref{eq:general_solution}. We can rearrange the right hand side of the expression derived in \ref{sec:eq_coord}, to find the physical coordinates
and eq. \eqref{eq:general_solution}. We can rearrange the right hand side of the derived expression in \ref{sec:eq_coord}, and find the physical coordinates
\begin{align}\label{eq:physical_coord}
x(t) &= A_{+} \cos(\omega_{+} t + \phi_{+}) + A_{-} \cos(\omega_{-} t + \phi_{-}) \\
y(t) &= - A_{+} \sin(\omega_{+} t + \phi_{+}) - A_{-} \sin(\omega_{-} t + \phi_{-})
@@ -92,74 +55,104 @@ However, to obtain a bound on the particle's movement in the radial direction, w
\begin{align*}
|f(t)| &= \sqrt{(x(t))^{2} + (y(t))^{2}}. \\
\end{align*} %
Which means we have to put constraint on the values of $\omega_{0}$ and $\omega_{z}^{2}$ in order to find a bounded solution $|f(t)| < \infty$. We derive an expression for this in appendix \ref{sec:bounded_solution}. Since we have assumed the particle charge $q > 0$, and the mass $m > 0$, the constraints are
\begin{equation}
\frac{q}{m} > \frac{4 V_{0}}{d^{2} B_{0}^{2}}.
\end{equation} %
%
When $t \rightarrow \infty$, the upper and lower limits are
\begin{align}
\label{eq:upper_b}
R_{+} &= A_{+} + A_{-}, \\
\label{eq:lower_b}
R_{+} &= A_{+} + A_{-} \\
R_{-} &= |A_{+} - A_{-}|,
\end{align}
which we derive in appendix \ref{sec:upper_lower_bound}.
derived in sec. \ref{sec:bounded_solution}.
In this experiment, we will use the initial conditions for the particle given in table \ref{tab:initial_particle_cond}. From eq. \eqref{eq:motion_z} and the initial conditions, we find the specific solution
% Problem 3
To obtain the bounded solution, we need to consider the expression
\begin{equation*}
z(t) = z_{0} \cos (\omega_{z} t)
\alpha = (\omega_{+} - \omega_{-}) t +( \phi_{+} - \phi_{-}).
\end{equation*}
For the particle movement in the radial direction, we find the specific solution using eq. \eqref{eq:general_solution} with
When $t \rightarrow \infty$ the constant phases will not affect the expression, we obtain a bounded solution if we consider the rate such that $|f(t)| < \infty$. That is, we need $\omega_{0}^{2} - 2 \omega_{z}^{2}$ in eq. \eqref{eq:angular_rate} to be real.
\begin{align*}
A_{+} &= \frac{v_{0} + \omega_{-} x{0}}{\omega_{-} - \omega_{+}}, & A_{-} &= - \frac{v_{0} + \omega_{+} x{0}}{\omega_{-} - \omega_{+}}, \\
\phi_{+} &= 0, & \phi_{-} &= 0.
\omega_{0}^{2} - 2 \omega_{z}^{2} = 0, \quad \omega_{0} > 2 \omega_{z}
\end{align*}
We will also consider the numerical simulation of multiple particles, confined in a Penning trap. The particles will experience a repelling force from each other, giving the electric field
\begin{equation}\label{eq:electric_field_interaction}
\mathbf{E} = k_{e} \sum_{j = 1}^{n} q_j \frac{\mathbf{r} - \mathbf{r}_{j}}{|\mathbf{r}_{i} - \mathbf{r}_{j}|^{3}}.
\end{equation} %
The Coulomb constant $k_{e}$ value can be found in table \ref{tab:constants}.
For multiple particles we have to modify the equations of motion, by adding a term for the force a given particle experience at a given point. When we scale eq. \eqref{eq:electric_field_interaction} by charge and mass, we get a new set of equations of motion
\begin{align}
\label{eq:coulomb_motion_x}
\ddot{x}_{i} - \omega_{0,i} \dot{y}_{i} - \frac{1}{2} \omega_{z,i}^{2} x_{i} - k_{e} \frac{q_{i}}{m_{i}}\sum_{j \neq i} q_j \frac{x_{i} - x_{j}}{|\mathbf{r}_{i} - \mathbf{r}_{j}|^{3}} &= 0, \\
\label{eq:coulomb_motion_y}
\ddot{y}_{i} - \omega_{0,i} \dot{x}_{i} - \frac{1}{2} \omega_{z,i}^{2} y_{i} - k_{e} \frac{q_{i}}{m_{i}}\sum_{j \neq i} q_j \frac{y_{i} - y_{j}}{|\mathbf{r}_{i} - \mathbf{r}_{j}|^{3}} &= 0, \\
\label{eq:coulomb_motion_z}
\ddot{z}_{i} + \omega_{z,i}^{2} z_{i} - k_{e} \frac{q_{i}}{m_{i}}\sum_{j \neq i} q_j \frac{z_{i} - z_{j}}{|\mathbf{r}_{i} - \mathbf{r}_{j}|^{3}} &= 0,
\end{align} %
where $i$ and $j$ denote the particle indices. When we include a time-dependence to the applied potential we make a replacement of the initial electric potential
\begin{equation}\label{eq:pertubation}
V_{0} \rightarrow V_{0} (1 + f \cos (\omega_{V} t)),
\begin{equation}\label{eq:angular_rate}
\omega_{\pm} = \frac{\omega_{0} \pm \sqrt{\omega_{0}^{2} - 2 \omega_{z}^{2}}}{2}
\end{equation}
where $f$ denotes the amplitude and $\omega_{V}$ the angular rate.
\subsection{Algorithms and implementation}\label{sec:algo_implementation}
When we consider a multi-particle system, we adapt the notation in our derived equations. The force acting on a particle in the Penning trap, which experience particle interaction, can be written as
\begin{equation}\label{eq:lorentz_force_interaction}
\mathbf{F}_{i}(t, \mathbf{v}_{i}, \mathbf{r}_{i}) = q_{i} \mathbf{E}(t, \mathbf{r}_{i}) + q_{i} \mathbf{v}_{i} \cross \mathbf{B} - \mathbf{E}_{p}(t, \mathbf{r}_{i}),
We find the solution
Physical properties given by newtons second law \eqref{eq:newton_second}
The particle moves and its position can be determined using newton. where the electric field
\begin{table}[H]
\centering
\begin{tabular}[c]{lll}
Constant & Value & \\
\hline
$B_{0}$ & $1.00 T$ & $9.65 \cross 10^{1} \frac{u}{(\mu s) e}$ \\
$V_{0}$ & $25.0 mV$ & $2.41 \cross 10^{6} \frac{u (\mu m)^{2}}{(\mu s)^{2} e}$ \\
$d$ & $500 \ \mu m$ & \\
\hline
\end{tabular}
\caption{Default configuration of the Penning trap, where the value of T and V can be found in table \ref{tab:constants}.}
\label{tab:penning_config}
\end{table}
\subsection{Dealing with a multi--particle system}
For a multi-particles system, we need to modify $\vb{F}$ to account for the
force of other particles in the system acting upon each other. To do that, we
add another term to $\vb{F}$
\begin{equation}
\vb{F}_i(t, \vb{v}_i, \vb{r}_i) = q_i \vb{E}(t, \vb{r}_i) + q_i \vb{v}_i \cross \vb{B} - \vb{E}_p(t, \vb{r}_i),
\end{equation}
where $i$ and $j$ are particle indices and
\begin{equation}
\vb{E}_p(t, \vb{r}_i) = q_i k_e \sum_{j \neq i}
q_j \frac{\vb{r_i} - \vb{r_j}}{\left| \vb{r_i} - \vb{r_j} \right|^3}.
\label{eq:}
\end{equation}
where $i$ and $j$ still denotes the particle indices, and $\mathbf{E}_{p}$ denotes the force exerted on particle $i$ by particle $j$.
\begin{equation}\label{eq:electric_force_interaction}
\mathbf{E}_{p}(t, \mathbf{r}_{i}) = k_{e} q_{i} \sum_{j \neq i}
q_{j} \frac{\mathbf{r}_{i} - \mathbf{r}_{j}}{| \mathbf{r}_{i} - \mathbf{r}_{j} |^{3}}.
\end{equation} %
In addition, we adapt the notation of \eqref{eq:newton_second}, and define the first derivative of the particle position as
\begin{align}
\label{eq:r_derivative}
\frac{d \mathbf{r}_{i}}{dt} = \dot{\mathbf{r}}_{i} &= \mathbf{v}_{i}, \\
\label{eq:v_derivative}
\frac{d \mathbf{v}_{i}}{dt} = \dot{\mathbf{v}}_{i} &= \frac{\mathbf{F}_{i} (t, \mathbf{v}_{i}, \mathbf{r}_{i}}{m_{i}},
\end{align}
We first implemented the forward Euler method, using the expression for a coupled system given in appendix \ref{sec:algo_euler}. We define the forward Euler algorithm in \ref{algo:forward_euler}.
Newton's second law for a particle $i$ is then
\begin{equation}
\frac{d^2\vb{r}_i}{dt^2} = \frac{\vb{F}_i\left(t, \frac{d\vb{r}_i}{dt}, \vb{r_i}\right)}{m_i},
\label{eq:newtonlaw2}
\end{equation}
We can then rewrite the second order ODE from equation~\ref{eq:newtonlaw2}
into a set of coupled first order ODEs.
We now rewrite Newton's second law of motion as
\begin{equation}
\begin{split}
\frac{d\vb{r}_i}{dt} &= \vb{v}_i \\
\frac{d\vb{v}_i}{dt} &= \frac{\vb{F}_i(t, \vb{v}_i, \vb{r}_i)}{m_i}.
\end{split}
\label{eq:coupled}
\end{equation}
\subsection{Forward Euler}
For a particle $i$, the forward Euler method for a coupled system is
expressed as
\begin{equation}
\begin{split}
\vb{r}_{i,j+1} &= \vb{r}_{i,j} + h \cdot \frac{d\vb{r}_{i,j}}{dt} = \vb{r}_{i,j} + h \cdot \vb{v}_{i,j} \\
\vb{v}_{i,j+1} &= \vb{v}_{i,j} + h \cdot \frac{\vb{v}_{i,j}}{dt} = \vb{v}_{i,j} + h \cdot \frac{\vb{F}\left( t_{j}, \vb{v}_{i,j}, \vb{r}_{i,j} \right)}{m},
\end{split}
\end{equation}
for particle $i$ where $j$ is the current time step of the particle,
$m$ is the mass of the particle, and $h$ is the step length.
When dealing with a multi-particle system, we need to ensure that we do not
update the position of any particles until every particle has calculated their
next step. An easy way of doing this is to create a copy of all the particles,
then update the copy, and when all the particles have calculated their next
step, simply replace the particles with the copies.
Algorithm~\ref{algo:forwardeuler} provides an overview on how that can be achieved. % Make this better
\begin{figure}[H]
\begin{algorithm}[H]
\caption{Forward Euler method}
\label{algo:forward_euler}
\label{algo:forwardeuler}
\begin{algorithmic}
\Procedure{Evolve forward Euler}{$particles, dt$}
\State $N \leftarrow \text{Number of particles in } particles$
@@ -173,7 +166,56 @@ We first implemented the forward Euler method, using the expression for a couple
\end{algorithm}
\end{figure}
We also implemented the 4th order Runge-Kutta (RK4) method, using the expression given in appendix \ref{sec:algo_rk4}. We define the RK4 algorithm in \ref{algo:rk4}. $\mathbf{F}$ does not take any arguments, however, the total force acting on the particle is calculated using the value of position and velocity within $particles$.
\subsection{4th order Runge-Kutta}
For a particle $i$, we can express the 4th order Runge-Kutta (RK4) method as
\begin{equation}
\begin{split}
\vb{v}_{i,j+1} &= \vb{v}_{i,j} + \frac{h}{6} \left( \vb{k}_{\vb{v},1,i}
+ 2\vb{k}_{\vb{v},2,i} + 2\vb{k}_{\vb{v},3,i} + \vb{k}_{\vb{v},4,i}
\right) \\
\vb{r}_{i,j+1} &= \vb{r}_{i,j} + \frac{h}{6} \left( \vb{k}_{\vb{r},1,i}
+ 2\vb{k}_{\vb{r},2,i} + 2\vb{k}_{\vb{r},3,i} + \vb{k}_{\vb{r},4,i}
\right),
\end{split}
\end{equation}
where
\begin{equation}
\begin{split}
\vb{k}_{\vb{v},1,i} &= \frac{\vb{F}_i(t_j, \vb{v}_{i,j},
\vb{r}_{i,j})}{m} \\
\vb{k}_{\vb{r},1,i} &= \vb{v}_{i,j} \\
\vb{k}_{\vb{v},2,i} &= \frac{\vb{F}_i(t_j+\frac{h}{2}, \vb{v}_{i,j}
+ h \cdot \frac{\vb{k}_{\vb{v},1,i}}{2}, \vb{r}_{i,j}
+ h \cdot \frac{\vb{k}_{\vb{r},1,i}}{2})}{m} \\
\vb{k}_{\vb{r},2,i} &= \vb{v}_{i,j}
+ h \cdot \frac{\vb{k}_{\vb{v},1,i}}{2} \\
\vb{k}_{\vb{v},3,i} &= \frac{\vb{F}_i(t_j+\frac{h}{2}, \vb{v}_{i,j}
+ h \cdot \frac{\vb{k}_{\vb{v},2,i}}{2}, \vb{r}_{i,j}
+ h \frac{\cdot \vb{k}_{\vb{r},2,i}}{2})}{m} \\
\vb{k}_{\vb{r},3,i} &= \vb{v}_{i,j}
+ h \cdot \frac{\vb{k}_{\vb{v},2,i}}{2} \\
\vb{k}_{\vb{v},4,i} &= \frac{\vb{F}_i(t_j+h, \vb{v}_{i,j}
+ h \cdot \vb{k}_{\vb{v},3,i}, \vb{r}_{i,j}
+ h \cdot \vb{k}_{\vb{r},3,i})}{m} \\
\vb{k}_{\vb{r},4,i} &= \vb{v}_{i,j}
+ h \cdot \frac{\vb{k}_{\vb{v},1,i}}{2}.
\end{split}
\end{equation}
In order to find each $\vb{k}_{\vb{r},i}$ and $\vb{k}_{\vb{v},i}$,
we need to first compute all $\vb{k}_{\vb{r},i}$ and $\vb{k}_{\vb{v},i}$
for all particles, then we can update the particles in order to compute
$\vb{k}_{\vb{r},i+1}$ and $\vb{k}_{\vb{v},i+1}$. In order for the algorithm
to work, we need to save a copy of each particle before starting so that we
can update the particles correctly for each step.
This approach would require 8 loops to be able to complete the calculation since
we cannot update the particles until after all $\vb{k}$ values have been
computed, however if we create a temporary array that holds particles, we can
put the updated particles in there, and then use that array in the next loop,
and would reduce the required amount of loops down to 4.
\begin{figure}
\begin{algorithm}[H]
\caption{RK4 method}
@@ -225,12 +267,12 @@ We also implemented the 4th order Runge-Kutta (RK4) method, using the expression
\State $\vb{k}_{\vb{v},4,i} \leftarrow \frac{\vb{F}}{m}$
\State $tmp\_p_i.\vb{r} \leftarrow orig\_p_i.\vb{r} + \frac{dt}{6}
\cdot \left( \vb{k}_{\vb{r},1,i} + 2 \vb{k}_{\vb{r},2,i}
+ 2 \vb{k}_{\vb{r},3,i} + \vb{k}_{\vb{r},4,i} \right)$
\cdot \left( \vb{k}_{\vb{r},1,i} + \vb{k}_{\vb{r},2,i}
+ \vb{k}_{\vb{r},3,i} + \vb{k}_{\vb{r},4,i} \right)$
\State $tmp\_p_i.\vb{v} \leftarrow orig\_p_i.\vb{v} + \frac{dt}{6}
\cdot \left( \vb{k}_{\vb{v},1,i} + 2 \vb{k}_{\vb{v},2,i}
+ 2 \vb{k}_{\vb{v},3,i} + \vb{k}_{\vb{v},4,i} \right)$
\cdot \left( \vb{k}_{\vb{v},1,i} + \vb{k}_{\vb{v},2,i}
+ \vb{k}_{\vb{v},3,i} + \vb{k}_{\vb{v},4,i} \right)$
\EndFor
@@ -238,20 +280,17 @@ We also implemented the 4th order Runge-Kutta (RK4) method, using the expression
\EndProcedure
\end{algorithmic}
\end{algorithm}
$\vb{F}$ in the algorithm does not take any arguments as it uses the
velocities and positions of the particles inside the array $particles$ to
calculate the total force acting on particle $i$.
\end{figure}
For a system of particles, the positional value of one particle affects the rest of the particles. We calculated the next step for all particles, updated their values in a copy, and updated the positional value based on the original values. We simulated the movement of particles confined in a Penning trap. All simulations used the initial conditions for particle 1 and 2 given in table \ref{tab:initial_particle_cond}.
\subsection{Testing and error analysis}
We implemented a test suite to validate our results, details can be found in appendix \ref{sec:testing}. To analyze our results, we compared the relative error of the analytical solution with the result from the implemented forward Euler method and RK4 method. We simulated four times using time steps given in table \ref{tab:time_steps}, and estimated the error convergence rate $r_{\text{err}}$ for both methods using
\begin{equation}
r_{\text{err}} = \frac{1}{3} \sum_{k=2}^{4} \frac{\log(\Delta_{\text{max},k} / \Delta_{\text{max}, k-1})}{\log(h_{k} / h_{k-1})}.
\end{equation}
The maximum error of a simulation $k$ with a step size $h_{k}$ is given by
\begin{equation*}
\Delta_{\text{max},k} = \max_{i} |\mathbf{r}_{i, \text{exact}} - \mathbf{r}_{i}|,
\end{equation*}
where $\mathbf{r}_{i, \text{exact}}$ is the analytical solution, and $\mathbf{r}_{i}$ is the computed result.
\subsection{Testing the simulation}
\subsection{Relative error and error convergance rate}
\subsection{Tools}
The numerical methods are implemented in C++, and parallelized using \verb|OpenMP| \cite{openmp:2018}. In addition, we used the profiler \verb|Scalasca| \cite{scalasca} and \verb|Score-P| \cite{scorep} event tracking, during development. We used the Python library \verb|matplotlib| \cite{hunter:2007:matplotlib} to produce all the plots, and \verb|seaborn| \cite{waskom:2021:seaborn} to set the theme in the figures.
The numerical methods implemented in C++, are parallelized using OpenMP \cite{openmp:2018}. We used the Python library matplotlib \cite{hunter:2007:matplotlib} to produce all the plots, and seaborn \cite{waskom:2021:seaborn} to set the theme in the figures.
\end{document}

View File

@@ -2,122 +2,88 @@
\graphicspath{{\subfix{../images/}}}
\begin{document}
\section{Results and Discussion}
The simulations were performed using a constant configuration for the Penning trap, where the values of $B_{0}$, $V_{0}$, and $d$ can be found in table \ref{tab:penning_config}. We also used a constant configuration for the particles, found in table \ref{tab:particle_config}. Initial position of particle 1 $p_{1}$ was set to $(20, 0, 20) \mu m$ with velocity $(0, 25, 0) \mu m/ \mu s$, whereas the position of particle 2 $p_{2}$ was set to $(25, 25, 0) \mu m$ with velocity $(0, 40, 5) \mu m/ \mu s$.
First, we simulated a single particle for $50 \mu s$, approximating the particle's motion using the RK4 method. In addition we compared the result with the analytical solution in figure \ref{fig:single_particle}. The approximated solution completely overlap the analytical, suggesting the implemented method is approximating the solution with minimal error. The angular frequency is
\begin{align*}
\omega_{z} &= \sqrt{\frac{2 q V_{0}}{m d^{2}}} = \sqrt{\frac{2 \cdot 1 \cdot 9.65}{40.078}} \approx 0.694 \text{ rad/\textmu s},
\end{align*}
which result in a period (P) of
\begin{align*}
\text{P} &= \frac{2 \pi}{|\omega_{z}|} \approx 9.054 \text{\textmu s}.
\end{align*}
From figure \ref{fig:single_particle} we see that the period, the time it takes for the particle to reach the same position, is close to 9 \textmu s. This is what we would expect given the value of $\omega_{z}$.
% Figure: single_particle.pdf
\section{Results and Discussion}
% Single particle
We simulated the movement of particles confined in a Penning trap. All simulations used the initial conditions for particle 1 and 2 given in table \ref{tab:initial_condition_particles}.
First we simulated a single particle for $50 \mu s$, approximating the particle's motion using the RK4 method. In addition we compared the motion of particle 1 with the analytical solution in figure \ref{fig:single_particle}. What we see is a complete overlap of the analytical solution completely overlap the approximated, suggest that the simulation result is good.
% Add something about why the simulated result is good, cos(wt) when w is
%
\begin{table}[H]
\centering
\begin{tabular}[c]{lll}
Particle & Position & Velocity \\
\hline
$p_{1}$ & $(20, 0, 20) \mu m$ & $(0, 25, 0) \mu m/ \mu s$ \\
$p_{2}$ & $(25, 25, 0) \mu m$ & $(0, 40, 5) \mu m/ \mu s$ \\
\hline
\end{tabular}
\caption{Initial position and velocity of particle 1 ($p_{1}$) particle 2 ($p_{2}$), where the analytical solution is given by $z(t) = z_{0} \cos (\omega_{z} t)$}
\label{tab:initial_condition_particles}
\end{table}
\begin{figure}[H]
\centering
\includegraphics[width=\linewidth]{images/single_particle.pdf}
\caption{Movement of a single particle in z-direction. Approximated using the 4th order Runge-Kutta method, compared to the analytical solution $z(t) = z_{0} \cos (\omega_{z} t)$.}
\caption{A single particle in the Penning trap, approximated and analytical motion in z-direction.}
\label{fig:single_particle}
\end{figure}
To evaluate the implemented methods we simulated the particle using both forward Euler (FE) and RK4, with different time steps given in \ref{tab:time_steps}. Again, we simulated the particle movement for $50$ \textmu s, and estimated the relative error of each method. The result can be found in figure \ref{fig:relative_error}. The relative error of FE is large compared to the relative error of RK4. The error convergence rate for FE is $r_{\text{err}} \approx 1.39652$, and RK4 $r_{\text{err}} \approx 3.99998$, which means RK4 converges faster compared to FE.
\begin{figure}[H]
% Add equations of motion for particle with interaction eq. (18, 19, 20)
% Multiple particles
% Add initial condition of Penning trap
We will now consider the Penning trap with initial conditions given in table \ref{tab:initial_condition_penning}, and simulate using one or two particles. In addition, we simulate two particles both with and without interactions, the result is found in figure \ref{fig:two_particles}. When we add interaction between the particles, they both still follow the same inherent path. However, we observe a small shift in both particle's movement.
\begin{table}[H]
\centering
\includegraphics[width=\linewidth]{images/relative_error.pdf}
\caption{Relative error measured for 4th order Runge-Kutta \(a\) and foreward Euler \(b\). Important to notice when reading the plot, that the scale of measured relative error differ between the methods.}
\label{fig:relative_error}
\end{figure}
RK4 is a more complex method, which requires four times the calculations compared to FE. When the simulation is done with $n_{4} = 32000$ time steps, the difference in relative error decreases. The cost of calculation exceed the benefit of accuracy. That is, at a large number of time steps we could find a satisfying approximation to the solution using FE, with less calculations.
Next, we simulated the movement of two particles in radial direction. In figure \ref{fig:two_particles_radial}, we see the path of both particles without interaction. The starting position of particle 1 $p_{1}$ is closer to the center of the Penning trap, than the starting position of $p_{}$. Both particles move in an orbital path arount the center, however, the starting velocity of each particles determine the minimum and maximum distance a particle moves from the center. We find these values bounds using eq. \ref{eq:upper_b} and eq. \ref{eq:lower_b}
\begin{align*}
R_{+} &= A_{+} + A_{-} \\
&= -12.3232 \text{\textmu m} + 32.3232 \text{\textmu m} \\
&= 20.00 \text{\textmu m},
\end{align*}
and
\begin{align*}
R_{-} &= |A_{+} - A_{-}| \\
&= |-12.3232 \text{\textmu m} - 32.3232 \text{\textmu m}| \\
&= 44.6464 \text{\textmu m}.
\end{align*}
The distance is similar that in figure \ref{fig:two_particles_radial}. In addition, we can see from \ref{fig:phase_nointer_x} that the distance differ between $p_{1}$ and $p_{2}$. When we study the particle movement in z-direction, in figure \ref{fig:phase_nointer_z}, we see a circular movement. Again, the distance the particle moves from the center is determined by its initial conditions.
In figure \ref{fig:two_particles_radial_interaction} we see the movement in radial direction, where particle interaction is included. The orbital path is similar to what we see without particle interaction. However, the additional force acting on the particle is affecting it's trajectory. The distance each particle is moving from the center, differs depending on the position. Which is also seen in figure \ref{fig:phase_inter_x}, where we see the trajectory of the particle at a given position. When we study the phase space plot, where particle interaction is included, in figure \ref{fig:phase_inter_z} a similar difference is observed. In figure \ref{fig:3d_particles} we see the movement of two particles in both the radial direction and z-direction. The figure include particle movement with and without interaction, where we can observe the change in movement.% Something about the trajectory related to the interaction?
\begin{figure}[H]
\begin{tabular}{lll}
$B_0$ & $V_{0}$ & $d$ \\
\hline
\end{tabular}
\caption{Caption}
\label{tab:initial_condition_penning}
\end{table}
%
\begin{figure}
\centering
\includegraphics[width=\linewidth]{images/simulate_2_particles_no_interaction_xy.pdf}
\caption{Path of two particles, $p_{1}$ and $p_{2}$, without interaction. The black dot marks the starting position of each particle.}
\label{fig:two_particles_radial}
\includegraphics[width=\linewidth]{images/plot_2_particles_xy.pdf}
\caption{Movement of two particles in the xy-plane. $\hat{p}_{1}$ and $\hat{p}_{2}$ include particle interaction, whereas $p_{1}$ and $p_{2}$ does not include particle interaction.}
\label{fig:two_particles}
\end{figure}
\begin{figure}[H]
\centering
\includegraphics[width=\linewidth]{images/simulate_2_particles_interaction_xy.pdf}
\caption{Path of two particles, $p_{1}$ and $p_{2}$, with interaction. The black dot marks the starting position of each particle.}
\label{fig:two_particles_radial_interaction}
\end{figure}
\begin{figure}[H]
% Phase space plot
When we simulate two particles, we can see the effect of interaction between the particles in the xy-plane in fig. \ref{fig:phase_space_2x} and in the z-direction in fig. \ref{fig:phase_space_2z}. What we observe is a very small shift in position for particle 1 in x-direction, whereas particle 2 does not have a visible shift. In the z-direction, however, the oscillation of particle 2 experience a greater shift. Particle 2 experience the force of particle 1 such that particle 2 moves larger distance.
%
\begin{figure}
\centering
\includegraphics[width=\linewidth]{images/phase_space_no_interaction_x.pdf}
\caption{Particle trajectory at a given position $x$, without particle interaction. The black dot marks the starting position of each particle.}
\label{fig:phase_nointer_x}
\caption{Phase space plot of two particles in x-direction.}
\label{fig:phase_space_2x}
\end{figure}
\begin{figure}[H]
\centering
\includegraphics[width=\linewidth]{images/phase_space_no_interaction_z.pdf}
\caption{Particle trajectory at a given position $z$, without particle interaction. The black dot marks the starting position of each particle.}
\label{fig:phase_nointer_z}
\end{figure}
\begin{figure}[H]
\centering
\includegraphics[width=\linewidth]{images/phase_space_interaction_x.pdf}
\caption{Particle trajectory at a given position $x$, with particle interaction. The black dot marks the starting position of each particle.}
\label{fig:phase_inter_x}
\end{figure}
\begin{figure}[H]
%
\begin{figure}
\centering
\includegraphics[width=\linewidth]{images/phase_space_interaction_z.pdf}
\caption{Particle trajectory at a given position $z$, with particle interaction. The black dot marks the starting position of each particle.}
\label{fig:phase_inter_z}
\caption{Phase space plot of two particles in z-direction.}
\label{fig:phase_space_2z}
\end{figure}
\begin{figure}[H]
\begin{figure}
\centering
\includegraphics[width=\linewidth]{images/3d_plot.pdf}
\caption{The movement of particles in a Penning trap. Where $p_{1}$ and $p_{2}$ is without interaction, $\hat{p}_{1}$ and $\hat{p}_{2}$ is without interaction.}
\caption{3D plot of particles-}
\label{fig:3d_particles}
\end{figure}
Finally, by subjecting the system to a time-dependent field, making the replacement in \ref{eq:pertubation}, we study the fraction of particles left at different amplitudes $f$. We can see how the different amplitudes lead to loss of particles, at different angular frequencies $\omega_{V}$ in \ref{fig:wide_sweep}. We study frequencies in the range $\omega_{V} \in (0.2, 2.5)$ MHz, with steps of $0.02$ MHz, and find that angular frequencies in the range $(1.0, 2.5)$ is effective in pushing the particles out of the Penning trap.
\begin{figure}
\centering
\includegraphics[width=\linewidth]{images/relative_error.pdf}
\caption{Relative error of RK4 and forward Euler method.}
\label{fig:rel_err}
\end{figure}
We explore the range $\omega_{V} \in (1.0, 1.7)$ MHz closer in figure \ref{fig:narrow_sweep}, and observe a loss of particles for amplitude $f_{1} = 0.1$ in the range $\omega_{V} \in (1.3, 1.5)$, for $f_{2} = 0.4$ in the range $\omega_{V} \in (1.2, 1.6)$, and $f_{3} = 0.7$ in the entire range explored. When we introduce particle interaction, we observe the amplitude with higher value will result in a larger bound for the particle movement, and particles are easily pushed out. When we add particle interaction the angular frequencies, which result in particles being pushed out, are similar as in no interaction. As we see in figure \ref{fig:narrow_sweep_interactions} the particle's behavior, when interactions are added, is disrupted and add to the force resulting in the particle being pushed out of the Penning trap. We see that fewer particles tend to be left in the Penning trap, than without any particle interactions. We also see that the fraction of particles left is more unpredictable with particle interactions.
\begin{figure}[H]
\begin{figure}
\centering
\includegraphics[width=\linewidth]{images/particles_left_wide_sweep.pdf}
\caption{Exploring the behavior of particles, where the amplitude of time-dependent potential $f = [0.1, 0.4, 0.7]$, for angular frequency $\omega_{V} \in (0.2, 2.5)$ MHz.}
\label{fig:wide_sweep}
\end{figure}
\begin{figure}[H]
\centering
\includegraphics[width=\linewidth]{images/particles_left_narrow_sweep.pdf}
\caption{Exploring the behavior of particles, where the amplitude of time-dependent potential $f = [0.1, 0.4, 0.7]$, for angular frequency $\omega_{V} \in (1.1, 1.7)$ MHz.}
\label{fig:narrow_sweep}
\end{figure}
\begin{figure}[H]
\centering
\includegraphics[width=\linewidth]{images/particles_left_narrow_sweep_interactions.pdf}
\caption{Exploring the behavior of particles, where the amplitude of time-dependent potential $f = [0.1, 0.4, 0.7]$, for angular frequency $\omega_{V} \in (1.1, 1.7)$ MHz with particle interactions.}
\label{fig:narrow_sweep_interactions}
\caption{Fraction of particles left in the Penning trap, with a given amplitude $f$.}
\label{fig:particles_left}
\end{figure}
\end{document}

View File

@@ -1,2 +1,3 @@
matplotlib
numpy
seaborn

View File

@@ -30,7 +30,7 @@ endif
.PHONY: clean
all: test_suite main
all: test_suite main frequency_narrow_sweeps_long
# Instrumentation using scorep for parallel analysis
instrument:
@@ -60,5 +60,4 @@ test_suite: test_suite.o $(LIBOBJS) $(CLASSOBJS)
clean:
rm *.o
rm test_suite
rm main
rm test_suite main frequency_narrow_sweeps_long

View File

@@ -1,11 +1,11 @@
/** @file main.cpp
/** @file frequency_narrow_sweeps_long.cpp
*
* @author Cory Alexander Balaton (coryab)
* @author Janita Ovidie Sandtrøen Willumsen (janitaws)
*
* @version 1.0
*
* @brief The main program for this project
* @brief Sweep of the frequencies from 1.1 to 1.7 using a small time step
*
* @bug No known bugs
* */

View File

@@ -1,3 +1,14 @@
## @file animate_100_particles.py
#
# @author Cory Alexander Balaton (coryab)
# @author Janita Ovidie Sandtrøen Willumsen (janitaws)
#
# @version 1.0
#
# @brief Animate 100 particles.
#
# @bug No known bugs
import matplotlib.pyplot as plt
import numpy as np
from matplotlib import animation

View File

@@ -1,3 +1,15 @@
## @file plot_2_particles.py
#
# @author Cory Alexander Balaton (coryab)
# @author Janita Ovidie Sandtrøen Willumsen (janitaws)
#
# @version 1.0
#
# @brief Plot 2 particles with and without particle interactions in the
# xy-plane.
#
# @bug No known bugs
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns

View File

@@ -1,3 +1,14 @@
## @file plot_3d.py
#
# @author Cory Alexander Balaton (coryab)
# @author Janita Ovidie Sandtrøen Willumsen (janitaws)
#
# @version 1.0
#
# @brief Plot 2 particles with and without particle interactions in 3D.
#
# @bug No known bugs
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns

View File

@@ -1,3 +1,15 @@
## @file plot_particles_left.py
#
# @author Cory Alexander Balaton (coryab)
# @author Janita Ovidie Sandtrøen Willumsen (janitaws)
#
# @version 1.0
#
# @brief Plot how many particles are left after 500 microseconds using
# different angular frequencies.
#
# @bug No known bugs
import matplotlib.pyplot as plt
import seaborn as sns

View File

@@ -1,3 +1,15 @@
## @file plot_phase_space.py
#
# @author Cory Alexander Balaton (coryab)
# @author Janita Ovidie Sandtrøen Willumsen (janitaws)
#
# @version 1.0
#
# @brief Plot the phase space for 2 particles in the x and z direction, with
# and without particle interactions.
#
# @bug No known bugs
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns

View File

@@ -1,3 +1,14 @@
## @file plot_relative_error.py
#
# @author Cory Alexander Balaton (coryab)
# @author Janita Ovidie Sandtrøen Willumsen (janitaws)
#
# @version 1.0
#
# @brief Plot the relative error for forward Euler and RK4 method.
#
# @bug No known bugs
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns

View File

@@ -1,3 +1,15 @@
## @file plot_single_particle.py
#
# @author Cory Alexander Balaton (coryab)
# @author Janita Ovidie Sandtrøen Willumsen (janitaws)
#
# @version 1.0
#
# @brief Plot the approximation and analytical solution for one particle
# in the z axis.
#
# @bug No known bugs
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
@@ -23,14 +35,6 @@ def z(t):
return 20.*np.cos(w_z*t)
def main():
colors = [
"lightskyblue",
"deepskyblue",
"salmon",
"tomato",
"mediumaquamarine",
"mediumseagreen"
]
filename = "output/simulate_single_particle/particle_0_r.txt"
r = t = []
with open(filename) as f: