Skip to content

Commit

Permalink
Move option saving to compute to capture dlcs
Browse files Browse the repository at this point in the history
  • Loading branch information
dzalkind committed Mar 11, 2024
1 parent 9106b40 commit 75eb15e
Show file tree
Hide file tree
Showing 2 changed files with 117 additions and 18 deletions.
35 changes: 17 additions & 18 deletions raft/omdao_raft.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import copy
from itertools import compress

DEBUG_OMDAO = False # use within WEIS
DEBUG_OMDAO = True # use within WEIS

ndim = 3
ndof = 6
Expand All @@ -23,23 +23,6 @@ def initialize(self):

def setup(self):

# Save options for RAFT testing/debugging
if DEBUG_OMDAO:
from weis.aeroelasticse.FileTools import save_yaml
all_options = {}
all_options['modeling_options'] = self.options['modeling_options']
all_options['turbine_options'] = self.options['turbine_options']
all_options['mooring_options'] = self.options['mooring_options']
all_options['member_options'] = self.options['member_options']
all_options['analysis_options'] = self.options['analysis_options']

# handle some paths for testing
gen_opt = all_options['analysis_options']['general']
gen_opt['folder_output'] = os.path.split(gen_opt['folder_output'])[-1]

save_yaml(os.path.join(os.path.dirname(__file__), '../tests/test_data/'), 'weis_options.yaml', all_options)


# unpack options
modeling_opt = self.options['modeling_options']
analysis_options = self.options['analysis_options']
Expand Down Expand Up @@ -365,6 +348,22 @@ def compute(self, inputs, outputs, discrete_inputs, discrete_outputs):
# save inputs for RAFT testing/debugging
if DEBUG_OMDAO:
from weis.aeroelasticse.FileTools import save_yaml
# Options
all_options = {}
all_options['modeling_options'] = self.options['modeling_options']
all_options['turbine_options'] = self.options['turbine_options']
all_options['mooring_options'] = self.options['mooring_options']
all_options['member_options'] = self.options['member_options']
all_options['analysis_options'] = self.options['analysis_options']

# handle some paths for testing
gen_opt = all_options['analysis_options']['general']
gen_opt['folder_output'] = os.path.split(gen_opt['folder_output'])[-1]

save_yaml(os.path.join(os.path.dirname(__file__), '../tests/test_data/'), 'weis_options.yaml', all_options)


