# Aerodynamics

This tutorial will introduce you to Rescale's platform using a basic airfoil design of experiments (DOE) in OpenFOAM.

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.

Post processing visualization of result (using ParaView)

## Description of the Simulation

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 software: OpenFOAM

## Starting up Rescale

• 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:

## 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 sofware. 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:

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:

## 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 Onyx.
• 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:

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:

## Status

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:

## Results

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.