gmshairfoil2d 0.1.4__tar.gz → 0.2.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (23) hide show
  1. gmshairfoil2d-0.2.1/PKG-INFO +139 -0
  2. gmshairfoil2d-0.1.4/PKG-INFO → gmshairfoil2d-0.2.1/README.md +40 -34
  3. {gmshairfoil2d-0.1.4 → gmshairfoil2d-0.2.1}/gmshairfoil2d/airfoil_func.py +12 -2
  4. gmshairfoil2d-0.2.1/gmshairfoil2d/geometry_def.py +1189 -0
  5. gmshairfoil2d-0.2.1/gmshairfoil2d/gmshairfoil2d.py +310 -0
  6. gmshairfoil2d-0.2.1/gmshairfoil2d.egg-info/PKG-INFO +139 -0
  7. gmshairfoil2d-0.2.1/gmshairfoil2d.egg-info/SOURCES.txt +16 -0
  8. {gmshairfoil2d-0.1.4 → gmshairfoil2d-0.2.1}/gmshairfoil2d.egg-info/requires.txt +1 -1
  9. {gmshairfoil2d-0.1.4 → gmshairfoil2d-0.2.1}/gmshairfoil2d.egg-info/top_level.txt +1 -0
  10. {gmshairfoil2d-0.1.4 → gmshairfoil2d-0.2.1}/setup.py +17 -18
  11. gmshairfoil2d-0.2.1/tests/__init__.py +0 -0
  12. gmshairfoil2d-0.2.1/tests/test_airfoil_func.py +77 -0
  13. gmshairfoil2d-0.2.1/tests/test_geometry_def.py +41 -0
  14. gmshairfoil2d-0.1.4/README.md +0 -80
  15. gmshairfoil2d-0.1.4/gmshairfoil2d/geometry_def.py +0 -687
  16. gmshairfoil2d-0.1.4/gmshairfoil2d/gmshairfoil2d.py +0 -176
  17. gmshairfoil2d-0.1.4/gmshairfoil2d.egg-info/PKG-INFO +0 -102
  18. gmshairfoil2d-0.1.4/gmshairfoil2d.egg-info/SOURCES.txt +0 -13
  19. {gmshairfoil2d-0.1.4 → gmshairfoil2d-0.2.1}/LICENSE +0 -0
  20. {gmshairfoil2d-0.1.4 → gmshairfoil2d-0.2.1}/gmshairfoil2d/__init__.py +0 -0
  21. {gmshairfoil2d-0.1.4 → gmshairfoil2d-0.2.1}/gmshairfoil2d.egg-info/dependency_links.txt +0 -0
  22. {gmshairfoil2d-0.1.4 → gmshairfoil2d-0.2.1}/gmshairfoil2d.egg-info/entry_points.txt +0 -0
  23. {gmshairfoil2d-0.1.4 → gmshairfoil2d-0.2.1}/setup.cfg +0 -0
