Skip to content

Commit

Permalink
surrogate model training logic modified
Browse files Browse the repository at this point in the history
  • Loading branch information
yonghoonlee committed Nov 21, 2024
1 parent f0f926d commit 6b63c80
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion weis/glue_code/runWEIS.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ def run_weis(fname_wt_input, fname_modeling_options, fname_opt_options, geometry

# If design_of_experiment, recorder flag, train_surrogate_model are all True,
# collect sql files and create smt object
if opt_options['opt_flag'] and (not SKIP_DRIVER) and (not SKIP_SMT):
if opt_options['opt_flag'] and (not SKIP_SMT):
if opt_options['driver']['design_of_experiments']['flag'] and opt_options['recorder']['flag']:
if opt_options['driver']['design_of_experiments']['train_surrogate_model']:
WTSM = WindTurbineDOE2SM()
Expand Down
2 changes: 2 additions & 0 deletions weis/surrogate/WTsurrogate.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ def read_doe(self, sql_file, modeling_options, opt_options):
rank = 0

cr = om.CaseReader(sql_file)
print('reading cases from {:}'.format(sql_file))
cases = cr.list_cases('driver')

if (not MPI) or (MPI and rank == 0):
Expand Down Expand Up @@ -413,6 +414,7 @@ def write_sm(self, sm_filename):
try:
with open(sm_filename, 'wb') as fid:
pkl.dump(self.dataset_list, fid, protocol=5)
print('Surrogate model written in {:}'.format(sm_filename))
except:
print('Unable to write surrogate model file: {:}.'.format(sm_filename))
raise Exception('Unable to write surrogate model file: {:}.'.format(sm_filename))
Expand Down

0 comments on commit 6b63c80

Please sign in to comment.