Any Squeakers into CFD? - Possible job...

Paul D. Fernhout pdfernhout at kurtz-fernhout.com
Wed Feb 13 01:27:48 UTC 2008


Dan-

Cool wave tank video.

This existing Java applet is maybe not as fancy as you want eventually, but
check out this link for a ripple tank simulator for what is easily possible
if you are willing to just have a non-particle meshwork ripple model at first:
  http://www.falstad.com/ripple/
"This java applet is a simulation of a ripple tank. It demonstrates waves in
two dimensions, including such wave phenomena as interference, diffraction
(single slit, double slit, etc.), refraction, resonance, phased arrays, and
the Doppler effect. To get started with the applet, just go through the
items in the Setup menu in the upper right. You can also draw on the screen
with the mouse. The predefined setups are just starting points; you can
modify the sources and walls as you desire. Click the 3-D View checkbox to
see a 3-D view. "

The code is there too in Java, but only for two dimensions (shore waves do
some funky circular particle rolling thing I think, if you want to be really
accurate).
  http://en.wikipedia.org/wiki/Ocean_surface_wave
(that links to a simpler wave applet, by the way).

It should not be that hard for someone like you to translate that "ripple"
WaveBox applet to Smalltalk. Only about 1700 lines:
  ~/downloaded_files$ wc WaveBox.java
   1693  5881 48302 WaveBox.java
It's a surprisingly complex applet as far as the GUI, so way more than half
of the code seems related to the GUI and the drawing. From a casual glance
at it, I'm guessing the core part is, as you say, only a few pages of code,
mostly towards the end. There is no license statement in the file though. :-(

>From the start of the source file:
// WaveBox.java (c) 2001 by Paul Falstad, www.falstad.com.
// Rendering algorithm in this applet is based on the description of
// the algorithm used in Atom in a Box by Dean Dauger (www.dauger.com).
// We raytrace through a 3-d dataset, sampling a number of points and
// integrating over them using Simpson's rule.
(So, not much on the wave part, and no other detailed comments in the file).

Anyway, this sort of numerically oriented wave library is exactly the kind
of thing you might want to code in Smalltalk and then translate to Scala to
run on the JVM. It would only go 1/2 to 1/3 of native C or Fortran speeds
probably, but it would be run fast everywhere Squeak/JVM would run. Or
course, having the JVM set up right is a hassle.  Or, of course, you could
write is such that Slang could translate part of it to C. But running that
code everywhere might be harder.

This example makes me think it might be nice to have a Java->Smalltalk
translator as well as a Smalltalk->Java/Scala one as part of a Squeak/JVM,
because there sure is a lot of Java code out there of educational interest.
(Too bad Jim Spohrer's EOE educaitonal Java applet directory site seems not
to be up these days, last I looked.)

--Paul Fernhout

Dan Ingalls wrote:
>> ... that's Computational Fluid Dynamics.  I'm specifically interested
>> in running a Navier-Stokes simulation using something like the Volume
>> of Fluid model to deal with free surface movement.  My first goal is to
>> be able to duplicate something like the following simulation of a
>> breaking wave:
>> 
>> http://www.coastal.udel.edu/faculty/jpuleo/RIPPLE/ripple.mov
>> 
>> I want to be able to run similar simulations for waves breaking against
>> different shaped walls.
>> 
>> Most people use big programs in C or Fortran (!), and half the trouble
>> is learning how to use them, since there's no prayer of changing them.
>> However the basic equations can be written in half a page, and I don't
>> need it to run very fast.
>> 
>> It could be fun but so far it looks like it will be simpler to build a
>> wave tank :-(.
> 
> I'm getting more serious about this.  As a point of reference I did build
> a wave tank...
> 
> http://www.youtube.com/watch?v=joRv6aiST3s
> 
> It's fun to build stuff (and I now have a 300-pound structure in my
> driveway waiting for the next time when the tide is right), but I would
> still like to be able to do some simulations, even if only in 2D at
> first.
> 
> I have a feeling that if one understands the basic equations, plus the
> volume-of-fluid method for the surface and other boundaries (as in
> http://www.math.rug.nl/~veldman/preprints/ECCOMAS2004.pdf), it wouldn't
> take more than a couple of pages of Squeak, and it might even fit the
> StarSqueak or Kedama framework as suggested by Jecel.
> 
> Sadly I have only personal funds to work with at this point  but, if
> someone thought they could duplicate, eg, the little ripple.mov above in
> a few pages of Squeak, I'd pay real money for it, and maybe more for
> future experiments.  Let me know if this appeals to you and perhaps we
> can negotiate some sort of agreement.



More information about the Squeak-dev mailing list