Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 18 additions & 4 deletions examples/example.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
varspeed = True
varpitch = True
cdf_type = 'rayleigh'
optimizer = 'psqp'
optimizer = 'conmin'
# ------------------------

# ---- instantiate rotor object -------
Expand Down Expand Up @@ -85,7 +85,7 @@

# ---- control settings ------------
rotor.control.Vin = 3.0 # (Float, m/s): cut-in wind speed
rotor.control.Vout = 25.0 # (Float, m/s): cut-out wind speed
rotor.control.Vout = 50.0 # (Float, m/s): cut-out wind speed
rotor.control.ratedPower = 5e6 # (Float, W): rated power
rotor.control.pitch = 0.0 # (Float, deg): pitch angle in region 2 (and region 3 for fixed pitch machines)

Expand Down Expand Up @@ -114,10 +114,24 @@


# run one iteration to get baseline for normalization
rotor.driver.config_parameters()
rotor.driver.update_parameters()
rotor.driver.start_iteration()

rotor.driver.run_iteration()
rotor.AEP0 = rotor.aep.AEP
rotor.driver.run_iteration()
# rotor.AEP0 = rotor.aep.AEP
# rotor.driver.run_iteration()


inputs = ['cdf.x']
outputs = ['cdf.F']
rotor.cdf.run()
#rotor.driver.gradient_options.fd_step_type = 'relative'
#rotor.driver.gradient_options.fd_form = 'central'
rotor.check_gradient(inputs=inputs, outputs=outputs)


exit()
# run optimization
rotor.run()

Expand Down
11 changes: 8 additions & 3 deletions src/harpopt.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from pyopt_driver.pyopt_driver import pyOptDriver
except Exception:
pass
from openmdao.lib.drivers.api import SLSQPdriver
from openmdao.lib.drivers.api import SLSQPdriver, CONMINdriver
from openmdao.lib.casehandlers.api import DumpCaseRecorder

from rotorse.rotoraerodefaults import common_io_with_ccblade, common_configure_with_ccblade
Expand Down Expand Up @@ -44,7 +44,7 @@ def configure(self):
'Minor feasibility tolerance': 1e-6,
'Major optimality tolerance': 1e-5,
'Function precision': 1e-8,
'Iterations limit': 500,
'Iterations limit': 100,
'Print file': 'harpopt_snopt.out',
'Summary file': 'harpopt_snopt_summary.out'}

Expand All @@ -53,14 +53,19 @@ def configure(self):
self.driver.optimizer = 'PSQP'
self.driver.options = {'XMAX': 100.0,
'TOLG': 1e-4,
'MFV': 500,
'MFV': 100,
'IFILE': 'harpopt_psqp.out'}

elif self.optimizer == 'slsqp':
self.replace('driver', SLSQPdriver())
self.driver.accuracy = 1.0e-6
self.driver.maxiter = 500

elif self.optimizer == "conmin":
self.replace('driver', CONMINdriver())
self.driver.delfun = 1e-6
self.driver.itmax = 500

else:
print 'invalid optimizer specified'
exit()
Expand Down