コード例 #1
0
def test_area():
    P1, P2 = np.array([1, 0]), np.array([0, 0])
    P3, P4 = np.array([0, 1]), np.array([1, 1])

    panel = Panel(P1, P2, P3, P4)

    calculated_area = panel.area()
    expected_area = 1.0

    assert_almost_equal(calculated_area, expected_area)
コード例 #2
0
ファイル: main.py プロジェクト: AlexS12/PyVLM
N = n * m  # total number of panels

x = np.linspace(0, c, n + 1)
y = np.linspace(-b / 2, b / 2, m + 1)

# Calculations
A = np.zeros(shape=(N, N))
k = 0
for i in range(0, n):
    for j in range(0, m):
        P1 = np.array([x[i + 1], y[j]])
        P2 = np.array([x[i], y[j]])
        P3 = np.array([x[i], y[j + 1]])
        P4 = np.array([x[i + 1], y[j + 1]])
        panel_pivot = Panel(P1, P2, P3, P4)
        s = panel_pivot.area()
        CP = panel_pivot.control_point()
        #        print(P1, P2, P3, P4)
        print('---- Induced vel. on panel %s...' % k)
        #        print('area = ', s, 'control point = ', CP)
        kk = 0
        for ii in range(0, n):
            for jj in range(0, m):
                PP1 = np.array([x[ii + 1], y[jj]])
                PP2 = np.array([x[ii], y[jj]])
                PP3 = np.array([x[ii], y[jj + 1]])
                PP4 = np.array([x[ii + 1], y[jj + 1]])
                panel = Panel(PP1, PP2, PP3, PP4)
                w = panel.induced_velocity(CP)
                print('	...by panel %s = %s' % (kk, w))
                A[k, kk] = w
コード例 #3
0
alpha = np.deg2rad(3)

# Grid generator
b, c = 2, 1  # size of the panel (span, chord)
P1 = np.array([c, -b / 2])
P2 = np.array([0, -b / 2])
P3 = np.array([0, 0])
P4 = np.array([0, b / 2])
P5 = np.array([c, b / 2])
P6 = np.array([c, 0])

# Calculations
panel1 = Panel(P1, P2, P3, P6)
panel2 = Panel(P6, P3, P4, P5)

S1 = panel1.area()
S2 = panel2.area()

CP1 = panel1.control_point()
CP2 = panel2.control_point()

w11 = panel1.induced_velocity(CP1)
w12 = panel1.induced_velocity(CP2)
w22 = panel2.induced_velocity(CP2)
w21 = panel2.induced_velocity(CP1)

print('control point1 =', CP1, '  area1 =', '%4.3F' % S1)
print('control point2 =', CP2, '  area2 =', '%4.3F' % S2)
print('w11_induced =', '%4.3F' % w11, '  w12_induced =', '%4.3F' % w12)
print('w21_induced =', '%4.3F' % w21, '  w22_induced =', '%4.3F' % w22)
コード例 #4
0
import numpy as np
import matplotlib.pyplot as plt

from pyvlm.panel import Panel

# Initial data
V = 10.0

# Grid generator
b, c = 1, 1  # size of the panel (span, chord)
P1, P2 = np.array([c / 2, -b / 2]), np.array([-c / 2, -b / 2])
P3, P4 = np.array([-c / 2, b / 2]), np.array([c / 2, b / 2])

# Calculations
panel = Panel(P1, P2, P3, P4)
S = panel.area()
CP = panel.control_point()
w = panel.induced_velocity(CP)
print('w_induced =', '%4.3F' % w)

# Plots initialization
alpha_plot = np.linspace(-5, 5, 21)
gamma_plot = np.zeros_like(alpha_plot)
cl_plot = np.zeros_like(alpha_plot)
cd_plot = np.zeros_like(alpha_plot)
cm_plot = np.zeros_like(alpha_plot)

for i in range(len(alpha_plot)):
    alpha = np.deg2rad(alpha_plot[i])

    # Linear equation solving AX = Y