# Inputs
input_list = self.list_inputs(out_stream=None)
input_dict = {}
for i in input_list:
Expand Down
100 changes: 100 additions & 0 deletions tests/test_data/weis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,106 @@ modeling_options:
model_potential: [false, false, false, false, false, false, false, false, false, false]
nfreq: 20
n_cases: 98
raft_dlcs:
- [3.0, 0.0, IB_NTM, operating, 0.0, JONSWAP, 6.9, 1.0, 0.0]
- [5.0, 0.0, IB_NTM, operating, 0.0, JONSWAP, 6.93, 1.0, 0.0]
- [7.0, 0.0, IB_NTM, operating, 0.0, JONSWAP, 6.99, 1.0, 0.0]
- [9.0, 0.0, IB_NTM, operating, 0.0, JONSWAP, 7.07, 1.0, 0.0]
- [11.0, 0.0, IB_NTM, operating, 0.0, JONSWAP, 7.1850000000000005, 1.095, 0.0]
- [13.0, 0.0, IB_NTM, operating, 0.0, JONSWAP, 7.34, 1.25, 0.0]
- [15.0, 0.0, IB_NTM, operating, 0.0, JONSWAP, 7.545, 1.455, 0.0]
- [17.0, 0.0, IB_NTM, operating, 0.0, JONSWAP, 7.800000000000001, 1.715, 0.0]
- [19.0, 0.0, IB_NTM, operating, 0.0, JONSWAP, 8.105, 2.04, 0.0]
- [21.0, 0.0, IB_NTM, operating, 0.0, JONSWAP, 8.45, 2.42, 0.0]
- [23.0, 0.0, IB_NTM, operating, 0.0, JONSWAP, 8.82, 2.8449999999999998, 0.0]
- [25.0, 0.0, IB_NTM, operating, 0.0, JONSWAP, 9.01, 3.07, 0.0]
- [3.0, 0.0, IB_ECD, operating, 0.0, JONSWAP, 6.9, 1.0, 0.0]
- [3.0, 0.0, IB_ECD, operating, 0.0, JONSWAP, 6.9, 1.0, 0.0]
- [5.0, 0.0, IB_ECD, operating, 0.0, JONSWAP, 6.93, 1.0, 0.0]
- [5.0, 0.0, IB_ECD, operating, 0.0, JONSWAP, 6.93, 1.0, 0.0]
- [7.0, 0.0, IB_ECD, operating, 0.0, JONSWAP, 6.99, 1.0, 0.0]
- [7.0, 0.0, IB_ECD, operating, 0.0, JONSWAP, 6.99, 1.0, 0.0]
- [9.0, 0.0, IB_ECD, operating, 0.0, JONSWAP, 7.07, 1.0, 0.0]
- [9.0, 0.0, IB_ECD, operating, 0.0, JONSWAP, 7.07, 1.0, 0.0]
- [11.0, 0.0, IB_ECD, operating, 0.0, JONSWAP, 7.1850000000000005, 1.095, 0.0]
- [11.0, 0.0, IB_ECD, operating, 0.0, JONSWAP, 7.1850000000000005, 1.095, 0.0]
- [13.0, 0.0, IB_ECD, operating, 0.0, JONSWAP, 7.34, 1.25, 0.0]
- [13.0, 0.0, IB_ECD, operating, 0.0, JONSWAP, 7.34, 1.25, 0.0]
- [15.0, 0.0, IB_ECD, operating, 0.0, JONSWAP, 7.545, 1.455, 0.0]
- [15.0, 0.0, IB_ECD, operating, 0.0, JONSWAP, 7.545, 1.455, 0.0]
- [17.0, 0.0, IB_ECD, operating, 0.0, JONSWAP, 7.800000000000001, 1.715, 0.0]
- [17.0, 0.0, IB_ECD, operating, 0.0, JONSWAP, 7.800000000000001, 1.715, 0.0]
- [19.0, 0.0, IB_ECD, operating, 0.0, JONSWAP, 8.105, 2.04, 0.0]
- [19.0, 0.0, IB_ECD, operating, 0.0, JONSWAP, 8.105, 2.04, 0.0]
- [21.0, 0.0, IB_ECD, operating, 0.0, JONSWAP, 8.45, 2.42, 0.0]
- [21.0, 0.0, IB_ECD, operating, 0.0, JONSWAP, 8.45, 2.42, 0.0]
- [23.0, 0.0, IB_ECD, operating, 0.0, JONSWAP, 8.82, 2.8449999999999998, 0.0]
- [23.0, 0.0, IB_ECD, operating, 0.0, JONSWAP, 8.82, 2.8449999999999998, 0.0]
- [25.0, 0.0, IB_ECD, operating, 0.0, JONSWAP, 9.01, 3.07, 0.0]
- [25.0, 0.0, IB_ECD, operating, 0.0, JONSWAP, 9.01, 3.07, 0.0]
- [3.0, 0.0, IB_EWS, operating, 0.0, JONSWAP, 6.9, 1.0, 0.0]
- [3.0, 0.0, IB_EWS, operating, 0.0, JONSWAP, 6.9, 1.0, 0.0]
- [3.0, 0.0, IB_EWS, operating, 0.0, JONSWAP, 6.9, 1.0, 0.0]
- [3.0, 0.0, IB_EWS, operating, 0.0, JONSWAP, 6.9, 1.0, 0.0]
- [5.0, 0.0, IB_EWS, operating, 0.0, JONSWAP, 6.93, 1.0, 0.0]
- [5.0, 0.0, IB_EWS, operating, 0.0, JONSWAP, 6.93, 1.0, 0.0]
- [5.0, 0.0, IB_EWS, operating, 0.0, JONSWAP, 6.93, 1.0, 0.0]
- [5.0, 0.0, IB_EWS, operating, 0.0, JONSWAP, 6.93, 1.0, 0.0]
- [7.0, 0.0, IB_EWS, operating, 0.0, JONSWAP, 6.99, 1.0, 0.0]
- [7.0, 0.0, IB_EWS, operating, 0.0, JONSWAP, 6.99, 1.0, 0.0]
- [7.0, 0.0, IB_EWS, operating, 0.0, JONSWAP, 6.99, 1.0, 0.0]
- [7.0, 0.0, IB_EWS, operating, 0.0, JONSWAP, 6.99, 1.0, 0.0]
- [9.0, 0.0, IB_EWS, operating, 0.0, JONSWAP, 7.07, 1.0, 0.0]
- [9.0, 0.0, IB_EWS, operating, 0.0, JONSWAP, 7.07, 1.0, 0.0]
- [9.0, 0.0, IB_EWS, operating, 0.0, JONSWAP, 7.07, 1.0, 0.0]
- [9.0, 0.0, IB_EWS, operating, 0.0, JONSWAP, 7.07, 1.0, 0.0]
- [11.0, 0.0, IB_EWS, operating, 0.0, JONSWAP, 7.1850000000000005, 1.095, 0.0]
- [11.0, 0.0, IB_EWS, operating, 0.0, JONSWAP, 7.1850000000000005, 1.095, 0.0]
- [11.0, 0.0, IB_EWS, operating, 0.0, JONSWAP, 7.1850000000000005, 1.095, 0.0]
- [11.0, 0.0, IB_EWS, operating, 0.0, JONSWAP, 7.1850000000000005, 1.095, 0.0]
- [13.0, 0.0, IB_EWS, operating, 0.0, JONSWAP, 7.34, 1.25, 0.0]
- [13.0, 0.0, IB_EWS, operating, 0.0, JONSWAP, 7.34, 1.25, 0.0]
- [13.0, 0.0, IB_EWS, operating, 0.0, JONSWAP, 7.34, 1.25, 0.0]
- [13.0, 0.0, IB_EWS, operating, 0.0, JONSWAP, 7.34, 1.25, 0.0]
- [15.0, 0.0, IB_EWS, operating, 0.0, JONSWAP, 7.545, 1.455, 0.0]
- [15.0, 0.0, IB_EWS, operating, 0.0, JONSWAP, 7.545, 1.455, 0.0]
- [15.0, 0.0, IB_EWS, operating, 0.0, JONSWAP, 7.545, 1.455, 0.0]
- [15.0, 0.0, IB_EWS, operating, 0.0, JONSWAP, 7.545, 1.455, 0.0]
- [17.0, 0.0, IB_EWS, operating, 0.0, JONSWAP, 7.800000000000001, 1.715, 0.0]
- [17.0, 0.0, IB_EWS, operating, 0.0, JONSWAP, 7.800000000000001, 1.715, 0.0]
- [17.0, 0.0, IB_EWS, operating, 0.0, JONSWAP, 7.800000000000001, 1.715, 0.0]
- [17.0, 0.0, IB_EWS, operating, 0.0, JONSWAP, 7.800000000000001, 1.715, 0.0]
- [19.0, 0.0, IB_EWS, operating, 0.0, JONSWAP, 8.105, 2.04, 0.0]
- [19.0, 0.0, IB_EWS, operating, 0.0, JONSWAP, 8.105, 2.04, 0.0]
- [19.0, 0.0, IB_EWS, operating, 0.0, JONSWAP, 8.105, 2.04, 0.0]
- [19.0, 0.0, IB_EWS, operating, 0.0, JONSWAP, 8.105, 2.04, 0.0]
- [21.0, 0.0, IB_EWS, operating, 0.0, JONSWAP, 8.45, 2.42, 0.0]
- [21.0, 0.0, IB_EWS, operating, 0.0, JONSWAP, 8.45, 2.42, 0.0]
- [21.0, 0.0, IB_EWS, operating, 0.0, JONSWAP, 8.45, 2.42, 0.0]
- [21.0, 0.0, IB_EWS, operating, 0.0, JONSWAP, 8.45, 2.42, 0.0]
- [23.0, 0.0, IB_EWS, operating, 0.0, JONSWAP, 8.82, 2.8449999999999998, 0.0]
- [23.0, 0.0, IB_EWS, operating, 0.0, JONSWAP, 8.82, 2.8449999999999998, 0.0]
- [23.0, 0.0, IB_EWS, operating, 0.0, JONSWAP, 8.82, 2.8449999999999998, 0.0]
- [23.0, 0.0, IB_EWS, operating, 0.0, JONSWAP, 8.82, 2.8449999999999998, 0.0]
- [25.0, 0.0, IB_EWS, operating, 0.0, JONSWAP, 9.01, 3.07, 0.0]
- [25.0, 0.0, IB_EWS, operating, 0.0, JONSWAP, 9.01, 3.07, 0.0]
- [25.0, 0.0, IB_EWS, operating, 0.0, JONSWAP, 9.01, 3.07, 0.0]
- [25.0, 0.0, IB_EWS, operating, 0.0, JONSWAP, 9.01, 3.07, 0.0]
- [3.0, 0.0, IB_NTM, operating, 0.0, JONSWAP, 11.5, 6.3, 0.0]
- [5.0, 0.0, IB_NTM, operating, 0.0, JONSWAP, 12.1, 7.15, 0.0]
- [7.0, 0.0, IB_NTM, operating, 0.0, JONSWAP, 12.7, 8.0, 0.0]
- [9.0, 0.0, IB_NTM, operating, 0.0, JONSWAP, 12.75, 8.05, 0.0]
- [11.0, 0.0, IB_NTM, operating, 0.0, JONSWAP, 12.95, 8.3, 0.0]
- [13.0, 0.0, IB_NTM, operating, 0.0, JONSWAP, 13.1, 8.5, 0.0]
- [15.0, 0.0, IB_NTM, operating, 0.0, JONSWAP, 13.6, 9.15, 0.0]
- [17.0, 0.0, IB_NTM, operating, 0.0, JONSWAP, 14.1, 9.8, 0.0]
- [19.0, 0.0, IB_NTM, operating, 0.0, JONSWAP, 14.1, 9.8, 0.0]
- [21.0, 0.0, IB_NTM, operating, 0.0, JONSWAP, 14.1, 9.8, 0.0]
- [23.0, 0.0, IB_NTM, operating, 0.0, JONSWAP, 14.1, 9.850000000000001, 0.0]
- [25.0, 0.0, IB_NTM, operating, 0.0, JONSWAP, 14.1, 9.9, 0.0]
- [70.0, 0.0, IB_EWM, parked, -8.0, JONSWAP, 14.2, 10.68, 0.0]
- [70.0, 0.0, IB_EWM, parked, 8.0, JONSWAP, 14.2, 10.68, 0.0]
raft_dlcs_keys: [wind_speed, wind_heading, turbulence, turbine_status, yaw_misalign, wave_spectrum, wave_period, wave_height, wave_heading]
turbine_options:
npts: 11
scalar_thicknesses: false
Expand Down

0 comments on commit 75eb15e

Please sign in to comment.