gmshairfoil2d 0.2__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.
- {gmshairfoil2d-0.2 → gmshairfoil2d-0.2.1}/PKG-INFO +1 -3
- {gmshairfoil2d-0.2 → gmshairfoil2d-0.2.1}/gmshairfoil2d/airfoil_func.py +12 -2
- {gmshairfoil2d-0.2 → gmshairfoil2d-0.2.1}/gmshairfoil2d.egg-info/PKG-INFO +1 -3
- {gmshairfoil2d-0.2 → gmshairfoil2d-0.2.1}/gmshairfoil2d.egg-info/SOURCES.txt +1 -4
- {gmshairfoil2d-0.2 → gmshairfoil2d-0.2.1}/gmshairfoil2d.egg-info/top_level.txt +1 -0
- {gmshairfoil2d-0.2 → gmshairfoil2d-0.2.1}/setup.py +12 -8
- gmshairfoil2d-0.2.1/tests/__init__.py +0 -0
- gmshairfoil2d-0.2.1/tests/test_airfoil_func.py +77 -0
- gmshairfoil2d-0.2/tests/test_airfoil_func.py +0 -73
- {gmshairfoil2d-0.2 → gmshairfoil2d-0.2.1}/LICENSE +0 -0
- {gmshairfoil2d-0.2 → gmshairfoil2d-0.2.1}/README.md +0 -0
- {gmshairfoil2d-0.2 → gmshairfoil2d-0.2.1}/gmshairfoil2d/__init__.py +0 -0
- {gmshairfoil2d-0.2 → gmshairfoil2d-0.2.1}/gmshairfoil2d/geometry_def.py +0 -0
- {gmshairfoil2d-0.2 → gmshairfoil2d-0.2.1}/gmshairfoil2d/gmshairfoil2d.py +0 -0
- {gmshairfoil2d-0.2 → gmshairfoil2d-0.2.1}/gmshairfoil2d.egg-info/dependency_links.txt +0 -0
- {gmshairfoil2d-0.2 → gmshairfoil2d-0.2.1}/gmshairfoil2d.egg-info/entry_points.txt +0 -0
- {gmshairfoil2d-0.2 → gmshairfoil2d-0.2.1}/gmshairfoil2d.egg-info/requires.txt +0 -0
- {gmshairfoil2d-0.2 → gmshairfoil2d-0.2.1}/setup.cfg +0 -0
- {gmshairfoil2d-0.2 → gmshairfoil2d-0.2.1}/tests/test_geometry_def.py +0 -0
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: gmshairfoil2d
|
|
3
|
-
Version: 0.2
|
|
3
|
+
Version: 0.2.1
|
|
4
4
|
Summary: Python tool to generate 2D mesh around an airfoil
|
|
5
5
|
Home-page: https://github.com/cfsengineering/GMSH-Airfoil-2D
|
|
6
6
|
Author: Giacomo Benedetti
|
|
7
7
|
Author-email: giacomo.benedetti@cfse.ch
|
|
8
|
-
License: Apache License 2.0
|
|
9
8
|
Keywords: airfoil,2D,mesh,cfd,gmsh
|
|
10
9
|
Classifier: Programming Language :: Python :: 3.11
|
|
11
10
|
Classifier: License :: OSI Approved :: Apache Software License
|
|
@@ -25,7 +24,6 @@ Dynamic: description
|
|
|
25
24
|
Dynamic: description-content-type
|
|
26
25
|
Dynamic: home-page
|
|
27
26
|
Dynamic: keywords
|
|
28
|
-
Dynamic: license
|
|
29
27
|
Dynamic: license-file
|
|
30
28
|
Dynamic: requires-dist
|
|
31
29
|
Dynamic: requires-python
|
|
@@ -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
|
-
|
|
53
|
-
|
|
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
|
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: gmshairfoil2d
|
|
3
|
-
Version: 0.2
|
|
3
|
+
Version: 0.2.1
|
|
4
4
|
Summary: Python tool to generate 2D mesh around an airfoil
|
|
5
5
|
Home-page: https://github.com/cfsengineering/GMSH-Airfoil-2D
|
|
6
6
|
Author: Giacomo Benedetti
|
|
7
7
|
Author-email: giacomo.benedetti@cfse.ch
|
|
8
|
-
License: Apache License 2.0
|
|
9
8
|
Keywords: airfoil,2D,mesh,cfd,gmsh
|
|
10
9
|
Classifier: Programming Language :: Python :: 3.11
|
|
11
10
|
Classifier: License :: OSI Approved :: Apache Software License
|
|
@@ -25,7 +24,6 @@ Dynamic: description
|
|
|
25
24
|
Dynamic: description-content-type
|
|
26
25
|
Dynamic: home-page
|
|
27
26
|
Dynamic: keywords
|
|
28
|
-
Dynamic: license
|
|
29
27
|
Dynamic: license-file
|
|
30
28
|
Dynamic: requires-dist
|
|
31
29
|
Dynamic: requires-python
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
LICENSE
|
|
2
2
|
README.md
|
|
3
3
|
setup.py
|
|
4
|
-
./gmshairfoil2d/__init__.py
|
|
5
|
-
./gmshairfoil2d/airfoil_func.py
|
|
6
|
-
./gmshairfoil2d/geometry_def.py
|
|
7
|
-
./gmshairfoil2d/gmshairfoil2d.py
|
|
8
4
|
gmshairfoil2d/__init__.py
|
|
9
5
|
gmshairfoil2d/airfoil_func.py
|
|
10
6
|
gmshairfoil2d/geometry_def.py
|
|
@@ -15,5 +11,6 @@ gmshairfoil2d.egg-info/dependency_links.txt
|
|
|
15
11
|
gmshairfoil2d.egg-info/entry_points.txt
|
|
16
12
|
gmshairfoil2d.egg-info/requires.txt
|
|
17
13
|
gmshairfoil2d.egg-info/top_level.txt
|
|
14
|
+
tests/__init__.py
|
|
18
15
|
tests/test_airfoil_func.py
|
|
19
16
|
tests/test_geometry_def.py
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
from pathlib import Path
|
|
2
|
-
import
|
|
2
|
+
from setuptools import setup, find_packages
|
|
3
3
|
|
|
4
4
|
NAME = "gmshairfoil2d"
|
|
5
|
-
VERSION = "0.2"
|
|
5
|
+
VERSION = "0.2.1"
|
|
6
6
|
AUTHOR = "Giacomo Benedetti"
|
|
7
7
|
EMAIL = "giacomo.benedetti@cfse.ch"
|
|
8
8
|
DESCRIPTION = "Python tool to generate 2D mesh around an airfoil"
|
|
@@ -22,7 +22,7 @@ README = "README.md"
|
|
|
22
22
|
PACKAGE_DIR = "."
|
|
23
23
|
LICENSE = "Apache License 2.0"
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
setup(
|
|
26
26
|
name=NAME,
|
|
27
27
|
version=VERSION,
|
|
28
28
|
author=AUTHOR,
|
|
@@ -32,16 +32,20 @@ setuptools.setup(
|
|
|
32
32
|
long_description_content_type="text/markdown",
|
|
33
33
|
url=URL,
|
|
34
34
|
include_package_data=True,
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
packages=[NAME],
|
|
35
|
+
|
|
36
|
+
packages=find_packages(),
|
|
38
37
|
python_requires=REQUIRES_PYTHON,
|
|
39
38
|
entry_points = {
|
|
40
39
|
"console_scripts": ['gmshairfoil2d = gmshairfoil2d.gmshairfoil2d:main']
|
|
41
40
|
},
|
|
42
41
|
keywords=["airfoil", "2D", "mesh", "cfd", "gmsh"],
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
|
|
43
|
+
install_requires=[
|
|
44
|
+
"gmsh>=4.14",
|
|
45
|
+
"numpy>=1.20.3",
|
|
46
|
+
"pytest==7.1.3",
|
|
47
|
+
"requests==2.26.0",
|
|
48
|
+
],
|
|
45
49
|
classifiers=[
|
|
46
50
|
"Programming Language :: Python :: 3.11",
|
|
47
51
|
"License :: OSI Approved :: Apache Software License",
|
|
File without changes
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import pickle
|
|
2
|
+
from pathlib import Path
|
|
3
|
+
from unittest.mock import patch, Mock
|
|
4
|
+
|
|
5
|
+
import gmshairfoil2d.__init__
|
|
6
|
+
from gmshairfoil2d.airfoil_func import (NACA_4_digit_geom, get_airfoil_file,
|
|
7
|
+
get_all_available_airfoil_names)
|
|
8
|
+
from pytest import approx
|
|
9
|
+
|
|
10
|
+
LIB_DIR = Path(gmshairfoil2d.__init__.__file__).parents[1]
|
|
11
|
+
|
|
12
|
+
database_dir = Path(LIB_DIR, "database")
|
|
13
|
+
test_data_dir = Path(LIB_DIR, "tests", "test_data")
|
|
14
|
+
|
|
15
|
+
def test_get_all_available_airfoil_names(monkeypatch):
|
|
16
|
+
class MockResponse:
|
|
17
|
+
def __init__(self):
|
|
18
|
+
self.status_code = 200
|
|
19
|
+
self.text = (
|
|
20
|
+
'<html>'
|
|
21
|
+
'<a href="coord/naca0010.dat">naca0010</a>'
|
|
22
|
+
'<a href="coord/naca0018.dat">naca0018</a>'
|
|
23
|
+
'<a href="coord/falcon.dat">falcon</a>'
|
|
24
|
+
'<a href="coord/goe510.dat">goe510</a>'
|
|
25
|
+
'<a href="coord/e1210.dat">e1210</a>'
|
|
26
|
+
'</html>'
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
monkeypatch.setattr("gmshairfoil2d.airfoil_func.requests.get", lambda *args, **kwargs: MockResponse())
|
|
30
|
+
|
|
31
|
+
current_airfoil_list = get_all_available_airfoil_names()
|
|
32
|
+
|
|
33
|
+
expected_airfoil = ["naca0010", "naca0018", "falcon", "goe510", "e1210"]
|
|
34
|
+
for foil in expected_airfoil:
|
|
35
|
+
assert foil in current_airfoil_list
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def test_get_airfoil_file(monkeypatch, tmp_path):
|
|
39
|
+
|
|
40
|
+
fake_text = "0.0 0.0\n0.5 0.1\n1.0 0.0"
|
|
41
|
+
|
|
42
|
+
class MockResponse:
|
|
43
|
+
def __init__(self):
|
|
44
|
+
self.status_code = 200
|
|
45
|
+
self.text = fake_text
|
|
46
|
+
self.content = fake_text.encode('utf-8')
|
|
47
|
+
|
|
48
|
+
monkeypatch.setattr("gmshairfoil2d.airfoil_func.requests.get", lambda *args, **kwargs: MockResponse())
|
|
49
|
+
|
|
50
|
+
monkeypatch.setattr("gmshairfoil2d.airfoil_func.database_dir", tmp_path)
|
|
51
|
+
|
|
52
|
+
profile = "naca0010"
|
|
53
|
+
expected_path = tmp_path / f"{profile}.dat"
|
|
54
|
+
|
|
55
|
+
get_airfoil_file(profile)
|
|
56
|
+
|
|
57
|
+
assert expected_path.exists()
|
|
58
|
+
assert expected_path.read_text() == fake_text
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def test_NACA_4_digit_geom():
|
|
62
|
+
with open(Path(test_data_dir, "naca0012.txt"), "rb") as f:
|
|
63
|
+
naca0012 = pickle.load(f)
|
|
64
|
+
with open(Path(test_data_dir, "naca4412.txt"), "rb") as f:
|
|
65
|
+
naca4412 = pickle.load(f)
|
|
66
|
+
|
|
67
|
+
"""
|
|
68
|
+
Test if the NACA0012 profil and NACA4412 profil are correctly generated
|
|
69
|
+
"""
|
|
70
|
+
|
|
71
|
+
assert all(
|
|
72
|
+
[a == approx(b, 1e-3) for a, b in zip(naca0012, NACA_4_digit_geom("0012"))]
|
|
73
|
+
)
|
|
74
|
+
|
|
75
|
+
assert all(
|
|
76
|
+
[a == approx(b, 1e-3) for a, b in zip(naca4412, NACA_4_digit_geom("4412"))]
|
|
77
|
+
)
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import pickle
|
|
2
|
-
from pathlib import Path
|
|
3
|
-
|
|
4
|
-
import gmshairfoil2d.__init__
|
|
5
|
-
from gmshairfoil2d.airfoil_func import (NACA_4_digit_geom, get_airfoil_file,
|
|
6
|
-
get_all_available_airfoil_names)
|
|
7
|
-
from pytest import approx
|
|
8
|
-
|
|
9
|
-
LIB_DIR = Path(gmshairfoil2d.__init__.__file__).parents[1]
|
|
10
|
-
|
|
11
|
-
database_dir = Path(LIB_DIR, "database")
|
|
12
|
-
test_data_dir = Path(LIB_DIR, "tests", "test_data")
|
|
13
|
-
|
|
14
|
-
def test_get_all_available_airfoil_names():
|
|
15
|
-
"""
|
|
16
|
-
Test if at least the database obtained containt some airfoils
|
|
17
|
-
|
|
18
|
-
"""
|
|
19
|
-
|
|
20
|
-
expected_airfoil = ["naca0010", "naca0018", "falcon", "goe510", "e1210"]
|
|
21
|
-
current_airfoil_list = get_all_available_airfoil_names()
|
|
22
|
-
|
|
23
|
-
for foil in expected_airfoil:
|
|
24
|
-
assert foil in current_airfoil_list
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
def test_get_airfoil_file():
|
|
28
|
-
"""
|
|
29
|
-
Test if the download of some profiles is possible and if it is, check if
|
|
30
|
-
they are conform.
|
|
31
|
-
"""
|
|
32
|
-
|
|
33
|
-
# Remove airfoil if they exist
|
|
34
|
-
for profile in ["naca0010", "naca4412"]:
|
|
35
|
-
|
|
36
|
-
proflie_dl_path = Path(database_dir, profile + ".dat")
|
|
37
|
-
if proflie_dl_path.exists():
|
|
38
|
-
proflie_dl_path.unlink()
|
|
39
|
-
|
|
40
|
-
# Download them back
|
|
41
|
-
get_airfoil_file(profile)
|
|
42
|
-
|
|
43
|
-
# Test if download is correctly done
|
|
44
|
-
assert proflie_dl_path.exists()
|
|
45
|
-
|
|
46
|
-
with open(proflie_dl_path, "r") as f:
|
|
47
|
-
profil_dl = f.read()
|
|
48
|
-
|
|
49
|
-
proflie_test_path = Path(test_data_dir, profile + ".dat")
|
|
50
|
-
with open(proflie_test_path, "r") as f:
|
|
51
|
-
profil_test = f.read()
|
|
52
|
-
|
|
53
|
-
# Test if the downloaded profile is the same as the test profile
|
|
54
|
-
assert profil_test == profil_dl
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
def test_NACA_4_digit_geom():
|
|
58
|
-
"""
|
|
59
|
-
Test if the NACA0012 profil and NACA4412 profil are correctly generated
|
|
60
|
-
|
|
61
|
-
"""
|
|
62
|
-
|
|
63
|
-
with open(Path(test_data_dir, "naca0012.txt"), "rb") as f:
|
|
64
|
-
naca0012 = pickle.load(f)
|
|
65
|
-
with open(Path(test_data_dir, "naca4412.txt"), "rb") as f:
|
|
66
|
-
naca4412 = pickle.load(f)
|
|
67
|
-
|
|
68
|
-
assert all(
|
|
69
|
-
[a == approx(b, 1e-3) for a, b in zip(naca0012, NACA_4_digit_geom("0012"))]
|
|
70
|
-
)
|
|
71
|
-
assert all(
|
|
72
|
-
[a == approx(b, 1e-3) for a, b in zip(naca4412, NACA_4_digit_geom("4412"))]
|
|
73
|
-
)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|