Skip to content

Commit

Permalink
Update openfast_io for new added mass AeroDyn blade inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
hkross committed Dec 27, 2024
1 parent 32c06e0 commit 4c17e4d
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 8 deletions.
26 changes: 22 additions & 4 deletions openfast_io/openfast_io/FAST_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -1251,9 +1251,15 @@ def read_AeroDynBlade(self):
self.fst_vt['AeroDynBlade']['BlTwist'] = [None]*self.fst_vt['AeroDynBlade']['NumBlNds']
self.fst_vt['AeroDynBlade']['BlChord'] = [None]*self.fst_vt['AeroDynBlade']['NumBlNds']
self.fst_vt['AeroDynBlade']['BlAFID'] = [None]*self.fst_vt['AeroDynBlade']['NumBlNds']
self.fst_vt['AeroDynBlade']['t_c'] = [None]*self.fst_vt['AeroDynBlade']['NumBlNds']
self.fst_vt['AeroDynBlade']['BlCb'] = [None]*self.fst_vt['AeroDynBlade']['NumBlNds']
self.fst_vt['AeroDynBlade']['BlCenBn'] = [None]*self.fst_vt['AeroDynBlade']['NumBlNds']
self.fst_vt['AeroDynBlade']['BlCenBt'] = [None]*self.fst_vt['AeroDynBlade']['NumBlNds']
self.fst_vt['AeroDynBlade']['BlCpn'] = [None]*self.fst_vt['AeroDynBlade']['NumBlNds']
self.fst_vt['AeroDynBlade']['BlCpt'] = [None]*self.fst_vt['AeroDynBlade']['NumBlNds']
self.fst_vt['AeroDynBlade']['BlCan'] = [None]*self.fst_vt['AeroDynBlade']['NumBlNds']
self.fst_vt['AeroDynBlade']['BlCat'] = [None]*self.fst_vt['AeroDynBlade']['NumBlNds']
self.fst_vt['AeroDynBlade']['BlCam'] = [None]*self.fst_vt['AeroDynBlade']['NumBlNds']
for i in range(self.fst_vt['AeroDynBlade']['NumBlNds']):
data = [float(val) for val in f.readline().split()]
self.fst_vt['AeroDynBlade']['BlSpn'][i] = data[0]
Expand All @@ -1263,14 +1269,26 @@ def read_AeroDynBlade(self):
self.fst_vt['AeroDynBlade']['BlTwist'][i] = data[4]
self.fst_vt['AeroDynBlade']['BlChord'][i] = data[5]
self.fst_vt['AeroDynBlade']['BlAFID'][i] = data[6]
if len(data) == 9:
self.fst_vt['AeroDynBlade']['BlCb'][i] = data[7]
self.fst_vt['AeroDynBlade']['BlCenBn'][i] = data[8]
self.fst_vt['AeroDynBlade']['BlCenBt'][i] = data[9]
if len(data) == 16:
self.fst_vt['AeroDynBlade']['t_c'][i] = data[7]
self.fst_vt['AeroDynBlade']['BlCb'][i] = data[8]
self.fst_vt['AeroDynBlade']['BlCenBn'][i] = data[9]
self.fst_vt['AeroDynBlade']['BlCenBt'][i] = data[10]
self.fst_vt['AeroDynBlade']['BlCpn'][i] = data[11]
self.fst_vt['AeroDynBlade']['BlCpt'][i] = data[12]
self.fst_vt['AeroDynBlade']['BlCan'][i] = data[13]
self.fst_vt['AeroDynBlade']['BlCat'][i] = data[14]
self.fst_vt['AeroDynBlade']['BlCam'][i] = data[15]
else:
self.fst_vt['AeroDynBlade']['t_c'][i] = 0.0
self.fst_vt['AeroDynBlade']['BlCb'][i] = 0.0
self.fst_vt['AeroDynBlade']['BlCenBn'][i] = 0.0
self.fst_vt['AeroDynBlade']['BlCenBt'][i] = 0.0
self.fst_vt['AeroDynBlade']['BlCpn'][i] = 0.0
self.fst_vt['AeroDynBlade']['BlCpt'][i] = 0.0
self.fst_vt['AeroDynBlade']['BlCan'][i] = 0.0
self.fst_vt['AeroDynBlade']['BlCat'][i] = 0.0
self.fst_vt['AeroDynBlade']['BlCam'][i] = 0.0


