def advanceUnsteady(fmodel, meshes, globalTime, nTimeSteps, particles): #pdb.set_trace() px = geomFields.coordinate[particles] pv = flowFields.velocity[particles] pxArray = px.asNumPyArray() pvArray = pv.asNumPyArray() for i in range(0, nTimeSteps): v = 0.1 * math.cos(2.0 * math.pi * frequency * globalTime) pvArray[:, 0] = 0 pvArray[:, 1] = v pvArray[:, 2] = 0 fmodel.computeIBFaceVelocity(particles) fmodel.computeIBandSolidVelocity(particles) advance(fmodel, numIterationsPerStep) pI = fmodel.getPressureIntegralonIBFaces(mesh0) #mI = fmodel.getMomentumFluxIntegralonIBFaces(mesh0) #pxArray[:,1] += v * timeStep #solid.setVelocities(pv) #solid.setCoordinates(px) fvmbaseExt.CellMark_Impl(mesh0, geomFields, fileBase, octree, solid, option) metricsCalculator.computeIBInterpolationMatrices(particles) metricsCalculator.computeIBandSolidInterpolationMatrices(particles) vFile.write("%e\t%e\n" % (globalTime, v)) pFile.write("%e\t%e\t%e\t%e\n" % (globalTime, pI[0], pI[1], pI[2])) #mFile.write("%e\t%e\t%e\t%e\n" % (globalTime, mI[0], mI[1], mI[2])) globalTime += timeStep print 'advancing to time %e' % globalTime fmodel.updateTime()
metricsCalculator.setTangentCoords(0, 7, 1) flowFields = models.FlowFields('flow') fmodel = models.FlowModelA(geomFields, flowFields, meshes) reader.importFlowBCs(fmodel) fmodel.init() import time t0 = time.time() solid = fvmbaseExt.MPM() octree = fvmbaseExt.Octree() option = 2 fvmbaseExt.CellMark_Impl(mesh0, geomFields, fileBase, octree, solid, option) cells = mesh0.getCells() nCells = cells.getSelfCount() print nCells t1 = time.time() if outfile != '/dev/stdout': print '\nsolution time = %f' % (t1 - t0) print 'solution time = %f' % (t1 - t0)