utils.getStressAndTangent()

Asked by dan.wang

from your website, i can see there is a command called utlis.getStressAndTangent() which can give a macroscopic Tangent. However, the program with such command has error:

AttributeError: 'module' object has no attribute 'getStressAndTangent'

Yade on my computer is 1.07.0, i am wondering it is the version problem.

And also, if it is the version problem, how can i update the Yade version, for i have input " sudo apt-get install yade" in terminal and it says the version is the newest.

You can use such codes to test what i met:
-------------------------------------------------------------------------
#!/usr/bin/python # This is server.py file

import string
from yade import plot,qt
from yade.pack import *
from yade import pack, plot
import socket # Import socket module
import numpy # initial the math of matrix compute (needed in ns)

# initial the global variables
arrcc =[0]*3 # last step strain(commit)
arrtt =[0]*3 # last step strain(trail)
scc=[0]*3 # last step stress
orst=1 # initialize the orginal save document(trial)
check=[0]*1 # I need to calculate the first step when ag=0
check[0]=0
theTangent=(0)
# load the identical package
O.load('/tmp/cccc.gz') # only load the package, because the O.cell.velGrad is not compatible with the peri3dcontroller eigine

#O.periodic=True ### note!!! add
O.dt=1e-8

# see the example of peri3dcontroller, 1.5 is used to speed up the computation
EnlargeFactor=1.5
EnlargeFactor=1.0
O.engines=[
 ForceResetter(),
 InsertionSortCollider([Bo1_Sphere_Aabb(aabbEnlargeFactor=EnlargeFactor,label='bo1s')]),
 InteractionLoop(
  [Ig2_Sphere_Sphere_ScGeom(interactionDetectionFactor=EnlargeFactor,label='ig2ss')],
  [Ip2_CpmMat_CpmMat_CpmPhys()],[Law2_ScGeom_CpmPhys_Cpm()]),
 NewtonIntegrator(),
 #VTKRecorder(fileName='3dfirst-vtk-',recorders=['all','cpm'],iterPeriod=4999),

]

O.cell.velGrad=utils.Matrix3(0,0,0,0,0,0,0,0,0)
O.step()
bo1s.aabbEnlargeFactor=ig2ss.interactionDetectionFactor=1. # O.step and change 1.5 back to 1. , because the concrete model is developed in the 1. environment

if orst==1:
 print "orst1"

 for b in O.bodies:
  b.material.young = 1.0001*17e10

 orst=2
 ag = [0]*3 # current - last ie. the changed strain
 ag[0] = 0
 ag[1]= 0
  ag[2] =0
 ns=100
 dstrain = utils.Matrix3(ag[0],ag[2],0,0,ag[1],0,0,0,0) # the goal strain xx xy xz, yx yy yz, zx zy zz
 O.cell.velGrad=dstrain/(ns*O.dt)
 O.run(ns,True)
 stressValue=utils.getStress()
 stressxx=stressValue[0,0] # the return stress xx
 stressyy=stressValue[1,1] # the return stress yy
 stressxy=(stressValue[0,1]+stressValue[1,0])/2 # the return stress xy = (xy + yx)/2

 print "stress here from strain[0,0,0] step 1"
 print stressxx
 print stressyy
 print stressxy

 theTangent=utils.getStressAndTangent()
 print theTangent
 O.saveTmp('first')

-------------------------------------------------------------------------------------------------

Thanks a lot!

Question information

Language:
English Edit question
Status:
Solved
For:
Yade Edit question
Assignee:
No assignee Edit question
Solved by:
Jan Stránský
Solved:
Last query:
Last reply:
Revision history for this message
Best Jan Stránský (honzik) said :
#1

Hello,
yes, getStressAndTangent is missing because of old Yade version, 1.07 is from 2014-01

apt-get tells it is the newest version in the package repository of your operating system (Ubuntu?). To have this functionality:
1) upgrade your system to a newer version
2) compile newer version of Yade from source (but on older system, it is likely there will be some problems)

so option 1) is the way to go, but it may be time consuming and you should backup all your data (I faced several times that during upgrades I would have lost some data if I did not make backup)

cheers
Jan

Revision history for this message
Bruno Chareyre (bruno-chareyre) said :
#2

3) install yadedaily maybe (see installation page in the doc)

Revision history for this message
dan.wang (dan.wang) said :
#3

Thanks Jan Stránský, that solved my question.