I have coordinates of an airfoil curve. But I want to design semi-circular shapes that have equal distance of center on this curve's upper line.
I prepared the code like this, but it didn't give me the new design. What else can I do?
I prepared the code like this, but it didn't give me the new design. What else can I do?
import matplotlib.pyplot as plt
import numpy as np
# Airfoil coordinates (replace with your actual airfoil data)
# Format: [x, y]
airfoil_coordinates = np.array([
[1.0, 0.0],
[0.997397 , 0.00066484],
[0.98930099 ,0.00263811],
[0.9758986 , 0.00585581],
[0.95732594, 0.01021599],
[0.93377286, 0.01558451],
[0.90548195, 0.02180217],
[0.87274705, 0.02869202],
[0.83591106, 0.03606593],
[0.79536313, 0.04372985],
[0.7515351, 0.05148739],
[0.70489738, 0.0591418],
[0.65595428, 0.06649689],
[0.60523895, 0.07335757],
[0.55330789, 0.07953095],
[0.50073524, 0.08482876],
[0.44810653, 0.08907167],
[0.39597224, 0.09209455],
[0.34447681, 0.09354874],
[0.29469369, 0.09319491],
[0.247217, 0.09101236],
[0.20261449, 0.08704035],
[0.16141717, 0.08137882],
[0.1241097, 0.07418436],
[0.09112218, 0.06566122],
[0.06282393, 0.05604757],
[0.03951943, 0.04559798],
[0.0214464, 0.03456355],
[0.00877581, 0.02317172],
[0.00161308, 0.01160775],
[0 , 0],
[0.00386502, -0.01105828],
[0.01307659, -0.02100956],
[0.02749709, -0.02980941],
[0.04693512, -0.03740803],
[0.07115066, -0.04375885],
[0.09986083, -0.04882884],
[0.13274548, -0.05260868],
[0.16945222, -0.05512141],
[0.20960026, -0.05642796],
[0.252783, -0.05662861],
[0.29856967, -0.05586008],
[0.3465062, -0.05428834],
[0.39611607, -0.05209824],
[0.44736501, -0.04932603],
[0.49926476, -0.04594219],
[0.55122057, -0.04211028],
[0.60267274, -0.03798361],
[0.65306271, -0.03369861],
[0.70183926, -0.02937242],
[0.7484649, -0.02510332],
[0.79242212, -0.02097352],
[0.83321955, -0.01705316],
[0.87039778, -0.01340466],
[0.90353504, -0.01008621],
[0.93225254, -0.00715385],
[0.95621952, -0.00466171],
[0.97515792, -0.00266062],
[0.98884661, -0.00119526],
[0.9971249, -0.00030089],
[1.0, 0.0]
])
# Dimple parameters
dimple_radius = 0.05 # Radius of the semi-circle dimple
dimple_spacing = dimple_radius * 2 # Distance between centers of the dimples
# Calculate the number of dimples based on the airfoil length and spacing
num_dimples = int((airfoil_coordinates[-1, 0] - airfoil_coordinates[0, 0]) / dimple_spacing) #+1 vardı
# Create semi-circle dimples
def create_dimple(x, y, radius):
distance_to_center = np.sqrt(x ** 2 + y ** 2)
if distance_to_center <= radius:
y_offset = np.sqrt(radius ** 2 - x ** 2)
return y_offset
return y
dimpled_airfoil_coordinates = airfoil_coordinates.copy()
for i in range(num_dimples):
dimple_x = i * dimple_spacing
dimpled_airfoil_coordinates[:, 1] = np.vectorize(create_dimple)(
airfoil_coordinates[:, 0] - dimple_x,
dimpled_airfoil_coordinates[:, 1],
dimple_radius
)
# Plot the airfoil with dimples
plt.plot(airfoil_coordinates[:, 0], airfoil_coordinates[:, 1], label="Airfoil")
plt.plot(dimpled_airfoil_coordinates[:, 0], dimpled_airfoil_coordinates[:, 1], label="Airfoil with Dimples")
plt.xlabel('X-coordinate')
plt.ylabel('Y-coordinate')
plt.title('Airfoil with Semi-Circle Dimples')
plt.legend()
plt.axis('equal')
plt.grid(True)
plt.show()
Larz60+ write Aug-06-2023, 05:44 PM:
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
Fixed for you this time. Please use BBCode tags on future posts.
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
Fixed for you this time. Please use BBCode tags on future posts.
