New question #677516 on Yade: https://answers.launchpad.net/yade/+question/677516
Hey, I am trying to implement nbTensCracks and nbShearCracks functions [1] & [2], to count the number of breakage after compression of one single particle. BTW, I faced attribute error, the error is: AttributeError: 'Law2_ScGeom_JCFpmPhys_JointedCohesiveFrictionalPM' object has no attribute 'nbTensCracks'. [1] https://answers.launchpad.net/yade/+question/635871 [2] https://answers.launchpad.net/yade/+question/676014 the MWE is as follows: from yade import pack, utils, ymport, export import numpy as np import yade.timing import matplotlib.pyplot as plt import os.path particleDiameter = 0.6e-3 displacementRate = 1.6667e-6 # m/s strainRate = displacementRate/particleDiameter # m/s young =3e8 #elastic modulus [Pa] poisson = 0.3 density = 5000 relDuctility=30 #relative ductility of bonds in normal direction mn,mx=Vector3(-0.52e-3, -1e-3,-1e-3),Vector3(0.52e-3, 1e-3, 1e-3) #size of particle finalFricDegree = 25 #Contact friction angle intRadius= 1.329 #Internal Radius sigmaT = 7e6 #Normal shear stress identifier=str(particleDiameter) output='./out/'+identifier rate = strainRate*10000 stabilityThreshold=0.01 iterper=1000 #Periodicity criterion using step number (deactivated if <= 0) cohesion=20e6 jCFmat = O.materials.append(JCFpmMat(young=young, cohesion=cohesion, density=density, frictionAngle=radians(finalFricDegree), tensileStrength=sigmaT, poisson=poisson, label='JCFmat')) #frictionless walls wallmat = O.materials.append(FrictMat(young=80e9,poisson=.45,frictionAngle=radians(finalFricDegree),density=7000,label='frictionlessWalls')) walls=aabbWalls([mn,mx], material='frictionlessWalls') wallIds=O.bodies.append(walls) sp = O.bodies.append(ymport.textExt('sandGrain_0-6mmdiameter.spheres', 'x_y_z_r',color=(0,0.2,0.7), material='JCFmat')) triax = TriaxialStressController( thickness=0, stressMask=7, internalCompaction=False, ) O.engines=[ ForceResetter(), InsertionSortCollider([Bo1_Sphere_Aabb(aabbEnlargeFactor=intRadius),Bo1_Box_Aabb()]), InteractionLoop( [Ig2_Sphere_Sphere_ScGeom6D(interactionDetectionFactor=intRadius),Ig2_Box_Sphere_ScGeom()], [Ip2_FrictMat_FrictMat_FrictPhys(),Ip2_JCFpmMat_JCFpmMat_JCFpmPhys(cohesiveTresholdIteration=10, label='jcf')], [Law2_ScGeom_JCFpmPhys_JointedCohesiveFrictionalPM(Key=identifier, smoothJoint=True,label='interactionLaw', recordCracks=True, neverErase=True),Law2_ScGeom_FrictPhys_CundallStrack()] ), GlobalStiffnessTimeStepper(active=1,timeStepUpdateInterval=100,timestepSafetyCoefficient=0.5), triax, VTKRecorder(dead=0,Key=identifier,iterPeriod=iterper,initRun=True,fileName=(output+'-'),recorders=['spheres','intr','stress', 'bstresses','jcfpm','cracks']), NewtonIntegrator(damping=0.9) ] O.dt = 0.3 * utils.PWaveTimeStep() from yade import qt v=qt.Controller() v=qt.View() from yade import plot O.engines=O.engines[0:6]+[PyRunner(iterPeriod=iterper/4,command='stressStrainHist()',label='recorder')]+O.engines[6:7] def stressStrainHist(): plot.addData(e11=np.exp(-O.engines[4].strain[0])-1, e22=exp(-(O.engines[4].strain[1]))-1, e33=-O.engines[4].strain[2], s11=-O.engines[4].stress(0)[0], s22=-O.engines[4].stress(2)[1], s33=-O.engines[4].stress(4)[2], i=O.iter, displacement=(exp(-(O.engines[4].strain[1]))-1)*particleDiameter, P = -O.engines[4].stress(0)[0]*O.engines[4].height*O.engines[4].depth) plot.saveDataTxt('txt/data'+identifier+'.txt',vars= ('displacement','e11','s11','P')) plot.plots={'displacement':(('P'))} #,None,('Uk'))} plot.plot() def addPlotData(): yade.plot.addData({'i':O.iter, 'tc':interactionLaw.nbTensCracks, 'sc':interactionLaw.nbShearCracks, 'te':interactionLaw.totalTensCracksE, 'se':interactionLaw.totalShearCracksE, 'unbF':utils.unbalancedForce()}) }) plot.saveDataTxt('txt/data.txt') #### coordination number verification numSSlinks=0 numCohesivelinks=0 for i in O.interactions: if isinstance(O.bodies[i.id1].shape,Sphere) and isinstance(O.bodies[i.id2].shape,Sphere): numSSlinks+=1 if i.phys.isCohesive : numCohesivelinks+=1 print "nblinks=", numSSlinks, " | nbCohesivelinks=", numCohesivelinks, " || Kcohesive=", 2.0*numCohesivelinks/nbSpheres O.engines=O.engines[0:7]+[PyRunner(iterPeriod=iterper/4,command='stopifDamaged()',label='recorder')]+O.engines[7:8] def stopifDamaged(): sigma,eps, P=plot.data['s11'],plot.data['e11'],plot.data['P'] if O.iter > 5000: if P[-1]>10 and P[-1] < 0.6*max(P): print 'failure reached' yade.timing.stats() O.pause() triax.stressMask = 0 triax.goal2=rate triax.goal1=-rate triax.goal3=rate -- 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 : yade-users@lists.launchpad.net Unsubscribe : https://launchpad.net/~yade-users More help : https://help.launchpad.net/ListHelp