Monday, October 8, 2012

OpenFoam on Google Compute Engine

I signed up for the free preview of Google Compute Engine. The project I described in their questionaire was basically just some hobby-level CFD stuff, so I am surprised they sent me an invite. This post provides links to the initial setup documentation and getting started tutorials, and describes getting OpenFoam up and running on an instance.

Once gcutil is installed this initializes the project:

gcutil getproject --project_id=varconcfd --cache_flag_values
which should give output looking something like this: An instance is added like this:

$ gcutil addinstance my-first-instance --wait_until_running Status check like this:

$ gcutil getinstance my-first-instance should give output something like this:

The default instance runs a recent version of Ubuntu (they also have CentOS 6 images available as well) so you can use the standard distribution package management tools to update and install programs.

The instance can be deleted with:

gcutil deleteinstance my-first-instance

Log in to a running instance with:

gcutil ssh my-first-instance

I followed the instructions for installing OpenFoam on Ubuntu from the OpenFoam site.

Once the user configuration is complete a simple test confirms things are installed and configured correctly.

The configuration can be saved to a custom image for later use using the tool that is installed on the default images.
sudo python /usr/share/imagebundle/ \
-r / -o /tmp/ --log_file=/tmp/abc.log

The image must be stored on Google Cloud Storage (this requires billing to be set up):

gsutil cp /tmp/4860e52466c0646558e252326e43db11cadac7c3.image.tar.gz gs://varconcfd

Then log out of the instance and add the image to the project.

gcutil addimage openfoamimage gs://varconcfd/4860e52466c0646558e252326e43db11cadac7c3.image.tar.gz --project_id=varconcfd

Once this is done then new instances can be initialized with the custom image.

gcutil addinstance --image=openfoamimage mynewinstance --project_id=varconcfd

Ready to run!


  1. Most commercial analysis software licenses are incompatible with the future: CFD Experiment, old vendors trying to learn new tricks.

  2. CFD vendors are going to need to come to grips with the licensing problem to reach "internet scale" heights:
    CAE Watch reports (shengwei, 31 Dec 2012) Cloud computing is not new for CFD. But major CFD software vendors are not interested in this area because of the business models (licensing) in this industry.