### Configure GKlib Installation Prefix Source: https://github.com/su2code/su2/blob/master/externals/metis/GKlib/BUILD.txt Specify the installation directory using 'make config'. This example sets the prefix to '~/local'. ```bash make config prefix=~/local ``` -------------------------------- ### Install SU2 Source: https://github.com/su2code/su2/wiki/Build-from-Source Executes the installation process after compilation. Copies programs and Python scripts to the specified prefix directory. Defaults to /usr/local/bin if no prefix is set. ```bash make install ``` -------------------------------- ### Install Open MPI on macOS Source: https://github.com/su2code/su2/wiki/Python-Wrapper-Build Installs Open MPI using the Homebrew package manager on macOS. ```bash $ sudo brew install open-mpi ``` -------------------------------- ### Compile and Install SU2 with Ninja Source: https://github.com/su2code/su2/blob/master/README.md After configuring the build, use Ninja to compile and install the SU2 code. This command should be run from the root source code folder. ```bash ./ninja -C build install ``` -------------------------------- ### Configure GKlib Build with OpenMP Source: https://github.com/su2code/su2/blob/master/externals/metis/GKlib/BUILD.txt Use 'make config' to set build options. This example enables OpenMP support. Ensure OpenMP is available on your system. ```bash make config openmp=ON make ``` -------------------------------- ### Install SWIG on macOS Source: https://github.com/su2code/su2/wiki/Python-Wrapper-Build Installs SWIG using the Homebrew package manager on macOS. ```bash $ sudo brew install swig ``` -------------------------------- ### Configure SU2 with Python Wrapper (Linux) Source: https://github.com/su2code/su2/wiki/Python-Wrapper-Build Configures a parallel build of SU2 with the Python wrapper enabled on Linux. Ensure SWIG and mpi4py are installed. This command sets the installation prefix, optimization flags, and enables MPI and Python bindings. ```bash $ ./configure --prefix=/path/to/install/SU2 CXXFLAGS="-O3" --enable-mpi --with-cc=/path/to/mpicc --with-cxx=/path/to/mpicxx --enable-PY_WRAPPER ``` -------------------------------- ### Install SWIG on Linux Source: https://github.com/su2code/su2/wiki/Python-Wrapper-Build Installs the SWIG package using the APT package manager on Debian-based Linux distributions. ```bash $ sudo apt-get install swig ``` -------------------------------- ### Install Xcode Developer Tools Source: https://github.com/su2code/su2/wiki/Build-from-Source Installs necessary command-line developer tools on Mac OS X if they are not found after installing Xcode. ```bash xcode-select --install ``` -------------------------------- ### Configure SU2 Build with Meson Source: https://github.com/su2code/su2/blob/master/README.md Use this command to create a build configuration for SU2 using Meson. Ensure you have a C/C++ compiler and Python 3 installed. ```bash ./meson.py setup build ``` -------------------------------- ### Build teciompi with Makefile on Linux Source: https://github.com/su2code/su2/blob/master/externals/tecio/teciompisrc/readme.txt Use this command if you do not have CMake installed, specifying the Boost include directory path. ```bash make BOOST_ROOT=iii -f Makefile.linux ``` -------------------------------- ### Install mpi4py on Linux Source: https://github.com/su2code/su2/wiki/Python-Wrapper-Build Installs the mpi4py package using pip after ensuring python-pip is installed on Linux. ```bash $ sudo apt-get install python-pip $ sudo pip install mpi4py ``` -------------------------------- ### Basic SU2 Build Source: https://github.com/su2code/su2/wiki/Simple-Build Compile the most basic version of SU2 (single-threaded with no optional features). Ensure you are in the SU2 source directory and specify an installation prefix. ```bash cd /path/to/your/SU2/ ./configure --prefix=/path/to/install/SU2 make make install ``` -------------------------------- ### Configure SU2 with TecIO and X11 Source: https://github.com/su2code/su2/wiki/Build-from-Source Example configure options for Mac OS X to enable automatic building and linking of the TecIO library, ensuring correct X11 dependencies are found. ```bash --enable-tecio CPPFLAGS="-I/opt/X11/include" ``` -------------------------------- ### Build teciompi with CMake on Linux/macOS Source: https://github.com/su2code/su2/blob/master/externals/tecio/teciompisrc/readme.txt Use this command when CMake is installed on your system to configure and build the library. ```bash cmake . make ``` -------------------------------- ### Install METIS Library Source: https://github.com/su2code/su2/blob/master/externals/metis/libmetis/CMakeLists.txt Installs the METIS library targets (library, runtime, archive) to specified destinations if METIS_INSTALL is enabled. ```cmake if(METIS_INSTALL) install(TARGETS metis LIBRARY DESTINATION lib RUNTIME DESTINATION lib ARCHIVE DESTINATION lib) endif() ``` -------------------------------- ### Clone TestCases Repository using Git Source: https://github.com/su2code/su2/wiki/Download Clone the separate repository containing SU2 test cases (configuration and mesh files) using git. This is useful for running tutorial or example cases. ```bash git clone https://github.com/su2code/TestCases.git ``` -------------------------------- ### Execute SU2_DEF for FFD Mesh Generation Source: https://github.com/su2code/su2/wiki/Constrained-Optimal-Shape-Design-of-a-Fixed-Wing Run SU2_DEF with the configuration file to generate a new mesh incorporating the FFD box. Ensure SU2 tools are installed and in your PATH. The output mesh 'mesh_out.su2' should be renamed. ```bash SU2_DEF inv_ONERAM6_adv.cfg ``` -------------------------------- ### Configure and Build SU2 for Parallel Execution Source: https://github.com/su2code/su2/wiki/Parallel-Build This command configures SU2 for parallel builds using MPI and specifies installation paths. The '-j 8' option in the subsequent 'make' command enables parallel compilation using 8 cores. ```bash $ cd /path/to/SU2 $ ./configure --prefix=/path/to/install/SU2 CXXFLAGS="-O3" --enable-mpi --with-cc=/path/to/mpicc --with-cxx=/path/to/mpicxx $ make -j 8 install ``` -------------------------------- ### Configure SU2 with Help Option Source: https://github.com/su2code/su2/wiki/Build-from-Source Displays all available options and environment variables for the configure script, allowing customization of the build process. ```bash $ ./configure --help ``` -------------------------------- ### Install mpi4py on macOS Source: https://github.com/su2code/su2/wiki/Python-Wrapper-Build Installs mpi4py using pip on macOS, ensuring pip is installed first. ```bash $ sudo easy_install pip $ sudo pip install mpi4py ``` -------------------------------- ### Build GKlib Library Source: https://github.com/su2code/su2/blob/master/externals/metis/GKlib/BUILD.txt Run this command to build the GKlib library. The library will be placed in build//. ```bash make ``` -------------------------------- ### SU2 Configuration: List Option with Braces and Commas Source: https://github.com/su2code/su2/wiki/Configuration-File Demonstrates formatting a list option using braces and commas. This syntax is optional for lists. ```config FREESTREAM_VELOCITY = ( 5.0, 0.00, 0.00 ) % braces and commas can be used for list options ``` -------------------------------- ### Execute SU2_CFD with Configuration File Source: https://github.com/su2code/su2/wiki/Execution Run the SU2_CFD solver with a specific configuration file. The executable and config file should be in the current directory. ```bash $ ./SU2_CFD default.cfg ``` -------------------------------- ### Uninstall GKlib Library Source: https://github.com/su2code/su2/blob/master/externals/metis/GKlib/BUILD.txt Run this command to remove the installed GKlib library from the system. ```bash make uninstall ``` -------------------------------- ### Start AD Recording Source: https://github.com/su2code/su2/wiki/Advanced-AD-Techniques Enables the traversal of computational graphs for subsequent expressions to store partial derivatives. ```cpp AD::StartRecording() ``` -------------------------------- ### Run Discrete-Adjoint Simulation Source: https://github.com/su2code/su2/blob/master/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_2d/README.md Perform the discrete-adjoint simulation using SU2_CFD_AD and then generate the adjoint solution with SU2_DOT_AD. ```bash mpirun -n <#cores> SU2_CFD_AD DA_configMaster.cfg ``` ```bash SU2_DOT_AD DA_configMaster.cfg ``` -------------------------------- ### Standard SU2 Configuration Source: https://github.com/su2code/su2/wiki/AD-Build This is the standard command for configuring SU2 without AD support, used as a reference for comparison. ```bash ./configure --enable-mpi --prefix=$SU2_INSTALLPATH CXXFLAGS="-O3 -Wall" ``` -------------------------------- ### SU2 Configuration: Scalar Option with Whitespace Source: https://github.com/su2code/su2/wiki/Configuration-File Illustrates a scalar option where whitespace between elements is not significant. Comments start with '%'. ```config KIND_TURB_MODEL = NONE % space between elements is not significant ``` -------------------------------- ### Get Derivative Value from AD Source: https://github.com/su2code/su2/wiki/Advanced-AD-Techniques Retrieves the interpreted adjoint value for a variable registered as input. Must be called in the same order as AD::RegisterInput(). ```cpp SU2_TYPE::GetDerivative(su2double &var) ``` -------------------------------- ### Include Directories and Source Discovery Source: https://github.com/su2code/su2/blob/master/externals/metis/libmetis/CMakeLists.txt Configures include directories and finds C source files for the METIS library. ```cmake include_directories(.) file(GLOB metis_sources *.c) ``` -------------------------------- ### Execute SU2 Python Script Source: https://github.com/su2code/su2/wiki/Execution Run any SU2 Python script by invoking the python interpreter with the script name and its options. Ensure Python is installed and in your PATH. ```bash $ python script_name.py [options] ``` -------------------------------- ### Configure SU2 for AD Support Source: https://github.com/su2code/su2/wiki/AD-Build Use this command to enable AD support during the SU2 configuration process. Ensure `make distclean` is run if `./configure` was previously executed in the source directory. ```bash export CXXFLAGS="-O3 -Wall" && ./preconfigure.py --enable-autodiff --enable-mpi --prefix=$SU2_INSTALLPATH ``` -------------------------------- ### Add SU2 to Python Path Source: https://github.com/su2code/su2/wiki/Build-from-Source Includes the SU2 installation directory in the Python path. Necessary for using SU2 Python scripts for parallel calculations or design tasks. ```bash export PYTHONPATH=$PYTHONPATH:$SU2_RUN ``` -------------------------------- ### Run Primal Simulation Source: https://github.com/su2code/su2/blob/master/TestCases/incomp_navierstokes/streamwise_periodic/chtPinArray_2d/README.md Execute the primal simulation using SU2_CFD with the specified configuration file and number of cores. ```bash mpirun -n <#cores> SU2_CFD configMaster.cfg ``` -------------------------------- ### Set SU2 Environment Variables Source: https://github.com/su2code/su2/blob/master/README.md Configure your shell environment by setting SU2_RUN, SU2_HOME, and updating your PATH and PYTHONPATH. This is crucial for running SU2 commands and scripts after installation. ```bash export SU2_RUN="your_prefix/bin" export SU2_HOME="/path/to/SU2vX.X.X/" export PATH=$PATH:$SU2_RUN export PYTHONPATH=$SU2_RUN:$PYTHONPATH ``` -------------------------------- ### Run Parallel Simulation with parallel_computation.py Source: https://github.com/su2code/su2/wiki/Turbulent-ONERA-M6 Use this script to automatically handle domain decomposition and execute parallel simulations with SU2. Ensure SU2 is compiled with parallel support and installed. ```bash $ parallel_computation.py -n NP -f turb_ONERAM6.cfg ``` -------------------------------- ### Run SU2 Regression Tests Source: https://github.com/su2code/su2/wiki/Test-Cases Commands to clone SU2 and test case repositories, configure SU2, and run serial regression tests. Ensure SU2 paths are set correctly. ```bash $ git clone https://github.com/su2code/SU2.git $ git clone https://github.com/su2code/TestCases.git $ cd SU2/ $ ./configure $ make install $ cp -R ../TestCases/* ./TestCases/ $ cd ./TestCases/ $ python serial_regression.py ``` -------------------------------- ### Checkout SU2 Repository using SVN Source: https://github.com/su2code/su2/wiki/Download If git is not available, you can check out the latest version of the SU2 source code using an SVN client. This command fetches the trunk of the repository. ```bash svn checkout https://github.com/su2code/SU2/trunk ``` -------------------------------- ### Clone SU2 Repository using Git Source: https://github.com/su2code/su2/wiki/Download Use this command to clone the SU2 source code repository directly from GitHub using a git client. Ensure you have git installed. ```bash git clone https://github.com/su2code/SU2 ``` -------------------------------- ### Run SU2 Simulation Source: https://github.com/su2code/su2/wiki/Transitional-Flat-Plate Execute the SU2 CFD solver from the terminal. Ensure configuration and mesh files are in the same directory and SU2 tools are in the system path. ```bash SU2_CFD transitional_BC_model_ConfigFile.cfg ``` -------------------------------- ### Run SU2 CFD Solver in Serial Source: https://github.com/su2code/su2/wiki/Turbulent-ONERA-M6 Execute the SU2_CFD solver for a turbulent ONERA M6 test case from the terminal. Ensure SU2 tools are compiled, installed, and in your system's PATH. ```bash $ SU2_CFD turb_ONERAM6.cfg ``` -------------------------------- ### Configure SU2 for Parallel Build with Libraries and Optimization Source: https://github.com/su2code/su2/wiki/Build-from-Source Configures SU2 for parallel calculations with MPI and ParMETIS, enabling CGNS and TecIO support, and applying high compiler optimization. Replace paths with your system's specific locations. ```bash $ ./configure --prefix=/path/to/install/SU2 --enable-mpi --with-cc=/path/to/mpicc --with-cxx=/path/to/mpicxx CXXFLAGS="-O3" ```