<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>tinowagner.com // Blog &#187; Physik</title>
	<atom:link href="http://blog.tinowagner.com/category/physik/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.tinowagner.com</link>
	<description>Dies und das.</description>
	<lastBuildDate>Wed, 25 Nov 2009 00:44:06 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>750 frames of chaos</title>
		<link>http://blog.tinowagner.com/2009/11/25/750-frames-of-chaos/</link>
		<comments>http://blog.tinowagner.com/2009/11/25/750-frames-of-chaos/#comments</comments>
		<pubDate>Wed, 25 Nov 2009 00:44:06 +0000</pubDate>
		<dc:creator>Tino Wagner</dc:creator>
				<category><![CDATA[Bilder]]></category>
		<category><![CDATA[Physik]]></category>
		<category><![CDATA[Programmieren]]></category>

		<guid isPermaLink="false">http://blog.tinowagner.com/?p=76</guid>
		<description><![CDATA[Here&#8217;s a video my graphics card has just finished. It&#8217;s a travel lasting 750 frames from a friction coefficent of 0.05 to 1.0 and my &#8222;standard&#8220; setting of three magnets below the pendulum&#8217;s body (see here and here for more information).

]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a video my graphics card has just finished. It&#8217;s a travel lasting 750 frames from a friction coefficent of 0.05 to 1.0 and my &bdquo;standard&ldquo; setting of three magnets below the pendulum&#8217;s body (see <a href="http://blog.tinowagner.com/2009/11/23/magnetic-pendulum-the-opencl-way/">here</a> and <a href="http://blog.tinowagner.com/2009/07/13/das-magnetpendel/">here</a> for more information).</p>
<p><object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/I11gxf3IIb0&#038;hl=de_DE&#038;fs=1&#038;"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/I11gxf3IIb0&#038;hl=de_DE&#038;fs=1&#038;" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.tinowagner.com/2009/11/25/750-frames-of-chaos/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Magnetic pendulum, the OpenCL way.</title>
		<link>http://blog.tinowagner.com/2009/11/23/magnetic-pendulum-the-opencl-way/</link>
		<comments>http://blog.tinowagner.com/2009/11/23/magnetic-pendulum-the-opencl-way/#comments</comments>
		<pubDate>Mon, 23 Nov 2009 18:48:21 +0000</pubDate>
		<dc:creator>Tino Wagner</dc:creator>
				<category><![CDATA[Allgemein]]></category>
		<category><![CDATA[Physik]]></category>
		<category><![CDATA[Programmieren]]></category>
		<category><![CDATA[magnetic pendulum]]></category>
		<category><![CDATA[Magnetpendel]]></category>
		<category><![CDATA[OpenCL]]></category>

		<guid isPermaLink="false">http://blog.tinowagner.com/?p=70</guid>
		<description><![CDATA[For the last couple of days I did some effort on porting my Python implementation of a magnetic pendulum (German post here, the slides include lots of pictures) to OpenCL. It&#8217;s really cool to leverage GPU power for your own benefit.
If you&#8217;d like to see code rather than words, you should come around at my [...]]]></description>
			<content:encoded><![CDATA[<p>For the last couple of days I did some effort on porting my Python implementation of a <a href="http://www.inf.ethz.ch/personal/muellren/pendulum/index.html">magnetic pendulum</a> (German post <a href="http://blog.tinowagner.com/2009/07/13/das-magnetpendel/">here</a>, the <a href="http://tinowagner.com/projekte/magnetic_pendulum/vortrag_short-web.pdf">slides</a> include lots of pictures) to <a href="http://en.wikipedia.org/wiki/OpenCL">OpenCL</a>. It&#8217;s really cool to leverage <span class="caps">GPU</span> power for your own benefit.</p>
<p>If you&#8217;d like to see code rather than words, you should <a href="http://github.com/tuxu/magnetic_pendulum">come around at my Git repository</a>. Just to quote from the <a href="http://github.com/tuxu/magnetic_pendulum/blob/master/README">README</a> file:</p>
<blockquote><p>
This is an implementation of a magnetic pendulum in OpenCL. A spherical pendulum is influenced by magnets. For every point of origin the program finds the magnet the pendulum&#8217;s body will be nearest when it comes to rest (friction is taken into account). It will create an image, where every pixel (points in the <img src="http://blog.tinowagner.com/wp-content/cache/tex_1ed346930917426bc46d41e22cc525ec.png" align="absmiddle" class="tex" alt="\phi" />-<img src="http://blog.tinowagner.com/wp-content/cache/tex_2554a2bb846cffd697389e5dc8912759.png" align="absmiddle" class="tex" alt="\theta" />-plane) is mapped to a color representing each magnet.</p>
<p>The problem is ideally suited for parallel computing as every initial condition can be solved independently from the others. I did a Python version some time ago that utilized Scipy. Although it was quite optimized with C code, it performed very bad. To create a map of 1600&#215;1600 pixels, it took about 2700 minutes! Leveraging the power hidden in GPUs, I wanted to know what speed-up would be reached.</p>
<p>The code works quite good so far. I began coding a <span class="caps">CPU</span> version in C that is a lot faster than the original Python version, but even my decent <span class="caps">GPU</span> outperforms that by a factor of ten. The map from above can now be done in 284 seconds. That is seconds, not minutes! <img src='http://blog.tinowagner.com/wp-content/plugins/smilies-themer/Silk/emoticon_smile.png' alt=':-)' class='wp-smiley' /> </p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://blog.tinowagner.com/2009/11/23/magnetic-pendulum-the-opencl-way/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Das Magnetpendel</title>
		<link>http://blog.tinowagner.com/2009/07/13/das-magnetpendel/</link>
		<comments>http://blog.tinowagner.com/2009/07/13/das-magnetpendel/#comments</comments>
		<pubDate>Mon, 13 Jul 2009 18:08:18 +0000</pubDate>
		<dc:creator>Tino Wagner</dc:creator>
				<category><![CDATA[Physik]]></category>
		<category><![CDATA[Programmieren]]></category>
		<category><![CDATA[Magnetpendel]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://blog.tinowagner.com/?p=50</guid>
		<description><![CDATA[Als Projektarbeit f&#252;r Computational Physics habe ich ein Magnetpendel programmiert. Geschrieben in Python mit wxWidgets und Pyglet, parallelisiert mit IPython.

Pr&#228;sentation des Projekts: PDF (Kurzfassung, 1 MB), PDF (Langfassung mit weiteren Fraktalen, 14 MB)
Dokumentation: hier
Quelltext


]]></description>
			<content:encoded><![CDATA[<a rel="lightbox" href="http://tinowagner.com/projekte/magnetic_pendulum/screen.jpg"><img title="Screenshot des Magnetpendels" src="http://tinowagner.com/projekte/magnetic_pendulum/screen.jpg" alt="Screenshot des Magnetpendels" width="400" height="248" /></a>
<a rel="lightbox" href="http://tinowagner.com/projekte/magnetic_pendulum/map.png"><img title="Beispiel f&#252;r eine berechnete Karte" src="http://tinowagner.com/projekte/magnetic_pendulum/map.png" alt="Beispiel f&#252;r eine berechnete Karte" width="200" height="200" /></a>
<p>Als Projektarbeit f&#252;r <a title="Computational Physics" href="http://www.comp-phys.tu-dresden.de/cp2009/">Computational Physics</a> habe ich ein <a title="Magnetpendel" href="http://de.wikipedia.org/wiki/Magnetpendel">Magnetpendel</a> programmiert. Geschrieben in Python mit wxWidgets und <a href="http://pyglet.org/">Pyglet</a>, parallelisiert mit <a title="IPython" href="http://ipython.scipy.org/doc/stable/html/parallel/index.html">IPython</a>.</p>
<ul>
<li>Pr&#228;sentation des Projekts: <a title="Kurzfassung" href="http://tinowagner.com/projekte/magnetic_pendulum/vortrag_short-web.pdf">PDF</a> (Kurzfassung, 1 MB), <a title="Langfassung" href="http://tinowagner.com/projekte/magnetic_pendulum/vortrag.pdf">PDF</a> (Langfassung mit weiteren Fraktalen, 14 MB)</li>
<li>Dokumentation: <a href="http://tinowagner.com/projekte/magnetic_pendulum/docs/">hier</a></li>
<li><a title="Quelltext" href="http://tinowagner.com/projekte/magnetic_pendulum/magnetic_pendulum-src.zip">Quelltext</a></li>
<p>
</ul></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.tinowagner.com/2009/07/13/das-magnetpendel/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>M&#246;ge es doppel-pendeln!</title>
		<link>http://blog.tinowagner.com/2008/04/02/doppelpendel/</link>
		<comments>http://blog.tinowagner.com/2008/04/02/doppelpendel/#comments</comments>
		<pubDate>Wed, 02 Apr 2008 21:24:04 +0000</pubDate>
		<dc:creator>Tino Wagner</dc:creator>
				<category><![CDATA[Physik]]></category>
		<category><![CDATA[Programmieren]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[ODE]]></category>
		<category><![CDATA[Pendel]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://blog.tinowagner.com/?p=36</guid>
		<description><![CDATA[Die Semesterferien neigen sich dem Ende zu, und nach all der Pr&#252;fungszeit wollte ich mal wieder was programmieren. Doch was? Nun, ich glaube ein Physikstudent sollte zumindest einmal in seinem Leben eine Simulation eines Doppelpendels programmieren  Es ist nicht nur sch&#246;n anzusehen, sondern auch als wohl einfachstes chaotisches System ein physikalisch interessanter Fall.
Die Herleitung [...]]]></description>
			<content:encoded><![CDATA[<p>Die Semesterferien neigen sich dem Ende zu, und nach all der Pr&#252;fungszeit wollte ich mal wieder was programmieren. Doch was? Nun, ich glaube ein Physikstudent sollte zumindest einmal in seinem Leben eine <em>Simulation eines Doppelpendels</em> programmieren <img src='http://blog.tinowagner.com/wp-content/plugins/smilies-themer/Silk/emoticon_wink.png' alt=';)' class='wp-smiley' /> Es ist nicht nur sch&#246;n anzusehen, sondern auch als wohl einfachstes <a href="http://de.wikipedia.org/wiki/Chaos">chaotisches System</a> ein physikalisch interessanter Fall.</p>
<p>Die Herleitung der Bewegungsgleichungen ist dank zwei Semestern theoretischer Physik und <a href="http://de.wikipedia.org/wiki/Lagrange-Formalismus">Lagrange II</a> nicht schwer, wird aber auch bei <a href="http://scienceworld.wolfram.com/physics/DoublePendulum.html">Eric Weisstein&#8217;s World Of Physics</a> sehr sch&#246;n beschrieben. </p>
<p>Die dort hergeleiteten Gleichungen sind</p>
<p><img src="http://blog.tinowagner.com/wp-content/cache/tex_4c0b069366cd66db675f5ef26ccc5f13.png" align="absmiddle" class="tex" alt="M l_1 \ddot \phi_1 + m_2 l_2 \ddot \phi_2 \cos (\phi_1 - \phi_2) + m_2 l_2 \dot \phi^2_2 \sin (\phi_1 - \phi_2) + M g \sin \phi_1 = 0" /></p>
<p><img src="http://blog.tinowagner.com/wp-content/cache/tex_b82ee2f519fdc535351739816840e1d5.png" align="absmiddle" class="tex" alt="m_2 l_2 \ddot \phi_2 + m_2 l_1 \ddot \phi_1 \cos (\phi_1 - \phi_2) - m_2 l_1 \dot \phi^2_1 \sin (\phi_1 - \phi_2) + m_2 g \sin \phi_2 = 0" /></p>
<p>mit <img src="http://blog.tinowagner.com/wp-content/cache/tex_48d58b8640f6c04b8315fe838e2d51bb.png" align="absmiddle" class="tex" alt="M = m_1 + m_2" />  als Gesamtmasse.</p>
<p>Bleibt noch das Problem sie zu l&#246;sen. Analytisch ist das aber ohne N&#228;herung nicht m&#246;glich. (Schon das einfache Fadenpendel l&#228;&#223;t sich analytisch nur f&#252;r kleine Winkel exakt l&#246;sen!)</p>
<p>Also numerisch.</p>
<p>Angefangen mit <a href="http://www.python.org/">Python</a> und dem Rechenpaket <a href="http://scipy.org/">SciPy</a> habe ich also ein Einfach- und ein Doppelpendel nebeneinander aufgeh&#228;ngt. (F&#252;r die Grafkausgabe OpenGL und <a href="http://www,pyglet.org/">Pyglet</a>)</p>
<p>Das gekoppelte Differentialgleichungssystem 2. Ordnung mu&#223; man hierbei zur numerischen L&#246;sung in ein Differentialgleichungssystem 1. Ordnung umformen, damit die Integrationsroutinen aus SciPy anwendbar sind. Aber das ist zum Gl&#252;ck immer m&#246;glich.</p>
<p>Weil es aber langweilig ist, eine fertige Funktion zu nutzen, habe ich auch diese Routinen noch umgesetzt. Genauer gesagt drei verschiedene: das <a href="http://de.wikipedia.org/wiki/Explizites_Euler-Verfahren">Euler-Verfahren</a>, das <a href="http://de.wikipedia.org/wiki/Klassisches_Runge-Kutta-Verfahren">klassische Runge-Kutta-Verfahren</a> mit fester Schrittweite und das Runge-Kutta-Verfahren nach <a href="http://en.wikipedia.org/wiki/Dormand-Prince">Dormand und Prince</a> mit einer sich anpassenden Schrittweite, wie es in <a href="http://www.nrbook.com/">Numerical Recipes</a> beschrieben ist.</p>
<p><a href="http://www.tinowagner.com/projekte/double_pendulum-r25.zip"><img class="alignnone size-medium wp-image-37 image" title="Doppelpendelsimulation mit Python" src="http://blog.tinowagner.com/wp-content/uploads/double_pendulum.png" alt="Doppelpendel" /></a></p>
<p>Lange Rede, kurzer Sinn. Den Python-Code gibt&#8217;s hier: <a href="http://www.tinowagner.com/projekte/double_pendulum-r25.zip">klick</a>. Ausf&#252;hren mit &bdquo;python -O simulation.py&ldquo;.</p>
<p>Zur Ausf&#252;hrung wird, wie gesagt, weiterhin das Modul <a href="http://pyglet.org/download.html">Pyglet</a> ben&#246;tigt. In <em>ode.py</em> findet sich die Implementation der <a title="ODE" href="http://de.wikipedia.org/wiki/Gew&#246;hnliche_Differentialgleichung">ODE</a>-Integrationsroutinen. Um die Pendelparameter zu &#228;ndern, liefere ich eine einfaches und schnell zusammengeschustertes Widget-Toolkit mit, das das Unterfenster erzeugt.</p>
<p><a href="http://www.tinowagner.com/projekte/jpendulum/webstart/launch.jnlp"><img class="aligncenter size-full wp-image-38 image" title="Doppelpendelsimulation mit Java" src="http://blog.tinowagner.com/wp-content/uploads/jpendulum.png" alt="" /></a></p>
<p>Da ich aber auch mal wieder was mit Java machen wollte, habe ich das Doppelpendel noch mit Java, <a href="http://www.netbeans.org/">NetBeans</a> und <a href="https://jogl.dev.java.net/">JOGL</a> (OpenGL-Binding f&#252;r Java) umgesetzt. &bdquo;umgesetzt&ldquo; hei&#223;t hierbei, da&#223; ich den Code nahezu 1:1 von meinem urspr&#252;nglichen Python-Code &#252;bersetzt habe. Die Java-Simulation l&#228;uft etwas schneller und dank Java Web Start kann ich hier auch einen <a href="http://www.tinowagner.com/projekte/jpendulum/webstart/launch.jnlp">Link bieten, um sich das ganze sofort anzuschauen</a>.</p>
<p>Den Quelltext gibt&#8217;s nat&#252;rlich <a href="http://www.tinowagner.com/projekte/jpendulum/jpendulum-r21.zip">auch</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.tinowagner.com/2008/04/02/doppelpendel/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>
