Quickstart
Build the library and run a viscous analysis of a NACA 2412. You need CMake 3.18+, a C++17 compiler, and Eigen 3.4+.
:::tip Working in Python instead? Skip the build: run the servers from Docker images and follow Python and MDO frameworks. :::
1. Install the dependencies
- macOS
- Ubuntu
brew install cmake eigen
sudo apt-get install -y build-essential cmake git libeigen3-dev
2. Build
git clone https://github.com/chrislupp/Scirocco.git
cd Scirocco
cmake -S scirocco -B scirocco/build -DCMAKE_BUILD_TYPE=Release
cmake --build scirocco/build -j --target quickstart
3. Run
The quickstart target is this program:
quickstart.cpp
#include <iostream>
#include "scirocco/scirocco.h"
int main() {
scirocco::Scirocco foil("2412", 160); // NACA 2412, 160 panels
// alpha = 4 deg, no lift target, Re = 1e6, Mach 0
foil.SetOper(4.0, -1.0, 1.0e6, 0.0);
if (!foil.Solve()) {
std::cerr << "did not converge\n";
return 1;
}
std::cout << "Cl = " << foil.GetCl() << '\n'
<< "Cd = " << foil.GetCd() << '\n'
<< "Cm = " << foil.GetCm() << '\n';
return 0;
}
scirocco/build/quickstart
Cl = 0.720173
Cd = 0.00693199
Cm = -0.0585055
That's a full viscous solve, with boundary layer, transition, and wake, in about a quarter of a second. Your last digits may differ slightly with a different compiler.
SetOper(alpha, cl, Re, Ma) sets the operating point:
| Argument | Meaning |
|---|---|
alpha | Angle of attack in degrees |
cl | Target lift coefficient. Pass -1.0 to solve at the given alpha instead. |
Re | Chord Reynolds number. 0 gives an inviscid solve. |
Ma | Freestream Mach number |
Use it in your own project
Install the library, then link it with CMake:
cmake --install scirocco/build --prefix "$PWD/install"
CMakeLists.txt
cmake_minimum_required(VERSION 3.18)
project(my_app LANGUAGES CXX)
find_package(scirocco CONFIG REQUIRED)
add_executable(my_app main.cpp)
target_link_libraries(my_app PRIVATE scirocco::scirocco)
Point CMake at the install prefix when you configure:
cmake -S . -B build -DCMAKE_PREFIX_PATH=/path/to/Scirocco/install
Installation covers the other ways to build, including the optional HDF5 and Philote components.