← Back to team overview

yade-users team mailing list archive

Re: [Question #245254]: Update interaction and material parameters during the simlulation process

 

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

Henry posted a new comment:
Thanks to Jan.
 Follows is a part of my script. I want to change the material paramteres during the simulation. But I found there is no change whether use the function of 'Par_Change() or not .

The script:

SoilMat=O.materials.append(CohFrictMat(young=Young_Soil,poisson=0.2,density=den,frictionAngle=Frict_0,normalCohesion=Coh_0,shearCohesion=0.1*Coh_0,isCohesive=True,momentRotationLaw=True,etaRoll=0.1,label='soil'))

#def sphereMat(): return JCFpmMat(type=1,young=5.0e11,frictionAngle=Frict_0,density=3000) ## Rq: density needs to be adapted as porosity of real rock is different to granular assembly due to difference in porosity (utils.sumForces(baseBodies,(0,1,0))/(Z*X) should be equal to Gamma*g*h with h=Y, g=9.82 and Gamma=2700 kg/m3
O.bodies.append(ymport.text(packing+'.spheres',scale=1.0,shift=Vector3(0,0,0),material=SoilMat))

O.engines=[

	ForceResetter(),
	InsertionSortCollider([Bo1_Sphere_Aabb(aabbEnlargeFactor=interactionRadius,label='is2aabb'),Bo1_Box_Aabb()]),
	InteractionLoop(
		[Ig2_Sphere_Sphere_ScGeom6D(interactionDetectionFactor=interactionRadius,label='ss2d3dg'),Ig2_Box_Sphere_ScGeom6D()],#Ig2_Sphere_Sphere_ScGeom(interactionDetectionFactor=interactionRadius,label='ss2d3dg'),Ig2_Box_Sphere_ScGeom()],
        [Ip2_FrictMat_FrictMat_FrictPhys(),
        Ip2_CohFrictMat_CohFrictMat_CohFrictPhys(label='cohesiveIp')],#setCohesionNow=False,setCohesionOnNewContacts=False,
        [Law2_ScGeom_FrictPhys_CundallStrack(),Law2_ScGeom6D_CohFrictPhys_CohesionMoment(
			useIncrementalForm=True, #useIncrementalForm is turned on as we want plasticity on the contact moments
			always_use_moment_law=True,  #if we want "rolling" friction even if the contact is not cohesive (or cohesion is broken), we will have to turn this true somewhere
			label='cohesiveLaw')]
	),
	GlobalStiffnessTimeStepper(timeStepUpdateInterval=100,timestepSafetyCoefficient=0.8,defaultDt=O.dt),
    PyRunner(iterPeriod=1000,initRun=True,command='Par_Change()'),
	NewtonIntegrator(damping=0.5,gravity=(0.,-9.82,0.),label='Grav'),

]


def Par_Change():
    global Fos_Step,Coh_0,Frict_0
    global Fos,D_step
    if O.iter>Fos_Step:# and utils.unbalancedForce()<0.1:
        Fos=Fos+0.05
        Fos_Step=D_step+O.iter 
        Fri_Fos=math.atan(math.tan(Frict_0)/Fos)
         # here we modify the material and interaction physics
        for b in O.bodies:
            if b.material.id==0:
                b.mat.frictionAngle=Fri_Fos
                b.mat.normalCohesion=Coh_0/Fos
                b.mat.shearCohesion=0.1*Coh_0/Fos    
        for i in O.interactions:
            if O.bodies[i.id1].material.id==1 or O.bodies[i.id2].material.id==1:
                i.phys.normalCohesion=0.0
                i.phys.shearCohesion=0.0
                i.phys.frictionAngle=0.0
            else:
                i.phys.normalCohesion=Coh_0/Fos
                i.phys.shearCohesion=0.1*Coh_0/Fos
                i.phys.frictionAngle=Fri_Fos
 
Thanks a lot!
Henry

-- 
You received this question notification because you are a member of
yade-users, which is an answer contact for Yade.