Skip to content
Snippets Groups Projects
Commit a35dc559 authored by Mads M. Pedersen's avatar Mads M. Pedersen
Browse files

added warning catch for evaluate

parent 4e005c95
No related branches found
No related tags found
1 merge request!94Handle disabled mpi
...@@ -5,6 +5,7 @@ from openmdao.api import Problem, ScipyOptimizeDriver, IndepVarComp ...@@ -5,6 +5,7 @@ from openmdao.api import Problem, ScipyOptimizeDriver, IndepVarComp
import numpy as np import numpy as np
from topfarm.constraint_components.boundary_component import BoundaryComp from topfarm.constraint_components.boundary_component import BoundaryComp
from topfarm.constraint_components.spacing_component import SpacingComp from topfarm.constraint_components.spacing_component import SpacingComp
import warnings
class TopFarm(object): class TopFarm(object):
...@@ -67,7 +68,9 @@ class TopFarm(object): ...@@ -67,7 +68,9 @@ class TopFarm(object):
def evaluate(self): def evaluate(self):
t = time.time() t = time.time()
self.problem.run_model() with warnings.catch_warnings(): # suppress OpenMDAO/SLSQP warnings
warnings.filterwarnings('ignore', "Inefficient choice of derivative mode. You chose 'rev' for a problem with")
self.problem.run_model()
print ("Evaluated in\t%.3fs" % (time.time() - t)) print ("Evaluated in\t%.3fs" % (time.time() - t))
return self.get_cost(), self.turbine_positions return self.get_cost(), self.turbine_positions
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment