yade-users team mailing list archive
Mailing list archive
[Question #677084]: manipulate the spheres during running
New question #677084 on Yade:
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
# 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):
if not (vboxMin<= eb.state.pos<= vboxMax and vboxMin<= eb.state.pos <= vboxMax and vboxMin <=
eb.state.pos <= vboxMax):
# 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))
#define the new thread to load saved file
if O.time > 3.6:
### import saved state
### new engines and new run
### the function of getDemandBody is what i need to run to get sphere information
O.engines = [
### the save file function
# handle sphere+sphere and facet+sphere collisions
NewtonIntegrator(damping=0.75, exactAsphericalRot=True, gravity=(0,0,-9810*gcof)),
### 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?
You received this question notification because your team yade-users is
an answer contact for Yade.