# rst create DVGeo # The Plot3D file ffdbox.xyz contains the coordinates of the free-form deformation (FFD)volume # we will be using for this problem. It's a cube with sides of length 1 centered on (0, 0,0.5). # The "i" direction of the cube consists of 10 points along the x axis # The "j" direction of the cube is 2 points up and down (y axis direction) # The "k" direction of the cube is 2 points into the page (z axis direction) FFDfile = "ffdbox.xyz" # initialize the DVGeometry object with the FFD file DVGeo = DVGeometry(FFDfile) # rst add pointset # add the cylinder pointset to the FFD under the name 'cylinder' DVGeo.addPointSet(Xpt.copy(), "cylinder") DVGeo.writePointSet("cylinder", "pointset") # rst add shape DV # Now that we have pointsets added, we should parameterize the geometry. # Adding local geometric design to make local modifications to FFD box # This option will perturb all the control points but only the y (up-down) direction DVGeo.addLocalDV("shape", lower=-0.5, upper=0.5, axis="y", scale=1.0) # rst getLocalIndex # The control points of the FFD are the same as the coordinates of the points in the input file # but they will be in a jumbled order because of the internal spline representation of the volume. # Let's put them in a sensible order for plotting. # the raw array of FFD control points (size n_control_pts x 3) FFD = DVGeo.FFD.coef
#rst Add local dvs # Comment out one or the other DVGeo.addGeoDVLocal('local', lower=-0.5, upper=0.5, axis='y', scale=1) DVGeo.addGeoDVSectionLocal('slocal', secIndex='k', axis=1, lower=-0.5, upper=0.5, scale=1) #rst Embed points gridFile = 'wing_vol.cgns' meshOptions = {'gridFile': gridFile} mesh = USMesh(options=meshOptions) coords = mesh.getSurfaceCoordinates() DVGeo.addPointSet(coords, 'coords') #rst Change dvs dvDict = DVGeo.getValues() dvDict['twist'] = numpy.linspace(0, 50, nRefAxPts)[1:] dvDict['dihedral'] = numpy.linspace(0, 3, nRefAxPts)[1:] dvDict['taper'] = numpy.array([1.2, 0.5]) dvDict['slocal'][::5] = 0.5 DVGeo.setDesignVars(dvDict) #rst Update DVGeo.update('coords') DVGeo.writePlot3d('ffd_deformed.xyz') DVGeo.writePointSet('coords', 'surf')
# rst Add local dvs # Comment out one or the other DVGeo.addGeoDVLocal("local", lower=-0.5, upper=0.5, axis="y", scale=1) DVGeo.addGeoDVSectionLocal("slocal", secIndex="k", axis=1, lower=-0.5, upper=0.5, scale=1) # rst Embed points gridFile = "wing_vol.cgns" meshOptions = {"gridFile": gridFile} mesh = USMesh(options=meshOptions) coords = mesh.getSurfaceCoordinates() DVGeo.addPointSet(coords, "coords") # rst Change dvs dvDict = DVGeo.getValues() dvDict["twist"] = np.linspace(0, 50, nRefAxPts)[1:] dvDict["dihedral"] = np.linspace(0, 3, nRefAxPts)[1:] dvDict["taper"] = np.array([1.2, 0.5]) dvDict["slocal"][::5] = 0.5 DVGeo.setDesignVars(dvDict) # rst Update DVGeo.update("coords") DVGeo.writePlot3d("ffd_deformed.xyz") DVGeo.writePointSet("coords", "surf")