f.close()
Expand Down
14 changes: 10 additions & 4 deletions openfast_io/openfast_io/FAST_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1019,20 +1019,26 @@ def write_AeroDynBlade(self):
f.write('Generated with OpenFAST_IO\n')
f.write('====== Blade Properties =================================================================\n')
f.write('{:<11d} {:<11} {:}'.format(self.fst_vt['AeroDynBlade']['NumBlNds'], 'NumBlNds', '- Number of blade nodes used in the analysis (-)\n'))
f.write(' BlSpn BlCrvAC BlSwpAC BlCrvAng BlTwist BlChord BlAFID BlCb BlCenBn BlCenBt\n')
f.write(' (m) (m) (m) (deg) (deg) (m) (-) (-) (m) (m)\n')
f.write(' BlSpn BlCrvAC BlSwpAC BlCrvAng BlTwist BlChord BlAFID t_c BlCb BlCenBn BlCenBt BlCpn BlCpt BlCan BlCat BlCam\n')
f.write(' (m) (m) (m) (deg) (deg) (m) (-) (-) (-) (m) (m) (-) (-) (-) (-) (-)\n')
BlSpn = self.fst_vt['AeroDynBlade']['BlSpn']
BlCrvAC = self.fst_vt['AeroDynBlade']['BlCrvAC']
BlSwpAC = self.fst_vt['AeroDynBlade']['BlSwpAC']
BlCrvAng = self.fst_vt['AeroDynBlade']['BlCrvAng']
BlTwist = self.fst_vt['AeroDynBlade']['BlTwist']
BlChord = self.fst_vt['AeroDynBlade']['BlChord']
BlAFID = self.fst_vt['AeroDynBlade']['BlAFID']
t_c = self.fst_vt['AeroDynBlade']['t_c']
BlCb = self.fst_vt['AeroDynBlade']['BlCb']
BlCenBn = self.fst_vt['AeroDynBlade']['BlCenBn']
BlCenBt = self.fst_vt['AeroDynBlade']['BlCenBt']
for Spn, CrvAC, SwpAC, CrvAng, Twist, Chord, AFID, BlCb, BlCenBn, BlCenBt in zip(BlSpn, BlCrvAC, BlSwpAC, BlCrvAng, BlTwist, BlChord, BlAFID, BlCb, BlCenBn, BlCenBt):
f.write('{: 2.15e} {: 2.15e} {: 2.15e} {: 2.15e} {: 2.15e} {: 2.15e} {: 8d} {: 2.15e} {: 2.15e} {: 2.15e}\n'.format(Spn, CrvAC, SwpAC, CrvAng, Twist, Chord, int(AFID), BlCb, BlCenBn, BlCenBt))
BlCpn = self.fst_vt['AeroDynBlade']['BlCpn']
BlCpt = self.fst_vt['AeroDynBlade']['BlCpt']
BlCan = self.fst_vt['AeroDynBlade']['BlCan']
BlCat = self.fst_vt['AeroDynBlade']['BlCat']
BlCam = self.fst_vt['AeroDynBlade']['BlCam']
for Spn, CrvAC, SwpAC, CrvAng, Twist, Chord, AFID, t_c, BlCb, BlCenBn, BlCenBt, BlCpn, BlCpt, BlCan, BlCat, BlCam in zip(BlSpn, BlCrvAC, BlSwpAC, BlCrvAng, BlTwist, BlChord, BlAFID, t_c, BlCb, BlCenBn, BlCenBt, BlCpn, BlCpt, BlCan, BlCat, BlCam):
f.write('{: 2.15e} {: 2.15e} {: 2.15e} {: 2.15e} {: 2.15e} {: 2.15e} {: 8d} {: 2.15e} {: 2.15e} {: 2.15e} {: 2.15e} {: 2.15e} {: 2.15e} {: 2.15e} {: 2.15e} {: 2.15e}\n'.format(Spn, CrvAC, SwpAC, CrvAng, Twist, Chord, int(AFID), t_c, BlCb, BlCenBn, BlCenBt, BlCpn, BlCpt, BlCan, BlCat, BlCam))

f.flush()
os.fsync(f)
Expand Down

0 comments on commit 4c17e4d

Please sign in to comment.