# 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) leList = [[1e-4, 0.0, 1e-4], [1e-4, 0.0, 0.1 - 1e-4]] teList = [[0.998 - 1e-4, 0.0, 1e-4], [0.998 - 1e-4, 0.0, 0.1 - 1e-4]] DVCon.addVolumeConstraint(leList, teList, nSpan=2, nChord=10, lower=1.0, upper=3, scaled=True) DVCon.addThicknessConstraints2D(leList, teList,
# ============================================================================= 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 # ============================================================================= optFuncs.DASolver = DASolver optFuncs.DVGeo = DVGeo optFuncs.DVCon = DVCon optFuncs.evalFuncs = evalFuncs optFuncs.gcomm = gcomm # ============================================================================= # Task # ============================================================================= if args.task == "opt":