yade-users team mailing list archive
-
yade-users team
-
Mailing list archive
-
Message #07266
Re: [Question #224128]: How to learn and start a 2D simulation in YADE
Question #224128 on Yade changed:
https://answers.launchpad.net/yade/+question/224128
Status: Open => Answered
Jan Stránský proposed the following answer:
Hello,
thanks for providing the script. Unfortunately I am not able to run the
script, because ThreeDTriaxialEngine has no parameter 'sigma_iso'. What
version of Yade are you using?
> (1).The python shell provide me an error warning that can be expressed as
> that:
> "terminate called after throwing an instance of
> 'boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::lock_error>
> >'
> what(): boost::lock_error
> Aborted (core dumped)"
> But I divide this script into two parts in order to inheriting initial
> state to the second-step simulation and the second part of this script
> starts with "O.loadTmp('qw')". It's worth mentioning that I copy all the
> details of the second script and paste them to YADE shell instead of making
> them be read by YADE shell directly. So it can work well. I do not know why
> this phenomenon appear.
>
>
I am not sure, but the first command O.run() of your script can be the
source of the problem. Try to use
O.run(); O.wait()
> (2).I need to do post-processing with third-party software after the
> simulation task is over. So it is essential for me to record all the
> variables I want to get in a independent txt, of which the framework is
> like(I want to get the displacement field of specimen):
> "particles' id X-cord Y-cord X-cord radius disp-1 disp-2 disp-3"
> I failed to find any example for "disp" getting, please tell me how to
> write the py script for this purpose.
>
This is very easy task:
f = open(fileName,'w')
for b in O.bodies:
pos = b.state.pos #
https://yade-dem.org/doc/yade.wrapper.html#yade.wrapper.State.pos
dspl = b.state.displ() #
https://yade-dem.org/doc/yade.wrapper.html#yade.wrapper.State.displ
r = b.shape.radius #
https://yade-dem.org/doc/yade.wrapper.html#yade.wrapper.Sphere.radius
f.write('%d %g %g %g %g %g %g %g'%(b.id
,pos[0],pos[1],pos[2],r,dspl[0],dspl[1],dspl[2]))
f.close()
>
> (3).The color of particles is randomly assigned in the process of
> particles generation accord to my script and I can hardly distinguish the
> statement of particles after simulation stopped. So I
> intend to define theirs color in special needs and the first step of this
> work is to define appropriate partition of specimen. Is this can be
> achieved in YADE and how can I do to accomplish it?
>
>
It is also very easy :-)
for b in O.bodies:
pos = b.state.pos
if pos[0] <3 and pos[1] < 3: b.shape.color = (1,0,0)
elif pos[0] < 3 and pos[1] >=3: b.shape.color = (0,1,0)
# ...
else: b.shape.pos = (1,1,0)
cheers
Jan
--
You received this question notification because you are a member of
yade-users, which is an answer contact for Yade.