コード例 #1
0
ファイル: lifting_line.py プロジェクト: booya-at/paraBEM
# WingGeometry
spw = 2
numpos = 50
z_fac_1 = -0.3
z_fac_2 = -0.7
y = np.sin(np.linspace(0, np.pi / 2, numpos)) * spw / 2
x = [0.0 for _ in y]
z = [i ** 2 * z_fac_1 + i ** 6 * z_fac_2 for i in y]

mirror = lambda xyz: [xyz[0], -xyz[1], xyz[2]]
wing = list(zip(x, y, z))
wing = list(map(mirror, wing))[::-1] + list(wing)[1:]
wing = [paraBEM.Vector3(*i) for i in wing]

# LiftingLine
lifting_line = LiftingLine(wing)
lifting_line.v_inf = paraBEM.Vector3(1, 0, 0)
lifting_line.solve_for_best_gamma(1)
gamma = [i.best_gamma for i in lifting_line.segments]
gamma_max = max(gamma)

# Plot
gamma_el = lambda y: gamma_max * (1 - (y / spw * 2) ** 2) ** (1 / 2)
mids = [[i.mids.x, i.mids.y, i.mids.z] for i in lifting_line.segments]
x, y, z = zip(*mids)

fig = plt.figure()
ax1 = fig.add_subplot(3, 1, 1)
ax1.plot(y, z)

ax2 = fig.add_subplot(3, 1, 2)
コード例 #2
0
ファイル: lifting_line_opt.py プロジェクト: booya-at/paraBEM
    symmetric=False,
    distribution=Distribution.from_cos_2_distribution,
    num_average=0,
)

case = DirichletDoublet0Source0Case3(panels, trailing_edge)
case.v_inf = paraBEM.Vector3(*glider2d.v_inf)
case.create_wake(1000, 100)
case.trefftz_cut_pos = case.v_inf * 20
case.run()
gamma_pan = -np.array([edge.vorticity for edge in case.trailing_edge])


######################LiftingLine############################
te_line = [paraBEM.Vector3(0, i.y, i.z) for i in trailing_edge]
lifting_line = LiftingLine(te_line)
lifting_line.v_inf = case.v_inf
lifting_line.solve_for_best_gamma(1)
gamma = [line.best_gamma for line in lifting_line.segments]
gamma_max = max(gamma)
gamma_pan *= gamma_max / max(gamma_pan)

line_segment_length = np.array([0] + [line.b for line in lifting_line.segments])
line_segment_length = line_segment_length.cumsum()
spw = max(line_segment_length)
spw_proj = abs(lifting_line.segments[0].v1.y) * 2
line_segment_length -= spw / 2


#####################Plottin#################################
コード例 #3
0
ファイル: lifting_line.py プロジェクト: luzpaz/paraBEM
# WingGeometry
spw = 2
numpos = 50
z_fac_1 = -0.3
z_fac_2 = -0.7
y = np.sin(np.linspace(0, np.pi/2, numpos)) * spw/2
x = [0. for _ in y]
z = [i**2 * z_fac_1 + i**6 * z_fac_2 for i in y]

mirror = lambda xyz: [xyz[0], -xyz[1], xyz[2]]
wing = list(zip(x, y, z))
wing = list(map(mirror, wing))[::-1] + list(wing)[1:]
wing = [paraBEM.Vector3(*i) for i in wing]

# LiftingLine
lifting_line = LiftingLine(wing)
lifting_line.v_inf = paraBEM.Vector3(1, 0, 0)
lifting_line.solve_for_best_gamma(1)
gamma = [i.best_gamma for i in lifting_line.segments]
gamma_max = max(gamma)

# Plot
gamma_el = lambda y: gamma_max * (1 - (y / spw * 2)**2)**(1 / 2)
mids = [[i.mids.x, i.mids.y, i.mids.z] for i in lifting_line.segments]
x, y, z = zip(*mids)

fig = plt.figure()
ax1 = fig.add_subplot(3, 1, 1)
ax1.plot(y, z)

ax2 = fig.add_subplot(3, 1, 2)
コード例 #4
0
    midribs=0,
    profile_numpoints=20,
    symmetric=False,
    distribution=Distribution.from_cos_2_distribution,
    num_average=0)

case = DirichletDoublet0Source0Case3(panels, trailing_edge)
case.v_inf = paraBEM.Vector3(*glider2d.v_inf)
case.create_wake(1000, 100)
case.trefftz_cut_pos = case.v_inf * 20
case.run()
gamma_pan = -np.array([edge.vorticity for edge in case.trailing_edge])

######################LiftingLine############################
te_line = [paraBEM.Vector3(0, i.y, i.z) for i in trailing_edge]
lifting_line = LiftingLine(te_line)
lifting_line.v_inf = case.v_inf
lifting_line.solve_for_best_gamma(1)
gamma = [line.best_gamma for line in lifting_line.segments]
gamma_max = max(gamma)
gamma_pan *= gamma_max / max(gamma_pan)

line_segment_length = np.array([0] +
                               [line.b for line in lifting_line.segments])
line_segment_length = line_segment_length.cumsum()
spw = max(line_segment_length)
spw_proj = abs(lifting_line.segments[0].v1.y) * 2
line_segment_length -= spw / 2

#####################Plottin#################################