# yade-users team mailing list archive

## Re: [Question #698058]: confused by UniaxialStrainer's parameters and uniaxial compression test

```Question #698058 on Yade changed:

Description changed to:
Dear all,
As a beginner of Yade,I want to start with the uniaxial compression test.I refer to the code of many people on the forum.
When I run the following code, no matter how to modify the parameters of UniaxialStrainer(), I can't get the ideal stress-strain curve.The problems are as follows:
1.When the following code is run, the strain increases and the stress remains constant after an instantaneous increase.
2.When I changed the parameter asymmetry of uniaxialstrain() to 1, the cylinder was scattered from below, which puzzled me.
3.In the above process, I am also puzzled by the positive and negative values of stress and strain.In my understanding, when strainrate is set to a negative value, the stress and strain are both compressive, then both are negative. But the actual situation doesn't seem to be like this. I don't know if I understand it right.
Can anyone help me? Thanks!!

#######code####
normalCohesion=1e9
shearCohesion=1e9
RollingStiffness=1

material_1=O.materials.append(CohFrictMat(young=23e9,poisson=0.4,frictionAngle=atan(0.5),density=2036,normalCohesion=normalCohesion,shearCohesion=shearCohesion,fragile=True))
sp.toSimulation(material=material_1)

for b in O.bodies:
b.shape.color=(0,1,0)

factor=1.5
damping=0.4
strainRate_Tension=-0.005

renderer=qt.Renderer()
renderer.dispScale=(10,10,10)

bb=uniaxialTestFeatures()
negIds,posIds,axis,crossSectionArea=bb['negIds'],bb['posIds'],bb['axis'],bb['area']

O.engines=[
ForceResetter(),
InteractionLoop(
[Ig2_Sphere_Sphere_ScGeom6D(interactionDetectionFactor=factor,label='ig2ss')],
[Ip2_CohFrictMat_CohFrictMat_CohFrictPhys(setCohesionNow=True,setCohesionOnNewContacts=False)],
[Law2_ScGeom6D_CohFrictPhys_CohesionMoment(useIncrementalForm=True,always_use_moment_law=False)],
),
NewtonIntegrator(damping=damping,label='damper'),
PyRunner(iterPeriod=4,command='stopIfDamaged()',label='damageChecker'),
]

O.dt=0
O.step()
bo1s.aabbEnlargeFactor=1
ig2ss.interactionDetectionFactor=1
O.dt=0.8*PWaveTimeStep()

for i in O.interactions:
i.phys.cohesionDisablesFriction=True

O.engines=O.engines[:4]+[UniaxialStrainer(strainRate=strainRate_Tension,axis=axis,asymmetry=1,posIds=posIds,negIds=negIds,crossSectionArea=crossSectionArea,blockDisplacements=False,blockRotations=False,setSpeeds=True,label='strainer')]+O.engines[4:]

dim=utils.aabbExtrema()
if strainRate_Tension<0:
layerSize=.05
height=dim[axis]-dim[axis]
for b in O.bodies:
if isinstance(b.shape,Sphere):
if(b.state.pos[axis] < (dim[axis]+layerSize*height)) or (b.state.pos[axis] > (dim[axis]-layerSize*height)):
b.shape.color=(1,1,1)

for i in O.interactions:
if isinstance(O.bodies[i.id1].shape,Sphere) and isinstance(O.bodies[i.id2].shape,Sphere):
if O.bodies[i.id1].shape.color==(1,1,1) or O.bodies[i.id2].shape.color==(1,1,1):

def stopIfDamaged():
if O.iter<2 or 'sigma' not in plot.data : return
sigma=plot.data['sigma']
extremum=max(sigma)
if extremum==0 : return
if abs(sigma[-1]/extremum)<0.5 or abs(strainer.strain)>5e2:
print('damaged')
O.pause()
plot.plots={'eps':('sigma'),'i':('eps')}
plot.plot()
O.saveTmp()