<?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>Brooks Moses: Notes on Divergent Simulations</title>
	<atom:link href="http://notes.dpdx.net/feed/" rel="self" type="application/rss+xml" />
	<link>http://notes.dpdx.net</link>
	<description>Fluid Dynamics, Computer Simulations, and Assorted Tinkering</description>
	<lastBuildDate>Tue, 06 May 2008 05:23:44 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>An interesting little phenomenon</title>
		<link>http://notes.dpdx.net/2008/04/10/an-interesting-little-phenomenon/</link>
		<comments>http://notes.dpdx.net/2008/04/10/an-interesting-little-phenomenon/#comments</comments>
		<pubDate>Thu, 10 Apr 2008 21:48:27 +0000</pubDate>
		<dc:creator>Brooks</dc:creator>
				<category><![CDATA[Programming and People]]></category>

		<guid isPermaLink="false">http://notes.dpdx.net/2008/04/10/an-interesting-little-phenomenon/</guid>
		<description><![CDATA[So, earlier today, Jeff Atwood wrote a rather interesting post about people who aren&#8217;t willing to pay money for software.  And in there, he made this comment:
It&#8217;s tempting to ascribe this to the &#8220;cult of no-pay&#8221;, programmers and users who simply won&#8217;t pay for software no matter how good it is, or how inexpensive [...]]]></description>
			<content:encoded><![CDATA[<p>So, earlier today, <a href="http://www.codinghorror.com/blog/">Jeff Atwood</a> wrote a rather interesting <a href="http://www.codinghorror.com/blog/archives/001097.html">post about people who aren&#8217;t willing to pay money for software</a>.  And in there, he made this comment:<br />
<blockquote>It&#8217;s tempting to ascribe this to the &#8220;cult of no-pay&#8221;, programmers and users who simply <b>won&#8217;t pay for software</b> no matter how good it is, or how inexpensive it may be. These people used to be called <i>pirates</i>. Now they&#8217;re <i>open source enthusiasts</i>.</p></blockquote>
<p>And there&#8217;s been the predictable outcry of <a href="http://avinashv.net/2008/04/so-im-a-software-pirate/">blog</a> <a href="http://perlbuzz.com/2008/04/open-source-is-not-piracy.html">posts</a> reading that as saying that open source enthusiasts are pirates, and saying things like <a href="http://perlbuzz.com/2008/04/open-source-is-not-piracy.html">this</a>:<br />
<blockquote>Jeff Atwood&#8217;s blog Coding Horror is one of my favorites. Until yesterday, I&#8217;d been recommending it unreservedly. Jeff&#8217;s made a big stumble, and I hope he corrects it soon&#8230;.</p></blockquote>
<p>Right.  First off, anyone who&#8217;s read Jeff&#8217;s blog and is halfway observant knows a couple of things about him.  He&#8217;s intelligent, and he&#8217;s outspoken about his opinions.  If he wanted to say that open-source enthusiasts were the same as pirates, he would come right out and say it, and give you several paragraphs of reasons why he thought that.  He wouldn&#8217;t just imply it in a throwaway sentence like that.  So it ought to be obvious to any reasonable reader that that&#8217;s not what he intended, regardless of how he worded it.</p>
<p>More than that, though, I find the reaction of &#8220;I can no longer unreservedly recommend this blog&#8221; to be quite interesting.  Suppose that Jeff <i>did</i> intend to say that open-source enthusiasts were pirates?  I don&#8217;t agree with that, obviously, but so what?  I don&#8217;t think I&#8217;ve ever read a blog that I completely agree with; that&#8217;s what makes conversation worthwhile, and if he has a good argument to back it up, it&#8217;s probably worth reading even if I think it&#8217;s erroneous.  To me, what makes a blog worth recommending is when it presents intelligent arguments based on reasonable facts, in a way that I find interesting and thought-provoking and on subjects that I think are worth reading about.  Making a &#8220;stumble&#8221; doesn&#8217;t change any of that.</p>
]]></content:encoded>
			<wfw:commentRss>http://notes.dpdx.net/2008/04/10/an-interesting-little-phenomenon/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Daylight Saving Time updates for Windows 2000 and 98</title>
		<link>http://notes.dpdx.net/2007/03/14/daylight-saving-time-updates-for-windows-2000-and-98/</link>
		<comments>http://notes.dpdx.net/2007/03/14/daylight-saving-time-updates-for-windows-2000-and-98/#comments</comments>
		<pubDate>Thu, 15 Mar 2007 05:37:53 +0000</pubDate>
		<dc:creator>Brooks</dc:creator>
				<category><![CDATA[Assorted Tinkering]]></category>

		<guid isPermaLink="false">http://notes.dpdx.net/2007/03/14/daylight-saving-time-updates-for-windows-2000-and-98/</guid>
		<description><![CDATA[I just found out today, when I turned my laptop on, that Microsoft&#8217;s &#8220;Windows Update&#8221; updates for Windows 2000 do not include a fix to make it compatible with the new version of Daylight Saving Time.  (And, yes, apparently &#8220;Saving&#8221; is correct and &#8220;Savings&#8221; incorrect.  I didn&#8217;t know that before.)  Apparently since [...]]]></description>
			<content:encoded><![CDATA[<p>I just found out today, when I turned my laptop on, that Microsoft&#8217;s &#8220;Windows Update&#8221; updates for Windows 2000 do not include a fix to make it compatible with the new version of Daylight Saving Time.  (And, yes, apparently &#8220;Saving&#8221; is correct and &#8220;Savings&#8221; incorrect.  I didn&#8217;t know that before.)  Apparently since it&#8217;s not a security issue, they feel no need to actually do anything much about it.</p>
<p>There are, however, solutions.  First, there&#8217;s the <a href="http://support.microsoft.com/kb/914387">semi-official Microsoft solution</a>, which involves some really hairy poking around in the system registry.  (And, by &#8220;really hairy&#8221;, I mean that it looks signficantly more so than poking around in the system registry usually is.)</p>
<p>There&#8217;s also a handy little freeware utility that does those changes for you automatically, created by the fellow who runs IntelliAdmin.com.  His blog post describing it is <a href="http://www.intelliadmin.com/blog/2007/01/unofficial-windows-2000-daylight.html">here</a>, and the actual download is <a href="http://www.intelliadmin.com/DaylightSavingFix.exe">here</a>.  I tried it out, and as far as I can tell it worked perfectly (aside from not actually closing the window when done).  He suggests setting your clock ahead to November to watch the time flip over to see if it worked, but it&#8217;s easier just to go into the &#8220;Time&#8221; control panel that you get from right-clicking on the clock and selecting &#8220;Adjust Date/Time&#8221;, and looking at the &#8220;Time Zone&#8221; panel to make sure it says &#8220;Pacific Daylight Time&#8221; (or whatever) rather than &#8220;Pacific Standard Time&#8221; for the time zone.</p>
<p>For those of you still running Windows 98, he also wrote a fix for that, even though there isn&#8217;t an official Microsoft solution at all.  The blog post about that one is <a href="http://www.intelliadmin.com/blog/2007/02/windows-98-me-dst-patch.html">here</a>, and the download is <a href="http://www.intelliadmin.com/DaylightSavingFix98.exe">here</a>.</p>
<p>It&#8217;s an interesting observation on advertising, too.  It probably took him a day or so to code up this program and test it, and he&#8217;s now got a first-page Google hit for people looking for a solution to one of the bigger problems of the month &#8212; and people like me are passing around links to his blog, too.  You just can&#8217;t buy advertising that good.</p>
<p>(The <a href="http://www.intelliadmin.com/blog/default.htm">rest of his blog</a> looks fairly interesting, too, if you&#8217;re doing Windows administration.  <a href="http://www.intelliadmin.com/blog/2007/02/create-date-and-time-stamp-in-your_15.html">This little trick for automatically putting the current date in a filename</a> is particularly neat, for instance.)</p>
]]></content:encoded>
			<wfw:commentRss>http://notes.dpdx.net/2007/03/14/daylight-saving-time-updates-for-windows-2000-and-98/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Time synchronization in a VMWare box running GNU/Linux</title>
		<link>http://notes.dpdx.net/2007/03/07/time-synchronization-in-a-vmware-box-running-gnulinux/</link>
		<comments>http://notes.dpdx.net/2007/03/07/time-synchronization-in-a-vmware-box-running-gnulinux/#comments</comments>
		<pubDate>Wed, 07 Mar 2007 09:11:48 +0000</pubDate>
		<dc:creator>Brooks</dc:creator>
				<category><![CDATA[Assorted Tinkering]]></category>

		<guid isPermaLink="false">http://notes.dpdx.net/2007/03/07/time-synchronization-in-a-vmware-box-running-gnulinux/</guid>
		<description><![CDATA[For a lot of the GCC and GNU Fortran development work that I&#8217;m doing, it&#8217;s much more convenient to work on a GNU/Linux box &#8212; the compilation process is set up in a way that is rather slow on Windows (even under Cygwin), and so testing changes is much quicker under Linux.  On the [...]]]></description>
			<content:encoded><![CDATA[<p>For a lot of the GCC and GNU Fortran development work that I&#8217;m doing, it&#8217;s much more convenient to work on a GNU/Linux box &#8212; the compilation process is set up in a way that is rather slow on Windows (even under Cygwin), and so testing changes is much quicker under Linux.  On the other hand, my main computer runs Windows, and I don&#8217;t want to be running two computers all the time, much less be rebooting all the time.  Thus, I&#8217;m running a GNU/Linux installation &#8212; Debian stable, to be precise &#8212; in a VMWare virtual machine.  I can access the files on it via Samba and Windows file sharing almost as easily as files directly on my disk, and PuTTY is one of the nicest terminal windows I&#8217;ve used, and it generally is quite a nice way to do things.</p>
<p>One particularly nice feature is that, since all of the GNU/Linux stuff is operating in a single process on the Windows side, it&#8217;s easy to set the whole thing to a priority of BelowNormal, and thus even when I&#8217;ve got a compilation running and taking up as much CPU as it can hog, it doesn&#8217;t slow down anything else I&#8217;m doing at all.  And it turns out that there&#8217;s enough slack in the system that this doesn&#8217;t give it any noticable lag in the terminals, even.</p>
<p>The one problem with that is that it completely confuses the software clock on the operating system in the virtual machine, though.  When I&#8217;ve been using the CPU heavily on the Windows side of things, I&#8217;ve seen the GNU/Linux time lose 10 minutes out of 15!  VMWare does a nice job of keeping the hardware clock up-to-date, but Debian is set up so that everything depends on the software clock, which only gets synchronized to the hardware clock on bootup.  It&#8217;s not a critical problem, really, but it&#8217;s somewhat annoying to have to remember that a file date of three days ago (or whatever) means &#8220;a minute ago&#8221;.</p>
<p>The right solution to this is not <tt>ntpdate</tt> or some other NTP solution.  The Windows clock is already synchronized over the network, and the VMWare virtual hardware clock is synchronized to that (I presume), and so there&#8217;s no need for adding extra traffic to the network.  (Especially since it&#8217;s dialup, and disconnected from the internet and any NTP servers half the time.) Nor is the solution something like <tt>adjtimex</tt>, which tweaks the speed of the software clock; the time skew is a function of Windows-side computer load, and thus quite random, and a static speed tweak is not much of an improvement.</p>
<p>Instead, a better solution is <tt>hwclock --hctosys</tt>, which synchronizes the software clock to the hardware clock.  Because the skew is quite large and needs correction quite often (and because <tt>cron</tt> is using the skewed software clock for timing, and thus loses time), I added the following to my root crontab:<br />
<code><br />
* * * * * /sbin/hwclock --hctosys<br />
</code></p>
<p>So far, it seems to be working beautifully.</p>
]]></content:encoded>
			<wfw:commentRss>http://notes.dpdx.net/2007/03/07/time-synchronization-in-a-vmware-box-running-gnulinux/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>listings 1.4</title>
		<link>http://notes.dpdx.net/2007/02/27/listings-14/</link>
		<comments>http://notes.dpdx.net/2007/02/27/listings-14/#comments</comments>
		<pubDate>Tue, 27 Feb 2007 09:16:32 +0000</pubDate>
		<dc:creator>Brooks</dc:creator>
				<category><![CDATA[Tex, LaTeX, and ConTeXt]]></category>

		<guid isPermaLink="false">http://notes.dpdx.net/2007/02/27/listings-14/</guid>
		<description><![CDATA[I sent off the tarfile for the listings 1.4 distribution to CTAN this afternoon.  It should be posted to the official mirrors within the next day or two.
This marks the first significant bugfix release in nearly three years; I took over the official maintenance of this package early last year, after the previous maintainer [...]]]></description>
			<content:encoded><![CDATA[<p>I sent off the tarfile for the <a href="http://www.ctan.org/tex-archive/macros/latex/contrib/listings">listings</a> 1.4 distribution to <a href="http://www.ctan.org/">CTAN</a> this afternoon.  It should be posted to the official mirrors within the next day or two.</p>
<p>This marks the first significant bugfix release in nearly three years; I took over the official maintenance of this package early last year, after the previous maintainer simply disappeared.  It feels good to have this back in the realm of actively-maintained packages again, even if I am a little slow about replying to bug reports sometimes.</p>
<p>Also, although this doesn&#8217;t show in the release, I was for a few hours this afternoon completely caught up on listings-related email.  (I got another bug report this evening, though.)  One of the perks of having one&#8217;s email address at the top of the documentation is that one gets a lot of questions as well as things that are truly bugs in the package; cases where someone wants to do something like highlighting parentheses and brackets and numbers, which the package doesn&#8217;t directly support, and so I spend 15 minutes or so hacking up a workaround for them.  Sometimes these questions result in new functionality, too &#8212; the old versions assumed that if <tt>\chapter</tt> was defined, the user wanted the listing-number counter to reset at each chapter, and the only way I could find to change that on the user side was to temporarily undefine <tt>\chapter</tt> around the \usepackage{listings} macro.  Now, there&#8217;s a <tt>numberbychapter</tt> key that can be set to &#8220;true&#8221; or &#8220;false&#8221; in the preamble.</p>
<p>This release also has the usual selection of small fixes to handle newly-discovered and newly-created conflicts with other packages, and I particularly want to thank Markus Kohm for his bug reports, which always contain an insightful analysis of whatever is conflicting with his KOMAscript document classes this year, and a small piece of code that I can copy in to make things work right again.</p>
<p>There&#8217;s also a new <tt>\lstMakeShortInline</tt> macro, which defines a character as an equivalent to <tt>\lstinline</tt> with the appropriate user-specified options.  This is a pleasant case of unintended consequences; a couple of years ago, I was corresponding with Frank Mittelbach (of the LaTeX3 project) about some suggestions I had for making the LaTeX Project Public License &#8212; which is essentially the TeX-world equivalent of the GPL, used by nearly everything on CTAN &#8212; more appropriate for cases where one&#8217;s borrowing a bit of code from one project to use in another rather than distributing a slightly-modified version of the original project, and I believe a few of those ideas made it into updated versions of the license.  (At the least, Frank clarified that the intent of the original license allowed that sort of copying, even if the wording was arguably unclear.)  And it turned out today that implementing this bit of functionality was almost trivial to do, because I could copy an equivalent implementation for inline verbatim environments from the LaTeX documentation classes.</p>
<p>This post also wouldn&#8217;t be complete without thanking Carsten Heinz, the original author of the package.  Although the code is deeply arcane and complicated in places, in the way that only a general-purpose parser implemented in TeX could be &#8212; which is not to be confused with the way that a TeX output routine to handle three levels of cross-referential footnotes in scholarly editions of originally-footnoted books can be, and I am glad David Kastrup is writing that piece of code and I am not! &#8212; it has quite a significant amount of documentation, including several chapters on the high-level design and implementation which are almost completely useless to anyone who&#8217;s not working on the internals of the package.  There&#8217;s a line at the beginning of them, saying, &#8220;First I must apologize for this developer&#8217;s guide since some parts are not explained as well as possible. But note that you are in a pretty good shape: this developer&#8217;s guide exists!&#8221;  And every time I read it, I smile, because he&#8217;s right: I am, and it makes a tremendous difference.</p>
]]></content:encoded>
			<wfw:commentRss>http://notes.dpdx.net/2007/02/27/listings-14/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Customer Support Fun with Academic Journals</title>
		<link>http://notes.dpdx.net/2007/01/09/customer-support-fun-with-academic-journals/</link>
		<comments>http://notes.dpdx.net/2007/01/09/customer-support-fun-with-academic-journals/#comments</comments>
		<pubDate>Tue, 09 Jan 2007 09:46:37 +0000</pubDate>
		<dc:creator>Brooks</dc:creator>
				<category><![CDATA[Academia]]></category>

		<guid isPermaLink="false">http://notes.dpdx.net/2007/01/09/customer-support-fun-with-academic-journals/</guid>
		<description><![CDATA[I&#8217;ve been spending most of today catching up on a huge backlog of journal citation alerts and downloading the relevant articles to read before I start writing the &#8220;other work&#8221; section of my dissertation in the next week or two.  So I&#8217;ve been noticing a few things about the websites of various journal publishers.
One [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been spending most of today catching up on a huge backlog of journal citation alerts and downloading the relevant articles to read before I start writing the &#8220;other work&#8221; section of my dissertation in the next week or two.  So I&#8217;ve been noticing a few things about the websites of various journal publishers.</p>
<p>One of the things that I&#8217;ve noticed is how different websites handle feedback from their customers—and, in particular, bug reports (and feature requests).</p>
<p>For example, the <a href="http://scitation.aip.org/pre/help.jsp">American Institute of Physics</a> has direct links to an online &#8220;submit query&#8221; form directly off their help page, and also has a prominently-featured email address—which was quite useful, since I got a server error when I tried to use the online form.  We&#8217;ll see how quickly they reply (if they do; bug reports don&#8217;t really need replies), but in my opinion, that page is pretty much how things should be.  It would be nice if they had an explicit mention of &#8220;bug reports go here&#8221;, but &#8220;Technical Support Query Form&#8221; is close enough.</p>
<p>Contrast this with the <a href="http://www3.interscience.wiley.com/contactus.html">Wiley &#8220;Contact Us&#8221; page</a>, which I&#8217;ve been dealing with for the past fifteen minutes or so.  Why have I been dealing with it for fifteen minutes, for what started out as a trivial feature request?  Well, first off, at the bottom of the <a href="http://interscience.custhelp.com/cgi-bin/interscience.cfg/php/enduser/std_adp.php?p_faqid=3648">How To Contact Customer Support</a> page (yes, that&#8217;s a different page, which you get to by clicking a link on the &#8220;Contact Us&#8221; page), it says, &#8220;We regret that Wiley InterScience Customer Support does not accept queries by email.&#8221;  That, of course, means that the only option to actually say anything to them is through their web system, regardless of whether or not it happens to be broken.</p>
<p>So, consider the web form.  That &#8220;Contact Us&#8221; page has a couple of links to customer support: one labeled &#8220;Online Customer Support&#8221; promising FAQs and so forth, and one labeled &#8220;Contact Customer Support&#8221; and noting that one should use it if &#8220;unable to log in&#8221;.  Despite the appearance of being different things, they both go to the same page, which is a <a href="http://www3.interscience.wiley.com/cgi-bin/rightnow">login form</a>, with a place to register an account in the fine print at the bottom.  Now, I don&#8217;t have a personal account here, since I&#8217;m using a university site license for the content, so it looks like they&#8217;re asking me to go through the whole process of creating an account on the site <em>just to file a simple bug report</em>.</p>
<p>Eventually I noticed, down at the fine print on the bottom of that page, the link for &#8220;if you don&#8217;t want to register, click here&#8221;.  Good.  No, I don&#8217;t want to register; I want to file a bug report and be done with that.</p>
<p>That gets me to the main customer service web page, which then has a link to &#8220;Ask A Question&#8221;.  It does not have a link to &#8220;File a Bug Report&#8221;, or to &#8220;Make a Feature Request&#8221;, or to anything at all which would be an appropriate phrasing for any problem that would require them to do anything whatsoever about it, but that sort of implicit assumption that it&#8217;s the customer&#8217;s problem seems to be the style these days, so I dutifully clicked on the &#8220;Ask A Question&#8221; link, and got presented with a web form.</p>
<p>This web form has a fair bit of clever Javascript to make my life &#8220;easier&#8221;, so that depending on which options I click for my problem, different subcategory boxes appear.  Once I&#8217;ve got them all filled in, a box pops up for me to select my regional location and enter my institution.  (Apparently it&#8217;s a barter system; I have to trade demographic information to them before they&#8217;ll answer my &#8220;question&#8221;.)  Except that this doesn&#8217;t actually work in the version of Opera that I use, so the &#8220;Location&#8221; box never appears, which means that the &#8220;Error: You didn&#8217;t enter a location&#8221; message that I got when I tried to submit the form was really quite cryptic.  And rather hard to work around, too, until I decoded it to &#8220;Error: We don&#8217;t support your browser,&#8221; and tried Mozilla, in which the Javascript works a little better.</p>
<p>Once I entered the question and clicked submit, I still wasn&#8217;t done.  First, there was the little matter that since I hadn&#8217;t registered before, they wanted me to do so now, and were presenting me with the registration form to fill out.  I gave in and gave them a password to associate with my email address and the other information they wanted, and again clicked submit.</p>
<p>And, again, I still wasn&#8217;t done, because that gave me a page along the lines of &#8220;We&#8217;ve selected five answers from our FAQ that our <a href="http://www.google.com/technology/pigeonrank.html">pigeons</a> think may have something to do with your question.  Do any of them answer it?  If not, please scroll down a screen and click the &#8216;No, these don&#8217;t answer my question&#8217; link at the bottom of the page.&#8221;  Of course the FAQ answers don&#8217;t answer my question; it&#8217;s a bug report, and it needs someone on <em>your end</em> to do something about it.  (This is <em>why</em> I am annoyed with customer service websites that phrase things as &#8220;ask a question&#8221; rather than &#8220;contact customer support&#8221;; it seems that it&#8217;s a short jump from there to setting up the whole process as if the only things the site has to deal with are questions.)</p>
<p>At this point, it finally accepted the question, gave me a tracking number, and told me that I should expect a reply in 24 hours.  We shall see.</p>
<p>So, let&#8217;s recap on why this matters (beyond the obvious bug report).  A good-sized chunk of my dissertation is going to get reworked into a journal paper or two, and both AIP and Wiley publish journals that would be good places to submit it.  One publisher&#8217;s customer-service site is a clear, simple, single-page website with a no-javascript online form and a prominently-placed email address.  The other publisher&#8217;s customer service site comes with its own <a href="http://www3.interscience.wiley.com/aboutus/sharedfiles/wis_support_flyer.pdf">650kb(!) user manual in PDF form</a> and makes it a 15-minute complicated web maze to file a trivial bug report.  So, whose paper-submission process would I be likely to want to deal with?</p>
<p><strong>Edited to add:</strong> I got an emailed reply to all three messages to Wiley, within four hours of submitting the questions.  It was polite and clearly from a human being, and made it clear that my initial feature request was noted and relates to things they are currently working on.  It was slightly off-putting that the response to my bug report about the web form was essentially &#8220;We&#8217;ve tested this on all current browser versions, and recommend upgrading your browser&#8221; (rather than something like &#8220;Sorry about that; I&#8217;ll let our web team know, though it may be low-priority for them since it&#8217;s not an up-to-date browser&#8221;), but other than that, the message was responsive and prompt, and seemed to involve at least as much thought and consideration as I&#8217;d put into the messages I&#8217;d sent.  There&#8217;s more to customer service than just the website!</p>
]]></content:encoded>
			<wfw:commentRss>http://notes.dpdx.net/2007/01/09/customer-support-fun-with-academic-journals/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Slides from the 2006 APS fluid dynamics meeting.</title>
		<link>http://notes.dpdx.net/2006/11/21/slides-from-the-2006-aps-fluid-dynamics-meeting/</link>
		<comments>http://notes.dpdx.net/2006/11/21/slides-from-the-2006-aps-fluid-dynamics-meeting/#comments</comments>
		<pubDate>Tue, 21 Nov 2006 22:04:53 +0000</pubDate>
		<dc:creator>Brooks</dc:creator>
				<category><![CDATA[Computational Fluid Dynamics]]></category>
		<category><![CDATA[Dissertation Research]]></category>
		<category><![CDATA[Tex, LaTeX, and ConTeXt]]></category>

		<guid isPermaLink="false">http://notes.dpdx.net/2006/11/21/slides-from-the-2006-aps-fluid-dynamics-meeting/</guid>
		<description><![CDATA[The 2006 annual conference of the American Physical Society&#8217;s Division of Fluid Dynamics just ended a few hours ago, here in Tampa. As usual, I&#8217;ve put the slides from my talk up on dpdx.net/research/papers.  Direct links: abstract, Slides in PDF form, and ConTeXt source for the slides. It&#8217;s a fun conference; unlike most, the [...]]]></description>
			<content:encoded><![CDATA[<p align="left">The 2006 annual conference of the American Physical Society&#8217;s Division of Fluid Dynamics just ended a few hours ago, here in Tampa. As usual, I&#8217;ve put the slides from my talk up on <a href="http://dpdx.net/research/papers">dpdx.net/research/papers</a>.  Direct links: <a href="http://dpdx.net/research/papers/DFD2006_Moses_abstract.html">abstract</a>, <a href="http://dpdx.net/research/papers/DFD2006_Moses_slides.pdf">Slides in PDF form</a>, and <a href="http://dpdx.net/research/papers/DFD2006_Moses_slides.tex">ConTeXt source for the slides</a>. It&#8217;s a fun conference; unlike most, the talks are only ten minutes long, so it&#8217;s pretty easy to hit information overload by the end.</p>
<p align="left">I&#8217;ll post some more about these results once I get home. I&#8217;ve been working pretty hard on this for the last few months, and haven&#8217;t had time to post much about it here, but things should be a bit less hectic soon. My code is finally producing results (luckily just in time for the conference!), and the results are considerably more dramatic than I was expecting &#8212; a pleasant surprise!</p>
<p align="left">
]]></content:encoded>
			<wfw:commentRss>http://notes.dpdx.net/2006/11/21/slides-from-the-2006-aps-fluid-dynamics-meeting/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fortran&#8217;s 50th Birthday</title>
		<link>http://notes.dpdx.net/2006/10/15/fortrans-50th-birthday/</link>
		<comments>http://notes.dpdx.net/2006/10/15/fortrans-50th-birthday/#comments</comments>
		<pubDate>Sun, 15 Oct 2006 18:37:53 +0000</pubDate>
		<dc:creator>Brooks</dc:creator>
				<category><![CDATA[Computer Languages]]></category>

		<guid isPermaLink="false">http://notes.dpdx.net/2006/10/15/fortrans-50th-birthday/</guid>
		<description><![CDATA[IBM&#8217;s very first Fortran manual, Programmer&#8217;s Reference Manual: Fortran Automatic Coding System for the IBM 704, was dated October 15, 1956 &#8212; 50 years ago today.  There are a couple of different scanned copies of it available online; bitsavers.org has one, and fortran.com has an autographed one.
There&#8217;s an old joke that, in a hundred [...]]]></description>
			<content:encoded><![CDATA[<p>IBM&#8217;s very first Fortran manual, <em>Programmer&#8217;s Reference Manual: Fortran Automatic Coding System for the IBM 704</em>, was dated October 15, 1956 &#8212; 50 years ago today.  There are a couple of different scanned copies of it available online; <a href="http://www.bitsavers.org/pdf/ibm/704/">bitsavers.org</a> has one, and <a href="http://www.fortran.com/ibm.html">fortran.com</a> has an autographed one.</p>
<p>There&#8217;s an old joke that, in a hundred years, programmers will be using a language that&#8217;s completely unrecognizable to modern users &#8212; and it will be called &#8220;Fortran&#8221;.  There&#8217;s a lot of truth to that; in the first 50 years since this manual, Fortran has changed a lot.  Among the signficant changes: subroutines, functions, explicit variable typing, character strings, block IF and DO loops, whole-array expressions, array segments, pointers, dynamic arrays, user-defined data types, pure functions, polymorphic data types, function pointers, generic functions, object-oriented capabilites, and (in the upcoming 2008 standard) arrays shared across multiple threads.  Oh, and for those of you who remember the old version: lower-case letters and removal of the &#8220;statements must be in columns 7-72 of the line&#8221; restriction!</p>
]]></content:encoded>
			<wfw:commentRss>http://notes.dpdx.net/2006/10/15/fortrans-50th-birthday/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Penny Smith&#8217;s Proof on the Navier-Stokes Equations</title>
		<link>http://notes.dpdx.net/2006/10/06/penny-smiths-proof-on-the-navier-stokes-equations/</link>
		<comments>http://notes.dpdx.net/2006/10/06/penny-smiths-proof-on-the-navier-stokes-equations/#comments</comments>
		<pubDate>Sat, 07 Oct 2006 05:45:38 +0000</pubDate>
		<dc:creator>Brooks</dc:creator>
				<category><![CDATA[Computational Fluid Dynamics]]></category>

		<guid isPermaLink="false">http://notes.dpdx.net/2006/10/06/penny-smiths-proof-on-the-navier-stokes-equations/</guid>
		<description><![CDATA[This week&#8217;s big news in fluid flow simulation is Penny Smith&#8217;s existence proof for smooth solutions of the Navier-Stokes equations.  (See also this in-depth explanation of the proof, and various other mentions of it here, here, and here.)
(Update: Regrettably, the article has been withdrawn due to a &#8220;serious flaw&#8221;.  The piece described below [...]]]></description>
			<content:encoded><![CDATA[<p>This week&#8217;s big news in fluid flow simulation is <a href="http://arxiv.org/abs/math/0609740">Penny Smith&#8217;s existence proof for smooth solutions of the Navier-Stokes equations</a>.  (See also <a href="http://comet.lehman.cuny.edu/sormani/others/SmithNavierStokes.html">this in-depth explanation of the proof</a>, and various other mentions of it <a href="http://www.math.columbia.edu/~woit/wordpress/?p=470">here</a>, <a href="http://www.metafilter.com/mefi/55295">here</a>, and <a href="http://scienceblogs.com/goodmath/2006/10/navierstokes_another_historic_1.php">here</a>.)</p>
<p>(<strong>Update:</strong> Regrettably, <a href="http://arxiv.org/abs/math/0609740">the article has been withdrawn due to a &#8220;serious flaw&#8221;</a>.  The piece described below is still interesting, however.)</p>
<p>The question that she&#8217;s solving is this: Given an infinite three-dimensional domain with arbitrary initial conditions, does a smooth solution to the Navier-Stokes equations (which are the equations describing the flow of water, air, or other fluids) exist on that domain for all future time?  This problem was considered one of the most important open questions in mathematics by the Clay Institute, who are offering a <a href="http://www.claymath.org/millennium">one million dollar prize for a solution</a>.  It&#8217;s of some physical relevance directly, since if it&#8217;s not true then either there are cases where the Navier-Stokes equations don&#8217;t describe physical reality or else physical reality can behave in surprising ways.  The greater significance, though, is that it and the methods that are used to prove it will be useful in further mathematical understanding of this particularly difficult problem.</p>
<p>Even though this is an existence proof and not a constructive one &#8212; which means that it proves that a solution exists, but does not provide an analytical method for finding one &#8212; there are some interesting construtive portions to the proof.  Specifically, she shows that the solutions to the Navier-Stokes equations can be expressed as the limit of a set of hyperbolic equations.  There is some interesting physical and computational relevance to how that works, which I thought would be interesting to more mathematically-inclined readers.</p>
<p>To start with, the Navier-Stokes equations are differential equations in four variables &#8212; pressure (<em>p</em>) and three directional components of velocity (<em>u<sub>i</sub></em>, for <em>i</em>=1, 2, or 3).  They look like this:</p>
<p><!-- \Large \frac{\partial u_i}{\partial t} + u_k \frac{\partial u_i}{\partial x_k} = - \frac{\partial p}{\partial x_i} + \nu \sum_{k=1}^3 \frac{\partial^2 u_i}{\partial x_k^2} --> <center><img src="http://images.dpdx.net/notes/2006/10/eq1.gif" /></center> <!-- \Large \frac{\partial u_k}{\partial x_k} = 0 --> <center><img src="http://images.dpdx.net/notes/2006/10/eq2.gif" /></center>(Note that, in this notation, each term has an implicit sum over indices that appear twice in the term; thus, the second term in the first equation and the first term in the second equation are implicitly summed over <em>k</em>.  As <em>i</em> appears only once in each term of the first equation, there isn&#8217;t an implicit summation over it, and thus that represents a set of three equations, one for each coordinate direction.)</p>
<p>There are some interesting features of this set of equations.  First, there are four equations and four unknown variables, so it&#8217;s a closed set.  However, if we start matching up variables with equations on a one-to-one basis, we find that the first three equations match up neatly with the three components of velocity, leaving the last for the pressure &#8212; even though it doesn&#8217;t actually have pressure in it (much less a time-derivative of pressure)!</p>
<p>What happens, then, is that at any point in time, the first three equations describe the time derivative of the velocity, as a function only of the local field at the current time (that is, they&#8217;re hyperbolic).  This means that in these equations information travels across the domain at a finite rate, which is a very nice feature computationally; one can compute a solution at each grid point without needing to know the solution everywhere else.  It&#8217;s also handy mathematically.</p>
<p>The fourth equation, though, messes all of this up.  What it says is that the pressure needs to be chosen such that this velocity condition is satisfied everywhere.  Physically speaking, if the velocities would be trying to compress a certain spot, the pressure there gets increased to counteract that, so it doesn&#8217;t compress.  This isn&#8217;t a local constraint, because it&#8217;s the derivative of the pressure that affects the velocities, and so a change in pressure in one place causes immediate changes throughout the whole domain &#8212; essentially, the speed of information transfer is infinite.  In a computational simulation, the vast bulk of the time is usually spent taking care of the pressure.</p>
<p>So, how does Penny Smith&#8217;s analysis approximate this by a set of hyperbolic equations?  There are two parts to that.  The first part is that she needs a set of first-order equations for her analysis, and this contains a second order term.  Fixing that is straightforward, we simply introduce more variables, and a mathematical identity.  The (nine) new variables are the components of a &#8220;viscous stress tensor&#8221;, defined as:</p>
<p><!--  \Large  \Upsilon_{ik} = \frac{\partial u_i}{\partial x_k}  --></p>
<p><center><img src="http://images.dpdx.net/notes/2006/10/eq3.gif" /></center>(That&#8217;s nine equations, one for each combination of <em>i</em> and <em>k</em>).  (Also, for the fluid mechanicians: it&#8217;s not quite the viscous stress tensor, I know; there are terms left out that sum to zero.)  Then, the first three equations can be rewritten as<!--  \Large  \frac{\partial u_i}{\partial t} + u_k \frac{\partial u_i}{\partial x_k}  = - \frac{\partial p}{\partial x_i} + \nu \frac{\partial \Upsilon_{ik}}{\partial x_k}  --></p>
<p><center><img src="http://images.dpdx.net/notes/2006/10/eq4.gif" /></center>This gives a set of thirteen first-order differential equations and thirteen unknowns.Now, for the hyperbolic part.  I&#8217;ll start with the pressure equation, since that&#8217;s the one that has historically been a problem, but in this first-order formulation the stress-tensor equations also are not hyperbolic.   To be a hyperbolic equation, this needs to have a time derivative of pressure in it.  So, suppose we just add one, multiplied by an arbitrary constant (denoted ?):</p>
<p><!--  \Large  \lambda \frac{\partial p}{\partial t} = \frac{\partial u_k}{\partial x_k}  --></p>
<p><center><img src="http://images.dpdx.net/notes/2006/10/eq5.gif" /></center>If ? is zero, this is the same as the initial equation, but if ? is greater than zero, this and the other three initial equations form a hyperbolic set.  Thus, if we take a set of ? values that converge to a limit of zero, we get a set of solutions of hyperbolic equations which converge to a solution of the initial non-hyperbolic equations.It turns out that this has physical significance &#8212; what happens is that, if the velocities are trying to compress a certain spot, the pressure there still goes up, but not immediately, and so things do get compressed but only a limited amount.  This is exactly what happens in &#8220;compressible&#8221; flows, such as air flows at high speed, so it&#8217;s a phsyically meaningful problem.  In effect, there&#8217;s a &#8220;relaxation time&#8221; &#8212; a finite amount of time that it takes for the pressure to respond to a given input; this relaxation time is proportional to ?, and so what we&#8217;ve done is taken an equation with a zero relaxation time and given it a finite nonzero one.</p>
<p>This suggests a rather simple computational method: solve the problem with a small but non-zero value of ?, and thereby obtain a solution that&#8217;s close to the desired one.  This used to be a fairly common method, because hyperbolic problems are relatively easy to solve, and it&#8217;s called &#8220;artificial compressiblity&#8221;.  It works reasonably well in some cases, although as ? gets closer to zero, the rates of information transfer around the domain get faster, and so the equations take more work to solve computationally.  And, of course, if you use a larger ?, the rates of information transfer get slower, and so the solutions aren&#8217;t as close to the real solution.  But it&#8217;s reasonably good for some problems.</p>
<p>Now, in Penny Smith&#8217;s case with everything in first-order equations, there are some additional equations that aren&#8217;t in hyperbolic form, so she does exactly the same thing to those equations, adding a time-derivative term to those as well:</p>
<p><!--  \Large  \lambda \frac{\partial \Upsilon_{ik}{\partial t} + \Upsilon_{ik} = \frac{\partial u_i}{\partial x_k}  --></p>
<p><center><img src="http://images.dpdx.net/notes/2006/10/eq6.gif" /></center>In the computational situation, this isn&#8217;t necessary; the stress tensor can be calculatated from local data and doesn&#8217;t have problems of global dependencies, so there&#8217;s no need to add the nonzero relaxation time to these equations.  However, it&#8217;s important for simplifying the mathematical analysis.  (And it&#8217;s an interesting question whether it might be useful in computations as well; there are some advantages to working with things that are mathematically simpler.)So, that&#8217;s pretty much what&#8217;s going on with that part of the analysis.  From there, the proof then goes off into two additional &#8212; and far more complicated &#8212; parts.  First, there&#8217;s a proof that smooth solutions to these sets of first-order hyperbolic equations exist for all time, given a sufficiently smooth set of starting conditions.  Then, there&#8217;s a reference to a proof from 25 years ago by John Heywood, which showed that smooth solutions to the Navier-Stokes equations exist at least for a finite time, and some analysis that shows that his solutions can be used to provide appropriate starting conditions for the first half of the proof. And, finally, there’s a small bit to tie everything together and show that the fact that the hyperbolic equations have smooth solutions means that their limit is also smooth. QED.</p>
<p><font size="2">(Note: Equations in this article were typeset with <a href="http://notes.dpdx.net/category/uncategorized/">MimeTeX</a>.)</font></p>
]]></content:encoded>
			<wfw:commentRss>http://notes.dpdx.net/2006/10/06/penny-smiths-proof-on-the-navier-stokes-equations/feed/</wfw:commentRss>
		<slash:comments>27</slash:comments>
		</item>
		<item>
		<title>Why can&#8217;t a car engine run on water?</title>
		<link>http://notes.dpdx.net/2006/05/23/why-cant-a-car-engine-run-on-water/</link>
		<comments>http://notes.dpdx.net/2006/05/23/why-cant-a-car-engine-run-on-water/#comments</comments>
		<pubDate>Wed, 24 May 2006 03:12:26 +0000</pubDate>
		<dc:creator>Brooks</dc:creator>
				<category><![CDATA[Thermodynamics]]></category>

		<guid isPermaLink="false">http://notes.dpdx.net/2006/05/23/why-cant-a-car-engine-run-on-water/</guid>
		<description><![CDATA[I recently came across a mention of yet another inventor who supposedly has built a car engine that runs on water.  The claim is in a video which doesn&#8217;t play on my computer, so I don&#8217;t know much for details of what he&#8217;s actually claiming.  But even without watching the video, I can [...]]]></description>
			<content:encoded><![CDATA[<p>I recently came across <a href="http://www.cognitivedissident.com/?p=55">a mention</a> of yet another inventor who supposedly has built a car engine that runs on water.  The claim is in a <a href="http://livedigital.com/content/287275/">video</a> which doesn&#8217;t play on my computer, so I don&#8217;t know much for details of what he&#8217;s actually claiming.  But even without watching the video, I can say with almost absolute certainty that this inventor hasn&#8217;t built a car powered by water.</p>
<p>I&#8217;m sure of this, even though I have no idea how this engine is supposed to work.  Why?  It&#8217;s a matter of applied thermodynamics.</p>
<p>First, imagine that the engine is in a black box.  We can&#8217;t see into the black box, so it could be any possible type of engine that has been or will be invented.  All we can measure is what goes in and out.</p>
<p>What goes in is basically just the &#8220;fuel&#8221;: room-temperature water.  There might be some air with it, too.   There are a couple of things that come out: The exhaust from the engine, and the power from the engine — maybe in the form of a shaft coming out of the engine that it&#8217;s turning, or something.</p>
<p>According to the First and Second Laws of Thermodynamics, available energy cannot be created, though it can be destroyed by turning available energy into unavailable energy.  If we apply that principle to the box with the engine in it, it&#8217;s pretty clear that the sum of the available energy that goes into the box and what is in it when we start running it has to be at least as much as the sum of what comes out and what is in it when we finish.</p>
<p>Now, this is an &#8220;engine&#8221;, not a storage system; it&#8217;s not allowed to be running off some sort of hidden internal energy supply that&#8217;s also contained in the box.  So, if the engine isn&#8217;t cheating, the amount of available energy in the box when we start will be the same as the amount when we finish.  Thus, we conclude: what goes in must be at least as much as what goes out.</p>
<p>So, look at the available energy that&#8217;s in that exhaust.  Whatever the exhaust is, it has to contain the same hydrogen and oxygen atoms that came in with the water, along with the atoms that came in with the air.  It could hot steam — which has higher available energy than the water that came in.  It could be some other compounds of hydrogen and oxygen and stuff in the air — and all of those have higher available energy than water and air do.  It could be a cool wet fog, which has slightly higher energy than the water.  It could even be ice, but even that has higher available energy than room-temperature water.  The <i>best possible</i> case is that it could be room temperature water and air just like what came in, and have the same available energy.</p>
<p>That means that the available energy that comes out in the exhaust is at least as much than the available energy that goes in with the fuel and air.  And there&#8217;s supposedly even more energy coming out via the power from the engine — thus, the output is claimed to be higher than the input.</p>
<p>This is obviously a contradiction.  We just found that, by the laws of thermodynamics, we can&#8217;t have more energy coming out in the exhaust and power shaft than what came in with the fuel.</p>
<p>Thus, the engine is impossible.</p>
]]></content:encoded>
			<wfw:commentRss>http://notes.dpdx.net/2006/05/23/why-cant-a-car-engine-run-on-water/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>What would an expert want with recipes?</title>
		<link>http://notes.dpdx.net/2006/05/23/what-would-an-expert-want-with-recipes/</link>
		<comments>http://notes.dpdx.net/2006/05/23/what-would-an-expert-want-with-recipes/#comments</comments>
		<pubDate>Tue, 23 May 2006 21:25:24 +0000</pubDate>
		<dc:creator>Brooks</dc:creator>
				<category><![CDATA[Programming and People]]></category>

		<guid isPermaLink="false">http://notes.dpdx.net/2006/05/23/what-would-an-expert-want-with-recipes/</guid>
		<description><![CDATA[Jeff Atwood makes the point that although experts generally don&#8217;t follow recipes (such as &#8220;best practices&#8221;) literally, the recipes are still valuable:

The idea that a recipe (eg, a best practice, a methodology, or a maturity model) is completely worthless is just as wrongheaded as the idea that everything should be based on a strict recipe. [...]]]></description>
			<content:encoded><![CDATA[<p>Jeff Atwood <a href="http://www.codinghorror.com/blog/archives/000594.html">makes the point</a> that although experts generally don&#8217;t follow recipes (such as &#8220;best practices&#8221;) literally, the recipes are still valuable:</p>
<blockquote><p>
The idea that a recipe (eg, a best practice, a methodology, or a maturity model) is completely worthless is just as wrongheaded as the idea that everything should be based on a strict recipe. In other words, even an expert chef may occasionally find it helpful to refer to a recipe card. </p>
<p>There&#8217;s no reason these two models can&#8217;t coexist. You should always start with the common denominator recipe, of course, but you may want to provide some alternative guidelines and ideas for those cooks who have outgrown traditional recipes, too.</p></blockquote>
<p>I strongly agree with his general point, but I think that &#8220;guidelines and ideas&#8221; are the wrong sort of thing to include.</p>
<p>To take the metaphor literally, for some things, I&#8217;m a <a href="http://www.codinghorror.com/blog/archives/000203.html">level 4</a> cook.  (Not necessarily an especially good one — it&#8217;s worth noting that these levels are not always parallel to the quality of the output!)  A particular example would be some coleslaw I made a couple of weeks ago, when I found myself in an ill-stocked kitchen with a cabbage, an empty stomach, and the <i>Joy of Cooking</i>.</p>
<p>The <i>Joy of Cooking</i> is a pretty good cookbook for this sort of thing, as it turns out.  It has a half-page discussion of what coleslaw is, without any recipes at all.  It turns out that pretty much the only common factor in slaw is that it has cabbage in it.  Everything else is variable.  (This was an important point; we had no mayonaisse, and the person I was cooking with insisted that coleslaw has to have mayo.)  It went on to describe, in loose terms, some of the common varieties.  I skimmed through those, and then went on to look at the actual recipes.  The standard recipe format is well-optimized for this sort of thing; there&#8217;s a list of ingredients at the top, separate from the instructions, making it very easy to skim to pull out specific bits of data such as the ratio of sugar to vinegar in a sugar-vinegar slaw.</p>
<p>After looking through the cookbook, I&#8217;d gleaned the following information: sugar and vinegar are a perfectly sufficient base for a slaw dressing, and it&#8217;s common to have them in X ratio, Y is a typical amount of salt, and Z, W, Q, and a dozen other things are some ideas for spices to put it.</p>
<p>Those, you may object, look exactly like &#8220;guidelines and ideas&#8221;.  So, why am I objecting to including guidelines and ideas for experts in the recipe?  The same reason that specific instructions are wrong for experts: They are <i>processed</i> information, and the definition of &#8220;expert&#8221; in this context is someone who does their own information processing.  In my case, when I read the recipes, I was mining them for bits of information.  Any processing that complicates that information-mining is a detriment, not a benefit.</p>
<p>And so, when writing recipes to be useful beyond basic instructions, the thing to include is facts.  Not a guideline of &#8220;this squash should be cooked for 20 minutes&#8221;, but the fact of &#8220;if you cook this squash for more than 25 minutes it will be mushy and begin to lose flavor.&#8221;  Not the idea of, &#8220;You could use peaches in this,&#8221; but the fact of &#8220;Peaches are also common in this.&#8221;  The guidelines and ideas are certainly useful because they contain facts, but the parts that make them &#8220;guidelines&#8221; and &#8220;ideas&#8221; rather than bare facts rarely are.  Often the process of distilling the fact into a guideline or idea loses useful information, too; suppose I wanted mushy squash, or wanted an uncommon alteration?</p>
]]></content:encoded>
			<wfw:commentRss>http://notes.dpdx.net/2006/05/23/what-would-an-expert-want-with-recipes/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Nerd Bravado, redux.</title>
		<link>http://notes.dpdx.net/2006/05/12/nerd-bravado-redux/</link>
		<comments>http://notes.dpdx.net/2006/05/12/nerd-bravado-redux/#comments</comments>
		<pubDate>Sat, 13 May 2006 06:30:40 +0000</pubDate>
		<dc:creator>Brooks</dc:creator>
				<category><![CDATA[Programming and People]]></category>

		<guid isPermaLink="false">http://notes.dpdx.net/2006/05/12/nerd-bravado-redux/</guid>
		<description><![CDATA[I was reading Kristin Abkemeier&#8217;s post on what it feels like to be a &#8220;geek girl&#8221;, and she linked to Matt McIrvin&#8217;s post about Nerd Bravado, which is the claim (originally made by an anonymous poster on yet a third blog post that I haven&#8217;t read) that in order to have any cred as an [...]]]></description>
			<content:encoded><![CDATA[<p>I was reading <a href="http://radioactive-banana.com/blog/2006/03/08/what-it-feels-like-for-a-geek-girl/">Kristin Abkemeier&#8217;s post on what it feels like to be a &#8220;geek girl&#8221;</a>, and she linked to <a href="http://mmcirvin.livejournal.com/300531.html">Matt McIrvin&#8217;s post about Nerd Bravado</a>, which is the claim (originally made by an anonymous poster on yet a third blog post that I haven&#8217;t read) that in order to have any cred as an engineer, one has to at least once solve a problem in the manner of sitting down and working on it for 20 or 30 hours of continuous independent work, because there are some problems that can&#8217;t be solved any other way.  (To be clear, that&#8217;s a claim that Matt was describing in order to disagree with it.)</p>
<p>I&#8217;m going to claim some authority in talking about this, because I&#8217;ve done that — and it wasn&#8217;t just 20 or 30 hours, either.  A year ago, I thought that there was some chance that I could finish my dissertation by the end of the academic year if I got a certain set of simulations done, which required taking a computer program that was currently held together by Duck-brand Fortran Tape, and turning the structurally unsound mass of the core algorithms into a well-oiled robust, solid, machine that would do what I told it.  I had two weeks in which to either accomplish it or give up.</p>
<p>So, I sat down on Monday to start working on it, and for all practical purposes, I worked on it straight through until Wednesday of the following week.</p>
<p>This is the first flaw of the Nerd Bravado claim.  Hyperfocus doesn&#8217;t care if you sleep and eat and take a shower.  You can think while you&#8217;re eating.  Your brain keeps working on things when you sleep, and if you think about a problem when you go to bed and when you get up in the morning, you&#8217;ll often find that some tricky bit of it has become a lot clearer in the interim.  You don&#8217;t have to sit for 25 hours straight to get the benefits.</p>
<p>That&#8217;s where the benefit of this style of working is, insofar as there is one: Hyperfocus.  After a dozen or so hours into this project, I was so focused on it that I couldn&#8217;t really think about anything else — even if I tried, the problems in the code would keep distracting me back to the task.  And, because I&#8217;d pretty much emptied everything else from short-term memory, quite a lot of stuff about the code could fit in there — enough to contain all the complicated interweavings of how the code all fit together.  I could look at the results and see where the problems were coming from and what bits of subroutines wove together to create the particular effect that was happening, and I knew, without having to look, where to prod the program to change it, and when I prodded it, it changed.  It&#8217;s a heady feeling.</p>
<p>I think that&#8217;s what the appeal of Nerd Bravado is, really.  It&#8217;s like spice, from Dune.  Get a bit of it into your system, and the universe opens up before you and whirls at your beck and call, and you have tremendous power at your fingertips to poke exactly the right thing in exactly the right place.  But it&#8217;s also got downsides; do it a few too many times, and your eyeballs turn funny colors and it completely eats your life.</p>
<p>Now, I said I had two weeks to fix this program, and I stopped a week and a half in.  Do you think that means I finished early?  Hardly.  A week in, and I&#8217;d gotten all the easy bugs fixed and most of the complicated ones, and I&#8217;d started tangling with the algorithms at the core of it.  And they had a problem: The math that I was working with involved solving an equation where significant parts of both sides are multiplied by a factor that goes to zero.  Divide that out to solve it, and very small errors in one term become very big errors in the solution, and it stops being well-behaved.  There are ways around this, but they have to be designed into the algorithm from the start, not bolted on later.  And by about Wednesday, it became quite clear that I was dealing with something that needed to be fixed from the ground up, and there was no way I could come close to that in the three days I had left.</p>
<p>This is the second flaw of the Nerd Bravado claim.  It doesn&#8217;t actually solve the real big problems.  Hyperfocus is a state of working on instincts, of having enough information actively in your brain that you don&#8217;t have to work through logic and deductive reasoning to know what the Right Thing To Do Now is.  And that&#8217;s great, if what you need to accomplish is something that&#8217;s a chain of consecutive steps, like debugging a convoluted program or working through a complicated mathematical derivation or even writing a new program that fits a general specification that you&#8217;ve already determined.</p>
<p>Real big problems aren&#8217;t like that.  Flash-of-insight problems aren&#8217;t like that — Einstein didn&#8217;t have his flash of insight about time dilation on the trolley because he&#8217;d been hyperfocusing on the problem for the past few days; he had it because he&#8217;d been rolling the problem around in his head for months.  (Or years; I don&#8217;t actually know that bit of his biography well enough to say for sure.)  And hard-work problems aren&#8217;t like that, either — writing a fixed version of my program isn&#8217;t going to work like that either, because it needs to be designed right from the ground up, and designing something right is a process that requires awareness of the outside world, and of a lot more than what fits in the hyperfocus.  Yes, there are the legends of the great designers who sit down and in one day lay out the basic lines of an airplane or a car engine that are more right than their less-great colleagues create with a committee and a month, and that comes from having tremendous amounts of knowledge in their heads, but that&#8217;s the sort of knowledge that gets there over years, not hours.</p>
<p>This brings me to the third flaw of the Nerd Bravado claim: It&#8217;s not, overall, worth doing.  When I&#8217;d finished my week-and-a-half of debugging, I was mentally exhausted.  I was a week behind on all of the minutiae of daily life, I was emotionally starved for interpersonal interactions, I&#8217;d barely talked to my wife about anything that mattered to her, and my brain felt thoroughly fried.  (My wife&#8217;s ironic laugh when I asked her if she remembered when I did this probably tells you all you need to know about what it was like from the outside.)  It took somewhere around a month before my work productivity was anywhere near normal again.  All totaled, I&#8217;d probably have accomplished as much if I&#8217;d simply worked at a reasonable pace for the month and two weeks, and I&#8217;m pretty sure the resulting solution would have been worth a bit more, as I&#8217;d have had the time to actually work out at least a first cut at a ground-up solution.</p>
<p>And, finally, the fourth flaw of the Nerd Bravado claim: the claim that &#8220;you must do it at least once to be a successful engineer &#8230; and to gain the respect of your peers&#8221; simply doesn&#8217;t hold true.  The result of this particular experience, for me, was that I had a nicely debugged program that solved the equations the wrong way and didn&#8217;t produce useful answers.  And all I learned from it was this: That style of working isn&#8217;t sustainable, and doesn&#8217;t lead to an enjoyable life, and I don&#8217;t want to do it again except in very small doses.  As for the respect of my peers — well, does this cause any of you to respect me any more?  No?  I didn&#8217;t think so.</p>
]]></content:encoded>
			<wfw:commentRss>http://notes.dpdx.net/2006/05/12/nerd-bravado-redux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Noodling about a MetaLanguage</title>
		<link>http://notes.dpdx.net/2006/05/07/noodling-about-a-metalanguage/</link>
		<comments>http://notes.dpdx.net/2006/05/07/noodling-about-a-metalanguage/#comments</comments>
		<pubDate>Sun, 07 May 2006 20:09:15 +0000</pubDate>
		<dc:creator>Brooks</dc:creator>
				<category><![CDATA[Computer Languages]]></category>

		<guid isPermaLink="false">http://notes.dpdx.net/2006/05/07/noodling-about-a-metalanguage/</guid>
		<description><![CDATA[I&#8217;ve been reading a few articles recently about language syntax and semantics, and what makes for a good computer language these days.  (For instance, this article by Larry O&#8217;Brien.)  One theme that struck me was the idea that the power of a language is in its extensibility — that is, in the rules [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been reading a few articles recently about language syntax and semantics, and what makes for a good computer language these days.  (For instance, <a href="http://www.knowing.net/PermaLink,guid,affe9827-10f2-4490-8cd1-fafbe8e6f6d0.aspx">this article by Larry O&#8217;Brien</a>.)  One theme that struck me was the idea that the power of a language is in its extensibility — that is, in the rules of the language that allow a program to add to the language.</p>
<p>This has interesting ramifications for language design.  A language is not defined by all of the syntax and semantics that are in its programs.  It is, instead, defined by its primitives and by the structure upon which the programmer can add to the language.</p>
<p>For example, here&#8217;s a short Fortran program:</p>
<pre>
<font color="#FF0000">program</font> sample
  <font color="#FF0000">use</font> vectorModule
  <font color="#FF0000">real</font> :: b
  <font color="#FF0000">type</font>(vector) :: V
  <font color="#FF0000">call</font> loadFromFile(V, 'myfile.dat')
  b = abs(V)
  <font color="#FF0000">write</font>(*,*) b
<font color="#FF0000">end program</font>
</pre>
<p>Fortran defines the words that are highlighted in red, and the punctuation; everything else is something that I&#8217;ve defined either in this program or in the matrixModule module that gets included by the second line.  Some of these definitions are so common that we don&#8217;t even think of them as &#8220;language extensions&#8221; any more — for instance, the function and subroutine definitions.  Beyond those, there&#8217;s also the user-defined &#8220;vector&#8221; type, and the extension of the absolute-value intrinsic to apply to it.</p>
<p>The invariants of the language are more interesting, though.  Variables are declared with a &#8220;::&#8221; syntax, and must be declared before any executable statement.  User-defined variables must be declared as &#8220;type(vector) ::&#8221; rather than just &#8220;vector ::&#8221;.  Subroutines cannot be used as statements alone; they are prefixed with a &#8220;call&#8221; keyword.  Expressions, likewise, cannot be used as statements — and an assignment is a statement, not an expression.  These requirements are at the core of what can and what cannot be a Fortran program.</p>
<p>One interesting question is: What happens as we reduce the number of syntax invariants of the language?</p>
<p>Consider the TeX typesetting language.  What if we had a programming language that worked like TeX?</p>
<p>TeX is, to a rough approximation, a two-level language.  The first layer is a macro expansion language; the user&#8217;s code (along with some system libraries) is processed through a macro system that converts it into a stream of TeX primitive commands.  These primitive commands are then processed through a second layer, which converts them into the typesetting equivalent of machine code.  It would be easy enough to imagine a language like this where the second layer produces compiled programs rather than typeset pages.</p>
<p>This has some interesting results in how the TeX is used.  Knuth expected that what he had written was largely a proof-of-concept language, and that people would rewrite the basic language processor to add extensions to it.  However, the macro expansion language he wrote is sufficiently powerful that nearly any desired language extension can be written as a macro.  (There are a few exceptions, surrounding things like file input-output and bits of math typesetting that are implemented largely in the second layer, but they are rare.)  And, given the choice of writing a macro that works with the existing system, or creating a new system, people have generally chosen to write macros.  Even the LaTeX typesetting langauge, which is sufficiently different from TeX as to be nearly a distinct language, is merely a large set of TeX macros that are treated as a system library.</p>
<p>Another benefit is that it makes experimentation easy, and makes it portable.  To write a new bit of language syntax, I simply write a few macro commands and put them at the top of my file &#8212; and, so long as those commands go with my file, it will run on anyone else&#8217;s TeX system.</p>
<p>These would be good traits to have in a programming language.</p>
<p>Thus, the question is: What is an appropriate set of primitives for a programming language?  And what is a good way to structure a TeX-like macro language that will produce them?</p>
]]></content:encoded>
			<wfw:commentRss>http://notes.dpdx.net/2006/05/07/noodling-about-a-metalanguage/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Slides from DFD &#8216;05 presentation posted</title>
		<link>http://notes.dpdx.net/2006/05/06/slides-from-dfd-05-presentation-posted/</link>
		<comments>http://notes.dpdx.net/2006/05/06/slides-from-dfd-05-presentation-posted/#comments</comments>
		<pubDate>Sat, 06 May 2006 18:21:06 +0000</pubDate>
		<dc:creator>Brooks</dc:creator>
				<category><![CDATA[Computational Fluid Dynamics]]></category>
		<category><![CDATA[Dissertation Research]]></category>

		<guid isPermaLink="false">http://notes.dpdx.net/2006/05/06/slides-from-dfd-05-presentation-posted/</guid>
		<description><![CDATA[I just added the slides from my presentation at the 58th annual November meeting of the APS&#8217;s Division of Fluid Dynamics to my publications page.  This is largely a modified version of the presentation I gave at the ILASS meeting last May.
Presentations at APS meetings are only 10 minutes long, instead of the 25 [...]]]></description>
			<content:encoded><![CDATA[<p>I just added the slides from my <a href="http://dpdx.net/research/papers/DFD2005_Moses_abstract.html">presentation at the 58th annual November meeting of the APS&#8217;s Division of Fluid Dynamics</a> to my <a href="http://dpdx.net/research/papers/">publications page</a>.  This is largely a modified version of the <a href="http://dpdx.net/research/papers/ILASS2005_Moses_abstract.html">presentation</a> I gave at the ILASS meeting last May.</p>
<p>Presentations at APS meetings are only 10 minutes long, instead of the 25 at most other conferences, so these slides are much tighter and more concise than the ILASS slides.  I think there are definite advantages to the format; most of the presentations still seemed to contain all of the critical aspects of the research, and most of what seemed to get cut was excessive belaboring of points, and recitations of the same justifications and basic background that we&#8217;ve all heard dozens of times before.  And, of course, it means that there&#8217;s time to see more than twice as many presentations in a day; when the conference packs over a thousand talks into a three-day block, that&#8217;s quite important.</p>
<p>One unfortunate thing about the APS DFD meeting is that the talks don&#8217;t come accompanied by papers that one can look up and read afterwards.  For my presentation, though, my <a href="http://dpdx.net/research/papers/ILASS2005_Moses_abstract.html">paper from the ILASS meeting</a> covers most of the same results.</p>
<p>Oh, and at some point I&#8217;ll work out an appropriate Creative Commons license for this stuff.  In the interim, if you want to borrow one of the slides or figures for something, just send me an email.</p>
]]></content:encoded>
			<wfw:commentRss>http://notes.dpdx.net/2006/05/06/slides-from-dfd-05-presentation-posted/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>On replacing the right light bulb.</title>
		<link>http://notes.dpdx.net/2006/04/29/on-replacing-the-right-light-bulb/</link>
		<comments>http://notes.dpdx.net/2006/04/29/on-replacing-the-right-light-bulb/#comments</comments>
		<pubDate>Sun, 30 Apr 2006 02:58:56 +0000</pubDate>
		<dc:creator>Brooks</dc:creator>
				<category><![CDATA[Assorted Tinkering]]></category>

		<guid isPermaLink="false">http://notes.dpdx.net/2006/04/29/on-replacing-the-right-light-bulb/</guid>
		<description><![CDATA[A few days ago, the front left turn signal in my wife&#8217;s Geo Metro stopped working, and so one of my chores today was to replace it.  I went down to the garage with a pair of screwdrivers and the new bulb, expecting that it would be a pretty simple repair.
A 1997 Geo Metro [...]]]></description>
			<content:encoded><![CDATA[<p>A few days ago, the front left turn signal in my wife&#8217;s Geo Metro stopped working, and so one of my chores today was to replace it.  I went down to the garage with a pair of screwdrivers and the new bulb, expecting that it would be a pretty simple repair.</p>
<p>A 1997 Geo Metro is one of the cars with an integrated headlight-and-signal-light unit that&#8217;s accessed from the front corner of the engine compartment, so I popped the hood and went to work.  The lens is held on by a couple of obvious clips, so I removed those.  No luck; obviously there was something else that needed to be unfastened on the bottom, too.  The next obvious thing to undo were a couple of large screws holding the entire light unit on.  I removed those, and still no luck — there was something holding it on the outside bottom corner, which I couldn&#8217;t figure out how to get to.</p>
<p>This, I concluded, was the appropriate time to read the documentation, in the form of the owner&#8217;s manual.  The owners manual explained that one didn&#8217;t actually remove the lens or the housing at all, but replaced the bulbs by reaching in behind the light housing, unfastening the socket, and pulling it out.  It went on to say — and this is only a mild paraphrase — &#8220;Reaching the socket to unfasten it is actually physically impossible unless you are a leprechaun.  You will want to take your car to the dealer and let them do it.&#8221;  Back to plan A.</p>
<p>Some more investigation found the third screw holding the headlight unit in place, hidden in a cavity behind the bumper that I could either look into or reach into at any given time, but not both.  So I removed that while contemplating the pipes running across the ceiling, and pulled out the headlight unit, and pulled the socket out of the now-accessible back of it, and discovered a small light bulb entirely unlike the one that the parts store had sold me to replace it.</p>
<p>A small light bulb which, to all appearances, seemed perfectly intact and functional.</p>
<p>Some further testing of the corresponding lights on the other side of the car informed me that what I had just gone to all of that effort to access was not, in fact, the turn signal light at all, but merely the parking light, which was just as functional as it appeared.</p>
<p>So, thus enlightened, I reassembled the headlight unit with only slightly less effort than had been required to disassemble it, and then replaced the actual turn signal bulb, which is in the middle of the front bumper behind a lens that&#8217;s held in place by two quite obvious and quite visible screws that are, as it turns out, entirely trivial to remove and replace.</p>
]]></content:encoded>
			<wfw:commentRss>http://notes.dpdx.net/2006/04/29/on-replacing-the-right-light-bulb/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Free-software licenses: requirements vs. requests.</title>
		<link>http://notes.dpdx.net/2006/04/24/free-software-licenses-and-obligations/</link>
		<comments>http://notes.dpdx.net/2006/04/24/free-software-licenses-and-obligations/#comments</comments>
		<pubDate>Tue, 25 Apr 2006 02:39:10 +0000</pubDate>
		<dc:creator>Brooks</dc:creator>
				<category><![CDATA[Programming and People]]></category>

		<guid isPermaLink="false">http://notes.dpdx.net/2006/04/24/free-software-licenses-and-obligations/</guid>
		<description><![CDATA[I&#8217;ve been thinking quite a lot about free software licenses lately, and how important it is to get them right.  A couple of recent events will serve to illustrate some of the important points:

The &#8220;listings&#8221; package for LaTeX is invaluable for including computer source code in a document.  It&#8217;s something like syntax highlighting [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been thinking quite a lot about free software licenses lately, and how important it is to get them right.  A couple of recent events will serve to illustrate some of the important points:</p>
<ul>
<li>The &#8220;listings&#8221; package for LaTeX is invaluable for including computer source code in a document.  It&#8217;s something like syntax highlighting in a source code editor, but for typeset output rather than on-screen, and very easily user-customizable.  Carsten Heinz spent almost a decade writing it and perfecting it, and it&#8217;s a marvel of intricate TeX programming — 218 pages of typeset user documentation and source code.  Then, about a year ago, Carsten disappeared.  As far as I know, nobody in the TeX community knows what happened to him; he simply stopped replying to email, and letters to his last known physical address just disappear.  As a result, the official version of the listings package has effectively been frozen for the last year, despite a couple of important bugfixes that have been informally circulating.  Luckily, this isn&#8217;t a permanent situation; it&#8217;s licensed under the LaTeX Project Public License, which provides a process by which the maintainership of the &#8220;official version&#8221; of a package can be transferred to someone else in such a case.
</li>
<li>In a blog post I was reading this morning (I&#8217;m leaving this vague so as not to point fingers excessively at only one example of a common problem), the author mentioned a general-purpose data structure that he had included in his open-source simulation code, and provided a link to the source file for the implementation.  Like many such implementations, it&#8217;s sufficiently general that it would be useful in many programs that I&#8217;m writing, and it&#8217;s a better implementation than I could come up with (and test!) in a day&#8217;s work.  However, there&#8217;s a problem: The license for this software package is not quite the same as any common software license, and it requires that its particular set of conditions and disclaimer be included in any redistribution.  Further, the license has the relatively common clause that any scientific publications which contain data resulting from use of the program must cite it.
</li>
</ul>
<p>I&#8217;ll start with the last item.  It&#8217;s completely reasonable that the author of a piece of scientific software would want to be cited when their work is used, so what&#8217;s wrong with putting that in the license?  <a href="http://www.gnu.org/philosophy/bsd.html">The answer is a lesson that should have been learned years ago.</a>  It only makes sense for cases where what&#8217;s being redistributed is pretty much the same as the original work.  Beyond the well-known problems described at that link (short form: someone else builds on it enough to merit citation and adds their paper, and after a few repeats of that it quickly becomes unweildy), there&#8217;s the problem of partial reuse: if I include this little data structure implementation in my program, according to the license I then have to cite their paper in all of mine, even though my work is in a quite unrelated field.  And so does anyone who uses my program.  While that might arguably be appropriate for an advertising clause, it&#8217;s not appropriate for scientific citations.</p>
<p>So, functionally, I pretty much can&#8217;t reuse their data structure in my own software, if I wish to do so under its published license.  That&#8217;s completely contrary to the spirit of free software; even though it&#8217;s open source and I can read it, the license prohibits me from simply copying it and reusing it unless I&#8217;m willing to agree to inappropriate terms.  This almost certainly isn&#8217;t the intent of the program&#8217;s author; he simply didn&#8217;t consider the possibility of someone reusing a small piece of his program when he decided how to license it.</p>
<p>In this case, there&#8217;s probably a simple solution.  If I want to use this code, I can write to him and ask for permission to use it under a different license than the one it&#8217;s published under — specifically, one which doesn&#8217;t contain this citation clause.  Probably he&#8217;ll agree, and that will be that.</p>
<p>However, this is where the first example is relevant.  What if it was something in Carsten&#8217;s code that I wanted to reuse, and he had a similar sort of clause in his license?  Plain and simple, I&#8217;d be stuck.  Even if I were willing to ignore the license on the assumption that his heirs wouldn&#8217;t find out or wouldn&#8217;t care enough to sue me, I certainly couldn&#8217;t relicense the code with a clear conscience.</p>
<p>That&#8217;s why license compatibility is important, and why it&#8217;s a bad idea to add private clauses like the &#8220;cite my paper&#8221; clause.  Without it, free software isn&#8217;t a commons — it&#8217;s a balkanized set of little gardens fenced off from each other and unable to cross-fertilize.  We&#8217;ve had this problem with railroad tracks, with fire hoses, with all sorts of things early in the industrial revolution; as engineers, you&#8217;d think we&#8217;d know better by now.  Four feet eight and a half inches probably isn&#8217;t the optimal solution for any given railroad in isolation, but it&#8217;s certainly better in practice in the real world for nearly all of them, because it&#8217;s what everyone else uses, and in the long run it&#8217;s just not worth the trouble of being different.</p>
<p>&#8220;But,&#8221; you say, &#8220;I still want people to cite my paper when they use my software!&#8221;</p>
<p>Consider this: Most researchers and users of your program are, by and large, honorable and honest people.  They understand the value of citing sources, and they appreciate that you&#8217;ve written this software and made it available for them to use.  For the vast majority of them, all that you need to do to get them to cite your paper about the software is to ask.</p>
<p>License terms aren&#8217;t &#8220;asking&#8221;.  They&#8217;re a demand, one with legal teeth behind it.  They&#8217;re what you put in there for the people who you don&#8217;t trust to do right, and for the corporations that are too big to have morals at all.  They ought to be the final line in the sand for the things that are vitally important: you don&#8217;t claim you wrote this, you don&#8217;t claim I&#8217;ll support it, you don&#8217;t put restrictions on it that I disagree with.  If it&#8217;s not that critical, and if you wouldn&#8217;t sue someone for ignoring it, then setting it in that sort of legal inflexibility does more harm than good.</p>
<p>Thus, I propose the idea of adding a &#8220;Requests&#8221; or &#8220;Moral Obligations&#8221; section to software licenses, for this sort of thing.  When I release a program that&#8217;s large enough to merit a paper citation if someone uses it, somewhere near the license clause in the documentation will be a section that says something like this: &#8220;The requirements in this section are not legally binding; however, they represent things that the author would appreciate:  If you write a paper based on work that uses this software, please include a citation to my paper, and send me a copy of your paper.  If you create a derivative work based on a this software, tell me about it and let me know how I can get a copy, and include this request if it&#8217;s appropriate.&#8221;</p>
<p>In virtually all cases, that will work just as well as adding those as terms to the software license.  (How do I know it will work?  Well, it already works quite well for the papers themselves, though there the request is implicit rather than stated.)  And, importantly, it will work equally well in the cases where something I asked for turns out to be terribly inconvenient for some reason that I didn&#8217;t think of when I wrote it, even if I&#8217;m not around to change the license terms.</p>
]]></content:encoded>
			<wfw:commentRss>http://notes.dpdx.net/2006/04/24/free-software-licenses-and-obligations/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>OpenFOAM-1.3 Cygwin port posted.</title>
		<link>http://notes.dpdx.net/2006/04/10/openfoam-13-cygwin-port-posted/</link>
		<comments>http://notes.dpdx.net/2006/04/10/openfoam-13-cygwin-port-posted/#comments</comments>
		<pubDate>Tue, 11 Apr 2006 07:42:23 +0000</pubDate>
		<dc:creator>Brooks</dc:creator>
				<category><![CDATA[Computational Fluid Dynamics]]></category>

		<guid isPermaLink="false">http://notes.dpdx.net/2006/04/10/openfoam-13-cygwin-port-posted/</guid>
		<description><![CDATA[After a couple of weeks of work (in and among the other things I was doing), I&#8217;ve finished a releasable version of the OpenFOAM-1.3 Cygwin port.  I&#8217;ve stuck it all in a source .tar.gz file and a compiled-binaries .tar.gz file, and updated the openfoam-cygwin page with links and updated instructions and things.  There&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p>After a couple of weeks of work (in and among the other things I was doing), I&#8217;ve finished a releasable version of the <a href="http://www.opencfd.co.uk/openfoam/version1.3.html">OpenFOAM-1.3</a> Cygwin port.  I&#8217;ve stuck it all in a source .tar.gz file and a compiled-binaries .tar.gz file, and updated the <a href="http://dpdx.net/openfoam-cygwin/">openfoam-cygwin page</a> with links and updated instructions and things.  There&#8217;s also a compiled-binary version of gcc 4.1.0 up there to go with it, for people who&#8217;d rather not compile their own – theoretically, this time around, OpenFOAM shouldn&#8217;t need a specially-configured version like it did of 4.0.2 (to get around a gcc bug), but I couldn&#8217;t find any binaries already online to copy, so I had to make my own again.</p>
<p>The basics of the port were pretty much the same as last time.  There are a couple of key problems to work around to get OpenFOAM to compile on Cygwin.  First, it&#8217;s written for a case-sensitive filesystem, and has files named &#8220;Vector.H&#8221; and &#8220;vector.H&#8221; in the same directory, and suchlike.  This clashes when one tries to unpack the source distribution on a case-insensitive filesystem, and then when one goes to compile it, the #include lines in the source files pull in the system&#8217;s &#8220;vector.h&#8221; file instead of either of them.  Fixing this is a tedious but trivial matter of renaming all the relevant files, and fixing all the #include lines.  Someday I&#8217;ll write a script for it, but this time I did it by hand with the disk-search-and-replace in <a href="http://www.notetab.com">my text editor</a>.</p>
<p>The more interesting problem involves how dynamically-linked libraries are compiled and linked on Windows versus Unix and Linux.  OpenFOAM is, functionally, a big set of libraries that get linked into application-specific (and often user-written) wrapper programs.  Most of the core functionality is in a libOpenFOAM library, although the parallel-processing parts are off in a libPstream library.  This allows for different parallel implementations to be used depending on which of various libPstream libraries is actually used at runtime, while having only one version of the libOpenFOAM library.  Unfortunately, this is written with a bit of a circular dependence; libPstream uses a lot of data types defined in libOpenFOAM, while libOpenFOAM needs to link to libPstream.</p>
<p><span id="more-15"></span></p>
<p>On Unix and Linux systems, this doesn&#8217;t actually present any difficulties; one simply includes the relevant header files when compiling the two libraries, and then all of the class methods from libOpenFOAM and the parallel functions from libPstream get resolved when the final wrapper code is compiled and the two libraries are both linked in.</p>
<p>It seems that this fundamentally doesn&#8217;t work on Windows, however, because (as I understand it), a dynamically-linked library on Windows cannot have unresolved symbols.  All of those functions need to be resolved at compile-time, even if they get resolved differently at runtime.  And so we can&#8217;t compile libPstream first because it needs to link to libOpenFOAM at compile-time, and we can&#8217;t compile libOpenFOAM first because it needs to link to libPstream at compile-time.  This is a bit sticky.</p>
<p>The solution to this is a bit of modification to the OpenFOAM make scripts that Petr Vita created and posted to the OpenFOAM forums earlier this year.  I don&#8217;t quite understand the details yet, but he&#8217;s written something that allows the make script for one library to &#8220;import&#8221; the source files from another library and include them, and thus the compilation of libOpenFOAM can reference the relevant libPstream functions that way, before libPstream is compiled.  Then, once that&#8217;s taken care of, we can compile libPstream in the usual way by linking to the libOpenFOAM library, and all is well.</p>
<p>This time around, that seemed to work a lot better than it did in OpenFOAM-1.2 – or perhaps I simply had better luck with the compiler.  In any case, in OpenFOAM-1.2, it didn&#8217;t work to import the (only three) libPstream files into libOpenFOAM, and instead Petr had to do things the other way around, which involved dozens of libOpenFOAM files getting imported.  And then the libOpenFOAM files had to be imported into another library as well, which should have compiled fine without them, but apparently didn&#8217;t.  This time around that one worked just as it should with just a link to the libOpenFOAM library, so now I&#8217;m wondering if perhaps something was just mixed up on Petr&#8217;s computer that day.</p>
<p>The rest of the port involved a few other things that shook out because of things that I&#8217;m guessing were the result of this Windows pickiness.  There were a couple of cases where an additional #include was needed in a source file to get the resulting library to link, including one case where the relevant function prototypes weren&#8217;t actually in a header file at all.  And then, there were a vast pile of cases where additional libraries needed to be given to the linker explicitly – presumably as a result of the fact that on Linux the link process didn&#8217;t complain if a needed library was omitted, and there weren&#8217;t any runtime failures if the library got referenced by the relevant applications somehow – so there was a bit of trial and error fixing those.  Someday I should look up the relevant gcc options to tell the linker not to give me ten thousand (literally; Windows gives me a maximum 9999-line scrollback buffer, and it got overflowed) lines of errors, but instead stop reporting after the first five or so.</p>
<p>But, in any case, that&#8217;s all done, and I&#8217;ve uploaded the files and posted an <a href="http://openfoam.cfd-online.com/cgi-bin/forum/show.cgi?1/2147">announcement post</a> on the discussion board.  Now to see if it works for anyone else!</p>
]]></content:encoded>
			<wfw:commentRss>http://notes.dpdx.net/2006/04/10/openfoam-13-cygwin-port-posted/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Random Diversions on Shuffling Cards</title>
		<link>http://notes.dpdx.net/2006/04/06/random-diversions-on-shuffling-cards/</link>
		<comments>http://notes.dpdx.net/2006/04/06/random-diversions-on-shuffling-cards/#comments</comments>
		<pubDate>Thu, 06 Apr 2006 21:45:39 +0000</pubDate>
		<dc:creator>Brooks</dc:creator>
				<category><![CDATA[Programming and People]]></category>

		<guid isPermaLink="false">http://notes.dpdx.net/2006/04/06/random-diversions-on-shuffling-cards/</guid>
		<description><![CDATA[I&#8217;ve been thinking a lot about the idea of practicing programming lately, after reading Steve Yegge&#8217;s &#8220;rant&#8221; on the subject.  His claim is that programming is a lot like playing guitar – just doing a lot of it doesn&#8217;t make you any better; you have to specifically do things that will improve them.
Dave Thomas [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been thinking a lot about the idea of practicing programming lately, after reading Steve Yegge&#8217;s <a href="http://www.cabochon.com/~stevey/blog-rants/practicing-programming.html">&#8220;rant&#8221; on the subject</a>.  His claim is that programming is a lot like playing guitar – just doing a lot of it doesn&#8217;t make you any better; you have to specifically do things that will improve them.</p>
<p>Dave Thomas suggests in his <a href="http://blogs.pragprog.com/cgi-bin/pragdave.cgi/Practices/Kata">Code Kata post</a> that one way of practicing programming is by solving small-but-complex algorithmic problems, and he has a list of suggestions.</p>
<p>In the shower this morning, I was thinking about a problem that would fit nicely in that list.  I&#8217;m writing a complicated bit of code that takes the triangles in a triangular mesh and loads them into a data structure.  It would be nice to test it by taking a given mesh and loading the triangles in various random orders, and that immediately leads to the classic card-shuffling problem: given a list of objects, how does one efficiently sort them into a random order?</p>
<p><span id="more-14"></span>With cards, this is relatively easy at first glance: Put the cards in a stack (i.e., a linked list).  Pick a random card from the current stack, and use it to start a new stack.  Pick another random card, and put it on the stack.  Repeat until the original stack is empty.</p>
<p>In practice, this doesn&#8217;t work so well: people aren&#8217;t very good at picking really random cards.  Or anything else random; this is why <a href="http://www.worldrps.com/advanced.html">random play doesn&#8217;t win rock-scissors-paper contests</a>.  But that&#8217;s a digression; we&#8217;ll assume that we have a &#8220;good enough&#8221; random number generator to use, just like a computer would.</p>
<p>Having a random number generator doesn&#8217;t solve the problem, though.  It picks numbers, not cards.  There&#8217;s still the problem of mapping the number to the card.</p>
<p>The trivial solution is to number the cards in the stack from 1 to 52 (thereby making it an indexed array), get a random number from 1 to 52, and pull out the corresponding card.  That works nicely for the first card, but then we&#8217;ve got a stack of cards that are numbered from 1 to 52, but one of them&#8217;s missing.  Now what?</p>
<p>We could renumber the cards after the one we pulled out, reducing each one&#8217;s number by one so that the deck is numbered from 1 to 51, but that&#8217;s still a lot of work – for the whole deck, it&#8217;s O(<em>n</em><sup>2</sup>).</p>
<p>(Now that I&#8217;m writing this out, I see an obvious solution here that I didn&#8217;t see earlier.  I&#8217;ll get to that later.)</p>
<p>Alternately, we could give up on renumbering the cards, and just leave them in a linked list.  Then, when the random number generator gives us a number, we count down that many cards from the top of the deck.  Again, for the whole deck, we end up counting O(<em>n</em><sup>2</sup>) cards.</p>
<p>So, consider an alternate approach: Take the top card off the stack, and put it in a random place in the new stack.  This looks like the same problem – how is locating a random place easier than locating a random card – but there&#8217;s a twist.  Because we&#8217;re doing this in a computer, we can keep the cards in two orders at once.  We can store them in one order that makes them easy to find, and simultaneously in another order that&#8217;s randomized.</p>
<p>First, consider the new deck as a linked list; we pick a card randomly, and insert the new card after it.  On a pointer level, this means that the new card points to what the old card had pointed to, and the old card now points at the new card.  The trick is that, when picking a random card, we don&#8217;t have any reason to care what order they&#8217;re in in the linked list.  So, if we&#8217;re actually storing the cards in an indexed array, and putting each new card on the end of the array, then all we need to do is pick a random index and go straight to that card.  Once all the cards are in the new deck, then we can traverse the linked list and pull them out in the shuffled order.</p>
<p>There&#8217;s a bit of nice optimization, too; we could pull cards off the bottom of the old deck just as easily as off the top, and since we&#8217;re putting them on the top of the new deck (insofar as actual storage location), there&#8217;s no need to actually move the cards at all; everything below the current index is the new deck, and above it is the old deck.  If the cards are just numbers, there&#8217;s no need to even store the cards at all; we just store the pointers.</p>
<p>So, how does that actually get implemented?  Start at the beginning of an indexed array of pointers (which are really just numbers).  Increment the index.  Pick a random bin below the current index.  Take the number from the random bin and put it in the bin corresponding to the current index.  Put the current index as a pointer in the random bin.  Repeat until done.</p>
<p>&#8230;</p>
<p>So, back to that parenthetical note from earlier.  There&#8217;s really no need to renumber all the cards, because they don&#8217;t have to stay in the same order.  We could just take last card on the deck, and renumber it to fit in the gap, and be done.  So, we take a random card out of the deck, put it at the first spot of the new deck, and then move the last card from the deck into the hole that got left.  Or, to do this in the same space, we could just pick a card, set it aside, take the first card from the deck and set it in the hole, and put the picked card in the now-empty first spot.  Now, the &#8220;new deck&#8221; is the first card, and the &#8220;old deck&#8221; is the rest, and so forth as we go along.</p>
<p>How does that get implemented?</p>
<p>Start at the beginning of an indexed array of card numbers (which are essentially pointers).  Increment the index.  Pick a random bin above the current index.  Take the number from the random bin and put it in the bin corresponding to the current index (i.e., the end of the new deck).  Take the current index (i.e., the card from the end of the old deck) and put it in the random bin.</p>
<p>An interesting similarity, isn&#8217;t it?</p>
]]></content:encoded>
			<wfw:commentRss>http://notes.dpdx.net/2006/04/06/random-diversions-on-shuffling-cards/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>My software port has a user!</title>
		<link>http://notes.dpdx.net/2006/03/28/my-software-port-has-a-user/</link>
		<comments>http://notes.dpdx.net/2006/03/28/my-software-port-has-a-user/#comments</comments>
		<pubDate>Tue, 28 Mar 2006 21:25:36 +0000</pubDate>
		<dc:creator>Brooks</dc:creator>
				<category><![CDATA[Computational Fluid Dynamics]]></category>

		<guid isPermaLink="false">http://notes.dpdx.net/2006/03/28/my-software-port-has-a-user/</guid>
		<description><![CDATA[The good news: Someone&#8217;s using my Windows port of OpenFOAM.  It&#8217;s nice to know that it&#8217;s actually going to be useful to somebody.
The bad news: I know this, of course, because they&#8217;ve posted a bug report to say it doesn&#8217;t work for them.
Turns out that a large part of the problem was fairly obvious [...]]]></description>
			<content:encoded><![CDATA[<p>The good news: Someone&#8217;s using my <a href="http://dpdx.net/openfoam-cygwin/">Windows port of OpenFOAM</a>.  It&#8217;s nice to know that it&#8217;s actually going to be useful to somebody.</p>
<p>The bad news: I know this, of course, because they&#8217;ve posted a <a href="http://openfoam.cfd-online.com/cgi-bin/forum/show.cgi?tpc=1&#038;post=6822#POST6822">bug report</a> to say it doesn&#8217;t work for them.</p>
<p>Turns out that a large part of the problem was fairly obvious in hindsight.  The original <a href="http://www.opencfd.co.uk/openfoam/index.html">OpenFOAM</a> package contains environment setup files for both bash and tcsh, and I had modified them both for use under Cygwin.  However, since I use tcsh, I had completely neglected to test the bash scripts, and there were several typos in one of them.  The other problem was that, since the OpenFOAM port uses a local copy of GCC 4.0.2, rather than the Cygwin system copy of GCC, this user had decided to uninstall his system GCC to avoid any possible confusion – and thereby flushed out a bug where the make system was hardwired to use the C preprocessor installed as /bin/cpp, rather than the one in the local copy of GCC.  This one dates back to the original Linux version of the software, so I&#8217;ve in turn filed a bug report on that.</p>
<p>Aside from that, there were a number of complications that amounted to reminders that, whenever the build process goes awry, it&#8217;s important to clean up any incomplete results so that they won&#8217;t perpetuate the problem after the actual bug is fixed.</p>
<p>So, it looks like everything is fixed now, but I&#8217;m waiting for a final confirmation that it all works before I push all the bugfixes into a new version and post it.</p>
]]></content:encoded>
			<wfw:commentRss>http://notes.dpdx.net/2006/03/28/my-software-port-has-a-user/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fixing AC power plugs in various HP and Compaq laptops</title>
		<link>http://notes.dpdx.net/2006/03/18/fixing-ac-power-plugs-in-various-hp-and-compaq-laptops/</link>
		<comments>http://notes.dpdx.net/2006/03/18/fixing-ac-power-plugs-in-various-hp-and-compaq-laptops/#comments</comments>
		<pubDate>Sat, 18 Mar 2006 21:48:41 +0000</pubDate>
		<dc:creator>Brooks</dc:creator>
				<category><![CDATA[Assorted Tinkering]]></category>

		<guid isPermaLink="false">http://notes.dpdx.net/2006/03/18/fixing-ac-power-plugs-in-various-hp-and-compaq-laptops/</guid>
		<description><![CDATA[(This is a slightly-edited repost of an article I wrote elsewhere, back in 2004.)
Some time ago, I posted a comment on This Is Broken, noting my frustration with motherboard-mounted AC power jacks on laptops, and noting that I had fixed a couple of them by following some online directions.  Several people asked me to [...]]]></description>
			<content:encoded><![CDATA[<p>(This is a slightly-edited repost of an article I wrote elsewhere, back in 2004.)</p>
<p>Some time ago, I posted a comment on <a href="http://broken.typepad.com">This Is Broken</a>, noting my frustration with motherboard-mounted AC power jacks on laptops, and noting that I had fixed a couple of them by following some online directions.  Several people asked me to explain further, and I decided it would be useful to write up a more detailed explanation of how I did it.</p>
<p>First, the keywords: My experience is with a Compaq Presario 1210 laptop (which is very similar to the Compaq 1600 series), and a pair of HP Pavilion xf235 laptops, but this should apply to most similar laptops; the advice is mostly generic.</p>
<p>The problem, in short, is that most laptops have their AC power jacks hard-mounted to the motherboard just like any other soldered-on component, and for many of them this is the only structural connection. Unlike most other components, though, power jacks regularly get yanked on when someone steps on the power cord or such, and the solder joints (or the mounting tabs, which after all are pretty thin metal) start to fatigue, and eventually they crack. At this point, the laptop will only charge if the plug is twiddled &#8220;just so&#8221; (if at all), and doesn&#8217;t work reliably.</p>
<p>The official solution, of course, is to replace the motherboard &#8212; which fixes the symptom, but not the overall design problem. On a laptop with a street value of $300, this is also not an economical solution. But it does mean that you don&#8217;t really have anything to lose if you toast the motherboard trying to fix it yourself.</p>
<p>So. Enough preamble. Here&#8217;s how I fixed the problem.</p>
<p><span id="more-12"></span></p>
<p>DISCLAIMER: THIS IS A DESCRIPTION OF HOW I DID THIS REPAIR. FOLLOW THESE INSTRUCTIONS AT YOUR OWN RISK, AND USE YOUR OWN JUDGEMENT; I MAKE NO WARRANTY THAT YOU WILL HAVE A WORKING LAPTOP WHEN YOU FINISH. SOME MINOR STEPS HAVE BEEN OMITTED.</p>
<p>On the Compaq, I used the solution that I found on <a href="http://www.delanoscientific.com/cpq1675.html">http://www.delanoscientific.com/cpq1675.html</a>. Essentially, you take a three-inch strand of some form of heavy-but-flexible two-conductor wire &#8212; that site recommends a good grade of speaker wire, but I happened to have a dead iBook power supply that I salvaged some wire from &#8212; and solder a socket on the end of it that matches the plug on the power cord, feed it through the original power jack hole in the case, and solder the other end to the motherboard where the original power jack used to be. One trick is to tie a knot in this new pigtail just inside the case, so that pulling on it only pulls on the knot, rather than pulling on the solder connections.</p>
<p>On the two HP Pavilion computers, I found a better solution. There is a hole in the case, right next to where the power jack goes, that&#8217;s intended for a PS/2 keyboard or mouse plug on other versions of the laptop. However, it&#8217;s unused and blanked off, which makes it a great place to put a case-mounted power jack &#8212; and it turns out that a standard 1/2&#8243;-diameter panel-mount jack fits perfectly. I used a Philmore No. 248 &#8220;DC Power Jack&#8221;, which has 2.5mm x 5.5mm pin and socket diameters, thereby matching the original plug. While you&#8217;re at the electronics shop, get a decent soldering iron and a power supply for it that lets you control the temperature. If you haven&#8217;t done much soldering before, find some sort of discarded computer-board junk that you can practice on.</p>
<p>Here&#8217;s what the new case-mounted jack looks like when it&#8217;s installed; the original power jack hole is just to the left of it:</p>
<p><center><img src="http://www.stanford.edu/~bmoses/Power_Jack_1.jpg"></center></p>
<p>Actually doing the replacement took me about two hours, on the last one I did. The time-consuming part is that you need to completely disassemble the laptop to remove the motherboard. This starts (on the HP Pavilion computers) with gently popping out the panel above the keyboard that has the CD playback and volume controls on it, and continuing by removing every screw you come across. A digital camera is a very useful timesaver here; photograph the screwdriver pointing to every screw you remove, put the screw next to a number on a numbered piece of paper, and photograph it there &#8212; then, go through the photos backwards and you have a detailed set of reassembly instructions.</p>
<p>When you have the motherboard all the way out, the next step is to remove the remnants of the old power jack, and solder on some one-inch-long wires (or the pigtail, if you&#8217;re not using a case-mounted jack; remember to feed it through the case first!) in its place.</p>
<p>Here, it&#8217;s worth noting that the original power jack has three pins, and acts somewhat like a switch. One pin goes to the ground, and becomes connected to the power-adaptor ground when the adaptor is plugged in to the laptop. The second pin is the +19.5V (or whatever the power voltage is) line; when the adaptor is not plugged in, it becomes connected to the ground pin. The third pin is a logic pin for determining when the adaptor is connected; it is open-circuit when the adaptor is not plugged in, and connected to the ground pin when it is.  (Unfortunately, I didn&#8217;t keep a record of which pin goes with which connection to post here; sorry.)</p>
<p>This could theoretically be problematic with the pigtail-mounted socket, as that socket only has two connections &#8212; the logic line for sensing whether the adaptor is connected does not exist. I simply ignored this problem on the Compaq laptop, and the computer seemed to work fine; it may or may not work properly on other computers. On the case-mounted jack, there are three lines, so this is not an issue.</p>
<p>Meanwhile, speaking of the case-mounted jack for the HP Pavilion laptops, there&#8217;s the issue of attaching it in the case. Remove the blanking plate from the case by appropriate means (I did this by grinding off the heat-swaged mounting pins), and install the jack in the hole that this leaves. You&#8217;ll need to remove a bit of material from the inside top of the jack to prevent interference with the top half of the case later; now is a good time to do that. Also, if you want to be fancy, you can cut a small rectangle out of the blanking plate and superglue it in place to cover the old power-jack hole.</p>
<p>Anyhow, you then reinstall the motherboard (with its new wiring) in the case, and &#8212; if using the case-mounted jack &#8212; connect the wires to the jack. On the HP Pavilions, make sure the wires aren&#8217;t over the LEDS immediately behind it on the motherboard; there are clear-plastic &#8220;light pipes&#8221; that have to go on top of those, and the wires can easily get in the way. Then reassamble the laptop, and that&#8217;s &#8220;all there is to it&#8221;.</p>
<hr/>
<p>In comments on the original version, someone mentioned that <a href="http://www.laptopjacks.com/index.php">http://www.laptopjacks.com</a> sells exact replacements for the original laptop power jacks, if you want to go that route, though they&#8217;re rather more expensive than the generic parts.  Other people mentioned repairing the following laptops (which I&#8217;ll list for the sake of Google) with this advice: HP Pavillion 1150, Compaq Presario 1685, HP ze1115, HP xt412, HP Pavilion ZE43xx series, Compaq 2195US, and a Compaq 2100.  I&#8217;m particularly entertained by the fellow from Montana with the Compaq 2100; he couldn&#8217;t find the right replacement fitting, and so ended up using a trailer-hitch plug set from the local truck stop.</p>
]]></content:encoded>
			<wfw:commentRss>http://notes.dpdx.net/2006/03/18/fixing-ac-power-plugs-in-various-hp-and-compaq-laptops/feed/</wfw:commentRss>
		<slash:comments>31</slash:comments>
		</item>
		<item>
		<title>Why Simulating Free-Surface Flow is Difficult, Part 2</title>
		<link>http://notes.dpdx.net/2006/03/17/why-simulating-free-surface-flow-is-difficult-part-2/</link>
		<comments>http://notes.dpdx.net/2006/03/17/why-simulating-free-surface-flow-is-difficult-part-2/#comments</comments>
		<pubDate>Fri, 17 Mar 2006 08:31:04 +0000</pubDate>
		<dc:creator>Brooks</dc:creator>
				<category><![CDATA[Computational Fluid Dynamics]]></category>
		<category><![CDATA[Dissertation Research]]></category>

		<guid isPermaLink="false">http://notes.dpdx.net/2006/03/17/why-simulating-free-surface-flow-is-difficult-part-2/</guid>
		<description><![CDATA[(This is a continuation of Why Simulating Free-Surface Flow is Difficult, Part 1.)
In Part 1 of this series, I talked about why it&#8217;s difficult to do an accurate computer simulation of a single drop dripping from a faucet.  That&#8217;s a very simple example of a free-surface flow, however, and many of the flows that [...]]]></description>
			<content:encoded><![CDATA[<p>(This is a continuation of <a href="http://notes.dpdx.net/2006/03/03/why-simulating-free-surface-flow-is-difficult-part-1/">Why Simulating Free-Surface Flow is Difficult, Part 1</a>.)</p>
<p>In Part 1 of this series, I talked about why it&#8217;s difficult to do an accurate computer simulation of a single drop dripping from a faucet.  That&#8217;s a very simple example of a free-surface flow, however, and many of the flows that are relevant to other scientific or engineering questions are far more complicated.</p>
<p>One general class of more complicated free-surface flows are &#8220;sprays&#8221;, also referred to as &#8220;spray flows&#8221; or &#8220;atomization&#8221; – a liquid is forced at relatively high pressure through a small nozzle (or set of nozzles), and when it comes out it breaks up into tiny droplets.  Sprays are nearly ubiquitous in any handling of liquids; for instance, in my day-to-day life, I might take a shower in the morning (under a spray of water from the showerhead), wash the shower walls with a cleaner in a spray-bottle, use an aerosol spray can of cooking oil to oil the pan to cook my eggs in, and wash the pan using the spray attachment on my sink.  My car has a fuel-injected engine, which means that there are nozzles in it that spray the fuel into the air intake.  If I were to paint the (sadly rusting) hood on it, I&#8217;d use a spray can.  The train that I take to work has a diesel engine; the term &#8220;diesel&#8221; means that in it the fuel is sprayed directly into the engine&#8217;s cylinder, where it burns immediately as it&#8217;s being sprayed in.</p>
<p>In every one of those cases, it&#8217;s important to get the spray &#8220;right&#8221;.  The shower-cleaner, cooking-oil, and paint sprays need to provide an even coating on the walls without spraying any off to the sides.  The shower head needs to produce rather large drops that act like rain rather than fog.  The fuel injectors in my car need to produce tiny droplets that will evaporate quickly, while the ones on the diesel locomotive need to produce droplets of the right size to get to the middle of the cylinder before they burn up.  Thus, it would be very useful to be able to simulate the spray that comes out of a new nozzle design, so that it can be tested and improved without needing to do costly experiments.</p>
<p>As an example to talk about, here&#8217;s a fairly typical spray that&#8217;s easy to photograph – water being squirted through the nozzle from a <a href="http://www.windex.com/">Windex®</a> bottle.  I should credit my wife for patiently helping me take the picture; it took quite a few tries before I managed to get the flash timed correctly with the spray!</p>
<p><a href="http://images.dpdx.net/notes/2006/03/spray1.jpg"><br />
<img src="http://images.dpdx.net/notes/2006/03/spray1-small.jpg" alt="Water spraying from a Windex-bottle nozzle" class="centered" /><br />
</a><br />
(click on the photo for a larger version)</p>
<p><span id="more-11"></span></p>
<h4>Dilute Parts of a Spray: Lots of Little Droplets</h4>
<p>One of the most obvious complications in simulating a spray like this is the number of drops involved.  There are something on the order of 10,000 shown in this picture, and this is a fairly &#8220;tame&#8221; spray; a diesel-fuel-injector spray will produce millions at a time.  If calculating the behavior of a single drop dripping from a faucet is compilated, this is obviously far, far worse.</p>
<p>This isn&#8217;t quite as complicated as it might seem from that estimation, however.  For at least the left two thirds of the picture, the individual drops aren&#8217;t really doing anything interesting.  Very few of them are breaking apart, and they&#8217;re mostly far enough apart that they&#8217;re not interacting with each other (except indirectly because the overall spray pulls along the air it&#8217;s moving through), and, though it&#8217;s not visible in the picture, they&#8217;ve pretty much all settled down to being nearly spherical.  This part of the spray, where the drops are widely spaced apart so that they aren&#8217;t interacting with each other, is known as the &#8220;dilute region&#8221;.</p>
<p>That means that, for most of the dilute region, we don&#8217;t need very much information about a drop to know what it&#8217;s doing; if we know the size of the droplet and its velocity, it&#8217;s a reasonable approximation to say that it&#8217;s doing exactly the same thing as any other droplet of that size with the same airspeed.  And that&#8217;s much easier to calculate than trying to track all of the individual details of where each point on the surface of each drop is.</p>
<p>Even when the drops are breaking apart – and sometimes they do, if they&#8217;re large enough and are going fast enough – they break apart in ways that don&#8217;t differ very much from drop to drop, and so it&#8217;s possible to approximate that by applying a statistical distribution that converts some fraction of the drops (depending on their velocity and size) into multiple smaller drops.</p>
<p>So, for the 10,000 drops of this spray, that reduces the calculation of the dilute region of the spray to something that could run on a desktop computer in a day or so.  But even that&#8217;s a fairly long time, particularly if we want to simulate something with millions of drops.  For those, there&#8217;s yet another simplification that we can make – with that many drops, we can start grouping them into &#8220;packets&#8221;; near a given spot in the middle of the spray, there are perhaps a hundred tiny drops that all have nearly the same diameter and nearly the same airspeed, and so there&#8217;s no reason to do a calculation for each one of them individually; we could just do the calculation once and say that they all do approximately the same thing.</p>
<p>There is, of course, the question of how good these approximations actually are in practice.  This obviously depends on the details of how one does it and of the spray that one&#8217;s simulating, but it turns out that it&#8217;s possible to get quite good results for simulations of the dilute region of most sprays with this sort of method.</p>
<h4>The Nozzle: The Other (Relatively) Easy Bit</h4>
<p>The other part of the spray that&#8217;s relatively easy to simulate is the flow inside the nozzle and just outside it for the first half-millimeter or so.  In this part, the surface is not doing anything especially interesting, and so it&#8217;s entirely possible to track all of the details of its motion in a simulation that could be run on a desktop computer in a few hours.</p>
<h4>Dense Parts of a Spray: What About the Rest of It?</h4>
<p>That, then, takes care of the spray in the left-hand two thirds of the image, and the first tiny bit coming out of the nozzle.  The alert reader will have noticed that this leaves quite a significant portion of the spray undiscussed!  This is where things get tricky.  In this region of the spray, known as the &#8220;dense region&#8221; because the drops are sufficiently close together to affect each other directly, there are still too many drops and too much going on to simulate all of the details of the surface motion, but the process of the water breaking apart into droplets is far too complicated to accurately approximate as the motion of independent spheres.</p>
<p>This region is one of the biggest reasons why simulating free-surface flows that are of interest in engineering problems is difficult.  At present, it&#8217;s an unsolved problem.</p>
<p>One common way to deal with the dense region is to simply take the independent-spherical-drops approximation from the dilute region, and continue it all the way up to the nozzle.  The drops in the simulation are created at the nozzle in such a way that, when they get downstream to the edge of the dilute region, they match some experimental data for the distribution of real drops there.  How good is this approximation?  It&#8217;s not really clear; it works fairly well for cases where the dilute region is the only part that&#8217;s important (though it&#8217;s not completely clear how true that is in most interesting sprays), but of course it&#8217;s only applicable in cases where there&#8217;s good experimental data to start with.</p>
<p>Meanwhile, there are ways to do approximations working from the upstream end.  If you look at the spray as it comes out of the nozzle, it&#8217;s (roughly) a conical sheet.  To a rough approximation, this conical sheet first breaks up into rings, and the rings then break up into drops.  (That&#8217;s a very rough approximation for this spray; it&#8217;s a bit clearer in some with more precise nozzles.)  By assuming that these processes can be separated and calculated independently, it&#8217;s possible to get mathematical models for how quickly the sheet breaks apart and what size drops are produced, and these tend to be reasonable as a very rough guess for the actual drop distribution.</p>
<p>So, at present, there are two big remaining problems.  One of the problems is that the existing sets of approximations don&#8217;t really meet in the middle; there is a part of the dense region after the calculations of the initial exit from the nozzle have done what they can accurately do, and before the independent-drop approximations of the dilute region are accurate.  The second problem, even if we solve the first problem, is that the computational methods corresponding to these two sets of approximations are very different, and it&#8217;s not clear how to combine them in the same simulation in a way that&#8217;s mathematically consistent.</p>
<p>The research that I&#8217;m doing for my dissertation is something to address a tiny piece of both of those two problems.  It won&#8217;t solve them – not by a long shot – but it&#8217;s a small step up the hill.</p>
]]></content:encoded>
			<wfw:commentRss>http://notes.dpdx.net/2006/03/17/why-simulating-free-surface-flow-is-difficult-part-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
