diff --git a/_docs_v7/Build-SU2-Linux-MacOS.md b/_docs_v7/Build-SU2-Linux-MacOS.md index 25e133a6..1c179e37 100644 --- a/_docs_v7/Build-SU2-Linux-MacOS.md +++ b/_docs_v7/Build-SU2-Linux-MacOS.md @@ -47,7 +47,7 @@ Short summary of the minimal requirements: If you have these tools installed, you can create a configuration using the `meson.py` found in the root source code folder: ``` -./meson.py build +./meson.py setup build ``` Use `ninja` to compile and install the code @@ -62,10 +62,10 @@ Use `ninja` to compile and install the code ### Compilers ### Installing SU2 from source requires a C++ compiler. The GNU compilers (gcc/g++) are open-source, widely used, and reliable for building SU2. The Intel compiler set has been optimized to run on Intel hardware and has also been used successfully by the development team to build the source code, though it is commercially licensed. The Apple LLVM compiler (Clang) is also commonly used by the developers. -- GNU gcc / g++ -- Intel icc / icpc +- GNU gcc / g++ +- Intel icc / icpc - Apple LLVM (clang) - + **Note**: SU2 uses some C++11 features, that means at least GCC >= v4.7, Clang >= v3.0 or Intel C++ >= v12.0 is necessary. ### MPI ### @@ -76,7 +76,7 @@ It is possible to force the MPI mode with the meson option `-Dcustom-mpi=true`, ### Python ### -SU2 requires Python 3 for compilation and for running the python scripts. Make sure that you have properly set up the `python3` executables in your environment. +SU2 requires Python 3 for compilation and for running the python scripts. Make sure that you have properly set up the `python3` executables in your environment. ### Optional: swig and mpi4py ### If you want to use the python wrapper capabilities, also `swig` and `mpi4py` are required. On **Linux** `swig` should be available in the package manager of your distribution and `mpi4py` can be installed using [pip](https://pip.pypa.io/en/stable/). @@ -89,37 +89,39 @@ Install mpi4py with Python pip using easy install: $ easy_install pip $ pip install mpi4py - + --- ## Automatically installed dependencies ## -The following dependencies are automatically downloaded (or initialized if source code was cloned using `git`) during the [configuration](#configuration-and-compilation). +The following dependencies are automatically downloaded (or initialized if source code was cloned using `git`) during the [configuration](#configuration-and-compilation). ### Meson and Ninja ### -The build system of SU2 is based on a combination of [meson](http://mesonbuild.com/) (as the front-end) and [ninja](https://ninja-build.org/) (as the back-end). Meson is an open source build system meant to be both extremely fast, and, even more importantly, as user friendly as possible. Ninja is a small low-level build system with a focus on speed. +The build system of SU2 is based on a combination of [meson](http://mesonbuild.com/) (as the front-end) and [ninja](https://ninja-build.org/) (as the back-end). Meson is an open source build system meant to be both extremely fast, and, even more importantly, as user friendly as possible. Ninja is a small low-level build system with a focus on speed. ### CoDiPack and MeDiPack ### -In order to use the discrete adjoint solver the compilation requires two additional (header-only) libraries. [CoDi](https://github.com/SciCompKL/CoDiPack) provides the AD datatype and [MeDi](https://github.com/SciCompKL/MeDiPack) provides the infrastructure for the MPI communication when the reverse mode of AD is used. +In order to use the discrete adjoint solver the compilation requires two additional (header-only) libraries. [CoDi](https://github.com/SciCompKL/CoDiPack) provides the AD datatype and [MeDi](https://github.com/SciCompKL/MeDiPack) provides the infrastructure for the MPI communication when the reverse mode of AD is used. ---- +--- ## Configuration and Compilation ## -Like mentioned above, SU2 uses meson and ninja for configuration and compilation, respectively. A configuration using meson is generated first and then an invocation of ninja is used to compile SU2 with this configuration. +Like mentioned above, SU2 uses meson and ninja for configuration and compilation, respectively. A configuration using meson is generated first and then an invocation of ninja is used to compile SU2 with this configuration. ### Basic Configuration ### -In the root folder of the sources you will find a python script called `meson.py`. This script generates a configuration. It will also check whether all dependencies are found and downloads some of them if necessary see [previous section](#automatically-installed-dependencies). +In the root folder of the sources you will find a python script called `meson.py`. This script generates a configuration. It will also check whether all dependencies are found and downloads some of them if necessary see [previous section](#automatically-installed-dependencies). **Note**: For the following steps you can also use preinstalled versions of `meson` and `ninja` available on your machine. Just replace the `./meson.py` and `./ninja` calls with the binaries of the respective installations. However, this way you have to manually make sure that the correct versions of [CoDiPack and MeDiPack](#codipack-and-medipack) are placed in the `externals/` folders. -The only required argument for `meson.py` is a name of a directory where it should store the configuration. You can have multiple configurations in different folders next to each other. To generate a basic configuration that will be stored in the folder `build` use +A configuration can be generated using `meson.py setup [builddir] [options]`, where the only required argument is `[builddir]`. For example, to generate a basic configuration that will be stored in the folder `build`, use ``` - ./meson.py build + ./meson.py setup build ``` +You can have multiple configurations in different folders next to each other. + Options can be passed to the script to enable or disable different features of SU2. Below you find a list of project options and their default values: - + | Option | Default value | Description | |---| --- | --- | | `-Denable-autodiff` | `false` | enable AD (reverse) support (needed for discrete adjoint solver) | @@ -127,7 +129,7 @@ Options can be passed to the script to enable or disable different features of S | `-Denable-pywrapper` | `false` | enable Python wrapper support| | `-Dwith-mpi` | `auto` | Set dependency mode for MPI (`auto`,`enabled`,`disabled`) | | `-Dwith-omp` | `false` | enable MPI+Threads support (experimental) | -| `-Denable-cgns` | `true` | enable CGNS support | +| `-Denable-cgns` | `true` | enable CGNS support | | `-Denable-tecio` | `true` | enable TECIO support | | `-Denable-mkl` | `false` | enable Intel MKL support | | `-Denable-openblas` | `false` | enable OpenBLAS support | @@ -139,20 +141,20 @@ Options can be passed to the script to enable or disable different features of S For example to enable AD support pass the option to the `meson.py` script along with a value: ``` -./meson.py build -Denable-autodiff=true +./meson.py setup build -Denable-autodiff=true ``` To set a installation directory for the binaries and python scripts, use the `--prefix` option, e.g.: ``` -./meson.py build -Denable-autodiff=true --prefix=/home/username/SU2 +./meson.py setup build -Denable-autodiff=true --prefix=/home/username/SU2 ``` If you are not interested in setting custom compiler flags and other options you can now go directly to the [Compilation](#compilation) section, otherwise continue reading the next section. ### Advanced Configuration ### -In general meson appends flags set with the environment variable `CXXFLAGS`. It is however recommended to use +In general meson appends flags set with the environment variable `CXXFLAGS`. It is however recommended to use mesons built-in options to set debug mode, warning levels and optimizations. All options can be found [here](https://mesonbuild.com/Builtin-options.html) or by using `./meson.py configure`. An already created configuration can be modified by using the `--reconfigure` flag, e.g.: ``` -./meson.py build --reconfigure --buildtype=debug +./meson.py setup build --reconfigure --buildtype=debug ``` Note that it is only possible to change one option at once. @@ -196,7 +198,7 @@ Profiling allows developers to identify inefficiencies in their code. SU2 can be /path/to/binary/SU2_CFD config.cfg ``` -After completion, a file called `gmon.out` is generated in your current working directory, indicating that the profiling was successful. In order to compile the analysis, run the command +After completion, a file called `gmon.out` is generated in your current working directory, indicating that the profiling was successful. In order to compile the analysis, run the command ``` gprof /path/to/binary/SU2_CFD > analysis.txt @@ -206,7 +208,7 @@ Now the file `analysis.txt` contains the profiling analysis summary. For more ad ### Compilation ### -Finally to compile and install SU2 use +Finally to compile and install SU2 use ``` ./ninja -C build install ``` diff --git a/_docs_v7/Execution.md b/_docs_v7/Execution.md index 109a9519..03b1032b 100644 --- a/_docs_v7/Execution.md +++ b/_docs_v7/Execution.md @@ -94,7 +94,7 @@ Options: * `-f FILE, --file=FILE` read config from FILE * `-n PARTITIONS, --partitions=PARTITIONS` number of PARTITIONS * `-s STEP, --step=STEP` finite difference STEP -* `-q QUIET, --quiet=QUIET` if True, output QUIET to log files +* `-q QUIET, --quiet=QUIET` if True, output QUIET to log files ### Shape Optimization Script (shape_optimization.py) @@ -114,7 +114,7 @@ Options: It is possible to call SU2 from python by importing it as a module. The first step is to compile SU2 with python wrapper support. For instance if your SU2 repository is in your home directory at *~/SU2*: -Usage: `$ ./meson.py build -Denable-pywrapper=true --prefix=~/SU2` +Usage: `$ ./meson.py setup build -Denable-pywrapper=true --prefix=~/SU2` The python module will then be available in the installation folder *~/SU2/bin*. To make the SU2 python wrapper available from everywhere in the system, add the installation path to *PYTHONPATH*: diff --git a/_docs_v7/Running-Unit-Tests.md b/_docs_v7/Running-Unit-Tests.md index 764cdd94..85ebfde5 100644 --- a/_docs_v7/Running-Unit-Tests.md +++ b/_docs_v7/Running-Unit-Tests.md @@ -24,19 +24,19 @@ In order to compile the unit tests, add the flag `-Denable-tests=true` to your meson configure call. Then, you can build and run the tests by calling `ninja test`. -## Running Tests +## Running Tests There are three ways to run the main unit tests: -1. `meson test -C builddir`, where `builddir` is the build directory. -2. `ninja test -C builddir`, where `builddir` is the build directory. +1. `meson test -C [builddir]`, where `[builddir]` is the build directory. +2. `ninja test -C [builddir]`, where `[builddir]` is the build directory. 3. `./UnitTests/test_driver` from the SU2 build directory. If you have run `ninja install`, then the `test_driver` executable will also be located in the `bin` directory where you have installed SU2. The first option will call ninja, which will then run the `test_driver` executable. The second option will call the `test_driver` executable. -The last option, manually running the test driver, gives the most flexibility. +The last option, manually running the test driver, gives the most flexibility. This help page will focus on the command-line options for that last option. By default, Catch2 will only show the output from failing tests. To also @@ -48,7 +48,7 @@ are actually three test drivers: `test_driver`, `test_driver_AD`, and `test_driver_DD`. These test drivers are built or run depending on the type of installation (e.g. direcdiff, autodiff). For the most common use-case, you will not have a directdiff -or autodiff build and will only use `test_driver`. If you call +or autodiff build and will only use `test_driver`. If you call `meson_test` or `ninja test`, the correct drivers will run automatically. For more on tests using algorithmic differentiation or direct differentiation, see the section "AD and @@ -88,7 +88,7 @@ run: ``` To run tests matching a specific tag, write the tag name in square braces -as an argument for the test driver. For example, if I want to run the +as an argument for the test driver. For example, if I want to run the tests with the tag "Dual Grid", I would run: ``` diff --git a/_tutorials/design_features/Inc_Turbulent_Bend_Opt/Inc_Turbulent_Bend_Opt.md b/_tutorials/design_features/Inc_Turbulent_Bend_Opt/Inc_Turbulent_Bend_Opt.md index 3fd253c5..02679155 100644 --- a/_tutorials/design_features/Inc_Turbulent_Bend_Opt/Inc_Turbulent_Bend_Opt.md +++ b/_tutorials/design_features/Inc_Turbulent_Bend_Opt/Inc_Turbulent_Bend_Opt.md @@ -4,8 +4,8 @@ permalink: /tutorials/Inc_Turbulent_Bend_Opt/ written_by: Nijso Beishuizen for_version: 8.0.1 revised_by: -revision_date: -revised_version: +revision_date: +revised_version: solver: INC_RANS requires: SU2_CFD, FADO complexity: advanced @@ -22,7 +22,7 @@ follows: Inc_Turbulent_Bend This tutorial closely follows the design optimization setup of the 2D mixing channel, see the tutorial on design optimization for [Species Transport](/tutorials/Species_Transport/). We will use the python framework [FADO](https://github.com/su2code/FADO) to set up the optimization problem. In this tutorial however we will optimize the pressure drop of the 90 degree pipe bend. The CFD results were already discussed previously in [this tutorial](/tutorials/Inc_Turbulent_Bend/). Here we focus on the following aspects: * Setup of the FFD box for a 3D problem using SU2_DEF. -* Setup of the FADO problem: +* Setup of the FADO problem: - using previous solutions of the CFD and adjoint solver to reduce computing time. - automatically add the correct keywords for the FFD box (type and degrees of freedom). - discussion of mesh quality issues and improvement using FFD constraints. @@ -34,7 +34,7 @@ If you have not done so already, please first have a look at the prerequisite tu Besides the python library FADO, you will need to compile SU2 with automatic differentiation support. Note that the script provided uses 8 cores, so you need to compile with mpi support as well as enable autodiff: ``` -./meson.py build --optimization=2 -Ddebug=false -Denable-autodiff=true -Dwith-mpi=enabled --prefix=/home/user/Codes/su2_github_develop/su2/ +./meson.py setup build --optimization=2 -Ddebug=false -Denable-autodiff=true -Dwith-mpi=enabled --prefix=/home/user/Codes/su2_github_develop/su2/ ``` ## Resources @@ -43,7 +43,7 @@ You can find the resources for this tutorial in the folder [design/Inc_Turbulent ## 1. Basic setup of FFD box and FADO Usually, designs are created with a CAD tool. These designs are then discretized into a computational mesh for CFD analysis. When optimizing a design, we then only have the discretized mesh available. We could manipulate the mesh nodes directly but this does not lead to very smooth deformations. Instead we modify our mesh using FFD boxes. The nodes of the FFD box are moved according to the design sensitivities, and the mesh nodes inside the FFD box are then smoothly deformed using Bezier curves (default) or B-splines. -Figure (1) above shows the setup that we will be using. +Figure (1) above shows the setup that we will be using. ### Creation of the FFD box The FFD box can be created and added to the .su2 mesh file using SU2_DEF. The important parameters to add to the configuration file are: @@ -65,32 +65,32 @@ DV_MARKER= ( wall, symmetry) DV_PARAM= (1.0) ``` Our FFD box is 5x5x5 cells, or 6x6x6=216 nodes. With each 3 degrees of freedom for the x-,y- and z-direction, we get a total of 648 d.o.f. The box is slightly larger than our original bend, but most importantly the symmetry plane is completely inside the FFD box. -We run the command +We run the command ``` $ SU2_DEF sudo_0_add_FFD_box.cfg ``` -We will only use the file *sudo_0_add_FFD_box.cfg* to create the FFD box. This command will create a new .su2 mesh called *mesh_out.su2* that has the definition of the FFD box added to the file. Note that at this stage we need to provide the boundaries inside the FFD box that are allowed to deform using the keyword **DV_MARKER**. The nodes on the boundaries inside the FFD box are part of the information that is added with the FFD box to the mesh_out.su2 mesh file. +We will only use the file *sudo_0_add_FFD_box.cfg* to create the FFD box. This command will create a new .su2 mesh called *mesh_out.su2* that has the definition of the FFD box added to the file. Note that at this stage we need to provide the boundaries inside the FFD box that are allowed to deform using the keyword **DV_MARKER**. The nodes on the boundaries inside the FFD box are part of the information that is added with the FFD box to the mesh_out.su2 mesh file. ### Setup the FADO script optimization.py -Previously the python script *set_ffd_design_var.py* was used in the tutorial on the optimization of the mixing channel. We can however create the correct entries with a couple of simple python commands and add them directly to the main python script that FADO will use, *optimization.py*. We already used *optimization.py* before in the tutorial [Species Transport](/tutorials/Species_Transport/) and we will highlight some changes here. +Previously the python script *set_ffd_design_var.py* was used in the tutorial on the optimization of the mixing channel. We can however create the correct entries with a couple of simple python commands and add them directly to the main python script that FADO will use, *optimization.py*. We already used *optimization.py* before in the tutorial [Species Transport](/tutorials/Species_Transport/) and we will highlight some changes here. For the optimization, we need to modify 2 things in our config file: **DV_KIND** and **DV_PARAM**. The keyword **DV_PARAM** contains N entries of the form *( BOX, 0, 0, 0, 1.0, 0.0, 0.0 );* - Note that the meaning of the entries are *( FFD_BoxTag, i_Ind, j_Ind, k_Ind, x_Disp, y_Disp, z_Disp )* , meaning that after the keyword **BOX**, we get the 3 indices i,j,k of the FFD box, followed by the allowed displacement of that index in the x-,y- and z-direction. Mesh nodes in the symmetry plane only move in the symmetry plane, so symmetry is preserved. + Note that the meaning of the entries are *( FFD_BoxTag, i_Ind, j_Ind, k_Ind, x_Disp, y_Disp, z_Disp )* , meaning that after the keyword **BOX**, we get the 3 indices i,j,k of the FFD box, followed by the allowed displacement of that index in the x-,y- and z-direction. Mesh nodes in the symmetry plane only move in the symmetry plane, so symmetry is preserved. The list of FFD control points can be created using: ```python s = "FFD_CONTROL_POINT" ffd_string = s for i in range((DX**NDIM)*NDIM - 1): - ffd_string = ffd_string + ", " + s + ffd_string = ffd_string + ", " + s ``` In the sudo.cfg file we have a placeholder which has the form: ``` -DV_KIND= __FFD_CTRL_PTS__ +DV_KIND= __FFD_CTRL_PTS__ ``` And we automatically replace the placeholder **\_\_FFD_CTRL_PTS\_\_** in the fado script during run-time using the command ``` @@ -164,7 +164,7 @@ for j in jlist: dv_param_string = dv_param_string.replace(remove_dof, "", 1) ``` -Another modification to the configuration file that we would like to add is to restart from the solution of the previous design. SU2 will automatically interpolate the solution to the nearest neighbor if the mesh coordinates do not match. Since we might not have an initial solution to start with, we would like to switch from **RESTART= NO** to **RESTART= YES** after the first iteration. +Another modification to the configuration file that we would like to add is to restart from the solution of the previous design. SU2 will automatically interpolate the solution to the nearest neighbor if the mesh coordinates do not match. Since we might not have an initial solution to start with, we would like to switch from **RESTART= NO** to **RESTART= YES** after the first iteration. We can do this with a simple *sed* command that searches and replaces the string in config.cfg in the working directory and then copies the config file back to the base dir: @@ -172,12 +172,12 @@ We can do this with a simple *sed* command that searches and replaces the string restart_yes="sed -i 's/RESTART_SOL= NO/RESTART_SOL= YES/' config.cfg && cp " + configCopy + " ../../" ``` -The easiest way to perform the update is to simply add it as another ExternalRun process: +The easiest way to perform the update is to simply add it as another ExternalRun process: ```python update_restart = ExternalRun("UPDATE_RESTART",restart_yes,False) # True means sym links are used for addData update_restart.addData(configCopy) ``` -This means that we will call this function every design iteration, but only in the first design iteration will it have an effect. +This means that we will call this function every design iteration, but only in the first design iteration will it have an effect. FADO copies the restart file and all other necessary files from the base directory (where you start your script) into the working directory. Here, the working directory is called *OPTIM*. Inside *OPTIM* we have subdirectories for the different runs, i.e. *OPTIM/DEFORM*, OPTIM/DIRECT*, *OPTIM/ADJOINT* and *OPTIM/DOT*. When all runs in this directory are done, they are archived in *DSN_001*, *DSN_002*, etc. @@ -203,7 +203,7 @@ We have set it to run 5 design iterations. Please note that the optimization was The objective values for the 5 design iterations are given in the table below. -| iteration | $$\Delta P$$, total| $$\Delta P$$, bend| gain, total| gain, bend | +| iteration | $$\Delta P$$, total| $$\Delta P$$, bend| gain, total| gain, bend | | --------|--------|--------|--------|--------| |0|89.0 [Pa]|20.7 [Pa]| -| - | |1|84.9 [Pa]|16.6 [Pa]|4.6 %|19.8 %|