# DVGeo FFDFile = "./FFD/localFFD.xyz" DVGeo = DVGeometry(FFDFile) # select points pts = DVGeo.getLocalIndex(0) indexList = pts[1:3, :, 1].flatten() PS = geo_utils.PointSelect("list", indexList) DVGeo.addGeoDVLocal("shapey", lower=-1.0, upper=1.0, axis="y", scale=1.0, pointSelect=PS) DVGeo.addGeoDVLocal("shapez", lower=-1.0, upper=1.0, axis="z", scale=1.0, pointSelect=PS) # DAFoam DASolver = PYDAFOAM(options=aeroOptions, comm=gcomm) DASolver.setDVGeo(DVGeo) mesh = USMesh(options=meshOptions, comm=gcomm) DASolver.addFamilyGroup(DASolver.getOption("designSurfaceFamily"), DASolver.getOption("designSurfaces")) DASolver.printFamilyList() DASolver.setMesh(mesh) # set evalFuncs evalFuncs = [] DASolver.setEvalFuncs(evalFuncs) # DVCon DVCon = DVConstraints() DVCon.setDVGeo(DVGeo) [p0, v1, v2] = DASolver.getTriangulatedMeshSurface(groupName=DASolver.getOption("designSurfaceFamily")) surf = [p0, v1, v2] DVCon.setSurface(surf) # optFuncs optFuncs.DASolver = DASolver
lower=-1.0, upper=1.0, axis="y", scale=1.0, pointSelect=PS) DVGeo.addGeoDVGlobal("alpha", [alpha0], alpha, lower=-10.0, upper=10.0, scale=1.0) # DAFoam DASolver = PYDAFOAM(options=aeroOptions, comm=gcomm) DASolver.setDVGeo(DVGeo) mesh = USMesh(options=meshOptions, comm=gcomm) DASolver.addFamilyGroup(DASolver.getOption("designSurfaceFamily"), DASolver.getOption("designSurfaces")) DASolver.printFamilyList() DASolver.setMesh(mesh) # set evalFuncs evalFuncs = [] DASolver.setEvalFuncs(evalFuncs) # DVCon DVCon = DVConstraints() DVCon.setDVGeo(DVGeo) [p0, v1, v2] = DASolver.getTriangulatedMeshSurface( groupName=DASolver.getOption("designSurfaceFamily")) surf = [p0, v1, v2] DVCon.setSurface(surf)
DVGeo = DVGeometry(FFDFile) # select points pts = DVGeo.getLocalIndex(0) indexList = pts[1:4, :, :].flatten() PS = geo_utils.PointSelect("list", indexList) DVGeo.addGeoDVLocal("shapey", lower=-1.0, upper=1.0, axis="y", scale=1.0, pointSelect=PS) DVGeo.addGeoDVLocal("shapez", lower=-1.0, upper=1.0, axis="z", scale=1.0, pointSelect=PS) # ============================================================================= # DAFoam initialization # ============================================================================= DASolver = PYDAFOAM(options=daOptions, comm=gcomm) DASolver.setDVGeo(DVGeo) mesh = USMesh(options=meshOptions, comm=gcomm) DASolver.addFamilyGroup(DASolver.getOption("designSurfaceFamily"), DASolver.getOption("designSurfaces")) DASolver.printFamilyList() DASolver.setMesh(mesh) evalFuncs = [] DASolver.setEvalFuncs(evalFuncs) # ============================================================================= # Constraint setup # ============================================================================= DVCon = DVConstraints() DVCon.setDVGeo(DVGeo) DVCon.setSurface(DASolver.getTriangulatedMeshSurface(groupName=DASolver.getOption("designSurfaceFamily"))) # ============================================================================= # Initialize optFuncs for optimization # =============================================================================