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

Hello all,

I am trying to code a simple Triaxial problem in the way that at the first 
stage, isotropic stress is applied on the specimen, and at the second stage, a 
deviatoric stress in z direction is applied. The result I want to get is the 
stress and strain curve as those we see on soil mechanics books. 

I am using Ubuntu 18.04, and Yade 2019-08-08.git-775ae74

I coded this problem with TriaxialCompressionEngine while it was working 
limited and Yade suggested to use TriaxialStressController. Now, the code gives 
the following WARNINGS and does not work:

ehsan@ehsan:~/Desktop/mycodes/3axtst$ 
/home/ehsan/yade/install/bin/yade-2019-08-08.git-775ae74 3axtst.py
Welcome to Yade 2019-08-08.git-775ae74 
Using python version: 3.6.8 (default, Oct  7 2019, 12:59:55) 
[GCC 8.3.0]
TCP python prompt on localhost:9000, auth cookie `sdseua'
XMLRPC info provider on http://localhost:21000
Running script 3axtst.py
<WARNING> SpherePack:242 long int SpherePack::makeCloud(Vector3r, Vector3r, 
Real, Real, int, bool, Real, const std::vector<double>&, const 
std::vector<double>&, bool, int, Matrix3r): Exceeded 1000 tries to insert 
non-overlapping sphere to packing. Only 658 spheres were added, although you 
requested 2000. Trying again with porosity 0.46. The size distribution is being 
scaled down
<WARNING> SpherePack:242 long int SpherePack::makeCloud(Vector3r, Vector3r, 
Real, Real, int, bool, Real, const std::vector<double>&, const 
std::vector<double>&, bool, int, Matrix3r): Exceeded 1000 tries to insert 
non-overlapping sphere to packing. Only 689 spheres were added, although you 
requested 2000. Trying again with porosity 0.514. The size distribution is 
being scaled down
<WARNING> SpherePack:242 long int SpherePack::makeCloud(Vector3r, Vector3r, 
Real, Real, int, bool, Real, const std::vector<double>&, const 
std::vector<double>&, bool, int, Matrix3r): Exceeded 1000 tries to insert 
non-overlapping sphere to packing. Only 872 spheres were added, although you 
requested 2000. Trying again with porosity 0.5626. The size distribution is 
being scaled down
<WARNING> SpherePack:242 long int SpherePack::makeCloud(Vector3r, Vector3r, 
Real, Real, int, bool, Real, const std::vector<double>&, const 
std::vector<double>&, bool, int, Matrix3r): Exceeded 1000 tries to insert 
non-overlapping sphere to packing. Only 1056 spheres were added, although you 
requested 2000. Trying again with porosity 0.60634. The size distribution is 
being scaled down
<WARNING> SpherePack:242 long int SpherePack::makeCloud(Vector3r, Vector3r, 
Real, Real, int, bool, Real, const std::vector<double>&, const 
std::vector<double>&, bool, int, Matrix3r): Exceeded 1000 tries to insert 
non-overlapping sphere to packing. Only 1258 spheres were added, although you 
requested 2000. Trying again with porosity 0.645706. The size distribution is 
being scaled down
<WARNING> SpherePack:242 long int SpherePack::makeCloud(Vector3r, Vector3r, 
Real, Real, int, bool, Real, const std::vector<double>&, const 
std::vector<double>&, bool, int, Matrix3r): Exceeded 1000 tries to insert 
non-overlapping sphere to packing. Only 1705 spheres were added, although you 
requested 2000. Trying again with porosity 0.681135. The size distribution is 
being scaled down
Traceback (most recent call last):
  File "/home/ehsan/yade/install/bin/yade-2019-08-08.git-775ae74", line 336, in 
runScript
    execfile(script,globals())
  File "/usr/lib/python3/dist-packages/past/builtins/misc.py", line 82, in 
execfile
    exec_(code, myglobals, mylocals)
  File "3axtst.py", line 20, in <module>
    maxMultiplier=1.+2e4/young, # spheres growing factor (fast growth)
NameError: name 'young' is not defined
[[ ^L clears screen, ^U kills line. F12 controller, F11 3D view (press "h" in 
3D view for help), F10 both, F9 generator, F8 plot. ]]

In [1]:    

*********************************************
my code is:

import numpy as np
import math
from yade import pack, plot, qt, export, utils
from datetime import datetime

sp=pack.SpherePack()
mn, mx=Vector3(0,0,0), Vector3(10,10,10)
sp.makeCloud(minCorner=mn,maxCorner=mx,rRelFuzz=0.2,num=2000,porosity=0.4)      


O.materials.append(FrictMat(young=15e6,poisson=0.4,frictionAngle=radians(30),density=2600,label='spheres'))
     
O.materials.append(FrictMat(young=15e6,poisson=0.4,frictionAngle=0,density=0,label='frictionless'))
     

O.bodies.append([sphere(center,rad,material='spheres') for center, rad in sp])

walls=aabbWalls(thickness=1e-10,material='frictionless')        
wallIds=O.bodies.append(walls)  

triax=TriaxialStressController(
        maxMultiplier=1.+2e4/young, # spheres growing factor (fast growth)
        finalMaxMultiplier=1.+2e3/young, # spheres growing factor (slow growth)
        thickness = 0,
        stressMask = 7,
        internalCompaction=False,
)


#*****   APPLYING CONFINING PRESSURE   *****#

triax.stressMask = 7
triax.goal1=triax.goal2=triax.goal3=-50e3


#*****   DEVIATORIC LOADING   *****#

triax.stressMask = 3
triax.goal1=triax.goal2 =-50e3
triax.goal3 = -0.2
newton.damping=0.1

#triax=TriaxialCompressionEngine(
#       wall_bottom_id=wallIds[2],
#       wall_top_id=wallIds[3],
#       wall_left_id=wallIds[0],
#       wall_right_id=wallIds[1],
#       wall_back_id=wallIds[4],
#       wall_front_id=wallIds[5],
#       internalCompaction=False,
#       sigmaIsoCompaction=-50e3,
#       sigmaLateralConfinement=-50e3,
#       max_vel=10,
#       strainRate=0.01,
#       label="triax",
#)


O.engines=[
        ForceResetter(),        
        InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Box_Aabb()]),      
        InteractionLoop(
        [Ig2_Sphere_Sphere_ScGeom(),Ig2_Box_Sphere_ScGeom()],   
        [Ip2_FrictMat_FrictMat_FrictPhys()],    
        [Law2_ScGeom_FrictPhys_CundallStrack()] 
        ),
        
GlobalStiffnessTimeStepper(active=1,timeStepUpdateInterval=100,timestepSafetyCoefficient=0.8),
        triax,
        NewtonIntegrator(damping=0.4)
]

O.engines=O.engines[0:5]+[PyRunner(iterPeriod=20,command='history()',label='recorder')]+O.engines[5:7]
#O.engines=O.engines[0:5]+[PyRunner(command='checkUnbalanced()',realPeriod=2)]+O.engines[5:7]
#O.engines=O.engines[0:5]+[VTKRecorder(fileName='3d-vtk-',recorders=['all'],iterPeriod=1000)]+O.engines[5:7]
#O.engines=O.engines[0:5]+[qt.SnapshotEngine(fileBase='3d-',iterPeriod=200,label='snapshot')]+O.engines[5:7]
#O.engines=O.engines[0:5]+[PyRunner(command='finish()',iterPeriod=20000)]+O.engines[5:7]

O.dt=.5*PWaveTimeStep()

qt.View()

def finish():
        makeVideo(snapshot.snapshots,'3d.mpeg',fps=10,bps=10000)
        O.pause()

#rr=yade.qt.Renderer()
#rr.shape=False
#rr.intrPhys=True

def history():
        plot.addData(unbalanced=unbalancedForce(),i=O.iter,**O.energy,
                e11=-triax.strain[0], e22=-triax.strain[1], 
e33=-triax.strain[2],
                s11=-triax.stress(0)[0], s22=-triax.stress(2)[1], 
s33=-triax.stress(4)[2],
                Etot=O.energy.total())


#O.trackEnergy=True


def checkUnbalanced():
        if unbalancedForce()<.05:
                O.pause()
                plot.saveDataTxt('bbb.txt.bz2')

for i in O.interactions:
   id1,id2 = i.id1,i.id2
   fn = i.phys.normalForce
   fs = i.phys.shearForce

#plot.plots={'i':('unbalanced'),'i':('s11','s22','s33'),'i':('e11','e22','e33'),'i':(O.energy.keys,None,'Etot')}
plot.plots={'i':('unbalanced'),'i ':('s11','s22','s33'),' 
i':('e11','e22','e33'),'e22':('s22')}
plot.labels={'unbalanced':'$F_{UB}$' , 's11':'$\sigma_{11}$' , 
's22':'$\sigma_{22}$' , 's33':'$\sigma_{33}$' , 'e11':'$\epsilon_{11}$' , 
'e22':'$\epsilon_{22}$' , 'e33':'$\epsilon_{33}$'}
#plot.saveGnuplot()

Gl1_Sphere.stripes=True

plot.plot()

O.saveTmp()

O.run(5000,True)
plot.saveDataTxt('results')


#print 'stress difference:', (triax.stress[2]-triax.stress[1])
#print 'mean stress:',(triax.stress[2]+triax.stress[1]+triax.stress[0])/3
#print 'porosity:', porosity()

*********************************

Thank you very much for your help.
Ehsan

-- 
You received this question notification because your team yade-users 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