#%% Load Dependencies from pyvlm import LatticeResult from pyvlm import latticesystem_from_json #%% Create Lattice System jsonfilepath = '../files/Test_twist_sweep.json' lsys = latticesystem_from_json(jsonfilepath) print(lsys) #%% Original Strip Geometry print(lsys.strip_geometry) #%% Original Strip Geometry print(lsys.panel_geometry) #%% Original Case lres_org = LatticeResult('Baseline', lsys) lres_org.set_state(alpha=3.0) #%% Original Strip Forces print(lres_org.strip_forces) #%% Original Strip Coefficients print(lres_org.strip_coefficients) #%% Original Panel Forces print(lres_org.panel_forces) #%% Print Result print(lres_org)
from pyvlm import LatticeResult from pyvlm import latticesystem_from_json #%% Create Lattice System jsonfilepath = '../files/Straight_Wing_Cosine_100.json' lsys = latticesystem_from_json(jsonfilepath) display(lsys) #%% Original Strip Geometry display(lsys.strip_geometry) #%% Original Strip Geometry display(lsys.panel_geometry) #%% Original Case lres_org = LatticeResult('Baseline', lsys) lres_org.set_state(alpha=3.0) #, pbo2V=0.002) display(lres_org) #%% Original Strip Forces display(lres_org.strip_forces) #%% Original Strip Coefficients display(lres_org.strip_coefficients) #%% Original Panel Forces display(lres_org.panel_forces) #%% Plot Distribution axl = lres_org.plot_trefftz_lift_force_distribution()
from pyvlm import LatticeResult from pyvlm import latticesystem_from_json #%% Create Lattice System jsonfilepath = '../files/Test_taper.json' lsys = latticesystem_from_json(jsonfilepath) display_markdown(lsys) #%% Original Strip Geometry display_markdown(lsys.strip_geometry) #%% Original Strip Geometry display_markdown(lsys.panel_geometry) #%% Original Case lres_org = LatticeResult('Baseline', lsys) lres_org.set_state(alpha=3.0) #%% Original Strip Forces display_markdown(lres_org.strip_forces) #%% Original Strip Coefficients display_markdown(lres_org.strip_coefficients) #%% Original Panel Forces display_markdown(lres_org.panel_forces) #%% Print Result display_markdown(lres_org) #%% Plot Lift Distribution
#%% Import Dependencies from IPython.display import display from pyvlm import LatticeResult, LatticeOptimum from pyvlm import latticesystem_from_json #%% Low AR Wing jsonfilepath = '../files/Test.json' lsys = latticesystem_from_json(jsonfilepath) display(lsys) lsys_opt = latticesystem_from_json(jsonfilepath) lres_org = LatticeResult('Initial', lsys) lres_org.set_state(alpha=3.0) display(lres_org) Lspec = lres_org.trres.CL*lres_org.qfs*lsys.sref #%% Low AR Optimal Lift Distribution lopt = LatticeOptimum('Optimal', lsys_opt) lopt.set_state() lopt.add_constraint('L', Lspec) phi, lam = lopt.optimum_lift_force_distribution() display(lopt) #%% Original Lift Distribution Plot axl = lres_org.plot_trefftz_lift_force_distribution() axl = lopt.plot_trefftz_lift_force_distribution(ax=axl) _ = axl.set_ylabel('Lift Distribution') _ = axl.set_xlabel('Span Position') _ = axl.legend()
from pyvlm import latticesystem_from_json #%% Create Lattice System jsonfilepath = '../files/Straight_Wing_Control.json' lsys = latticesystem_from_json(jsonfilepath) display(lsys) #%% Original Strip Geometry display(lsys.strip_geometry) #%% Original Strip Geometry display(lsys.panel_geometry) #%% Original Case lres_org = LatticeResult('Baseline', lsys) lres_org.set_state(alpha=3.0) #, pbo2V=0.002) display(lres_org) # lres_org.print_total_loads() # lres_org.print_aerodynamic_coefficients() #%% Original Strip Forces display(lres_org.strip_forces) #%% Original Strip Coefficients display(lres_org.strip_coefficients) #%% Original Panel Forces display(lres_org.panel_forces)
ax.plot(lsys.srfcs[0].strpy, l, label='Lift Distribution') ax = lopt_bll.plot_trefftz_lift_force_distribution(ax=ax) 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
#%% Import Dependencies 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)
# rho = 1.0 V = (W/S/rho/CL*2)**0.5 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