Freesteel Blog » Atmospheric Large Eddy Simulation

Atmospheric Large Eddy Simulation

Friday, December 15th, 2017 at 6:48 pm Written by:

If I don’t blog it, it hasn’t happened. I have been forgetting this fact.

Yesterday I had a minor breakthrough.

For years I’d been seeing beautiful videos of simulated cloud convection online, but was never able to run them myself in order to look at the data.

The structure of thermals has been a long-term mystery to me, and I’ve noticed that some pilots seem to be able to navigate through and climb these invisible things quite reliably, yet are not able to explain how they do it. They are in the dark just as much as I am, yet they have — probably by luck (plus the necessary skill to recognize and lock it in) — struck upon the combinations of responses to inputs and gut senses that just happens to pay off spectacularly.

My gut feelings and responses to inputs don’t always work out so well because my imaginations of the air are probably too logical, incorrect and counter-productive and they require resetting and retraining to break free from their false notions.

So I’ve decided that it has got to help me if I can see what is going on, and not carry on wondering whether thermals are columns or vortex donuts, are surrounded by sinking air or tailwind incoming air, are observably warmer than their surroundings or mere upward kinetic energy.

So this time I tried harder to get to the simulation code when I had the time.

I am now pretty sure that the code for the GPU-resident Atmospheric Large-Eddy Simulation (GALES) is unpublished.

However, I did eventually establish from one of the papers that GALES is based on DALES — the Dutch Atmospheric Large-Eddy Simulation where it said the code was to be found at the broken link Fortunately it does exist at

This divulged a pile of Fortran90 code and a CMake script, and I was able to build it and run it against the cblstrong case example.

This eventually (after heating up my computer’s CPU) dumped out a file called initd03h00mx000y000.001 written by the function modstartup.f90 writerestartfiles with lines like:

write(ifoutput) (((u0 (i,j,k),i=2-ih,i1+ih),j=2-jh,j1+jh),k=1,k1)
write(ifoutput)  (((v0 (i,j,k),i=2-ih,i1+ih),j=2-jh,j1+jh),k=1,k1)
write(ifoutput)  (((w0    (i,j,k),i=2-ih,i1+ih),j=2-jh,j1+jh),k=1,k1)
write(ifoutput) (((thl0 (i,j,k),i=2-ih,i1+ih),j=2-jh,j1+jh),k=1,k1)

By the power of Python I used the module to read the velocity component records like so:

ku = f.read_record(dtype="f8")
kv = f.read_record(dtype="f8")
kw = f.read_record(dtype="f8")

and determine that the number of double-float values in each array record came to 475300. Of course you can immediately tell that this factorizes into 50*70*70, so that the 3-dimensional array of vertical components of air velocity can be stated as:

kkw = numpy.resize(kw, (50,70,70))

Thus this is plotted slice-wise at a constant altitude by:


to make a familiar image of computer generated thermals seen in past papers:

I didn’t stop there, and generated the following video of a melt through from the bottom to the top with black arrows denoting the horizontal wind components:

using the code:

cmdstring = ('ffmpeg','-r', '5','-f','image2pipe','-vcodec', 'png', 
             '-i', 'pipe:', "testA.avi")
p = subprocess.Popen(cmdstring, stdin=subprocess.PIPE)
X, Y = numpy.mgrid[0:70, 0:70]
for ik in range(1,50,1):
    plt.figure(figsize=(11,11), frameon=False)
    Q = plt.quiver(X, Y, kku[ik,:,:], kkv[ik,:,:], color="black", headlength=4, headwidth=2)
    plt.imshow(kkw[ik,:,:], cmap=plt.get_cmap("coolwarm"), vmin=-5, vmax=5, interpolation="bilinear")
    plt.title("zslice %d" % ik)
    plt.savefig(p.stdin, format='png', pad_inches=0.0, bbox_inches='tight')

Boy have I wasted a lot of time on this so far, and I’ve got to do some other things while I catch up on some Basic Lessons on CFD (Computational Fluid Dynamics). It can only help to have some background knowledge of the field.

The next step will be to investigate how to program the initial boundary conditions and setup to create a single idealized thermal, which is an evolutionary structure in time and space that a glider like mine might encounter. And while a glider is flying and circling and climbing in it, the thermal is evolving, so your experience can only be expressed as a slice that runs like a diagonal corkscrew through the spacetime continuum fluid in four dimensions.

There’s no way this is ever going to make sense, but if it challenges my intuition to break out into another state where the flight of my wings flows through the air better, then it will have certainly worked for me.

Leave a comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <blockquote cite=""> <code> <em> <strong>