Skip to content

Commit

Permalink
Put test in function
Browse files Browse the repository at this point in the history
  • Loading branch information
dzalkind committed Dec 1, 2023
1 parent 30aab7e commit a893d08
Showing 1 changed file with 25 additions and 20 deletions.
45 changes: 25 additions & 20 deletions tests/test_omdao_VolturnUS-S.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,30 +16,35 @@
# -----------------------------------
# OMDAO
# -----------------------------------
this_dir = os.path.dirname(__file__)

# Load options directly generated in WEIS
with open(os.path.join(this_dir,'test_data',weis_options_file)) as file:
opt = yaml.load(file, Loader=yaml.FullLoader)
def test_omdao_raft():
this_dir = os.path.dirname(__file__)

prob = om.Problem()
prob.model = RAFT_Group(modeling_options=opt['modeling_options'],
analysis_options=opt['analysis_options'],
turbine_options=opt['turbine_options'],
mooring_options=opt['mooring_options'],
member_options=opt['member_options'])
prob.setup()
# Load options directly generated in WEIS
with open(os.path.join(this_dir,'test_data',weis_options_file)) as file:
opt = yaml.load(file, Loader=yaml.FullLoader)

# -------------------------
# inputs
# -------------------------
# Load options directly generated in WEIS
with open(os.path.join(this_dir,'test_data',weis_inputs_file)) as file:
inputs = yaml.load(file, Loader=yaml.FullLoader)
prob = om.Problem()
prob.model = RAFT_Group(modeling_options=opt['modeling_options'],
analysis_options=opt['analysis_options'],
turbine_options=opt['turbine_options'],
mooring_options=opt['mooring_options'],
member_options=opt['member_options'])
prob.setup()

for key, val in inputs.items():
prob[key] = val
# -------------------------
# inputs
# -------------------------
# Load options directly generated in WEIS
with open(os.path.join(this_dir,'test_data',weis_inputs_file)) as file:
inputs = yaml.load(file, Loader=yaml.FullLoader)

for key, val in inputs.items():
prob[key] = val

prob.run_model()

prob.run_model()

if __name__=="__main__":
test_omdao_raft()

0 comments on commit a893d08

Please sign in to comment.