← Back to team overview

yade-users team mailing list archive

Re: [Question #265521]: What's the most efficient way to get the average stress at each cycle?

 

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

Jan Stránský proposed the following answer:
Hi Behzad,

bodyStressTensors() computes stress tensors for each body, so to make it
more efficient, just do not call it for each body again :-)

def get2():
        stress=0.0
        sums=0.0
        global a
        num=len(a)
        stressTensors = bodyStressTensors()
        for i in a:
                sums+=stressTensors[i][2][2]
        stress=sums/num
        return stress

cheers
Jan


2015-04-20 17:41 GMT+02:00 behzad
<question265521@xxxxxxxxxxxxxxxxxxxxx>:

> New question #265521 on Yade:
> https://answers.launchpad.net/yade/+question/265521
>
> Hi,
>
> I have a simulation in which a sinusoidal strain is applied to a
> cylindrical sample of spheres by a box. I'd like to get the imposed stress
> history which is supposed to be a sinusoidal curve with a time lag.
> The history of stress on the box with bodyStressTensors()[box_1][2][2] has
> some noise.
> I decided to get the average stress of the spheres in the sample in z
> direction as the imposed stress.
>
> This can be done via calling the following function at certain cycles by
> Pyrunner:
>
> def get2():
>         stress=0.0
>         sums=0.0
>         global a
>         num=len(a)
>         for i in a:
>                 sums+=bodyStressTensors()[i][2][2]
>         stress=sums/num
>         return stress
>
> However, this is not efficient at all (as you can tell, with such a loop
> in the function).
> So, what's the most efficient way to get the stress in z direction from
> spherical bodies of a model with iterPeriod of e.g.100.
>
> Shall I use VTKRecorder?
>
> I wonder if others are using VTKRecorder, that much or not? But, I'm not
> used to it yet. I appreciate if you can share your ideas or experience in
> dealing with such a case.
>
> Regards,
> Behzad
>
> --
> 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@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~yade-users
> More help   : https://help.launchpad.net/ListHelp
>

-- 
You received this question notification because you are a member of
yade-users, which is an answer contact for Yade.