Reading Time: 60 min
Simulation Time: 25 s
Simulation Cost: 0.4
Target audience: new-to-CFD and new-to-Luminary
In this Tutorial
Welcome to this introductory Tutorial on running the NACA 0012 airfoil in Luminary! This exercise will cover many of the basic principles when setting up a simulation, including:
defining simulation setup, i.e., the physical problem being modeled (boundary conditions, solver settings, etc)
using a "farfield" boundary condition for external aerodynamics
customizing simulation controls (stopping conditions)
defining Frames to specify forces & moments
the Setup Summary
visualizing the resulting flow field
By the end you will be able to produce this result:
Background
The NACA 0012 is one of the standard airfoils developed by the U.S. National Advisory Committee for Aeronautics (NACA - NASA's precursor) in the 1920s and 1930s. This is one of the "four digit airfoils", where the first digit specifies the airfoil's maximum camber, the second digit the position of that maximum camber, and the last two digits the maximum thickness. Thus the digits 0012 define an airfoil that is symmetrical with a maximum thickness equal to 12% of its chord length. This four digit recipe can be used to understand any NACA XXXX airfoil you come across.
In this Tutorial we will start by creating a new Project and importing a mesh file. This workflow is representative of how many CFD practitioners may use Luminary: importing meshes they've already created for other CFD codes and running those cases in Luminary to assess accuracy and performance. Starting a Project from CAD geometry models and subsequent mesh generation are covered in subsequent Tutorials.
The provided mesh is a quasi-2D mesh: the domain is only one-cell thick. Luminary is a fully 3D solver, and does not support formally 2D grids; such meshes must be "extruded" or thickened into a 3D mesh before importing into Luminary. Obviously, real airfoils are not infinitely thin, however these 2D domains are computationally cheap to evaluate and are often leveraged in the conceptual design of wing cross-sections.
Let's Get Started
In Luminary open your Projects tab and click New Project. Browse and click the "NACA 0012: 2D Airfoil" Sample Project to create a new Project where you will run this Tutorial.
Explore the Geometry
One of the most important things when running CFD (and Computer Aided Engineering more broadly) is fully understanding the geometry model you are working with. Especially when you are not the one who created the geometry, a critical first step is familiarizing yourself with what you have.
In addition to learning the basics of the 3D View mouse and keyboard controls, several important properties of the model to be aware of are Surface names and Volume names. These names are relied on for assigning simulation parameters, so knowing what they refer to is critical to setting up the case correctly.
The available surfaces are shown here, where the other surfaces are semi-transparent:
and the mesh cell topology in the vicinity of the airfoil is visualized below (+Z view):
Because we have imported the mesh, and did not generate it within Luminary, there is no editing of the mesh we can perform. Also, note that the airfoil lies flat along the X axis, so to impose an angle-of-attack we must do this through our boundary conditions.
Simulation Setup
Note: optionally skip this step
if you do not want to manually input all of the following values, you can download the following *.json file, which is a Luminary settings file:
You can upload the settings file via the three-dot button (...) and select Upload Settings and point to this json file. This will automatically populate the relevant settings from the json content.
A Guided Workflow
A Progression
When setting up a case for the first time, the UI will walk users through a guided workflow (see the top navigation tabs): Physics assignments, Outputs (diagnostics to instrument), and Solver settings. Within each of these major tabs will be specific items to fill in to define the simulation, presented as a checklist (right side of screen).
For Projects where you import CAD geometry models, additional tabs related to Geometry manipulation and Mesh generation will be visible.
Interface Notifications
In the image above you'll see indicator dots (red icons) over several items. These indicate items that require additional definition or assignment. By hovering over the red-dots (red for Simulation-impeding issues, yellow if simply a warning) you will see a tooltip that describes what action to take.
An additional area to view incomplete workflow tasks is along the bottom tray in the Simulation Issues tab. Click on this to expand the tray and see a list and description of the incomplete items.
Luminary's Flow
Though users can input values in any order they wish, there is a motivation for the particular ordering of inputs for Luminary. Because the order may differ from traditional CFD tools, it is worth describing here.
As much as possible we want to automate and assist users where we can. The more knowledge about the physics setup and problem being simulated, the more intelligent suggestions and automations we can embed into the UI. An example that is relevant in this tutorial is: by knowing Output quantities of relevance to you (defined in Outputs tab) we can leverage them in how we customize the behavior of the Solver (e.g., stop the simulation when a target accuracy in my Output has been reached). Another example, though not relevant to this tutorial, is that physics settings can be used to intelligently inform the mesh generation process. This is why much of the physical description of the problem is front-loaded in the workflow.
Physics Tab
Materials
We need to know what material is going to be simulated, i.e., what fluid will be flowing over the airfoil. For any new Project there will be a default Material defined (Standard Air). This is suitable for our simulation, but if you wanted to adjust the properties of the material you can do so by clicking it in the Physics Checklist and updating any properties in the panel that appears.
Action: none - use default material
Physics
Unless you are running a multi-physics simulation (e.g., conjugate heat transfer), you will generally need only a single Physics to be defined. This is similar conceptually to specifying what kind of simulation capabilities do you need: fluid dynamics, solid conduction, multiphase flows, etc.
New Projects will have a Fluid Physics created by default. By clicking on the Physics node ("Fluid Physics") you can adjust properties of the fluid dynamics solver. We have built a series of preset settings that allow users to choose an acceptable level of robustness vs. accuracy, see the Spatial Discretization and Solution Controls drop-downs under Advanced Solver Settings.
Actions
choose RANS from Viscous Model dropdown
select the Spalart-Allmaras model from the Turbulence dropdown
ensure the Default presets are selected for Spatial Discretization and Solution Controls under Advanced Solver Settings
For CFD uses who want to get into the guts of the solver's behavior, use the Customize link in the Advanced Solver Settings to have fine grained control over a variety of numerical properties and parameters.
Volume Selection
After the Physics properties, the next step is to ensure the appropriate volumes have been assigned to this Physics. This effectively states what Volumes are participating in the solution, i.e., where will this particular Physics be active within the simulation domain. By default all Volumes will have been assigned to this Physics.
Action: none - volume already assigned to Fluid Flow physics by default
Boundary Conditions (BCs)
Often the most important settings to make sure are specified correctly are the Boundary Conditions. These determine the behavior of the fluid at the boundaries of the simulation domain.
Symmetry
Because this simulation is 2D, we do not want the large circular side-walls (z_plus and z_minus surfaces) to effect the fluid. This can be achieved by assigning them to a Symmetry boundary condition. The fluid essentially sees these surfaces as a mirror, as if fluid with the same properties (velocity, temperature, pressure, etc) exists on the other side.
Action
create a Symmetry BC using the "+" icon next to Boundary Conditions
assign the "z_minus" and "z_plus" surfaces to this BC
An alternative option would have been to make these surfaces a Periodic Pair, though that boundary behavior is beyond the scope of this tutorial. Because this simulation is a single cell thick, there should be no difference between the periodic and symmetry approaches.
Wall
We assign any solid surfaces to this boundary type, which means the Airfoil walls. Depending on the type of simulation being performed, different options will be available in the Momentum drop-down. Generally you will assign the wall to be "No Slip", which is the physically accurate representation (the air slows down to zero-velocity as it approaches the wall).
Action
create a Wall BC using the "+" icon next to Boundary Conditions
assign the "airfoil" surface to this BC
There are other parameters available to adjust how the wall behaves physically, e.g., introducing Wall Roughness, but are outside the scope of this Tutorial.
Farfield
The Farfield boundary is one common in aerospace applications, and is best used when an object is moving through a uniform medium. To work effectively, the surfaces of this boundary condition must be far from the vehicle/object being simulated - sufficiently far that any recirculation or slight aerodynamic effect of the object is not "felt" at the boundary. As a rule of thumb, it should be 50-100X the largest characteristic length away from the object, for example vehicle length, but many organization may make this even larger.
We want the flow to have an angle of attack of 1.25 degrees relative to the airfoil. To specify this simply we can use the Flow Direction controls within the Far-field definition.
Action
create a Farfield BC using the "+" icon next to Boundary Conditions
assign the "farfield" surface to this BC
Assign
Static Pressure: 101,325 Pa
Mach Number: 0.8
Temperature 273.15 K
choose Flow Angles for the Flow Direction dropdown. This will allow us to specify the angle-of-attack as an input field
Angle of Attack to 1.25 degrees
Initialization
Boundary conditions define how the fluid at the boundaries of the volumes behave; the Initialization is used to define the state of the fluid within the Volumes when the simulation begins. The fluid within the Volumes will update and evolve as the simulation proceeds, but a state is required to define the initial condition of the fluid.
Though it may not be intuitive for new-to-CFD users, simulation robustness and even accuracy can depend on the physics appropriateness of the initial condition, so it is not necessarily a trivial aspect of the setup.
There are three primary options to define the initial condition of the fluid:
Uniform Values
specify spatially uniform values of the fluid stateFarfield Values
take the properties defined at the Farfield boundary condition (must exist in the simulation)Existing Simulation
interpolate from an existing simulation within the Project (may be on a different mesh)
Because we are using a Farfield boundary condition, we can leverage the Farfield initialization. This ensures two things that are important:
at the first iteration of the solver, the state described at the boundary and inside the volume is consistent. This is important for robustness during the initial stages of the simulation.
If we change properties of the Farfield boundary condition, the Initialization will automatically update accordingly. If instead we used Uniform Values, we would have to update those properties both in the Boundary Condition as well as the Initialization nodes.
This requires us to define an appropriate Body Frame, see the Frames & Motion section below.
Equations
The turbulence modeling approach we will use for this case is the RANS approach, which will solve for the time-averaged statistically stationary flow. A broader discussion of choosing the transient behavior of the solver and specific turbulence model choices is outside the scope of this Tutorial.
Frames & Motion
Frames are shorthand for Reference Frames in Luminary. Any time a reference frame that is different from the global coordinate system is desired, this mechanism should be used. This is true for establishing moving simulation domains, walls that behave as if they are moving surfaces, or for computing forces in geometry-aligned coordinate systems.
Action
create a Body Frame using the "+" button next to the Frames & Motion node
the origin should be at (0,0,0)
the orientation should be defined as (-90,0,180)
Now we can move on to the next stage of Simulation Setup: Outputs.
Outputs Tab
Outputs are any quantities that you want to have evaluated while the Simulation is running, effectively monitors or diagnostics that will be evaluated as the simulation evolves.
Default Behavior
By default, the solver will export several quantities each iteration. This includes area or volume integrated scalar outputs on all surfaces, volumes, and monitor planes. Data at monitor points will also be evaluated every iteration, as well as solution residuals.
The benefit of this default behavior is that any manipulation of this data can be accessed while the simulation is running or even once the simulation is complete. This alleviates the need to exhaustively setup diagnostics before the simulation - you can often simply add additional Outputs after-the-fact if you want to see them.
This does require that Monitor Points and Monitor Planes of interest be defined before the simulation (which can be added by clicking the "+" icon in the Geometry tree); the data per-surface and per-volume will be written automatically.
Iterations per output
There are several larger data files which are not automatically written every iteration, namely Surface Solution files and Volume Solution files. The interval for writing these is specified by the Iterations per output field.
Action: set Iterations per output to 1000
Outputs
Once a simulation is running, any Outputs that have been defined here will be available for charting vs time/iteration. The motivation for defining these properties now, even though many can be setup after-the-fact (as discussed above), is that they can be used as a "stopping condition" for the solver. This means that the solver can stop based on statistical properties of these values, e.g., stop the simulation when the value of Lift (a surface Output) is no longer varying largely.
Outputs can be defined for different data topologies, where Surface and Volume Outputs are area or volume-weighted integrated quantities, respectively. Point Outputs are data at specific locations in 3D space. Custom Outputs allow you to create mathematical expressions of the existing Outputs - a mechanism to define your own diagnostics of interest.
Let's create an Output for Lift just to see how this mechanism works.
Action:
click "+" next to Outputs and add a Surface output
select "Lift (N)" as the quantity
make sure "Body Frame" is selected as the Reference Frame
assign the Surface "airfoil" to this Output
Now we can move on to the final tab of the guided workflow: Solver.
Solver Tab
In this Tab you will find the interface to adjust parameters of the solver. These are largely the same settings exposed in the Physics Tab -> Physics node.
Solver Settings
We have built a series of preset settings that allow users to choose an acceptable level of robustness vs. accuracy.
Action: ensure "Default" is selected for both Spatial Discretization and Solution Controls
Advanced Solver Settings
For CFD uses who want to get into the guts of the solver's behavior, use the Customize link to have fine grained control over a variety of numerical properties and parameters.
Stopping Conditions
General
In this node we define the metrics that will cause the simulation to exit cleanly. The most common one to specify is Max Iterations, which is the number of iterative solves the solver will perform.
In general for RANS simulations, this should no less than ~1000 iterations, but the specific value need to get to a converged solution will depend greatly by case and numerical settings. It is good to set a conservative value (high number of iterations) and achieve convergence, as opposed to run too few iterations and have a partially-converged result.
Action: set Max Iterations to 2000
Conditions
At the bottom of this panel you can add additional stopping conditions based on the defined Outputs. As can be seen above, because we created a "Lift" Output in the previous step, we can define a stopping criterion based on the convergence in the magnitude of Lift (in addition to criteria based on the residual convergence).
Action: none necessary
Running The Simulation
Once all the checklist items are green, your case setup should be valid. Because the mesh has already been built (on import), the Run Simulation button in the upper right should be clearly visible, highlighted in purple, and ready to be clicked - so go ahead!
Setup Summary
Before you run the simulation, you are presented with the Setup Summary modal. This is a single view where you can confirm the correctness of your inputs for the Simulation. This is a quick "glanceable" view, that avoids having to re-navigate the Tabs and Checklist nodes to double check the inputs:
If you don't want this panel to appear every time you click Run Simulation, you can choose dismiss it (takes affect across all of your Projects).
Run Status Panel
Once you finally click Run Simulation from the Setup Summary the job will be submitted to the Luminary platform. Congratulations!
Now things get easy. The appropriate sized resource will be allocated on your behalf and the job will run asynchronously when those resources are ready. You'll now enter a Results Tab view for this particular simulation. Because the job is running asynchronously, you can leave this project or close the tab - these actions will not terminate the job.
When you have run multiple simulations within a project, you can click on the "All Results" tab to view a tabulated list of all the past simulations in this Project.
As the simulation is running, status will be updated in the Run Status panel on the left. Additionally, when the simulation has started the data displayed in the Output Chart in the bottom tray will update. You can choose what Output values to monitor here, and also use this interface to move through available solutions (iterations).
Post-processing
While the job is either running or when complete, the main actions you will likely perform are extracting information from the results. Below we describe a few of the visualization tools available.
Slice
Click the Slice icon in the visualization toolbar and select Slice.
In the properties panel, set the Visualization options to:
Origin: 0, 0, 0.5
Normal: 0, 0, 1
Click the check button to create the slice.
Click the Zoom to Fit button at the bottom of the 3D Viewer to see the entire domain. It's difficult to view the flow features around the airfoil, so use the clip tool to only look at the area near the airfoil.
Clip
In the Geometry panel, hide the airfoil, farfield, z_minus and z_plus surfaces. You'll only be left with the slice.
Next, create the clip:
Ensure the previous slice is currently selected in the Visualization section of the control panel.
Click the Clip icon in the visualization toolbar.
In the properties panel, set the Display options to:
Color By: Pressure (Pa)
Representation: Surface
In the Visualization Input options set:
Clip Type: Box
Box Center: 0, 0, 0.5
Length: 4, 3, 2
Rotation: 0, 0, 0
Click the check button to create the clip.
Set the camera view to the -Z direction and click Zoom to Fit, you should see only the area around the airfoil, as shown below.
What Next?
Here are a few options that are natural extensions of this Tutorial.
You could continue with this NACA 0012 Project and learn how to adjust a few parameters and run your next simulation within this Project. You'll also learn about the Design of Experiments feature to quickly build and run parameter explorations.
Alternatively, you may be interested to see what the workflow looks like when you start from a CAD geometry model and need to perform mesh generation within Luminary. The case is the Onera M6 wing, a 3D transonic flow simulation which introduces a bit more fun as a visualizations playground.