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)
distribution=Distribution.from_cos_2_distribution, num_average=0, symmetric=False) 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)
import numpy as np import matplotlib matplotlib.use('Agg') from matplotlib import pyplot as plt import paraBEM from paraBEM import pan3d from paraBEM.mesh import mesh_object from paraBEM.vtk_export import CaseToVTK from paraBEM.utils import check_path, v_inf_deg_range3 mesh = mesh_object.from_OBJ("../mesh/wing_lift.obj") alpha_0 = np.deg2rad(5) v_inf = paraBEM.Vector3(np.cos(alpha_0), 0, np.sin(alpha_0)) v_inf_range = v_inf_deg_range3(v_inf, -5, 10, 20) fz = [] cmy = [] xcp = [] cL = [] cD = [] case = pan3d.DirichletDoublet0Source0Case3(mesh.panels, mesh.trailing_edges) case.farfield = 5 case.create_wake(10, 30) case.v_inf = v_inf case.create_wake(length=10000, count=4) # length, count polars = case.polars(v_inf_range) p = []