diff --git a/.idea/watcherTasks.xml b/.idea/watcherTasks.xml index c23cb2a7..bd83d372 100644 --- a/.idea/watcherTasks.xml +++ b/.idea/watcherTasks.xml @@ -1,25 +1,8 @@ - - - + + \ No newline at end of file diff --git a/pterasoftware/aerodynamics.py b/pterasoftware/aerodynamics.py index db8b38ec..24490f40 100644 --- a/pterasoftware/aerodynamics.py +++ b/pterasoftware/aerodynamics.py @@ -49,7 +49,7 @@ # dramatically affect the stability of the result. I'm using this value, as cited for # use in flapping-wing vehicles in "Role of Filament Strain in the Free-Vortex # Modeling of Rotor Wakes" (Ananthan and Leishman, 2004). It is unitless. -squire = 10 ** -4 +squire = 10**-4 # Set the value of Lamb's constant that will be used by the induced velocity # functions. Lamb's constant relates to the size of the vortex cores and the rate at @@ -335,7 +335,7 @@ def update_position( ) -@njit(cache=True, fastmath=True) +@njit(cache=True, fastmath=False) def collapsed_velocities_from_horseshoe_vortices( points, back_right_vortex_vertices, @@ -419,7 +419,7 @@ def collapsed_velocities_from_horseshoe_vortices( return induced_velocities -@njit(cache=True, fastmath=True) +@njit(cache=True, fastmath=False) def expanded_velocities_from_horseshoe_vortices( points, back_right_vortex_vertices, @@ -503,7 +503,7 @@ def expanded_velocities_from_horseshoe_vortices( return induced_velocities -@njit(cache=True, fastmath=True) +@njit(cache=True, fastmath=False) def collapsed_velocities_from_ring_vortices( points, back_right_vortex_vertices, @@ -589,7 +589,7 @@ def collapsed_velocities_from_ring_vortices( return induced_velocities -@njit(cache=True, fastmath=True) +@njit(cache=True, fastmath=False) def expanded_velocities_from_ring_vortices( points, back_right_vortex_vertices, @@ -675,7 +675,7 @@ def expanded_velocities_from_ring_vortices( return induced_velocities -@njit(cache=True, fastmath=True) +@njit(cache=True, fastmath=False) def collapsed_velocities_from_line_vortices( points, origins, @@ -759,10 +759,10 @@ def collapsed_velocities_from_line_vortices( r_0_z = termination[2] - origin[2] # Find the r_0 vector's length. - r_0 = math.sqrt(r_0_x ** 2 + r_0_y ** 2 + r_0_z ** 2) + r_0 = math.sqrt(r_0_x**2 + r_0_y**2 + r_0_z**2) c_1 = strength / (4 * math.pi) - c_2 = r_0 ** 2 * r_c ** 2 + c_2 = r_0**2 * r_c**2 for point_id in range(num_points): point = points[point_id] @@ -783,9 +783,9 @@ def collapsed_velocities_from_line_vortices( r_3_z = r_1_x * r_2_y - r_1_y * r_2_x # Find the r_1, r_2, and r_3 vectors' lengths. - r_1 = math.sqrt(r_1_x ** 2 + r_1_y ** 2 + r_1_z ** 2) - r_2 = math.sqrt(r_2_x ** 2 + r_2_y ** 2 + r_2_z ** 2) - r_3 = math.sqrt(r_3_x ** 2 + r_3_y ** 2 + r_3_z ** 2) + r_1 = math.sqrt(r_1_x**2 + r_1_y**2 + r_1_z**2) + r_2 = math.sqrt(r_2_x**2 + r_2_y**2 + r_2_z**2) + r_3 = math.sqrt(r_3_x**2 + r_3_y**2 + r_3_z**2) c_3 = r_1_x * r_2_x + r_1_y * r_2_y + r_1_z * r_2_z @@ -793,14 +793,14 @@ def collapsed_velocities_from_line_vortices( # within machine epsilon), there is a removable discontinuity. In this # case, continue to the next point because there is no velocity induced # by the current vortex at this point. - if r_1 < eps or r_2 < eps or r_3 ** 2 < eps: + if r_1 < eps or r_2 < eps or r_3**2 < eps: continue else: c_4 = ( c_1 * (r_1 + r_2) * (r_1 * r_2 - c_3) - / (r_1 * r_2 * (r_3 ** 2 + c_2)) + / (r_1 * r_2 * (r_3**2 + c_2)) ) velocities[point_id, 0] += c_4 * r_3_x velocities[point_id, 1] += c_4 * r_3_y @@ -809,7 +809,7 @@ def collapsed_velocities_from_line_vortices( return velocities -@njit(cache=True, fastmath=True) +@njit(cache=True, fastmath=False) def expanded_velocities_from_line_vortices( points, origins, @@ -893,10 +893,10 @@ def expanded_velocities_from_line_vortices( r_0_z = termination[2] - origin[2] # Find the r_0 vector's length. - r_0 = math.sqrt(r_0_x ** 2 + r_0_y ** 2 + r_0_z ** 2) + r_0 = math.sqrt(r_0_x**2 + r_0_y**2 + r_0_z**2) c_1 = strength / (4 * math.pi) - c_2 = r_0 ** 2 * r_c ** 2 + c_2 = r_0**2 * r_c**2 for point_id in range(num_points): point = points[point_id] @@ -917,9 +917,9 @@ def expanded_velocities_from_line_vortices( r_3_z = r_1_x * r_2_y - r_1_y * r_2_x # Find the r_1, r_2, and r_3 vectors' lengths. - r_1 = math.sqrt(r_1_x ** 2 + r_1_y ** 2 + r_1_z ** 2) - r_2 = math.sqrt(r_2_x ** 2 + r_2_y ** 2 + r_2_z ** 2) - r_3 = math.sqrt(r_3_x ** 2 + r_3_y ** 2 + r_3_z ** 2) + r_1 = math.sqrt(r_1_x**2 + r_1_y**2 + r_1_z**2) + r_2 = math.sqrt(r_2_x**2 + r_2_y**2 + r_2_z**2) + r_3 = math.sqrt(r_3_x**2 + r_3_y**2 + r_3_z**2) c_3 = r_1_x * r_2_x + r_1_y * r_2_y + r_1_z * r_2_z @@ -927,14 +927,14 @@ def expanded_velocities_from_line_vortices( # within machine epsilon), there is a removable discontinuity. In this # case, set the velocity components to their true values, which are 0.0 # meters per second. - if r_1 < eps or r_2 < eps or r_3 ** 2 < eps: + if r_1 < eps or r_2 < eps or r_3**2 < eps: continue else: c_4 = ( c_1 * (r_1 + r_2) * (r_1 * r_2 - c_3) - / (r_1 * r_2 * (r_3 ** 2 + c_2)) + / (r_1 * r_2 * (r_3**2 + c_2)) ) velocities[point_id, vortex_id, 0] = c_4 * r_3_x velocities[point_id, vortex_id, 1] = c_4 * r_3_y diff --git a/pterasoftware/functions.py b/pterasoftware/functions.py index c61b889d..1bd9fb79 100644 --- a/pterasoftware/functions.py +++ b/pterasoftware/functions.py @@ -119,19 +119,19 @@ def angle_axis_rotation_matrix(angle, axis, axis_already_normalized=False): rotation_matrix = np.array( [ [ - cos_theta + u_x ** 2 * (1 - cos_theta), + cos_theta + u_x**2 * (1 - cos_theta), u_x * u_y * (1 - cos_theta) - u_z * sin_theta, u_x * u_z * (1 - cos_theta) + u_y * sin_theta, ], [ u_y * u_x * (1 - cos_theta) + u_z * sin_theta, - cos_theta + u_y ** 2 * (1 - cos_theta), + cos_theta + u_y**2 * (1 - cos_theta), u_y * u_z * (1 - cos_theta) - u_x * sin_theta, ], [ u_z * u_x * (1 - cos_theta) - u_y * sin_theta, u_z * u_y * (1 - cos_theta) + u_x * sin_theta, - cos_theta + u_z ** 2 * (1 - cos_theta), + cos_theta + u_z**2 * (1 - cos_theta), ], ] ) @@ -140,7 +140,7 @@ def angle_axis_rotation_matrix(angle, axis, axis_already_normalized=False): return rotation_matrix -@njit(cache=True, fastmath=True) +@njit(cache=True, fastmath=False) def numba_centroid_of_quadrilateral( front_left_vertex, front_right_vertex, back_left_vertex, back_right_vertex ): @@ -616,7 +616,7 @@ def calculate_steady_freestream_wing_influences(steady_solver): ) -@njit(cache=True, fastmath=True) +@njit(cache=True, fastmath=False) def numba_1d_explicit_cross(vectors_1, vectors_2): """This function takes in two arrays, each of which contain N vectors of 3 components. The function then calculates and returns the cross product of the two