evalFuncs=['cl', 'cd', 'cmz'], xRef=0.25, xRot=0.25) def callback(refGrid, t, ts): newGrid = numpy.copy(refGrid) x = refGrid[:, 0] y = refGrid[:, 1] p = deltaAlpha * numpy.sin(omega * t) c = numpy.cos(p) s = numpy.sin(p) newGrid[:, 0] = c * (x - 0.25) - s * y + 0.25 newGrid[:, 1] = s * (x - 0.25) + c * y return newGrid CFDSolver = SUMB(options=options) CFDSolver.setMesh(mesh) CFDSolver.addSlices('z', [0.5]) CFDSolver(ap, surfaceMeshCallback=callback) funcs = {} CFDSolver.evalFunctions(ap, funcs) CFDSolver.checkSolutionFailure(ap, funcs) if MPI.COMM_WORLD.rank == 0: print('Eval Functions:') reg_write_dict(funcs, 1e-6, 1e-6) os.system('rm 0012pitching*')
xRot=0.25) def callback(refGrid, t, ts): newGrid = numpy.copy(refGrid) x = refGrid[:, 0] y = refGrid[:, 1] p = deltaAlpha * numpy.sin(omega * t) c = numpy.cos(p) s = numpy.sin(p) newGrid[:, 0] = c * (x - 0.25) - s * y + 0.25 newGrid[:, 1] = s * (x - 0.25) + c * y return newGrid CFDSolver = SUMB(options=options) CFDSolver.setMesh(mesh) CFDSolver.addSlices('z', [0.5]) CFDSolver(ap) refCoor = CFDSolver.getSurfaceCoordinates('allWalls') for tdx in xrange(1, nfineSteps + 1): curTime, curTimeStep = CFDSolver.advanceTimeStepCounter() newCoor = callback(refCoor, curTime, curTimeStep) # Set displacements CFDSolver.setSurfaceCoordinates(newCoor, 'allwalls') CFDSolver.updateGeometryInfo() # Solve current time step CFDSolver.solveTimeStep() funcs = {}