DVGeometryMulti
- class pygeo.parameterization.DVGeoMulti.DVGeometryMulti(comm=mpi4py.MPI.COMM_WORLD, checkDVs=True, debug=False, isComplex=False)[source]
A class for manipulating multiple components using multiple FFDs and handling design changes near component intersections.
- Parameters
- commMPI.IntraComm, optional
The communicator associated with this geometry object.
- checkDVsbool, optional
Flag to check whether there are duplicate DV names in or across components.
- debugbool, optional
Flag to generate output useful for debugging the intersection setup.
- isComplexbool, optional
Flag to use complex variables for complex step verification.
- addComponent(comp, DVGeo, triMesh=None, scale=1.0, bbox=None, pointSetKwargs=None)[source]
Method to add components to the DVGeometryMulti object.
- Parameters
- compstr
The name of the component.
- DVGeoDVGeometry
The DVGeometry object defining the component FFD.
- triMeshstr, optional
Path to the triangulated mesh file for this component.
- scalefloat, optional
A multiplicative scaling factor applied to the triangulated mesh coordinates. Useful for when the scales of the triangulated and CFD meshes do not match.
- bboxdict, optional
Specify a bounding box that is different from the bounds of the FFD. The keys can include
xmin
,xmax
,ymin
,ymax
,zmin
,zmax
. If any of these are not provided, the FFD bound is used.- pointSetKwargsdict, optional
Keyword arguments to be passed to the component addPointSet call for the triangulated mesh.
- addIntersection(compA, compB, dStarA=0.2, dStarB=0.2, featureCurves=None, distTol=1e-14, project=False, marchDir=1, includeCurves=False, intDir=None, curveEpsDict=None, trackSurfaces=None, excludeSurfaces=None, remeshBwd=True, anisotropy=[1.0, 1.0, 1.0])[source]
Method that defines intersections between components.
- Parameters
- compAstr
The name of the first component.
- compBstr
The name of the second component.
- dStarAfloat, optional
Distance from the intersection over which the inverse-distance deformation is applied on compA.
- dStarBfloat, optional
Distance from the intersection over which the inverse-distance deformation is applied on compB.
- featureCurveslist or dict, optional
Points on feature curves will remain on the same curve after deformations and projections. Feature curves can be specified as a list of curve names. In this case, the march direction for all curves is
marchDir
. Alternatively, a dictionary can be provided. In this case, the keys are the curve names and the values are the march directions for each curve. SeemarchDir
for the definition of march direction.- distTolfloat, optional
Distance tolerance to merge nearby nodes in the intersection curve.
- projectbool, optional
Flag to specify whether to project points to curves and surfaces after the deformation step.
- marchDirint, optional
The side of the intersection where the feature curves are remeshed. The sign determines the direction and the value (1, 2, 3) specifies the axis (x, y, z). If
remeshBwd
is True, the other side is also remeshed. In this case, the march direction only serves to define the ‘free end’ of the feature curve. If None, the entire curve is remeshed. This argument is only used if a list is provided forfeatureCurves
.- includeCurvesbool, optional
Flag to specify whether to include features curves in the inverse-distance deformation.
- intDirint, optional
If there are multiple intersection curves, this specifies which curve to choose. The sign determines the direction and the value (1, 2, 3) specifies the axis (x, y, z). For example, -1 specifies the intersection curve as the one that is further in the negative x-direction.
- curveEpsDictdict, optional
Required if using feature curves. The keys of the dictionary are the curve names and the values are distances. All points within the specified distance from the curve are considered to be on the curve.
- trackSurfacesdict, optional
Points on tracked surfaces will remain on the same surfaces after deformations and projections. The keys of the dictionary are the surface names and the values are distances. All points within the specified distance from the surface are considered to be on the surface.
- excludeSurfacesdict, optional
Points on excluded surfaces are removed from the intersection computations. The keys of the dictionary are the surface names and the values are distances. All points within the specified distance from the surface are considered to be on the surface.
- remeshBwdbool, optional
Flag to specify whether to remesh feature curves on the side opposite that which is specified by the march direction.
- anisotropylist of float, optional
List with three entries specifying scaling factors in the [x, y, z] directions. The factors multiply the [x, y, z] distances used in the curve-based deformation. Smaller factors in a certain direction will amplify the effect of the parts of the curve that lie in that direction from the points being warped. This tends to increase the mesh quality in one direction at the expense of other directions. This can be useful when the initial intersection curve is skewed.
- addPointSet(points, ptName, compNames=None, comm=None, applyIC=False, **kwargs)[source]
Add a set of coordinates to DVGeometryMulti. The is the main way that geometry, in the form of a coordinate list, is manipulated.
- Parameters
- pointsarray, size (N,3)
The coordinates to embed. These coordinates should all be inside at least one FFD volume.
- ptNamestr
A user supplied name to associate with the set of coordinates. This name will need to be provided when updating the coordinates or when getting the derivatives of the coordinates.
- compNameslist, optional
A list of component names that this point set should be added to. To ease bookkeepping, an empty point set with ptName will be added to components not in this list. If a list is not provided, this point set is added to all components.
- commMPI.IntraComm, optional
Comm that is associated with the added point set. Does not work now, just added to be consistent with the API of other DVGeo types.
- applyICbool, optional
Flag to specify whether this point set will follow the updated intersection curve(s). This is typically only needed for the CFD surface mesh.
- addVariablesPyOpt(optProb, globalVars=True, localVars=True, sectionlocalVars=True, ignoreVars=None, freezeVars=None, comps=None)[source]
Add the current set of variables to the optProb object.
- Parameters
- optProbpyOpt_optimization class
Optimization problem definition to which variables are added
- globalVarsbool
Flag specifying whether global variables are to be added
- localVarsbool
Flag specifying whether local variables are to be added
- ignoreVarslist of strings
List of design variables the user doesn’t want to use as optimization variables.
- freezeVarslist of string
List of design variables the user wants to add as optimization variables, but to have the lower and upper bounds set at the current variable. This effectively eliminates the variable, but it the variable is still part of the optimization.
- compslist
List of components we want to add the DVs of. If no list is provided, we will add DVs from all components.
- getLocalIndex(iVol, comp)[source]
Return the local index mapping that points to the global coefficient list for a given volume.
- Parameters
- iVolint
Index specifying the FFD volume.
- compstr
Name of the component.
- getValues()[source]
Generic routine to return the current set of design variables. Values are returned in a dictionary format that would be suitable for a subsequent call to setDesignVars().
- Returns
- dvDictdict
Dictionary of design variables.
- getVarNames(pyOptSparse=False)[source]
Return a list of the design variable names. This is typically used when specifying a
wrt=
argument for pyOptSparse.Examples
>>> optProb.addCon(.....wrt=DVGeo.getVarNames())
- pointSetUpToDate(ptSetName)[source]
This is used externally to query if the object needs to update its point set or not. When update() is called with a point set, the self.updated value for pointSet is flagged as True. We reset all flags to False when design variables are set because nothing (in general) will up to date anymore. Here we just return that flag.
- Parameters
- ptSetNamestr
The name of the pointset to check.
- 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 dictionary are simply ignored.
- totalSensitivity(dIdpt, ptSetName, comm=None, config=None)[source]
This function computes sensitivity information.
Specificly, it computes the following: \(\frac{dX_{pt}}{dX_{DV}}^T \frac{dI}{d_{pt}}\)
- Parameters
- dIdptarray of size (Npt, 3) or (N, Npt, 3)
This is the total derivative of the objective or function of interest with respect to the coordinates in ‘ptSetName’. This can be a single array of size (Npt, 3) or a group of N vectors of size (Npt, 3, N). If you have many to do, it is faster to do many at once.
- ptSetNamestr
The name of set of points we are dealing with
- commMPI.IntraComm, optional
The communicator to use to reduce the final derivative. If comm is None, no reduction takes place.
- configstr or list, optional
Define what configurations this design variable will be applied to Use a string for a single configuration or a list for multiple configurations. The default value of None implies that the design variable appies to ALL configurations.
- Returns
- dIdxDictdict
The dictionary containing the derivatives, suitable for pyOptSparse.
Notes
The
child
andnDVStore
options are only used internally and should not be changed by the user.
- update(ptSetName, config=None)[source]
This is the main routine for returning coordinates that have been updated by design variables. Multiple configs are not supported.
- Parameters
- ptSetNamestr
Name of point set to return. This must match one of those added in an
addPointSet()
call.