From 3c76437ed6c8aba4ca38ba8ce437c8e64ab94e51 Mon Sep 17 00:00:00 2001 From: madsmpedersen <m@madsp.dk> Date: Mon, 4 Apr 2016 10:57:21 +0200 Subject: [PATCH] includes hydro dll input to input files --- wetb/hawc2/htc_file.py | 11 ++++++++--- .../test_files/htcfiles/dlc14_wsp10_wdir000_s0000.htc | 2 +- wetb/hawc2/tests/test_htc_file.py | 6 ++++++ 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/wetb/hawc2/htc_file.py b/wetb/hawc2/htc_file.py index 08193c5e..d539794e 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 4a994f38..6928a04f 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 51da8f5c..ba878df6 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()) -- GitLab