from IPython.display import display_markdown from pyvlm import LatticeResult from pyvlm import latticesystem_from_json #%% Create Lattice System jsonfilepath = '../files/Prandtl-D2.json' lsys = latticesystem_from_json(jsonfilepath) display_markdown(lsys) #%% Design Point Result alpha = 0.0 speed = 13.0 rho = 1.145 lres = LatticeResult('Design Point', lsys) lres.set_density(rho=rho) lres.set_state(alpha=alpha, speed=speed) display_markdown(lres) display_markdown(lres.surface_loads) display_markdown(lres.stability_derivatives) #%% Roll Case Result alpha = 0.0 speed = 13.0 pbo2V = 0.01 rho = 1.145 lres = LatticeResult('Roll Case', lsys) lres.set_density(rho=rho) lres.set_state(alpha=alpha, speed=speed, pbo2V=pbo2V)
ax = lopt_bll.plot_strip_lift_force_distribution(ax=ax) leg = ax.legend() #%% Plot Specified Twist fig = figure(figsize=(12, 8)) ax = fig.gca() ax.grid(True) ax.plot(yspec, alspec) ax.set_title('Wing Geometric Twist as a function of Span') ax.set_xlabel('Span Coordinate - y - [m]') _ = ax.set_ylabel('Geometric Twist Angle - $\\alpha_g$ - [deg]') #%% New Results lres_1g = LatticeResult('1g Result', lsys_bll) lres_1g.set_state(alpha=0.0, speed=trm.speed) lres_1g.set_density(rho=rho) display(lres_1g) CL0 = lres_1g.nfres.CL CLa = lres_1g.stres.alpha.CL al3g = degrees(asin((3*CL-CL0)/CLa)) lres_3g = LatticeResult('3g Result', lsys_bll) lres_3g.set_state(alpha=al3g, speed=trm.speed) lres_3g.set_density(rho=rho) display(lres_3g) #%% New Plots axl = None axl = lres_1g.plot_trefftz_lift_force_distribution(ax=axl) axl = lres_1g.plot_strip_lift_force_distribution(ax=axl)
print(f'V = {V:.4f} m/s') q = rho*V**2/2 # Pa print(f'q = {q:.2f} Pa') #%% Low AR Wing System jsonfilepath = '../files/Test_rhofw.json' lsys = latticesystem_from_json(jsonfilepath) lsys_opt = latticesystem_from_json(jsonfilepath) lsys_bll = latticesystem_from_json(jsonfilepath) display(lsys) #%% Create Initial Result lres_org = LatticeResult('Initial', lsys) lres_org.set_state(speed=V) lres_org.set_density(rho=rho) display(lres_org) #%% Bell Shaped Lift Distribution lbll = bell_lift_force_distribution(lsys.srfcs[0].strpy, lsys.bref, W) lopt_bll = LatticeOptimum('Bell', lsys_bll) lopt_bll.set_target_lift_force_distribution(lbll, rho, V) lopt_bll.add_record('L') lopt_bll.add_record('l', strplst=lsys.lstrpi) lopt_bll.add_record('l', strplst=lsys.mstrpi) display(lopt_bll) #%% Optimal Lift Distribution lopt = LatticeOptimum('Optimal', lsys_opt) lopt.set_state(speed=V)