"bExp": 5.0, "LdefFact": 1.0, "alpha": 0.25, "errTol": 0.0005, "evalMode": "fast", "symmTol": 1e-6, "useRotations": True, "bucketSize": 8, } # Create the mesh object mesh = USMesh(options=options, comm=MPI.COMM_WORLD) coords0 = mesh.getSurfaceCoordinates() new_coords = coords0.copy() for i in range(len(coords0)): span = coords0[i, 2] new_coords[i, 0] += 0.05 * span new_coords[i, 1] += 0.05 * span new_coords[i, 2] += 0.15 * span # Reset the newly computed surface coordiantes mesh.setSurfaceCoordinates(new_coords) # Actually run the mesh warping mesh.warpMesh() # Write the new grid file. mesh.writeGrid("warped.cgns")
'fileType':'CGNS', 'gridFile':'../../input_files/o_mesh.cgns', 'aExp': 3.0, 'bExp': 5.0, 'LdefFact':100.0, 'alpha':0.25, 'errTol':0.0001, 'evalMode':'fast', 'symmTol':1e-6, 'useRotations':True, 'bucketSize':8, } # Create the mesh object mesh = USMesh(options=options, comm=MPI.COMM_WORLD) coords0 = mesh.getSurfaceCoordinates() new_coords = coords0.copy() for i in range(len(coords0)): new_coords[i, :] *= 1.1 # Reset the newly computed surface coordiantes mesh.setSurfaceCoordinates(new_coords) # Actually run the mesh warping mesh.warpMesh() # Write the new grid file. mesh.writeGrid('warped.cgns')
new_coords = coords0.copy() #form bump arc according to parameters l = 0.3 l0 = 0.05 b = 0.02 l1 = l + l0 lc = (l / 2.0) + l0 r = ((l / 2.0)**2 + b**2) / (2.0 * b) rmb = r - b for i in range(len(coords0)): x = new_coords[i, 0] y = new_coords[i, 1] z = new_coords[i, 2] if x > l0 and x < l1 and z < 0.5: th = atan(abs(x - lc) / rmb) new_coords[i, 2] += r * cos(th) - rmb # new_coords[i, :] *= 1.1 # Reset the newly computed surface coordiantes mesh.setSurfaceCoordinates(new_coords) # Actually run the mesh warping mesh.warpMesh() # Write the new grid file. mesh.writeGrid(f'bump_69x49_{l}_{l0}_{b}.cgns')
# Case 5: Shape # xDV['length'][2] = 1.75#2.0#1.05 # xDV['angleVars'][2] = 0.15 # xDV['angleVars'][0] = 0.19 # xDV['noseLen'][0] = -0.1 # xDV['angleVars'][1] = 0.18 # xDV['angleVars'][2] = 0.18 # xDV['angleVars'][3] = 0.12 DVGeo.setDesignVars(xDV) mesh.setSurfaceCoordinates(DVGeo.update(ptSetName)) mesh.warpMesh() DVGeo.writeTecplot("warpedFFD.dat") # mesh.writeOFGridTecplot('warped.dat') mesh.writeGrid() # # Repeat ================ # #xDV['length'][2] = 1.25#2.0#1.05 # xDV['angleVars'][2] = 0.3 # DVGeo.setDesignVars(xDV) # #coords = DVGeo.update(ptSetName) # # for i in range(coords0.shape[0]): # # if coords0[i,1]==0: # # print 'x',coords[i,:] # # # end # # # end # # for i in range(coords.shape[0]): # # print 'x',coords0[i,:],coords[i,:] # # # print DVGeo.update(ptSetName)
from pygeo import DVGeometry, DVConstraints from plate_comp_opts import aeroOptions, warpOptions, optOptions '''Just generate a mesh moved with a set of design variables''' aoptions = aeroOptions woptions = warpOptions ooptions = optOptions # Generate FFD and DVs DVGeo = pf.createFFD() # starting flat mesh meshname = aoptions['gridFile'] mesh = USMesh(options=warpOptions) coords = mesh.getSurfaceCoordinates() DVGeo.addPointSet(coords, "coords") vars = optOptions['ro_shape'] dvDict = {'pnts': vars} DVGeo.setDesignVars(dvDict) new_coords = DVGeo.update("coords") # move the mesh using idwarp mesh.setSurfaceCoordinates(new_coords) mesh.warpMesh() # Write the new grid file. mesh.writeGrid(f'opt_result.cgns')