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/.pre-commit-config.yaml b/.pre-commit-config.yaml index 91acc09d..a9abd52c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/psf/black - rev: 22.1.0 + rev: 22.3.0 hooks: - id: black language_version: python3.8 \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index 0c6724e3..df4eeb01 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,11 +5,11 @@ os: linux dist: xenial before_install: # configure a headless display - - git clone --depth 1 git://github.com/pyvista/gl-ci-helpers.git + - git clone --depth 1 https://github.com/pyvista/gl-ci-helpers.git - source ./gl-ci-helpers/travis/setup_headless_display.sh install: - pip install -r requirements.txt - pip install -r requirements_dev.txt script: - coverage run --source=pterasoftware -m unittest discover -s tests - - codecov + - codecov \ 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 diff --git a/pterasoftware/geometry.py b/pterasoftware/geometry.py index 053462e7..df159110 100644 --- a/pterasoftware/geometry.py +++ b/pterasoftware/geometry.py @@ -610,7 +610,7 @@ def populate_coordinates(self): # Get the camber. y_c_piece1 = ( max_camber - / camber_loc ** 2 + / camber_loc**2 * ( 2 * camber_loc * x_t[x_t <= camber_loc] - x_t[x_t <= camber_loc] ** 2 @@ -631,7 +631,7 @@ def populate_coordinates(self): first_piece_slope = ( 2 * max_camber - / camber_loc ** 2 + / camber_loc**2 * (camber_loc - x_t[x_t <= camber_loc]) ) second_piece_slope = ( diff --git a/pterasoftware/operating_point.py b/pterasoftware/operating_point.py index 953973a2..6e6526da 100644 --- a/pterasoftware/operating_point.py +++ b/pterasoftware/operating_point.py @@ -88,7 +88,7 @@ def calculate_dynamic_pressure(self): """ # Calculate and return the freestream dynamic pressure - dynamic_pressure = 0.5 * self.density * self.velocity ** 2 + dynamic_pressure = 0.5 * self.density * self.velocity**2 return dynamic_pressure def calculate_rotation_matrix_wind_to_geometry(self): diff --git a/pyproject.toml b/pyproject.toml index b5a3c468..58da3223 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [build-system] requires = [ - "setuptools>=42", + "setuptools>=62", "wheel" ] build-backend = "setuptools.build_meta" \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index b8673725..560ed0a5 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,8 +1,8 @@ matplotlib >= 3.5.0, < 4.0.0 numpy >= 1.21.0, < 1.22.0 -pyvista >= 0.33.0, < 1.0.0 -scipy >= 1.7.0, < 2.0.0 +pyvista >= 0.34.0, < 1.0.0 +scipy >= 1.8.0, < 2.0.0 numba >= 0.55.0, < 1.0.0 cmocean >= 2.0.0, < 3.0.0 -tqdm >= 4.63.0, < 5.0.0 +tqdm >= 4.64.0, < 5.0.0 webp >= 0.1.3, < 1.0.0 diff --git a/requirements_dev.txt b/requirements_dev.txt index cb0d4d5c..f9a4d57d 100644 --- a/requirements_dev.txt +++ b/requirements_dev.txt @@ -1,3 +1,3 @@ -codecov >= 2.1.12, < 3.0.0 -black >= 22.1.0, < 23.0.0 -pre-commit >= 2.17.0, < 3.0.0 +codecov >= 2.1.0, < 3.0.0 +black >= 22.3.0, < 23.0.0 +pre-commit >= 2.18.0, < 3.0.0 diff --git a/setup.cfg b/setup.cfg index a58033e9..0711da30 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = PteraSoftware -version = 2.0.0 +version = 2.0.1 author = Cameron Urban author_email = camerongurban@gmail.com license = MIT diff --git a/validation/validation_study.py b/validation/validation_study.py index 3cae5a2b..899a3a60 100644 --- a/validation/validation_study.py +++ b/validation/validation_study.py @@ -716,8 +716,8 @@ def normalized_validation_geometry_sweep_function_rad(time): ) lift_mean_absolute_error = np.mean(lift_absolute_errors) -sim_lift_rms = math.sqrt(np.mean(final_flap_sim_net_lift_forces_wind_axes ** 2)) -exp_lift_rms = math.sqrt(np.mean(exp_lifts_wind_axes ** 2)) +sim_lift_rms = math.sqrt(np.mean(final_flap_sim_net_lift_forces_wind_axes**2)) +exp_lift_rms = math.sqrt(np.mean(exp_lifts_wind_axes**2)) lift_rmsape = 100 * abs((sim_lift_rms - exp_lift_rms) / exp_lift_rms) print("\nLift RMS Absolute Percent Error: " + str(np.round(lift_rmsape, 2)) + "%") print("Simulated Lift RMS: " + str(np.round(sim_lift_rms, 4)) + " N")