def min_func(x): global count count += 1 print("\niteration: " + str(count)) _glider2d = deepcopy(glider2d) glider_set_controlpoint(_glider2d, x) glider3d = _glider2d.get_glider_3d() panels = paraBEM_Panels(glider3d, midribs=0, profile_numpoints=40, symmetric=True, distribution=Distribution.from_nose_cos_distribution(40, 0.2), num_average=0) case = Case(panels[1], panels[2]) case.farfield = 5 case.drag_calc = "trefftz" case.A_ref = 23 case.create_wake(length=10000, count=5) case.v_inf = paraBEM.Vector3(8, 0, 1) case.trefftz_cut_pos = case.v_inf * 50 alpha = v_inf_deg_range3(case.v_inf, 5, 9, 20) polars = case.polars(alpha) vtk_writer = CaseToVTK(case, "results/vtk_opt", suffix=str(count)) vtk_writer.write_panels(data_type="point") cL = [] cD = [] for i in polars.values: cL.append(i.cL) cD.append(i.cD) return np.interp(0.6, cL, cD)
from paraBEM.mesh import mesh_object from paraBEM.pan3d import DirichletDoublet0Source0Case3 as Case from paraBEM.vtk_export import CaseToVTK mesh = mesh_object.from_OBJ("../mesh/sphere_half.obj") for panel in mesh.panels: panel.set_symmetric() case = Case(mesh.panels) case.run() writer = CaseToVTK(case, "results/symmetric_test") writer.write_panels(data_type="point") writer.write_field([-2, 2, 20], [-2, 2, 20], [-2, 2, 20])
v_inf = [8, 0, 1] case = Case(panels, trailing_edge) case.mom_ref_point = paraBEM.Vector3(1.25, 0, -6) case.A_ref = parametricGlider.shape.area case.farfield = 5 case.drag_calc = "on_body" case.trefftz_cut_pos = case.v_inf * 800 case.v_inf = paraBEM.Vector3(v_inf) case.create_wake(length=10000, count=4) # length, count polars = case.polars(v_inf_deg_range3(case.v_inf, -5, 12, 15)) vtk_writer = CaseToVTK(case, "results/vtk_glider_case") vtk_writer.write_panels(data_type="cell") vtk_writer.write_wake_panels() vtk_writer.write_body_stream(panels, 100) p = [] alpha = [] for i in polars.values: alpha.append(np.rad2deg(i.alpha)) p.append((i.cL, i.cD, i.cP, i.cop.x, i.cop.z)) plt.figure(figsize=(10, 4)) # plt.title(u"Beiwerte bei variiertem Anströmwinkel") plt.ylabel(u"$\\alpha$", rotation=0, fontsize=20) plt.xlabel(u"$c_{Wi}$, $c_N$, $c_A$", rotation=0, fontsize=20) plt.plot(np.array(p).T[0], alpha, label=u"$c_A$")
from paraBEM.vtk_export import CaseToVTK with open("../openglider/glider/referenz_schirm_berg.json") as _file: glider = load(_file)["data"] panels = paraBEM_Panels(glider.get_glider_3d() , 0, 30, 0, False) case = Case(panels[1], panels[2]) case.v_inf = paraBEM.Vector(glider.v_inf) case.drag_calc = "on_body" case.A_ref = glider.shape.area #wake parallel to the x axis print("* wake parallel to the x-axis") case.create_wake(50, 100, paraBEM.Vector3(1., 0., 0.)) case.run() writer = CaseToVTK(case, "results/wake/x-parallel") writer.write_panels() writer.write_wake_panels() print("F_l = ", case.cL * case.A_ref * 1.2 * 11**2 / 2., "F_w = ", case.cD * case.A_ref * 1.2 * 11**2 / 2.) #wake parallel to v_inf print("* wake parallel to v_inf") case.create_wake(50, 100, case.v_inf) case.run() writer = CaseToVTK(case, "results/wake/v_inf-parallel") writer.write_panels() writer.write_wake_panels() print("F_l = ", case.cL * case.A_ref * 1.2 * 11**2 / 2., "F_w = ", case.cD * case.A_ref * 1.2 * 11**2 / 2.)
import paraBEM from paraBEM import pan3d from paraBEM.vtk_export import CaseToVTK from paraBEM.mesh import mesh_object import numpy as np mesh = mesh_object.from_OBJ("../mesh/sphere_low_tri.obj") case = pan3d.DirichletDoublet0Case3(mesh.panels) case.v_inf = paraBEM.Vector3(1, 0, 0.) case.farfield = 100 case.run() lin = np.linspace(-0.5, 0.5, 5) grid = [[-2, k, j] for j in lin for k in lin] vtk_writer = CaseToVTK(case, "results/vtk_test_case") vtk_writer.write_panels(data_type="point") # vtk_writer.write_wake_panels() vtk_writer.write_body_stream(mesh.panels, 50) vtk_writer.write_field([-2, 2, 100], [-2, 2, 100], [-1, 1, 3])
n_x = 50 n_y = 10 a = Airfoil.joukowsky(-0.01+1j) a.numpoints = n_x print(a.coordinates) ribs = [rib3d(a, y) for y in np.linspace(-5, 5, n_y)] panels = [] for i in range(n_y)[:-1]: for j in range(n_x): panels.append(paraBEM.Panel3([ribs[i][j], ribs[i + 1][j], ribs[i + 1][j + 1], ribs[i][j + 1]])) te = [rib[0] for rib in ribs] print(te) case = Case(panels, te) case.farfield = 5 case.v_inf = paraBEM.Vector3(1, 0, 0.0) case.create_wake(length=10000, count=3) # length, count case.run() for i in range(n_y): plt.plot(*zip(*[[pan.center.x, pan.cp] for pan in case.panels[i * n_x : (i+1) * n_x]]), marker="x") # plt.show() plt.plot(*zip(*a.coordinates)) # plt.show() vtk_writer = CaseToVTK(case, "results/joukowsky3_d") vtk_writer.write_panels(data_type="point")