diff --git a/wetb/hawc2/htc_file.py b/wetb/hawc2/htc_file.py index 08193c5e42e524f6e54662a532711152da9c0c71..d539794e32d0f8107757e1e8b4e30b5f40d6f4c8 100644 --- a/wetb/hawc2/htc_file.py +++ b/wetb/hawc2/htc_file.py @@ -131,6 +131,7 @@ class HTCFile(HTCContents, HTCDefaults): if 'hydro' in self: if 'water_properties' in self.hydro: files.append(self.hydro.water_properties.get('water_kinematics_dll', [None])[0]) + files.append(self.hydro.water_properties.get('water_kinematics_dll', [None, None])[1]) if 'soil' in self: if 'soil_element' in self.soil: files.append(self.soil.soil_element.get('datafile', [None])[0]) @@ -168,7 +169,12 @@ class HTCFile(HTCContents, HTCDefaults): return [f for f in files if f] def turbulence_files(self): - files = [self.get('wind.%s.filename_%s' % (type, comp), [None])[0] for type in ['mann', 'flex'] for comp in ['u', 'v', 'w']] + if self.wind.turb_format[0] == 0: + return [] + elif self.wind.turb_format[0] == 1: + files = [self.get('wind.mann.filename_%s' % comp, [None])[0] for comp in ['u', 'v', 'w']] + elif self.wind.turb_format[0] == 2: + files = [self.get('wind.flex.filename_%s' % comp, [None])[0] for comp in ['u', 'v', 'w']] return [f for f in files if f] @@ -195,7 +201,6 @@ class HTCFile(HTCContents, HTCDefaults): raise Exception (str(stdout) + str(stderr)) if "__main__" == __name__: - f = HTCFile(r"C:\mmpe\HAWC2\Hawc2_model\htc\NREL_5MW_reference_wind_turbine_launcher_test.htc") - print ("\n".join(f.output_files())) + f = HTCFile(r"C:\mmpe\HAWC2\models\PhaseIJacketv30\htc", "../../") diff --git a/wetb/hawc2/tests/test_files/htcfiles/dlc14_wsp10_wdir000_s0000.htc b/wetb/hawc2/tests/test_files/htcfiles/dlc14_wsp10_wdir000_s0000.htc index 4a994f38434a8a15f6915ce1a9a92420f9a2e265..6928a04fa4c672557ae03fb0309418b398cb8e2a 100644 --- a/wetb/hawc2/tests/test_files/htcfiles/dlc14_wsp10_wdir000_s0000.htc +++ b/wetb/hawc2/tests/test_files/htcfiles/dlc14_wsp10_wdir000_s0000.htc @@ -286,7 +286,7 @@ begin wind ; windfield_rotations 0.0 0.0 0.0 ; yaw, tilt, rotation center_pos0 0.0 0.0 -90 ; hub heigth shear_format 3 0.2 ; - turb_format 0.0 ; 0=none, 1=mann,2=flex + turb_format 1 ; 0=none, 1=mann,2=flex tower_shadow_method 3 ; 0=none, 1=potential flow, 2=jet scale_time_start 100.0 ; wind_ramp_factor 0.0 100.0 0.8 1.0 ; diff --git a/wetb/hawc2/tests/test_htc_file.py b/wetb/hawc2/tests/test_htc_file.py index 51da8f5cc7b3aa8e9f5b164f0383b58b3a5ef8d4..ba878df683153fe88a28c756065865d75faae290 100644 --- a/wetb/hawc2/tests/test_htc_file.py +++ b/wetb/hawc2/tests/test_htc_file.py @@ -200,6 +200,12 @@ class TestHtcFile(unittest.TestCase): raise ValueError(f + " is not in list") self.assertFalse(input_files) + def test_input_files2(self): + htcfile = HTCFile(self.testfilepath + "ansi.htc") + input_files = htcfile.input_files() + self.assertTrue('./htc_hydro/ireg_airy_h6_t10.inp' in input_files) + # + def test_continue_in_files(self): htcfile = HTCFile(self.testfilepath + "continue_in_file.htc", ".") self.assertIn('main_body__31', htcfile.new_htc_structure.keys())