- class idwarp.UnstructuredMesh.USMesh(*args, **kwargs)
This is the main Unstructured Mesh. This mesh object is designed to interact with an structured or unstructured CFD solver though a variety of interface functions.
Create the USMesh object.
A dictionary containing the options for the mesh movement strategies. THIS IS NOT OPTIONAL.
MPI communication (as obtained from mpi4py) on which to create the USMesh object. If not provided, MPI_COMM_WORLD is used.
Flag specifying if the MExt import is automatically deleted. This needs to be true ONLY when a symbolic debugger is used.
Return the grid in the original ordering. This is required for the OpenFOAM tecplot writer since the connectivity is only known in this ordering.
Return the current grid in the order specified by setExternalMeshIndices(). This is the main routine for returning the defomed 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
- coordsnumpy array size (N,3)
Specified surface coordinates residing on this processor. This may be empty array, size (0,3)
Return the current grid. This funtion is typically unused. See getSolverGrid for the more useful interface functionality.
- warpGrid, numpy array, real: The resulting grid.
The output is returned in flatted 1D coordinate format.
Return the current values in dXs. This is the result from a mesh-warp derivative computation.
- 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.
Set the indicies 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
The list of indicies this processor needs from the common mesh file
Sets all surface coordinates on this processor
- coordinatesnumpy array, size(N, 3)
The coordinate to set. This MUST be exactly the same size as the array obtained from getSurfaceCoordinates()
- setSurfaceDefinition(pts, conn, faceSizes, cgnsBlockID=None)
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 SUmb) 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.
- cgnsBlockIDdummy argument.
This argument is not used at all. It is here just to have the same API as the IDWarpMulti class.
Set the surface definition for the warping from a multiblock PLOT3D surface file
- surfFilefilename of multiblock PLOT3D surface file.
Update the internal surface surface coordinates using an external PLOT3D surface file. This can be used in an analogous way to setSurfaceDefinitionFromFile. The ‘sense’ of the file must be same as the file used with setSurfaceDefinitionFromFile. That means, the same number of blocks, with the same sizes, in the same order.
- surfFile: filename of multiblock PLOT3D surface file’
- verifyWarpDeriv(dXv=None, solverVec=True, dofStart=0, dofEnd=10, h=1e-06, randomSeed=314)
Run an internal verification of the solid warping derivatives
- warpDeriv(dXv, solverVec=True)
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.
- None. The resulting calculation is available from the getdXs()
- warpDerivFwd(dXs, solverVec=True)
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 peturbation on all the surface nodes.
- dXsarray, size Nsx3
This is the forward mode peturbation seed. Same size as the surface mesh from getSurfaceCoordinates().
Whether or not to convert to the solver ordering.
The peturbation on the volume meshes. It may be in warp ordering or solver ordering depending on the solverVec flag.
Run the applicable mesh warping strategy.
This will update the volume coordinates to match surface coordinates set with setSurfaceCoordinates()
Write the current grid to the correct format
- fileNamestr or None
Filename for grid. Should end in .cgns for CGNS files. For PLOT3D whatever you want. It is not optional for CGNS/PLOT3D. It is not required for OpenFOAM meshes. This call will update the ‘points’ file.
Write the current OpenFOAM grid to a Tecplot FE polyhedron file. This is generally used for debugging/visualization purposes.
Filename to use. Should end in .dat for tecplot ascii file.