diff --git a/.github/workflows/publish_su2_validation.yml b/.github/workflows/publish_su2_validation.yml new file mode 100644 index 00000000..d99afae7 --- /dev/null +++ b/.github/workflows/publish_su2_validation.yml @@ -0,0 +1,377 @@ +name: Publish SU2 Validation Test Cases Results + +on: + workflow_dispatch: + inputs: + branch_name: + description: "SU2 Branch Checked Out (e.g. master, develop)" + required: true + type: choice + options: + - master + - develop + case_code: + description: "Validation Case Code (e.g. 2DML)" + required: true + type: choice + options: + - 2DML + - All + case_name: + description: "Validation Case Name (e.g. 2D Mixing Layer)" + required: true + type: choice + options: + - 2D Mixing Layer + - All + flow_condition: + description: "Incompressible Flow or Compressible Flow" + required: true + type: choice + options: + - Incompressible Flow + - Compressible Flow + - All + author_name: + description: "Author's Name (e.g. Harsh)" + required: true + type: string + +env: + SANITIZED_AUTHOR: "Automated_Update" + +jobs: + process-and-publish: + runs-on: ubuntu-latest + steps: + - name: Validate Inputs + run: | + echo "Validating workflow inputs..." + + CASE_CODE="${{ github.event.inputs.case_code }}" + CASE_NAME="${{ github.event.inputs.case_name }}" + FLOW_CONDITION="${{ github.event.inputs.flow_condition }}" + + ERRORS="" + + if [[ "$CASE_CODE" == "All" && "$CASE_NAME" != "All" ]]; then + ERRORS+="\n'All' case code cannot be paired with a specific case name ($CASE_NAME)" + fi + + if [[ "$CASE_CODE" != "All" && "$CASE_NAME" == "All" ]]; then + ERRORS+="\nSpecific case code ($CASE_CODE) cannot be paired with 'All' case name" + fi + + if [[ "$CASE_CODE" != "All" && "$FLOW_CONDITION" == "All" ]]; then + ERRORS+="\nSpecific case code ($CASE_CODE) cannot be paired with 'All' flow condition" + fi + + if [[ "$CASE_CODE" == "All" && "$FLOW_CONDITION" != "All" ]]; then + ERRORS+="\n'All' case code must also have 'All' flow condition" + fi + + if [[ -n "$ERRORS" ]]; then + echo "::error::Input Validation Failed:$ERRORS" + echo "Tip: Use either all 'All' values or all specific values for a single run." + exit 1 + fi + + echo "Inputs are valid. Continuing..." + + - name: Sanitize Author's Name + run: | + SANITIZED=$(echo "${{ github.event.inputs.author_name }}" | + tr -d '\n' | # Remove newlines + tr ' ' '_' | # Convert spaces + tr -s '_' | # Collapse multiple ____ + sed 's/^_\+//; s/_\+$//' | # Trim leading/trailing _ + tr -dc '[:alnum:]_' | # Strict character set + head -c 50) + + # Fallback Conditions + if [[ -z "$SANITIZED" || "$SANITIZED" =~ ^[0-9_]+$ ]]; then + SANITIZED="Automated_Update" + fi + echo "SANITIZED_AUTHOR=${SANITIZED}" >> $GITHUB_ENV + + - name: Checkout Develop Branch + uses: actions/checkout@v4 + with: + ref: develop + + - name: Check If Target Branch Exists + id: branch-check + env: + TARGET_BRANCH: "ValidationCases_${{ github.event.inputs.branch_name}}_${{ env.SANITIZED_AUTHOR }}" + run: | + if git ls-remote --heads origin $TARGET_BRANCH | grep -q $TARGET_BRANCH; then + echo "Branch $TARGET_BRANCH exists. Proceeding..." + echo "branch_exists=true" >> $GITHUB_OUTPUT + else + echo "::error::Branch $TARGET_BRANCH does not exist. Aborting." + echo "branch_exists=false" >> $GITHUB_OUTPUT + exit 1 + fi + + - name: Checkout Target Branch + if: steps.branch-check.outputs.branch_exists == 'true' + uses: actions/checkout@v4 + with: + ref: "ValidationCases_${{ github.event.inputs.branch_name}}_${{ env.SANITIZED_AUTHOR }}" + token: ${{ secrets.GITHUB_TOKEN }} + persist-credentials: true + fetch-depth: 0 + + - name: Prepare Markdown File For All Validation Cases + if: steps.branch-check.outputs.branch_exists == 'true' && inputs.case_code == 'All' && inputs.case_name == 'All' + run: | + BASE_PATH="vandv_files" + TEMPLATE="template_README.md" + OUTPUT_DIR="_vandv" + OUTPUT_FILE="${OUTPUT_DIR}/All_Validation_Cases.md" + + for case_dir in "$BASE_PATH"/*/; do + if [ -d "$case_dir" ] && [[ "$(basename "$case_dir")" != .* ]]; then + casecode=$(basename "$case_dir") + IMAGE_COUNT=0 + IMAGE_DIR="vandv_files/${casecode}" + + # Validate inputs and paths + if [ ! -f "${TEMPLATE}" ]; then + echo "::error::Template ${TEMPLATE} not found!" + exit 1 + fi + + if [ ! -d "${OUTPUT_DIR}" ]; then + echo "::error::Directory ${OUTPUT_DIR} must exist in the repository. Deploy it first." + exit 1 + fi + + if [ ! -d "${IMAGE_DIR}" ]; then + echo "::error::Image directory ${IMAGE_DIR} not found!" + exit 1 + fi + + if ! grep -q '{Case_Code}' "${TEMPLATE}" || ! grep -q 'Your Case Study Title' "${TEMPLATE}"; then + echo "::error::Template missing required placeholders" + exit 1 + fi + + # Update front matter and write to new file + sed \ + -e "s/{Case_Code}/All_Validation_Cases/g" \ + -e "s/Your Case Study Title/All Validation Cases/g" \ + "${TEMPLATE}" > "${OUTPUT_FILE}" + + # Count images first + IMAGE_COUNT=$(find "${IMAGE_DIR}" -type f \( -iname "*.png" -o -iname "*.jpg" -o -iname "*.jpeg" \) | wc -l) + + if [ "${IMAGE_COUNT}" -eq 0 ]; then + echo "::error::ABORTING: No plot images found in ${IMAGE_DIR}/" + rm -f "${OUTPUT_FILE}" # Delete the empty Markdown file + exit 1 + fi + + echo -e "\n## Results Plots For ${casecode}\n" >> "${OUTPUT_FILE}" + + # Find and process images + find "${IMAGE_DIR}" -type d -name "${casecode}_*" | sort | while read -r dir; do + folder_name=$(basename "${dir}") + echo -e "\n### ${folder_name}\n" >> "${OUTPUT_FILE}" + + # Process images with their relative path + find "${dir}" -type f \( -iname "*.png" -o -iname "*.jpg" -o -iname "*.jpeg" \) | sort | while read -r img; do + # Calculate relative path + rel_path="/${img#*/vandv_files/}" + echo "\"${folder_name}" >> "${OUTPUT_FILE}" + echo "" >> "${OUTPUT_FILE}" + done + done + fi + done + # Verify creation + echo "Generated ${OUTPUT_FILE}" + + - name: Prepare Markdown File For Specific Validation Case + if: steps.branch-check.outputs.branch_exists == 'true' && inputs.case_code != 'All' && inputs.case_name != 'All' + run: | + # Initialize variables + IMAGE_COUNT=0 + SANITIZED_CASE_NAME=$(echo "${{ github.event.inputs.case_name }}" | tr -dc '[:alnum:] ') + SANITIZED_CASE_CODE=$(echo "${{ github.event.inputs.case_code }}" | tr -dc '[:alnum:]' | tr '[:lower:]' '[:upper:]') + + # Define paths + TEMPLATE="template_README.md" + OUTPUT_DIR="_vandv" + OUTPUT_FILE="${OUTPUT_DIR}/${SANITIZED_CASE_CODE}.md" + IMAGE_DIR="vandv_files/${SANITIZED_CASE_CODE}" + + # Validate inputs and paths + if [ ! -f "${TEMPLATE}" ]; then + echo "::error::Template ${TEMPLATE} not found!" + exit 1 + fi + + if [ ! -d "${OUTPUT_DIR}" ]; then + echo "::error::Directory ${OUTPUT_DIR} must exist in the repository. Deploy it first." + exit 1 + fi + + if [ ! -d "${IMAGE_DIR}" ]; then + echo "::error::Image directory ${IMAGE_DIR} not found!" + exit 1 + fi + + if ! grep -q '{Case_Code}' "${TEMPLATE}" || ! grep -q 'Your Case Study Title' "${TEMPLATE}"; then + echo "::error::Template missing required placeholders" + exit 1 + fi + + # Update front matter and write to new file + sed \ + -e "s/{Case_Code}/${SANITIZED_CASE_CODE}/g" \ + -e "s/Your Case Study Title/${SANITIZED_CASE_NAME}/g" \ + "${TEMPLATE}" > "${OUTPUT_FILE}" + + # Count images first + IMAGE_COUNT=$(find "${IMAGE_DIR}" -type f \( -iname "*.png" -o -iname "*.jpg" -o -iname "*.jpeg" \) | wc -l) + + if [ "${IMAGE_COUNT}" -eq 0 ]; then + echo "::error::ABORTING: No plot images found in ${IMAGE_DIR}/" + rm -f "${OUTPUT_FILE}" # Delete the empty Markdown file + exit 1 + fi + + echo -e "\n## Results Plots\n" >> "${OUTPUT_FILE}" + + # Find and process images + find "${IMAGE_DIR}" -type d -name "${SANITIZED_CASE_CODE}_*" | sort | while read -r dir; do + folder_name=$(basename "${dir}") + echo -e "\n### ${folder_name}\n" >> "${OUTPUT_FILE}" + + # Process images with their relative path + find "${dir}" -type f \( -iname "*.png" -o -iname "*.jpg" -o -iname "*.jpeg" \) | sort | while read -r img; do + # Calculate relative path + rel_path="../${img#*/vandv_files/}" + echo "\"${folder_name}" >> "${OUTPUT_FILE}" + echo "" >> "${OUTPUT_FILE}" + done + done + + # Verify creation + echo "Generated ${OUTPUT_FILE}" + + - name: Install yq (Go version) + run: | + sudo wget -qO /usr/local/bin/yq https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 + sudo chmod +x /usr/local/bin/yq + yq --version + + - name: Update V&V Listing + if: steps.branch-check.outputs.branch_exists == 'true' + run: | + # Verify yq installation + if ! command -v yq &>/dev/null; then + echo "::error::yq not installed" + exit 1 + fi + + VANDV_YML="_data/vandv.yml" + + # Verify file exists + if [ ! -f "${VANDV_YML}" ]; then + echo "::error::YAML file ${VANDV_YML} not found" + exit 1 + fi + + # Create backup + cp "${VANDV_YML}" "${VANDV_YML}.bak" + + if [ "${{ github.event.inputs.flow_condition }}" == "All" ]; then + NEW_SECTION_TITLE="All Validation Cases" + NEW_ENTRY="All_Validation_Cases" + + # Check if section exists + SECTION_EXISTS=$(yq eval ".[] | select(.title == \"${NEW_SECTION_TITLE}\") | length" "${VANDV_YML}") + + if [ "${SECTION_EXISTS}" -gt 0 ]; then + echo "Section '${NEW_SECTION_TITLE}' already exists. No changes made." + else + echo "Adding new '${NEW_SECTION_TITLE}' section..." + + # Create new section in a temporary file + TEMP_FILE=$(mktemp) + trap 'rm -f "${TEMP_FILE}" "${VANDV_YML}.tmp"' EXIT + echo "- title: ${NEW_SECTION_TITLE}" > "${TEMP_FILE}" + echo " vandv:" >> "${TEMP_FILE}" + echo " - ${NEW_ENTRY}" >> "${TEMP_FILE}" + + # Merge with existing content + yq eval-all 'select(fileIndex == 0) *+ select(fileIndex == 1)' "${VANDV_YML}" "${TEMP_FILE}" > "${VANDV_YML}.tmp" + + # Verify merge was successful + MERGED_COUNT=$(yq eval 'length' "${VANDV_YML}.tmp") + ORIGINAL_COUNT=$(yq eval 'length' "${VANDV_YML}") + + if [ "${MERGED_COUNT}" -le "${ORIGINAL_COUNT}" ]; then + echo "::error::Failed to properly merge new section" + rm -f "${TEMP_FILE}" "${VANDV_YML}.tmp" + mv "${VANDV_YML}.bak" "${VANDV_YML}" + exit 1 + fi + + # Verify new section exists in merged file + if [ $(yq eval ".[] | select(.title == \"${NEW_SECTION_TITLE}\") | length" "${VANDV_YML}.tmp") -eq 0 ]; then + echo "::error::New section not found in merged file" + rm -f "${TEMP_FILE}" "${VANDV_YML}.tmp" + mv "${VANDV_YML}.bak" "${VANDV_YML}" + exit 1 + fi + + # Replace original file if all checks pass + mv "${VANDV_YML}.tmp" "${VANDV_YML}" + echo "Successfully added new section while preserving existing content" + rm -f "${TEMP_FILE}" + fi + else + CASE_CODE="${{ github.event.inputs.case_code }}" + FLOW_TYPE="${{ github.event.inputs.flow_condition }}" + + # Check if case exists + EXISTS=$(yq eval ".[] | select(.title == \"${FLOW_TYPE}\").vandv[] | select(. == \"${CASE_CODE}\")" "${VANDV_YML}") + if [ -n "${EXISTS}" ]; then + echo "Case ${CASE_CODE} already exists. Skipping update." + rm -f "${VANDV_YML}.bak" + exit 0 + fi + + # Update YAML + yq eval -i ".[] |= (select(.title == \"${FLOW_TYPE}\").vandv += [\"${CASE_CODE}\"])" "${VANDV_YML}" + + # Verify update + UPDATED=$(yq eval ".[] | select(.title == \"${FLOW_TYPE}\").vandv[] | select(. == \"${CASE_CODE}\")" "${VANDV_YML}") + if [ -z "${UPDATED}" ]; then + echo "::error::Failed to add case code to YAML" + mv "${VANDV_YML}.bak" "${VANDV_YML}" + exit 1 + fi + fi + + echo "Successful update to vandv.yml" + rm -f "${VANDV_YML}.bak" + + - name: Commit And Push Changes + if: steps.branch-check.outputs.branch_exists == 'true' + run: | + git config --global user.name "GitHub Actions" + git config --global user.email "actions@github.com" + + git add . + git status + + if ! git diff-index --quiet HEAD --; then + git commit -m "Automated Update" + git push origin HEAD:"ValidationCases_${{ github.event.inputs.branch_name}}_${{ env.SANITIZED_AUTHOR }}" + else + echo "No changes to commit" + fi diff --git a/.gitignore b/.gitignore index 8b479a8b..b8098178 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,5 @@ # bundler snapshot of all gems and versions that it installed # https://bundler.io/rationale.html Gemfile.lock + +.jekyll-metadata diff --git a/Gemfile b/Gemfile index e4bb3af0..9b5e72ad 100644 --- a/Gemfile +++ b/Gemfile @@ -2,4 +2,5 @@ source 'https://rubygems.org' group :jekyll_plugins do gem 'github-pages' gem 'jekyll-twitter-plugin' + gem 'webrick' end diff --git a/README.md b/README.md index 30683b3e..f6bb3996 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,6 @@ # su2code.github.io [Link to Website](https://su2code.github.io/) + +## For Developers + +In order to make any changes in the documentation of SU2, the files in [_docs_v7/](_docs_v7) should be touched. This is the documentation which is currently online. diff --git a/_config.yml b/_config.yml index f09ad726..e63bd734 100644 --- a/_config.yml +++ b/_config.yml @@ -16,7 +16,7 @@ bootwatch: yeti # Build settings markdown: kramdown highlighter: rouge -gems: +plugins: - jekyll-feed - jekyll-redirect-from - jekyll-seo-tag @@ -76,6 +76,25 @@ defaults: sectionid: vandv seo: type: "WebPage" + +- scope: + path: _su2gui + type: su2gui + values: + layout: su2gui + sectionid: su2gui + seo: + type: "WebPage" + +- scope: + path: _gsoc + type: gsoc + values: + layout: gsoc + sectionid: gsoc + seo: + type: "WebPage" + collections: docs: permalink: /:collection/:path/ @@ -89,6 +108,12 @@ collections: vandv: permalink: /:collection/:path/ output: true + su2gui: + permalink: /:collection/:path/ + output: true + gsoc: + permalink: /:collection/:path/ + output: true posts: permalink: /blog/:year/:month/:day/:title/ output: true diff --git a/_data/docs_v7.yml b/_data/docs_v7.yml index 840fd876..69224b75 100644 --- a/_data/docs_v7.yml +++ b/_data/docs_v7.yml @@ -29,6 +29,8 @@ - title: Theory docs_v7: - Theory + - Streamwise-Periodicity + - Thermochemical-Nonequilibrium - title: Users Guide docs_v7: @@ -39,6 +41,7 @@ - Physical-Definition - Markers-and-BC - Convective-Schemes + - Slope-Limiters-and-Shock-Resolution - Custom-Output - Linear-Solvers-and-Preconditioners - Multizone @@ -55,7 +58,7 @@ - Advanced-AD-Techniques - Container-Development - Writing-Unit-Tests - + - Tracy-Integration - title: FAQ docs_v7: - FAQ diff --git a/_data/gsoc.yml b/_data/gsoc.yml new file mode 100644 index 00000000..fad92a45 --- /dev/null +++ b/_data/gsoc.yml @@ -0,0 +1,11 @@ +- title: GSOC + gsoc: + - Introduction + +- title: Participation + gsoc: + - Participation + +- title: Assignments + gsoc: + - Assignments diff --git a/_data/su2gui.yml b/_data/su2gui.yml new file mode 100644 index 00000000..c822b29e --- /dev/null +++ b/_data/su2gui.yml @@ -0,0 +1,19 @@ +- title: Introduction to SU2GUI + su2gui: + - Introduction + - Quick-Start + +- title: Installation + su2gui: + - Installation + +- title: User Guide + su2gui: + - Terminal-Initialization + - Manage-Cases + - Mesh-File + - configurations + - Initialization + - Logs-Errors + - Result-Analysis + - Supported-Functionalities \ No newline at end of file diff --git a/_data/tutorials.yml b/_data/tutorials.yml index e69dbc6b..873857e1 100644 --- a/_data/tutorials.yml +++ b/_data/tutorials.yml @@ -12,10 +12,14 @@ - Laminar_Cylinder - Turbulent_Flat_Plate - Transitional_Flat_Plate + - Transitional_Flat_Plate_T3A - Turbulent_ONERAM6 - Unsteady_NACA0012 - UQ_NACA0012 - NICFD_nozzle + - NICFD_nozzle_datadriven + - Aachen_Turbine + - Actuator_Disk - title: Incompressible Flow tutorials: @@ -25,19 +29,29 @@ - Inc_Turbulent_NACA0012 - Inc_Laminar_Step - Inc_Laminar_Cavity - - Inc_Heated_Cylinders - + - Inc_Streamwise_Periodic + - Inc_Species_Transport + - Inc_Species_Transport_Composition_Dependent_Model + - Inc_Von_Karman + - Inc_Turbulent_Bend + - Inc_Urban_City + - title: Structural Mechanics tutorials: - Linear_Elasticity - Linear_Dynamics - Nonlinear_Elasticity - Multiple_Material - + - title: Multiphysics tutorials: - Static_FSI - Dynamic_FSI_Python + - Static_CHT + - Inc_Heated_Cylinders_Unsteady + - SS_CR_CHT + - Inc_Combustion + - TFC_python - title: Design Features tutorials: @@ -46,6 +60,12 @@ - Inviscid_3D_Constrained_ONERAM6 - Multi_Objective_Shape_Design - Unsteady_Shape_Opt_NACA0012 + - Species_Transport + - Inc_Turbulent_Bend_Opt + +- title: Workflow Setup + tutorials: + - paraview_live - title: Event Content tutorials: diff --git a/_data/vandv.yml b/_data/vandv.yml index de4b668c..8a857aae 100644 --- a/_data/vandv.yml +++ b/_data/vandv.yml @@ -8,3 +8,11 @@ - MMS_FVM_Navier_Stokes - Flat_Plate - Bump_Channel + - 30p30n + - swbli + - LM_transition + - dsma661 + +- title: Incompressible Flow + vandv: + - SANDIA_jet diff --git a/_docs/Advanced-AD-Techniques.md b/_docs/Advanced-AD-Techniques.md index f0aabd4a..3b9c6e61 100644 --- a/_docs/Advanced-AD-Techniques.md +++ b/_docs/Advanced-AD-Techniques.md @@ -25,7 +25,7 @@ we can build an internal representation of each expression to directly compute a The picture below shows the computational graph for the expression `φ=cos(v1)v2` and the compile-time representation as object with `su2double` being the general datatype used throughout SU2. ![Expression Templates](http://www.scicomp.uni-kl.de/wordpress/wp-content/uploads/2016/05/Screenshot-from-2016-05-20-15-49-59.png) -This object can be traversed to compute and store the partial derivatives `∂φ/∂v1=cos(v1)` and `∂φ/∂v2=-sin(v1)v2` based on the derivatives of each involved unary or binary operation. If recording is enabled the traversal of the computational graph of each +This object can be traversed to compute and store the partial derivatives `∂φ/∂v1=-sin(v1)v2` and `∂φ/∂v2=cos(v1)` based on the derivatives of each involved unary or binary operation. If recording is enabled the traversal of the computational graph of each expression is started as soon as it occurs on the right-hand side in a statement. Note that the partial derivatives are only stored if the corresponding argument has some dependency on the input variables set by the user. This kind of dependency or activity tracking is relatively easy to accomplish since every variable stores an index along with its value. A zero index represents passive variables while a non-zero index identifies active variables. This index will be @@ -35,7 +35,7 @@ as an argument. ### AD Tool Wrapper The CoDi library provides a special datatype and is automatically included -during the compilation if AD support is requested by the user (see [[AD Build]]) . For developers of SU2 there is no need to deal +during the compilation if AD support is requested by the user (see the build instructions for further information). For developers of SU2 there is no need to deal with this library explicitly which is why there are simple wrapper routines for the most important features available. These are for example the following: diff --git a/_docs/Installation.md b/_docs/Installation.md index e5df89cc..7a057be9 100644 --- a/_docs/Installation.md +++ b/_docs/Installation.md @@ -22,7 +22,7 @@ In general, all SU2 execution occurs via command line arguments within a termina ### Data Visualization -Users of SU2 need a data visualization tool to post-process solution files. The software currently supports .vtk and .plt output formats natively read by ParaView and Tecplot, respectively. ParaView provides full functionality for data visualization and is freely available under an open source license. Tecplot is a commercially-licensed software package widely used by the scientific computing community and is available for purchase. Some SU2 results are also output to comma-separated value (.csv) files, which can be read by a number of software packages. Furthermore, CGNS output files can also be generated, which can also be read by the majority of visualization programs. The two most typical packages used by the development team are the following: +Users of SU2 need a data visualization tool to post-process solution files. The software currently supports .vtk and .plt output formats natively read by ParaView and Tecplot, respectively. ParaView provides full functionality for data visualization and is freely available under an open source license. Tecplot is a commercially-licensed software package widely used by the scientific computing community and is available for purchase. Some SU2 results are also output to comma-separated value (.csv) files, which can be read by a number of software packages. Furthermore, CGNS output files can also be generated, which can also be read by the majority of visualization programs. The three most typical packages used by the development team are the following: - ParaView - Tecplot - FieldView diff --git a/_docs/Mesh-File.md b/_docs/Mesh-File.md index 626eb456..ca45798b 100644 --- a/_docs/Mesh-File.md +++ b/_docs/Mesh-File.md @@ -113,7 +113,7 @@ First, the number of boundaries, or markers, is specified using the "NMARK=" str ## CGNS Format -To make creating your own meshes easier and more accessible, support for the open CGNS data standard has been included within SU2. The main advantage gained is that complex meshes created in a third-party software package (one that supports unstructured, single-zone CGNS file export) can be used directly within SU2 without the need for conversion to the native format. Moreover, as CGNS is a binary format, the size of the mesh files can be significantly reduced. If needed, a converter from CGNS to the SU2 format has been built into SU2 (See the [inviscid wedge tutorial](../tutorials/Inviscid_Wedge)). +To make creating your own meshes easier and more accessible, support for the open CGNS data standard has been included within SU2. The main advantage gained is that complex meshes created in a third-party software package (one that supports unstructured, single-zone CGNS file export) can be used directly within SU2 without the need for conversion to the native format. Moreover, as CGNS is a binary format, the size of the mesh files can be significantly reduced. If needed, a converter from CGNS to the SU2 format has been built into SU2 (See the [inviscid wedge tutorial](../../tutorials/Inviscid_Wedge)). ### Compiling with CGNS Support diff --git a/_docs_v7/Build-SU2-Linux-MacOS.md b/_docs_v7/Build-SU2-Linux-MacOS.md index 82b4d873..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,30 +129,32 @@ 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 | | `-Denable-pastix` | `false` | enable PaStiX support | | `-Denable-mpp` | `false` | enable Mutation++ support | | `-Denable-mixedprec` | `false` | enable the use of single precision on linear solvers and preconditioners | +| `-Denable-mlpcpp` | `false` | enable the use of multi-layer perceptrons for data-driven fluid models | +| `-Denable-gprof` | `false` | enable profiling of SU2 through `gprof` | 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. @@ -164,7 +168,7 @@ The optimization level can be set with `--optimization=level`, where `level` cor However, that may not result in optimum performance, for example with the GNU compilers level 2 and the extra flag `-funroll-loops` results in better performance for most problems. Some numerical schemes support vectorization (see which ones in the Convective Schemes page), to make the most out of it the compiler needs to be informed of the target CPU architecture, so it knows what "kind of vectorization" it can generate (256 or 512bit, 128bit being the default). -With gcc, clang, and icc this can be done via the `-march=??` and `-mtune=??` options, where `??` needs to be set appropriately e.g. `skylake`, `ryzen`, etc., these flags can be passed to the compiler by setting `CXXFLAGS` before first running meson (which will print some messages acknowledging the flags). +With gcc, clang, and icc this can be done via the `-march=??` and `-mtune=??` options, where `??` needs to be set appropriately e.g. `skylake`, `znver3`, etc., these flags can be passed to the compiler by setting `CXXFLAGS` before first running meson (which will print some messages acknowledging the flags). #### Warning level #### @@ -186,9 +190,25 @@ If the use of BLAS is restricted to RBF interpolation, parallel versions of Open **Note:** The BLAS library needs to provide support for LAPACK functions. If this is not the case, the linker will fail with "undefined reference" errors, this problem can be solved by installing LAPACK and specifying it as an extra dependency when running `meson.py` using `-Dextra-deps=lapack` (this uses pkg-config, use commas to separate the names of multiple extra dependencies). +#### Profiling for developers #### + +Profiling allows developers to identify inefficiencies in their code. SU2 can be compiled with profiling enabled through `-Denable-gprof=true`. After reconfiguration of meson and compiling the code, profiling is enabled for your SU2 executable. In order to retrieve the profiling analysis information, first run your simulation as normal. The following example is for `SU2_CFD`, although profiling is also supported for `SU2_CFD_AD`. + +``` +/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 + +``` +gprof /path/to/binary/SU2_CFD > analysis.txt +``` + +Now the file `analysis.txt` contains the profiling analysis summary. For more advanced features on using `gprof` for profiling, see the [GNU gprof website](https://ftp.gnu.org/old-gnu/Manuals/gprof-2.9.1/html_mono/gprof.html). + ### Compilation ### -Finally to compile and install SU2 use +Finally to compile and install SU2 use ``` ./ninja -C build install ``` diff --git a/_docs_v7/Code-Review.md b/_docs_v7/Code-Review.md index 56f760bf..b55a1347 100644 --- a/_docs_v7/Code-Review.md +++ b/_docs_v7/Code-Review.md @@ -19,19 +19,19 @@ All developers and users (internal and external) are encouraged to participate i 2. Is the change implemented in the correct way? - Does it interact minimally with the rest of the code? - Does it have the correct algorithmic complexity? -- Is it located in the place? (file, etc.) +- Is it located in the right place? (file, class, etc.) 3. Is the code legible? - Is the code mostly legible on its own without documentation? - Are the variable names concise and accurate? -- Is there documentation where necessary, and it is correct? +- Is there documentation where necessary, and is it correct? 4. Does the code follow established conventions? - Does it match the SU2 code style? - Do the variable names follow the same patterns as in other parts of the code? # Good code changes -The above list is a long list of questions. A large change to the code will be much harder to review than a small change. As such, good pull requests will contain a minimal set of changes to be useful. Pull requests should "do one thing". In some cases, "doing one thing" may be a large change to the code, such as adding a new flow solver. In most cases, changes can be done in small increments that can each individually be reviewed and evaluated. Pull requests should not be of the form "Add a new config option and fix a bug in interation_structure.cpp". These should be two separate pull requests. +The above list is a long list of questions. A large change to the code will be much harder to review than a small change. As such, good pull requests will contain a minimal set of changes to be useful. Pull requests should "do one thing". In some cases, "doing one thing" may be a large change to the code, such as adding a new flow solver. In most cases, changes can be done in small increments that can each individually be reviewed and evaluated. Pull requests should not be of the form "Add a new config option and fix a bug in interation_structure.cpp". **Such pull requests will be required to be split**. # The Code Review Process Github provides an easy interface for performing code reviews as part of every Pull Request. After a Pull Request is submitted to the SU2 'develop' branch, two different developers must review and approve the code changes before the request can be merged, in addition to passing the Travis CI regression test suite. Reviewers have the opportunity to comment on the changes and requests specific changes. @@ -40,6 +40,6 @@ In response to these comments, the pull requester should make changes to the cod When a reviewer is happy with the proposed changes to the code, the reviewer should approve and can say "LGTM", standing for "looks good to me". In general, the changes to the code should be finalized before a LGTM is given, though if there are only very minor outstanding issues an LGTM can be given along with the changes. For example, if the only outstanding issue with the PR is that a word has been misspelled, a reviewer may make an inline comment about the misspelling, and in the main dialogue say "LGTM with the comment fix". -All developers are encouraged to participate in the code review process, as the code is for everyone. However, there will typically be a specific set of developers who are experts in the section of code that is being modified. Generally, an LGTM should be gotten from at least one of these developers before merging. Users can be requested using "@username", for example, "PTAL @su2luvr". This sends that user an email about the pull request. Similarly, this can be used to request the opinions of other developers. While this can feel burdensome, it is in place to maintain good, correct code. Please use good judgement -- if the change is a spelling fix in a comment, it is not necessary to solicit the opinion of the entire development team. +**All developers are encouraged to participate in the code review process, as the code is for everyone.** However, there will typically be a specific set of developers who are experts in the section of code that is being modified. Generally, a LGTM should be gotten from at least one of these developers before merging. Users can be requested using "@username", for example, "PTAL @su2luvr". This sends that user an email about the pull request. Similarly, this can be used to request the opinions of other developers. While this can feel burdensome, it is in place to maintain good, correct code. Once the proper set of "LGTM"s has been received, the change can be merged. If the pull-requester has commit access, it is tradition to let them make the merge. If the requester does not, then the main/final reviewer can submit the merge. If the pull-request came from an internal branch, the branch should be deleted on conclusion if it is no longer useful. diff --git a/_docs_v7/Code-Structure.md b/_docs_v7/Code-Structure.md index 4a00cbf4..b4271b4b 100644 --- a/_docs_v7/Code-Structure.md +++ b/_docs_v7/Code-Structure.md @@ -5,6 +5,8 @@ permalink: /docs_v7/Code-Structure/ Full details on the class hierarchy and internal structure of the code can be found in the Doxygen documentation for SU2. A brief description for the major C++ classes is given on this page. +**Note:** The images below can be out of sync with the current version of the code. + The objective of this section is to introduce the C++ class structure of SU2 at a high level. The class descriptions below focus on the structure within SU2_CFD (the main component of SU2), but many of the classes are also used in the other modules. Maximizing the flexibility of the code was a fundamental driver for the design of the class architecture, and an overview of the collaboration diagram of all classes within SU2_CFD is shown below. ![Class Structure General](../../docs_files/class_c_driver__coll__graph.png) diff --git a/_docs_v7/Container-Development.md b/_docs_v7/Container-Development.md index 99997899..bb3b0a15 100644 --- a/_docs_v7/Container-Development.md +++ b/_docs_v7/Container-Development.md @@ -20,20 +20,25 @@ A container is a virtual runtime environment that runs on top of a single operat We use [Docker](https://www.docker.com/) container during the software development life-cycle for running the regression tests and creating binaries for different operating systems during the release process. The execution of these containers is triggered by events (e.g. by a push to an open pull request) on Github using the [Github Actions](https://github.com/features/actions) feature. -The files for the creation of the containers can found in the [Docker-Builds](https://github.com/su2code/Docker-Builds) repository. Currently we have three different containers: +The files for the creation of the containers can found in the [Docker-Builds](https://github.com/su2code/Docker-Builds) repository. Currently we have five different containers: -- **build-su2**: Based on Ubuntu 18.04 (GCC v7.4.0, OpenMPI v2.1.1) it features all necessary packages that are needed to compile SU2. Furthermore a script is provided (set as the [entrypoint](https://docs.docker.com/engine/reference/builder/#entrypoint)) that will checkout and compile a specific branch with provided build options. -- **test-su2**: Based on the latest **build-su2** container. Includes a script that checks out the test cases and the tutorials and runs a specified test script. -- **build-su2-cross**: Based on the latest **build-su2** container it features an environment to create binaries for Linux, MacOS and Windows. All libraries are linked statically (including a custom build MPICH v3.3.2) with the binaries if a host file is specified in order achieve portability. For more information have a look at the [ReadMe](https://github.com/su2code/Docker-Builds/blob/master/build_cross/README.md). +- **build-su2**: Based on Ubuntu 20.04 (GCC v9.4.0, OpenMPI v4.0.3) it features all necessary packages that are needed to compile SU2. Furthermore a script is provided (set as the [entrypoint](https://docs.docker.com/engine/reference/builder/#entrypoint)) that will checkout and compile a specific branch with provided build options. +- **test-su2**: Based on the corresponding version of the **build-su2** container. Includes a script that checks out the test cases and the tutorials and runs a specified test script. +- **build-su2-cross**: Based on the corresponding version of the **build-su2** container. It features an environment to create binaries for Linux, MacOS and Windows. All libraries are linked statically (including a custom build MPICH v3.3.2) with the binaries if a host file is specified in order achieve portability. For more information have a look at the [ReadMe](https://github.com/su2code/Docker-Builds/blob/master/build_cross/README.md). +- **build-su2-tsan**: Based on the same setup as **build-su2**, this container is intended to build SU2 with the thread sanitizer for automatic data race detection. To this end, it features a custom gcc build and provides a preconfigured environment for building with the thread sanitizer. +- **test-su2-tsan**: Like **test-su2** but based on the corresponding version of the **build-su2-tsan** container instead. Can be used like **test-su2** and is intended for testing for data races. **Note:** The build containers *do not* include binaries to run SU2, and they are not intended to do so (except for running the regression tests). It is assumed that you have added your linux username to the `docker` group, like it is explained [here](https://docs.docker.com/install/linux/linux-postinstall/). Otherwise `sudo` is required to run docker. There also a [rootless version](https://docs.docker.com/engine/security/rootless/) available. -The most recent versions can be found on [Docker Hub](https://hub.docker.com/r/su2code/) and can be pulled with `docker pull su2code/*` (where `*` can be replaced with `build-su2`, `test-su2` or `build-su2-cross`) if docker is properly installed on your machine. +The most recent versions of prebuilt container images can be found in the [GitHub container registry](https://github.com/orgs/su2code/packages). You can click on an image to see its versions and the command for pulling it, e.g., `docker pull ghcr.io/su2code/su2/build-su2:230704-1323` for a specific version of **build-su2**. + In the following we give a small overview on how to use the containers to compile and run the tests. We will only cover basic commands for docker. If you are interested in learning more, check out the [official documentation](https://docs.docker.com/). +Please note that some of the examples refer to features that are only available in the latest [develop](https://github.com/su2code/SU2/tree/develop) branch of SU2. + ## Running a container ## @@ -47,7 +52,7 @@ You should see the following message, which means that everything works as inten SU2 v7 Docker Compilation Container SU2 source directory not found. Make sure to ... ``` -The containers we provide all feature entrypoint scripts, i.e. a script that is executed when the container is started. If no arguments are given, like in the command above, it just prints an error message. The arguments of the compile and test scripts are discussed [here](#using-the-scripts-to-compile-su2). If the image does not already exist locally, it will be pulled from docker hub. You can specify a tag by adding `:tagname` to the name. If none is specified, it will use `:latest` by default. Let us have a look at the most important arguments for the `docker run` command: +The containers we provide all feature entrypoint scripts, i.e. a script that is executed when the container is started. If no arguments are given, like in the command above, it just prints an error message. The arguments of the compile and test scripts are discussed [here](#using-the-scripts-to-compile-su2). Make sure to pull the image first, as explained above, or provide the full URL including a version tag, e.g., `ghcr.io/su2code/su2/build-su2:230704-1323`. Let us have a look at the most important arguments for the `docker run` command: - `-ti` (or `--interactive --tty`): Needed to provide input to the container (stdin) via the terminal. - `--rm`: Automatically remove the container when it exits (otherwise ressources (disk space) are still occupied) @@ -55,11 +60,17 @@ The containers we provide all feature entrypoint scripts, i.e. a script that is - `--volume :` (or `-v`): Bind mount a volume where `` is a local folder on the host and `` the mount location in the container. - `--workdir ` (or `-w`): The working directory inside the container. +### Working interactively in a container ### + A typical call where the current directory on the host is mounted and used as working directory would look like this: ``` docker run -ti --rm -v $PWD:/workdir/ -w /workdir --entrypoint bash su2code/build-su2 ``` -Here, we also override the entrypoint in order to execute a bash shell. Note, that all changes you make will be lost after you exit the container (except from changes in the working directory). Once in the bash you can simply use an existing or new clone of the repository to compile SU2 [the usual way](/docs_v7/Build-SU2-Linux-MacOS/). +Here, we also override the entrypoint in order to execute a bash shell. Note that all changes you make will be lost after you exit the container (except from changes in the working directory). Once in the bash you can simply use an existing or new clone of the repository to compile SU2 [the usual way](/docs_v7/Build-SU2-Linux-MacOS/), run a regression test script, or execute a specific regression test. + +This interactive way of using the container gives you most control over building and testing SU2, we recommend it particularly for running specific tests instead of entire test scripts, e.g., when debugging them with the thread sanitizer. If you look for an out-of-the-box way of compiling and testing SU2, please refer to the sections about using the scripts below. + +If you want to build SU2 with the thread sanitizer, you work with the **build-su2-tsan** container instead and compile SU2 as explained above. Note that the thread sanitizer is only meaningful for SU2 builds with OpenMP. You don't have to supply any additional flags when configuring, compiling, or running, the container provides a fully configured environment. Any test executed with SU2 built this way will perform thread sanitizer analysis. ## Using the scripts to compile SU2 ## @@ -68,7 +79,7 @@ The scripts provide an easy way to directly clone and compile a specific branch The [compile script](https://github.com/su2code/Docker-Builds/blob/master/build/compileSU2.sh) expects two arguments, the build flags for meson and the branch name. They are given with `-f` and `-b`, respectively. E.g. to compile the master branch with python wrapper enabled: ``` -docker run -ti --rm su2code/build-su2 -f "-Denable-pywrapper=true" -b master +docker run -ti --rm su2code/su2/build-su2 -f "-Denable-pywrapper=true" -b master ``` ### Accessing source code and binaries ### @@ -113,4 +124,17 @@ docker run -ti --rm -v $PWD:/workdir/ -w /workdir \ docker run -ti --rm -v $PWD/install/bin:/workdir/install/bin -w /workdir \ -v $PWD/src/SU2_develop:/workdir/src/SU2 \ su2code/test-su2 -t develop -c develop -s parallel_regression.py -``` \ No newline at end of file +``` + +### Running thread sanitizer tests ### + +If you want to run thread sanitizer tests, you have to build SU2 with the **build-su2-tsan** container and test with the **test-su2-tsan** container. Thread sanitizer analysis is only meaningful for OpenMP builds and the hybrid regression scripts. It is advisable to use optimized debug builds to reduce runtime while still getting useful stack traces. You should provide the `--tsan` flag to the test script, which disables tests that are either not compatible with the thread sanitizer or take too long to run. The following example demonstrates thread sanitizer testing. + +``` +docker run -ti --rm -v $PWD:/workdir/ -w /workdir \ + su2code/su2/build-su2-tsan -f "--buildtype=debugoptimized -Dwith-omp=true" -b develop + +docker run -ti --rm -v $PWD/install/bin:/workdir/install/bin -w /workdir \ + -v $PWD/src/SU2_develop:/workdir/src/SU2 \ + su2code/su2/test-su2-tsan -t develop -c develop -s hybrid_regression.py -a "--tsan" +``` diff --git a/_docs_v7/Convective-Schemes.md b/_docs_v7/Convective-Schemes.md index 0195cbe8..62d25c6d 100755 --- a/_docs_v7/Convective-Schemes.md +++ b/_docs_v7/Convective-Schemes.md @@ -24,7 +24,7 @@ The options listed here do not apply to the high order DG solver. Convective schemes are used in the FVM discretization of convective fluxes through the faces of the dual-grid control volumes. They are selected via option `CONV_NUM_METHOD_FLOW` and fall under the two broad categories of central and upwind. Central schemes tend to be more robust whereas second order upwind schemes can be more accurate (i.e. less dissipative). -To achieve second order upwind schemes need to be used with MUSCL reconstruction (`MUSCL_FLOW = YES`), see the "gradients and limiters" page for the MUSCL-related options. +To achieve second-order in space, upwind schemes need to be used with MUSCL reconstruction (`MUSCL_FLOW = YES`), see the [Slope Limiters and Shock Resolution](/docs_v7/Slope-Limiters-and-Shock-Resolution) page for the MUSCL-related options. **Note:** MUSCL options have no effect on central schemes or on coarse multigrid levels in general. @@ -32,7 +32,7 @@ To achieve second order upwind schemes need to be used with MUSCL reconstruction | Solver | Version | | --- | --- | -| `EULER`, `NAVIER_STOKES`, `RANS` | 7.0.0 | +| `EULER`, `NAVIER_STOKES`, `RANS` | 8.0.0 | ### Central Schemes ### @@ -46,9 +46,7 @@ In implicit time marching it improves the numerical properties of the Jacobian m To maintain CFL at lower-than-default values of dissipation coefficients, a higher factor should be used. `JST_MAT` benefits from higher values (~8.0). -All compressible central schemes support vectorization (`USE_VECTORIZATION= YES`) with no robustness downsides, see the build instructions for how to tune the compilation for maximum vectorization performance. - -**Note:** The Lax-Friedrich scheme is always used on coarse multigrid levels when any central scheme is selected. +**Note:** The Lax-Friedrich scheme is always used on coarse multigrid levels when any central scheme is selected. All compressible central schemes use vectorization, see the build instructions for how to tune the compilation for maximum performance. ### Upwind Schemes ### @@ -62,28 +60,25 @@ All compressible central schemes support vectorization (`USE_VECTORIZATION= YES` - `SLAU` - Simple Low dissipation AUSM scheme; - `SLAU2` - SLAU with the alternative pressure flux formulation; - `HLLC` - Harten-Lax-van Leer-Contact; -- `CUSP` - Convective Upwind Split Pressure; - `MSW` - Modified Steger-Warming. Some of the schemes above have tunning parameters or accept extra options, the following table lists those options and indicates to which schemes they apply (if a scheme does not appear on the table, no options apply to it). -| Option \ Scheme | `ROE` | `L2ROE` | `TURKEL_PREC` | `AUSMPLUSUP[2]` | `SLAU[2]` | `HLLC` | `CUSP` | -| --------------------------------- | ----- | ------- | ------------- | --------------- | --------- | ------ | ------ | -| **`ROE_KAPPA`** | X | X | X | | | X | | -| **`ENTROPY_FIX_COEFF`** | X | X | X | | | | X | -| **`ROE_LOW_DISSIPATION`** | X | | | | X | | | -| **`USE_ACCURATE_FLUX_JACOBIANS`** | | | | X | X | | | -| **`MIN/MAX_ROE_TURKEL_PREC`** | | | X | | | | | -| **`USE_VECTORIZATION`** | X | | | | | | | +| Option \ Scheme | `ROE` | `L2ROE` | `TURKEL_PREC` | `AUSMPLUSUP[2]` | `SLAU[2]` | `HLLC` | +| --------------------------------- | ----- | ------- | ------------- | --------------- | --------- | ------ | +| **`ROE_KAPPA`** | X | X | X | | | X | +| **`ENTROPY_FIX_COEFF`** | X | X | X | | | | +| **`ROE_LOW_DISSIPATION`** | X | | | | X | | +| **`USE_ACCURATE_FLUX_JACOBIANS`** | | | | X | X | | +| **`MIN/MAX_ROE_TURKEL_PREC`** | | | X | | | | - `ROE_KAPPA`, default 0.5, constant that multiplies the left and right state sum; - `ENTROPY_FIX_COEFF`, default 0.001, puts a lower bound on dissipation by limiting the minimum convective Eigenvalue to a fraction of the speed of sound. Increasing it may help overcome convergence issues, at the expense of making the solution sensitive to this parameter. - `ROE_LOW_DISSIPATION`, default `NONE`, methods to reduce dissipation in regions where certain conditions are verified, `FD` (wall distance based), `NTS` (Travin and Shur), `FD_DUCROS` and `NTS_DUCROS` as before plus Ducros' shock sensor; - `USE_ACCURATE_FLUX_JACOBIANS`, default `NO`, if set to `YES` accurate flux Jacobians are used instead of Roe approximates, slower on a per iteration basis but in some cases allows much higher CFL values to be used and therefore faster overall convergence; - `MIN_ROE_TURKEL_PREC` and `MAX_ROE_TURKEL_PREC`, defaults 0.01 and 0.2 respectively, reference Mach numbers for Turkel preconditioning; -- `USE_VECTORIZATION`, default `NO`, if `YES` use the vectorized (SSE, AVX, or AVX512) implementation which is faster but may be less robust against initial solution transients. -**Note:** Some schemes are not compatible with all other features of SU2, the AUSM family and CUSP are not compatible with unsteady simulations of moving grids, non-ideal gases are only compatible with the standard Roe and HLLC schemes. +**Note:** Some schemes are not compatible with all other features of SU2, the AUSM family is not compatible with unsteady simulations of moving grids, non-ideal gases are only compatible with the standard Roe and HLLC schemes. The only upwind scheme that uses vectorization is the Roe scheme (ideal gas only), see the build instructions for how to tune the compilation for maximum performance. ## Incompressible Flow ## @@ -97,14 +92,15 @@ Some of the schemes above have tunning parameters or accept extra options, the f ### Upwind Schemes ### -`FDS` - Flux Difference Splitting with low speed preconditioning, this scheme does not have tunning parameters. +`FDS` - Flux Difference Splitting with low speed preconditioning, this scheme does not have tuning parameters. -## Turbulence Equations ## +## Turbulence and Scalar/Species Equations ## | Solver | Version | | --- | --- | -| `RANS`, `INC_RANS` | 7.0.0 | +| `RANS`, `INC_RANS` | 8.0.0 | -Only one method is currently available: `SCALAR_UPWIND` which must be selected via option `CONV_NUM_METHOD_TURB`. -This method does not have any special parameters. +For compressible flows the only method available is `SCALAR_UPWIND` which must be selected via option `CONV_NUM_METHOD_TURB`. +For incompressible flows the `BOUNDED_SCALAR` method is also available, this includes a divergence correction to prevent spurious production/destruction of the transported scalar while convergence is not reached. +These methods do not have any special parameters. diff --git a/_docs_v7/Custom-Output.md b/_docs_v7/Custom-Output.md index 9610e91e..04d8bfe9 100644 --- a/_docs_v7/Custom-Output.md +++ b/_docs_v7/Custom-Output.md @@ -16,6 +16,7 @@ It is now possible to individually define what you want to have in your output. - [Screen Output](#screen-output) - [History Output](#history-output) - [Example](#example-1) + - [User Defined Functions ](#user-defined-functions) --- @@ -29,7 +30,7 @@ Let's define some terminology first. - **Output group**: A collection of output fields. -**Note**: You can print all available output fields and groups available for the current solver (set with the `SOLVER` option) by calling `SU2_CFD` with the `-d` flag, i.e. +**Note**: You can print all available output fields and groups available for the current solver (set with the `SOLVER` option) by calling `SU2_CFD` with the `-d` flag (dry-run mode), i.e. ``` SU2_CFD -d ``` @@ -42,8 +43,12 @@ SU2 can output the solution in several file formats. You can specify what files | Option value | Description | |---|---| | `RESTART` | Native SU2 binary restart format | -| `RESTART_ASCII` | ASCII CSV restart format | +| `RESTART_ASCII` | Native SU2 ASCII CSV restart format | +| `STL_BINARY` | binary mesh in .stl format | +| `STL_ASCII` | ASCII mesh in .stl format | +| `MESH` | Native SU2 mesh in .su2 format | | `CSV` | ASCII CSV restart format (identical to `RESTART_ASCII`) | +| `PARAVIEW_MULTIBLOCK` | Binary Paraview .vtm format | | `PARAVIEW` | Binary Paraview .vtk format | | `PARAVIEW_ASCII` | ASCII Paraview .vtk format | | `TECPLOT` | Binary Tecplot .szplt format | @@ -54,44 +59,103 @@ SU2 can output the solution in several file formats. You can specify what files | `SURFACE_TECPLOT` | Surface values in binary Tecplot .szplt format (includes all markers set with `MARKER_PLOTTING`)| | `SURFACE_TECPLOT_ASCII` | Surface values in ASCII Tecplot .dat format (includes all markers set with `MARKER_PLOTTING`)| -The default value of `OUTPUT_FILES` is `(RESTART, PARAVIEW, SURFACE_PARAVIEW)`. The output frequency can be set by using the `OUTPUT_WRT_FREQ` option. If it is a time-dependent problem, the frequency is based on the time iterations, while for steady-state problems it is based on the outer or inner iterations, depending on whether it is a multi-zone or single-zone problem, respectively. +The default value of `OUTPUT_FILES` is `(RESTART, PARAVIEW, SURFACE_PARAVIEW)`. The output frequencies can be set by using the `OUTPUT_WRT_FREQ` option. OUTPUT_WRT_FREQ accepts a list of integer values for each of the file types in `OUTPUT_FILES`. If a single value is given, this value will be used as the writing frequency for all output files. If 2 values are used, the first value is used for the first file type in OUTPUT_FILES, and the second value is used for the other file types in the list. For time-dependent problems, the frequency is based on the time iterations, while for steady-state problems it is based on the outer or inner iterations, depending on whether it is a multi-zone or single-zone problem, respectively. -**Note:** If run SU2 in parallel you should always use binary output files to get the best performance. +**Note:** If you run SU2 in parallel you should always use binary output files to get the best performance. ### Setting Output Fields ### The `VOLUME_OUTPUT` option can be used to set fields for the restart and visualization files. Here you have the option to specify either single fields and/or groups. +| Option value | Default value | Description | Data type | +|---|---|---|---| +| VOLUME_OUTPUT| COORDINATES,SOLUTION,PRIMITIVE| fields or groups that will be saved to file| list of keywords| + + ### Example ### +Groups and fields can be combined, e.g.: + +`VOLUME_OUTPUT= SOLUTION, PRESSURE, DENSITY ` + +will save all field that are in the `SOLUTION` group. Pressure is in the `PRIMITIVE` group for the compressible solver and in the `SOLUTION` group for the incompressible solver. Density on the other hand is in the `SOLUTION` group for the compressible solver and in the `PRIMITIVE` group for the incompressible solver. They can be added individually as in the example above, or by simply adding the entire `PRIMITIVE` group to the list if file size is no issue. Note that keywords that are not valid for the current setup will simply be ignored. + For the compressible Navier-Stokes solver (i.e. `SOLVER=NAVIER_STOKES`), a **non-exhaustive list** of possible fields/groups is the following: -| Field Name | Description | Group Name | +| Field Name | Description | Group Name | Remarks | +|---|---|---| +| `COORD-X` | x coordinate | `COORDINATES` | - | +| `COORD-Y` | y coordinate | `COORDINATES` | - | +| `COORD-Z` | z coordinate | `COORDINATES` | 3D only | +| `DENSITY` | Density | `SOLUTION` | - | +| `MOMENTUM-X` | Momentum x-component | `SOLUTION` | - | +| `MOMENTUM-Y` | Momentum y-component | `SOLUTION` | - | +| `MOMENTUM-Z` | Momentum z-component | `SOLUTION` | 3D only | +| `ENERGY` | Energy | `SOLUTION` | - | +| `PRESSURE` | Pressure| `PRIMITIVE` | - | +| `TEMPERATURE` | Temperature | `PRIMITIVE` | - | +| `MACH` | Mach Number | `PRIMITIVE` | - | +| `PRESSURE_COEFF` | Pressure Coefficient | `PRIMITIVE` | - | +| `LAMINAR_VISCOSITY` | Laminar viscosity | `PRIMITIVE` | - | +| `SKIN_FRICTION-X` | Skin friction coefficient x-component | `PRIMITIVE` | - | +| `SKIN_FRICTION-Y` | Skin friction coefficient y-component | `PRIMITIVE` | - | +| `SKIN_FRICTION-Z` | Skin friction coefficient z-component | `PRIMITIVE` | 3D only | +| `HEAT_FLUX` | Heat flux | `PRIMITIVE` | - | +| `Y_PLUS` | Y-Plus | `PRIMITIVE` | - | + +Additionally, for every field in the SOLUTION group, the limiters (group name `LIMITER`) and residuals (group name RESIDUAL) can be saved by adding `RES_` or `LIMITER_` in front of the field name. + + +For the incompressible Navier-Stokes solver (i.e. `SOLVER=INC_NAVIER_STOKES`), the solution group is different: + +| Field Name | Description | Group Name | Remarks | +|---|---|---| +| `PRESSURE` | Pressure | `SOLUTION` | - | +| `VELOCITY-X` | Velocity x-component | `SOLUTION` | - | +| `VELOCITY-Y` | Velocity y-component | `SOLUTION` | - | +| `VELOCITY-Z` | Velocity z-component | `SOLUTION` | 3D only | +| `TEMPERATURE` | Static Temperature | `SOLUTION` | `INC_ENERGY_EQUATION= YES` | +| `DENSITY` | Density | `PRIMITIVE` | - | + + +Turbulence quantities: + +| Field Name | Description | Group Name | Remarks | +|---|---|---| +| `NU_TILDE` | Spalart Allmaras variable | `SOLUTION` | SA models | +| `TKE` | Turbulent kinetic energy k | `SOLUTION` | SST models | +| `DISSIPATION` | Turbulent dissipation rate omega | `SOLUTION` | SST models | +| `EDDY_VISCOSITY` | Turbulent eddy viscosity | `PRIMITIVE` | - | + + +To inspect the mesh quality we additionaly have: + +| Field Name | Description | Group Name | Remarks | |---|---|---| -| `COORD-X` | x coordinate | `COORDINATES` | -| `COORD-Y` | y coordinate | `COORDINATES` | -| `COORD-Z` | z coordinate | `COORDINATES` | -| `DENSITY` | Density | `SOLUTION` | -| `MOMENTUM-X` | Momentum x-component | `SOLUTION` | -| `MOMENTUM-Y` | Momentum y-component | `SOLUTION` | -| `MOMENTUM-Z` | Momentum z-component | `SOLUTION` | -| `ENERGY` | Energy | `SOLUTION` | -| `PRESSURE` | Pressure| `PRIMITIVE` | -| `TEMPERATURE` | Temperature | `PRIMITIVE` | -| `MACH` | Mach Number | `PRIMITIVE` | -| `PRESSURE_COEFF` | Pressure Coefficient | `PRIMITIVE` | -| `LAMINAR_VISCOSITY` | Laminar viscosity | `PRIMITIVE` | -| `SKIN_FRICTION-X` | Skin friction coefficient x-component | `PRIMITIVE` | -| `SKIN_FRICTION-Y` | Skin friction coefficient y-component | `PRIMITIVE` | -| `SKIN_FRICTION-Z` | Skin friction coefficient z-component | `PRIMITIVE` | -| `HEAT_FLUX` | Heat flux | `PRIMITIVE` | -| `Y_PLUS` | Y-Plus | `PRIMITIVE` | +| `ORTHOGONALITY` | Orthogonality angle | `MESH_QUALITY` | - | +| `ASPECT_RATIO` | CV Aspect ratio | `MESH_QUALITY` | - | +| `VOLUME_RATIO` | CV sub-volume ratio | `MESH_QUALITY` | - | + +For moving grids: + +| Field Name | Description | Group Name | Remarks | +|---|---|---| +| `GRID_VELOCITY-X` | X-component of grid velocity vector | `GRID_VELOCITY` | - | +| `GRID_VELOCITY-Y` | Y-component of grid velocity vector | `GRID_VELOCITY` | - | +| `GRID_VELOCITY-Z` | Z-component of grid velocity vector | `GRID_VELOCITY` | 3D only | ## Customizing the Screen and History Output ## ### Screen Output ### -You can define the output fields you want to have on screen by using the config option `SCREEN_OUTPUT`. +You can define the output fields you want to have printed on screen by using the config option `SCREEN_OUTPUT`. + +| Option value | Default value | Description | Data type | Remark | +|---|---|---|---|---| +| SCREEN_OUTPUT| INNER_ITER, RMS_DENSITY, RMS_MOMENTUM-X,RMS_MOMENTUM-Y, RMS_ENERGY| field or group that will be printed to screen | list of keywords| compressible | +| SCREEN_OUTPUT| INNER_ITER, RMS_PRESSURE, VELOCITY-X,VELOCITY-Y| field or group that will be printed to screen | list of keywords| incompressible | + + Fields available depend on the solver you are using. Fields available for **all solvers** are the following: - `TIME_ITER`: Time iteration index @@ -102,7 +166,6 @@ Fields available depend on the solver you are using. Fields available for **all - `WALL_TIME`: Current average wall-clock time for one iteration - If you run a multizone problem, the convergence history of the individual zones (i.e. the convergence of the inner iteration) is disabled by default and only the convergence of the outer iteration is shown. That means `SCREEN_OUTPUT` in the sub-config files is ignored. You can still print fields from individual zones by using the field name and the zone index. For example in an Fluid-Structure interaction problem the drag in zone 0 and the von-Mises stress in zone 1 can be used as fields by adding `DRAG[0]` and/or `VMS[1]` to the screen output in the main config file. It is possible to force the output of the full inner convergence history per zone by setting `WRT_ZONE_CONV` to `YES`. You can also customize the frequency when the convergence history should be written to screen by using `SCREEN_WRT_FREQ_INNER`, `SCREEN_WRT_FREQ_OUTER` and `SCREEN_WRT_FREQ_TIME`. @@ -110,7 +173,7 @@ You can also customize the frequency when the convergence history should be writ ### History Output ### -The history output can be customized in a similar fashion to the screen output by using the `HISTORY_OUTPUT` option. In fact, screen and history outputs share all fields which means that everything that can written to screen can be written also to the history file and vice versa. However, instead of specifying single output fields, for the history output it is **only possible** to specify output groups by using the group name. +The history output can be customized in a similar fashion as the screen output by using the `HISTORY_OUTPUT` option. In fact, screen and history outputs share all fields which means that everything that can written to screen can be written also to the history file and vice versa. If you run a multizone problem, in addition to the history files per zone, a file (default: `history_multizone.dat`) will be created where the convergence history of the outer iteration is stored. Groups for this output can be set by using the `HISTORY_OUTPUT` option in the main config file. @@ -120,7 +183,7 @@ You can also customize the frequency when the convergence history should be writ For the compressible Navier-Stokes solver (i.e. `SOLVER=NAVIER_STOKES`), a **non-exhaustive list** of possible fields/groups is the following: -| Field Name (for screen output) | Description | Group Name (for history output) | +| Field Name | Description | Group Name | |---|---|---| | `TIME_ITER` | Time iteration index | `ITER` | | `OUTER_ITER` | Outer (coupling) iteration index. | `ITER` | @@ -129,18 +192,51 @@ For the compressible Navier-Stokes solver (i.e. `SOLVER=NAVIER_STOKES`), a **non | `TIME_STEP` | Current time step. | `TIME_DOMAIN` | | `WALL_TIME` | Current average wall-clock time for one iteration. | `WALL_TIME` | | `RMS_DENSITY` | Root-mean square residual of the density. | `RMS_RES` | -| `RMS_MOMENTUM-X` | Root-mean square residual of the momentum x-component. | `RMS_RES` | -| `RMS_MOMENTUM-Y` | Root-mean square residual of the momentum y-component. | `RMS_RES` | -| `RMS_MOMENTUM-Z` | Root-mean square residual of the momentum z-component. | `RMS_RES` | -| `RMS_ENERGY` | Root-mean square residual of the energy. | `RMS_RES` | -| `DRAG` | Total Drag coefficient. | `AERO_COEFF` | -| `LIFT` | Total Lift coefficient | `AERO_COEFF` | -| `SIDEFORCE` | Total Sideforce coefficient. | `AERO_COEFF` | -| `MOMENT-X` | Total Moment around the x-axis. | `AERO_COEFF` | -| `MOMENT-Y` | Total Moment around the y-axis. | `AERO_COEFF` | -| `MOMENT-Z` | Total Moment around the z-axis. | `AERO_COEFF` | -| `FORCE-X` | Total Force in x direction. | `AERO_COEFF` | -| `FORCE-Y` | Total Force in y direction. | `AERO_COEFF` | -| `FORCE-Z` | Total Force in z direction.| `AERO_COEFF` | -| `EFFICIENCY` | Total Lift-to-drag ratio. | `AERO_COEFF` | +| `RMS_MOMENTUM-X` | Root-mean square residual of the momentum x-component. | `RMS_RES` | +| `RMS_MOMENTUM-Y` | Root-mean square residual of the momentum y-component. | `RMS_RES` | +| `RMS_MOMENTUM-Z` | Root-mean square residual of the momentum z-component. | `RMS_RES` | +| `RMS_ENERGY` | Root-mean square residual of the energy. | `RMS_RES` | +| `DRAG` | Total Drag coefficient. | `AERO_COEFF` | +| `LIFT` | Total Lift coefficient | `AERO_COEFF` | +| `SIDEFORCE` | Total Sideforce coefficient. | `AERO_COEFF` | +| `MOMENT_X` | Total Moment around the x-axis. | `AERO_COEFF` | +| `MOMENT_Y` | Total Moment around the y-axis. | `AERO_COEFF` | +| `MOMENT_Z` | Total Moment around the z-axis. | `AERO_COEFF` | +| `FORCE_X` | Total Force in x direction. | `AERO_COEFF` | +| `FORCE_Y` | Total Force in y direction. | `AERO_COEFF` | +| `FORCE_Z` | Total Force in z direction.| `AERO_COEFF` | +| `EFFICIENCY` | Total Lift-to-drag ratio. | `AERO_COEFF` | + +### User Defined Functions ### + +From version 7.4.0 it is possible for users to create custom outputs via math expressions of solver variables and built-in outputs. +All custom outputs are specified via the config option `CUSTOM_OUTPUTS`, in general the syntax to define a custom output is `name : type{expression}[markers];` (note the use of ; to separate different outputs). +Where 'name' is the identifier that can be used to request output to screen or history file, and also to reference the output in other custom outputs (he group name for all custom outputs is `CUSTOM`). + +The available types are: +- `Macro`: Introduces a new field that can only be used in other expressions, it is not an output by itself (note the "$" symbol to reference macros in the example below). +- `Function`: Introduces a new scalar output that is a function of other scalar outputs, it cannot reference fields (e.g. velocity). +- `AreaAvg` and `AreaInt`: Computes an area average or integral of a field (the expression) over the list of markers. +- `MassFlowAvg` and `MassFlowInt`: Computes a mass flow average or integral. +- `Probe`: Evaluates the expression using the values of the mesh point closest to the coordinates specified inside "[]", [x, y] or [x, y, z] (2 or 3D). + +**Note:** Each custom output can only use one type, e.g. it is not possible to write `p_drop : AreaAvg{PRESSURE}[inlet] - AreaAvg{PRESSURE}[outlet]`. This would need to be separated into two `AreaAvg` outputs and one `Function` to compute their difference. + +**Example:** +``` +CUSTOM_OUTPUTS= 'velocity : Macro{sqrt(pow(VELOCITY_X, 2) + pow(VELOCITY_Y, 2) + pow(VELOCITY_Z, 2))};\ + avg_vel : AreaAvg{$velocity}[z_minus, z_plus];\ + var_vel : AreaAvg{pow($velocity - avg_vel, 2)}[z_minus, z_plus];\ + dev_vel : Function{sqrt(var_vel) / avg_vel};\ + probe1 : Probe{$velocity}[0.005, 0.005, 0.05]' +``` + +To obtain the list of solver variables that can be used, write an invalid expression (e.g. 'x : AreaAvg{INVALID}[]') and run SU2. + +To use a custom output as the objective function of the discrete adjoint solver, use `OBJECTIVE_FUNCTION= CUSTOM_OBJFUNC` and set `CUSTOM_OBJFUNC` appropriately, for example: +``` +CUSTOM_OBJFUNC= 'LIFT + dev_vel' +``` + +For more details see the [example test case](https://github.com/su2code/SU2/blob/master/TestCases/user_defined_functions/lam_flatplate.cfg). diff --git a/_docs_v7/Developing-SU2-on-GitHub-(Internal-Developers).md b/_docs_v7/Developing-SU2-on-GitHub-(Internal-Developers).md index 97b90519..f14cfdd6 100644 --- a/_docs_v7/Developing-SU2-on-GitHub-(Internal-Developers).md +++ b/_docs_v7/Developing-SU2-on-GitHub-(Internal-Developers).md @@ -5,10 +5,10 @@ permalink: /docs_v7/Developing-SU2-on-GitHub-(Internal-Developers)/ The repository for SU2 is being hosted here on GitHub. As you are likely aware, GitHub is simply an online project hosting service with a very useful web interface and additional tools to aid code development with Git as its backbone. Git is a version control system (VCS) that is similar to SVN, Mercurial, etc., and it helps organize the development of code over time by tracking changes. -To get started, you need to create a personal user account on GitHub (free) and follow the [basic setup instructions](https://help.github.com/articles/set-up-git). These instructions include how to get Git installed on your local machine. To sync up your local settings with GitHub, change the user.email and user.name variables for your local git configuration with +To get started, you need to create a personal user account on GitHub (free) and follow the [basic setup instructions](https://help.github.com/articles/set-up-git). These instructions include how to get Git installed on your local machine. To sync up your local settings with GitHub, change the `user.email` and `user.name` variables for your local git configuration with ``` -git config --global user.email "your_email@domain.com" -git config --global user.name "Your Name" +git config --local user.email "your_email@domain.com" +git config --local user.name "Your Name" ``` Note that the email address should be the one associated with your GitHub account. @@ -22,6 +22,7 @@ After cloning, you should have a new SU2/ folder in your current working directo ``` git log ``` +To setup the local copy of SU2 for development purposes, one must follow the steps mentioned in [Build-SU2-Windows](_docs_v7/Build-SU2-Windows.md) and [Build-SU2-Linux-MacOS](_docs_v7/Build-SU2-Linux-MacOS.md). ## Typical Workflow with Git diff --git a/_docs_v7/Execution.md b/_docs_v7/Execution.md index e0ffc443..03b1032b 100644 --- a/_docs_v7/Execution.md +++ b/_docs_v7/Execution.md @@ -15,7 +15,7 @@ Once downloaded and installed, and now that you know the basics for setting up y - [Discrete Adjoint Gradient Calculation (discrete_adjoint.py)](#discrete-adjoint-gradient-calculation-discreteadjointpy) - [Finite Difference Gradient Calculation (finite_differences.py)](#finite-difference-gradient-calculation-finitedifferencespy) - [Shape Optimization Script (shape_optimization.py)](#shape-optimization-script-shapeoptimizationpy) - + - [Python wrapper scripts](#python-wrapper-scripts) --- ## C++ Modules @@ -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) @@ -109,3 +109,30 @@ Options: * `-n PARTITIONS, --partitions=PARTITIONS` number of PARTITIONS * `-g GRADIENT, --gradient=GRADIENT` Method for computing the GRADIENT (ADJOINT, DISCRETE_ADJOINT, FINDIFF, NONE) * `-q QUIET, --quiet=QUIET` True/False Quiet all SU2 output (optimizer output only) + +### Python wrapper scripts + +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 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*: + +Usage: `export PYTHONPATH=~/SU2/bin:$PYTHONPATH` + +You should now be able to call SU2 from a python file. A quick way to test this is by using the following command: + +Usage: `python -c "import pysu2; print('hello world') "` + +If you see the message *hello world* without any error messages, you can now try to run the pywrapper examples in the */Testcases/py_wrapper* subdirectory. +For instance the unsteady flat plate with conjugate heat transfer. Note that the configuration files are inside the SU2 repository and the meshes for the testcases are inside the Testcases repository. We recommend to copy .cfg files to the Testcases repository and run from there. +``` +cd ~/Testcases/py_wrapper/flatplate_unsteady_CHT +cp ~/SU2/Testcases/py_wrapper/flatplate_unsteady_CHT/unsteady_CHT_FlatPlate_Conf.cfg . +python launch_unsteady_CHT_FlatPlate.py -f unsteady_CHT_FlatPlate_Conf.cfg +``` + +Options: +* `-h, --help` show this help message and exit +* `-f FILE, --file=FILE` read config from FILE +* `--parallel` Specify if we need to initialize MPI diff --git a/_docs_v7/Gitting-Started.md b/_docs_v7/Gitting-Started.md index cc08f795..93a3fdbf 100644 --- a/_docs_v7/Gitting-Started.md +++ b/_docs_v7/Gitting-Started.md @@ -16,6 +16,10 @@ We follow [a popular git branching strategy](http://nvie.com/posts/a-successful- ## Contributing Code -SU2 merges new code contributions through pull requests. As a new developer, you'll want to fork SU2 to your personal account. This creates a clone of the whole SU2 repository, branches and all, inside your github account. Generally you'll want to start from the develop branch, but you can check with the developers if you think it would be more appropriate to work on a feature branch. +SU2 merges new code contributions through pull requests. As a new developer, you'll want to fork SU2 to your personal account. This creates a clone of the whole SU2 repository, branches and all, inside your github account. Generally you'll want to **start from the develop branch**, but you can check with the developers if you think it would be more appropriate to work on a feature branch (join the SU2 slack channel or open a GitHub discussion to get in touch). -You can push all of your working changes to your forked repository. Once you're happy with these, and want to push them to the origin repository, submit a pull request to the 'develop' branch under the SU2 repo. Make sure to pull any new changes from the origin repository before submitting the pull request, so that the changes can be merged more simply. The SU2 developers will review the changes, make comments, ask for some edits. Then when everything looks good, your changes will merge into the main development branch! +You can push all of your working changes to your forked repository. Once you're happy with these, and want to push them to the origin repository, submit a pull request to the 'develop' branch under the SU2 repo. Make sure to **pull any new changes regularly** from the origin repository before submitting the pull request, so that the changes can be merged more simply. The SU2 developers will review the changes, make comments, ask for some edits, and when everything looks good, your changes will merge into the main development branch! + +### General Guidelines +- If you have a very clear plan for the work you are doing, open a **draft pull request** so that the maintainers can start reviewing early. +- If you are working on a large feature (1k+ lines of code (loc), or 200+ loc with changes to 10+ files) ask to be added to the SU2 organization to work from the SU2 repo directly instead of your fork (this makes reviewing easier). diff --git a/_docs_v7/Markers-and-BC.md b/_docs_v7/Markers-and-BC.md index b9ffae3a..f4edb12f 100755 --- a/_docs_v7/Markers-and-BC.md +++ b/_docs_v7/Markers-and-BC.md @@ -10,13 +10,18 @@ The term *Marker* refers to a named entity in your mesh file. Boundary condition - [Euler (Slip) Wall](#euler-slip-wall) - [Symmetry Wall](#symmetry-wall) - [Constant Heatflux (no-slip) Wall](#constant-heatflux-no-slip-wall) +- [Heat Transfer or Convection (no-slip) Wall](#heat-transfer-or-convection-no-slip-wall) - [Isothermal (no-slip) Wall](#isothermal-no-slip-wall) - [Farfield Boundary Condition](#farfield-boundary-condition) +- [Turbulence Boundary Condition](#turbulence-boundary-condition) + - [Wall functions](#wall-functions) - [Inlet Boundary Condition](#inlet-boundary-condition) - [Total Conditions](#total-conditions) - [Mass Flow Inlet](#mass-flow-inlet) - [Velocity Inlet](#velocity-inlet) - [Pressure Inlet](#pressure-inlet) +- [Supersonic Inlet Boundary Condition](#supersonic-inlet-boundary-condition) + - [Thermochemical Nonequilibrium Supersonic Inlet](#thermochemical-nonequilibrium-supersonic-inlet) - [Outlet Boundary Condition](#outlet-boundary-condition) - [Pressure Outlet (Compressible)](#pressure-outlet-compressible) - [Pressure Outlet (Incompressible)](#pressure-outlet-incompressible) @@ -72,7 +77,30 @@ A wall with a prescribed constant heatflux is defined with the `MARKER_HEATFLUX` MARKER_HEATFLUX = (Wall1, 1e05, Wall2, 0.0) ``` -**Note**: Typically Navier-Stokes and RANS simulations are setup with adiabatic walls (heatflux = 0). +Instead of a constant heatflux (in `[W/m^2]`), a constant rate of heat flow (in `[W]`) can be prescribed by additionally adding the option `INTEGRATED_HEATFLUX= YES`. For the above `MARKER_HEATFLUX`, lets consider that `Wall1` has a surface area of 0.3 `[m^2]` then one could equivalently prescribe +``` +MARKER_HEATFLUX = (Wall1, 0.3e05, Wall2, 0.0) +``` + +when additionally using the `INTEGRATED_HEATFLUX= YES` option. In the case of a DOE or an optimization this prescription of a rate of heat flow might be the more natural boundary condition. + +**Notes**: +1. Typically Navier-Stokes and RANS simulations are setup with adiabatic walls (heatflux = 0). +2. `INTEGRATED_HEATFLUX` is not available for `FEM_NAVIER_STOKES`. + +## Heat Transfer or Convection (no-slip) Wall ## + +| Solver | Version | +| --- | --- | +| `NAVIER_STOKES`, `RANS`, `INC_NAVIER_STOKES`, `INC_RANS` | 7.0.0 | + + +A wall with a prescribed locally variable heatflux via a heat transfer coefficient and and a Temperature at infinity (or reservoir Temperature) is defined with the `MARKER_HEATTRANSFER` option. The heatflux `q` computes to `q = h(T_inf - T_wall)`, where `T_wall` is the local wall temperature and therefore no user input. The option format is the marker name followed by the value of the heat-transfer coefficient (in Watts per square meter and Kelvin `[W/(m^2*K)],[J/(s*m^2*K)]`) and the value of the Temperature at infinity (in Kelvin `[K]`), e.g. +``` +MARKER_HEATTRANSFER = (Wall1, 10.0, 350.0, Wall2, 5.0, 330.0, ...) +``` + +**Note**: The Heat Transfer Wall degenerates to an adiabatic wall when the heat transfer coefficient is zero. On the other extreme (a very high heat transfer coefficient) the Heat Transfer Wall degenerates to an isothermal wall with Temperature at infinity being the wall temperature. ## Isothermal (no-slip) Wall ## @@ -97,6 +125,51 @@ A marker can be defined as a Farfield boundary by addings its name to the `MARKE MARKER_FAR= (farfield) ``` +## Turbulence Boundary Condition ## + +| Solver | Version | +| --- | --- | +| `RANS`, `INC_RANS`, | 7.3.0 | + +The turbulence boundary conditions have a `MARKER_INLET_TURBULENT` keyword for the Turbulence models. For the SA turbulence model, ratio of turbulent to laminar viscosity can be provided at each inlet as follows: + +``` +MARKER_INLET_TURBULENT= (inlet_marker1, NuFactor1, inlet_marker2, NuFactor2, ...) +``` + +If 'MARKER_INLET_TURBULENT' is not provided in the .cfg file, SU2 will filled up the markers with the freestream option: + +``` +FREESTREAM_NU_FACTOR= 3 +``` + +Similarly, for the SST turbulence model, turbulence intensity and turbulent-to-laminar ratio can be provided at each inlet as follows: + +``` +MARKER_INLET_TURBULENT= (inlet_1, TURBULENCEINTENSITY_1, TURB2LAMVISCRATIO_1 , inlet_2, TURBULENCEINTENSITY_1, TURB2LAMVISCRATIO_1 ,..) +``` +If 'MARKER_INLET_TURBULENT' is not provided in the .cfg file, SU2 will filled up the markers with the freestream options: + +``` +FREESTREAM_TURBULENCEINTENSITY= 0.05 +FREESTREAM_TURB2LAMVISCRATIO= 10 +``` + +### Wall functions ### +Accurately resolving the turbulence close to walls requires very fine meshes and can be quite expensive. When the vertices of the first cell neighboring the wall have on average a normalized distance $$y^+ >1$$, wall functions can be used. For example to activate wall functions on the markers `wall1` and `wall2`, we write: +``` +MARKER_WALL_FUNCTIONS=(wall1,STANDARD_WALL_FUNCTION,wall2,STANDARD_WALL_FUNCTION) +``` +The wall functions will now be used automatically. all functions have 5 additional expert parameters: +``` +WALLMODEL_KAPPA= 0.41 +WALLMODEL_B= 5.5 +WALLMODEL_MINYPLUS= 5.0 +WALLMODEL_MAXITER= 200 +WALLMODEL_RELFAC= 0.5 +``` +The constant `WALLMODEL_KAPPA` is the von Karman constant, and `WALLMODEL_B` is an additional constant describing the universal 'law of the wall'. The constants are supposed to be universal, and do not change. The setting `WALLMODEL_MINYPLUS= 5` will activate the wall model only when the local value of $$y^+$$ is higher than the value given (default: 5). Note that in principle, this implementation is valid for any $$y^+ < 100-500$$ and will also work correctly for very small values of $$y^+$$. the upper limit that can be used depends on (and increases with) the Reynolds number. The universal law of the wall is an implicit function and a Newton iterator is used to determine $$u^+(y^+)$$. The maximum number of iterations can be set by `WALLMODEL_MAXITER` and the relaxation factor can be set with `WALLMODEL_RELFAC`. When the Newton solver does not converge within the maximum number of iterations given, a warning message will appear during the computation. When these warning messages do not disappear, you might consider increasing `WALLMODEL_MAXITER` or decreasing `WALLMODEL_RELFAC`. + ## Inlet Boundary Condition ## Inlet boundary conditions are set using the option `MARKER_INLET`. @@ -131,11 +204,11 @@ MARKER_INLET = (inlet1, 1.13 , 20, 1.0, 0.0, 0.0, inlet2, 1.15, 10, 0.0, 1.0, 0. | --- | --- | | `INC_EULER`, `INC_NAVIER_STOKES`, `INC_RANS` | 7.0.0 | -To describe the **Velocity** at the inlet, set the option `INC_INLET_TYPE= VELOCITY_INLET`. The format for `MARKER_INLET` then is the marker name, followed by the Temperature (in Kelvin `[K`]), the Velocity magnitude (in meter per second `[m/s]`) and the flow direction unity vector (in meter per second `[m/s]`). +To describe the **Velocity** as well as the **Temperature** at the inlet, set the option `INC_INLET_TYPE= VELOCITY_INLET`. The format for `MARKER_INLET` then is the marker name, followed by the Temperature (in Kelvin `[K`]), the Velocity magnitude (in meter per second `[m/s]`) and the flow direction vector (the direction vector does not need to be normalized). Note that the temperature has to be provided even when `INC_ENERGY_EQUATION= NO`, but it will be ignored in the calculations. ``` INC_INLET_TYPE= VELOCITY_INLET, VELOCITY_INLET -MARKER_INLET = (inlet1, 300 , 20, 1.0, 0.0, 0.0, inlet2, 200, 10, 0.0, 1.0, 0.0) +MARKER_INLET = (inlet1, 300, 20, 1.0, 0.0, 0.0, inlet2, 200, 10, 0.0, 1.0, 0.0) ``` ### Pressure Inlet ### @@ -155,6 +228,28 @@ MARKER_INLET = (inlet1, 300 , 1e6, 1.0, 0.0, 0.0, inlet2, 200, 1e6, 0.0, 1.0, 0. **Note 2**: Updates to the velocity based on the prescribed pressure are damped in order to help with stability/convergence. The damping coefficient can be changed using the `INC_INLET_DAMPING` option (default is `0.1`). +## Supersonic Inlet Boundary Condition ## +Supersonic inlet boundary conditions are set using the option `MARKER_SUPERSONIC_INLET`. + +### Thermochemical Nonequilibrium Supersonic Inlet + +| Solver | Version | +| --- | --- | +| `NEMO_EULER`, `NEMO_NAVIER_STOKES` | 7.0.0 | + +The format for `MARKER_SUPERSONIC_INLET` for the NEMO solvers is the marker name, followed by the static translational-rotational Temperature (in Kelvin `[K]`), the static Pressure (in Pascal `[Pa]`) and the flow velocity vector (in meter per second `[m/s]`). For example: + +``` +MARKER_SUPERSONIC_INLET = (inlet1, 300, 1e6, 1000.0, 0.0, 0.0, inlet2, 400, 1e6, 0.0, 1000.0, 0.0) +``` + +For the NEMO solvers, a gas composition at the inlet must also be specified using the `INLET_GAS_COMPOSITION` option, as well as the vibrational-electronic Temperature at the inlet, using the `INLET_TEMPERATURE_VE` option. If no vibrational-electronic Temperature is specified, the given translational-rotational Temperature set for the inlet is used by default. For example: + +``` +INLET_GAS_COMPOSITION = (0.77, 0.23, 0.0, 0.0, 0.0) +INLET_TEMPERATURE_VE = 288.15 +``` + ## Outlet Boundary Condition ## Outlet boundary conditions are set using the `MARKER_OUTLET` option. diff --git a/_docs_v7/Physical-Definition.md b/_docs_v7/Physical-Definition.md index c5b36555..09d52bf7 100644 --- a/_docs_v7/Physical-Definition.md +++ b/_docs_v7/Physical-Definition.md @@ -9,21 +9,53 @@ SU2 offers different ways of setting and computing this definition. This documen --- +- [Fluid Model](#fluid-model) - [Reference Values](#reference-values) - [Free-Stream Definition (Compressible)](#free-stream-definition-compressible) - [Thermodynamic State](#thermodynamic-state) - [Mach Number and Velocity](#mach-number-and-velocity) - [Reynolds Number and Viscosity](#reynolds-number-and-viscosity) - [Non-Dimensionalization](#non-dimensionalization) +- [Free-Stream Definition (Thermochemical Nonequilibrium)](#free-stream-definition-thermochemical-nonequilibrium) + - [Free-Stream Temperatures](#free-stream-temperatures) + - [Chemical Composition and Mass Fractions](#chemical-composition-and-mass-fractions) +- [Transport Coefficient Model (Thermochemical Nonequilibrium)](#transport-coefficient-model-thermochemical-nonequilibrium) - [Flow Condition (Incompressible)](#flow-condition-incompressible) - [Thermodynamic and Gauge Pressure](#thermodynamic-and-gauge-pressure) - [Initial State and Non-Dimensionalization](#initial-state-and-non-dimensionalization) +- [Turbulence Models](#turbulence-models) + - [Spalart-Allmaras (SA)](#spalart-allmaras-model) + - [Shear Stress Transport (SST)](#shear-stress-transport) +- [Transition Models](#transition-models) --- +## Fluid Model ## + +| Solver | Version | +| --- | --- | +| `EULER`, `NAVIER_STOKES`, `RANS`, `NEMO_EULER`, `NEMO_NAVIER_STOKES`, `INC_EULER`, `INC_NAVIER_STOKES`, `INC_RANS`, `FEM_EULER`, `FEM_NAVIER_STOKES` | 7.0.0 | + +For fluid simulations, a model defining the equation of state and thermodynamic properties of the fluid or mixture is required. This is selected using the `FLUID_MODEL` option in the config. Available fluid models in SU2 include: + +| Option Value | Description | +|---|---| +|`STANDARD_AIR` | **Air model with ideal gas EOS** | +|`IDEAL_GAS` | **Arbitrary fluid with ideal gas EOS** | +|`VW_GAS` | **Arbitrary fluid with Vander-Waals EOS** | +|`PR_GAS` | **Arbitrary fluid with Peng-Robinson EOS** | +|`CONSTANT_DENSITY` | **Constant density** | +|`INC_IDEAL_GAS` | **Incompressible fluid constant specific heat** | +|`INC_IDEAL_GAS_POLY` | **Incompressible fluid polynomial specific heat** | +|`FLUID_MIXTURE` | **Incompressible ideal gas mixing laws for multicomponent flow** | +|`SU2_NONEQ` | **SU2 nonequilibrium thermochemical library** | +|`MUTATIONPP` | **Mutation++ nonequilibrium thermochemical library** | + +Some fluid models require the specification of additional parameters, with the full set of required options available in the configuration file template. + ## Reference Values ## -| Solver | Version | +| Solver | Version | | --- | --- | | `EULER`, `NAVIER_STOKES`, `RANS`, `INC_EULER`, `INC_NAVIER_STOKES`, `INC_RANS`, `FEM_EULER`, `FEM_NAVIER_STOKES` | 7.0.0 | @@ -47,7 +79,7 @@ The following table depicts the reference values used by most of the solvers in ## Free-Stream Definition (Compressible) ## -| Solver | Version | +| Solver | Version | | --- | --- | | `EULER`, `NAVIER_STOKES`, `RANS`,`FEM_EULER`, `FEM_NAVIER_STOKES` | 7.0.0 | @@ -77,9 +109,41 @@ For all schemes, as reference values for the density and temperature the free-st - `FREESTREAM_VEL_EQ_MACH`: Reference pressure is chosen such that the non-dimensional free-stream velocity equals the Mach number: $$p_{ref} = \gamma p_{\infty}$$. - `FREESTREAM_VEL_EQ_ONE`: Reference pressure is chosen such that the non-dimensional free-stream velocity equals `1.0`: $$p_{ref} = Ma^2_{\infty} \gamma p_{\infty}$$. +## Free-Stream Definition (Thermochemical Nonequilibrium) ## + +| Solver | Version | +| --- | --- | +| `NEMO_EULER`, `NEMO_NAVIER_STOKES` | 7.0.0 | + +The physical definition for the thermochemical nonequilibrium (NEMO) solvers is similar to the compressible solvers, but with additional parameters to specify. The free-stream values are not only used as boundary conditions for the `MARKER_FAR` option, but also for initialization and non-dimensionalization. That means even if you don't have any farfield BCs in your problem, it might be important to prescribe physically meaningful values for the options. + +### Free-Stream Temperatures ### + +Thermodynamic state is specified using the same options as the compressible solver, with the addition of the free-stream electronic temperature. This can be specified using the `FREESTREAM_TEMPERATURE_VE` option in the config file. For a free-stream in equilibrium, this is typically the same value as specified in the `FREESTREAM_TEMPERATURE` option. + +### Chemical Composition and Mass Fractions ### + +The NEMO solvers require a specification of thermochemical nonequilibrium library using the `FLUID_MODEL` option, either `SU2_NONEQ` if using the SU2 built-in thermochemical library, or `MUTATIONPP` if using the Mutation++ thermochemical library. + +A chemistry model, consisting of a set of flow species, thermochemical properties, and chemical reactions, is specified using `GAS_MODEL`. The names of these models are specific to the thermochemical library. If using the `SU2_NONEQ` option the choices are `ARGON`, `N2`, `AIR-5`, and `AIR-7`. + +Free-stream mass fractions must also be specified in list using the option `GAS_COMPOSITION`. The mass fractions are specified as decimal values in the order of the species in the gas model. For example, an AIR-5 mixture of 77% oxygen and 23% nitrogen would be expressed as (0.77, 0.23, 0.00, 0.00, 0.00). + +## Transport Coefficient Model (Thermochemical Nonequilibrium) ## + +| Solver | Version | +| --- | --- | +| `NEMO_NAVIER_STOKES` | 7.0.0 | + +A transport coefficient model must be specified for viscous simulations with the NEMO solver, using the `TRANSPORT_COEFF_MODEL` config option. Available options when using the SU2TCLib thermochemical library are the Wilkes-Blottner-Eucken, Gupta-Yos, and Sutherland viscosity models, specified by `WILKE`, `GUPTA-YOS`, and `SUTHERLAND`, respectively. The default option for transport coefficient model is Wilkes-Blottner-Eucken. + +It should be noted the Sutherland model is only used to evaluate viscosity, and the Wilkes-Blottner-Eucken model is used to evaluate diffusion coefficient and thermal conductivity. + +--- + ## Flow Condition (Incompressible) ## -| Solver | Version | +| Solver | Version | | --- | --- | | `INC_EULER`, `INC_NAVIER_STOKES`, `INC_RANS` | 7.0.0 | @@ -97,3 +161,83 @@ The reference values $$\rho_{ref}, T_{ref}, v_{ref}$$ equal the initial state va **Note:** The initial state is also used as boundary conditions for `MARKER_FAR`. +## Turbulence Models ## + +| Solver | Version | +| --- | --- | +| `*_RANS` | 7.4.0 | + +This section describes how to setup turbulence models for RANS simulations. Turbulence is activated using the option `KIND_SOLVER= RANS`, or `KIND_SOLVER= INC_RANS` +A turbulence model can then be selected via the option `KIND_TURB_MODEL` +Different submodels and parameters are specified via the different options listed below. +The turbulent Prandtl number can be modified with the option `PRANDTL_TURB` (the default is 0.9). + +### Spalart-Allmaras (SA) ### + +SU2 implements several versions and corrections of the SA model. +The model is selected using `KIND_TURB_MODEL= SA` and the modifications via the `SA_OPTIONS` list. If this list is empty, then SU2 defaults to `SA-noft2`. +The freestream and inlet conditions are specified via the option `FREESTREAM_NU_FACTOR= 3` (ratio of SA variable to freestream kinematic viscosity). + +The following modifications are allowed (refer to [NASA's TMR](https://turbmodels.larc.nasa.gov/spalart.html) for further info): +- Versions: + - `NEGATIVE` - Negative SA model. + - `EDWARDS` - Edwards modification. + - `BCM` - BCM transitional model. + - `WITHFT2` - SA model **with** ft2 term, note that by default we omit this term. +- Corrections: + - `QCR2000` - Quadratic contitutive relation used in the stress tensor. + - `COMPRESSIBILITY` - Mixing layer compressibility correction. + - `ROTATION` - Dacles-Mariani et al. rotation correction. + +All the modifications can be combined with each other expect `NEGATIVE` and `EDWARDS`. +For example, to specify `SA-neg-R-comp-QCR2000` use `SA_OPTIONS= NEGATIVE, WITHFT2, ROTATION, COMPRESSIBILITY, QCR2000`. +**However, some combinations are not considered standard**, e.g. `SA-neg` should have the ft2 term, whereas `SA-noft2-Edwards` and `SA-noft2-BCM` should not have the ft2 term, and they are usually not combined with other corrections (see TMR for more details). To use non-standard combinations it is necessary to add `EXPERIMENTAL` to the option list, e.g. `SA_OPTIONS= NEGATIVE, BCM, EXPERIMENTAL`. + +The rough wall correction is implicitly turned on by specifying roughness values for wall markers via the `WALL_ROUGHNESS` option. + +### Shear Stress Transport (SST) ### + +SU2 implements the "Standard" (1994) and 2003 versions of the SST model along with several modifications. + +**Note:** Currently all versions are "modified" i.e. the turbulence kinetic energy (TKE) is not included in the viscous stress tensor. + +The main model is selected using `KIND_TURB_MODEL= SST` and the version and modifications via the `SST_OPTIONS` list. If this list is empty SU2 defaults to the baseline 1994 model, `V1994m` (see warning below). The options allow for a version and a set of modifiers to the version. +The freestream and inlet conditions are specified via the options `FREESTREAM_TURBULENCEINTENSITY= 0.05` (5%) and `FREESTREAM_TURB2LAMVISCRATIO= 10` (ratio of turbulent to laminar viscosity). + +**Note:** The default values for these options are suitable for internal flows but may be too high for external aerodynamics problems. + +The following modifications are allowed: +- Versions: + - `V1994m` - SSTm **WARNING:** Our implementation has a small [inconsistency with the literature](https://github.com/su2code/SU2/issues/1551), which will be resolved in the next major SU2 update (i.e. version 8). + - `V2003m` - SST-2003m (no known inconsistencies). +- Production modifications: + - `VORTICITY` - Uses vorticity to compute the source term instead of strain-rate magnitude. + - `KATO_LAUNDER` - Uses the Kato-Launder modification (vorticity times strain-rate). + - `UQ` - Production is computed using a modified stress tensor for [uncertainty quantification](https://su2code.github.io/tutorials/UQ_NACA0012/). **Note** with this modification TKE is always included in the stress tensor. +- Corrections: + - `SUSTAINING` - SST with controlled decay. + - Curvature corrections are currently not implemented. + +Modifications from each of these three groups can be combined, for example `SST_OPTIONS= V2003m, VORTICITY, SUSTAINING` + +## Transition Models ## + +| Solver | Version | +| --- | --- | +| `*_RANS` | 7.5.0 | + +This section describes how to setup transition models for RANS simulations. Transition is activated using the option `KIND_SOLVER= RANS`, or `KIND_SOLVER= INC_RANS` together with a choice of `KIND_TRANS_MODEL` (different from `NONE`). +Currently, the only valid option for `KIND_TRANS_MODEL` is `LM`, for Langtry-Menter transition models. +Different submodels and correlations are then specified via `LM_OPTIONS` (for example `LM_OPTIONS= LM2015, MENTER_LANGTRY`). + +The following modifications are allowed: +- Versions: + - `LM2015` - Correction to include stationary crossflow instabilities. It has to be used only in 3D problems. The RMS of roughness used in this model has to be set through the separate option `HROUGHNESS`. +- Correlations (only one can be specified): + - `MALAN` - This is the default correlation when the LM model is coupled with the `SA` turbulence model. + - `SULUKSNA` - This should be used only if the `SST` model is used. It should require a formulation of the Re_theta_t correlation that omits the pressure gradient parameter, however it is not clear. + - `KRAUSE` - This correlation should be used for hypersonic flows. Its implementation at the moment is unclear due to inconsistencies in the literature. + - `KRAUSE_HYPER` - This correlation should be used for hypersonic flows. Its implementation at the moment is unclear due to inconsistencies in the literature. + - `MEDIDA` - Designed for `SA` turbulence model. Has problems when dealing with separation induced transition. + - `MEDIDA_BAEDER` - Designed for `SA` turbulence model. Has problems when dealing with separation induced transition. + - `MENTER_LANGTRY` - This is the default correlation when the LM model is coupled with the `SST` turbulence model. diff --git a/_docs_v7/Quick-Start.md b/_docs_v7/Quick-Start.md index e2fecd99..534f2053 100644 --- a/_docs_v7/Quick-Start.md +++ b/_docs_v7/Quick-Start.md @@ -3,7 +3,7 @@ title: Quick Start permalink: /docs_v7/Quick-Start/ --- -Welcome to the Quick Start Tutorial for the SU2 software suite. This tutorial is intended to demonstrate some of the key features of the analysis and design tools in an easily accessible format. Completion of this tutorial only requires a few minutes. If you haven't done so already, please visit the [Download](/download.html) and [Installation](/docs_v7/Installation/) pages to obtain the most recent stable release of the software and details for installation. This tutorial requires only the SU2_CFD tool from the SU2 suite. +Welcome to the Quick Start Tutorial for the SU2 software suite. This tutorial is intended to demonstrate some of the key features of the analysis and design tools in an easily accessible format. Completion of this tutorial only requires a few minutes. If you haven't done so already, please visit the [Download](/download.html) and [Installation](/docs_v7/Installation/) pages to obtain the most recent stable release of the software and details for installation. This tutorial requires only the SU2_CFD tool from the SU2 suite (and optionally the SU2_CFD_AD tool). --- @@ -13,22 +13,24 @@ Welcome to the Quick Start Tutorial for the SU2 software suite. This tutorial is - [Background](#background) - [Problem Setup](#problem-setup) - [Mesh Description](#mesh-description) - - [Configuration File Options](#configuration-file-options) - - [Running SU2](#running-su2) - - [Results](#results) - - [Flow Solution](#flow-solution) - - [Adjoint Solution](#adjoint-solution) + - [Direct Problem Configuration](#direct-problem-configuration) + - [Running SU2 Direct Analysis](#running-su2-direct-analysis) + - [Direct Analysis Results](#direct-analysis-results) + - [Running SU2 Adjoint Analysis](#running-su2-adjoint-analysis) + - [Adjoint Analysis Results](#adjoint-analysis-results) +- [Conclusions](#conclusions) --- -![NACA 0012 Pressure](../../docs_files/naca0012_pressure.png) +![NACA 0012 Pressure](../../docs_files/NACA0012_pressure_field.png) ## Goals -Upon completing this simple tutorial, the user will be familiar with performing the flow and continuous adjoint simulation of external, inviscid flow around a 2D geometry and be able to plot both the flow solution and the surface sensitivities that result. The specific geometry chosen for the tutorial is the NACA 0012 airfoil. Consequently, the following capabilities of SU2 will be showcased in this tutorial: -- Steady, 2D, Euler and Continuous Adjoint Euler equations +Upon completing this simple tutorial, the user will be familiar with performing the flow and continuous (and/or discrete) adjoint simulation of external, inviscid flow around a 2D geometry and be able to plot both the flow solution and the surface sensitivities that result. The specific geometry chosen for the tutorial is the NACA 0012 airfoil. Consequently, the following capabilities of SU2 will be showcased in this tutorial: + +- Steady, 2D, Euler and Continuous/Discrete Adjoint Euler equations - Multigrid - JST numerical scheme for spatial discretization - Euler implicit time integration @@ -36,7 +38,7 @@ Upon completing this simple tutorial, the user will be familiar with performing ## Resources -The files necessary to run this tutorial are included in the [SU2/QuickStart/](https://github.com/su2code/SU2/tree/master/QuickStart) directory. For the other tutorials, the files will be found in the TestCases/ repository. Two files are needed as input to the code: a [configuration file](https://github.com/su2code/SU2/blob/master/QuickStart/inv_NACA0012.cfg) describing the options for the particular problem, and the corresponding computational [mesh file](https://github.com/su2code/SU2/blob/master/QuickStart/mesh_NACA0012_inv.su2). The files are in QuickStart/ and can also be found in the TestCases repository under TestCases/euler/naca0012. +The files necessary to run this tutorial are included in the [SU2/QuickStart/](https://github.com/su2code/SU2/tree/master/QuickStart) of the [SU2](https://github.com/su2code/SU2) repository. Some auxiliary files, useful to automate the tutorial simulations and the visualization of results, may be found in the [QuickStart](https://github.com/su2code/Tutorials/tree/master/compressible_flow/QuickStart) directory of the [Tutorials](https://github.com/su2code/Tutorials) repository. Files for other tutorials may be found in the same repository. For a start, two files are needed as input to the code: a [configuration file](https://github.com/su2code/SU2/blob/master/QuickStart/inv_NACA0012.cfg) describing the options for the particular problem, and the corresponding computational [mesh file](https://github.com/su2code/SU2/blob/master/QuickStart/mesh_NACA0012_inv.su2). ## Tutorial @@ -44,13 +46,13 @@ The following tutorial will walk you through the steps required to compute the f ### Background -The NACA0012 airfoil is one of the four-digit wing sections developed by the National Advisory Committee for Aeronautics (NACA), and it is a widely used geometry for many CFD test cases. The numbering system is such that the first number indicates the maximum camber (in percent of chord), the second shows the location of the maximum camber (in tens of percent of chord) and the last two digits indicate the maximum thickness (in percent of chord). More information on these airfoil sections can be found here or in the book 'Theory of Wing Sections' by Abbott and von Doenhoff. +The NACA 0012 airfoil is one of the four-digit wing sections developed by the National Advisory Committee for Aeronautics (NACA), and it is a widely used geometry for many CFD test cases. The numbering system is such that the first number indicates the maximum camber (in percent of chord), the second shows the location of the maximum camber (in tens of percent of chord) and the last two digits indicate the maximum thickness (in percent of chord). More information on these airfoil sections can be found here or in the book 'Theory of Wing Sections' by Abbott and von Doenhoff. ### Problem Setup -This problem will solve the Euler equations on the NACA0012 airfoil at an angle of attack of 1.25 degrees, using air with the following freestream conditions: +This problem will solve the Euler equations on the NACA 0012 airfoil at an angle of attack of 1.25 degrees, using air with the following freestream conditions: -- Pressure = 101,325 Pa +- Pressure = 101325 Pa - Temperature = 273.15 K - Mach number = 0.8 @@ -58,82 +60,88 @@ The aim is to find the flow solution and the adjoint solution with respect to an ### Mesh Description -The unstructured mesh provided is in the native .su2 format. It consists of 10,216 triangular cells, 5,233 points, and two boundaries (or "markers") named *airfoil* and *farfield*. The airfoil surface uses a flow-tangency Euler wall boundary condition, while the farfield uses a standard characteristic-based boundary condition. The figure below gives a view of the mesh. +The unstructured mesh provided is in the native .su2 format. It consists of 10216 triangular cells, 5233 points, and two boundaries (or "markers") named *airfoil* and *farfield*. The airfoil surface uses a flow-tangency Euler wall boundary condition, while the farfield uses a standard characteristic-based boundary condition. The figure below gives a view of the mesh. ![NACA 0012 Mesh](../../docs_files/naca0012_mesh.png) Figure (1): Far-field and zoom view of the computational mesh. -### Configuration File Options +### Direct Problem Configuration Aside from the mesh, the only other file required to run the SU2_CFD solver details the configuration options. It defines the problem, including all options for the numerical methods, flow conditions, multigrid, etc., and also specifies the names of the input mesh and output files. In keeping simplicity for this tutorial, only two configuration options will be discussed. More configuration options will be discussed throughout the remaining tutorials. Upon opening the inv_NACA0012.cfg file in a text editor, one of the early options is the MATH_PROBLEM: ``` -% Mathematical problem (DIRECT, CONTINUOUS_ADJOINT, DISCRETE_ADJOINT) +% Mathematical problem (DIRECT, CONTINUOUS_ADJOINT) MATH_PROBLEM= DIRECT ``` -SU2 is capable of running the direct and adjoint problems for several sets of equations. The direct analysis solves for the flow around the geometry, and quantities of interest such as the lift and drag coefficient on the body will be computed. Solving the adjoint problem leads to an efficient method for obtaining the change in a single objective function (e.g., the drag coefficient) relative to a large number of design variables (surface deformations). The direct and adjoint solutions often couple to provide the objective analysis and gradient information needed by an optimizer when performing aerodynamic shape design. In this tutorial, we will perform DIRECT and CONTINUOUS_ADJOINT solutions for the NACA 0012 airfoil. +SU2 is capable of running the direct and adjoint problems for several sets of equations. The direct analysis solves for the flow around the geometry, and quantities of interest such as the lift and drag coefficient on the body will be computed. Solving the adjoint problem leads to an efficient method for obtaining the change in a single objective function (e.g., the drag coefficient) relative to a large number of design variables (surface deformations). The direct and adjoint solutions often couple to provide the objective analysis and gradient information needed by an optimizer when performing aerodynamic shape design. In this tutorial, we will first perform a DIRECT simulation for the NACA 0012 airfoil. -The user can also set the format for the solution files: +The user can also set the format for the output files: ``` % Output file format -OUTPUT_FILES= (RESTART, TECPLOT, SURFACE_TECPLOT) +OUTPUT_FILES= (RESTART, PARAVIEW, SURFACE_CSV) ``` -SU2 can output solution files in the .vtk (ParaView), .dat (Tecplot ASCII), and .szplt (Tecplot binary) formats which can be opened in the ParaView and Tecplot visualization software packages, respectively. We have set the file type to TECPLOT in this tutorial by, but users without access to Tecplot are encouraged to download and use the freely available [ParaView](http://www.paraview.org) package. To output solution files for ParaView, set the `OUTPUT_FILES` option to `(RESTART, PARAVIEW, SURFACE_PARAVIEW)` which is the default value if the option is not present. +SU2 can output solution files in the .vtu (ParaView), .dat (Tecplot ASCII), and .szplt (Tecplot binary) formats which can be opened in the ParaView and Tecplot visualization software packages, respectively. We have set the file type to PARAVIEW in this tutorial: in order to visualize the solution, users are encouraged to download and use the freely available [ParaView](https://www.paraview.org) package. The output format for the data on the *airfoil* boundary is set to SURFACE_CSV (Comma Separated Values): the resulting text file may be plotted with various graphing tools or with LaTeX packages such as [PGFPlots](https://pgfplots.sourceforge.net/). Please note that, if the `OUTPUT_FILES` option is not present in the configuration file, its default value is `(RESTART, PARAVIEW, SURFACE_PARAVIEW)`. -### Running SU2 +### Running SU2 Direct Analysis The first step in this tutorial is to solve the Euler equations: 1. Either navigate to the QuickStart/ directory or create a directory in which to run the tutorial. If you have created a new directory, copy the config file (inv_NACA0012.cfg) and the mesh file (mesh_NACA0012_inv.su2) to this directory. - 2. Run the executable by entering `SU2_CFD inv_NACA0012.cfg` at the command line. If you have not set the $SU2_RUN environment variable you will need to run `../bin/SU2_CFD inv_NACA0012.cfg` (from the QuickStart directory) or use the appropriate path to your SU2_CFD executable at the command line. + 2. Run the executable by entering `SU2_CFD inv_NACA0012.cfg` at the command line. If you have not set the appropriate environment variables, you may need to specify the path to your SU2_CFD executable in the command line. 3. SU2 will print residual updates with each iteration of the flow solver, and the simulation will finish after reaching the specified convergence criteria. - 4. Files containing the flow results (with "flow" in the file name) will be written upon exiting SU2. The flow solution can be visualized in ParaView (.vtk) or Tecplot (.dat or .szplt). More specifically, these files are: - - **flow.szplt** or **flow.vtk** - full volume flow solution. - - **surface_flow.szplt** or **surface_flow.vtk** - flow solution along the airfoil surface. - - **surface_flow.csv** - comma separated values (.csv) file containing values along the airfoil surface. + 4. Files containing the flow results (with "flow" in the file name) will be written upon exiting SU2. The flow solution can be visualized in ParaView (.vtu) or Tecplot (.dat or .szplt). More specifically, these files are: + - **flow.vtu** (or **flow.szplt**) - full volume flow solution. + - **surface_flow.csv** (or **surface_flow.vtu** or **surface_flow.szplt**) - file containing values along the airfoil surface. - **restart_flow.dat** - restart file in an internal format for restarting this simulation in SU2. - - **history.dat** or **history.csv** - file containing the convergence history information. + - **history.csv** (or **history.dat**) - file containing the convergence history information. -Next, we want to run the adjoint solution to get the sensitivity of the objective function (the drag over the airfoil) to conditions within the flow: - 1. Open the config file and change the parameter `MATH_PROBLEM` from `DIRECT` to `CONTINUOUS_ADJOINT`, and save this file. - 2. Rename the restart file (restart_flow.dat) to "solution_flow.dat" so that the adjoint code has access to the direct flow solution. - 3. Run the executable again by entering `SU2_CFD inv_NACA0012.cfg` at the command line. - 4. SU2 will print residual updates with each iteration of the adjoint solver, and the simulation will finish after reaching the specified convergence criteria. - 5. Files containing the adjoint results (with "adjoint" in the file name) will be written upon exiting SU2. The flow solution can be visualized in ParaView (.vtk) or Tecplot (.dat or .szplt). More specifically, these files are: - - **adjoint.szplt** or **adjoint.vtk** - full volume adjoint solution. - - **surface_adjoint.szplt** or **surface_adjoint.vtk** - adjoint solution along the airfoil surface. - - **surface_adjoint.csv** - comma separated values (.csv) file containing values along the airfoil surface. - - **restart_adj_cd.dat** - restart file in an internal format for restarting this simulation in SU2. Note that the name of the objective appears in the file name. - - **history.dat** or **history.csv** - file containing the convergence history information. +### Direct Analysis Results -Note that as of SU2 v4.1, you can also compute a discrete adjoint for the Euler equations. Assuming that you have built the code with [algorithmic differentiation support](/docs_v7/Build-SU2-Linux-MacOS/#basic-configuration), you can run the discrete adjoint with the following steps instead: - 1. Open the config file and change the parameter `MATH_PROBLEM` from `DIRECT` to `DISCRETE_ADJOINT`, and save this file. - 2. Rename the restart file (restart_flow.dat) to "solution_flow.dat" so that the adjoint code has access to the direct flow solution. - 3. Run the executable again by entering `SU2_CFD_AD inv_NACA0012.cfg` at the command line. Note that the `SU2_CFD_AD` executable will only be available when the source has been compiled with AD support. +The following figures were created in ParaView using the SU2 results. These results are contained in the **flow.vtu** file. -### Results +![NACA 0012 Pressure](../../docs_files/NACA0012_pressure_field.png) -The following figures were created in Tecplot using the SU2 results. These results are contained in the flow.dat, surface_flow.dat, adjoint.dat, and surface_adjoint.dat files. +Figure (2): Pressure contours around the NACA 0012 airfoil. -#### Flow Solution +![NACA 0012 Mach Number](../../docs_files/NACA0012_mach_field.png) -![NACA 0012 Pressure](../../docs_files/naca0012_pressure.png) +Figure (3): Mach number contours around the NACA 0012 airfoil. -Figure (2): Pressure contours around the NACA 0012 airfoil. +The following plot was created in LaTeX with PGFPlots using the SU2 results. These results are contained in the **surface_flow.csv** file. -![NACA 0012 Pressure Distribution](../../docs_files/naca0012_cp.png) +![NACA 0012 Coefficient of Pressure Distribution](../../docs_files/NACA0012_coef_pres.png) + +Figure (4): Coefficient of pressure distribution along the airfoil surface. Notice the strong shock on the upper surface (top line) and a weaker shock along the lower surface (bottom line). + +### Running SU2 Adjoint Analysis + +Next, we want to run the adjoint solution to get the sensitivity of the objective function (the drag over the airfoil) to conditions within the flow: + 1. Open the config file and change the parameter `MATH_PROBLEM` from `DIRECT` to `CONTINUOUS_ADJOINT`, and the parameter `OUTPUT_FILES` from `(RESTART, PARAVIEW, SURFACE_CSV)` to `(RESTART, SURFACE_CSV)`; save this file. + 2. Rename (or symlink) the restart file (restart_flow.dat) to "solution_flow.dat" so that the adjoint code has access to the direct flow solution. + 3. Run the executable again by entering `SU2_CFD inv_NACA0012.cfg` at the command line. + 4. SU2 will print residual updates with each iteration of the adjoint solver, and the simulation will finish after reaching the specified convergence criteria. + 5. Files containing the adjoint results (with "adjoint" in the file name) will be written upon exiting SU2. More specifically, these files are: + - **surface_adjoint.csv** (or **surface_adjoint.vtu** or **surface_adjoint.szplt**) - file containing adjoint values along the airfoil surface. + - **restart_adj_cd.dat** - restart file in an internal format for restarting this simulation in SU2. Note that the name of the objective appears in the file name. + - **history.csv** (or **history.dat**) - file containing the convergence history information. + - (**adjoint.vtu** or **adjoint.szplt**, if requested) - full volume adjoint solution, that can be visualized in ParaView or Tecplot. -Figure (3): Coefficient of pressure distribution along the airfoil surface. Notice the strong shock on the upper surface (top line) and a weaker shock along the lower surface (bottom line). +Note that as of SU2 v4.1 or later, you can also compute a discrete adjoint for the Euler equations. Assuming that you have built the code with [algorithmic differentiation support](/docs_v7/Build-SU2-Linux-MacOS/#basic-configuration), you can run the discrete adjoint with the following steps instead: + 1. Open the config file and change the parameter `MATH_PROBLEM` to `DISCRETE_ADJOINT`, and the parameter `OUTPUT_FILES` to `(RESTART, SURFACE_CSV)`; save this file. + 2. Rename (or symlink) the restart file (restart_flow.dat) to "solution_flow.dat" so that the adjoint code has access to the direct flow solution. + 3. Run the executable by entering `SU2_CFD_AD inv_NACA0012.cfg` at the command line. Note that the `SU2_CFD_AD` executable will only be available when the source has been compiled with AD support. + 4. SU2 will again print residual updates with each iteration of the adjoint solver, and the simulation will finish after reaching the specified convergence criteria. + 5. Similar files containing the adjoint results will be written upon exiting SU2. -#### Adjoint Solution +### Adjoint Analysis Results -![NACA 0012 Adjoint Density](../../docs_files/naca0012_psirho.png) +The following plot was created in LaTeX with PGFPlots using the SU2 results and comparing the output from the continuous and discrete adjoint approaches. These results are contained in the two **surface_adjoint.csv** files. -Figure (4): Contours of the adjoint density variable. +![NACA 0012 Surface Sensitivity](../../docs_files/NACA0012_surf_sens.png) -![NACA 0012 Surface Sensitivity](../../docs_files/naca0012_sensitivity.png) +Figure (5): Surface sensitivities. The surface sensitivity is the change in the objective function due to an infinitesimal deformation of the surface in the local normal direction. These values may be refined at each node on the airfoil surface from the flow and adjoint solutions at negligible computational cost using an additional step not described in this tutorial. -Figure (5): Surface sensitivities. The surface sensitivity is the change in the objective function due to an infinitesimal deformation of the surface in the local normal direction. These values are calculated at each node on the airfoil surface from the flow and adjoint solutions at negligible computational cost using an additional step not described in this tutorial. +## Conclusions Congratulations! You've successfully performed your first flow simulations with SU2. Move on to the [tutorials](https://su2code.github.io/tutorials/home) to learn much more about using the code, and don't forget to read through the information in the user's guide. Having problems with the quick start or visualizing the results? Visit the [FAQs](/docs_v7/FAQ) page, or see our forum at [CFD-online](http://www.cfd-online.com/Forums/su2/). diff --git a/_docs_v7/Restart-File.md b/_docs_v7/Restart-File.md index 5ee20b21..b486ca2e 100644 --- a/_docs_v7/Restart-File.md +++ b/_docs_v7/Restart-File.md @@ -3,9 +3,44 @@ title: Restart File permalink: /docs_v7/Restart-File/ --- + +## Saving files for restarts or adjoint runs + +The restart files are used to restart the code from a previous solution and also to run the adjoint simulations, which require a flow solution as input. To save a restart file, the user needs to add the option `RESTART` to the keyword `OUTPUT_FILES` in the configuration file: + +`OUTPUT_FILES= RESTART` + The SU2 binary restart format has the extension `.dat`, but it is also possible to write out restart files in a simple ASCII file format with extension `.csv`. Have a look at the [Output section](/docs_v7/Custom-Output/) to learn how to change output file formats. -The restart files are used to restart the code from a previous solution and also to run the adjoint simulations, which require a flow solution as input. In order to run an adjoint simulation, the user must first change the name of the `restart_flow.dat` file (or `restart_flow.csv` if ASCII format) to `solution_flow.dat` (or `solution_flow.csv`) in the execution directory (these default file names can be adjusted in the config file). It is important to note that the adjoint solver will create a different adjoint restart file for each objective function, e.g. `restart_adj_cd.dat`. +A restart file with the name given by the keyword `RESTART_FILENAME` is then saved at the end of the simulation, or after every number of iterations given by the keyword `OUTPUT_WRT_FREQ`. For instance, + +`RESTART_FILENAME= restart_flow` \ +`OUTPUT_WRT_FREQ= 100` + +will write the file restart_flow.dat every 100 iterations when the total number of iterations is larger than 100, or only once at the end of the simulation when the total number of iterations is smaller than 100. Note that the file extension (the suffix) is automatic and can be left out. +If you would like to keep copies of previously saved restart files, this is possible by setting -To restart a simulation the `RESTART_SOL` flag should be set to `YES` in the configuration file. If performing an unsteady restart the `RESTART_ITER` needs to be set to the iteration number which you want to restart from. For instance if we want to restart at iteration 100 and run the unsteady solver with 2nd-order dual time stepping method, we will need to specify `RESTART_ITER = 100` and have the restart files `solution_flow_00098.dat` and `solution_flow_00099.dat`. +`WRT_RESTART_OVERWRITE= NO` + +Additional to the regular restart file, a restart file with the current iteration appended to the filename will then be written every `OUTPUT_WRT_FREQ` iterations. Note that this option is available only for steady simulations. In unsteady simulations, the number of timesteps is appended to the filename automatically. + +## Starting a simulation from a saved solution + +When restarting the primal or starting an adjoint, the filename given by the keyword `SOLUTION_FILENAME` will be used. In order to restart the primal or start the run of an adjoint simulation, the user must therefore first change the name of the saved file, e.g. `restart_flow.dat` (or `restart_flow.csv` if ASCII format) to the filename `solution_flow.dat` (or `solution_flow.csv`) in the execution directory. It is important to note that the adjoint solver will create a different adjoint restart file for each objective function, e.g. `restart_adj_cd.dat`. +To restart a simulation the `RESTART_SOL` flag should be set to `YES` in the configuration file. + +`RESTART_SOL= YES` \ +`SOLUTION_FILENAME= solution_flow` + +If performing an unsteady restart the `RESTART_ITER` needs to be set to the iteration number which you want to restart from. For instance if we want to restart at iteration 100 and run the unsteady solver with 2nd-order dual time stepping method, we will need to specify `RESTART_ITER = 100` and have the restart files `solution_flow_00098.dat` and `solution_flow_00099.dat`. + +| Option value | Default value | Description | Data type | +|---|---|---|---| +| `OUTPUT_FILES` | RESTART,PARAVIEW,SURFACE_PARAVIEW | files types to write | list of keywords | +| `RESTART_FILENAME` | restart.dat | filename under which the restart file will be saved | string | +| `OUTPUT_WRT_FREQ` | 10,250,42 | the list of frequencies with which the output files will be saved | list of integers | +| `WRT_RESTART_OVERWRITE` | YES | overwrite the restart file or (additionally) append the iteration number to the filename | boolean | +| `RESTART_SOL` | solution | restart from file or from initial conditions | boolean | +| `SOLUTION_FILENAME` | solution.dat | filename that will be used to restart the primal or start the adjoint computation | string | +| `RESTART_ITER` | 1 | iteration number that an unsteady simulation will restart from | integer | diff --git a/_docs_v7/Running-Regression-Tests.md b/_docs_v7/Running-Regression-Tests.md index 333bfe68..a35faff7 100644 --- a/_docs_v7/Running-Regression-Tests.md +++ b/_docs_v7/Running-Regression-Tests.md @@ -3,17 +3,7 @@ title: Running Regression Tests permalink: /docs_v7/Running-Regression-Tests/ --- -The regression tests can be run on your local machine by using the Python scripts available in the SU2/TestCases/ directory and the mesh files from the su2code/TestCases repository. See the [Test Cases](/docs_v7/Test-Cases/) page for more information on working with the TestCases repo. +The regression tests can be run on your local machine by using the Python scripts available in the SU2/TestCases/ directory and the mesh files from the su2code/TestCases and Tutorials repository. See the [Test Cases](/docs_v7/Test-Cases/) page for more information on working with the TestCases repo. -When you are ready to combine your modifications into the develop branch, creating a pull request will automatically run these same regression tests on the Travis CI system. Your pull request must pass these tests in order to be merged into the develop branch. In the pull request, you will be able to see the state of the tests, and by clicking on links find the details of the test results. +When you are ready to combine your modifications into the develop branch, creating a pull request will automatically run these same regression tests. Your pull request must pass these tests in order to be merged into the develop branch. In the pull request, you will be able to see the state of the tests, and by clicking on links find the details of the test results. -If you are working with a forked version of the repository, you can use the following directions to run these same regression tests within your repository rather than within the su2code/ repository. This is preferable if you are not ready to submit your code to the develop branch and just want to run the tests, or if you want to create your own regression tests. - -1. Modify the travis.yml file in the develop branch to update the ***email address*** and ***repository url***. At this point you can also modify which branch will have the tests run. Commit the change to your fork/develop. -2. Sign up for Travis CI and allow access to your account. -3. Activate the repository within Travis CI. -4. Modify the "README" file in the SU2/ directory such that the url points to the results for your fork rather than su2code/SU2. -5. Commit the result into your fork/develop. -6. View the results: when you open up your fork/develop on github the readme file should display. There will be a colored link going to the travis CI build which state whether the test is building, passing, or failing. This link will lead to the details of the tests. Pull requests between your fork/develop and any branches you have created on your fork will also run regression tests. - -If the tests do not run at first, double check that the repository is activated within Travis CI, and if so push a commit with some small change to the travis.yml file to your repository. If it still doesn't work, double check your urls and refer to Travis CI help menu. 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/_docs_v7/SU2-Windows.md b/_docs_v7/SU2-Windows.md index 104223b8..451939d5 100644 --- a/_docs_v7/SU2-Windows.md +++ b/_docs_v7/SU2-Windows.md @@ -19,7 +19,7 @@ SU2 supports Windows platforms from Windows 7 and Windows 10 for x86 (64-bit). Y ## Installation ### Download and unpack the archive -[Download](/download/) the .zip for your operating system and unzip it where you want it to be installed. +[Download](/docs_v7/Download/) the .zip for your operating system and unzip it where you want it to be installed. ### Add SU2 environment variables This is done through the Environment Variables control panel. You can access these by typing "environ" in the search/run box of the start menu. Start a New System variable. Assign the Variable Name `SU2_RUN`, and assign the Variable Value to be the path to your SU2 Executables (the folder that contains `SU2_CFD.exe` for example). This variable will allow you to quickly navigate to the SU2 directory using `cd %SU2_RUN%`, and run the executables using `%SU2_RUN%\`. diff --git a/_docs_v7/Slope-Limiters-and-Shock-Resolution.md b/_docs_v7/Slope-Limiters-and-Shock-Resolution.md new file mode 100644 index 00000000..9b87f733 --- /dev/null +++ b/_docs_v7/Slope-Limiters-and-Shock-Resolution.md @@ -0,0 +1,168 @@ +--- +title: Slope Limiters and Shock Resolution +permalink: /docs_v7/Slope-Limiters-and-Shock-Resolution/ +--- + +This page lists the limiters available in SU2 and their associated options, it is not meant as a detailed theory guide but a brief review of the governing mathematics is presented. +The options listed here do not apply to the high order DG solver. + +--- + +- [Theory: An introduction to slope limiters](#theory-an-introduction-to-slope-limiters) + - [Total Variation and Total Variation Diminishing](#total-variation-and-total-variation-diminishing) + - [Godunov's Theorem](#godunovs-theorem) +- [Available Limiter Options](#available-limiter-options) + - [Slope Limiter Fields](#slope-limiter-fields) + - [Available Limiters](#available-limiters) + - [Limiter Parameters and Further Details](#limiter-parameters-and-further-details) +- [Empirical comparison of limiters on a periodic advective domain](#empirical-comparison-of-limiters-on-a-periodic-advective-domain) + +--- + + + +## Theory: An introduction to slope limiters +For many studying compressible flow or high-speed aerodynamics, the formation of shock discontinuities is a common occurrence. The use of high-order numerical schemes is desired to resolve these regions as the strength of the shock largely governs the behavior of the downstream flow field. However, high-resolution linear schemes often result in numerical oscillations near the shock due to the high-frequency content associated with the shock. These oscillations can result in non-physical values (e.g. negative density) that significantly degrade the accuracy of your solution and pollute the domain. An example of this phenomenon is shown below with a MATLAB implementation of the Lax-Wendroff scheme for scalar advection. Although the Lax-Wendroff method is second-order, note that it introduces numerical oscillations that result in the state value of $$u$$ becoming negative. + + + +Figure (1): A MATLAB simulation of a one period advection (red) of an initial value discontinuity (black) using the Lax-Wendroff method. + +SU2 uses **slope limiters** to avoid these oscillations by damping second-order terms near shocks and other regions with sharp gradients. The second-order reconstruction is kept where the solution is smooth. This preserves solution accuracy in regions with smooth gradients and helps obtain physical results and numerical stability in regions close to the shock. + +Before mathematically describing the form of the limiters implemented in SU2, it is useful to briefly understand two concepts. These include **Total Variation** and **Godunov's Theorem**. + +### Total Variation and Total Variation Diminishing +We can first introduce the concept of **total variation** (TV) which is a measure of how oscillatory a solution is. In a discrete one dimensional setting, TV can be calculated as the following: + +$$ TV(u^n) = \sum_j |u^n_{j+1} - u^n_j| $$ + + + +Figure (2): A numerical scheme resulting in both high and low TV. + +A scheme can be said to be **total variation diminishing** (TVD) if + +$$ TV(u^{n+1}) \leq TV(u^n) $$ + +where for every successive timestep $$n$$, the total variation of the solution does not increase. + +A favorable property of TVD schemes is that they are **monotonicity preserving**. This means they do not introduce new extrema into the solution and local minimum (maximum) are non-decreasing (increasing) in time. These are both desirable qualities for correctly resolving a shock and ensuring the solution is physical. + +### Godunov's Theorem +The question of "How accurate can a TVD scheme be?" is still unanswered. For this, we turn to [Godunov's Theorem](https://en.wikipedia.org/wiki/Godunov%27s_theorem). + +**Godunov's Theorem**: +1. A linear scheme is monotone if and only if it is total variation diminishing. +2. Linear total variation diminishing schemes are at most first-order accurate. + +The first statement is simple, stating that for linear schemes, the characteristic of being monotone and TVD is equivalent. The second statement is more interesting. It states that if we want to construct a linear TVD (monotone) scheme, the best we can be possibly hope for is first-order accuracy. + +Recall that the original motivation for a slope limiter was to prevent the formation of oscillations in the solution. In the section above, we noted that TVD schemes are monotonicity preserving (a favorable property in resolving a shock). However, through Godunov's theorem, we note that if we also want high-order accuracy, **our TVD discretization MUST be nonlinear** + +The inclusion of a slope limiter into a TVD scheme accomplishes this idea. + + +## Available Limiter Options + +The field `SLOPE_LIMITER_FLOW` in the `.cfg` file specifies which limiter to use. Note that this option is only used if `MUSCL_FLOW = YES` (which specifies to use a second-order method). +The [Laminar Cylinder](https://su2code.github.io/tutorials/Laminar_Cylinder/) shows an example of this. +The [Turbulent Flat Plate example](https://su2code.github.io/tutorials/Turbulent_Flat_Plate/) sets `SLOPE_LIMITER_TURB`, which is used for the turbulence equations (if `MUSCL_TURB = YES`), rather than for the flow equations. +More possible applications of limiters are listed below. + + +### Slope Limiter Fields + +| Configuration Field | Description | Notes | +| --- | --- | --- | +| `SLOPE_LIMITER_FLOW` | Flow equations | Need `MUSCL_FLOW = YES` | +| `SLOPE_LIMITER_TURB` | Turbulence equations | Need `MUSCL_TURB = YES` | +| `SLOPE_LIMITER_SPECIES` | Species evolution equations | Need `MUSCL_SPECIES = YES` | +| `SLOPE_LIMITER_ADJFLOW` | Adjoint flow equations | Need `MUSCL_ADJFLOW = YES` | +| `SLOPE_LIMITER_ADJTURB` | Adjoint turbulence equations | Need `MUSCL_ADJTURB = YES` | + + +The `SLOPE_LIMITER_` options above may each be changed to use different limiters, which are listed and explained below. + +**Note:** the Discontinuous-Galerkin methods (DG) / Higher-order methods (HOM) do not use limiters. + + + +### Available Limiters + +| Type | Description | Notes | +| --- | --- | --- | +| `NONE` | No limiter | | +| `BARTH_JESPERSEN` | Barth-Jespersen | This limiter is a smooth version of the commonly seen Barth-Jespersen limiter seen in the literature | +| `VENKATAKRISHNAN` | Venkatakrishnan | | +| `VENKATAKRISHNAN_WANG` | Venkatakrishnan-Wang | | +| `NISHIKAWA_R3` | Nishikawa-R3 | | +| `NISHIKAWA_R4` | Nishikawa-R4 | | +| `NISHIKAWA_R5` | Nishikawa-R5 | | +| `SHARP_EDGES` | Venkatakrishnan with sharp-edge modification | This limiter should not be used for flow solvers | +| `WALL_DISTANCE` | Venkatakrishnan with wall distance modification | This limiter should not be used for flow solvers | +| `VAN_ALBADA_EDGE` | Van Albada (edge formulation) | This limiter is only implemented for flow solvers and does not output limiter values when using the VOLUME_OUTPUT option | + +The default limiter is `VENKATAKRISHNAN`. + +### Limiter Parameters and Further Details + +The `VENKAT_LIMITER_COEFF` parameter is generally a small constant, defaulting to $$0.05$$, but its specific definition depends on the limiter being used. + +For the `VENKATAKRISHNAN`, `SHARP_EDGES`, and `WALL_DISTANCE` limiters, the `VENKAT_LIMITER_COEFF` parameter refers to $$K$$ in $$\epsilon^2=\left(K\bar{\Delta} \right)^3$$, where $$\bar{\Delta}$$ is an average grid size (this is hardcoded as 1m and thus all tuning is via $$K$$). For NISHIKAWA_Rp limiters, $$\epsilon^p=\left(K\bar{\Delta} \right)^{p+1}$$ (p = 3, 4 or 5). +The $$K$$ parameter defines a threshold, below which oscillations are not damped by the limiter, as described by [Venkatakrishnan](https://doi.org/10.1006/jcph.1995.1084). +Thus, a large value will approach the case of using no limiter with undamped oscillations, while too small of a value will slow the convergence and add extra diffusion. +The SU2 implementation of the `BARTH_JESPERSEN` limiter actually uses `VENKATAKRISHNAN` with $$K=0$$. +**Note:** the value of `VENKAT_LIMITER_COEFF` depends on both the mesh and the flow variable and thus should be reduced if the mesh is refined. + +When using the `VENKATAKRISHNAN_WANG` limiter, `VENKAT_LIMITER_COEFF` is instead $$\varepsilon '$$ in $$\varepsilon = \varepsilon ' (q_{max} - q_{min})$$, where $$q_{min}$$ and $$q_{max}$$ are the respective *global* minimum and maximum of the field variable being limited. +This global operation incurs extra time costs due to communication between MPI ranks. +The original work by [Wang](https://doi.org/10.2514/6.1996-2091) suggests using `VENKAT_LIMITER_COEFF` in the range of $$[0.01, 0.20]$$, where again larger values approach the case of using no limiter. +**Note:** unlike the aforementioned `VENKATAKRISHNAN` limiter and NISHIKAWA_Rp limiter, the `VENKATAKRISHNAN_WANG` limiter does not depend directly on the mesh size and can thus be used without non-dimensionalization. If the `VENKATAKRISHNAN` limiter is used outside of non-dimensional mode, the fields with larger values (pressure and temperature) will generally be limited more aggressively than velocity. + + +The `NONE`, `BARTH_JESPERSEN`, `VENKATAKRISHNAN`, `VENKATAKRISHNAN_WANG`, and NISHIKAWA_Rp limiter options all have no **geometric modifier**. +A geometric modifier increases limiting near walls or sharp edges. This is done by multiplying the limiter value by a **geometric factor**. + +For both the `SHARP_EDGES` and `WALL_DISTANCE` limiters, the influence of the geometric modifier is controlled with `ADJ_SHARP_LIMITER_COEFF` which defaults to 3.0. +**Note:** these limiters should not be used for flow solvers, as they only apply to the continuous adjoint solvers. + +Increasing this parameter will decrease the value of the limiter and thus make the field more diffusive and less oscillatory near the feature (sharp edge or wall). + +In the `SHARP_EDGES` limiter, the qualification of what makes an edge "sharp" is described by the parameter `REF_SHARP_EDGES` (defaults to 3.0). Increasing this will make more edges qualify as "sharp". +Other than the addition of this geometric factor, these limiters are the same as the `VENKATAKRISHNAN` limiter and should also use `VENKAT_LIMITER_COEFF` (given by $$K$$ below). + +Specifically, given the distance to the feature, $$d_{\text{feature}}$$, an intermediate measure of the distance, $$d$$, is calculated. The parameter $$c$$ is set by `ADJ_SHARP_LIMITER_COEFF`. + + +$$ d(d_{\text{feature}}; c, K) = \frac{d_{\text{feature}}} { (c \cdot K \bar{\Delta}) } - 1$$ + +Then, the geometric factor is given by + +$$ \gamma (d) = \frac{1}{2} (1+d+\sin(\pi \cdot d)/ \pi) $$ + +Note that the geometric factor is nonnegative and nondecreasing in $$d_{feature}$$. + + +After the number of iterations given by `LIMITER_ITER` (default $$999999$$), the value of the limiter will be frozen. + + +The option `FROZEN_LIMITER_DISC` tells whether the slope limiter is to be frozen in the discrete adjoint formulation (default is `NO`). + + +## Empirical comparison of limiters on a periodic advective domain +An example problem of the linear advection problem against four unique wave-forms was simulated in MATLAB to illustrate differences between the primary limiters in SU2. The wave forms contain both smooth and discontinuous initial conditions and are advected for a single period with a CFL of $$\sigma = 0.8$$. The domain is discretized with $$N = 200$$ cells. The Lax-Wendroff scheme was used as a comparative case: + +$$ u_j^{n+1} = u_j^{n} - \sigma (u_j^{n} - u_{j-1}^{n}) - \frac{1}{2}\sigma(1-\sigma) \left[ \phi_{j+\frac{1}{2}}(u_{j+1}^{n} - u_j^{n}) - \phi_{j-\frac{1}{2}}(u_{j}^{n} - u_{j-1}^{n}) \right] $$ + +where $$\phi_{j+\frac{1}{2}}$$ is the scalar value of the limiter at the interface of cell $$u_j$$ and $$u_{j+1}$$. + + + +Figure (3): A MATLAB simulation of one period advection (red) of an initial condition (black) using various schemes, with and without limiters. + +From the above example we note: +* The **Lax-Wendroff** scheme produces oscillations near sudden gradients due to dispersion errors. From Godunov's theorem this is expected as the scheme is second-order accurate and does not utilize a limiter. +* The **Barth-Jespersen** limiter performs well for most of the waveforms. However, the Barth-Jespersen limtier is known to be compressive and will turn smooth waves into square waves. This is best seen with the value discontinuity on the very left. +* The **Van-Albada** limiter also performs well. It is slightly more diffusive than Barth-Jespersen but has robust convergence properties. +* The **Venkatakrishnan** limiter is similar to the Barth-Jespersen and has significantly improved convergence properties. However, it is more diffusive and does require a user-specified parameter $$K$$ that is flow dependent. diff --git a/_docs_v7/Solver-Setup.md b/_docs_v7/Solver-Setup.md index baf046a3..65a0c996 100644 --- a/_docs_v7/Solver-Setup.md +++ b/_docs_v7/Solver-Setup.md @@ -31,6 +31,8 @@ SU2 is capable of dealing with different kinds of physical problems. The kind of |`EULER` | **Euler's equation** |Finite-Volume method | |`NAVIER_STOKES` | **Navier-Stokes' equation** | Finite-Volume method | |`RANS` | **Reynolds-averaged Navier-Stokes' equation** | Finite-Volume method| +|`NEMO_EULER` | **Thermochemical Nonequilibrium Euler's equation** |Finite-Volume method | +|`NEMO_NAVIER_STOKES` | **Thermochemical Nonequilibrium Navier-Stokes' equation** | Finite-Volume method | |`INC_EULER` | **Incompressible Euler's equation** | Finite-Volume method | |`INC_NAVIER_STOKES` | **Incompressible Navier-Stokes' equation** | Finite-Volume method| |`INC_RANS` | **Incompressible Reynolds-averaged Navier-Stokes' equation** | Finite-Volume method| diff --git a/_docs_v7/Streamwise-Periodicity.md b/_docs_v7/Streamwise-Periodicity.md new file mode 100644 index 00000000..e239e87b --- /dev/null +++ b/_docs_v7/Streamwise-Periodicity.md @@ -0,0 +1,107 @@ +--- +title: Streamwise Periodicity +permalink: /docs_v7/Streamwise-Periodicity/ +--- + +| Solver | Version | +| --- | --- | +| `INC_NAVIER_STOKES`, `INC_RANS` | 7.0.0 | + + +This page contains an overview of the theory behind streamwise periodic flow and builds upon [Incompressible Navier-Stokes](/docs_v7/Theory/#incompressible-navier-stokes). A tutorial for [Streamwise Periodic Flow](/tutorials/Inc_Streamwise_Periodic/) is available. + +--- + +- [Limitations](#limitations) +- [Introduction](#introduction) +- [Pressure and Velocity Periodiciy](#pandv-periodiciy) + - [Massflow prescription](#massflow) +- [Temperature Periodiciy](#T-periodiciy) + - [Fake temperature periodicity via outlet heat sink](#fake-temperature-periodicity-via-outlet-heat-sink) +- [References](#references) + +--- + +## Limitations +- can only be used with the incompressible solver, namely `INC_NAVIER_STOKES` and `INC_RANS` +- temperature dependent fluid properties (e.g. $$c_p, \mu_{lam}$$) cannot be used with real streamwise periodic flow + +## Introduction + +A flow can be modeled as streamwise periodic if the following statements hold true: + +$$\begin{align} +\bar{v}\left( \bar{x} \right) &= \bar{v} \left( \bar{x}+\bar{t} \right), \\ +p\left( \bar{x} \right) &= p \left( \bar{x}+\bar{t} \right) + \Delta p_0, \\ +T\left( \bar{x} \right) &= T \left( \bar{x}+\bar{t} \right) - \Delta T_0. +\end{align}$$ + +With $$\bar{t}$$ being the translation vector between periodic interfaces and $$\Delta p_0, \Delta T_0$$ the constant pressure or temperature drop between the periodic interfaces. + +## Pressure and Velocity Periodicity + +The continuous relation between physical pressure $$p$$ and periodic/reduced pressure $$\tilde{p}$$ in space is: + +$$p\left( \bar{x} \right) = \tilde p \left( \bar{x} \right) - \frac{\Delta p_0}{\left\lVert\bar{t}\right\rVert_2}t_p, \quad t_p =\frac{1}{\left\lVert\bar{t}\right\rVert_2} \left| \left( \bar{x} - \bar{x}^\star \right) \cdot \bar{t} \right|.$$ + +This separation into two parts can be interpreted as a "constant" and a "linear" (along the domain) contribution. +This relation is used to compute the recovered pressure for postprocessing. +Inserting this pressure formulation into the momentum equation of the incompressible Navier-Stokes equation (see [here](/docs_v7/Theory/#incompressible-navier-stokes)) results in: + +$$\frac{\partial \bar{v}}{\partial t} + \nabla\cdot\left( \rho \bar{v} \otimes \bar{v} + \bar{\bar{I}}\tilde{p} - \bar{\bar \tau} \right) - \frac{\Delta p_0}{\left\lVert\bar{t}\right\rVert_2^2}\bar{t} = 0,$$ + +where two things changed: +1. Working variable of the pressure $$p$$ changed to the periodic pressure $$\tilde{p}$$. +2. A constant source term is added to the formulation of the momentum equation. + +The source term is now the force that drives the flow and scales with the prescribed pressure drop $$\Delta p_0$$. + +This substitution of the pressure variable has to be done in every place it appears. For pressure there is nothing further to do e.g. for the boundary conditions, which will be different for the derivation of periodic temperature. + +### Massflow prescription + +In applications often the massflux $$\dot{m}_0^2$$ is known and the pressure drop is the observable. If a massflow is prescribed the pressure drop $$\Delta p_0$$ in the source term is adapted with each iteration to match the current massflow $$\dot{m}^2$$ with the prescribed massflow: + + +$$\Delta p_0^{n+1} - \Delta p_0^{n} = \Delta \left( \Delta p_0 \right) = \frac{\frac{1}{2} \rho \left( \dot{m}_0^2 - \dot{m}^2 \right)}{\left( \rho A \right)^2}.$$ + +$$\rho$$ is the density and $$A$$ the flowed through inlet Area. For the pressure drop update a relaxation factor $$\phi$$ is used: + +$$\Delta p_0^{n+1} = \Delta p_0^{n} + \phi \Delta \left( \Delta p_0 \right).$$ + +## Temperature Periodicity + +The here presented approach for periodicity in temperature is only possible if only heatflux or symmetry boundary conditions are used, isothermal walls in particular are not allowed. In that case use the [method described below](#fake-temperature-periodicity-via-outlet-heat-sink) is used: + +Similar to the pressure term for the momentum equation the Temperature can be split in a periodic and a linear part: + +$$T\left( \bar{x} \right) = \tilde T \left( \bar{x} \right) + \frac{\Delta T_0}{\left\lVert\bar{t}\right\rVert_2}t_p, \quad t_p =\frac{1}{\left\lVert\bar{t}\right\rVert_2} \left| \left( \bar{x} - \bar{x}^\star \right) \cdot \bar{t} \right|$$ + +Just as with the pressure term, this relation is used to compute the recovered temperature for postprocessing. +Inserting the temperature formulation into the energy equation results in: + +$$\frac{\partial \left( \rho c_p \tilde{T} \right)}{\partial t} + \nabla\cdot\left( \rho c_p \tilde{T} \bar{v} - \kappa\nabla \tilde{T} \right) + \frac{Q \rho }{ \dot{m}\left\lVert\bar{t}\right\rVert_2^2} \left[ \bar{t} \cdot \bar{v} \right] = 0$$ + +With $$Q$$ being the integrated heatflux across the domain boundaries in Watts. In contrast to the derivation for pressure periodicity in the momentum equations the boundary conditions have to adapted for the energy equation. The heatflux (Neumann) wall contribution for the energy equation becomes: + +$$- \int_{\partial\Omega} \left( \kappa\nabla T \right) \cdot \bar{n} dS + \int_{\partial\Omega} \kappa\frac{Q}{\dot{m} c_p \left\lVert\bar{t}\right\rVert_2^2} \left[ \bar{t} \cdot \bar{n} \right] dS = 0 $$ + +### Temperature periodicity via outlet heat sink + +In cases where the above requirements cannot be held (e.g. isothermal walls, CHT interfaces) a simple massflow averaged outlet heat sink is implemented. In these cases pressure is still periodic but temperature is solved in its non-periodic form. Energy is extracted from the domain just at the outlet such that the temperature profile via the periodic interface is approximately retained. This of course is a major simplification that enables the use of an approximated temperature profile over the periodic interface. Solution interpretation, especially if it involves surface temperature integrals near the periodic faces, should be done with the necessary care. + +The residual contributions are in twofold. Firstly an either user provided or computed heat is extracted at the outlet with massflow averaged weighting which proved to be better than area averaged weighting: + +$$Res -= \frac{\dot m_{local}}{\dot m_{global}} Q_{integrated}$$ + +The second term is adaptive and scales with the difference between the initial temperature `INC_TEMPERATURE_INIT` and the actual area averaged temperature on the inlet: + +$$Res += \frac{1}{2} |\dot m| c_p \left( T_{inlet} - \frac{T_{init}}{T_{ref}} \right)$$ + +This allows to set the general temperature level in the domain and thereby also allows for the use of temperature material parameters, or isothermal walls and CHT interfaces. + +## References + +$$^1$$ S.V. Patankar, C.H. Liu, and E.M. Sparrow. Fully developed flow and heat transfer in ducts having streamwise-periodic variations of cross-sectional area. *Journal of Heat Transfer*, 99(2):180–186, 1977. doi: [https://doi.org/10.1115/1.3450666](https://doi.org/10.1115/1.3450666) + +$$^2$$ Steven B. Beale. On the implementation of stream-wise periodic boundary conditions. In *ASME 2005 Summer Heat Transfer Conference collocated with the ASME 2005 Pacific Rim Technical Conference and Exhibition on Integration and Packaging of MEMS, NEMS, and ElectronicSystems*, pages 771–777. American Society of Mechanical Engineers, 2005. doi: [https://doi.org/10.1115/HT2005-72271](https://doi.org/10.1115/HT2005-72271) \ No newline at end of file diff --git a/_docs_v7/Style-Guide.md b/_docs_v7/Style-Guide.md index 11f02921..fe2666f5 100644 --- a/_docs_v7/Style-Guide.md +++ b/_docs_v7/Style-Guide.md @@ -3,101 +3,71 @@ title: Style Guide permalink: /docs_v7/Style-Guide/ --- -SU2 is released under an open source license to facilitate its widespread use and development in the scientific computing community. To support uniformity and consistency in the style of the source code, a C++ style guide has been included on this page, and it is strongly encouraged that outside developers adhere to the guidelines dictated in the style guide to maintain readability of the source. +To support uniformity and consistency in the style of the source code, a C++ style guide has been included on this page, and it is strongly encouraged that outside developers adhere to the guidelines dictated in the style guide to maintain readability of the code. Any contributions from the scientific community at-large are encouraged and welcomed. Feel free to contact the development team at any time. -This document describes the conventions that will be used when implementing new features in SU2. This includes allowed syntactic and semantic language features, filename conventions, indentation conventions and more. The consistency is fundamental, it is very important that any programmer be able to look at another part of the code and quickly understand it, the uniformity in the style is a key issue. Some of the ideas expressed in this document comes from the Google C++ Style Guide (revision 3.188). +This document describes the conventions that will be used when implementing new features in SU2. Consistency is fundamental, it is very important that any programmer be able to look at another part of the code and quickly understand it. Some of the ideas expressed in this document come from the Google C++ Style Guide, others from the [C++ Core Guidelines](https://github.com/su2code/SU2/issues/1218). ## C++ style guide +Below is summary of the rules we try to follow in SU2. **Older parts of SU2 are not good examples of these rules.** + +**Duplicating code is absolutely not allowed.** + ### Version numbering -Each code of the SU2 suite must have a release number following the rule Major.Patch, where the Major number is increased each time a new major update is performed and the Patch number is increased each time new features are added. The configuration file also has a number following the rule Major.Patch, where Major correspond with the SU2_CFD major version and Patch is increased with new changes. +The SU2 suite has a major release number followed the rule minor.path, where the minor number is increased each time a significant update is performed and the patch number is increased in maintenance releases. +Patch releases cannot break backward compatibility. ### Standard conformance, and formatting -Source code must comply with the C++ ISO/ANSI standard. with respect to the formatting some recommendation can be made: -- Each line of text in your code should be at most 80 characters long. -- Non-ASCII characters should be rare, and must use UTF-8 formatting. -- Use only spaces (default indent is 2 spaces). You can set your editor to emit spaces when you hit the tab key. -- Sections in public, protected and private order, each indented one space. -- The hash mark that starts a preprocessor directive should always be at the beginning of the line. -- When you have a boolean expression that is longer than the standard line length, be consistent in how you break up the lines. +SU2 is written for C++11, the formatting rules are defined in a `clang-format` file located in the root of the repository. +**New files must follow the formatting rules exactly.** + +SU2 uses pre-commit to enforce a consistent formatting. To use, [install pre-commit](https://pre-commit.com/#install) and run `pre-commit install` at the root of the project. You can now force the formatting on all files with `pre-commit run -a`. This will also run all pre-commit hooks before each commit, preventing dirty commits in the repository. ### Files, functions, and variables -Here some basic recommendation are made for creating files, functions, and variables: +Basic recommendations for creating files, functions, and variables: - C++ filenames must have extension .cpp. - C++ header filenames must have extension .hpp. In general, every .cpp file should have an associated .hpp file. -- C++ inline filenames must have extension .inl. Define functions inline only when they are small, say, 10 lines or less. -- All subprograms (subroutines of functions) must be contained in a class. Each parent class must be contained in a file with the same name as the class (plus extension ’.cpp’, and ’.hpp’). This implies that there can only be one parent class per file. -- When defining a function, parameter order is: inputs, then outputs. +- When defining a function, the parameter order is: inputs, then outputs. - Order of includes. Use standard order for readability and to avoid hidden dependencies: C library, C++ library, other libraries', your project's. -- Prefer small and focused functions. +- Write small and focused functions. - Use overloaded functions (including constructors) only if a reader looking at a call site can get a good idea of what is happening without having to first figure out exactly which overload is being called. - Local variables. Place a function's variables in the narrowest scope possible, and initialize variables in the declaration. -- Static or global variables of class type are forbidden: they cause hard-to-find bugs due to indeterminate order of construction and destruction. -- In the initialization, use 0 for integers, 0.0 for reals, NULL for pointers, and '\0' for chars. - -### Classes - -The classes are the key element of the object oriented programming, here some basic rules are specified. -In general, constructors should merely set member variables to their initial values. Any complex initialization should go in an explicit Init() method. -- You must define a default constructor, and destructor. -- Use the C++ keyword explicit for constructors with one argument. -- Use a struct only for passive objects that carry data; everything else is a class. -- Do not overload operators except in rare, special circumstances. -- Use the specified order of declarations within a class: public: before private:, methods before data members (variables), etc. - -### Syntactic and semantic requirements - -In this section you can find some basic rules for programming: -- All allocated memory must be deallocated at program termination. -- Read or write operations outside an allocated memory block are not allowed. -- Read or write outside index bounds in arrays or character variables are not allowed. -- No uninitialized/undefined values may be used in a way that could affect the execution. -- Local variables that are not used must be removed. -- Pointer variables must be initialized with NULL unless they are obviously initialized in some other way before they are used. -- Indentation will be two steps for each nested block-level. -- In the header file, at the beginning of each program unit (class, subroutine or function) there must be a comment header describing the purpose of this code. The doxygen format should be used. -- When possible, it is better to use #DEFINE with a physical meaning to simplify the code. -- The code must be compiled using doxygen to be sure that there is no warning in the commenting format. -- When describing a function the following tag must be used: \brie_, \para_\[in\], \para_\[out\], \retur_, \overload. -- Static or global variables of class type are forbidden: they cause hard-to-find bugs due to indeterminate order of construction and destructionUse 0 for integers, 0.0 for reals, NULL for pointers, and '\0' for chars. -- All parameters passed by reference must be labeled const. We strongly recommend that you use const whenever it makes sense to do so. -- In the code short, int, and the unsigned version of both must be used case depending. -- Code should be 64-bit and 32-bit friendly. Bear in mind problems of printing, comparisons, and structure alignment +- Static or global variables of class type are forbidden. +- Make abundant use of `const`. +- Always use `su2double` for floating point variables, do not use `double`, `float`, or `auto`. +- Use `auto` or `auto&` or `auto*` for other types of variables. -### Naming - -The most important consistency rules are those that govern naming. The style of a name immediately informs us what sort of thing the named entity is: a type, a variable, a function, a constant, a macro, etc., without requiring us to search for the declaration of that entity. - -The following naming conventions for variables must be used: -- Geometry: Normal, Area (2D, and 3D), Volume (2D, and 3D), Coord, Position. Solution: Solution, Residual, Jacobian. -- Function names, variable names, and filenames should be descriptive; eschew abbreviation. Types and variables should be nouns, while functions should be "command" verbs. -- Elementary functions that set or get the value of a variable (e.g. Number) must be called as GetNumber(), or GetNumber(). Function names start with a capital letter and have a capital letter for each new word, with no underscores. -- Variable names are all lowercase, with underscores between words. -- The name for all the classes must start with the capital "C" letter, followed by the name of the class (capitalizing the first letter), if the name is composed by several words, all the words must be together, e.g.: CPrimalGrid. -- All the variables that are defined in a class must be commented using /\*< \brief \________.\*/. +### Code Documentation -### Comments - -The documentation, and comments must be Doxygen friendly, here I include some basic features: +Classes and functions must be documented with doxygen: - Start each file with a copyright notice, followed by a description of the contents of the file. -- Every class definition should have an accompanying comment that describes what it is for and how it should be used. -- Declaration comments describe use of the function; comments at the definition of a function describe operation. -- In general the actual name of the variable should be descriptive enough to give a good idea of what the variable is used for. +- Every class/function definition must have an accompanying comment that describes what it is for and how it should be used. +- The code must be compiled using doxygen to be sure that there are no warnings in the commenting format. +- When describing a function or class the following tags must be used: `\brief`, `\param[in]`, `\param[out]`, `\return`, `\overload`. +- Do not document the obvious, but rather the expected behavior/usage or the class or function, use `\note` to add details of an algorithm, include links to literature when appropriate. - In your implementation you should have comments in tricky, non-obvious, interesting, or important parts of your code. - Pay attention to punctuation, spelling, and grammar; it is easier to read well-written comments than badly written ones. - Short, and long comments must be in inside of /\*--- (your comment here) ---\*/, and they must be located just before the line to be commented. - Math comments are welcome and should be in the Latex language. -### Debugger tools +### Naming + +The consistency boat sailed a long time ago in SU2, the information below is more descriptive than prescriptive. -- The C++ code must support the following features for debugging: -- Array index bounds may be checked at runtime. -- Conformance with C++ may be checked. -- Use of obsolescent features may be reported as compilation warnings. -- Unused variables may be reported as compilation warnings. +The following naming conventions are in use: +- Function names, variable names, and filenames should be descriptive; eschew abbreviation. Types and variables should be nouns, while functions should be "command" verbs. +- Elementary functions that set or get the value of a variable (e.g. Number) must be called as SetNumber(), or GetNumber(). Function names start with a capital letter and have a capital letter for each new word, with no underscores. +- The name for all the classes must start with the capital "C" letter, followed by the `NameOfTheClass` (camel case). - Iteration: iPoint, jPoint, kPoint, iNode, jNode, kNode, iElem, jElem, kElem, iDim, iVar, iMesh, iEdge. + +**Variable names** +- Acceptable styles are `lowerCamelCase` and `snake_case`. +- Member variables can be `CamelCase`, or be ended `with_underscore_`. +- Template parameters are `CamelCase`. +- Be consistent and follow the existing style if you are modifying or fixing code, do not increase entropy... + diff --git a/_docs_v7/Test-Cases.md b/_docs_v7/Test-Cases.md index 6d138bd3..3063a7f7 100644 --- a/_docs_v7/Test-Cases.md +++ b/_docs_v7/Test-Cases.md @@ -14,8 +14,6 @@ The two repositories contain the same directory structure for the test cases, wi $ 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 diff --git a/_docs_v7/Theory.md b/_docs_v7/Theory.md index 3b1ebfd6..c03d7ddc 100644 --- a/_docs_v7/Theory.md +++ b/_docs_v7/Theory.md @@ -3,15 +3,19 @@ title: Governing Equations in SU2 permalink: /docs_v7/Theory/ --- -This page contains a very brief summary of the different governing equation sets that are treated in each of the solvers within SU2. The reader will be referred to other references for the full detail of the numerical implementations, but we will also describe the approaches at a high level here. +This page contains a very brief summary of the different governing equation sets that are treated in each of the solvers within SU2. The reader will be referred to other references in some instances for the full detail of the numerical implementations, but the approaches are also described at a high level here. --- - [Compressible Navier-Stokes](#compressible-navier-stokes) - [Compressible Euler](#compressible-euler) +- [Thermochemical Nonequilibrium Navier-Stokes](#thermochemical-nonequilibrium-navier-stokes) +- [Thermochemical Nonequilibrium Euler](#thermochemical-nonequilibrium-euler) - [Incompressible Navier-Stokes](#incompressible-navier-stokes) - [Incompressible Euler](#incompressible-euler) - [Turbulence Modeling](#turbulence-modeling) +- [Species Transport](#species-transport) +- [Combustion](#combustion) - [Elasticity](#elasticity) - [Heat Conduction](#heat-conduction) @@ -86,6 +90,68 @@ Within the `EULER` solvers, we discretize the equations in space using a finite --- +# Thermochemical Nonequilibrium Navier-Stokes # + +| Solver | Version | +| --- | --- | +| `NEMO_NAVIER_STOKES` | 7.0.0 | + + +To simulate hypersonic flows in thermochemical nonequilibrium, SU2-NEMO solves the Navier-Stokes equations for reacting flows, expressed in differential form as + +$$ \mathcal{R}(U) = \frac{\partial U}{\partial t} + \nabla \cdot \bar{F}^{c}(U) - \nabla \cdot \bar{F}^{v}(U,\nabla U) - S = 0 $$ + +where the conservative variables are the working variables and given by + +$$U = \left \{ \rho_{1}, \dots, \rho_{n_s}, \rho \bar{v}, \rho E, \rho E_{ve} \right \}^\mathsf{T}$$ + +$$S$$ is a source term composed of + +$$S = \left \{ \dot{w}_{1}, \dots, \dot{w}_{n_s}, \mathbf{0}, 0, \dot{\theta}_{tr:ve} + \sum_s \dot{w}_s E_{ve,s} \right \}^\mathsf{T}$$ + +and the convective and viscous fluxes are + +$$\bar{F}^{c} = \left \{ \begin{array}{c} \rho_{1} \bar{v} \\ \vdots \\ \rho_{n_s} \bar{v} \\ \rho \bar{v} \otimes \bar{v} + \bar{\bar{I}} p \\ \rho E \bar{v} + p \bar{v} \\ \rho E_{ve} \bar{v} \end{array} \right \}$$ + +and + +$$\bar{F}^{v} = \left \{ \begin{array}{c} \\- \bar{J}_1 \\ \vdots \\ - \bar{J}_{n_s} \\ \bar{\bar{\tau}} \\ \bar{\bar{\tau}} \cdot \bar{v} + \sum_k \kappa_k \nabla T_k - \sum_s \bar{J}_s h_s \\ \kappa_{ve} \nabla T_{ve} - \sum_s \bar{J}_s E_{ve} \end{array} \right \}$$ + +In the equations above, the notation is is largely the same as for the compressible Navier-Stokes equations. An individual mass conservation equation is introduced for each chemical species, indexed by $$s \in \{1,\dots,n_s\}$$. Each conservation equation has an associated source term, $$\dot{w}_{s}$$ associated with the volumetric production rate of species $$s$$ due to chemical reactions occuring within the flow. + +Chemical production rates are given by $$ \dot{w}_s = M_s \sum_r (\beta_{s,r} - \alpha_{s,r})(R_{r}^{f} - R_{r}^{b}) $$ + +where the forward and backward reaction rates are computed using an Arrhenius formulation. + +A two-temperature thermodynamic model is employed to model nonequilibrium between the translational-rotational and vibrational-electronic energy modes. As such, a separate energy equation is used to model vibrational-electronic energy transport. A source term associated with the relaxation of vibrational-electronic energy modes is modeled using a Landau-Teller formulation $$ \dot{\theta}_{tr:ve} = \sum _s \rho_s \frac{dE_{ve,s}}{dt} = \sum _s \rho_s \frac{E_{ve*,s} - E_{ve,s}}{\tau_s}. $$ + +Transport properties for the multi-component mixture are evaluated using a Wilkes-Blottner-Eucken formulation. + +--- + +# Thermochemical Nonequilibrium Euler # + +| Solver | Version | +| --- | --- | +| `NEMO_EULER` | 7.0.0 | + + +To simulate inviscid hypersonic flows in thermochemical nonequilibrium, SU2-NEMO solves the Euler equations for reacting flows which can be obtained as a simplification of the thermochemical nonequilibrium Navier-Stokes equations in the absence of viscous effects. They can be expressed in differential form as + +$$ \mathcal{R}(U) = \frac{\partial U}{\partial t} + \nabla \cdot \bar{F}^{c}(U) - S = 0 $$ + +where the conservative variables are the working variables and given by + +$$U = \left \{ \rho_{1}, \dots, \rho_{n_s}, \rho \bar{v}, \rho E, \rho E_{ve} \right \}^\mathsf{T}$$ + +$$S$$ is a source term composed of + +$$S = \left \{ \dot{w}_{1}, \dots, \dot{w}_{n_s}, \mathbf{0}, 0, \dot{\theta}_{tr:ve} + \sum_s \dot{w}_s E_{ve,s} \right \}^\mathsf{T}$$ + +and the convective and viscous fluxes are + +$$\bar{F}^{c} = \left \{ \begin{array}{c} \rho_{1} \bar{v} \\ \vdots \\ \rho_{n_s} \bar{v} \\ \rho \bar{v} \otimes \bar{v} + \bar{\bar{I}} p \\ \rho E \bar{v} + p \bar{v} \\ \rho E_{ve} \bar{v} \end{array} \right \}$$ + # Incompressible Navier-Stokes # | Solver | Version | @@ -93,7 +159,9 @@ Within the `EULER` solvers, we discretize the equations in space using a finite | `INC_NAVIER_STOKES`, `INC_RANS` | 7.0.0 | -SU2 solves the incompressible Navier-Stokes equations in a general form allowing for variable density due to heat transfer through the low-Mach approximation (or incompressible ideal gas formulation). The equations can be expressed in differential form as +SU2 solves the incompressible Navier-Stokes equations in a general form allowing for variable density due to heat transfer through the low-Mach approximation (or incompressible ideal gas formulation). +The reader is referred to [this paper](https://arc.aiaa.org/doi/10.2514/1.J058222) for extended details on the incompressible Navier-Stokes and Euler solvers in SU2. +The equations can be expressed in differential form as $$ \mathcal{R}(V) = \frac{\partial V}{\partial t} + \nabla \cdot \bar{F}^{c}(V) - \nabla \cdot \bar{F}^{v}(V,\nabla V) - S = 0 $$ @@ -163,9 +231,64 @@ Within the `INC_EULER` solver, we discretize the equations in space using a fini # Turbulence Modeling # -The Shear Stress Transport (SST) model of Menter and the Spalart-Allmaras (S-A) model are two of the most common and widely used turbulence models. The S-A and SST standard models, along with several variants, are implemented in SU2. The reader is referred to the [NASA Turbulence Modeling Resource](https://turbmodels.larc.nasa.gov/index.html) (TMR) for the details of each specific model, as the versions in SU2 are implemented according to the well-described formulations found there. +Available for `RANS`, `INC_RANS`. + +SU2 implements several variants of the SST and SA turbulence models, for specifics of the models please see the [NASA Turbulence Modeling Resource](https://turbmodels.larc.nasa.gov/index.html) (TMR). +For information on how to use turbulence models in SU2 see the [users guide](https://su2code.github.io/docs_v7/Physical-Definition/). + +The edge-based finite volume discretization of flow solvers is also used in turbulence solvers. Convective fluxes are evaluated using a scalar upwind scheme (1st or 2nd order). + +## Wall functions + +Available for `RANS`, `INC_RANS`. + +The wall function model of Nichols and Nelson (2004) has been implemented in the compressible and the incompressible solver, for the SA as well as the SST models. For the compressible solver, the wall function model takes into account the frictional heating of the wall according to the Crocco-Busemann relation when the wall boundary conditions is not isothermal. When the wall model is active, the value of the dimensional distance of the first node from the wall can be $$ y^+ > 5$$. When the wall model is not active, $$y^+ < 5 $$ and in addition a fine mesh is necessary close to the wall to resolve the near wall boundary layer. + +--- + +# Species Transport # + +Compatible with `NAVIER_STOKES`, `RANS`, `INC_NAVIER_STOKES`, `INC_RANS`. + +$$ \mathcal{R}(U) = \frac{\partial U}{\partial t} + \nabla \cdot \bar{F}^{c}(U) - \nabla \cdot \bar{F}^{v}(U,\nabla U) - S = 0 $$ + +where the conservative variables (which are also the working variables) are given by + +$$U=\left\lbrace \rho Y_1, ..., \rho Y_{N-1} \right\rbrace ^\mathsf{T}$$ + +with $$Y_i$$ $$[-]$$ being the species mass fraction. And + +$$\sum_{i=0}^N Y_i = 1 \Rightarrow Y_N = 1 - \sum_{i=0}^{N-1} Y_i$$ + +$$S$$ is a generic source term, and the convective and viscous fluxes are + +$$\bar{F}^{c}(V) = \left\{\begin{array}{c} \rho Y_1 \bar{v} \\ ... \\\rho Y_{N-1} \, \bar{v} \end{array} \right\}$$ + +$$\bar{F}^{v}(V,\nabla V) = \left\{\begin{array}{c} \rho D \nabla Y_{1} \\ ... \\ \rho D \nabla Y_{N-1} \end{array} \right\} $$ + +with $$D$$ $$[m^2/s]$$ being the mass diffusion. +For turbulence modeling, the diffusion coefficient becomes: + +$$\rho D = \rho D_{lam} + \frac{\mu_T}{Sc_{T}}$$ + +where $$\mu_T$$ is the eddy viscosity and $$Sc_{T}$$ $$[-]$$ the turbulent Schmidt number. + +--- + +# Combustion # + +| Solver | Version | +| --- | --- | +| `INC_NAVIER_STOKES` | 8.0.0 | + +Combustion with tabulated chemistry solves the scalar transport equations for total enthalpy $$h_t=h + h_{chem}$$, which is the sum of the sensible enthalpy and the chemical enthalpy. Additionally, it solves a transport equation for the progress variable $$C$$, indicating the progress of combustion. Reaction source terms for the progress variable, as well as necessary thermodynamic quantities like density, temperature, viscosity, heat capacity, etc. are all obtained from a 2D lookup table where the properties are stored as a function of the progress variable and total enthalpy. Note that temperature is now a quantity that is retrieved from the lookup table. These lookup tables are constructed from 1D detailed chemistry simulations, using codes like Cantera, Ember, FlameMaster (RWTH Aachen) or Chem1d (TU Eindhoven) and are also known as flamelets or Flamelet Generated Manifolds (FGM). + +The progress variable-enthalpy approach is used to simulate laminar premixed flames. Nonpremixed flames can also be simulated by simply using a lookup table for non-premixed flames. The progress variable then effectively becomes a mixture fraction. Combustion with conjugate heat transfer is also supported in the tabulated chemistry approach. +Additional transport of (reacting) species can be supported as well. The source terms for these additional species have to be stored in the lookup table. A split-source-term approach is supported, where the source term is assumed to be of the form $$S_{total} = S_{Production} + Y \cdot S_{Consumption}.$$ We store the production and consumption terms in the lookup table and construct the total source term internally. If only a total source term is available, the consumption source term can be set to zero. + +At the moment there is no turbulence-chemistry interaction implemented in this approach and the Lewis number is assumed to be $$Le=1$$. -Within the turbulence solvers, we discretize the equations in space using a finite volume method (FVM) with a standard edge-based data structure on a dual grid with vertex-based schemes. The convective and viscous fluxes are evaluated at the midpoint of an edge. +For a detailed introduction to flamelet modeling see the work of [van Oijen et al.](https://www.sciencedirect.com/science/article/pii/S0360128515300137) --- diff --git a/_docs_v7/Thermochemical-Nonequilibrium.md b/_docs_v7/Thermochemical-Nonequilibrium.md new file mode 100644 index 00000000..aff2df7c --- /dev/null +++ b/_docs_v7/Thermochemical-Nonequilibrium.md @@ -0,0 +1,400 @@ +--- +title: Thermochemical Nonequilibrium +permalink: /docs_v7/Thermochemical-Nonequilibrium/ +--- + +This page contains a summary of the physical models implemented in the NEMO solvers in SU2 designed ot simulate hypersonic flows in thermochemical nonequilibrium. This includes detials on thermodynamic and chemistry models, as well as transport properties and boundary conditions. + +--- + +- [Thermodynamic Model](#thermodynamic-model) +- [Finite Rate Chemistry](#finite-rate-chemistry) +- [Vibrational Relaxation](#vibrational-relaxation) +- [Viscous Phenomena and Transport Coefficients](#viscous-phenomena-and-transport-coefficients) + - [Wilkes-Blottner-Eucken](#wilkes-blottner-eucken) + - [Gupta-Yos](#gupta-yos) + - [Sutherland Viscosity Model](#sutherland-viscosity-model) +- [Slip Flow](#slip-flow) +- [Gas-surface Interaction](#gas-surface-interaction) + +--- + +# Thermodynamic Model # + +| Solver | Version | +| --- | --- | +| `NEMO_EULER`, `NEMO_NAVIER_STOKES` | 7.0.0 | + +A rigid-rotor harmonic oscillator (RRHO) two-temperature model is used to model the thermodynamic state of continuum hypersonic flows. Through the independence of the energy levels, the total energy and vibrational--electronic energy per unit volume can be expressed as +$$ \rho e = \sum_s \rho_s \left(e_s^{tr} + e_s^{rot} + e_s^{vib} + e_s^{el} + e^{\circ}_s + \frac{1}{2} \bar{v}^{\top} \bar{v}\right), +$$ +and +$$ + \rho e^{ve} = \sum_s \rho_{s} \left(e_s^{vib} + e_s^{el}\right). +$$ + +Considering a general gas mixture consisting of polyatomic, monatomic, and free electron species, expressions for the energy stored in the translational, rotational, vibrational, and electronic modes are given as +$$ + e^{tr}_s =\begin{cases} + \frac{3}{2} \frac{R}{M_s} T & \text{for monatomic and polyatomic species,}\\ + 0 & \text{for electrons,} + \end{cases} +$$ +$$ + e^{rot}_s =\begin{cases} + \frac{\xi }{2} \frac{R}{M_s} T & \text{for polyatomic species,}\\ + 0 & \text{for monatomic species and electrons,} + \end{cases} +$$ +\ +where $$\xi$$ is an integer specifying the number of axes of rotation, +$$ + e^{vib}_s =\begin{cases} + \frac{R}{M_s} \frac{\theta^{vib}_s}{exp\left( \theta^{vib}_s / T^{ve}\right) - 1} & \text{for polyatomic species,}\\ + 0 & \text{for monatomic species and electrons,} + \end{cases} +$$ +\ +where $$\theta^{vib}_s$$ is the characteristic vibrational temperature of the species, and + + +$$ + e^{el}_s =\begin{cases} + \frac{R}{M_s}\frac{\sum_{i=1}^{\infty} g_{i,s}{\theta^{el}_{i,s} \exp(-\theta^{el}_{i,s}/T_{ve})}}{\sum_{i=0}^{\infty} g_{i,s} exp(-\theta^{el}_{i,s}/T_{ve})} & \text{for polyatomic and monatomic species,}\\ + \frac{3}{2} \frac{R}{M_s} T^{ve} & \text{for electrons,} + \end{cases} +$$ + +where $$\theta^{el}_s$$ is the characteristic electronic temperature of the species and $$g_i$$ is the degeneracy of the $$i^{th}$$ state. + +--- + +# Finite Rate Chemistry # + +| Solver | Version | +| --- | --- | +| `NEMO_EULER`, `NEMO_NAVIER_STOKES` | 7.0.0 | + +The source terms in the species conservation equations are the volumetric mass production rates which are governed by the forward and backward reaction rates, $$R^f$$ and $$R^b$$, for a given reaction $$r$$, and can be expressed as +$$ + \dot{w}_s = M_s \sum_r (\beta_{s,r} - \alpha_{s,r})(R_{r}^{f} - R_{r}^{b}). +$$ + +From kinetic theory, the forward and backward reaction rates are dependent on the molar concentrations of the reactants and products, as well as the forward and backward reaction rate coefficients, $$k^f$$ and $$k^b$$, respectively, and can be expressed as +$$ + R_{r}^f = k_{r}^f \prod_s (\frac{\rho_s}{M_s})^{\alpha_{s,r}}, +$$ +and +$$ + R_{r}^b = k_{r}^b \prod_s (\frac{\rho_s}{M_s})^{\beta_{s,r}}. +$$ + +For an Arrhenius reaction, the forward reaction rate coefficient can be computed as +$$ + k_{r}^f = C_r(T_r)^{\eta_r} exp\left(- \frac{\epsilon_r}{k_B T_r}\right), +$$ +where $$C_r$$ is the pre-factor, $$T_r$$ is the rate-controlling temperature for the reaction, $$\eta_r$$ is an empirical exponent, and $$\epsilon_r$$ is the activation energy per molecule. + +The rate-controlling temperature of the reaction is calculated as a geometric average of the translation-rotational and vibrational-electronic temperatures, +$$ + T_r = (T)^{a_r}(T^{ve})^{b_r}. +$$ + +The value of he equilibrium constant $$K_{eq}$$ is expressed as + +$$ + K_{eq} = \exp( A_0 \left(\frac{T^c}{10,000}\right) + A_1 + A_2 \log \left( \frac{10,000}{T^c} \right) + A_3 \left( \frac{10,000}{T^c} \right) + A_4 \left( \frac{10,000}{T^c} \right)^2 ), +$$ + +where $$T^c$$ is a controlling temperature and $$A_0 - A_4$$ are constants dependent on the reaction. These reaction constants, the rate constrolling temperature and Arrhenius parameters are stored within the fluid model class in SU2 NEMO. + +--- + +# Vibrational Relaxation # + +| Solver | Version | +| --- | --- | +| `NEMO_EULER`, `NEMO_NAVIER_STOKES` | 7.0.0 | + +Vibrational relaxation is computed using a standard Landau-Teller relaxation time with a Park high-temperature correction +$$ + \dot{\Theta}^{tr:ve} = \sum _s \rho_s \frac{de^{ve}_{s}}{dt} = \sum _s \rho_s \frac{e^{ve*}_{s} - e^{ve}_{s}}{\tau_s}, +$$ +where $$\tau_s$$ is computed using a combination of the Landau-Teller relaxation time, $$\langle \tau_s \rangle_{L-T}$$, and a limiting relaxation time from Park, $$\tau_{ps}$$ using +$$ + \tau_s = \langle \tau_s \rangle_{L-T} + \tau_{ps}, +$$ +and +$$ + \langle \tau_s \rangle_{L-T} = \frac{\sum_r X_r}{\sum_r X_r/\tau_{sr}}. +$$ +The interspecies relaxation times are taken from experimental data from Millikan and White, expressed as +$$ + \tau_{sr} = \frac{1}{P}exp\left[A_sr\left(T^{-1/3} - 0.015\mu_{sr}^{1/4}\right) - 18.42\right]. +$$ +A limiting relaxation time, $$\tau_{ps}$$, is used to correct for under-prediction of the Millikan--White model at high temperatures. $$\tau_{ps}$$ is defined as +$$ + \tau_{ps} = \frac{1}{\sigma_s c_s n}, +$$ + +where $$\sigma_s$$ is the effective collision~cross-section. + +--- + +# Viscous Phenomena and Transport Coefficients # + +| Solver | Version | +| --- | --- | +| `NEMO_NAVIER_STOKES` | 7.0.0 | + + +Mass, momentum, and energy transport in fluids are all governed by molecular collisions, and expressions for these transport properties can be derived from the kinetic theory. The mass diffusion fluxes, $$\mathbf{J}_s$$, are computed using Fick's Law of Diffusion: +$$ + \mathbf{J}_s = - \rho D_s \nabla(Y_s) + Y_s \sum_k \rho D_k \nabla(Y_k) +$$ + +where $$c_s$$ is the species mass fraction and $$D_s$$ is the species multi-component diffusion coefficient. The values of $$D_s$$ are computed as a weighted sum of binary diffusion coefficients between all species in the mixture. These are obtained by solving the Stefan--Maxwell equations under the Ramshaw approximations. The viscous stress tensor is written as +$$ + \boldsymbol{\sigma} = \mu \left( \nabla \mathbf{u} + \nabla {\mathbf{u}}^\mathsf{T} - \frac{2}{3} \mathbf{I} (\nabla \cdot \mathbf{u}) \right), +$$ +where $$\mu$$ is the mixture viscosity coefficient. The conduction heat flux for each thermal energy mode, $$\mathbf{q}^{k}$$, is modeled by Fourier’s Law of heat conduction: +$$ +\mathbf{q}^{k} = \kappa^{k} \nabla(T^k), +$$ + +where $$\kappa^{k}$$ is the thermal conductivity associated with energy mode $$k$$. + +$$D_s$$, $$\mu$$, and $$\kappa$$ can be evaluated using the models discussed below by selecting the appropriate options in the configuration file. + + +## Wilkes-Blottner-Eucken ## + +The mixture dynamic viscosity and thermal conductivity are computed using Wilke's semi-empirical mixing rule as + +$$ +\mu = \sum_s \frac{X_s \mu_s}{\phi_s}, +$$ + +and + +$$ +\kappa = \sum_s \frac{X_s \kappa_s}{\phi_s}, +$$ + +where $$X_s$$ is the mole fraction of species $$s$$. The species dynamic viscosity is computed using Blottner's three paramter curve fit for high temperature air, + +$$ +\mu_s = 0.1 \exp [(A_s\log(T) + B_s)\log(T) + C_s]. +$$ + +The species thermal conductivities are computed according to Eucken's formula as + +$$ +\kappa^{tr}_s = \mu_s \left( \frac{5}{2} C_{v_s}^{trans} + C_{v_s}^{rot} \right), +$$ + +$$ +\kappa^{ve}_s = \mu_s C^{ve}_{v_s}. +$$ + +And the term $$\phi_s$$ is given by +$$ +\phi_s = \sum_r X_r \left[ 1 + \sqrt{\frac{\mu_r}{\mu_s}}\left( \frac{M_r}{M_s} \right)^{1/4} \right]^{2} \left[ \sqrt{8 \left(1 + \frac{M_s}{M_r} \right)} \right]^{-1}. +$$ + +The effective species diffusion coefficeint is copmuted as a weighted sum of the species binary diffusion coefficients + +$$ +\frac{(1 - X_i)}{D_i} = \sum_{i \neq j} \frac{X_j}{D_{ij}}, +$$ + +where the binary diffusion coefficients are computed as + +$$ +\rho D_{ij} = 1.1613 \times 10^{-25} \frac{M \sqrt{T \left( \frac{1}{M_i} + \frac{1}{M_j} \right) }}{\Omega_{ij}^{(1,1)}}. +$$ + +Collision integrals are computed using a four parameter curve fit for neutral-neutral, neutral-ion, and electron-ion collisions + +$$ +\pi \Omega_{ij}^{(n,n)} = D T^{A(\log(T))^2 + B \log(T) + C}, +$$ + +where A-D are constants. Ion-ion, electron-ion, and electron-electron collisions modeled using a shielded Coulomb potential as + +$$ +\pi \Omega_{ij}^{(n,n)} = 5.0 \times 10^{15} \pi (\lambda_D / T)^2 \log \{D_n T^{*} \left[ 1 - C_n \exp\left( -c_n T^{*} \right) \right] + 1 \} +$$ + +where + +$$ +T^{*} = \frac{\lambda_D}{e^2_{CGS} / (k_{B,CGS} T) } +$$ + +and the Debye length $$\lambda_D$$ is defined as + +$$ +\lambda_D = \sqrt{\frac{k_{B,CGS} T}{4 \pi n_{e,CGS} e^2_{CGS}}}. +$$ + +The Wilkes-Blottner-Eucken model is generally efective up to temperatures of 10,000 K. Above these temperatures it is recommended to use the Gupta-Yos model. + +## Gupta-Yos ## + +Aother model develped by Gupta focuses on the transport properties of weakly ionized flows, and is generally more accurate than the Wilkes-Blottner-Eucken model at temperatures above 10,000 K. + +The forumalae for the transport coefficients are dependent on the collision terms + +$$ +\Delta_{s,r}^{(1)}(T) = \frac{8}{3} \left[ \frac{2M_s M_r}{\pi R T (M_s + M_r)} \right]^{1/2} \pi {\Omega_{s,r}^{(1,1)}} +$$ + +and +$$ +\Delta_{s,r}^{(2)}(T) = \frac{16}{5} \left[ \frac{2M_s M_r}{\pi R T (M_s + M_r)} \right]^{1/2} \pi {\Omega_{s,r}^{(2,2)}}, +$$ + +where the collision cross-sections are computed as described in the Wilkes-Blottner-Eucken section. + +The mixutre viscoisty is computed as + +$$ +\mu = \sum_{s \neq e} \frac{m_s \gamma_s}{\sum_{r \neq e} \gamma_r \Delta_{s,r}^{(2)}(T_{tr}) + \gamma_r \Delta_{e,r}^{(2)}(T_{ve})} + \frac{m_e \gamma_e}{\sum_r \gamma_r \Delta_{e,r}^{(2)}(T_{ve}) } +$$ + +where + +$$ +\gamma_s = \frac{\rho_s}{\rho M_s}. +$$ + +Thermal conductivity is computed in terms of different energy modes. The contribution due to translation modes is expressed as + +$$ +\kappa_t = \frac{15}{4} k_{B} \sum_{s \neq e} +\frac{\gamma_s}{\sum_{r \neq e} a_{s,r} \gamma_r \Delta_{s,r}^{(2)}(T_{tr}) + 3.54 \gamma_e \Delta_{s,e}^{(2)}(T_{ve})}, +$$ + +where + +$$ +a_{s,r} = 1 + \frac{\left[1 - (m_s/m_r) \right] \left[ 0.45 - 2.54(m_s/m_r) \right] }{\left[1 + (m_s/m_r) \right]^2} +$$ + +and where + +$$ +m_s = \frac{M_s}{N_{av}} +$$ + +with $$N_{av}$$ being Avogadro's Number. The thermal conductivity for the rotational modes is expressed as + +$$ +\kappa_r = k_{B} \sum_{s \neq e} +\frac{\gamma_s}{\sum_{r \neq e} \gamma_r \Delta_{s,r}^{(1)}(T_{tr}) + \gamma_e \Delta_{s,e}^{(1)}(T_{ve})}. +$$ + +The mixture translational/rotational thermal conductivity can then be expressed as + +$$ +\kappa_{tr} = \kappa_t + \kappa_r. +$$ + +The vibrational/electronic mode thermal conductivity is + +$$ +\kappa_{ve} = k_{B} \frac{C_{ve}}{R} \sum_{s \in molecules} \frac{\gamma_s} +{\sum_{r \neq e} \gamma_r \Delta_{s,r}^{(1)}(T_{tr}) + \gamma_e \Delta_{s,r}^{(1)}(T_{ve}) } +$$ + +and the thermal conductivity for electrons is given by + +$$ +\kappa_e = \frac{15}{4} k_{B} \frac{\gamma_e}{\sum_r 1.45 \gamma_r \Delta_{e,r}^{(2)}(T_{ve})}. +$$ + +Finally, the binary diffusion coefficient for heavy particles is given by + +$$ +D_{s,r} = \frac{k_{B} T_{tr}}{p \Delta_{s,r}^{(1)}(T_{tr})}, +$$ + +and for electrons, + +$$ +D_{e,r} = \frac{k_{B} T_{ve}}{p \Delta_{e,r}^{(1)}(T_{ve})}. +$$ + +## Sutherland Viscosity Model ## + +In addition to the two models discussed above, there is the option to use a Sutherland model to calculate the flow viscosity. The Sutherland model is not applicable at high temperatures. + +In this case, the viscosity is computed as + +$$ +\mu = \mu_{0} \left( \frac{T}{T_{0}} \right)^{3/2} \frac{T_0 + S_{\mu}}{T + S_{\mu}}, +$$ + +where $$T_0$$ is a reference temperature (273.15 K), $$\mu_0$$ is a reference viscosity, and $$S_{\mu}$$ is the Sutherland constant. + +If the Sutherland model is selected with a NEMO solver, species diffusion coefficients and thermal conductivity are computed using the models described in the Wilkes-Blottner-Eucken section. + +--- + +# Slip Flow # + +| Solver | Version | +| --- | --- | +| `NEMO_NAVIER_STOKES` | 7.0.0 | + +SU2-NEMO uses the Maxwell velocity and Smoluchowski temperature jump equations to compute the velocity and temperature of the gas in contact with the surface. The equations are given as +$$ +v_s = \frac{2 - \sigma}{\sigma} \lambda \frac{\partial v}{\partial n } + \\ +\frac{3}{4} \frac{\mu}{\rho T} \frac{\partial T}{\partial x}, +$$ + +and +$$ +T - T_w = \frac{2 - \alpha}{\alpha} \lambda \frac{2\gamma}{(\gamma + 1 )Pr} \frac{\partial T}{\partial n}, +$$ + +respectively, where $$\mu$$ is the flow viscosity, $$\rho$$ is the mixture density, $$Pr$$ is the Prandtl number, $$\gamma$$ is the specific heat ratio, $$T$$ is the temperature of the gas, $$T_w$$ is the temperature of the surface, and $$\lambda$$ is the mean free path, calculated as +$$ + \lambda = \frac{\mu}{\rho} \frac{\pi}{\sqrt{2RT}}. +$$ + +The coefficients $$\sigma$$ and $$\alpha$$ are referred to as the Tangential Momentum Accommodation Coefficient (TMAC) and the Thermal Accommodation Coefficient (TAC), respectively. The values of the accommodation coefficients depend on the physical characteristics of the surface, and are usually determined empirically. + + +--- + +# Gas-surface Interaction # + +| Solver | Version | +| --- | --- | +| `NEMO_NAVIER_STOKES` | 7.0.0 | + +Mechanisms of gas-surface interaction are implemented as specific boundary conditions within the SU2-NEMO computational suite. The net result of recombination reactions occurring on the surface is a production of chemical species due to catalytic reactions, $$\dot{\omega}_s^{cat}$$, that must be balanced by the normal diffusive and convective flux at the wall. For steady flow and a no-slip boundary, this can be expressed as + +$$ + \mathbf{J}_s \cdot \mathbf{n} = \dot{\omega}_s^{cat}. +$$ + +In SU2-NEMO, the chemical production of species due to catalytic processes is included in the computation of the viscous component of the residual, as an additional diffusive flux equivalent to the chemical source term computed due to catalytic reactions. Gradients of species density are then computed directly as part of the SU2-NEMO computational routine, which are used to compute gradients of species mass fraction at wall vertices. + +Options in SU2-NEMO include a super-catalytic wall in which species concentrations are set to specify full recombination to a specified equilibrium concentration (typically the free-stream conditions) + +$$ +Y_{w,s} = Y_{eq,s}, +$$ + +as well as a partiall catalytic wall using a specified reaction efficiency model + +$$ + \dot{\omega}_s^{cat} = \gamma_s Y_s \rho_w \sqrt{\frac{R_s T_w}{2\pi}}, +$$ + +where $$\gamma_{s}$$ is the species catalytic efficiency, and represents the proportion of incident mass flux of monatomic species $$s$$ which recombines into its heteronuclear diatomic molecule at the wall. + +--- diff --git a/_docs_v7/Tracy-Integration.md b/_docs_v7/Tracy-Integration.md new file mode 100644 index 00000000..ba95983c --- /dev/null +++ b/_docs_v7/Tracy-Integration.md @@ -0,0 +1,99 @@ +--- +title: Integrating Tracy Profiler with SU2 +permalink: /docs_v7/Tracy-Integration/ +--- + +- [Introduction](#introduction) +- [Compiling SU2 with Tracy](#compiling-su2-with-tracy) +- [Instrumenting SU2 Code](#instrumenting-su2-code) +- [Running the Profiler and Visualizing Data](#running-the-profiler-and-visualizing-data) +- [Conclusion](#conclusion) + +--- + +## Introduction + +Tracy is a high-performance, real-time profiler designed for C++ applications, offering nanosecond-resolution timing with minimal overhead. It is an excellent tool for profiling computationally intensive software like SU2, where traditional profilers such as Valgrind may introduce significant slowdowns. This guide provides step-by-step instructions for integrating Tracy with SU2, enabling users to analyze and optimize the performance of their CFD simulations effectively. + +## Compiling SU2 with Tracy + +To compile SU2 with Tracy support, follow these steps: + +- Configure the build with Tracy enabled using Meson: + ```bash + ./meson.py setup build -Dwith-mpi=disabled --buildtype=debugoptimized -Denable-tracy=true --prefix= + ``` +- Build and install SU2: + ```bash + ./ninja -C build install + ``` +- Replace `` with your desired installation directory. + +This embeds the Tracy client into SU2 for profiling. + +## Instrumenting SU2 Code + +To profile a function in SU2, you must use the project's centralized wrapper macros. This approach ensures that profiling can be cleanly enabled or disabled at compile time without modifying the core logic. + +1. **Include the SU2 Tracy Wrapper Header:** + - Add an include directive for `tracy_structure.hpp` at the top of your C++ source file. The relative path will depend on the file's location. For example, for a file in `SU2_CFD/src/fluid/`: + ```cpp + #include "../../../Common/include/tracy_structure.hpp" + ``` + - **Important:** Do not include `` directly. The wrapper header manages the actual Tracy library. + +2. **Instrument the Function with SU2 Macros:** + - Use `SU2_ZONE_SCOPED_N("MyLabel")` to mark a function or scope with a custom name. This is the recommended macro for clarity. + ```cpp + void MyFunction() { + SU2_ZONE_SCOPED_N("MyFunction"); + // Function implementation + } + ``` + - The label you provide (e.g., `"MyFunction"`) is what will appear in the Tracy profiler's timeline. + - Alternatively, for a quick annotation, you can use `SU2_ZONE_SCOPED;`. This macro automatically uses the compiler-provided function name for the label. + ```cpp + void MyFunction() { + SU2_ZONE_SCOPED; + // Function implementation + } + ``` + +## Running the Profiler and Visualizing Data + +After compiling and instrumenting SU2, profile and visualize the data as follows: + +1. **Build the Tracy Server:** + +Install additional dependencies required for the Tracy server. +```bash +sudo apt install libfreetype6-dev libcapstone-dev libdbus-1-dev \ +libxkbcommon-dev libwayland-dev wayland-protocols \ +libegl1-mesa-dev libglvnd-dev libgtk-3-dev +``` + - Navigate to the Tracy directory: `cd /subprojects/tracy`. + - Build the profiler using CMake: + ```bash + cmake -B profiler/build -S profiler -DCMAKE_BUILD_TYPE=Release + cmake --build profiler/build --config Release --parallel + ``` + +2. **Launch the Tracy Profiler:** + - Run the profiler: + ```bash + ./profiler/build/tracy-profiler + ``` + - Click "Connect" in the GUI to wait for SU2. + +3. **Run the SU2 Simulation:** + - In a separate terminal, execute your simulation: + ```bash + /bin/SU2_CFD .cfg + ``` + - Replace `` and `` with your installation path and configuration file. + +The Tracy GUI will display real-time profiling data during the simulation. + +## Conclusion + +Integrating Tracy with SU2 equips users with a powerful, low-overhead tool for profiling and optimizing CFD simulations. Its real-time visualization and precise timing capabilities make it ideal for performance analysis. For advanced features, troubleshooting, or additional details, consult the [Tracy documentation](https://github.com/wolfpld/tracy/releases/latest/download/tracy.pdf). diff --git a/_gsoc/Assignments.md b/_gsoc/Assignments.md new file mode 100644 index 00000000..a1a3ce60 --- /dev/null +++ b/_gsoc/Assignments.md @@ -0,0 +1,41 @@ +--- +title: Student Assignments +permalink: /gsoc/Assignments/ +--- + +**Welcome to SU2 - GSOC!** +What is Google Summer of Code? + +[Google Summer of Code](https://summerofcode.withgoogle.com/) + + +## SU2 introduction assignments + +To help newcomers start with SU2 and to help GSOC mentors with evaluating the level of students who would like to participate in Google Summer of Code, we have prepared a couple of introduction assignments. These assignments have to be made in the order they are given. These assignments give us an indication of your familiarity with SU2 and the SU2 code. These assignments, together with your active participation in the SU2 community, will be taken into account when deciding on GSOC projects. + +## Assignment 1: Compile SU2 + +- Clone SU2 from github [SU2](https://github.com/su2code/SU2) on your system and compile it [compile instructions](https://su2code.github.io/docs_v7/Build-SU2-Linux-MacOS/) with different options, and run some tutorials [Tutorials](https://su2code.github.io/tutorials/home/). Get a proper understanding of the input and output of SU2. +- Deliverable: None + +## Assignment 2: Set up a test case from scratch + +- Generate a 2D mesh for an axisymmetric, steady-state, turbulent jet case (for instance with [gmsh](https://gmsh.info/)), setup the configuration file, run the simulation, and extract results. +- Deliverable: Testcase and small report (markdown) describing motivation for set-up, configuration options, convergence history, comparison with experimental values. +Reference paper that could be used for comparison [report](https://www.researchgate.net/publication/254224677_Investigation_of_the_Mixing_Process_in_an_Axisymmetric_Turbulent_Jet_Using_PIV_and_LIF) + +## Assignment 3: Python wrapper test case + +- Set up a problem in the python wrapper (compile with python support) and run a test case. +Testcase for the python wrapper: [flatplate](https://github.com/su2code/SU2/blob/master/TestCases/py_wrapper/flatPlate_unsteady_CHT/launch_unsteady_CHT_FlatPlate.py) +- Deliverable: Testcase and small report describing the test case and showing the results. + +## Assignment 4: Modification of the python wrapper setup + +- Enable a spatially varying wall temperature for a steady-state compressible turbulent flat plate testcase. +- Deliverable: Testcase and small report describing the results. + +## Assignment 5: Addition of new volume output: + +- Add the local speed of sound as computed by SU2 in the volume output (paraview files) and the screen output. Run the turbulent test case from point 2 with this new volume and screen output enabled. +- Deliverable: explain implementation, show the history output of the new screen output and show some image with the volume output. diff --git a/_gsoc/Introduction.md b/_gsoc/Introduction.md new file mode 100644 index 00000000..f402af6d --- /dev/null +++ b/_gsoc/Introduction.md @@ -0,0 +1,62 @@ +--- +title: Ideas List for SU2 Google Summer of Code +permalink: /gsoc/Introduction/ +--- + +**Welcome to SU2 - GSOC!** + +This is the updated ideas list for GSOC 2026. If you are interested in participating in [Google Summer of Code](https://summerofcode.withgoogle.com/about) with the SU2 team, then please read the page on [participation](https://su2code.github.io/gsoc/Participation/). The projects listed below have been tuned to fit within the google summer of code program and they have mentors assigned to them. We can also accept personal ideas beyond the ones presented below but you need to convince one of the mentors to support you. We also need you to be proficient in SU2 and have some kind of technical background beyond general computer science (studying physics, mechanical engineering, aerospace engineering,...). + +## Project BP: Adding pressure-based solver +Project Description (max. 5 Sentences) +The pressure-based solver has been requested for a long time. This solver is an important addition to the CFD solvers, especially for low Mach and incompressible flows. People have worked on it (detailed documentation available), and there is a branch that contains a working version, but this was never finalized and added to the main SU2 branch. Hence, the project's objective is to evaluate the current status of attempts, and propose a strategy for getting the pressure-based solver in the latest version of SU2. +Expected Outcome (deliverables): Finalize pressure-based solver, validate with test cases, tutorial and merge the PR. +- Skills Required: C++, experience with CFD and numerical methods +- Possible Mentors: Nitish Anand and Edwin van der Weide +- Expected Project Size: 175 hrs/medium +- Difficulty rating: **medium-hard** (needs experience with Computational Fluid Dynamics) + +## Project GPU: Continuation of GPU acceleration in SU2 +Project Description (max. 5 Sentences) +The SU2 code relies heavily on sparse linear algebra. In this area, there is significant speed-up potential with the adoption of GPU-based processing, as was demonstrated in the GSOC 24 project that applied CUDA to sparse matrix-vector multiplications in SU2. The objective of this project is to move more linear algebra operations to GPU in order to avoid host-device communication bottlenecks within the sparse linear system solver. +Expected Outcome (deliverables): Make SU2’s sparse linear solver GPU-native, i.e. minimal host-device communication after the initial setup of the system. +- Skills Required C++ +- Possible Mentors Pedro Gomes (lead), Ole Burghardt +- Expected Project Size (90 hrs/ small , 175 hrs/medium, 350 hrs/large): 175 hrs (medium) +- Difficulty rating: **medium** + +## Project AMR: Quick Adaptive Mesh refinement for 2D testcases +Project Description (max. 5 Sentences) +Many users have asked for adaptive mesh refinement capabilities. Several research groups are working on this. The aim of this project is to introduce a quick and easy adaptive mesh refinement that simply reads an existing results file and adaptively refines the meshes based on the value of a field. +Expected Outcome (deliverables): SU2_AMR, an added executable that simply splits 2D quad and triangle cells +- Skills Required: C++ +- Possible Mentors: Nijso Beishuizen (lead) +- Expected Project Size (90 hrs/ small , 175 hrs/medium, 350 hrs/large): 175 hrs (medium) +- Difficulty rating: **medium** + +## Project CMPLX: Performance Optimization of Complex Arithmetic in SU2 +Project Description (max. 5 Sentences) +Complex arithmetic operations currently cause significant performance degradation in SU2 when features requiring complex numbers are enabled. This limitation affects the efficiency of certain solver capabilities and restricts their practical application in industrial-scale problems. Preliminary observations suggest that complex arithmetic is a primary bottleneck, but systematic profiling is needed to confirm and quantify these losses. The project's objective is to profile the solver to identify performance hotspots, validate that complex arithmetic is the root cause, and develop a custom complex arithmetic library optimised for SU2's specific use cases. This work will enable more efficient execution of complex-number-dependent features without compromising computational performance. +Expected Outcome (deliverables): Performance profiling report, custom complex arithmetic library (if validated as necessary), benchmark comparisons demonstrating speedup, integration into SU2 codebase, and documentation with usage guidelines. +- Skills Required: C++ +- Possible Mentors: Joshua A. Kelly (lead), Harsh Mishra +- Expected Project Size (90 hrs/ small , 175 hrs/medium, 350 hrs/large): 175 hrs (medium) +- Difficulty rating: **medium** + +## Project PIML: Towards physics-informed machine learning with SU2 +Project Description (max. 5 Sentences) +SU2 uses algorithmic differentiation (AD) for the adjoint solver and has the ability to use multi-layer perceptrons in data-driven equation of state models through the [MLPCpp](https://github.com/EvertBunschoten/MLPCpp.git) submodule. The aim of this project is to combine these two functionalities to enable physics-informed machine learning (PIML) in SU2 by updating the weights and biases of multi-layer perceptrons using AD for sensitivity calculation. PIML would enable data-driven turbulence modeling, solving partial differential equations without a mesh, and open the door to many other interesting research opportunities. +Expected Outcome (deliverables): Demonstration of training a MLP for a reference data set within SU2 and comparison, MLP training library including at least one commonly used training algorithm (e.g. Adam), and documentation explaining usage. +- Skills Required: C++, experience with machine learning +- Possible Mentors: Evert Bunschoten (lead) +- Expected Project Size (90 hrs/ small , 175 hrs/medium, 350 hrs/large): 175 hrs (medium) +- Difficulty rating: **medium-hard** + +## Project FWH: Generalizing FWH-Based Aeroacoustic Noise Prediction +This project aims to generalize a Python tool that implements Farassat’s 1A formulation of the Ffowcs Williams-Hawkings (FWH) equation for far-field noise prediction. While originally developed for tandem cylinder test cases and recently extended to airfoils, the current implementation is limited by case-specific logic. The primary objective is to refactor the codebase into a robust, geometry-agnostic framework capable of handling diverse and complex flow configurations. Test cases should be included in the regression tests. +Expected Outcome (deliverables): A stand-alone Python code. +- Skills Required: Python +- Possible Mentors: Huseyin Ozdemir, (lead) Nijso Beishuizen +- Expected Project Size (90 hrs/ small, 175 hrs/medium, 350 hrs/large): 175 hrs (medium) +- Difficulty rating: **medium** +- diff --git a/_gsoc/Participation.md b/_gsoc/Participation.md new file mode 100644 index 00000000..3e851834 --- /dev/null +++ b/_gsoc/Participation.md @@ -0,0 +1,39 @@ +--- +title: Student Participation +permalink: /gsoc/Participation/ +--- + +**Welcome to SU2 - GSOC!** + +## What is Google Summer of Code? + +[Google Summer of Code](https://summerofcode.withgoogle.com/) + +Google Summer of Code is a program sponsored by Google to let students interested in Open Source work on cool and challenging open source projects. The basic idea is that you will work together with a mentor on a project. We have selected a couple of main topics for you but it is up to you to write a more complete project proposal. If you have ideas of your own, that is fine too but you will need to find a mentor to supervise such a project. + +If you would like to apply, please make sure that you have subscribed to [CFD-online](https://www.cfd-online.com/Forums/su2/) and github, and additionally join the developers team on slack (see our main website [su2code](https://su2code.github.io/). In that way you can stay informed about SU2, and our GSOC involvement. + +If you are interested in applying for GSOC with an SU2 project, please do the following: +1. send an application email to gsoc@su2foundation.org with some personal details, education background and motivation. +2. become a member of our slack channel and subscribe to the **general** and **gsoc** subchannel of SU2. Please introduce yourself :-) + +## To Apply: +To be considered as a GSOC student for an SU2 project, it is not sufficient to simply write a proposal and send it to the google website. We will not accept students who never contacted us or did not finish the assignments. We encourage students to participate in code development by fixing bugs or working on features. The minimum requirements to get accepted by the SU2 team for a GSOC project are: + +- Create a brief resume with your contact details, your education and code experience. If we cannot contact you, *we will not contact you*. +- Briefly write about your experience and interests in Computational Fluid Dynamics and SU2, and the specific project you would like to work on (if you know this already) +- Briefly write about your current work schedule: are you studying/working, how will you manage the time, etc.. +- Send it to gsoc@su2foundation.org +- Make the assignments on the assignment page and send us your github page with your results. +- work on fixing things in SU2 + +Then in the last stage: + +- **Together with a mentor** you will create a project proposal and a planning with a timeline containing a breakdown of the project in parts with periodic deliverables/milestones. + +## Evaluation +Note that applying does not mean acceptance into the program. We will carefully consider your application to see if you are capable of the job, taking into account your experience and availability. We heavily weigh your participation and visibility in the introduction phase. +Please note that experience with SU2 is required. A merged Pull Request on github is highly recommended experience. A pull request for a tutorial or validation testcase is also acceptable and will count as experience. + +## Use of AI +We allow usage of AI tools to *assist* you with your work. However, we do not allow the use of AI in vibe-coding where you let AI generate code that you do not understand. We also do not allow AI for automatic discussions with mentors or other users. AI is your assistant, not your replacement. If you do everything with AI, we might as well do it ourselves without you. diff --git a/_includes/gsoc_nav.html b/_includes/gsoc_nav.html new file mode 100644 index 00000000..4065d44b --- /dev/null +++ b/_includes/gsoc_nav.html @@ -0,0 +1,22 @@ +
+{% for section in site.data.gsoc %} +
+ +
+
    + {% for item in section.gsoc %} + {% assign item_url = item | prepend:"/gsoc/" | append:"/" %} + {% assign p = site.gsoc | where:"url", item_url | first %} + {{ p.title }} + {% endfor %} +
