New question #185785 on Yade:
https://answers.launchpad.net/yade/+question/185785

Hi all,

   I'm trying to modify the utils.normShearStressTensors in order to obtain the 
local stress in a periodic Cell during a simpleShear test.

I define a  function LocalStress.
It has as input the coordinates of the 2 corner of the box where I want to 
evaluate the stress.

this is the function:

* Return the stress tensor decomposed in 2 contributions, from normal and shear 
forces.
The formulation follows the [Thornton2000]_ article
"Numerical simulations of deviatoric shear deformation of granular media", eq 
(3) and (4)
 */

def localStress(undCorner, upCorner): #inputs are the 2 corners of the box 
where we want to evaluate the stress
                
        
        
         for k in O.interactions: 
                
                
                

            if (k.isReal): # check if is a real interaction

              mPt=k.geom.contactPoint   #  assign to mPt the coordinates of the 
contact point
              
              if mPt(0)<upCorner(0) and mPt(0)<undCorner(0):                    
       # check if the contact point is inside the box
                     if mPt(1)<upCorner(1) and mPt(1)<undCorner(1):
                            if mPt(2)<upCorner(2) and mPt(2)<undCorner(2):

                                 n=k.geom.normal

                                 # if compression has positive sign, we need to 
change sign for both normal and shear force
                                 # make copy to Fs since shearForce is used at 
multiple places (less efficient, but avoids confusion)

                                 Fs=k.phys.shearForce
                                 
                                 N=k.phys.normalForce.n
                                 
                                 T=Fs.norm()
                                 
                                 
                                 if(T>0): t=Fs/T

                
                                 R=.5*(k.geom.refR1+k.geom.refR2)

              for i in range(0,3):
                 for j in range(i,3):
                    sigNorm[i,j]=R*N*n[i]*n[j]    
                    sigTan[i,j]=R*T*n[i]*t[j]
                
        
         
vol=(upCorner(0)-undCorner(0))*(upCorner(1)-undCorner(1))*(upCorner(1)-undCorner(1));
 # evaluate the volume of the box
         sigNorm=2/vol*sigNorm;   # evaluate the stress tensor due to normal 
force 
         sigTan=2/vol*sigTan;     # evaluate the stress tensor due to 
tangential force

         #// fill terms under the diagonal
         sigNorm[1,0]=sigNorm[0,1]  
         sigNorm[2,0]=sigNorm[0,2] 
         sigNorm[2,1]=sigNorm[1,2]
         sigTan[1,0]=sigTan[0,1] 
         sigTan[2,0]=sigTan[0,2] 
         sigTan[2,1]=sigTan[1,2]
        
         return (sigNorm,sigTan)

then in the script:

LocStress=localStress([0.0001,0.0001,0.0001],[0.0002,0.0002,0.0002])

and this is what I get:

Yade [1]: 
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)

/usr/lib/yade-daily/py/yade/__init__.pyc in <module>()
----> 1 
      2 
      3 
      4 
      5 

/usr/lib/yade-daily/py/yade/__init__.pyc in saveData()
    197         damping=contactLaw.normDampDissip  # viscous damping
    198         # 
-------------------------------------------------------------------------

--> 199         
LocStress=localStress((0.00001,0.00001,0.00001),(0.00002,0.00002,0.00002))
    200 
    201         plot.addData(

/usr/lib/yade-daily/py/yade/__init__.pyc in localStress(undCorner, upCorner)
     55               mPt=k.geom.contactPoint   #  assign to mPt the 
coordinates of the contact point
     56 
---> 57               if mPt(0)<upCorner(0) and mPt(0)<undCorner(0):            
               # check if the contact point is inside the box
     58                      if mPt(1)<upCorner(1) and mPt(1)<undCorner(1):
     59                             if mPt(2)<upCorner(2) and 
mPt(2)<undCorner(2):

TypeError: 'Vector3' object is not callable

What's wrong?

Thanks for any suggestions,

Giuseppe







-- 
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     : [email protected]
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp

Reply via email to