Skip to content

Commit

Permalink
adding large angle yaw & bug fix for AD15 nac yaw, thanks to @danz
Browse files Browse the repository at this point in the history
  • Loading branch information
mayankchetan committed Aug 30, 2024
1 parent c3d9859 commit 8789357
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 18 deletions.
16 changes: 10 additions & 6 deletions openfast_io/openfast_io/FAST_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -1111,9 +1111,9 @@ def read_AeroDyn15(self):
# data = [float(val) for val in f.readline().split(',')]
self.fst_vt['AeroDyn15']['NacCenB'] = [idx.strip() for idx in f.readline().split('NacCenB')[0].split(',')]

self.fst_vt['AeroDyn15']['NacArea'] = [idx.strip() for idx in f.readline().split('NacCenB')[0].split(',')]
self.fst_vt['AeroDyn15']['NacCd'] = [idx.strip() for idx in f.readline().split('NacCenB')[0].split(',')]
self.fst_vt['AeroDyn15']['NacDragAC'] = [idx.strip() for idx in f.readline().split('NacCenB')[0].split(',')]
self.fst_vt['AeroDyn15']['NacArea'] = [idx.strip() for idx in f.readline().split('NacArea')[0].split(',')]
self.fst_vt['AeroDyn15']['NacCd'] = [idx.strip() for idx in f.readline().split('NacCd')[0].split(',')]
self.fst_vt['AeroDyn15']['NacDragAC'] = [idx.strip() for idx in f.readline().split('NacDragAC')[0].split(',')]
f.readline()
self.fst_vt['AeroDyn15']['TFinAero'] = bool_read(f.readline().split()[0])
tfa_filename = fix_path(f.readline().split()[0])[1:-1]
Expand Down Expand Up @@ -1987,6 +1987,10 @@ def read_HydroDyn(self, hd_file):
self.fst_vt['HydroDyn']['ExctnMod'] = int_read(f.readline().split()[0])
self.fst_vt['HydroDyn']['ExctnDisp'] = int_read(f.readline().split()[0])
self.fst_vt['HydroDyn']['ExctnCutOff'] = int_read(f.readline().split()[0])
self.fst_vt['HydroDyn']['PtfmYMod'] = int_read(f.readline().split()[0])
self.fst_vt['HydroDyn']['PtfmRefY'] = float_read(f.readline().split()[0])
self.fst_vt['HydroDyn']['PtfmYCutOff'] = float_read(f.readline().split()[0])
self.fst_vt['HydroDyn']['NExctnHdg'] = int_read(f.readline().split()[0])
self.fst_vt['HydroDyn']['RdtnMod'] = int_read(f.readline().split()[0])
self.fst_vt['HydroDyn']['RdtnTMax'] = float_read(f.readline().split()[0])
self.fst_vt['HydroDyn']['RdtnDT'] = float_read(f.readline().split()[0])
Expand Down Expand Up @@ -2446,7 +2450,7 @@ def read_SubDyn(self, sd_file):
self.fst_vt['SubDyn']['SDdeltaT'] = float_read(f.readline().split()[0])
self.fst_vt['SubDyn']['IntMethod'] = int_read(f.readline().split()[0])
self.fst_vt['SubDyn']['SttcSolve'] = bool_read(f.readline().split()[0])
self.fst_vt['SubDyn']['GuyanLoadCorrection'] = bool_read(f.readline().split()[0])
# self.fst_vt['SubDyn']['GuyanLoadCorrection'] = bool_read(f.readline().split()[0])
f.readline()
# FEA and CRAIG-BAMPTON PARAMETERS
self.fst_vt['SubDyn']['FEMMod'] = int_read(f.readline().split()[0])
Expand Down Expand Up @@ -3165,8 +3169,8 @@ def read_MoorDyn(self, moordyn_file):
while data_line[0] and data_line[0][:3] != '---': # OpenFAST searches for ---, so we'll do the same
self.fst_vt['MoorDyn']['Line_ID'].append(int(data_line[0]))
self.fst_vt['MoorDyn']['LineType'].append(str(data_line[1]))
self.fst_vt['MoorDyn']['AttachA'].append(int(data_line[2]))
self.fst_vt['MoorDyn']['AttachB'].append(int(data_line[3]))
self.fst_vt['MoorDyn']['AttachA'].append(str(data_line[2]))
self.fst_vt['MoorDyn']['AttachB'].append(str(data_line[3]))
self.fst_vt['MoorDyn']['UnstrLen'].append(float(data_line[4]))
self.fst_vt['MoorDyn']['NumSegs'].append(int(data_line[5]))
self.fst_vt['MoorDyn']['Outputs'].append(str(data_line[6]))
Expand Down
19 changes: 10 additions & 9 deletions openfast_io/openfast_io/FAST_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -692,9 +692,6 @@ def write_BeamDyn(self):
f.write(int_default_out(self.fst_vt['BeamDyn']['load_retries']) + ' {:<11} {:}'.format('load_retries', '- Number of factored load retries before quitting the aimulation [DEFAULT = 20]\n'))
f.write(int_default_out(self.fst_vt['BeamDyn']['NRMax']) + ' {:<11} {:}'.format('NRMax', '- Max number of iterations in Newton-Ralphson algorithm (-). DEFAULT = 10\n'))
f.write(float_default_out(self.fst_vt['BeamDyn']['stop_tol']) + ' {:<11} {:}'.format('stop_tol', '- Tolerance for stopping criterion (-) [DEFAULT = 1E-5]\n'))
print('----------')
print(self.fst_vt['BeamDyn']['tngt_stf_fd'], type(self.fst_vt['BeamDyn']['tngt_stf_fd']))

