def fluxtest(): global once,QinOk no=0 QinOk=Qin-deltabubble error=QinOk-total2 if error>toleranceWarning: print("Warning: difference between total water volume flowing through bottom wall and water loss due to air bubble generations",QinOk," vs. total water volume flowing inside dry or partially saturated cells",total2) if error>toleranceCritical: raise YadeCheckError("The difference is more, than the critical tolerance!") file.write(str(O.time-timeini)+" "+str(total2)+" "+str(QinOk)+" "+str(error)+"\n") for ii in range(nvoids): if flow.getCellLabel(ii)==0: no=1 if once==0: if no==0: imbtime=O.time-timeini print(imbtime,voidvol,total2,QinOk) if voidvol-total2>toleranceWarning: print("Warning: initial volume of dry voids",voidvol," vs. total water volume flowing inside dry or partially saturated cells",total2) if voidvol-total2>toleranceCritical: raise YadeCheckError("The difference is more, than the critical tolerance!") file.write(str(imbtime)+" "+str(voidvol)+" "+str(total2)+" "+str(QinOk)+"\n") once=1 timing.stats()
def fluxtest(): global once,errors,QinOk no=0 QinOk=Qin-deltabubble error=QinOk-total2 if error>toleranceWarning: print("Warning: difference between total water volume flowing through bottom wall and water loss due to air bubble generations",QinOk," vs. total water volume flowing inside dry or partially saturated cells",total2) if error>toleranceCritical: print("The difference is more, than the critical tolerance!") errors+=1 file.write(str(O.time-timeini)+" "+str(total2)+" "+str(QinOk)+" "+str(error)+"\n") for ii in range(nvoids): if flow.getCellLabel(ii)==0: no=1 if once==0: if no==0: imbtime=O.time-timeini print(imbtime,voidvol,total2,QinOk) if voidvol-total2>toleranceWarning: print("Warning: initial volume of dry voids",voidvol," vs. total water volume flowing inside dry or partially saturated cells",total2) if voidvol-total2>toleranceCritical: print("The difference is more, than the critical tolerance!") errors+=1 print(errors) file.write(str(imbtime)+" "+str(voidvol)+" "+str(total2)+" "+str(QinOk)+" "+str(errors)+"\n") once=1 timing.stats() if (errors): resultStatus+=1
def mpirun(nSteps, mergeSplit=False): #if(rank==1): #yappi.start(builtins=True) initStep = O.iter if not O.splitted: splitScene() if YADE_TIMING: O.timingEnabled = True if not mergeSplit: #run until collider is activated then stop O.run(nSteps, True) else: #merge/split for each collider update collisionChecker.dead = True while (O.iter - initStep) < nSteps: O.step() if checkColliderActivated() and (O.iter - initStep) < nSteps: mergeScene() splitScene() #if(rank==1): #yappi.stop() #yappi.get_func_stats().print_all() comm.barrier() time.sleep((numThreads - rank) * 0.1) for k, v in timings.items(): print k, " ", v comm.barrier() if YADE_TIMING: from yade import timing time.sleep( (numThreads - rank) * 0.1 ) #avoid mixing the final output, timing.stats() is independent of the sleep mprint("##### Worker " + str(rank) + " ######") timing.stats() #specific numbers for -n4 and gabion.py
def fluxtest(): global once, errors, QinOk no = 0 QinOk = -Qin - deltabubble error = QinOk - total if error > toleranceWarning: print "Warning: difference between total water volume flowing through bottom wall and water loss due to air bubble generations", QinOk, " vs. total water volume flowing inside dry or partially saturated cells", total if error > toleranceCritical: print "The difference is more, than the critical tolerance!" errors += 1 file.write(str(O.time) + " " + str(QinOk) + " " + str(error) + " \n") for ii in range(nvoids): if bar[ii] >= initiallevel: if flow.getCellPImposed(ii) == True: no = 1 if once == 0: if no == 0: imbtime = O.time - iterini print imbtime, voidvol, total, QinOk if voidvol - total > toleranceWarning: print "Warning: initial volume of dry voids", voidvol, " vs. total water volume flowing inside dry or partially saturated cells", total if voidvol - total > toleranceCritical: print "The difference is more, than the critical tolerance!" errors += 1 print errors file.write( str(imbtime) + " " + str(voidvol) + " " + str(total) + " " + str(QinOk) + " " + str(errors) + "\n") once = 1 timing.stats() if (errors): resultStatus += 1
def stopUnloading(): if abs(O.forces.f(plate.id)[2]) == 0: # O.tags can be used to retrieve unique identifiers of the simulation # if running in batch, subsequent simulation would overwrite each other's output files otherwise # d (or description) is simulation description (composed of parameter values) # while the id is composed of time and process number # plot.saveDataTxt(O.tags['d.id'] + '.txt') plot.saveDataTxt('data' + O.tags['id'] + '.txt') print timing.stats() O.pause()
def stopUnloading(): if abs(O.forces.f(plate.id)[2]) == 0: # O.tags can be used to retrieve unique identifiers of the simulation # if running in batch, subsequent simulation would overwrite each other's output files otherwise # d (or description) is simulation description (composed of parameter values) # while the id is composed of time and process number # plot.saveDataTxt(O.tags['d.id'] + '.txt') plot.saveDataTxt('data'+ O.tags['id'] +'.txt') print timing.stats() O.pause()
def mpirun(nSteps, np=numThreads): stack = inspect.stack() global userScriptInCheckList if len(stack[3][1]) > 12 and stack[3][1][-12:] == "checkList.py": userScriptInCheckList = stack[1][1] caller_name = stack[2][3] if (np > numThreads): if not mit_mode: autoInitialize(np) else: mprint( "number of cores can't be increased after first call to mpirun" ) if ( mit_mode and rank == 0 and not caller_name == 'execfile' ): #if the caller is the user's script, everyone already calls mpirun and the workers are not waiting for a command. for w in range(1, numThreads): comm.send("yade.mpy.mpirun(" + str(nSteps) + ")", dest=w, tag=_MASTER_COMMAND_) wprint("Command sent to ", w) initStep = O.iter mprint("splitting") if not O.splitted: splitScene() mprint("splitted") if YADE_TIMING: O.timingEnabled = True if not (MERGE_SPLIT or COPY_MIRROR_BODIES_WHEN_COLLIDE ): #run until collider is activated then stop O.run(nSteps, True) #a pyrunner will pause mergeScene() else: #merge/split or body_copy for each collider update if (MERGE_SPLIT): collisionChecker.dead = True while (O.iter - initStep) < nSteps: O.step() if checkNeedCollide(): mergeScene() splitScene() mergeScene() timing_comm.print_all() if YADE_TIMING: from yade import timing time.sleep( (numThreads - rank) * 0.1 ) #avoid mixing the final output, timing.stats() is independent of the sleep mprint("##### Worker " + str(rank) + " ######") timing.stats() #specific numbers for -n4 and gabion.py
elif geom=='l3a': loop=InteractionLoop([Ig2_Sphere_Sphere_L3Geom(approxMask=63)],[Ip2_FrictMat_FrictMat_FrictPhys()],[Law2_L3Geom_FrictPhys_ElPerfPl()]) else: raise ValueError('geom must be one of sc, d3d, l3, l3a (not %s)'%geom) O.engines=[ ForceResetter(), InsertionSortCollider([Bo1_Sphere_Aabb()],verletDist=.05*radius), loop, NewtonIntegrator(damping=.6), ] O.dt=0.5*PWaveTimeStep() try: from yade import qt qt.View() except: pass O.cell.velGrad=Matrix3(-.1,.03,0, 0,-.1,0, 0,0,-.1) O.saveTmp() #O.run(10000,True); #rrr=qt.Renderer(); rrr.intrAllWire,rrr.intrGeom=True,False if runningInBatch(): O.timingEnabled=True O.run(300000,True) O.timingEnabled from yade import timing timing.stats()