...
 
Commits (2)
......@@ -60,6 +60,52 @@ def read_blade_planform(filename):
return pf
def write_blade_planform(pf, filename):
"""
write a planform file with columns:
| s: normalized running length of blade
| x: x-coordinates of blade axis
| y: y-coordinates of blade axis
| z: z-coordinates of blade axis
| rot_x: x-rotation of blade axis
| rot_y: y-rotation of blade axis
| rot_z: z-rotation of blade axis
| chord: chord distribution
| rthick: relative thickness distribution
| p_le: pitch axis aft leading edge distribution
| dy: vertical offset of cross-section
parameters
----------
pf: dict
planform dictionary
filename: str
path to file containing planform data
"""
data = np.zeros((pf['x'].shape[0], 10))
s = calculate_length(data[:, [0, 1, 2]])
names = ['x', 'y', 'z', 'rot_x', 'rot_y', 'rot_z',
'chord', 'rthick', 'p_le', 'dy']
for i, name in enumerate(names):
try:
data[:, i] = pf[name]
except:
print('failed writing %s - assuming zeros' % name)
data[:, i] = np.zeros(s.shape[0])
fid = open(filename, 'w')
exp_prec = 15 # exponential precesion
col_width = exp_prec + 10 # column width required for exp precision
header_full = '#'
header_full += ''.join([(hh + ' [%i]').center(col_width + 1) % i
for i, hh in enumerate(names)]) + '\n'
fid.write(header_full)
np.savetxt(fid, data)
fid.close()
def redistribute_planform(pf, dist=[], s=None, spline_type='akima'):
"""
redistribute a blade planform
......