@@ -320,7 +320,8 @@ def read_outlist(self, f, module):
320320 def read_MainInput (self ):
321321 # Main FAST v8.16-v8.17 Input File
322322 # Currently no differences between FASTv8.16 and OpenFAST.
323- fst_file = os .path .join (self .FAST_directory , self .FAST_InputFile )
323+ fastdir = '' if self .FAST_directory is None else self .FAST_directory
324+ fst_file = os .path .join (fastdir , self .FAST_InputFile )
324325 f = open (fst_file )
325326
326327 # Header of .fst file
@@ -572,7 +573,8 @@ def read_ElastoDyn(self, ed_file):
572573 # Furling (furling)
573574 f .readline ()
574575 self .fst_vt ['ElastoDyn' ]['Furling' ] = bool_read (f .readline ().split ()[0 ])
575- self .fst_vt ['ElastoDyn' ]['FurlFile' ] = os .path .join (self .FAST_directory , quoted_read (f .readline ().split ()[0 ])) # TODO: add furl file data to fst_vt, pointing to absolute path for now
576+ fastdir = '' if self .FAST_directory is None else self .FAST_directory
577+ self .fst_vt ['ElastoDyn' ]['FurlFile' ] = os .path .join (fastdir , quoted_read (f .readline ().split ()[0 ])) # TODO: add furl file data to fst_vt, pointing to absolute path for now
576578
577579 # Tower (tower)
578580 f .readline ()
@@ -921,7 +923,8 @@ def read_BeamDynBlade(self, beamdyn_blade_file, BladeNumber = 0):
921923 def read_InflowWind (self ):
922924 # InflowWind v3.01
923925 # Currently no differences between FASTv8.16 and OpenFAST.
924- inflow_file = os .path .normpath (os .path .join (self .FAST_directory , self .fst_vt ['Fst' ]['InflowFile' ]))
926+ fastdir = '' if self .FAST_directory is None else self .FAST_directory
927+ inflow_file = os .path .normpath (os .path .join (fastdir , self .fst_vt ['Fst' ]['InflowFile' ]))
925928 f = open (inflow_file )
926929
927930 f .readline ()
@@ -1018,7 +1021,8 @@ def read_InflowWind(self):
10181021 def read_AeroDyn (self ):
10191022 # AeroDyn v15.03
10201023
1021- ad_file = os .path .join (self .FAST_directory , self .fst_vt ['Fst' ]['AeroFile' ])
1024+ fastdir = '' if self .FAST_directory is None else self .FAST_directory
1025+ ad_file = os .path .join (fastdir , self .fst_vt ['Fst' ]['AeroFile' ])
10221026 f = open (ad_file )
10231027
10241028 # General Option
@@ -1112,9 +1116,10 @@ def read_AeroDyn(self):
11121116 self .fst_vt ['AeroDyn' ]['InCol_Cpmin' ] = int (f .readline ().split ()[0 ])
11131117 self .fst_vt ['AeroDyn' ]['NumAFfiles' ] = int (f .readline ().split ()[0 ])
11141118 self .fst_vt ['AeroDyn' ]['AFNames' ] = [None ] * self .fst_vt ['AeroDyn' ]['NumAFfiles' ]
1119+ fastdir = '' if self .FAST_directory is None else self .FAST_directory
11151120 for i in range (self .fst_vt ['AeroDyn' ]['NumAFfiles' ]):
11161121 af_filename = fix_path (f .readline ().split ()[0 ])[1 :- 1 ]
1117- self .fst_vt ['AeroDyn' ]['AFNames' ][i ] = os .path .abspath (os .path .join (self . FAST_directory , self .fst_vt ['Fst' ]['AeroFile_path' ], af_filename ))
1122+ self .fst_vt ['AeroDyn' ]['AFNames' ][i ] = os .path .abspath (os .path .join (fastdir , self .fst_vt ['Fst' ]['AeroFile_path' ], af_filename ))
11181123
11191124 # Rotor/Blade Properties
11201125 f .readline ()
@@ -1138,7 +1143,7 @@ def read_AeroDyn(self):
11381143 f .readline ()
11391144 self .fst_vt ['AeroDyn' ]['TFinAero' ] = bool_read (f .readline ().split ()[0 ])
11401145 tfa_filename = fix_path (f .readline ().split ()[0 ])[1 :- 1 ]
1141- self .fst_vt ['AeroDyn' ]['TFinFile' ] = os .path .abspath (os .path .join (self . FAST_directory , tfa_filename ))
1146+ self .fst_vt ['AeroDyn' ]['TFinFile' ] = os .path .abspath (os .path .join (fastdir , tfa_filename ))
11421147
11431148 # Tower Influence and Aerodynamics
11441149 f .readline ()
@@ -1187,9 +1192,9 @@ def read_AeroDyn(self):
11871192 f .close ()
11881193
11891194 # Improved handling for multiple AeroDyn blade files
1190- ad_bld_file1 = os .path .join (self . FAST_directory , self .fst_vt ['Fst' ]['AeroFile_path' ], self .fst_vt ['AeroDyn' ]['ADBlFile1' ])
1191- ad_bld_file2 = os .path .join (self . FAST_directory , self .fst_vt ['Fst' ]['AeroFile_path' ], self .fst_vt ['AeroDyn' ]['ADBlFile2' ])
1192- ad_bld_file3 = os .path .join (self . FAST_directory , self .fst_vt ['Fst' ]['AeroFile_path' ], self .fst_vt ['AeroDyn' ]['ADBlFile3' ])
1195+ ad_bld_file1 = os .path .join (fastdir , self .fst_vt ['Fst' ]['AeroFile_path' ], self .fst_vt ['AeroDyn' ]['ADBlFile1' ])
1196+ ad_bld_file2 = os .path .join (fastdir , self .fst_vt ['Fst' ]['AeroFile_path' ], self .fst_vt ['AeroDyn' ]['ADBlFile2' ])
1197+ ad_bld_file3 = os .path .join (fastdir , self .fst_vt ['Fst' ]['AeroFile_path' ], self .fst_vt ['AeroDyn' ]['ADBlFile3' ])
11931198
11941199 if ad_bld_file1 == ad_bld_file2 and ad_bld_file1 == ad_bld_file3 :
11951200 # all blades are identical
@@ -1213,7 +1218,7 @@ def read_AeroDyn(self):
12131218
12141219 self .read_AeroDynPolar ()
12151220 self .read_AeroDynCoord ()
1216- olaf_filename = os .path .join (self . FAST_directory , self .fst_vt ['AeroDyn' ]['OLAFInputFileName' ])
1221+ olaf_filename = os .path .join (fastdir , self .fst_vt ['AeroDyn' ]['OLAFInputFileName' ])
12171222 if os .path .isfile (olaf_filename ):
12181223 self .read_AeroDynOLAF (olaf_filename )
12191224
@@ -1381,6 +1386,7 @@ def read_AeroDynCoord(self):
13811386
13821387 def read_AeroDynOLAF (self , olaf_filename ):
13831388
1389+ fastdir = '' if self .FAST_directory is None else self .FAST_directory
13841390 self .fst_vt ['AeroDyn' ]['OLAF' ] = {}
13851391 f = open (olaf_filename )
13861392 f .readline ()
@@ -1395,7 +1401,7 @@ def read_AeroDynOLAF(self, olaf_filename):
13951401 self .fst_vt ['AeroDyn' ]['OLAF' ]['CircSolvConvCrit' ] = float_read (f .readline ().split ()[0 ])
13961402 self .fst_vt ['AeroDyn' ]['OLAF' ]['CircSolvRelaxation' ] = float_read (f .readline ().split ()[0 ])
13971403 self .fst_vt ['AeroDyn' ]['OLAF' ]['CircSolvMaxIter' ] = int_read (f .readline ().split ()[0 ])
1398- self .fst_vt ['AeroDyn' ]['OLAF' ]['PrescribedCircFile' ] = os .path .join (self . FAST_directory , quoted_read (f .readline ().split ()[0 ])) # unmodified by this script, hence pointing to absolute location
1404+ self .fst_vt ['AeroDyn' ]['OLAF' ]['PrescribedCircFile' ] = os .path .join (fastdir , quoted_read (f .readline ().split ()[0 ])) # unmodified by this script, hence pointing to absolute location
13991405 f .readline ()
14001406 f .readline ()
14011407 f .readline ()
@@ -1434,7 +1440,8 @@ def read_AeroDisk(self):
14341440 Reading the AeroDisk input file.
14351441 '''
14361442
1437- aDisk_file = os .path .join (self .FAST_directory , self .fst_vt ['Fst' ]['AeroFile' ])
1443+ fastdir = '' if self .FAST_directory is None else self .FAST_directory
1444+ aDisk_file = os .path .join (fastdir , self .fst_vt ['Fst' ]['AeroFile' ])
14381445 f = open (aDisk_file )
14391446 f .readline ()
14401447 f .readline ()
@@ -1463,7 +1470,7 @@ def read_AeroDisk(self):
14631470 # if the next line starts with an @, then it is a file reference
14641471 line = f .readline ()
14651472 if line [0 ] == '@' :
1466- self .fst_vt ['AeroDisk' ]['actuatorDiskFile' ] = os .path .join (self . FAST_directory , line [1 :].strip ())
1473+ self .fst_vt ['AeroDisk' ]['actuatorDiskFile' ] = os .path .join (fastdir , line [1 :].strip ())
14671474
14681475 # using the load_ascii_output function to read the CSV file, ;)
14691476 data , info = load_ascii_output (self .fst_vt ['AeroDisk' ]['actuatorDiskFile' ], headerLines = 3 ,
@@ -1489,7 +1496,8 @@ def read_ServoDyn(self):
14891496 # Currently no differences between FASTv8.16 and OpenFAST.
14901497
14911498
1492- sd_file = os .path .normpath (os .path .join (self .FAST_directory , self .fst_vt ['Fst' ]['ServoFile' ]))
1499+ fastdir = '' if self .FAST_directory is None else self .FAST_directory
1500+ sd_file = os .path .normpath (os .path .join (fastdir , self .fst_vt ['Fst' ]['ServoFile' ]))
14931501 f = open (sd_file )
14941502
14951503 f .readline ()
@@ -1659,9 +1667,10 @@ def read_StC(self,filename):
16591667 StC_vt = {}
16601668
16611669 # Inputs should be relative to ServoDyn, like in OpenFAST
1670+ fastdir = '' if self .FAST_directory is None else self .FAST_directory
16621671 SvD_dir = os .path .dirname (self .fst_vt ['Fst' ]['ServoFile' ])
16631672
1664- with open (os .path .join (self . FAST_directory , SvD_dir , filename )) as f :
1673+ with open (os .path .join (fastdir , SvD_dir , filename )) as f :
16651674
16661675 f .readline ()
16671676 f .readline ()
@@ -1766,15 +1775,16 @@ def read_StC(self,filename):
17661775 f .readline () # PRESCRIBED TIME SERIES
17671776 StC_vt ['PrescribedForcesCoord' ] = int_read (f .readline ().split ()[0 ]) # 2 PrescribedForcesCoord- Prescribed forces are in global or local coordinates (switch) {1: global; 2: local}
17681777 # TODO: read in prescribed force time series, for now we just point to absolute path of input file
1769- StC_vt ['PrescribedForcesFile' ] = os .path .join (self . FAST_directory , quoted_read (f .readline ().split ()[0 ])) # "Bld-TimeForceSeries.dat" PrescribedForcesFile - Time series force and moment (7 columns of time, FX, FY, FZ, MX, MY, MZ)
1778+ StC_vt ['PrescribedForcesFile' ] = os .path .join (fastdir , quoted_read (f .readline ().split ()[0 ])) # "Bld-TimeForceSeries.dat" PrescribedForcesFile - Time series force and moment (7 columns of time, FX, FY, FZ, MX, MY, MZ)
17701779 f .readline ()
17711780
17721781 return StC_vt
17731782
17741783 def read_DISCON_in (self ):
17751784 # Read the Bladed style Interface controller input file, intended for ROSCO https://github.com/NREL/ROSCO_toolbox
17761785
1777- discon_in_file = os .path .normpath (os .path .join (self .FAST_directory , self .fst_vt ['ServoDyn' ]['DLL_InFile' ]))
1786+ fastdir = '' if self .FAST_directory is None else self .FAST_directory
1787+ discon_in_file = os .path .normpath (os .path .join (fastdir , self .fst_vt ['ServoDyn' ]['DLL_InFile' ]))
17781788
17791789 if os .path .exists (discon_in_file ):
17801790
@@ -1817,7 +1827,8 @@ def read_spd_trq(self, file):
18171827 '''
18181828 spd_trq = {}
18191829
1820- f = open (os .path .normpath (os .path .join (self .FAST_directory , file )))
1830+ fastdir = '' if self .FAST_directory is None else self .FAST_directory
1831+ f = open (os .path .normpath (os .path .join (fastdir , file )))
18211832
18221833 spd_trq ['header' ] = f .readline ()
18231834
@@ -3417,8 +3428,9 @@ def read_NonLinearEA(self,Stiffness_file): # read and return the nonlinear line
34173428
34183429 def execute (self ):
34193430
3431+ fastdir = '' if self .FAST_directory is None else self .FAST_directory
34203432 self .read_MainInput ()
3421- ed_file = os .path .join (self . FAST_directory , self .fst_vt ['Fst' ]['EDFile' ])
3433+ ed_file = os .path .join (fastdir , self .fst_vt ['Fst' ]['EDFile' ])
34223434
34233435 if self .fst_vt ['Fst' ]['CompElast' ] == 3 : # SimpleElastoDyn
34243436 self .read_SimpleElastoDyn (ed_file )
@@ -3491,30 +3503,30 @@ def execute(self):
34913503 self .read_DISCON_in ()
34923504 if self .fst_vt ['ServoDyn' ]['VSContrl' ] == 3 : # user-defined from routine UserVSCont refered
34933505 self .read_spd_trq ('spd_trq.dat' )
3494- hd_file = os .path .normpath (os .path .join (self . FAST_directory , self .fst_vt ['Fst' ]['HydroFile' ]))
3506+ hd_file = os .path .normpath (os .path .join (fastdir , self .fst_vt ['Fst' ]['HydroFile' ]))
34953507 if self .fst_vt ['Fst' ]['CompHydro' ] == 1 :
34963508 self .read_HydroDyn (hd_file )
3497- ss_file = os .path .normpath (os .path .join (self . FAST_directory , self .fst_vt ['Fst' ]['SeaStFile' ]))
3509+ ss_file = os .path .normpath (os .path .join (fastdir , self .fst_vt ['Fst' ]['SeaStFile' ]))
34983510 if self .fst_vt ['Fst' ]['CompSeaSt' ] == 1 :
34993511 self .read_SeaState (ss_file )
3500- sd_file = os .path .normpath (os .path .join (self . FAST_directory , self .fst_vt ['Fst' ]['SubFile' ]))
3512+ sd_file = os .path .normpath (os .path .join (fastdir , self .fst_vt ['Fst' ]['SubFile' ]))
35013513 # if os.path.isfile(sd_file):
35023514 if self .fst_vt ['Fst' ]['CompSub' ] == 1 :
35033515 self .read_SubDyn (sd_file )
35043516 elif self .fst_vt ['Fst' ]['CompSub' ] == 2 :
35053517 self .read_ExtPtfm (sd_file )
35063518 if self .fst_vt ['Fst' ]['CompMooring' ] == 1 : # only MAP++ implemented for mooring models
3507- map_file = os .path .normpath (os .path .join (self . FAST_directory , self .fst_vt ['Fst' ]['MooringFile' ]))
3519+ map_file = os .path .normpath (os .path .join (fastdir , self .fst_vt ['Fst' ]['MooringFile' ]))
35083520 if os .path .isfile (map_file ):
35093521 self .read_MAP (map_file )
35103522 if self .fst_vt ['Fst' ]['CompMooring' ] == 3 : # MoorDyn implimented
3511- moordyn_file = os .path .normpath (os .path .join (self . FAST_directory , self .fst_vt ['Fst' ]['MooringFile' ]))
3523+ moordyn_file = os .path .normpath (os .path .join (fastdir , self .fst_vt ['Fst' ]['MooringFile' ]))
35123524 if os .path .isfile (moordyn_file ):
35133525 self .read_MoorDyn (moordyn_file )
35143526
3515- bd_file1 = os .path .normpath (os .path .join (self . FAST_directory , self .fst_vt ['Fst' ]['BDBldFile(1)' ]))
3516- bd_file2 = os .path .normpath (os .path .join (self . FAST_directory , self .fst_vt ['Fst' ]['BDBldFile(2)' ]))
3517- bd_file3 = os .path .normpath (os .path .join (self . FAST_directory , self .fst_vt ['Fst' ]['BDBldFile(3)' ]))
3527+ bd_file1 = os .path .normpath (os .path .join (fastdir , self .fst_vt ['Fst' ]['BDBldFile(1)' ]))
3528+ bd_file2 = os .path .normpath (os .path .join (fastdir , self .fst_vt ['Fst' ]['BDBldFile(2)' ]))
3529+ bd_file3 = os .path .normpath (os .path .join (fastdir , self .fst_vt ['Fst' ]['BDBldFile(3)' ]))
35183530 if os .path .isfile (bd_file1 ):
35193531 # if the files are the same then we only need to read it once, need to handle the cases where we have a 2 or 1 bladed rotor
35203532 # Check unique BeamDyn blade files and read only once if identical
@@ -3557,4 +3569,4 @@ def execute(self):
35573569
35583570 check_rtest_cloned (os .path .join (fast .FAST_directory ))
35593571
3560- fast .execute ()
3572+ fast .execute ()
0 commit comments