f.write('{!s:<22} {:<11} {:}'.format(self.fst_vt['BeamDyn']['tngt_stf_fd'], 'tngt_stf_fd', '- Use finite differenced tangent stiffness matrix? (flag)\n'))
f.write('{!s:<22} {:<11} {:}'.format(self.fst_vt['BeamDyn']['tngt_stf_comp'], 'tngt_stf_comp', '- Compare analytical finite differenced tangent stiffness matrix? (flag)\n'))
f.write(float_default_out(self.fst_vt['BeamDyn']['tngt_stf_pert']) + ' {:<11} {:}'.format('tngt_stf_pert', '- Perturbation size for finite differencing (-) [DEFAULT = 1E-6]\n'))
Expand Down Expand Up @@ -978,9 +975,9 @@ def write_AeroDyn15(self):
f.write('====== Nacelle Properties ========================================================================== used only when Buoyancy=True or NacelleDrag=True]\n')
f.write('{:<22} {:<11} {:}'.format(self.fst_vt['AeroDyn15']['VolNac'], 'VolNac', '- Nacelle volume (m^3)\n'))
f.write('{:<22} {:<11} {:}'.format(', '.join(np.array(self.fst_vt['AeroDyn15']['NacCenB'], dtype=str)), 'NacCenB', '- Position of nacelle center of buoyancy from yaw bearing in nacelle coordinates (m)\n'))
f.write('{:<22} {:<11} {:}'.format(', '.join(np.array(self.fst_vt['AeroDyn15']['NacCenB'], dtype=str)), 'NacArea', '- Projected area of the nacelle in X, Y, Z in the nacelle coordinate system (m^2)\n'))
f.write('{:<22} {:<11} {:}'.format(', '.join(np.array(self.fst_vt['AeroDyn15']['NacCenB'], dtype=str)), 'NacCd', '- Drag coefficient for the nacelle areas defined above (-)\n'))
f.write('{:<22} {:<11} {:}'.format(', '.join(np.array(self.fst_vt['AeroDyn15']['NacCenB'], dtype=str)), 'NacDragAC', '- Position of aerodynamic center of nacelle drag in nacelle coordinates (m)\n'))
f.write('{:<22} {:<11} {:}'.format(', '.join(np.array(self.fst_vt['AeroDyn15']['NacArea'], dtype=str)), 'NacArea', '- Projected area of the nacelle in X, Y, Z in the nacelle coordinate system (m^2)\n'))
f.write('{:<22} {:<11} {:}'.format(', '.join(np.array(self.fst_vt['AeroDyn15']['NacCd'], dtype=str)), 'NacCd', '- Drag coefficient for the nacelle areas defined above (-)\n'))
f.write('{:<22} {:<11} {:}'.format(', '.join(np.array(self.fst_vt['AeroDyn15']['NacDragAC'], dtype=str)), 'NacDragAC', '- Position of aerodynamic center of nacelle drag in nacelle coordinates (m)\n'))
f.write('====== Tail Fin Aerodynamics ========================================================================\n')
f.write('{!s:<22} {:<11} {:}'.format(self.fst_vt['AeroDyn15']['TFinAero'], 'TFinAero', '- Calculate tail fin aerodynamics model (flag)\n'))
f.write('{:<22} {:<11} {:}'.format('"'+self.fst_vt['AeroDyn15']['TFinFile']+'"', 'TFinFile', '- Input file for tail fin aerodynamics [used only when TFinAero=True]\n'))
Expand Down Expand Up @@ -1693,6 +1690,10 @@ def write_HydroDyn(self):
f.write('{:<22d} {:<11} {:}'.format(self.fst_vt['HydroDyn']['ExctnMod'], 'ExctnMod', '- Wave Excitation model {0: None, 1: DFT, 2: state-space} (switch) [only used when PotMod=1; STATE-SPACE REQUIRES *.ssexctn INPUT FILE]\n'))
f.write('{:<22d} {:<11} {:}'.format(self.fst_vt['HydroDyn']['ExctnDisp'], 'ExctnDisp','- Method of computing Wave Excitation {0: use undisplaced position, 1: use displaced position, 2: use low-pass filtered displaced position) [only used when PotMod=1 and ExctnMod>0 and SeaState\'s WaveMod>0]} (switch)\n'))
f.write('{:<22d} {:<11} {:}'.format(self.fst_vt['HydroDyn']['ExctnCutOff'], 'ExctnCutOff','- Method of computing Wave Excitation {0: use undisplaced position, 1: use displaced position, 2: use low-pass filtered displaced position) [only used when PotMod=1 and ExctnMod>0 and SeaState\'s WaveMod>0]} (switch)\n'))
f.write('{:<22d} {:<11} {:}'.format(self.fst_vt['HydroDyn']['PtfmYMod'], 'PtfmYMod', '- - Model for large platform yaw offset {0: Static reference yaw offset based on PtfmRefY, 1: dynamic reference yaw offset based on low-pass filtering the PRP yaw motion with cutoff frequency PtfmYCutOff} (switch)\n'))
f.write('{:<22} {:<11} {:}'.format(self.fst_vt['HydroDyn']['PtfmRefY'], 'PtfmRefY', '- Constant (if PtfmYMod=0) or initial (if PtfmYMod=1) platform reference yaw offset (deg)\n'))
f.write('{:<22} {:<11} {:}'.format(self.fst_vt['HydroDyn']['PtfmYCutOff'], 'PtfmYCutOff', '- Cutoff frequency for the low-pass filtering of PRP yaw motion when PtfmYMod=1 [unused when PtfmYMod=0] (Hz)\n'))
f.write('{:<22d} {:<11} {:}'.format(self.fst_vt['HydroDyn']['NExctnHdg'], 'NExctnHdg', '- Number of evenly distributed platform yaw/heading angles over the range of [-180, 180) deg for which the wave excitation shall be computed [only used when PtfmYMod=1] (-)\n'))
f.write('{:<22d} {:<11} {:}'.format(self.fst_vt['HydroDyn']['RdtnMod'], 'RdtnMod', '- Radiation memory-effect model {0: no memory-effect calculation, 1: convolution, 2: state-space} (switch) [only used when PotMod=1; STATE-SPACE REQUIRES *.ss INPUT FILE]\n'))
f.write('{:<22} {:<11} {:}'.format(self.fst_vt['HydroDyn']['RdtnTMax'], 'RdtnTMax', '- Analysis time for wave radiation kernel calculations (sec) [only used when PotMod=1; determines RdtnDOmega=Pi/RdtnTMax in the cosine transform; MAKE SURE THIS IS LONG ENOUGH FOR THE RADIATION IMPULSE RESPONSE FUNCTIONS TO DECAY TO NEAR-ZERO FOR THE GIVEN PLATFORM!]\n'))
f.write('{:<22} {:<11} {:}'.format(self.fst_vt['HydroDyn']['RdtnDT'], 'RdtnDT', '- Time step for wave radiation kernel calculations (sec) [only used when PotMod=1; DT<=RdtnDT<=0.1 recommended; determines RdtnOmegaMax=Pi/RdtnDT in the cosine transform]\n'))
Expand Down Expand Up @@ -2065,7 +2066,7 @@ def write_SubDyn(self):
f.write('{:<22} {:<11} {:}'.format(self.fst_vt['SubDyn']['SDdeltaT'], 'SDdeltaT', '- Local Integration Step. If "default", the glue-code integration step will be used.\n'))
f.write('{:<22d} {:<11} {:}'.format(self.fst_vt['SubDyn']['IntMethod'], 'IntMethod', '- Integration Method [1/2/3/4 = RK4/AB4/ABM4/AM2].\n'))
f.write('{!s:<22} {:<11} {:}'.format(self.fst_vt['SubDyn']['SttcSolve'], 'SttcSolve', '- Solve dynamics about static equilibrium point\n'))
f.write('{!s:<22} {:<11} {:}'.format(self.fst_vt['SubDyn']['GuyanLoadCorrection'], 'GuyanLoadCorrection', '- Include extra moment from lever arm at interface and rotate FEM for floating.\n'))
# f.write('{!s:<22} {:<11} {:}'.format(self.fst_vt['SubDyn']['GuyanLoadCorrection'], 'GuyanLoadCorrection', '- Include extra moment from lever arm at interface and rotate FEM for floating.\n'))
f.write('-------------------- FEA and CRAIG-BAMPTON PARAMETERS---------------------------\n')
f.write('{:<22d} {:<11} {:}'.format(self.fst_vt['SubDyn']['FEMMod'], 'FEMMod', '- FEM switch: element model in the FEM. [1= Euler-Bernoulli(E-B); 2=Tapered E-B (unavailable); 3= 2-node Timoshenko; 4= 2-node tapered Timoshenko (unavailable)]\n'))
f.write('{:<22d} {:<11} {:}'.format(self.fst_vt['SubDyn']['NDiv'], 'NDiv', '- Number of sub-elements per member\n'))
Expand Down Expand Up @@ -2554,8 +2555,8 @@ def write_MoorDyn(self):
ln = []
ln.append('{:^11d}'.format(self.fst_vt['MoorDyn']['Line_ID'][i]))
ln.append('{:^11}'.format(self.fst_vt['MoorDyn']['LineType'][i]))
ln.append('{:^11d}'.format(self.fst_vt['MoorDyn']['AttachA'][i]))
ln.append('{:^11d}'.format(self.fst_vt['MoorDyn']['AttachB'][i]))
ln.append('{:^11}'.format(self.fst_vt['MoorDyn']['AttachA'][i]))
ln.append('{:^11}'.format(self.fst_vt['MoorDyn']['AttachB'][i]))
ln.append('{:^11.4f}'.format(self.fst_vt['MoorDyn']['UnstrLen'][i]))
ln.append('{:^11d}'.format(self.fst_vt['MoorDyn']['NumSegs'][i]))
ln.append('{:^11}'.format(self.fst_vt['MoorDyn']['Outputs'][i]))
Expand Down
6 changes: 3 additions & 3 deletions openfast_io/openfast_io/tests/test_of_io_pytest.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@
"SWRT_YFree_VS_EDC01" , # "openfast;elastodyn;aerodyn;servodyn")
"SWRT_YFree_VS_WTurb" , # "openfast;elastodyn;aerodyn;servodyn")
"5MW_Land_DLL_WTurb" , # "openfast;elastodyn;aerodyn;servodyn")
"5MW_Land_DLL_WTurb_ADsk" ,
"5MW_Land_DLL_WTurb_ADsk_SED" ,
"5MW_Land_DLL_WTurb_SED" ,
# "5MW_Land_DLL_WTurb_ADsk" ,
# "5MW_Land_DLL_WTurb_ADsk_SED" ,
# "5MW_Land_DLL_WTurb_SED" ,
"5MW_Land_DLL_WTurb_wNacDrag" , # "openfast;elastodyn;aerodyn;servodyn")
"5MW_OC3Mnpl_DLL_WTurb_WavesIrr" , # "openfast;elastodyn;aerodyn;servodyn;hydrodyn;subdyn;offshore")
"5MW_OC3Mnpl_DLL_WTurb_WavesIrr_Restart" , # "openfast;elastodyn;aerodyn;servodyn;hydrodyn;subdyn;offshore;restart")
Expand Down

0 comments on commit 8789357

Please sign in to comment.