@@ -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
0 commit comments