예제 #1
0
def test_control_point():
    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_control_point = panel.control_point()
    expected_control_point = np.array([0.75, 0.5])

    assert_almost_equal(calculated_control_point, expected_control_point)
예제 #2
0
def test_span():
    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_span = panel.span()
    expected_span = 1.0

    assert_almost_equal(calculated_span, expected_span)
예제 #3
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)
예제 #4
0
def test_induced_velocity():
    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)
    CP = panel.control_point()

    calculated_induced_velocity = panel.induced_velocity(CP)
    expected_induced_velocity = -0.7684680

    assert_almost_equal(calculated_induced_velocity, expected_induced_velocity)
예제 #5
0
def test_vortex_position():
    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_vortex_position = panel._vortex_position()
    expected_vortex_position = [
        np.array([0.75, 0.5]),
        np.array([0.25, 0]),
        np.array([0.25, 1])
    ]

    assert_almost_equal(calculated_vortex_position, expected_vortex_position)
예제 #6
0
파일: main.py 프로젝트: AlexS12/PyVLM
m = 4  # number of panels spanwise
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))
예제 #7
0
# Initial data
V = 10.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)
예제 #8
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])