Re: [Yade-users] [Question #189288]: Apply forces from previous simulation
Question #189288 on Yade changed: https://answers.launchpad.net/yade/+question/189288 liucheng83 posted a new comment: Really, I want to build an array like this tt=[] tt=[ForceEngine(ids=[i],force=(0,0,i),label=ttForce) for i in ids_sp] and tt[0],tt[i] are the ForceEngine, but I donnot know how to add it to the O.engine if ids_sp is a big number. a loop method like for i in ids_sp cannot be insert to O.engine like this: O.engines=[ ForceResetter(), InsertionSortCollider([Bo1_Sphere_Aabb(aabbEnlargeFactor=interactionRadius,label='aabb'),Bo1_Facet_Aabb()]), InteractionLoop( [Ig2_Sphere_Sphere_ScGeom(interactionDetectionFactor=interactionRadius,label='Ig2ssGeom'), Ig2_Facet_Sphere_ScGeom(),], [Ip2_FrictMat_FrictMat_FrictPhys()], [Law2_ScGeom_FrictPhys_CundallStrack()] ), ## Apply tt Force to some particles ForceEngine(ids=[i],force=(0,0,i),label=dragForce+str(i)) for i in ids_spSlurry # a message SyntaxError: invalid syntax is given NewtonIntegrator(damping=0.1,gravity=(0,0,-9.81)), PyRunner(command='checkInteraction()',iterPeriod=iterPeriod_checkInteraction,label='checker') ] # a message SyntaxError: invalid syntax is given because of using for loop PyRunner, which executes O.forces.addF for each particle in each iteration may be a method, but it is not the most efficient one, maybe the force keep as a constant for a time, and then anoter constant for a next time. How to solve it, please give some advice, somebody, thank you! -- You received this question notification because you are a member of yade-users, which is an answer contact for Yade. ___ Mailing list: https://launchpad.net/~yade-users Post to : yade-users@lists.launchpad.net Unsubscribe : https://launchpad.net/~yade-users More help : https://help.launchpad.net/ListHelp
Re: [Yade-users] [Question #189288]: Apply forces from previous simulation
Question #189288 on Yade changed: https://answers.launchpad.net/yade/+question/189288 Jan Stránský posted a new comment: Hello, Really, I want to build an array like this tt=[] tt=[ForceEngine(ids=[i],force=(0,0,i),label=ttForce) for i in ids_sp] and tt[0],tt[i] are the ForceEngine, but I donnot know how to add it to the O.engine if ids_sp is a big number. a loop method like for i in ids_sp cannot be insert to O.engine like this: you can achieve this by: tt=[ForceEngine(ids=[i],force=(0,0,i),label=ttForce+str(i)) for i in ids_sp] O.engines = [ ... ] + tt + [ ... ] where [ ... ] stands for standard code you would write before / after your ForceEngines # a message SyntaxError: invalid syntax is given because of using for loop it is not because of using for loop, it is because of using it incorectly. PyRunner, which executes O.forces.addF for each particle in each iteration may be a method, but it is not the most efficient one, maybe the force keep as a constant for a time, and then anoter constant for a next time. I am not sure what would be faster (you can test it :-), but I would say that anyway it should not be significant in comparison to other engines (at least with applying force to only some particles) cheers Jan -- You received this question notification because you are a member of yade-users, which is an answer contact for Yade. ___ Mailing list: https://launchpad.net/~yade-users Post to : yade-users@lists.launchpad.net Unsubscribe : https://launchpad.net/~yade-users More help : https://help.launchpad.net/ListHelp
Re: [Yade-users] [Question #189288]: Apply forces from previous simulation
Question #189288 on Yade changed: https://answers.launchpad.net/yade/+question/189288 liucheng83 posted a new comment: Hi, Jan Stránský (honzik) Thank you very much! O.engines = [ ... ] + tt + [ ... ] is a good way to solve the problem! -- You received this question notification because you are a member of yade-users, which is an answer contact for Yade. ___ Mailing list: https://launchpad.net/~yade-users Post to : yade-users@lists.launchpad.net Unsubscribe : https://launchpad.net/~yade-users More help : https://help.launchpad.net/ListHelp
Re: [Yade-users] [Question #189288]: Apply forces from previous simulation
Question #189288 on Yade changed: https://answers.launchpad.net/yade/+question/189288 Status: Open = Solved Klaus Thoeni confirmed that the question is solved: Ok, I have a solution but it might not be the most efficient one. I created a periodic engine, e.g. PyRunner, which executes O.forces.addF for each particle in each iteration. It works :-) -- You received this question notification because you are a member of yade-users, which is an answer contact for Yade. ___ Mailing list: https://launchpad.net/~yade-users Post to : yade-users@lists.launchpad.net Unsubscribe : https://launchpad.net/~yade-users More help : https://help.launchpad.net/ListHelp