DVConstraints
- class pygeo.constraints.DVCon.DVConstraints(name='DVCon1')[source]
DVConstraints provides a convenient way of defining geometric constraints for WINGS. This can be very useful for a constrained aerodynamic or aerostructural optimization. Three types of constraints are supported:
Thickness ‘tooth-pick’ constraints: Thickness constraints are enforced at specific locations. A relative or absolute minimum/maximum thickness can be specified. Two variants are supplied: a ‘2d’ variant for thickness constraints over an area such as a spar box
addThicknessConstraints2D()
and a ‘1d’ variant for thickness constraints along a (poly) lineaddThicknessConstraints1D()
.Volume constraint: This computes and enforces a volume constraint over the specified domain. The input is identical to the ‘2d’ thickness constraints. See
addVolumeConstraint()
.LE/TE Constraints: These geometric constraints are required when using FFD volumes with shape variables. The leading and trailing edges must be fixed wrt the shape variables so these enforce that the coefficients on the leading edge can only move in equal and opposite directions
Fixed Location Constraints: These constraints allow you to specify certain location in the FFD that can not move.
Gear Post Constraint: This is a very highly specialized constraint used to ensure there is sufficient vertical space to install wing-mounted landing gear and that it is correctly positioned relative to the wing. See the class definition for more information.
Analytic sensitivity information is computed for all functions and a facility for adding the constraints automatically to a pyOptSparse optimization problem is also provided.
- Parameters
- namestr
A name for this object. Used to distinguish between DVCon objects if multiple DVConstraint objects are used in an optimization.
Create a (empty) DVconstrains object. Specific types of constraints will added individually
- addCircularityConstraint(origin, rotAxis, radius, zeroAxis, angleCW, angleCCW, nPts=4, upper=1.0, lower=1.0, scale=1.0, name=None, addToPyOpt=True, DVGeoName='default', compNames=None)[source]
Add a contraint to keep a certain portion of your geometry circular. Define the origin, central axis and radius to define the circle. Define the zero axis, and two angles to define the portion of the circle to use for the constraint The constraint will enforce that the radial lengths from the origin to the nPts around the circle stay equal.
- Parameters
- origin: vector
The coordinate of the origin
- rotation: vector
The central axis of the circle
- radius: float
The radius of the circle
- zeroAxis: vector
The axis defining the zero rotation angle around the circle
- angleCWfloat
Angle in the clockwise direction to extend the circularity constraint. Angle should be positive. Angles are specified in degrees.
- angleCCWfloat
Angle in the counter-clockwise direction to extend the circularity constraint. Angle should be positive. Angles are specified in degrees.
- nPtsint
Number of points in the discretization of the circle
- lowerfloat
Lower bound for circularity. This is the ratio of the target length relative to the first length calculated
- upperfloat
Upper bound for optimization constraint. See lower.
- scalefloat
This is the optimization scaling of the constraint. Typically this parameter will not need to be changed. If scaled=True, this automatically results in a well-scaled constraint and scale can be left at 1.0. If scaled=False, it may changed to a more suitable value of the resulting physical volume magnitude is vastly different from O(1).
- namestr
Normally this does not need to be set; a default name will be generated automatically. Only use this if you have multiple DVCon objects and the constraint names need to be distinguished OR you are using this volume computation for something other than a direct constraint in pyOpt, i.e. it is required for a subsequent computation.
- addToPyOptbool
Normally this should be left at the default of True if the volume is to be used as a constraint. If the volume is to used in a subsequent calculation and not a constraint directly, addToPyOpt should be False, and name specified to a logical name for this computation. with addToPyOpt=False, the lower, upper and scale variables are meaningless
- compNameslist
If using DVGeometryMulti, the components to which the point set associated with this constraint should be added. If None, the point set is added to all components.
- addColinearityConstraint(origin, lineAxis, distances, upper=0.0, lower=0.0, scale=1.0, name=None, addToPyOpt=True, DVGeoName='default', compNames=None)[source]
Add a contraint to keep a set of points aligned. Define the origin, and axis of the line and then a set of distances along the axis to constrain. The constraint will compute the points to constrain.
- Parameters
- origin: vector
The coordinate of the origin (3x numpy array)
- lineAxis: vector
The line of colinearity (3x numpy array)
- distances: list
List of distances from origin to constrain
- lowerfloat
Lower bound for circularity. This is the ratio of the target length relative to the first length calculated
- upperfloat
Upper bound for optimization constraint. See lower.
- scalefloat
This is the optimization scaling of the constraint. Typically this parameter will not need to be changed. If scaled=True, this automatically results in a well-scaled constraint and scale can be left at 1.0. If scaled=False, it may changed to a more suitable value of the resulting physical volume magnitude is vastly different from O(1).
- namestr
Normally this does not need to be set; a default name will be generated automatically. Only use this if you have multiple DVCon objects and the constraint names need to be distinguished OR you are using this volume computation for something other than a direct constraint in pyOpt, i.e. it is required for a subsequent computation.
- addToPyOptbool
Normally this should be left at the default of True if the volume is to be used as a constraint. If the volume is to used in a subsequent calculation and not a constraint directly, addToPyOpt should be False, and name specified to a logical name for this computation. with addToPyOpt=False, the lower, upper and scale variables are meaningless
- compNameslist
If using DVGeometryMulti, the components to which the point set associated with this constraint should be added. If None, the point set is added to all components.
- addCompositeVolumeConstraint(vols, lower=1.0, upper=3.0, scaled=True, scale=1.0, name=None, addToPyOpt=True, DVGeoName='default')[source]
Add a composite volume constraint. This used previously added constraints and combines them to form a single volume constraint.
The general ussage is as follows:
DVCon.addVolumeConstraint(leList1, teList1, nSpan, nChord, name='part1', addToPyOpt=False) DVCon.addVolumeConstraint(leList2, teList2, nSpan, nChord, name='part2', addToPyOpt=False) DVCon.addCompositeVolumeConstraint(['part1', 'part2'], lower=1)
- Parameters
- volslist of strings
A list containing the names of the previously added volumes to be used.
- lowerfloat
The lower bound for the volume constraint.
- upperfloat
The upper bound for the volume constraint.
- scaledbool
Flag specifying whether or not the constraint is to be implemented in a scaled fashion or not.
scaled=True: The initial volume is defined to be 1.0. In this case, the lower and upper bounds are given in multiple of the initial volume. lower=0.85, upper=1.15, would allow for 15% change in volume both upper and lower. For aerodynamic optimization, this is the most widely used option .
scaled=False: No scaling is applied and the physical volume. lower and upper refer to the physical volumes.
- scalefloat
This is the optimization scaling of the constraint. Typically this parameter will not need to be changed. If scaled=True, this automatically results in a well-scaled constraint and scale can be left at 1.0. If scaled=False, it may changed to a more suitable value of the resulting physical volume magnitude is vastly different from O(1).
- namestr
Normally this does not need to be set; a default name will be generated automatically. Only use this if you have multiple DVCon objects and the constraint names need to be distinguished OR you are using this volume computation for something other than a direct constraint in pyOpt, i.e. it is required for a subsequent computation.
- addToPyOptbool
Normally this should be left at the default of True if the volume is to be used as a constraint. If the volume is to used in a subsequent calculation and not a constraint directly, addToPyOpt should be False, and name specified to a logical name for this computation. with addToPyOpt=False, the lower, upper and scale variables are meaningless
- addConstraintsPyOpt(optProb, exclude_wrt=None)[source]
Add all constraints to the optProb object. Only constraints the that have the addToPyOpt flags are actually added.
- Parameters
- optProbpyOpt_optimization object
Optimization description to which the constraints are added
Examples
>>> DVCon.addConstraintsPyOpt(optProb)
- addCurvatureConstraint(surfFile, curvatureType='Gaussian', lower=-1e+20, upper=1e+20, scaled=True, scale=1.0, KSCoeff=None, name=None, addToPyOpt=False, DVGeoName='default', compNames=None)[source]
Add a curvature contraint for the prescribed surface. The only required input for this constraint is a structured plot 3D file of the surface (there can be multiple surfaces in the file). This value is meant to be corelated with manufacturing costs.
- Parameters
- surfFile: vector
Plot3D file with desired surface, should be sufficiently refined to accurately capture surface curvature
- curvatureType: str
The type of curvature to calculate. Options are: ‘Gaussian’, ‘mean’, ‘combined’, or ‘KSmean’. Here the Gaussian curvature is K=kappa_1*kappa_2, the mean curvature is H = 0.5*(kappa_1+kappa_2), the combined curvature C = kappa_1^2+kappa_2^2=(2*H)^2-2*K, and the KSmean curvature applies the KS function to the mean curvature, which is essentially the max local mean curvature on the prescribed surface. In practice, we compute the squared integrated value over the surface, e.g., sum(H*H*dS), for the Gaussian, mean and combined curvatures. While for the KSmean, we applied the KS function, i.e., KS(H*H*dS)
- lowerfloat
Lower bound for curvature integral.
- upperfloat
Upper bound for optimization constraint. See lower.
- scalefloat
This is the optimization scaling of the constraint. Typically this parameter will not need to be changed. If scaled=True, this automatically results in a well-scaled constraint and scale can be left at 1.0. If scaled=False, it may changed to a more suitable value of the resulting physical volume magnitude is vastly different from O(1).
- scaledbool
Flag specifying whether or not the constraint is to be implemented in a scaled fashion or not.
scaled=True: The initial curvature is defined to be 1.0. In this case, the lower and upper bounds are given in multiple of the initial curvature. lower=0.85, upper=1.15, would allow for 15% change in curvature both upper and lower. For aerodynamic optimization, this is the most widely used option .
scaled=False: No scaling is applied and the physical curvature. lower and upper refer to the physical curvatures.
- KSCoefffloat
The coefficient for KS function when curvatureType=KSmean. This controls how close the KS function approximates the original functions. One should select a KSCoeff such that the printed “Reference curvature” is only slightly larger than the printed “Max curvature” for the baseline surface. The default value of KSCoeff is the number of points in the plot3D files.
- namestr
Normally this does not need to be set; a default name will be generated automatically. Only use this if you have multiple DVCon objects and the constraint names need to be distinguished OR you are using this volume computation for something other than a direct constraint in pyOpt, i.e. it is required for a subsequent computation.
- addToPyOptbool
Normally this should be left at the default of False if the cost is part of the objective. If the integral is to be used directly as a constraint, addToPyOpt should be True, and name specified to a logical name for this computation. with addToPyOpt=False, the lower, upper and scale variables are meaningless
- compNameslist
If using DVGeometryMulti, the components to which the point set associated with this constraint should be added. If None, the point set is added to all components.
- addCurvatureConstraint1D(start, end, nPts, axis, curvatureType='mean', lower=-1e+20, upper=1e+20, scaled=True, scale=1.0, KSCoeff=1.0, name=None, addToPyOpt=True, surfaceName='default', DVGeoName='default', compNames=None)[source]
Add a curvature contraint along the prescribed straightline on the design surface. This can be used to impose a spanwise curvature constraint for wing aerodynamic optimization. NOTE: the output is the square of the curvature to make sure the values are always positive
See below for a schematic.
Planform view of the wing: Physical extent of wing ____________________________________ | | | | | | | +---x--x---x---x---x---x---x---+ | | | | | | | |__________________________________/ The '+' are the (three dimensional) points defined by 'start' and 'end'. Once the straightline is defined, we generate nPts-2 intermediate points along it and project these points to the design surface mesh in the prescirbed axis direction. Here 'x' are the intermediate points added by setting nPts = 9. The curvature will be calculated based on the projected intermediate points (x) on the design surface. NOTE: we do not calculate the curvatures at the two end points (+). So make sure to extend the start and end points a bit to fully cover the area where you want to compute the curvature
- Parameters
- start/endlist of size 3
The 3D points forming a straight line along which the curvature constraints will be added.
- nPtsint
The number of intermediate points to add. We should prescribe nPts such that the point interval should be larger than the mesh size and smaller than the interval of FFD points in that direction
- axislist of size 3
The direction along which the projections will occur. Typically this will be y or z axis ([0,1,0] or [0,0,1]) NOTE: we also compute the curvature based on this axis dir
- curvatureTypestr
What type of curvature constraint to compute. Either mean or aggregated
- lowerfloat
Lower bound of curvature integral used for optimization constraint
- upperfloat
Upper bound of curvature integral used for optimization constraint
- scalefloat
This is the optimization scaling of the constraint. Typically this parameter will not need to be changed. If scaled=True, this automatically results in a well-scaled constraint and scale can be left at 1.0. If scaled=False, it may changed to a more suitable value of the resulting physical volume magnitude is vastly different from O(1).
- scaledbool
Flag specifying whether or not the constraint is to be implemented in a scaled fashion or not.
scaled=True: The initial curvature is defined to be 1.0. In this case, the lower and upper bounds are given in multiple of the initial curvature. lower=0.85, upper=1.15, would allow for 15% change in curvature both upper and lower. For aerodynamic optimization, this is the most widely used option .
scaled=False: No scaling is applied and the physical curvature. lower and upper refer to the physical curvatures.
- KSCoefffloat
The coefficient for KS function. This controls how close the KS function approximates the original functions.
- namestr
Normally this does not need to be set; a default name will be generated automatically. Only use this if you have multiple DVCon objects and the constraint names need to be distinguished OR you are using this volume computation for something other than a direct constraint in pyOpt, i.e. it is required for a subsequent computation.
- addToPyOptbool
Normally this should be left at the default of False if the cost is part of the objective. If the integral is to be used directly as a constraint, addToPyOpt should be True, and name specified to a logical name for this computation. with addToPyOpt=False, the lower, upper and scale variables are meaningless
- surfaceNamestr
Name of the surface to project to. This should be the same as the surfaceName provided when setSurface() was called. For backward compatibility, the name is ‘default’ by default.
- DVGeoNamestr
Name of the DVGeo object to compute the constraint with. You only need to set this if you’re using multiple DVGeo objects for a problem. For backward compatibility, the name is ‘default’ by default
- compNameslist
If using DVGeometryMulti, the components to which the point set associated with this constraint should be added. If None, the point set is added to all components.
Examples
# define a 2 point poly-line along the wing spanwise direction (z) # and project to the design surface along y >>> start = [0, 0, 0] >>> end = [0, 0, 1] >>> nPts = 10 >>> axis = [0, 1, 0] >>> DVCon.addCurvatureConstraint1D(start, end, nPts, axis, “mean”, lower=1.0, upper=3, scaled=True)
- addGearPostConstraint(wimpressCalc, position, axis, thickLower=1.0, thickUpper=3.0, thickScaled=True, MACFracLower=0.5, MACFracUpper=0.6, name=None, addToPyOpt=True, surfaceName='default', DVGeoName='default', compNames=None)[source]
Code for doing landing gear post constraints on the fly in an optimization. As it turns out, this is a critical constraint for wing-mounted landing gear and high-aspect ratio swept wings. This constraint actually encompasses two optimization constraints:
1. The first is a physical depth constraint that uses DVCon’s built in thickness constraint class.
2. The second constraint is that the x-position of the the gear post as a fraction of the wing MAC must be greater than MACFracLower which will typically be 50%.
The calculation uses a wimpressCalc object to determine the nominal trapezodial planform to determine the MAC and the LE-MAC.
- Parameters
- wimpressCalcwimpressCalc class
An instance of the wimpress calc class. This is required for computing the MAC and the xLEMac
- positionarray of size 3
Three dimensional position of the gear post constraint.
- axisarray of size 3
Direction to perform projection. Same as ‘axis’ in addThicknessConstraints1D
- thickLowerfloat
Lower bound for thickness constraint. If thickScaled=True, this is the physical distance scaled by the initial length. This value is used as the optimization constraint lower bound.
- thickUpperfloat
Upper bound for optimization constraint. See thickLower.
- thickScaledbool
Flag specifying if the constraint should be scaled. It is true by default. The default values of thickScaled=True, thickLower=1.0, ensures that the initial thickness does not decrease.
- MACFracLowerfloat
The desired lower bound for the gear post location as a fraction of MAC. Default is 0.50
- MACFracUpperfloat
The desired upper bound for the gear post location as a fraction of MAC. Default is 0.60
- namestr
Normally this does not need to be set. Only use this if you have multiple DVCon objects and the constraint names need to be distinguished or the values are to be used in a subsequent computation.
- addToPyOptbool
Normally this should be left at the default of True. If the values need to be processed (modified) BEFORE they are given to the optimizer, set this flag to False.
- compNameslist
If using DVGeometryMulti, the components to which the point set associated with this constraint should be added. If None, the point set is added to all components.
- addLERadiusConstraints(leList, nSpan, axis, chordDir, lower=1.0, upper=3.0, scaled=True, scale=1.0, name=None, addToPyOpt=True, surfaceName='default', DVGeoName='default', compNames=None)[source]
Add a set of leading edge radius constraints. The constraint is set up similar to the 1D thickness or thickness-to-chord constraints. The user provides a polyline near the leading edge and specifies how many locations should be sampled along the polyline. The sampled points are then projected to the upper and lower surface along the provided axis. A third projection is made to the leading edge along chordDir. We then compute the radius of the circle circumscribed by these three points.
In order for this radius calculation to be a reasonable approximation for the actual leading edge radius, it is critical that the polyline be drawn very close to the leading edge (less than 0.5% chord). We include a check to make sure that the points fall on the same hemisphere of the circumscribed circle, however we recommend that the user export the Tecplot view of the constraint using the writeTecplot function to verify that the circles do coincide with the leading edge radius.
See below for a schematic
Planform view of the wing: The '+' are the (three dimensional) points that are supplied in leList: Physical extent of wing \ __________________________\_________ | +-------+-----+-------+-----+ | | 5 points defining | | poly-line | | | | | | | |__________________________________/
- Parameters
- leListlist or array of size (N x 3) where N >=2
The list of points forming a poly-line along which the thickness constraints will be added.
- nSpanint
The number of thickness constraints to add
- axislist or array of length 3
The direction along which the up-down projections will occur. Typically this will be y or z axis ([0,1,0] or [0,0,1])
- chordDirlist or array or length 3
The vector pointing from the leList to the leading edge. This will typically be the negative xaxis ([-1,0,0]). The magnitude of the vector doesn’t matter, but the direction does.
- lowerfloat or array of size nSpan
The lower bound for the constraint. A single float will apply the same bounds to all constraints, while the array option will use different bounds for each constraint.
- upperfloat or array of size nSpan
The upper bound for the constraint. A single float will apply the same bounds to all constraints, while the array option will use different bounds for each constraint.
- scaledbool
Flag specifying whether or not the constraint is to be implemented in a scaled fashion or not.
scaled=True: The initial radius of each constraint is defined to be 1.0. In this case, the lower and upper bounds are given in multiples of the initial radius. lower=0.85, upper=1.15, would allow for 15% change in each direction from the original radius.
scaled=False: No scaling is applied and the physical radii must be specified for the lower and upper bounds.
- scalefloat or array of size nSpan
This is the optimization scaling of the constraint. Typically this parameter will not need to be changed. If the radius constraints are scaled, this already results in well-scaled constraint values, and scale can be left at 1.0. If scaled=False, it may be changed to a more suitable value if the resulting physical thickness have magnitudes vastly different than O(1).
- namestr
Normally this does not need to be set. Only use this if you have multiple DVCon objects and the constraint names need to be distinguished or you are using this set of thickness constraints for something other than a direct constraint in pyOptSparse.
- addToPyOptbool
Normally this should be left at the default of True. If the values need to be processed (modified) BEFORE they are given to the optimizer, set this flag to False.
- surfaceNamestr
Name of the surface to project to. This should be the same as the surfaceName provided when setSurface() was called. For backward compatibility, the name is ‘default’ by default.
- DVGeoNamestr
Name of the DVGeo object to compute the constraint with. You only need to set this if you’re using multiple DVGeo objects for a problem. For backward compatibility, the name is ‘default’ by default
- compNameslist
If using DVGeometryMulti, the components to which the point set associated with this constraint should be added. If None, the point set is added to all components.
- addLeTeConstraints(volID=None, faceID=None, topID=None, indSetA=None, indSetB=None, name=None, config=None, childIdx=None, comp=None, DVGeoName='default')[source]
Add a set of ‘leading edge’ or ‘trailing edge’ constraints to DVConstraints. These are just a particular form of linear constraints for shape variables. The need for these constraints arise when the shape variables can effectively emulate a ‘twist’ variable (actually a shearing twist). The purpose of these constraints is to make control points at the leading and trailing edge move in equal and opposite direction.
\[x_1 - x_2 = 0.0\]where \(x_1\) is the movement (in 1, 2, or 3 directions) of a control point on the top of the FFD and \(x_2\) is the control point on the bottom of the FFD.
There are two ways of specifying these constraints:
volID
andfaceID
Provide the index of the FFD block and the
faceID
(one ofilow
,ihigh
,jlow
,jhigh
,klow
, orkhigh
). This it the preferred approach. BothvolID
andfaceID
can be determined by examining the FFD file in TecPlot or ICEM. Use ‘prob data’ tool in TecPlot to click on the surface of which you want to put constraints on (e.g. the front or LE of FFD and the back surface or TE of the FFD). You will see which plane it coresponding to. For example, ‘I-Plane’ with I-index = 1 isiLow
.topID
provides a second input for blocks that have 2x2 faces.indSetA
andindSetB
Alternatively, two sets of indices can be provided. Both must be the same length. These indices may be obtained from the
lindex
array of the FFD object.>>> lIndex = DVGeo.getLocalIndex(iVol)
lIndex
is a three dimensional set of indices that provide the index into the global set of control points. See below for examples.
Note
These constraints will be added to pyOptSparse automatically with a call to
addConstraintsPyOpt()
- Parameters
- volIDint
Single integer specifying the volume index
- faceIDstr {‘iLow’, ‘iHigh’, ‘jLow’, ‘jHigh’, ‘kLow’, ‘kHigh’}
One of above specifying the node on which face to constrain.
- topIDstr {‘i’,’j’, ‘k’}
One of the above specifing the symmetry direction, should only be used on 2x2 faces
- indSetAarray of int
Indices of control points on one side of the FFD
- indSetBarray of int
Indices of control points on the other side of the FFD
- namestr
Normally this does not need to be set; a default name will be generated automatically. Only use this if you have multiple DVCon objects and the constraint names need to be distinguished
- configstr
The DVGeo configuration to apply this constraint to. Must be either None which will apply to ALL the local DV groups or a single string specifying a particular configuration.
- childIdxint
The zero-based index of the child FFD, if this constraint is being applied to a child FFD. The index is defined by the order in which you add the child FFD to the parent. For example, the first child FFD has an index of 0, the second an index of 1, and so on.
- comp: str
The component name if using DVGeometryMulti.
Examples
>>> # Preferred way: Constraints at the front and back (ifaces) of volume 0 >>> DVCon.addLeTeConstraints(0, 'iLow') >>> DVCon.addLeTeConstraints(0, 'iHigh') >>> # Alternative way -- this can be specialzed as required: >>> lIndex = DVGeo.getLocalIndex(1) # Volume 2 >>> indSetA = []; indSetB = []; >>> for k in range(4,7): # 4 on the leading edge >>> indSetA.append(lIndex[0, 0, k]) >>> indSetB.append(lIndex[0, 1, k]) >>> lIndex = DVGeo.getLocalIndex(4) # Volume 5 (different from LE) >>> for k in range(4,8): # 5 on the trailing edge >>> indSetA.append(lIndex[-1, 0, k]) >>> indSetB.append(lIndex[-1, 1, k]) >>> # Now add to DVCon >>> DVCon.addLeTeConstraints(0, indSetA, indSetB)
- addLinearConstraintsShape(indSetA, indSetB, factorA, factorB, lower=0, upper=0, name=None, config=None, childIdx=None, comp=None, DVGeoName='default')[source]
Add a complete generic set of linear constraints for the shape variables that have been added to DVGeo. The constraints are specified in the following general form:
lower <= factorA*dvA + factorB*dvB <= upper
The lists
indSetA
andindSetB
are used to specify the pairs of control points that are to be linked with linear variables. If more than one pair is specified (i.e.len(indSetA)=len(indSetB) > 1
) thenfactorA
,factorB
,lower
andupper
may all be arrays of the same length or a constant which will applied to all.Two sets of indices can be provided,
indSetA
andindSetB
. Both must be the same length. These indices may be obtained from thelindex
array of the FFD object.>>> lIndex = DVGeo.getLocalIndex(iVol)
lIndex
is a three dimensional set of indices that provide the index into the global set of control points. See below for examples.Note
These constraints will be added to pyOptSparse automatically with a call to
addConstraintsPyOpt()
.- Parameters
- indSetAarray of int
Indices of ‘A’ control points on one side of the FFD
- indSetBarray of int
Indices of ‘B’ control points on one side of the FFD
- factorAfloat or array
Coefficient for DV on control point(s) A
- factorBfloat or array
Coefficient for DV on control point(s) B
- lowerfloat or array
The lower bound of the constraint(s)
- upperfloat or array
The upper bound of the constraint(s)
- namestr
Normally this does not need to be set; a default name will be generated automatically. Only use this if you have multiple DVCon objects and the constraint names need to be distinguished
- configstr
The DVGeo configuration to apply this constraint to. Must be either None which will apply to ALL the local DV groups or a single string specifying a particular configuration.
- childIdxint
The zero-based index of the child FFD, if this constraint is being applied to a child FFD. The index is defined by the order in which you add the child FFD to the parent. For example, the first child FFD has an index of 0, the second an index of 1, and so on.
- comp: str
The component name if using DVGeometryMulti.
Examples
>>> # Make two sets of controls points move the same amount: >>> lIndex = DVGeo.getLocalIndex(1) # Volume 2 >>> indSetA = []; indSetB = []; >>> for i in range(lIndex.shape[0]): >>> indSetA.append(lIndex[i, 0, 0]) >>> indSetB.append(lIndex[i, 0, 1]) >>> DVCon.addLinearConstraintShape(indSetA, indSetB, >>> factorA=1.0, factorB=-1.0, >>> lower=0, upper=0)
- addLocationConstraints1D(ptList, nCon, lower=None, upper=None, scaled=False, scale=1.0, name=None, addToPyOpt=True, DVGeoName='default', compNames=None)[source]
Add a polyline in space that cannot move.
- Parameters
- ptListlist or array of size (N x 3) where N >=2
The list of points forming a poly-line along which the points will be fixed.
- nConint
The number of points constraints to add
- lowerfloat or array of size nCon
The lower bound for the constraint. A single float will apply the same bounds to all constraints, while the array option will use different bounds for each constraint. If no value is provided, the bounds will default to the points, giving equality constraints. Using the default is recommended.
- upperfloat or array of size nCon
The upper bound for the constraint. A single float will apply the same bounds to all constraints, while the array option will use different bounds for each constraint. If no value is provided, the bounds will default to the points, giving equality constraints. Using the default is recommended.
- scaledbool
Flag specifying whether or not the constraint is to be implemented in a scaled fashion or not.
scaled=True: The initial location of each location constraint is defined to be 1.0. In this case, the lower and upper bounds are given in multiple of the initial location. lower=0.85, upper=1.15, would allow for 15% change in each direction from the original location. However, for initial points close to zero this blows up, so this should be used with caution, therefore unscaled is the default.
scaled=False: No scaling is applied and the physical locations must be specified for the lower and upper bounds.
- scalefloat or array of size nCon
This is the optimization scaling of the constraint. Typically this parameter will not need to be changed. If the location constraints are scaled, this already results in well-scaled constraint values, and scale can be left at 1.0. If scaled=False, it may changed to a more suitable value if the resulting physical location have magnitudes vastly different than O(1).
- namestr
Normally this does not need to be set. Only use this if you have multiple DVCon objects and the constraint names need to be distinguished or you are using this set of location constraints for something other than a direct constraint in pyOptSparse.
- addToPyOptbool
Normally this should be left at the default of True. If the values need to be processed (modified) BEFORE they are given to the optimizer, set this flag to False.
- DVGeoNamestr
Name of the DVGeo object to compute the constraint with. You only need to set this if you’re using multiple DVGeo objects for a problem. For backward compatibility, the name is ‘default’ by default
- compNameslist
If using DVGeometryMulti, the components to which the point set associated with this constraint should be added. If None, the point set is added to all components.
- addMonotonicConstraints(key, slope=1.0, name=None, start=0, stop=-1, config=None, childIdx=None, comp=None, DVGeoName='default')[source]
- Parameters
- keystr
Name of the global design variable we are dealing with.
- slopefloat
- Direction of monotonic decrease
1.0 - from left to right along design variable vector -1.0 - from right to left along design variable vector
- namestr
Normally this does not need to be set; a default name will be generated automatically. Only use this if you have multiple DVCon objects and the constraint names need to be distinguished
- start/stop: int
This allows the user to specify a slice of the design variable to constrain if it is not desired to set a monotonic constraint on the entire vector. The start/stop indices are inclusive indices, so for a design variable vector [4, 3, 6.5, 2, -5.4, -1], start=1 and stop=4 would constrain [3, 6.5, 2, -5.4] to be a monotonic sequence.
- configstr
The DVGeo configuration to apply this constraint to. Must be either None which will apply to ALL the local DV groups or a single string specifying a particular configuration.
- childIdxint
The zero-based index of the child FFD, if this constraint is being applied to a child FFD. The index is defined by the order in which you add the child FFD to the parent. For example, the first child FFD has an index of 0, the second an index of 1, and so on.
- comp: str
The component name if using DVGeometryMulti.
Examples
>>> DVCon.addMonotonicConstraints('chords', 1.0)
- addPlanarityConstraint(origin, planeAxis, upper=0.0, lower=0.0, scale=1.0, name=None, addToPyOpt=True, surfaceName='default', DVGeoName='default', compNames=None)[source]
Add a contraint to keep the surface in set in DVCon planar Define the origin, and the plane axis. The constraint will enforce that all of the surface points lie on the plane.
- Parameters
- origin: vector
The coordinate of the origin
- planeAxis: vector
Vector defining the plane of interest
- lowerfloat
Lower bound for circularity. This is the ratio of the target length relative to the first length calculated
- upperfloat
Upper bound for optimization constraint. See lower.
- scalefloat
This is the optimization scaling of the constraint. Typically this parameter will not need to be changed. If scaled=True, this automatically results in a well-scaled constraint and scale can be left at 1.0. If scaled=False, it may changed to a more suitable value of the resulting physical volume magnitude is vastly different from O(1).
- namestr
Normally this does not need to be set; a default name will be generated automatically. Only use this if you have multiple DVCon objects and the constraint names need to be distinguished OR you are using this volume computation for something other than a direct constraint in pyOpt, i.e. it is required for a subsequent computation.
- addToPyOptbool
Normally this should be left at the default of True if the volume is to be used as a constraint. If the volume is to used in a subsequent calculation and not a constraint directly, addToPyOpt should be False, and name specified to a logical name for this computation. with addToPyOpt=False, the lower, upper and scale variables are meaningless
- compNameslist
If using DVGeometryMulti, the components to which the point set associated with this constraint should be added. If None, the point set is added to all components.
- addProjectedAreaConstraint(axis='y', lower=1.0, upper=3.0, scaled=True, scale=1.0, name=None, addToPyOpt=True, surfaceName='default', DVGeoName='default', compNames=None)[source]
Sum up the total surface area of the triangles included in the DVCon surface projected to a plane defined by “axis”.
- Parameters
- axisstr
The axis normal to the projection plane. (‘x’, ‘y’, or ‘z’)
- lowerfloat
The lower bound for the area constraint.
- upperfloat
The upper bound for the area constraint.
- scaledbool
Flag specifying whether or not the constraint is to be implemented in a scaled fashion or not.
scaled=True: The initial area is defined to be 1.0. In this case, the lower and upper bounds are given in multiple of the initial area. lower=0.85, upper=1.15, would allow for 15% change in area both upper and lower. For aerodynamic optimization, this is the most widely used option .
scaled=False: No scaling is applied and the physical area. lower and upper refer to the physical areas.
- scalefloat
This is the optimization scaling of the constraint. Typically this parameter will not need to be changed. If scaled=True, this automatically results in a well-scaled constraint and scale can be left at 1.0. If scaled=False, it may changed to a more suitable value of the resulting physical volume magnitude is vastly different from O(1).
- namestr
Normally this does not need to be set; a default name will be generated automatically. Only use this if you have multiple DVCon objects and the constraint names need to be distinguished OR you are using this volume computation for something other than a direct constraint in pyOpt, i.e. it is required for a subsequent computation.
- addToPyOptbool
Normally this should be left at the default of True if the volume is to be used as a constraint. If the volume is to used in a subsequent calculation and not a constraint directly, addToPyOpt should be False, and name specified to a logical name for this computation. with addToPyOpt=False, the lower, upper and scale variables are meaningless
- compNameslist
If using DVGeometryMulti, the components to which the point set associated with this constraint should be added. If None, the point set is added to all components.
- addProjectedLocationConstraints1D(ptList, nCon, axis, bias=0.5, lower=None, upper=None, scaled=False, scale=1.0, name=None, addToPyOpt=True, surfaceName='default', DVGeoName='default', compNames=None)[source]
This is similar to addLocationConstraints1D except that the actual poly line is determined by first projecting points on to the surface in a similar manner as addConstraints1D, and then taking the mid-point (or user specificed fraction) blend of the upper and lower surface locations.
- Parameters
- ptListlist or array of size (N x 3) where N >=2
The list of points from which to perform the projection
- nConint
The number of points constraints to add
- axislist or array of length 3
The direction along which the projections will occur. Typically this will be y or z axis ([0,1,0] or [0,0,1])
- biasfloat
The blending of the upper/lower surface points to use. Default is 0.5 which is the average. 0.0 cooresponds to taking the lower point, 1.0 the upper point.
- lowerfloat or array of size nCon
The lower bound for the constraint. A single float will apply the same bounds to all constraints, while the array option will use different bounds for each constraint. If no value is provided, the bounds will default to the points, giving equality constraints. Using the default is recommended.
- upperfloat or array of size nCon
The upper bound for the constraint. A single float will apply the same bounds to all constraints, while the array option will use different bounds for each constraint. If no value is provided, the bounds will default to the points, giving equality constraints. Using the default is recommended.
- scaledbool
Flag specifying whether or not the constraint is to be implemented in a scaled fashion or not.
scaled=True: The initial location of each location constraint is defined to be 1.0. In this case, the lower and upper bounds are given in multiple of the initial location. lower=0.85, upper=1.15, would allow for 15% change in each direction from the original location. However, for initial points close to zero this blows up, so this should be used with caution, therefore unscaled is the default.
scaled=False: No scaling is applied and the physical locations must be specified for the lower and upper bounds.
- scalefloat or array of size nCon
This is the optimization scaling of the constraint. Typically this parameter will not need to be changed. If the location constraints are scaled, this already results in well-scaled constraint values, and scale can be left at 1.0. If scaled=False, it may changed to a more suitable value if the resulting physical location have magnitudes vastly different than O(1).
- namestr
Normally this does not need to be set. Only use this if you have multiple DVCon objects and the constraint names need to be distinguished or you are using this set of location constraints for something other than a direct constraint in pyOptSparse.
- addToPyOptbool
Normally this should be left at the default of True. If the values need to be processed (modified) BEFORE they are given to the optimizer, set this flag to False.
- DVGeoNamestr
Name of the DVGeo object to compute the constraint with. You only need to set this if you’re using multiple DVGeo objects for a problem. For backward compatibility, the name is ‘default’ by default
- compNameslist
If using DVGeometryMulti, the components to which the point set associated with this constraint should be added. If None, the point set is added to all components.
- addSurfaceAreaConstraint(lower=1.0, upper=3.0, scaled=True, scale=1.0, name=None, addToPyOpt=True, surfaceName='default', DVGeoName='default', compNames=None)[source]
Sum up the total surface area of the triangles included in the DVCon surface
- Parameters
- lowerfloat
The lower bound for the area constraint.
- upperfloat
The upper bound for the area constraint.
- scaledbool
Flag specifying whether or not the constraint is to be implemented in a scaled fashion or not.
scaled=True: The initial area is defined to be 1.0. In this case, the lower and upper bounds are given in multiple of the initial area. lower=0.85, upper=1.15, would allow for 15% change in area both upper and lower. For aerodynamic optimization, this is the most widely used option .
scaled=False: No scaling is applied and the physical area. lower and upper refer to the physical areas.
- scalefloat
This is the optimization scaling of the constraint. Typically this parameter will not need to be changed. If scaled=True, this automatically results in a well-scaled constraint and scale can be left at 1.0. If scaled=False, it may changed to a more suitable value of the resulting physical volume magnitude is vastly different from O(1).
- namestr
Normally this does not need to be set; a default name will be generated automatically. Only use this if you have multiple DVCon objects and the constraint names need to be distinguished OR you are using this volume computation for something other than a direct constraint in pyOpt, i.e. it is required for a subsequent computation.
- addToPyOptbool
Normally this should be left at the default of True if the volume is to be used as a constraint. If the volume is to used in a subsequent calculation and not a constraint directly, addToPyOpt should be False, and name specified to a logical name for this computation. with addToPyOpt=False, the lower, upper and scale variables are meaningless
- compNameslist
If using DVGeometryMulti, the components to which the point set associated with this constraint should be added. If None, the point set is added to all components.
- addThicknessConstraints1D(ptList, nCon, axis, lower=1.0, upper=3.0, scaled=True, scale=1.0, name=None, addToPyOpt=True, surfaceName='default', DVGeoName='default', compNames=None)[source]
Add a set of thickness constraints oriented along a poly-line.
See below for a schematic
Planform view of the wing: The '+' are the (three dimensional) points that are supplied in ptList: Physical extent of wing \ __________________________\_________ | + | | -/ | | / | | +-------+-----+ | | 4-points defining | | poly-line | | | |__________________________________/
- Parameters
- ptListlist or array of size (N x 3) where N >=2
The list of points forming a poly-line along which the thickness constraints will be added.
- nConint
The number of thickness constraints to add
- axislist or array of length 3
The direction along which the projections will occur. Typically this will be y or z axis ([0,1,0] or [0,0,1])
- lowerfloat or array of size nCon
The lower bound for the constraint. A single float will apply the same bounds to all constraints, while the array option will use different bounds for each constraint.
- upperfloat or array of size nCon
The upper bound for the constraint. A single float will apply the same bounds to all constraints, while the array option will use different bounds for each constraint.
- scaledbool
Flag specifying whether or not the constraint is to be implemented in a scaled fashion or not.
scaled=True: The initial length of each thickness constraint is defined to be 1.0. In this case, the lower and upper bounds are given in multiple of the initial length. lower=0.85, upper=1.15, would allow for 15% change in each direction from the original length. For aerodynamic shape optimizations, this option is used most often.
scaled=False: No scaling is applied and the physical lengths must be specified for the lower and upper bounds.
- scalefloat or array of size nCon
This is the optimization scaling of the constraint. Typically this parameter will not need to be changed. If the thickness constraints are scaled, this already results in well-scaled constraint values, and scale can be left at 1.0. If scaled=False, it may changed to a more suitable value of the resulting physical thickness have magnitudes vastly different than O(1).
- namestr
Normally this does not need to be set. Only use this if you have multiple DVCon objects and the constraint names need to be distinguished or you are using this set of thickness constraints for something other than a direct constraint in pyOptSparse.
- addToPyOptbool
Normally this should be left at the default of True. If the values need to be processed (modified) BEFORE they are given to the optimizer, set this flag to False.
- surfaceNamestr
Name of the surface to project to. This should be the same as the surfaceName provided when setSurface() was called. For backward compatibility, the name is ‘default’ by default.
- DVGeoNamestr
Name of the DVGeo object to compute the constraint with. You only need to set this if you’re using multiple DVGeo objects for a problem. For backward compatibility, the name is ‘default’ by default
- compNameslist
If using DVGeometryMulti, the components to which the point set associated with this constraint should be added. If None, the point set is added to all components.
- addThicknessConstraints2D(leList, teList, nSpan, nChord, lower=1.0, upper=3.0, scaled=True, scale=1.0, name=None, addToPyOpt=True, surfaceName='default', DVGeoName='default', compNames=None)[source]
Add a set of thickness constraints that span a logically a two-dimensional region. A little ASCII art can help here
Planform view of the wing: The '+' are the (three dimensional) points that are supplied in leList and teList. The 'o' is described below. Physical extent of wing \ __________________________\_________ | | +-----------+--o-----------+ | | / \ | | leList teList \ | | \ \ | +------------------------------+ | | | |__________________________________/
Things to consider:
The region given by leList and teList must lie completely inside the wing
The number of points in leList and teList do not need to be the same length.
The leading and trailing edges are approximated using 2-order splines (line segments) and nSpan points are interpolated in a linear fashion. For integer nSpan, the thickness constraint may not correspond EXACTLY to intermediate locations in leList and teList. In the example above, with len(leList)=3 and nSpan=3, the three thickness constraints on the leading edge of the 2D domain would be at the left and right boundaries, and at the point denoted by ‘o’ which is equidistant between the root and tip. To match intermediate locations exactly, pass a list for nSpan.
If a curved leading or trailing edge domain is desired, simply pass in lists for leList and teList with a sufficient number of points that can be approximated with straight line segments.
The two-dimensional data is projected onto the surface along the normals of the ruled surface formed by leList and teList
Normally, leList and teList are in given such that the the two curves entirely lie in a plane. This ensure that the projection vectors are always exactly normal to this plane.
If the surface formed by leList and teList is NOT precisely normal, issues can arise near the end of an opensurface (ie root of a single wing) which can result in failing intersections.
- Parameters
- leListlist or array
A list or array of points (size should be (Nx3) where N is at least 2) defining the ‘leading edge’ or the start of the domain.
- teListlist or array
Same as leList but for the trailing edge.
- nSpanint or list of int
The number of thickness constraints to be (linear) interpolated along the leading and trailing edges. A list of length N-1 can be used to specify the number for each segment defined by leList and teList and precisely match intermediate locations.
- nChordint
The number of thickness constraints to be (linearly) interpolated between the leading and trailing edges.
- lowerfloat or array of size (nSpan x nChord)
The lower bound for the constraint. A single float will apply the same bounds to all constraints, while the array option will use different bounds for each constraint.
- upperfloat or array of size (nSpan x nChord)
The upper bound for the constraint. A single float will apply the same bounds to all constraints, while the array option will use different bounds for each constraint.
- scaledbool
Flag specifying whether or not the constraint is to be implemented in a scaled fashion or not.
scaled=True: The initial length of each thickness constraint is defined to be 1.0. In this case, the lower and upper bounds are given in multiple of the initial length. lower=0.85, upper=1.15, would allow for 15% change in each direction from the original length. For aerodynamic shape optimizations, this option is used most often.
scaled=False: No scaling is applied and the physical lengths must be specified for the lower and upper bounds.
- scalefloat or array of size (nSpan x nChord)
This is the optimization scaling of the constraint. Typically this parameter will not need to be changed. If the thickness constraints are scaled, this already results in well-scaled constraint values, and scale can be left at 1.0. If scaled=False, it may changed to a more suitable value of the resulting physical thickness have magnitudes vastly different than O(1).
- namestr
Normally this does not need to be set. Only use this if you have multiple DVCon objects and the constraint names need to be distinguished or the values are to be used in a subsequent computation.
- addToPyOptbool
Normally this should be left at the default of True. If the values need to be processed (modified) BEFORE they are given to the optimizer, set this flag to False.
- surfaceNamestr
Name of the surface to project to. This should be the same as the surfaceName provided when setSurface() was called. For backward compatibility, the name is ‘default’ by default.
- DVGeoNamestr
Name of the DVGeo object to compute the constraint with. You only need to set this if you’re using multiple DVGeo objects for a problem. For backward compatibility, the name is ‘default’ by default
- compNameslist
If using DVGeometryMulti, the components to which the point set associated with this constraint should be added. If None, the point set is added to all components.
Examples
>>> # Take unique square in x-z plane and and 10 along z-direction (spanWise) >>> # and the along x-direction (chordWise) >>> leList = [[0, 0, 0], [0, 0, 1]] >>> teList = [[1, 0, 0], [0, 0, 1]] >>> DVCon.addThicknessConstraints2D(leList, teList, 10, 3, lower=1.0, scaled=True)
- addThicknessToChordConstraints1D(ptList, nCon, axis, chordDir, lower=1.0, upper=3.0, scale=1.0, name=None, addToPyOpt=True, surfaceName='default', DVGeoName='default', compNames=None)[source]
Add a set of thickness-to-chord ratio constraints oriented along a poly-line.
See below for a schematic
Planform view of the wing: The '+' are the (three dimensional) points that are supplied in ptList: Physical extent of wing \ __________________________\_________ | + | | -/ | | / | | +-------+-----+ | | 4-points defining | | poly-line | | | |__________________________________/
- Parameters
- ptListlist or array of size (N x 3) where N >=2
The list of points forming a poly-line along which the thickness constraints will be added.
- nConint
The number of thickness to chord ratio constraints to add
- axislist or array of length 3
The direction along which the projections will occur. Typically this will be y or z axis ([0,1,0] or [0,0,1])
- chordDirlist or array or length 3
The direction defining “chord”. This will typically be the xasis ([1,0,0]). The magnitude of the vector doesn’t matter.
- lowerfloat or array of size nCon
The lower bound for the constraint. A single float will apply the same bounds to all constraints, while the array option will use different bounds for each constraint. This constraint can only be used in “scaled” mode. That means, the actual t/c is NEVER computed. This constraint can only be used to constrain the relative change in t/c. A lower bound of 1.0, therefore mean the t/c cannot decrease. This is the typical use of this constraint.
- upperfloat or array of size nCon
The upper bound for the constraint. A single float will apply the same bounds to all constraints, while the array option will use different bounds for each constraint.
- scalefloat or array of size nCon
This is the optimization scaling of the constraint. Typically this parameter will not need to be changed. If the thickness constraints are scaled, this already results in well-scaled constraint values, and scale can be left at 1.0. If scaled=False, it may changed to a more suitable value of the resulting physical thickness have magnitudes vastly different than O(1).
- namestr
Normally this does not need to be set. Only use this if you have multiple DVCon objects and the constraint names need to be distinguished or you are using this set of thickness constraints for something other than a direct constraint in pyOptSparse.
- addToPyOptbool
Normally this should be left at the default of True. If the values need to be processed (modified) BEFORE they are given to the optimizer, set this flag to False.
- DVGeoNamestr
Name of the DVGeo object to compute the constraint with. You only need to set this if you’re using multiple DVGeo objects for a problem. For backward compatibility, the name is ‘default’ by default
- compNameslist
If using DVGeometryMulti, the components to which the point set associated with this constraint should be added. If None, the point set is added to all components.
- addTriangulatedSurfaceConstraint(surface_1_name=None, DVGeo_1_name='default', surface_2_name='default', DVGeo_2_name='default', rho=50.0, heuristic_dist=None, perim_scale=0.1, max_perim=3.0, name=None, scale=1.0, addToPyOpt=True)[source]
Add a single triangulated surface constraint to an aerosurface. This constraint is designed to keep a general ‘blob’ of watertight geometry contained within an aerodynamic hull (e.g., a wing)
- Parameters
- surface_1_namestr
The name of the first triangulated surface to constrain. This should be the surface with the larger number of triangles. By default, it’s the ADflow triangulated surface mesh.
- DVGeo_1_namestr
The name of the DVGeo object to associate surface_1 to. If None, surface_1 will remain static during optimization. By default, it’s the ‘default’ DVGeo object
- surface_2_namestr
The name of the second triangulated surface to constrain. This should be the surface with the smaller number of triangles.
- DVGeo_2_namestr
The name of the DVGeo object to associate surface_2 to. If None, surface_2 will remain static during optimization. By default, it’s the ‘default’ DVGeo object
- rhofloat
The rho factor of the KS function of min distance.
- heuristic_distfloat
The triangulated surface constraint uses a procedure to skip pairs of facets that are farther apart than a heuristic distance in order to save computation time. By default, this is set to the maximum linear dimension of the second object’s bounding box. You can set this to a large number to compute an “exact” KS.
- perim_scalefloat
Apply a scaling factor to the intersection perimeter length.
- max_perimfloat
Maximum allowable intersection length before fail flag is returned
- namestr
Normally this does not need to be set; a default name will be generated automatically. Only use this if you have multiple DVCon objects and the constraint names need to be distinguished OR you are using this computation for something other than a direct constraint in pyOpt, i.e. it is required for a subsequent computation.
- scalefloat
This is the optimization scaling of the constraint. It may changed to a more suitable value of the resulting physical volume magnitude is vastly different from O(1).
- addToPyOptbool
Normally this should be left at the default of True if this is to be used as a constraint. If this to used in a subsequent calculation and not a constraint directly, addToPyOpt should be False, and name specified to a logical name for this computation. with addToPyOpt=False, the lower, upper and scale variables are meaningless
- addTriangulatedVolumeConstraint(lower=1.0, upper=99999.0, scaled=True, scale=1.0, name=None, surfaceName='default', DVGeoName='default', addToPyOpt=True)[source]
Add a single triangulated volume constraint to a surface. Computes and constrains the volume of a closed, triangulated surface. The surface normals must ALL be outward-oriented! This is typical for most stl files but should be verified in a program like Meshmixer.
- Parameters
- lowerfloat
The lower bound for the volume constraint.
- upperfloat
The upper bound for the volume constraint.
- scaledbool
Flag specifying whether or not the constraint is to be implemented in a scaled fashion or not.
scaled=True: The initial volume is defined to be 1.0. In this case, the lower and upper bounds are given in multiple of the initial volume. lower=0.85, upper=1.15, would allow for 15% change in volume both upper and lower. For aerodynamic optimization, this is the most widely used option .
scaled=False: No scaling is applied and the physical volume. lower and upper refer to the physical volumes.
- scalefloat
This is the optimization scaling of the constraint. Typically this parameter will not need to be changed. If scaled=True, this automatically results in a well-scaled constraint and scale can be left at 1.0. If scaled=False, it may changed to a more suitable value of the resulting physical volume magnitude is vastly different from O(1).
- namestr
Normally this does not need to be set; a default name will be generated automatically. Only use this if you have multiple DVCon objects and the constraint names need to be distinguished OR you are using this volume computation for something other than a direct constraint in pyOpt, i.e. it is required for a subsequent computation.
- surfaceNamestr
Name the triangulated surface attached to DVConstraints which should be used for the constraint. ‘default’ uses the main aerodynamic surface mesh
- DVGeoNamestr
Name the DVGeo object affecting the geometry of the surface. ‘default’ uses the main DVGeo object of the DVConstraints instance
- addToPyOptbool
Normally this should be left at the default of True if the volume is to be used as a constraint. If the volume is to used in a subsequent calculation and not a constraint directly, addToPyOpt should be False, and name specified to a logical name for this computation. with addToPyOpt=False, the lower, upper and scale variables are meaningless
- addVariablesPyOpt(optProb)[source]
Add all constraint variables to the optProb object.
- Parameters
- optProbpyOpt_optimization object
Optimization description to which the constraints are added
Examples
>>> DVCon.addVariablesPyOpt(optProb)
- addVolumeConstraint(leList, teList, nSpan, nChord, lower=1.0, upper=3.0, scaled=True, scale=1.0, name=None, addToPyOpt=True, surfaceName='default', DVGeoName='default', compNames=None)[source]
Add a single volume constraint to the wing. The volume constraint is defined over a logically two-dimensional region as shown below
Planform view of the wing: The '+' are the (three dimensional) points that are supplied in leList and teList. Physical extent of wing \ __________________________\_________ | | +--------------------------+ | | / (Volume in here) \ | | leList teList \ | | \ \ | +------------------------------+ | | | |__________________________________/
The region defined by the ‘—-’ boundary in the figure above will be meshed with nSpan x nChord points to form a 2D domain and then projected up and down onto the surface to form 3D hexahedral volumes. The accuracy of the volume computation depends on how well these linear hexahedral volumes approximate the (assumed) continuous underlying surface.
See addThicknessConstraints2D for additional information.
- Parameters
- leListlist or array
A list or array of points (size should be (Nx3) where N is at least 2) defining the ‘leading edge’ or the start of the domain.
- teListlist or array
Same as leList but for the trailing edge.
- nSpanint or list of int
The number of projected points to be (linear) interpolated along the leading and trailing edges. A list of length N-1 can be used to specify the number for each segment defined by leList and teList and precisely match intermediate locations.
- nChordint
The number of projected points to be (linearly) interpolated between the leading and trailing edges.
- lowerfloat
The lower bound for the volume constraint.
- upperfloat
The upper bound for the volume constraint.
- scaledbool
Flag specifying whether or not the constraint is to be implemented in a scaled fashion or not.
scaled=True: The initial volume is defined to be 1.0. In this case, the lower and upper bounds are given in multiple of the initial volume. lower=0.85, upper=1.15, would allow for 15% change in volume both upper and lower. For aerodynamic optimization, this is the most widely used option .
scaled=False: No scaling is applied and the physical volume. lower and upper refer to the physical volumes.
- scalefloat
This is the optimization scaling of the constraint. Typically this parameter will not need to be changed. If scaled=True, this automatically results in a well-scaled constraint and scale can be left at 1.0. If scaled=False, it may changed to a more suitable value of the resulting physical volume magnitude is vastly different from O(1).
- namestr
Normally this does not need to be set; a default name will be generated automatically. Only use this if you have multiple DVCon objects and the constraint names need to be distinguished OR you are using this volume computation for something other than a direct constraint in pyOpt, i.e. it is required for a subsequent computation.
- addToPyOptbool
Normally this should be left at the default of True if the volume is to be used as a constraint. If the volume is to used in a subsequent calculation and not a constraint directly, addToPyOpt should be False, and name specified to a logical name for this computation. with addToPyOpt=False, the lower, upper and scale variables are meaningless
- surfaceNamestr
Name of the surface to project to. This should be the same as the surfaceName provided when setSurface() was called. For backward compatibility, the name is ‘default’ by default.
- DVGeoNamestr
Name of the DVGeo object to compute the constraint with. You only need to set this if you’re using multiple DVGeo objects for a problem. For backward compatibility, the name is ‘default’ by default
- compNameslist
If using DVGeometryMulti, the components to which the point set associated with this constraint should be added. If None, the point set is added to all components.
- evalFunctions(funcs, includeLinear=False, config=None)[source]
Evaluate all the ‘functions’ that this object has. Of course, these functions are usually just the desired constraint values. These values will be set directly into the funcs dictionary.
- Parameters
- funcsdict
Dictionary into which the function values are placed.
- includeLeTebool
Flag to include Leading/Trailing edge constraints. Normally this can be false since pyOptSparse does not need linear constraints to be returned.
- evalFunctionsSens(funcsSens, includeLinear=False, config=None)[source]
Evaluate the derivative of all the ‘functions’ that this object has. These functions are just the constraint values. These values will be set directly in the funcSens dictionary.
- Parameters
- funcSensdict
Dictionary into which the sensitivities are added.
- includeLeTebool
Flag to include Leading/Trailing edge constraints. Normally this can be false since pyOptSparse does not need linear constraints to be returned.
- setDVGeo(DVGeo, name='default')[source]
Set the DVGeometry object that will manipulate this object. Note that DVConstraints doesn’t strictly need a DVGeometry object set, but if optimization is desired it is required.
- Parameters
- dvGeoA DVGeometry object.
Object responsible for manipulating the constraints that this object is responsible for.
Examples
>>> dvCon.setDVGeo(DVGeo)
- setDesignVars(dvDict)[source]
Standard routine for setting design variables from a design variable dictionary.
- Parameters
- dvDictdict
Dictionary of design variables. The keys of the dictionary must correspond to the design variable names. Any additional keys in the dfvdictionary are simply ignored.
- setSurface(surf, name='default', addToDVGeo=False, DVGeoName='default', surfFormat='point-vector')[source]
Set the surface DVConstraints will use to perform projections.
- Parameters
- surfpyGeo object or list or str
The triangulated surface representation to use for projections. There are a few possible ways of defining a surface. 1) A pyGeo surface object. surfFormat must be “point-vector”. 2) List of [p0, v1, v2] with surfFormat “point-vector”. 3) List of [p0, p1, p2] with surfFormat “point-point”. 4) Path to a PLOT3D surface file. surfFormat must be “point-vector”.
Option 2 is the most common, where the list is computed by an AeroSolver like ADflow.
- addToDVGeobool
Flag to embed the surface point set in a DVGeo object. If True, DVGeoName must be set appropriately.
- namestr
Name associated with the surface. Must be unique. For backward compatibility, the name is ‘default’ by default
- DVGeoNamestr
Name of the DVGeo object to set the surface to. You only need to set this if you’re using multiple DVGeo objects for a problem. For backward compatibility, the name is ‘default’ by default
- surfFormatstr
The surface format. Either “point-vector” or “point-point”. See surf for details.
Examples
>>> CFDsolver = ADFLOW(comm=comm, options=aeroOptions) >>> surf = CFDsolver.getTriangulatedMeshSurface() >>> DVCon.setSurface(surf) >>> # Or using a pyGeo surface object: >>> surf = pyGeo('iges',fileName='wing.igs') >>> DVCon.setSurface(surf)
- writeSurfaceSTL(fileName, surfaceName='default', fromDVGeo=None)[source]
Write the triangulated surface mesh to a .STL file for manipulation and visualization.
- Parameters
- fileNamestr
File name for stl file. Should have a .stl extension.
- surfaceNamestr
Which DVConstraints surface to write to file (default is ‘default’)
- fromDVGeostr or None
Name of the DVGeo object to obtain the surface from (default is ‘None’)
- writeSurfaceTecplot(fileName, surfaceName='default')[source]
Write the triangulated surface mesh used in the constraint object to a tecplot file for visualization.
- Parameters
- fileNamestr
File name for tecplot file. Should have a .dat extension.
- surfaceNamestr
Which DVConstraints surface to write to file (default is ‘default’)
- writeTecplot(fileName)[source]
This function writes a visualization file for constraints. All currently added constraints are written to a tecplot. This is useful for publication purposes as well as determine if the constraints are actually what the user expects them to be.
- Parameters
- fileNamestr
File name for tecplot file. Should have a .dat extension or a .dat extension will be added automatically.