Issue 095 – May 7, 2022

A Cloud CFD Blueprint

Hey there,

It’s Robin from CFD Engine & this is the blueprint for the cloud CFD platform that I never built.

Many moons ago I set out with a “plan” to start a CFD consultancy whose work would inform (& fund) the development of a cloud CFD platform – a “CFD engine” if you will 🙈

Clearly things took a different route & now I’m left with an ill-fitting company name & an unhealthy interest in cloud-based CFD.

The aspiration is still there, but the CFD market, the cloud & my perspectives have changed a lot since that original idea.

So, what would I build (& how would I build it) if I were starting today?

What to build?

First off, I don’t fancy squaring up to SimScale, AirShaper, NablaFlow & Bramble in the “OpenFOAM-based cloud CFD in your browser” dance battle, so let’s take a different path.

You know my shtick, I run OpenFOAM on AWS & have an affinity for command-line tools. So I’d bundle those together & build a command-line app that runs OpenFOAM cases on AWS with minimum fuss.

CFD.Direct from the Cloud is kind-of-almost this, but it’s not really what I’m looking for – it’s a little too manual & I’ve never been convinced about their per-hour software charge 🤔

I’m looking for something more like the user experience you get from web deployment tools like Vercel (or Netlify or Render or Fly) where the main event (in our case running a simulation) can be initiated with a single command & they handle the rest.

How it might work

It all starts with a cross-platform, command-line app – one where deploying a new simulation would just involve navigating to the case directory on your machine & running something like:

cfd deploy -desc "Baseline with a fancy new widget"

If it looks like a valid OpenFOAM case, it would be tarred & zipped in memory & uploaded to AWS S3.

The upload would trigger an AWS Lambda function to submit the case as a job on AWS Batch.

Batch would see the pending job & start a new instance for it. The instance would download the case, unpack it & run the Allrun script (which could also include generating post-pro via headless ParaView &/or other scripted tasks).

Batch would handle terminating the instance once the job was complete, but we’d probably need some middleware (code that lives outside your run script) to handle the nice-to-have bits. Things like logging progress, archiving data & sending you an email/SMS/WhatsApp when it’s all done.

Once complete, you could download the bits you need (including the full-case, if that’s your thing) via the command-line app, using something like…

cfd get R01 -exports -forces -residuals

…and then do whatever you normally do with them 👍

Not for everyone

This assumes that you know what you’re doing with OpenFOAM.

If your case doesn’t work (you mess up your BCs, your mesh is rubbish, you make a typo &/or it diverges) then that’s on you, just like it would be on your local machine.

Conversely, no real AWS knowledge is needed. The app would manage all the resources, but they would be run under your AWS account – no data would leave your account, everything could be encrypted using your own keys & you could choose a preferred regional location. Most importantly, you’d get the bill.

The app could be free to use, perhaps with a Pro tier where, for a monthly fee, it would unlock the option to run on spot instances. These instances are so deeply discounted that this would probably pay for itself in a handful of runs 🤔

Half an idea

So that’s where I’d start – an OpenFOAM batch runner that would take a case & run it on AWS with the minimum of fuss.

I could think of a hundred other features to add, but I reckon that’s roughly what v0.1.0 would look like.

AWS could make the whole thing obsolete with a couple of additions to their existing services, but there might be enough here to get some traction.

You never know, I might prototype it for my own enjoyment & let you know how I get on. It could make for a few interesting emails at the very least.

Let me know what you reckon – I’m always keen to hear your thoughts on anything CFD-related, especially anything cloud-y.

Until next week, stay safe,

Signed Robin K