Skip to main content

Pytest PyPi version License Black code style

GMSH-Airfoil-2D

Python tool to genreate 2D unstructured, hybrid and structured mesh around an airfoil with GMSH in one command line.

Installation

You can install this package from PyPi:

pip install gmshairfoil2d

Or you can clone and install this repository with the following commands:

git clone https://github.com/cfsengineering/GMSH-Airfoil-2D.git
cd GMSH-Airfoil-2D
pip install -e .

Usage

gmshairfoil2d -h                                    

optional arguments:
  -h, --help                  Show this help message and exit
  --config [PATH]             Path to configuration file (key=value format)
  --save_config [PATH]        Save current configuration to file
  --example_config            Create an example configuration file
  --list                      Display all airfoil available in the database :
                              https://m-selig.ae.illinois.edu/ads/coord_database.html
  --naca [4DIGITS]            NACA airfoil 4 digit
  --airfoil [NAME]            Name of an airfoil profile in the database (database available with
                              the --list argument)
  --airfoil_path [PATH]       Path to custom airfoil .dat file
  --flap_path [PATH]          Path to custom flap .dat file
  --aoa [AOA]                 Angle of attack [deg] (default: 0 [deg])
  --deflection [DEFLECTION]   Flap deflection angle [deg] (default: 0 [deg])
  --farfield [RADIUS]         Create a circular farfield mesh of given radius [m] (default 10m)
  --farfield_ctype            Generate a C-type structured farfield for hybrid meshes
  --box [LENGTHxWIDTH]        Create a box mesh of dimensions [length]x[height] [m]
  --airfoil_mesh_size [SIZE]  Mesh size of the airfoil contour [m] (default 0.01m)
  --ext_mesh_size [SIZE]      Mesh size of the external domain [m] (default 0.2m)
  --no_bl                     Do the unstructured meshing (with triangles), without a boundary
                              layer
  --first_layer [HEIGHT]      Height of the first layer [m] (default 3e-5m) (for bl and structured)
  --ratio [RATIO]             Growth ratio of layers (default 1.2) (for bl and structured)
  --nb_layers [INT]           Total number of layers in the boundary layer (default 35)
  --format [FORMAT]           Format of the mesh file, e.g: msh, vtk, wrl, stl, mesh, cgns, su2,
                              dat (default su2)
  --structured                Generate a structured mesh
  --arg_struc [LxL]           Parameters for the structured mesh [wake length (axis x)]x[total 
                              height (axis y)] [m] (default 10x10)
  --output [PATH]             Output path for the mesh file (default : current dir)
  --ui                        Open GMSH user interface to see the mesh

Configuration Files

Instead of using command-line arguments, you can use configuration files for batch processing. Configuration files use a simple key=value format with support for comments.

Create an example configuration file:

gmshairfoil2d --example_config

Use a configuration file:

gmshairfoil2d --config my_config.cfg

Override config values with CLI arguments:

gmshairfoil2d --config my_config.cfg --aoa 5.0

Save current configuration to file:

gmshairfoil2d --naca 0012 --aoa 5.0 --save_config my_config.cfg

For more details, see example/CONFIG_README.md and ready-to-use examples in example/EXAMPLES_README.md.

Examples of use

To check all airfoil available in the database:

gmshairfoil2d --list

For all the following examples, the default chord length is 1 meter.

Example 1: NACA0012 with circular farfield

To create a circular farfield mesh around a NACA0012 of 10m of radius and see the result with GMSH user interface:

gmshairfoil2d --naca 0012 --farfield 10 --ui --no_bl

Or using config file:

gmshairfoil2d --config example/example1_naca0012.cfg

GMSH user interface with the 2D mesh

Example 2: DAE11 with boundary layer

To create a circular farfield mesh with boundary layer around a Drela DAE11 airfoil (the name in the database is "dae11") of 4m of radius with a mesh size of 0.005m on the airfoil:

gmshairfoil2d --airfoil dae11 --farfield 4 --airfoil_mesh_size 0.005

Or using config file:

gmshairfoil2d --config example/example2_dae11.cfg

Example 3: E211 in box with angle of attack

To create mesh around an Eppler E211 airfoil (the name in the database is "e211") with an angle of attack of 8 degree in a box of 12x4m (length x height) and save it as a VTK mesh:

gmshairfoil2d --airfoil e211 --aoa 8 --box 12x4 --format vtk --ui --no_bl

Or using config file:

gmshairfoil2d --config example/example3_e211_box.cfg

GMSH user interface with the 2D mesh, rectangular box

Example 4: CH10SM with box and boundary layer

To create a boxed mesh around a Chuck Hollinger CH10SM airfoil (the name in the database is "ch10sm"), using the boundary layer with default parameters (first layer of height 3e-5, 35 layers and growth ratio of 1.2):

gmshairfoil2d --airfoil ch10sm --ui --box 2x1.4

Or using config file:

gmshairfoil2d --config example/example4_ch10sm_bl.cfg

GMSH result with 2D mesh with boundary layer, rectangular box

Example 5: NACA4220 structured mesh

To create a structured mesh around a NACA4220 airfoil with first layer height of 0.01, mesh size of 0.08, wake length of 6, height of 7, and angle of attack of 6 degrees:

gmshairfoil2d --naca 4220 --airfoil_mesh_size 0.08 --ui --structured --first_layer 0.01 --arg_struc 6x7 --aoa 6

Or using config file:

gmshairfoil2d --config example/example5_naca4220_structured.cfg

GMSH result with 2D structured mesh

Example 6: Custom airfoil from file

To create a mesh around a custom airfoil profile with a deflected flap:

gmshairfoil2d --airfoil_path tests/test_data/NLR_7301.dat --flap_path tests/test_data/Flap_NLR_7301.dat --deflection 10 --box 4x3 --ui --no_bl

Or using config file:

gmshairfoil2d --config example/example6_custom_airfoil_flap.cfg

This example shows how to load custom airfoil and flap profiles from external .dat files and generate a mesh with flap deflection, useful for using proprietary or custom-designed airfoil geometries. GMSH result with 2D mesh around a custom flapped airfoil

Metadata

Release files for gmshairfoil2d 0.2.33

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gmshairfoil2d 0.2.33
File Size Uploaded
gmshairfoil2d-0.2.33.tar.gz 32.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for gmshairfoil2d 0.2.33
File Interpreter ABI Platform
gmshairfoil2d-0.2.33-py3-none-any.whl Python 3 none any Details

Total release size: 65.0 kB

Release files / gmshairfoil2d-0.2.33.tar.gz

Download URL gmshairfoil2d-0.2.33.tar.gz
Size 32.2 kB
Tags Source
SHA-256 checksum
How to use checksums
3eb9640d94c8a1903c2cfe18725f06f6b5651ea2e838659bbad1c9848ac5c0a4
BLAKE2b-256 checksum
How to use checksums
0e17f7ce47e09ff5e9c1def12cf1f5499e9920dac31545ceaaaa6e42dbb0820e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.14

Release files / gmshairfoil2d-0.2.33-py3-none-any.whl

Download URL gmshairfoil2d-0.2.33-py3-none-any.whl
Size 32.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3a64b20a0ed238335b1090f78a366be90942d02f9479ab74c4b3da8538df7a50
BLAKE2b-256 checksum
How to use checksums
5a0b2f120053cec5bd85a716858ea16ebd40b059e596d6da500eb212b20b4064
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.14

Release history Release notifications | RSS feed

This release

0.2.33 This release

2 release files

0.2.31

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page