class idwarp.MultiUnstructuredMesh.MultiUSMesh(CGNSFile, optionsDict, comm=None, dtype='d', debug=False)[source]

This mesh object is designed to support independent deformation of multiple overset component meshes.

Create the MultiUSMesh object.


CGNSFile: string -> file name of the CGNS file. This CGNS file should be generated with cgns_utils combine, so that the domain names have the appropriate convention. That is, domains will have the same name as their original files. Domains that share the same name will be grouped to make an IDWarp instance.

optionsDict: dictionary of dictionaries -> Dictionary containing dictionaries that will be used to initialize multiple IDWarp instances. The keys are domain names and the values are dictionaries of standard IDWarp options that will be applied to this domain. The domains of the full CGNS file that do not have a corresponding entry in optionsDict will not be warped. For instance, if the CGNS file has the domains wing.00000, wing.00001, and wing.00002 associated with a wing mesh that we want to warp, then optionsDict should have an entry for ‘wing’.


Return the current grid in the order specified by setExternalMeshIndices(). This is the main routine for returning the deformed mesh to the external CFD solver.

solverGrid, numpy array, real: The resulting grid.

The output is returned in flatted 1D coordinate format. The len of the array is 3*len(indices) as set by setExternalMeshIndices()


Returns all defined surface coordinates on this processor, with the Solver ordering

ptsnumpy array size (N,3)

Specified surface coordinates residing on this processor. This may be empty array, size (0,3)


Return the current grids. This function is typically unused. See getSolverGrid for the more useful interface functionality.

This only returns the nearfield meshes.

volNodesList, list of 1D numpy arrays, real: These are the local volume nodes (in a flat 1D array)
of each instance. That is, volNodesList[i] has the volume nodes stored in the local proc for
the i-th IDWarp instance.
numCoorTotal: The total number of coordinates, across all procs and IDWarp instances.

Return the current values in dXs. This is the result from a mesh-warp derivative computation. Note that the same steps used in this function are done at warpDeriv, so in theory you could save time by just saving the output of warpDeriv.

Here we accumulate all seeds coming from each IDWarp instance

dXsnumpy array

The specific components of dXs. size(N,3). This the same size as the array obtained with getSurfaceCoordiantes(). N may be zero if this processor does not have any surface coordinates. These can be, for instance, reverse AD seeds.


Set the indices defining the transformation of an external solver grid to the original CGNS grid. This is required to use USMesh functions that involve the word “Solver” and warpDeriv. The indices must be zero-based.

indnumpy integer array[3*n] where n is the number of nodes stored in the proc.

The list of indicies this processor needs from the common mesh file. ind[3*i:3*i+3] represents the position of each coordinate of the i-th ADflow node in the CGNS file. ind has 0-based indices.


Sets all surface coordinates on this processor, with pts given in solver ordering

ptsnumpy array, size(N, 3)

The coordinate to set. This MUST be exactly the same size as the array obtained from getSurfaceCoordinates()

setSurfaceDefinition(pts, conn=None, faceSizes=None, cgnsBlockIDs=None, distTol=1e-06)[source]

This is the master function that determines the definition of the surface to be used for the mesh movement. This surface may be supplied from an external solver (such as ADflow) or it may be generated by IDWarp internally.

ptsarray, size (M, 3)

Nodes on this processor

connint array, size (sum(faceSizes))

Connectivity of the nodes on this processor

faceSizesint Array size (N)

Treat the conn array as a flat list with the faceSizes giving connectivity offset for each element.

cgnsBlockIDsint Array size (N)

Block ID, in CGNS ordering, that contains each element.

distTol: Distance tolerance to flag that a given surface node does not

belong to the current IDWarp surface definition in the current proc.

warpDeriv(dXv, solverVec=True)[source]

Compute the warping derivative (dXv/dXs^T)*Vec (where vec is the dXv argument to this function.

This is the main routine to compute the mesh warping derivative.

dXvnumpy array

Vector of size external solver_grid. This is typically obtained from the external solver’s dRdx^T * psi calculation.


Flag to indicate that the dXv vector is in the solver ordering and must be converted to the warp ordering first. This is the usual approach and thus defaults to True.

dXsnumpy array

The specific components of dXs. size(N,3). This the same size as the array obtained with getSurfaceCoordiantes(). N may be zero if this processor does not have any surface coordinates. These can be, for instance, reverse AD seeds.


Compute the forward mode warping derivative

This routine is not used for “regular” optimization; it is used for matrix-free type optimization. dXs is assumed to be the the perturbation on all the surface nodes.

dXsarray, size Nsx3

This is the forward mode perturbation seed. Same size as the surface mesh from getSurfaceCoordinates().


Whether or not to convert to the solver ordering.


The perturbation on the volume meshes. It may be in warp ordering or solver ordering depending on the solverVec flag.


This calls the mesh warping method for each IDWarp instance.

This will update the volume coordinates internally in each instance.


Write the grids of each instance

baseNamestr or None

a base namve that will be used to generate filenames for all instance mesh files.