Skip to content

Commit

Permalink
Make control example case
Browse files Browse the repository at this point in the history
  • Loading branch information
dzalkind committed Dec 30, 2024
1 parent b903ba1 commit fc4cf7c
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
3 changes: 3 additions & 0 deletions examples/02_run_openfast_cases/modeling_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ ROSCO:
flag: True
tuning_yaml: ../01_aeroelasticse/OpenFAST_models/IEA-15-240-RWT/IEA-15-240-RWT-UMaineSemi/IEA15MW-UMaineSemi.yaml
Kp_float: -10
U_pc: [12, 18, 24]
omega_pc: [.1, .1, .1]
zeta_pc: [1.,1.,1.]


DLC_driver:
Expand Down
27 changes: 25 additions & 2 deletions examples/02_run_openfast_cases/weis_driver_rosco_opt.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@

from weis.glue_code.runWEIS import run_weis
from openmdao.utils.mpi import MPI
from weis.glue_code.weis_args import weis_args, get_max_procs, set_modopt_procs

# Parse args
args = weis_args()


## File management
run_dir = os.path.dirname( os.path.realpath(__file__) )
Expand All @@ -13,12 +18,30 @@


tt = time.time()
wt_opt, modeling_options, opt_options = run_weis(fname_wt_input, fname_modeling_options, fname_analysis_options)
maxnP = get_max_procs(args)

modeling_override = None
if MPI:
# Pre-compute number of cores needed in this run
_, modeling_options, _ = run_weis(fname_wt_input,
fname_modeling_options,
fname_analysis_options,
prepMPI=True,
maxnP = maxnP)

modeling_override = set_modopt_procs(modeling_options)

# Run WEIS for real now
wt_opt, modeling_options, opt_options = run_weis(fname_wt_input,
fname_modeling_options,
fname_analysis_options,
modeling_override=modeling_override,
prepMPI=args.preMPI)

if MPI:
rank = MPI.COMM_WORLD.Get_rank()
else:
rank = 0
if rank == 0:
if rank == 0 and args.preMPI == False:
print("Run time: %f"%(time.time()-tt))
sys.stdout.flush()

0 comments on commit fc4cf7c

Please sign in to comment.