+
+
+{% endfor %} +
diff --git a/_includes/gsoc_section_nav.html b/_includes/gsoc_section_nav.html new file mode 100644 index 00000000..f5feadf8 --- /dev/null +++ b/_includes/gsoc_section_nav.html @@ -0,0 +1,52 @@ +{% comment %} +Map grabs the doc sections, giving us an array of arrays. Join, flattens all +the items to a comma delimited string. Split turns it into an array again. +{% endcomment %} +{% assign gsoc = site.data.gsoc | map: 'gsoc' | join: ',' | split: ',' %} + +{% comment %} +Because this is built for every page, lets find where we are in the ordered +document list by comparing url strings. Then if there's something previous or +next, lets build a link to it. +{% endcomment %} + +{% for document in gsoc %} + {% assign document_url = document | prepend:"/gsoc/" | append:"/" %} + {% if document_url == page.url %} +
    + {% if forloop.first %} + + {% else %} + {% assign previous = forloop.index0 | minus: 1 %} + {% assign previous_page = gsoc[previous] | prepend:"/gsoc/" | append:"/" %} + + {% endif %} + + {% if forloop.last %} + + {% else %} + {% assign next = forloop.index0 | plus: 1 %} + {% assign next_page = gsoc[next] | prepend:"/gsoc/" | append:"/" %} + + {% endif %} + +
    + {% break %} + {% endif %} +{% endfor %} diff --git a/_includes/head.html b/_includes/head.html index cd199958..1e4389db 100644 --- a/_includes/head.html +++ b/_includes/head.html @@ -19,7 +19,10 @@ - + + + + diff --git a/_includes/su2gui_nav.html b/_includes/su2gui_nav.html new file mode 100644 index 00000000..f2d70c56 --- /dev/null +++ b/_includes/su2gui_nav.html @@ -0,0 +1,22 @@ +
    +{% for section in site.data.su2gui %} +
    + +
    +
      + {% for item in section.su2gui %} + {% assign item_url = item | prepend:"/su2gui/" | append:"/" %} + {% assign p = site.su2gui | where:"url", item_url | first %} + {{ p.title }} + {% endfor %} +
    +
    +
    +{% endfor %} +
    diff --git a/_includes/su2gui_section_nav.html b/_includes/su2gui_section_nav.html new file mode 100644 index 00000000..a57f63f6 --- /dev/null +++ b/_includes/su2gui_section_nav.html @@ -0,0 +1,52 @@ +{% comment %} +Map grabs the doc sections, giving us an array of arrays. Join, flattens all +the items to a comma delimited string. Split turns it into an array again. +{% endcomment %} +{% assign su2gui = site.data.su2gui | map: 'su2gui' | join: ',' | split: ',' %} + +{% comment %} +Because this is built for every page, lets find where we are in the ordered +document list by comparing url strings. Then if there's something previous or +next, lets build a link to it. +{% endcomment %} + +{% for document in su2gui %} + {% assign document_url = document | prepend:"/su2gui/" | append:"/" %} + {% if document_url == page.url %} +
      + {% if forloop.first %} + + {% else %} + {% assign previous = forloop.index0 | minus: 1 %} + {% assign previous_page = su2gui[previous] | prepend:"/su2gui/" | append:"/" %} + + {% endif %} + + {% if forloop.last %} + + {% else %} + {% assign next = forloop.index0 | plus: 1 %} + {% assign next_page = su2gui[next] | prepend:"/su2gui/" | append:"/" %} + + {% endif %} + +
      + {% break %} + {% endif %} +{% endfor %} diff --git a/_includes/topnav.html b/_includes/topnav.html index b8173023..60e22f64 100644 --- a/_includes/topnav.html +++ b/_includes/topnav.html @@ -18,15 +18,16 @@
    • Docs
    • Tutorials
    • V&V
    • -
    • Forum
    • +
    • User Forum
    • +
    • Slack
    • Develop
    • +
    • GUI
    • +
    • GSOC