Skip to content

Commit

Permalink
fixed avl trap wing
Browse files Browse the repository at this point in the history
  • Loading branch information
timdmacdo committed Jul 29, 2017
1 parent e76cfcf commit c8a4852
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 11 deletions.
9 changes: 7 additions & 2 deletions trunk/SUAVE/Input_Output/OpenVSP/vsp_write.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ def write(vehicle,tag):
chord_i = root_chord*wing.Segments[i_segs-1].root_chord_percent
twist_i = wing.Segments[i_segs-1].twist / Units.deg
sweep_i = wing.Segments[i_segs-1].sweeps.quarter_chord / Units.deg
tc_i = wing.Segments[i_segs-1].thickness_to_chord

# Calculate the local span
if i_segs == n_segments:
Expand All @@ -209,15 +210,19 @@ def write(vehicle,tag):
vsp.SetParmVal( wing_id,'Sweep_Location',x_secs[i_segs+adjust],sweep_loc)
vsp.SetParmVal( wing_id,'Root_Chord',x_secs[i_segs+adjust],chord_i)
vsp.SetParmVal( wing_id,'Twist',x_secs[i_segs+adjust],twist_i)
vsp.SetParmVal( wing_id,'ThickChord',x_sec_curves[i_segs+adjust],tip_tc)
vsp.SetParmVal( wing_id,'ThickChord',x_sec_curves[i_segs+adjust],tc_i)

vsp.Update()

if wing.Segments[-1].percent_span_location == 1.:
if (n_segments != 0) and (wing.Segments[-1].percent_span_location == 1.):
tip_chord = root_chord*wing.Segments[-1].root_chord_percent
vsp.SetParmVal( wing_id,'Tip_Chord',x_secs[n_segments-1],tip_chord)
vsp.SetParmVal( wing_id,'Twist',x_secs[n_segments-1],wing.Segments[-1].twist / Units.deg)
vsp.SetParmVal( wing_id,'ThickChord',x_secs[n_segments-1],wing.Segments[-1].thickness_to_chord)
else:
vsp.SetParmVal( wing_id,'Tip_Chord',x_secs[-1-(1-adjust)],tip_chord)
vsp.SetParmVal( wing_id,'Twist',x_secs[-1-(1-adjust)],tip_twist)
# a single trapezoidal wing is assumed to have constant thickness to chord
vsp.Update()
vsp.SetParmVal(wing_id,'CapUMaxOption','EndCap',2.)
vsp.SetParmVal(wing_id,'CapUMaxStrength','EndCap',1.)
Expand Down
24 changes: 15 additions & 9 deletions trunk/SUAVE/Methods/Aerodynamics/AVL/create_avl_datastructure.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# Created: Oct 2014, T. Momose
# Modified: Jan 2016, E. Botero
# Apr 2017, M. Clarke
# Jul 2017, T. MacDonald

# ----------------------------------------------------------------------
# Imports
Expand Down Expand Up @@ -106,11 +107,9 @@ def populate_wing_sections(avl_wing,suave_wing):
segment_root_chord = root_chord*suave_wing.Segments[i_segs].root_chord_percent
segment_tip_chord = root_chord*suave_wing.Segments[i_segs+1].root_chord_percent
segment_span = semispan*(suave_wing.Segments[i_segs+1].percent_span_location - suave_wing.Segments[i_segs].percent_span_location )

span_no_dihedral = segment_span/np.cos(dihedral)
dx_quarter = span_no_dihedral*np.tan(sweep_quarter_chord) + segment_root_chord/4.
dx_leading_edge = dx_quarter - segment_tip_chord/4.

sweep = np.arctan(dx_leading_edge/span_no_dihedral)

section = Section()
Expand Down Expand Up @@ -142,12 +141,12 @@ def populate_wing_sections(avl_wing,suave_wing):
dx = span_no_dihedral*np.tan(sweep)
origin.append( [origin[i_segs][0] + dx , origin[i_segs][1] + dy, origin[i_segs][2] + dz])
else:
symm = avl_wing.symmetric
sweep = suave_wing.sweeps.quarter_chord
dihedral = suave_wing.dihedral
span = suave_wing.spans.projected
semispan = suave_wing.spans.projected * 0.5 * (2 - symm)
origin = suave_wing.origin
symm = avl_wing.symmetric
sweep_quarter_chord = suave_wing.sweeps.quarter_chord
dihedral = suave_wing.dihedral
span = suave_wing.spans.projected
semispan = suave_wing.spans.projected * 0.5 * (2 - symm)
origin = suave_wing.origin

root_section = Section()
root_section.tag = 'root_section'
Expand All @@ -159,7 +158,14 @@ def populate_wing_sections(avl_wing,suave_wing):
tip_section.tag = 'tip_section'
tip_section.chord = suave_wing.chords.tip
tip_section.twist = suave_wing.twists.tip
tip_section.origin = [origin[0]+semispan*np.tan(sweep),origin[1]+semispan,origin[2]+semispan*np.tan(dihedral)]

semispan_no_dihedral = semispan/np.cos(dihedral)
dx_quarter = semispan_no_dihedral*np.tan(sweep_quarter_chord) + root_section.chord/4.
dx_leading_edge = dx_quarter - tip_section.chord/4.
sweep = np.arctan(dx_leading_edge/semispan_no_dihedral)
dx = semispan_no_dihedral*np.tan(sweep)

tip_section.origin = [origin[0]+dx, origin[1]+semispan, origin[2]+semispan*np.tan(dihedral)]

if avl_wing.vertical:
temp = tip_section.origin[2]
Expand Down

0 comments on commit c8a4852

Please sign in to comment.