Exemplo n.º 1
0
valueList.append({'velocity':5,'alpha':10})
valueList.append({'velocity':7.5,'alpha':10})
print valueList

for k in range(6,len(valueList)):
    vel = valueList[k]['velocity']
    alpha = valueList[k]['alpha']
    caseDir.clear(functionObjectData=True)
    caseDir.clearOther()
    caseDir.clearPattern("postProcessing")
    caseDir.clearResults(functionObjectData=True)
    velocity = [0,math.sin(alpha*math.pi/180)*vel,-math.cos(alpha*math.pi/180)*vel]
    print "Simulation {:d} from {:d}: velocity = {:f} alpha = {:f}".format(k,len(valueList),vel,alpha)
    parameters['flowVelocity'] = "({:f} {:f} {:f})".format(velocity[0],velocity[1],velocity[2])
    parameters['magUInf'] = "{:f}".format(vel)
    parameters.writeFile()
    decompose = BasicRunner(argv=["decomposePar"],silent=True)
    print " Decompose Dictionary"
    start = time.clock()
    decompose.start()
    print " Run SimpleFoam"
    run = AnalyzedRunner(StandardLogAnalyzer(),argv=["mpirun -np 4","simpleFoam","-parallel"],silent=True)
    run.start()
    run.picklePlots()
    print " Reconstruct Par"
    reconstruct = BasicRunner(argv=["reconstructPar"],silent=True)
    reconstruct.start()
    end = time.clock()
    print " Save Data"
    print " Run finalized. Ellapsed time: {:f}s".format(end-start)
    caseDir.lastToArchive("vel={:f}alpha={:f}".format(vel,alpha))