DVGeometryVSP
- class pygeo.parameterization.DVGeoVSP.DVGeometryVSP(fileName, comm=mpi4py.MPI.COMM_WORLD, scale=1.0, comps=[], projTol=0.01)[source]
A class for manipulating OpenVSP geometry. The purpose of the DVGeometryVSP class is to provide translation of the VSP geometry engine to externally supplied surfaces. This allows the use of VSP design variables to control the MACH framework.
There are several important limitations:
Since VSP is volume-based, it cannot be used to parameterize a geometry that does not lie within a VSP body.
It cannot handle moving intersections. A geometry with static intersections is fine as long as the intersection doesn’t move
It does not support complex numbers for the complex-step method.
It does not support separate configurations.
Because OpenVSP does not provide sensitivities, this class uses parallel finite differencing to obtain the required Jacobian matrices.
- Parameters
- fileNamestr
filename of .vsp3 file.
- commMPI Intra Comm
Comm on which to build operate the object. This is used to perform embarrassingly parallel finite differencing. Defaults to MPI.COMM_WORLD.
- scalefloat
A global scale factor from the VSP geometry to incoming (CFD) mesh geometry. For example, if the VSP model is in inches, and the CFD in meters, scale=0.0254.
- compslist of strings
A list of string defining the subset of the VSP components to use when exporting the P3D surface files
Examples
- The general sequence of operations for using DVGeometry is as follows:
>>> from pygeo import * >>> DVGeo = DVGeometryVSP("wing.vsp3", MPI_COMM_WORLD) >>> # Add a set of coordinates Xpt into the object >>> DVGeo.addPointSet(Xpt, 'myPoints') >>>
- addPointSet(points, ptName, **kwargs)[source]
Add a set of coordinates to DVGeometry
The is the main way that geometry, in the form of a coordinate list is given to DVGeometry to be manipulated.
- Parameters
- pointsarray, size (N,3)
The coordinates to embed. These coordinates should all project into the interior of the FFD volume.
- ptNamestr
A user supplied name to associate with the set of coordinates. Thisname will need to be provided when updating the coordinates or when getting the derivatives of the coordinates.
- Returns
- dMax_globalfloat
The maximum distance betwen the points added and the projection on the VSP surfaces on any processor.
- addVariable(component, group, parm, value=None, lower=None, upper=None, scale=1.0, scaledStep=True, dh=1e-06)[source]
Add a design variable definition.
- Parameters
- componentstr
Name of the VSP component
- groupstr
Name of the VSP group
- parmstr
Name of the VSP parameter
- valuefloat or None
The design variable. If this value is not supplied (None), then the current value in the VSP model will be queried and used
- lowerfloat or None
Lower bound for the design variable. Use None for no lower bound
- upperfloat or None
Upper bound for the design variable. Use None for no upper bound
- scalefloat
Scale factor
- scaledStepbool
Flag to use a scaled step sized based on the initial value of the variable. It will remain constant thereafter.
- dhfloat
Step size. When scaledStep is True, the actual step is dh*value. Otherwise this actual step is used.
- createDesignFile(fileName)[source]
Take the current set of design variables and create a .des file
- Parameters
- fileNamestr
name of the output .des file
- 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 dv-dictionary are simply ignored.
- totalSensitivity(dIdpt, ptSetName, comm=None, config=None)[source]
This function computes sensitivity information.
Specifically, 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
The communicator to use to reduce the final derivative. If comm is None, no reduction takes place.
- Returns
- dIdxDictdict
The dictionary containing the derivatives, suitable for pyOptSparse
- totalSensitivityProd(vec, ptSetName, comm=None, config=None)[source]
This function computes sensitivity information.
Specifically, it computes the following: \(\frac{dX_{pt}}{dX_{DV}} \ vec\)
This is useful for forward AD mode.
- Parameters
- vecdictionary whose keys are the design variable names, and whose
values are the derivative seeds of the corresponding design variable.
- ptSetNamestr
The name of set of points we are dealing with
- commMPI.IntraComm
inactive parameter, this has no effect on the final result because with this method, the reduction is performed externally
- Returns
- xsdotarray (Nx3) -> Array with derivative seeds of the surface nodes.
- totalSensitivityTransProd(dIdpt, ptSetName, comm=None, config=None)[source]
This function computes sensitivity information.
Specifically, 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
The communicator to use to reduce the final derivative. If comm is None, no reduction takes place.
- Returns
- dIdxDictdic
The dictionary containing the derivatives, suitable for pyOptSparse
- 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 ones of the given in an
addPointSet()
call.- configstr or list
Inactive parameter for DVGeometryVSP. See the same method in DVGeometry.py for its normal use.