Skip to content

Commit

Permalink
Merge remote-tracking branch 'cory/optimization' into optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
dzalkind committed Aug 7, 2024
2 parents 97d990e + 3e7d853 commit 65a5f93
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
6 changes: 5 additions & 1 deletion examples/17_IEA22_Optimization/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@

This is an example of optimization and post-processing of an IEA 22MW RWT-based FOWT system.

## RAFT-based optimization

## Data generation
### Data generation

To run the cases, we use the standard WEIS setup, driven by `driver_weis_raft_opt.py`.
The driver leverages an analysis options file, `analysis_options_raft_ptfm_opt.yaml`, and the modeling options file `modeling_options_raft.yaml`.
Expand Down Expand Up @@ -33,3 +34,6 @@ Alternately, standard move operations for a user's operating system of choice ca
Once `17_IEA22_Opt_Result_COBYLA`, `17_IEA22_Opt_Result_SLSQP`, and `17_IEA22_Opt_Result_DE` are populated, `analysis.ipynb` can be used to evaluate the results.
The notebook has detailed descriptions of its analysis.

## OpenFAST-based optimization

TO BE COMPLETED...
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ driver:
maxiter: 100 # Maximum number of iterations (NLopt)
max_iter: 1000 # Maximum number of iterations (SLSQP)
solver: LN_COBYLA # Optimization solver. Other options are 'SLSQP' - 'CONMIN'
run_parallel: True

recorder:
flag: True # Flag to activate OpenMDAO recorder
Expand Down
11 changes: 7 additions & 4 deletions weis/glue_code/runWEIS.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from weis.control.tmd import assign_TMD_values

fd_methods = ['SLSQP','SNOPT', 'LD_MMA']
crawling_methods = ['DE', 'NSGA2']
evolutionary_methods = ['DE', 'NSGA2']

if MPI:
from wisdem.commonse.mpi_tools import map_comm_heirarchical, subprocessor_loop, subprocessor_stop
Expand Down Expand Up @@ -41,9 +41,12 @@ def run_weis(fname_wt_input, fname_modeling_options, fname_opt_options, geometry
if modeling_options['Level3']['flag']:

# If we are running an optimization method that doesn't use finite differencing, set the number of DVs to 1
if not (opt_options['driver']['design_of_experiments']['flag'] or opt_options['driver']['optimization']['solver'] in fd_methods):
if not (opt_options['driver']['design_of_experiments']['flag']) and (opt_options['driver']['optimization']['solver'] in evolutionary_methods):
n_DV *= 5 # targeting 10*n_DV population size... this is what the equivalent FD coloring would take
elif not (opt_options['driver']['design_of_experiments']['flag'] or opt_options['driver']['optimization']['solver'] in fd_methods):
n_DV = 1


# If openfast is called, the maximum number of FD is the number of DV, if we have the number of cores available that doubles the number of DVs,
# otherwise it is half of the number of DV (rounded to the lower integer).
# We need this because a top layer of cores calls a bottom set of cores where OpenFAST runs.
Expand Down Expand Up @@ -77,7 +80,7 @@ def run_weis(fname_wt_input, fname_modeling_options, fname_opt_options, geometry
n_FD = min([max_cores, n_DV])
n_OF_runs_parallel = 1
# if we're doing a GA or such, "FD" means "entities in epoch"
if opt_options['driver']['optimization']['solver'] in crawling_methods:
if opt_options['driver']['optimization']['solver'] in evolutionary_methods:
n_FD = max_cores

# Define the color map for the cores (how these are distributed between finite differencing and openfast runs)
Expand Down Expand Up @@ -231,7 +234,7 @@ def run_weis(fname_wt_input, fname_modeling_options, fname_opt_options, geometry
out_stream=pvfile,
)
pvfile.close()

# clean up the problem_var_dict that we extracted for output
for k in problem_var_dict.keys():
if not problem_var_dict.get(k): continue
Expand Down

0 comments on commit 65a5f93

Please sign in to comment.