← Back to team overview

yade-users team mailing list archive

Re: [Question #700980]: How to change the strainRate value of TriaxialCompressionEngine during the simulation period?

 

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

Xifan Li posted a new comment:
Thank you Robert, I have changed the engine I use from
TriaxialCompressionEngine to TriaxialStressController,

My code is below.

This code can run normally, but it still cannot make the cyclic loading
realizable.

[1] So I would like to know how to change the parameters in the
TriaxialStressController engine while the simulation is running? (Like
change the triax.goal1 and tiax.goal2 and the stressMask?

###############

from yade import pack
# The following 5 lines will be used later for batch execution
nRead=readParamsFromTable(
	num_spheres=1000,# number of spheres
	compFricDegree = 30, # contact friction during the confining phase
	key='_triax_base_', # put you simulation's name here
	unknownOk=True
)
from yade.params import table

num_spheres=table.num_spheres# number of spheres
key=table.key
targetPorosity = 0.43 #the porosity we want for the packing
compFricDegree = table.compFricDegree # initial contact friction during the confining phase (will be decreased during the REFD compaction process)
finalFricDegree = 30 # contact friction during the deviatoric loading
rate=-0.02 # loading rate (strain rate)
damp=0.2 # damping coefficient
stabilityThreshold=0.01 # we test unbalancedForce against this value in different loops (see below)
young=5e6 # contact stiffness
mn,mx=Vector3(0,0,0),Vector3(10,10,.1) # corners of the initial packing


## create materials for spheres and plates
O.materials.append(FrictMat(young=young,poisson=0.5,frictionAngle=radians(compFricDegree),density=2600,label='spheres'))
O.materials.append(FrictMat(young=young,poisson=0.5,frictionAngle=0,density=0,label='walls'))

## create walls around the packing
walls=aabbWalls([mn,mx],thickness=0,material='walls')
wallIds=O.bodies.append(walls)

## use a SpherePack object to generate a random loose particles packing
sp=pack.SpherePack()

sp.makeCloud(minCorner=mn,maxCorner=mx,rRelFuzz=0,num=2000)
sp.toSimulation(material='spheres')

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

	)
	
	
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,
	
	TriaxialStateRecorder(iterPeriod=100, file='WallStresses.txt'),
	NewtonIntegrator(damping=damp),
	PyRunner(command='triaxload()',iterPeriod=1, label='triaxload'),

	#PyRunner(command='triaxload()',realPeriod=2, label='triaxload')
]

triax.stressMask = 1
triax.goal1=-2e5
triax.goal2=rate


def triaxload():
        O.triax.goal1=-3e5
	if abs(O.triax.stress(triax.wall_top_id)[1])> 150000:
		O.triax.stressMask = 1
		O.triax.goal1=-3e5
		O.triax.goal2=rate
		triaxload.command=('triaxunload')
	
def triaxunload():
	if abs(triax.stress(triax.wall_top_id)[1])< 5e4:
		triax.stressMask = 1
		triax.goal1=-1e5
		triax.goal2=rate




from yade import plot


O.engines=O.engines[0:5]+[PyRunner(iterPeriod=20,command='history()',label='recorder')]+O.engines[5:7]
def history():
	plot.addData(e11=-triax.strain[0], 
	        e22=-triax.strain[1], 
		s11=-triax.stress(triax.wall_right_id)[0],
		s22=-triax.stress(triax.wall_top_id)[1],
		
		i=O.iter)

plot.plots={'e11': ('s11',),'e22': ('s22',)}

O.saveTmp()
plot.plot()

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.