Re: [Yade-users] [Question #677084]: manipulate the spheres during running

2018-12-27 Thread gaoxuesong
Question #677084 on Yade changed:
https://answers.launchpad.net/yade/+question/677084

Status: Answered => Open

gaoxuesong is still having a problem:
Hi. The thing i want is with the yade-batch mode, when i finish 5000 iters, i 
want to reload some previous state which has been saved before. So the 
procedure should be like this, 
create a new thread, invoke a new function, and execute the O.load() demand.

def newThread():
if O.time > 3.6:
import thread
thread.start_new_thread(newRun,())

def newRun():
O.pause();O.wait()
O.load('./svdir/t3-3.5')

I find this method is ok in usual mode of yade, but failed in batch
mode.

-- 
You received this question notification because your team yade-users 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 #677084]: manipulate the spheres during running

2018-12-27 Thread Chareyre
Question #677084 on Yade changed:
https://answers.launchpad.net/yade/+question/677084

Status: Open => Answered

Chareyre proposed the following answer:
Hi, if I read correctly you have two threads trying to run the same
simulation. I would expect this to fail always although i can imagine that
in some cases the problem remains unnoticed.
What are you trying to achieve? There could be simpler ways.
Bruno


Le 27 déc. 2018 18:13, "gaoxuesong" 
a écrit :

Question #677084 on Yade changed:
https://answers.launchpad.net/yade/+question/677084

gaoxuesong gave more information on the question:
I have just found that just put the functional code into a function
runned by pyRunner, it works well in yade-batch mode. So my question
becomes that if it is not allowed to create  a new thread to load yade
saved state in batch mode?


-- 
You received this question notification because your team yade-users 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

You received this question notification because your team yade-users 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 #677084]: manipulate the spheres during running

2018-12-27 Thread gaoxuesong
Question #677084 on Yade changed:
https://answers.launchpad.net/yade/+question/677084

gaoxuesong gave more information on the question:
I have just found that just put the functional code into a function
runned by pyRunner, it works well in yade-batch mode. So my question
becomes that if it is not allowed to create  a new thread to load yade
saved state in batch mode?

-- 
You received this question notification because your team yade-users 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


[Yade-users] [Question #677084]: manipulate the spheres during running

2018-12-27 Thread gaoxuesong
New question #677084 on Yade:
https://answers.launchpad.net/yade/+question/677084

I want to get the information of some specific spheres during the calculation 
when it meets some condition, like the time larger than some point. i have used 
two run mode of yade, one is just normal mode, the other is batch mode. 

The flowchart of my code is that, 

### to invode getDemandbody to get what i want 
def getDandBody():

# input a box 
vboxMin = (2.1,0.1,0.72)
vboxMax = (2.9,0.9,0.98)
vPorosity = utils.voxelPorosity(resolution=400, start=vboxMin, 
end=vboxMax)

# use the box the select the spheres and erase outside spheres 
for eb in O.bodies:
if not isinstance(eb.shape, Sphere):
continue 
if not (vboxMin[0]<= eb.state.pos[0]<= vboxMax[0] and vboxMin[1]<= 
eb.state.pos[1] <= vboxMax[1] and vboxMin[2] <= 
eb.state.pos[2] <= vboxMax[2]):
O.bodies.erase(eb.id)

# output the information 
   with open('rel.txt', 'w') as fd:
fd.write('%e %e\n' % (sthrd, lthrd))
fd.write('%.4f, %d, %d, %.2f\n' % (1-vPorosity, snum, inum, 
inum*1.0/snum))   
   O.pause()

#define the new thread to load saved file 
def newThread():
if O.time > 3.6:   
import thread 
thread.start_new_thread(newRun,())

def newRun(): 
O.pause();O.wait()

### import saved state 
O.load('./svdir/t3-3.5')

### new engines and new run
   ### the function of getDemandBody is what i need to run to get sphere 
information 
O.engines = [
PyRunner(iterPeriod=1,command='getDemandBody()'),
]
O.run(1)

### the save file function 
def svfun():
some expressions 
 

#define engines:
O.engines=[
ForceResetter(),
InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Facet_Aabb()]),
InteractionLoop(
# handle sphere+sphere and facet+sphere collisions
   [Ig2_Sphere_Sphere_ScGeom6D(),Ig2_Facet_Sphere_ScGeom6D()],
   [Ip2_CohFrictMat_CohFrictMat_CohFrictPhys()],
   [Law2_ScGeom6D_CohFrictPhys_CohesionMoment()]
),
   PyRunner(iterPeriod=100,command='svfun()'),
   PyRunner(iterPeriod=100,command='newThread()'),
   NewtonIntegrator(damping=0.75, exactAsphericalRot=True, 
gravity=(0,0,-9810*gcof)),

]

O.run() 

### script finished #

I have two problems,
1. when i use the normal mode, like the command, yade  myscript.py, it works. I 
can get the information of the selected spheres. But i want to ask, using a new 
thread is a must? In fact, i don't want to load saved file, just the current 
state is also ok.
2. when i use the yade-batch mode, it doesn't work. There is no output file. So 
i doubt there is a problem when create a new thread in batch mode.  

So any suggestions? 

Thanks, 
Xuesong 


-- 
You received this question notification because your team yade-users 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 #676382]: Engine Error (JCFpmMat)

2018-12-27 Thread SayedHessam
Question #676382 on Yade changed:
https://answers.launchpad.net/yade/+question/676382

SayedHessam posted a new comment:
Dear Bruno,

You right but this not another script. I've just tried to run a simple
triaxial based on JCFpmMat contact model but I could not run the model
properly. Anyway, I think it is a bug from the source.

Regards
Hessam

-- 
You received this question notification because your team yade-users 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