@@ -394,8 +394,11 @@ def correction3D(
394
394
/ cl_slope
395
395
* (1.6 * chord_over_r / 0.1267 * (a - chord_over_r ** expon ) / (b + chord_over_r ** expon ) - 1 )
396
396
)
397
+ # Force fcl to stay non-negative
398
+ if fcl < 0. :
399
+ fcl = 0.
397
400
else :
398
- fcl = 1 .0
401
+ fcl = 0 .0
399
402
elif lift_method == "Snel" :
400
403
# Snel correction
401
404
fcl = 3.0 * chord_over_r ** 2.0
@@ -730,7 +733,7 @@ def unsteadyParams(self, window_offset=None, nMin=720):
730
733
else :
731
734
window = [- 20 , 20 ]
732
735
try :
733
- alpha0cn = _find_alpha0 (alpha , cn , window , direction = 'up' )
736
+ alpha0cn = _find_alpha0 (alpha , cn , window , direction = 'up' , value_if_constant = 0. )
734
737
except NoCrossingException :
735
738
print ("[WARN] Polar: Cn unsteady, cannot find zero crossing with up direction, trying down direction" )
736
739
alpha0cn = _find_alpha0 (alpha , cn , window , direction = 'down' )
@@ -1265,17 +1268,17 @@ def _alpha_window_in_bounds(alpha, window):
1265
1268
return window
1266
1269
1267
1270
1268
- def _find_alpha0 (alpha , coeff , window , direction = 'up' ):
1271
+ def _find_alpha0 (alpha , coeff , window , direction = 'up' , value_if_constant = np . nan ):
1269
1272
"""Finds the point where coeff(alpha)==0 using interpolation.
1270
1273
The search is narrowed to a window that can be specified by the user. The default window is yet enough for cases that make physical sense.
1271
1274
The angle alpha0 is found by looking at a zero up crossing in this window, and interpolation is used to find the exact location.
1272
1275
"""
1273
1276
# Constant case or only one value
1274
- if np .all (coeff == coeff [0 ]) or len (coeff ) == 1 :
1277
+ if np .all (abs (( coeff - coeff [0 ]) < 1e-8 ) ) or len (coeff ) == 1 :
1275
1278
if coeff [0 ] == 0 :
1276
1279
return 0
1277
1280
else :
1278
- return np . nan
1281
+ return value_if_constant
1279
1282
# Ensuring window is within our alpha values
1280
1283
window = _alpha_window_in_bounds (alpha , window )
1281
1284
0 commit comments