Skip to content

Commit

Permalink
Update AddF0 and NumCoords in FAST_reader/writer
Browse files Browse the repository at this point in the history
  • Loading branch information
dzalkind committed May 11, 2022
1 parent f8c1dbe commit 97e2fe7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions ROSCO_toolbox/ofTools/fast_io/FAST_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -1633,9 +1633,9 @@ def read_HydroDyn(self):
# Get number of F0 terms [If NBodyMod=1, one size 6*NBody x 1 vector; if NBodyMod>1, NBody size 6 x 1 vectors]
NBody = self.fst_vt['HydroDyn']['NBody']
if self.fst_vt['HydroDyn']['NBodyMod'] == 1:
self.fst_vt['HydroDyn']['AddF0'] = np.array([float(f.readline().strip().split()[0]) for i in range(6*NBody)])
self.fst_vt['HydroDyn']['AddF0'] = [float(f.readline().strip().split()[0]) for i in range(6*NBody)]
elif self.fst_vt['HydroDyn']['NBodyMod'] > 1:
self.fst_vt['HydroDyn']['AddF0'] = np.array([[float(idx) for idx in f.readline().strip().split()[:NBody]] for i in range(6)])
self.fst_vt['HydroDyn']['AddF0'] = [[float(idx) for idx in f.readline().strip().split()[:NBody]] for i in range(6)]
else:
raise Exception("Invalid value for fst_vt['HydroDyn']['NBodyMod']")

Expand Down
7 changes: 5 additions & 2 deletions ROSCO_toolbox/ofTools/fast_io/FAST_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -875,7 +875,7 @@ def write_AeroDyn15(self):
self.write_AeroDyn15Polar()

# Generate AeroDyn v15 airfoil coordinates
if int(self.fst_vt['AeroDyn15']['af_data'][1][0]['NumCoords']) != 0:
if self.fst_vt['AeroDyn15']['af_data'][1][0]['NumCoords'] != '0':
self.write_AeroDyn15Coord()

if self.fst_vt['AeroDyn15']['WakeMod'] == 3:
Expand Down Expand Up @@ -1465,7 +1465,10 @@ def write_HydroDyn(self):
f.write('{:<22} {:<11} {:}'.format(self.fst_vt['HydroDyn']['SumQTF'], 'SumQTF', "- Full summation -frequency 2nd-order forces computed with full QTF {0: None; [10, 11, or 12]: WAMIT file to use}\n"))
f.write('---------------------- PLATFORM ADDITIONAL STIFFNESS AND DAMPING --------------\n')
for j in range(6):
ln = '{:14} '.format(self.fst_vt['HydroDyn']['AddF0'][j][0])
if type(self.fst_vt['HydroDyn']['AddF0'][j]) == float:
ln = '{:14} '.format(self.fst_vt['HydroDyn']['AddF0'][j])
elif type(self.fst_vt['HydroDyn']['AddF0'][j]) == list:
ln = '{:14} '.format(' '.join([f'{val}' for val in self.fst_vt['HydroDyn']['AddF0'][j]]))
if j == 0:
ln = ln + 'AddF0 - Additional preload (N, N-m) [If NBodyMod=1, one size 6*NBody x 1 vector; if NBodyMod>1, NBody size 6 x 1 vectors]\n'
else:
Expand Down

0 comments on commit 97e2fe7

Please sign in to comment.