Master control class.
More...
|
None | __init__ (self) |
|
None | AddControl (self, Control control) |
| Adds a given control to the master control. More...
|
|
'list[Control]' | GetListOfControls (self) |
| Returns the list of controls in the master control. More...
|
|
'dict[SupportedSensitivityFieldVariableTypes, KratosOA.CollectiveExpression]' | GetPhysicalKratosVariableCollectiveExpressionsMap (self) |
| Returns map of physical variables and collective expressions from each control. More...
|
|
KratosOA.CollectiveExpression | GetEmptyField (self) |
| Returns empty CollectiveExpression containing empty ContainerExpressions for each control. More...
|
|
KratosOA.CollectiveExpression | GetControlField (self) |
| Returns CollectiveExpression containing control field ContainerExpressions for each control. More...
|
|
KratosOA.CollectiveExpression | MapGradient (self, 'dict[SupportedSensitivityFieldVariableTypes, KratosOA.CollectiveExpression]' physical_space_gradient_variable_and_collective_expressions_map) |
| Maps physical space gradients to a collective expression. More...
|
|
'dict[Control, bool]' | Update (self, KratosOA.CollectiveExpression update_collective_expressions) |
| Update each control with given collective expression's respective container expression. More...
|
|
None | Check (self) |
|
None | Initialize (self) |
|
None | Finalize (self) |
|
Master control class.
This class is used to simplify working with many controls at once. Following responsibilities are assumed:
1. Maps physical gradients from different domains to one CollectiveExpression (using MapGradient).
2. Updates each respective domain from updates given by one CollectiveExpression (using Update).
There should be only one master control class per optimization problem.
◆ __init__()
None master_control.MasterControl.__init__ |
( |
|
self | ) |
|
◆ AddControl()
None master_control.MasterControl.AddControl |
( |
|
self, |
|
|
Control |
control |
|
) |
| |
Adds a given control to the master control.
Args:
control (Control): Control to be added
◆ Check()
None master_control.MasterControl.Check |
( |
|
self | ) |
|
◆ Finalize()
None master_control.MasterControl.Finalize |
( |
|
self | ) |
|
◆ GetControlField()
KratosOA.CollectiveExpression master_control.MasterControl.GetControlField |
( |
|
self | ) |
|
Returns CollectiveExpression containing control field ContainerExpressions for each control.
Returns:
KratosOA.CollectiveExpression: Control field CollectiveExpression
◆ GetEmptyField()
KratosOA.CollectiveExpression master_control.MasterControl.GetEmptyField |
( |
|
self | ) |
|
Returns empty CollectiveExpression containing empty ContainerExpressions for each control.
Returns:
KratosOA.CollectiveExpression: Empty CollectiveExpression
◆ GetListOfControls()
'list[Control]' master_control.MasterControl.GetListOfControls |
( |
|
self | ) |
|
Returns the list of controls in the master control.
Returns:
list[Control]: List of controls.
◆ GetPhysicalKratosVariableCollectiveExpressionsMap()
'dict[SupportedSensitivityFieldVariableTypes, KratosOA.CollectiveExpression]' master_control.MasterControl.GetPhysicalKratosVariableCollectiveExpressionsMap |
( |
|
self | ) |
|
Returns map of physical variables and collective expressions from each control.
This returns a map of physical control variables and a collective expressions. The collective expressions will contain
all the container expressions for respective control's control domains for each physical control variable. The repeated container
expressions for the same physical control variable is omitted to avoid double calculations.
Returns:
dict[SupportedSensitivityFieldVariableTypes, KratosOA.CollectiveExpression]: Physical control variable and collective expressions map.
◆ Initialize()
None master_control.MasterControl.Initialize |
( |
|
self | ) |
|
◆ MapGradient()
KratosOA.CollectiveExpression master_control.MasterControl.MapGradient |
( |
|
self, |
|
|
'dict[SupportedSensitivityFieldVariableTypes, KratosOA.CollectiveExpression]' |
physical_space_gradient_variable_and_collective_expressions_map |
|
) |
| |
Maps physical space gradients to a collective expression.
This method maps sensitivities w.r.t. physical space variables to control space by using each control. It is done by converting input
map with CollectiveExpression to a map with ContainerExpressions. The following is a pseudo example:
input:
physical_space_gradient_variable_and_collective_expressions_map = {
"YOUND_MODULUS": [ControlDomain1, ControlDomain2],
"DENSITY" : [ControlDomain1],
"VISCOSITY" : [ControlDomain2],
}
control info:
control1: domain = ControlDomain1
physical_vars = YOUND_MODULUS, DENSITY
control2: domain = ControlDomain2
physical_vars = VISCOSITY, DENSITY
from above information, following two maps are created and passed to each control to obtain one ContainerExpression from each control.
control_specific_maps:
for control1: {YOUND_MODULUS: ControlDomain1, DENSITY: ControlDomain1}
for control2: {VISCOSITY: ControlDomain2, DENSITY: A zero valued ControlDomain}
then returned mapped gradients are added to one CollectiveExpression.
In here, the missing gradients for required physical variables will be assumed to be zero.
This converts given map of sensitivities w.r.t. different physical space variables to one sensitivities in control space and aggregated
to one CollectiveExpression.
Args:
physical_space_gradient_variable_and_collective_expressions_map (dict[SupportedSensitivityFieldVariableTypes, KratosOA.CollectiveExpression]): Map of physical space sensitivities.
Returns:
KratosOA.CollectiveExpression: Control space sensitivities.
◆ Update()
'dict[Control, bool]' master_control.MasterControl.Update |
( |
|
self, |
|
|
KratosOA.CollectiveExpression |
update_collective_expressions |
|
) |
| |
Update each control with given collective expression's respective container expression.
Args:
update_collective_expressions (KratosOA.CollectiveExpression): Update
Raises:
RuntimeError: If number of controls and number of container expressions mismatch.
Returns:
dict[Control, bool]: A map with control and a boolean whether the update changed anything in that control.
The documentation for this class was generated from the following file:
- /home/runner/work/Documentation/Documentation/master/applications/OptimizationApplication/python_scripts/controls/master_control.py