windse.OptimizationManager¶
The OptimizationManager submodule contains all the required function for optimizing via dolfin-adjoint. To use dolfin-adjoin set:
general:
dolfin_adjoint: True
in the param.yaml file.
Todo
- Read through an update the docstrings for these functions.
- Create specific optimization classes.
-
class
windse.OptimizationManager.
ConsComp
(**kwargs)¶ Bases:
openmdao.core.explicitcomponent.ExplicitComponent
OpenMDAO component to wrap the constraint computation.
A small wrapper used on the fenics methods for computing constraint and Jacobian values using the OpenMDAO syntax.
-
compute
(inputs, outputs)¶ Compute outputs given inputs. The model is assumed to be in an unscaled state.
Parameters: - inputs (Vector) – unscaled, dimensional input variables read via inputs[key]
- outputs (Vector) – unscaled, dimensional output variables read via outputs[key]
- discrete_inputs (dict or None) – If not None, dict containing discrete input values.
- discrete_outputs (dict or None) – If not None, dict containing discrete output values.
-
compute_partials
(inputs, partials)¶ Compute sub-jacobian parts. The model is assumed to be in an unscaled state.
Parameters: - inputs (Vector) – unscaled, dimensional input variables read via inputs[key]
- partials (Jacobian) – sub-jac components written to partials[output_name, input_name]
- discrete_inputs (dict or None) – If not None, dict containing discrete input values.
-
initialize
()¶ Perform any one-time initialization run at instantiation.
-
setup
()¶ Declare inputs and outputs.
- Available attributes:
- name pathname comm options
-
-
class
windse.OptimizationManager.
ObjComp
(**kwargs)¶ Bases:
openmdao.core.explicitcomponent.ExplicitComponent
OpenMDAO component to wrap the objective computation from dolfin.
Specifically, we use the J and dJ (function and Jacobian) methods to compute the function value and derivative values as needed by the OpenMDAO optimizers.
-
compute
(inputs, outputs)¶ Compute outputs given inputs. The model is assumed to be in an unscaled state.
Parameters: - inputs (Vector) – unscaled, dimensional input variables read via inputs[key]
- outputs (Vector) – unscaled, dimensional output variables read via outputs[key]
- discrete_inputs (dict or None) – If not None, dict containing discrete input values.
- discrete_outputs (dict or None) – If not None, dict containing discrete output values.
-
compute_partials
(inputs, partials)¶ Compute sub-jacobian parts. The model is assumed to be in an unscaled state.
Parameters: - inputs (Vector) – unscaled, dimensional input variables read via inputs[key]
- partials (Jacobian) – sub-jac components written to partials[output_name, input_name]
- discrete_inputs (dict or None) – If not None, dict containing discrete input values.
-
initialize
()¶ Perform any one-time initialization run at instantiation.
-
setup
()¶ Declare inputs and outputs.
- Available attributes:
- name pathname comm options
-
-
class
windse.OptimizationManager.
Optimizer
(solver)¶ Bases:
object
A GenericProblem contains on the basic functions required by all problem objects.
Parameters: dom ( windse.DomainManager.GenericDomain()
) – a windse domain object.-
Gradient
()¶ Returns a gradient of the objective function
-
-
windse.OptimizationManager.
gather
(m)¶ Helper function to gather constraint Jacobians. Adapated from fenics.
-
windse.OptimizationManager.
om_wrapper
(J, initial_DVs, dJ, H, bounds, **kwargs)¶ Custom optimization wrapper to use OpenMDAO optimizers with dolfin-adjoint.
Follows the API as defined by dolfin-adjoint.
Parameters: - J (object) – Function to compute the model analysis value at a design point.
- initial_DVs (array) – The initial design variables so we can get the array sizing correct for the OpenMDAO implementation.
- dJ (object) – Function to compute the Jacobian at a design point.
- H (object) – Function to compute the Hessian at a design point (not used).
- bounds (array) – Array of lower and upper bound values for the design variables.
Returns: DVs – The optimal design variable values.
Return type: array
Classes¶
-
class
windse.OptimizationManager.
ConsComp
(**kwargs) Bases:
openmdao.core.explicitcomponent.ExplicitComponent
OpenMDAO component to wrap the constraint computation.
A small wrapper used on the fenics methods for computing constraint and Jacobian values using the OpenMDAO syntax.
-
compute
(inputs, outputs) Compute outputs given inputs. The model is assumed to be in an unscaled state.
Parameters: - inputs (Vector) – unscaled, dimensional input variables read via inputs[key]
- outputs (Vector) – unscaled, dimensional output variables read via outputs[key]
- discrete_inputs (dict or None) – If not None, dict containing discrete input values.
- discrete_outputs (dict or None) – If not None, dict containing discrete output values.
-
compute_partials
(inputs, partials) Compute sub-jacobian parts. The model is assumed to be in an unscaled state.
Parameters: - inputs (Vector) – unscaled, dimensional input variables read via inputs[key]
- partials (Jacobian) – sub-jac components written to partials[output_name, input_name]
- discrete_inputs (dict or None) – If not None, dict containing discrete input values.
-
initialize
() Perform any one-time initialization run at instantiation.
-
setup
() Declare inputs and outputs.
- Available attributes:
- name pathname comm options
-
-
class
windse.OptimizationManager.
MinimumDistanceConstraint
(m_pos, min_distance=200)¶ Bases:
object
-
class
windse.OptimizationManager.
ObjComp
(**kwargs) Bases:
openmdao.core.explicitcomponent.ExplicitComponent
OpenMDAO component to wrap the objective computation from dolfin.
Specifically, we use the J and dJ (function and Jacobian) methods to compute the function value and derivative values as needed by the OpenMDAO optimizers.
-
compute
(inputs, outputs) Compute outputs given inputs. The model is assumed to be in an unscaled state.
Parameters: - inputs (Vector) – unscaled, dimensional input variables read via inputs[key]
- outputs (Vector) – unscaled, dimensional output variables read via outputs[key]
- discrete_inputs (dict or None) – If not None, dict containing discrete input values.
- discrete_outputs (dict or None) – If not None, dict containing discrete output values.
-
compute_partials
(inputs, partials) Compute sub-jacobian parts. The model is assumed to be in an unscaled state.
Parameters: - inputs (Vector) – unscaled, dimensional input variables read via inputs[key]
- partials (Jacobian) – sub-jac components written to partials[output_name, input_name]
- discrete_inputs (dict or None) – If not None, dict containing discrete input values.
-
initialize
() Perform any one-time initialization run at instantiation.
-
setup
() Declare inputs and outputs.
- Available attributes:
- name pathname comm options
-
-
class
windse.OptimizationManager.
Optimizer
(solver) Bases:
object
A GenericProblem contains on the basic functions required by all problem objects.
Parameters: dom ( windse.DomainManager.GenericDomain()
) – a windse domain object.-
Gradient
() Returns a gradient of the objective function
-
Functions¶
-
windse.OptimizationManager.
gather
(m) Helper function to gather constraint Jacobians. Adapated from fenics.
-
windse.OptimizationManager.
om_wrapper
(J, initial_DVs, dJ, H, bounds, **kwargs) Custom optimization wrapper to use OpenMDAO optimizers with dolfin-adjoint.
Follows the API as defined by dolfin-adjoint.
Parameters: - J (object) – Function to compute the model analysis value at a design point.
- initial_DVs (array) – The initial design variables so we can get the array sizing correct for the OpenMDAO implementation.
- dJ (object) – Function to compute the Jacobian at a design point.
- H (object) – Function to compute the Hessian at a design point (not used).
- bounds (array) – Array of lower and upper bound values for the design variables.
Returns: DVs – The optimal design variable values.
Return type: array