OpenFOAM DOE Tutorial

This tutorial will introduce you to Rescale’s platform using a basic airfoil design of experiments (DOE) in OpenFOAM followed by post-processing in ParaView.

Please contact us if you’re having trouble.

The analysis here calculates the best lift to drag ratio for an airfoil across a range of airspeeds and angles of attack. In the process, this tutorial will demonstrate some of the post-processing capabilities of Rescale, and show you how to run a parallel process.

Air Foil

Post processing visualization of result (using ParaView)



Duration: Approximately 20 minutes for the tutorial and less than 25 minutes for computation. Alternatively, you can also click the Get Job Results link above, and review the full setup and results for the DOE analysis with OpenFOAM instantly.

The Problem: Calculate lift to drag ratios for a range of angles of attack (AoA) and airspeeds for the NACA 2412 airfoil (cambered 12% thick airfoil)

  • The independent variables are cross products of x_velocity and y_velocity
  • x_velocity: 20 to 30 meters per second with an increment of 1
  • y_velocity: 3 to 6 meters per second with an increment of 1
  • The output is the lift to drag ratio, which is equal to the lift coefficient over the drag coefficient

The Workflow: This tutorial will use a two variable parameter sweep (DOE) and evaluate it over 44 runs. Before running this tutorial, a Matlab script was used to generate the model, which is contained in an .stl file, of a NACA 2412 airfoil with a specific angle of attack. The workflow for this tutorial consists of two parts:

  • Rescale uses a customized template to vary the environmental setting of the wind.
  • OpenFOAM’s simpleFoam generates the steady state solution. This process uses the freestream airspeed and the meshed geometry to calculate the drag and lift coefficients, which the analysis code uses to evaluate the merit function.

Simulation softwareOpenFOAM

  • To start using Rescale, go to platform.rescale.com and log in using your account information. Using Rescale requires no download or implementation of additional software. Rescale is browser-based, which allows you to securely access your analyses from your work station or from your home computer.
  • From the main screen of the platform, click on the +New Job button at the top left corner of your screen. This will take you to a Setup page.
  • The first step is to use the Job Type drop-down menu to select DOE.
  • There are now seven Setup stages to complete.

Setup: Input File(s)

First, you need to give the job a name. Since Rescale saves all your jobs, we recommend you to choose a unique name that will help you to identify it later. (For example, Tutorial 1: OpenFOAM DOE). To change the name of your project, click on the pencil next to the current job name in the top left corner of the window.

Next upload the zip file airfoil2D_DOE.zip by clicking on the Choose File button.

On completion of this step, the Input Files setup page should look like that shown below.

Setup: Parallel Settings

To implement your parallel process, click on the Parallel Settings button to add a parallel process to your analysis. Here, you have two options to set the parameters for your analysis. You can either upload a CSV file with all of the information (Use a run definition file), or you can add the variables manually into Rescale using the Specify your variables here option. For this tutorial, select the Specify your variables here option.

Next, make sure the Cross Product radio button is selected, and then add two variables.

The first variable should be x_velocity, with a min value of 20, a max value of 30, and an increment of 1.

The second variable should be y_velocity, with a min value of 3, a max value of 6, and an increment of 1.

When finished, your Parallel Settings screen should look like this:

Setup: Templates

Move on to the Templates setup stage by clicking on the Templates icon.

In the Specify Templates section, you can upload any files that you will need for running this analysis.

Templates are input files that change with each run. These templates will use the variables you have already assigned, x and y velocities, to evaluate the lift to drag ratio. For our analysis, you will be uploading a template for this job. To do this, click on the Choose File button and upload the following template:

U.inp_template

Set the Processed Filename to:

airfoil2D_DOE/0/U

Your Templates setup stage should look like this:

Templates

Setup: Software Settings

Click Next to move on to the Software Settings section of the analysis. Now, you need to select the software module you want to use for your analysis. You can scroll down or use the search bar to search for a software. For this demo, scroll down and click on OpenFOAM.

Next, the Analysis Options must be set.

  • The drop-down selector allows users to choose their preferred version of OpenFOAM.
  • The input files used in this tutorial were tested with OpenFOAM version 17.06+, so select that option.

Next, you need to add the analysis execution command for your project. This is a command specific for each software package and each input file being used. For this input file and OpenFOAM, the execution command is shown below:

cd airfoil2D_DOE./Allrun

This should be the same command as what you would otherwise use on the local terminal.

On completion, the Software Settings page should look like that below:

Software Settings

Setup: Hardware Settings

Now that you have chosen the analysis code you want to use, the next step is to select the desired computing hardware for the job. Click on the Hardware Settings icon.

  • On this page, you must select your desired Core Type and how many cores you want to use for this job. A “core” is a virtualized computing unit, with each core representing a single core from a physical computer. For this demo, select Emerald.
  • The Number of Cores / Slot should be set to 1, since we want to execute each child run of this DOE job on a single core.
  • The Number of Task Slots represents how many parallel executions of the DOE tasks will take place. In this case, select Number of Task Slots to be 1.

Your Hardware Setting screen should look like this:

Setup: Post Processing

Move on to the Post Processing screen by clicking the Post Processing icon. For this demo, we will add some post-processing to visualize the analysis. Click on the Choose File button and upload the file extract.py file that you downloaded earlier.

You also need to enter the command required to run the post-processing script. For this analysis, add the following command:

python extract.py airfoil2D_DOE/log.simpleFoam Cd Cl

This post-processing script is executed at the end of every run and extracts the lift and drag coefficients from the OpenFOAM output files. Further information for working with post-processing scripts is available here

Your completed Post Processing screen should look like this:

Setup: Review

Finally, move to the Review stage of Setup and check that the setup is correct by reviewing the DOE Job Summary table. It should look like that below:

Review

Now you can monitor the progress of your job from the Status tab. To run your job, Rescale boots the cluster as you defined it, runs the simulation, and shuts down the cluster immediately upon completion. The entire process is completely automated and secure, and requires no further input from the user. The whole analysis should take less than thirty minutes.

While your analysis is running, you have the ability to follow its progress in real-time using Rescale’s live tailing feature. Live tailing allows you to pick individual runs, and look at the executing code to assess if the analysis is running correctly.

To use live tailing, move your mouse down to the Live Tailing section and click on an active run in the Runs list. Once you have selected an active run, a list of files should appear in the second box. If you pick any of these files, you will see a real-time rendering of what that file is doing. You can look at up to 5000 lines at the same time, and pressing Refresh will give you the most up-to-date activity in the analysis.

The Status window with live tailing will look like that shown below:

Live Tailing

The Results tab shows all the resulting files that are associated with your job. Given that some analyses result in many output files, Rescale gives you the option to download all files simultaneously or individually as needed.

As individual runs complete, the results show up on this page. Click on Refresh Results to show all of the completed results, and then click on Download to download your files. Note that if you click on Download before the Status page shows Cluster stopped in the Job Log section, then you may download a zip file containing data for only some of the runs.

Here is a screenshot of the Results page as the job is running; information for each individual run will get added to the table as they complete:

Results

Additionally, Rescale has the capability to display this data in charts before the user downloads the data. The Charts tab will bring you to a graphical representation of the data that resulted from the analysis. You can experiment with different configurations of the variables to get an idea of how the data looks.

An example chart is shown below:

Charts

The Rescale “Design of Experiments” (DOE) job type allows you to specify your runs and variables by means of these options:

  • Use a Run Definition File (CSV): each row is a case – also known as a run or Child Run
  • Specify your variables here: variable ranges are specified in your browser

Each of these options provides flexibility in how the variables you specify get transformed for use as input to each run of the DOE. This is done by means of template variable formatting.

Template files contain references to the variables that get substituted, at run- time, with values applicable to each Child Run. The basic placeholder for a variable, such as “x”, in a template file looks like this:

${x}

If you use this syntax and specify your variables in a CSV file, then we will replace the placeholder with the value from your CSV without any modification. This is useful if the simulation code you are using has fixed-width text input files. This can be also useful if you would like to include non-numeric data in a file specific to that case. For example, you might include a description of each case as a comment in an input file, which may be more meaningful than the identifier we automatically assign to that case. So if your CSV looks like this:

description, v, zcase 1a, 2.2, 3.4case 1b, 2.3, 3.4case 2a, 3.1, 3.2

And your input file template looks like this:

# ${description} vel: ${v}z: ${z}

Then the processed template for the first case would look like this:

# case 1a vel: 2.2z: 3.4

You may prefer to have a specific consistent number format in the file, regardless of how the variable was specified in the CSV or how you specified it in the browser. For this situation, you can supply an additional format instruction, using a “0” or “#” for a digit, where trailing zeros are absent if the “#” symbol is used. Here are some examples:

x${x?string(“0”)}${x?string(“0.0”)}${x?string(“0.00##”)}
0.910.90.90
1.4911.51.49
-55.123-55-55.1-55.123
981098109810.09810.00

Notice that when the format string has fewer digits to the right of the decimal place than the value, then the value will be rounded accordingly. Scientific notation can be used as shown below:

x${x?string(“0E0”)}${x?string(“000E00”)}${x?string(“0.0## E0”)}
0.99E-190E-029.0E-1
1.491E015E-011.49E0
-55.123-6E1-55E00-5.512E1
98101E498E029.81E3