@@ -0,0 +1,139 @@
1
+ Metadata-Version: 2.4
2
+ Name: gmshairfoil2d
3
+ Version: 0.2.1
4
+ Summary: Python tool to generate 2D mesh around an airfoil
5
+ Home-page: https://github.com/cfsengineering/GMSH-Airfoil-2D
6
+ Author: Giacomo Benedetti
7
+ Author-email: giacomo.benedetti@cfse.ch
8
+ Keywords: airfoil,2D,mesh,cfd,gmsh
9
+ Classifier: Programming Language :: Python :: 3.11
10
+ Classifier: License :: OSI Approved :: Apache Software License
11
+ Classifier: Operating System :: OS Independent
12
+ Classifier: Intended Audience :: Developers
13
+ Requires-Python: >=3.11.0
14
+ Description-Content-Type: text/markdown
15
+ License-File: LICENSE
16
+ Requires-Dist: gmsh>=4.14
17
+ Requires-Dist: numpy>=1.20.3
18
+ Requires-Dist: pytest==7.1.3
19
+ Requires-Dist: requests==2.26.0
20
+ Dynamic: author
21
+ Dynamic: author-email
22
+ Dynamic: classifier
23
+ Dynamic: description
24
+ Dynamic: description-content-type
25
+ Dynamic: home-page
26
+ Dynamic: keywords
27
+ Dynamic: license-file
28
+ Dynamic: requires-dist
29
+ Dynamic: requires-python
30
+ Dynamic: summary
31
+
32
+ [![Pytest](https://github.com/cfsengineering/GMSH-Airfoil-2D/actions/workflows/pytest.yml/badge.svg?branch=main)](https://github.com/cfsengineering/GMSH-Airfoil-2D/actions/workflows/pytest.yml)
33
+ [![PyPi version](https://img.shields.io/pypi/v/gmshairfoil2d.svg)](https://pypi.python.org/pypi/gmshairfoil2d)
34
+ [![License](https://img.shields.io/badge/license-Apache%202-blue.svg)](https://github.com/cfsengineering/GMSH-Airfoil-2D/blob/main/LICENSE)
35
+ [![Black code style](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
36
+
37
+ # GMSH-Airfoil-2D
38
+
39
+ Python tool to genreate 2D unstructured, hybrid and structured mesh around an airfoil with [GMSH](https://gmsh.info/) in one command line.
40
+
41
+ ## Installation
42
+
43
+ You can install this package from PyPi:
44
+
45
+ ```bash
46
+ pip install gmshairfoil2d
47
+ ```
48
+
49
+ Or you can clone and install this repository with the following commands:
50
+
51
+ ```bash
52
+ git clone https://github.com/cfsengineering/GMSH-Airfoil-2D.git
53
+ cd GMSH-Airfoil-2D
54
+ pip install -e .
55
+ ```
56
+
57
+ ## Usage
58
+
59
+ ```text
60
+ gmshairfoil2d -h
61
+
62
+ optional arguments:
63
+ -h, --help Show this help message and exit
64
+ --list Display all airfoil available in the database :
65
+ https://m-selig.ae.illinois.edu/ads/coord_database.html
66
+ --naca [4DIGITS] NACA airfoil 4 digit
67
+ --airfoil [NAME] Name of an airfoil profile in the database (database available with
68
+ the --list argument)
69
+ --aoa [AOA] Angle of attack [deg] (default: 0 [deg])
70
+ --farfield [RADIUS] Create a circular farfield mesh of given radius [m] (default 10m)
71
+ --box [LENGTHxWIDTH] Create a box mesh of dimensions [length]x[height] [m]
72
+ --airfoil_mesh_size [SIZE] Mesh size of the airfoil contour [m] (default 0.01m)
73
+ --ext_mesh_size [SIZE] Mesh size of the external domain [m] (default 0.2m) (for normal, bl
74
+ and structural)
75
+ --no_bl Do the unstructured meshing (with triangles), without a boundary
76
+ layer
77
+ --first_layer [HEIGHT] Height of the first layer [m] (default 3e-5m) (for bl and structural)
78
+ --ratio [RATIO] Growth ratio of layers (default 1.2) (for bl and structural)
79
+ --nb_layers [INT] Total number of layers in the boundary layer (default 35)
80
+ --format [FORMAT] Format of the mesh file, e.g: msh, vtk, wrl, stl, mesh, cgns, su2,
81
+ dat (default su2)
82
+ --structural Generate a structural mesh
83
+ --arg_struc [LxLxL] Parameters for the structural mesh [leading (axis x)]x[wake (axis
84
+ x)]x[total height (axis y)] [m] (default 1x10x10)
85
+ --output [PATH] Output path for the mesh file (default : current dir)
86
+ --ui Open GMSH user interface to see the mesh
87
+
88
+ ```
89
+
90
+ ## Examples of use
91
+
92
+ To check all airfoil available in the [database](https://m-selig.ae.illinois.edu/ads/coord_database.html):
93
+
94
+ ```bash
95
+ gmshairfoil2d --list
96
+ ```
97
+
98
+ For all the following examples, the defauld chord lenght is 1 meter.
99
+
100
+ To create a circular farfield mesh around a NACA0012 of 10m of radius and see the result with GMSH user interface:
101
+
102
+ ```bash
103
+ gmshairfoil2d --naca 0012 --farfield 10 --ui --no_bl
104
+ ```
105
+
106
+ ![GMSH user interface with the 2D mesh](images/example_mesh.png)
107
+
108
+ To create a circular farfield mesh with boudary layer around a Drela DAE11 airfoil (the name in the database is "dae11") of 4m or radius with a mesh size of 0.005m on the airfoil (but to not open on the interface):
109
+
110
+ ```bash
111
+ gmshairfoil2d --airfoil dae11 --farfield 4 --airfoil_mesh_size 0.005
112
+ ```
113
+
114
+ To create mesh around a Eppler E220 airfoil (the name in the database is "e211") with an angle of attack of 8 degree in a box of 12x4m (lenght x height) and save it as a vtk mesh and see the result with GMSH user interface:
115
+
116
+ ```bash
117
+ gmshairfoil2d --airfoil e211 --aoa 8 --box 12x4 --format vtk --ui --no_bl
118
+ ```
119
+
120
+ ![GMSH user interface with the 2D mesh, rectangular box](images/example_mesh_box.png)
121
+
122
+
123
+
124
+ To create a boxed mesh around a Chuch Hollinger CH 10-48-13 smoothed 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) :
125
+
126
+ ```bash
127
+ gmshairfoil2d --airfoil ch10sm --ui --box 2x1.4
128
+ ```
129
+
130
+ ![GMSH result with 2D mesh with boundary layer, rectangular box](images/example_ch10sm_bl.png)
131
+
132
+
133
+ To create a structural mesh around a Naca 4220 airfoil (the 4 digits code is obviously "4220"), 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 :
134
+
135
+ ```bash
136
+ gmshairfoil2d --naca 4220 --airfoil_mesh_size 0.08 --ui --structural --first_layer 0.01 --arg_struc 6x7 --aoa 6
137
+ ```
138
+
139
+ ![GMSH result with 2D structural mesh](images/example_structural_naca4220.png)
@@ -1,25 +1,3 @@
1
- Metadata-Version: 2.1
2
- Name: gmshairfoil2d
3
- Version: 0.1.4
4
- Summary: Python tool to genreate 2D mesh around an airfoil
5
- Home-page: https://github.com/cfsengineering/GMSH-Airfoil-2D
6
- Author: Aidan Jungo
7
- Author-email: aidan.jungo@cfse.ch
8
- License: Apache License 2.0
9
- Keywords: airfoil,2D,mesh,cfd,gmsh
10
- Classifier: Programming Language :: Python :: 3
11
- Classifier: Programming Language :: Python :: 3.6
12
- Classifier: Programming Language :: Python :: 3.7
13
- Classifier: Programming Language :: Python :: 3.8
14
- Classifier: Programming Language :: Python :: 3.9
15
- Classifier: Programming Language :: Python :: 3.10
16
- Classifier: License :: OSI Approved :: Apache Software License
17
- Classifier: Operating System :: OS Independent
18
- Classifier: Intended Audience :: Developers
19
- Requires-Python: >=3.6.0
20
- Description-Content-Type: text/markdown
21
- License-File: LICENSE
22
-
23
1
  [![Pytest](https://github.com/cfsengineering/GMSH-Airfoil-2D/actions/workflows/pytest.yml/badge.svg?branch=main)](https://github.com/cfsengineering/GMSH-Airfoil-2D/actions/workflows/pytest.yml)
24
2
  [![PyPi version](https://img.shields.io/pypi/v/gmshairfoil2d.svg)](https://pypi.python.org/pypi/gmshairfoil2d)
25
3
  [![License](https://img.shields.io/badge/license-Apache%202-blue.svg)](https://github.com/cfsengineering/GMSH-Airfoil-2D/blob/main/LICENSE)
@@ -27,7 +5,7 @@ License-File: LICENSE
27
5
 
28
6
  # GMSH-Airfoil-2D
29
7
 
30
- Python tool to genreate 2D unstructured mesh around an airfoil with [GMSH](https://gmsh.info/) in one command line.
8
+ Python tool to genreate 2D unstructured, hybrid and structured mesh around an airfoil with [GMSH](https://gmsh.info/) in one command line.
31
9
 
32
10
  ## Installation
33
11
 
@@ -51,20 +29,29 @@ pip install -e .
51
29
  gmshairfoil2d -h
52
30
 
53
31
  optional arguments:
54
- -h, --help show this help message and exit
32
+ -h, --help Show this help message and exit
55
33
  --list Display all airfoil available in the database :
56
34
  https://m-selig.ae.illinois.edu/ads/coord_database.html
57
- --naca [4DIGITS] NACA airfoil 4 digit (default 0012)
35
+ --naca [4DIGITS] NACA airfoil 4 digit
58
36
  --airfoil [NAME] Name of an airfoil profile in the database (database available with
59
37
  the --list argument)
60
38
  --aoa [AOA] Angle of attack [deg] (default: 0 [deg])
61
39
  --farfield [RADIUS] Create a circular farfield mesh of given radius [m] (default 10m)
62
40
  --box [LENGTHxWIDTH] Create a box mesh of dimensions [length]x[height] [m]
63
- --airfoil_mesh_size [SIZE] Mesh size of the airfoil countour [m] (default 0.01m)
64
- --ext_mesh_size [SIZE] Mesh size of the external domain [m] (default 0.2m)
65
- --format [FORMAT] format of the mesh file, e.g: msh, vtk, wrl, stl, mesh, cgns, su2,
41
+ --airfoil_mesh_size [SIZE] Mesh size of the airfoil contour [m] (default 0.01m)
42
+ --ext_mesh_size [SIZE] Mesh size of the external domain [m] (default 0.2m) (for normal, bl
43
+ and structural)
44
+ --no_bl Do the unstructured meshing (with triangles), without a boundary
45
+ layer
46
+ --first_layer [HEIGHT] Height of the first layer [m] (default 3e-5m) (for bl and structural)
47
+ --ratio [RATIO] Growth ratio of layers (default 1.2) (for bl and structural)
48
+ --nb_layers [INT] Total number of layers in the boundary layer (default 35)
49
+ --format [FORMAT] Format of the mesh file, e.g: msh, vtk, wrl, stl, mesh, cgns, su2,
66
50
  dat (default su2)
67
- --output [PATH] output path for the mesh file (default : current dir)
51
+ --structural Generate a structural mesh
52
+ --arg_struc [LxLxL] Parameters for the structural mesh [leading (axis x)]x[wake (axis
53
+ x)]x[total height (axis y)] [m] (default 1x10x10)
54
+ --output [PATH] Output path for the mesh file (default : current dir)
68
55
  --ui Open GMSH user interface to see the mesh
69
56
 
70
57
  ```
@@ -82,21 +69,40 @@ For all the following examples, the defauld chord lenght is 1 meter.
82
69
  To create a circular farfield mesh around a NACA0012 of 10m of radius and see the result with GMSH user interface:
83
70
 
84
71
  ```bash
85
- gmshairfoil2d --naca 0012 --farfield 10 --ui
72
+ gmshairfoil2d --naca 0012 --farfield 10 --ui --no_bl
86
73
  ```
87
74
 
88
75
  ![GMSH user interface with the 2D mesh](images/example_mesh.png)
89
76
 
90
- To create a circular farfield mesh around a Drela DAE11 airfoil (the name in the database is "dae11") of 20m or radius with a mesh size of 0.005m on the airfoil:
77
+ To create a circular farfield mesh with boudary layer around a Drela DAE11 airfoil (the name in the database is "dae11") of 4m or radius with a mesh size of 0.005m on the airfoil (but to not open on the interface):
91
78
 
92
79
  ```bash
93
- gmshairfoil2d --airfoil dae11 --farfield 20 --airfoil_mesh_size 0.005
80
+ gmshairfoil2d --airfoil dae11 --farfield 4 --airfoil_mesh_size 0.005
94
81
  ```
95
82
 
96
- To create mesh around a Eppler E220 airfoil (the name in the database is "e211") with an angle of attack of 8 degree in a box of 12x4m (lenght x hight) and save it as a vtk mesh and see the result with GMSH user interface:
83
+ To create mesh around a Eppler E220 airfoil (the name in the database is "e211") with an angle of attack of 8 degree in a box of 12x4m (lenght x height) and save it as a vtk mesh and see the result with GMSH user interface:
97
84
 
98
85
  ```bash
99
- gmshairfoil2d --airfoil e211 --aoa 8 --box 12x4 --format vtk --ui
86
+ gmshairfoil2d --airfoil e211 --aoa 8 --box 12x4 --format vtk --ui --no_bl
100
87
  ```
101
88
 
102
89
  ![GMSH user interface with the 2D mesh, rectangular box](images/example_mesh_box.png)
90
+
91
+
92
+
93
+ To create a boxed mesh around a Chuch Hollinger CH 10-48-13 smoothed 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) :
94
+
95
+ ```bash
96
+ gmshairfoil2d --airfoil ch10sm --ui --box 2x1.4
97
+ ```
98
+
99
+ ![GMSH result with 2D mesh with boundary layer, rectangular box](images/example_ch10sm_bl.png)
100
+
101
+
102
+ To create a structural mesh around a Naca 4220 airfoil (the 4 digits code is obviously "4220"), 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 :
103
+
104
+ ```bash
105
+ gmshairfoil2d --naca 4220 --airfoil_mesh_size 0.08 --ui --structural --first_layer 0.01 --arg_struc 6x7 --aoa 6
106
+ ```
107
+
108
+ ![GMSH result with 2D structural mesh](images/example_structural_naca4220.png)
@@ -2,6 +2,7 @@ from pathlib import Path
2
2
 
3
3
  import numpy as np
4
4
  import requests
5
+ import sys
5
6
 
6
7
  import gmshairfoil2d.__init__
7
8
 
@@ -49,8 +50,17 @@ def get_airfoil_file(airfoil_name):
49
50
 
50
51
  r = requests.get(url)
51
52
 
52
- if r.status_code != 200:
53
- raise Exception(f"Could not get airfoil {airfoil_name}")
53
+ try:
54
+ r = requests.get(url, timeout=10) # Aggiungi sempre un timeout
55
+ if r.status_code != 200:
56
+ # Invece di raise Exception, print e exit pulito
57
+ print(f"❌ Error: Could not find airfoil '{airfoil_name}' on UIUC database.")
58
+ import sys
59
+ sys.exit(1)
60
+ except requests.exceptions.RequestException as e:
61
+ print(f"❌ Network Error: Could not connect to the database. Check your internet.")
62
+ import sys
63
+ sys.exit(1)
54
64
 
55
65
  file_path = Path(database_dir, f"{airfoil_name}.dat")
56
66