Skip to content

Commit 3bbf565

Browse files
committed
Merge remote-tracking branch 'nrel/main' into f/ff
2 parents 210a581 + d764333 commit 3bbf565

36 files changed

+2442
-1179
lines changed

.github/workflows/development-pipeline.yml

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,6 @@ jobs:
2121
strategy:
2222
matrix:
2323
include:
24-
- os: ubuntu-latest
25-
python-version: 3.7
26-
python: xvfb-run python3
27-
pip_arg: ""
28-
- os: ubuntu-latest
29-
python-version: 3.8
30-
python: xvfb-run python3
31-
pip_arg: ""
3224
- os: ubuntu-latest
3325
python-version: 3.9
3426
python: xvfb-run python3
@@ -41,11 +33,11 @@ jobs:
4133
python-version: 3.12
4234
python: xvfb-run python3
4335
pip_arg: ""
44-
- os: macos-11
45-
python-version: 3.11
36+
- os: macos-13
37+
python-version: 3.12
4638
python: python3
4739
pip_arg: ""
48-
- os: windows-2019
40+
- os: windows-2022
4941
python-version: 3.11
5042
python: python
5143
pip_arg: --user

__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
"""Initializes the package"""
1+
"""Initialize package"""

openfast_toolbox/airfoils/Polar.py

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -84,15 +84,18 @@ def __init__(self, filename=None, alpha=None, cl=None, cd=None, cm=None, Re=None
8484
cd = df['Cd'].values
8585
cm = df['Cm'].values
8686
if 'fs' in df.keys():
87-
print('[INFO] Using separating function from input file.')
87+
if verbose:
88+
print('[INFO] Using separating function from input file.')
8889
self.fs = df['fs'].values
8990
self._fs_lock = True
9091
if 'Cl_fs' in df.keys():
91-
print('[INFO] Using Cl fully separated from input file.')
92+
if verbose:
93+
print('[INFO] Using Cl fully separated from input file.')
9294
self.cl_fs =df['Cl_fs'].values
9395
self._cl_fs_lock = True
9496
if 'Cl_inv' in df.keys():
95-
print('[INFO] Using Cl inviscid from input file.')
97+
if verbose:
98+
print('[INFO] Using Cl inviscid from input file.')
9699
self.cl_inv = df['Cl_inv'].values
97100
self._cl_inv_lock = True
98101
# TODO we need a trigger if cl_inv provided, we should get alpha0 and slope from it
@@ -667,7 +670,7 @@ def __getCM(self, i, cmCoef, alpha, cl_ext, cd_ext, alpha_low_deg, alpha_high_de
667670
print("Angle encountered for which there is no CM table value " "(near +/-180 deg). Program will stop.")
668671
return cm_new
669672

670-
def unsteadyParams(self, window_offset=None, nMin=720):
673+
def unsteadyParams(self, window_offset=None, nMin=720, verbose=False):
671674
"""compute unsteady aero parameters used in AeroDyn input file
672675
673676
TODO Questions to solve:
@@ -737,7 +740,8 @@ def unsteadyParams(self, window_offset=None, nMin=720):
737740
try:
738741
alpha0cn = _find_alpha0(alpha, cn, window, direction='up', value_if_constant = 0.)
739742
except NoCrossingException:
740-
print("[WARN] Polar: Cn unsteady, cannot find zero crossing with up direction, trying down direction")
743+
if verbose:
744+
print("[WARN] Polar: Cn unsteady, cannot find zero crossing with up direction, trying down direction")
741745
alpha0cn = _find_alpha0(alpha, cn, window, direction='down')
742746

743747
# checks for inppropriate data (like cylinders)
@@ -751,7 +755,8 @@ def unsteadyParams(self, window_offset=None, nMin=720):
751755
try:
752756
a_MaxUpp, cn_MaxUpp, a_MaxLow, cn_MaxLow = _find_max_points(alpha, cn, alpha0, method="inflections")
753757
except NoStallDetectedException:
754-
print('[WARN] Polar: Cn unsteady, cannot find stall based on inflections, using min and max')
758+
if verbose:
759+
print('[WARN] Polar: Cn unsteady, cannot find stall based on inflections, using min and max')
755760
a_MaxUpp, cn_MaxUpp, a_MaxLow, cn_MaxLow = _find_max_points(alpha, cn, alpha0, method="minmax")
756761

757762
# --- cn slope
@@ -790,7 +795,8 @@ def unsteadyParams(self, window_offset=None, nMin=720):
790795
a_f07_Upp = xInter[2]
791796
a_f07_Low = xInter[0]
792797
else:
793-
print('[WARN] Polar: Cn unsteady, cn_f does not intersect cn 3 times. Intersections:{}.'.format(xInter))
798+
if verbose:
799+
print('[WARN] Polar: Cn unsteady, cn_f does not intersect cn 3 times. Intersections:{}.'.format(xInter))
794800
a_f07_Upp = abs(xInter[0])
795801
a_f07_Low = -abs(xInter[0])
796802

@@ -1745,6 +1751,8 @@ def _find_linear_region(x, y, nMin, x0=None):
17451751
iEnd = j + nMin
17461752
if x0 is not None:
17471753
sl = np.linalg.lstsq(x[iStart:iEnd], y[iStart:iEnd], rcond=None)[0][0]
1754+
if not np.isscalar(sl):
1755+
sl = sl[0]
17481756
slp[iStart, j] = sl
17491757
off[iStart, j] = x0
17501758
y_lin = x[iStart:iEnd] * sl

openfast_toolbox/airfoils/tests/test_run_Examples.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,17 @@ def test_run_examples(self):
1919
# Add tests to class
2020
MyDir=os.path.dirname(__file__)
2121
files = glob.glob(os.path.join(MyDir,'../examples/[a-zA-Z]*.py'))
22-
import matplotlib.pyplot as plt
2322
print('\n--------------------------------------------------------------')
23+
import matplotlib.pyplot as plt
2424
for f in files:
25-
print('Running example script: {}'.format(f))
25+
print('Running: {}'.format(os.path.relpath(f, MyDir)))
2626
if hasattr(self,'subTest'):
2727
with self.subTest(filename=os.path.basename(f)):
2828
execfile(f, {'__name__': '__test__', 'print': lambda *_:None})
29-
plt.close('all')
29+
try:
30+
plt.close('all')
31+
except:
32+
pass
3033

3134

3235
if __name__ == '__main__':

0 commit comments

Comments
 (0)