← Back to team overview

yade-users team mailing list archive

[Question #676176]: Generate a sample with a porosity gradient; change sphere material in periodic simulation

 

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

Hello,

I'm trying to generate a random sample of porous material using Yade in the shape of a rectangular prism. I've used the spherePack function in the past to generate a spatially periodic REV like the one shown here: https://raw.githubusercontent.com/NauticalMile64/SVPGen_and_Rad/master/test/porous_block.png

This time, I want to create samples with a uniform porosity gradient. My idea for the best way to do this is to have the material stiffness for the spheres to vary over one dimension, so that penetrations are deeper near one end of the sample and shallower towards the opposite end.

The problem is I can't insert spheres into a periodic simulation that weren't generated from the spherePack object, and there spherePack assigns the same material ID to each sphere it creates. What I have tried to do is to individually add the spheres to the simulation based on the spherePack.makeCloud initialization function, and assign them a material with a stiffness based on their x-positions. But when I do this I get the error: 

FATAL /path/to/file/ThreadRunner.cpp:30 run: Exception occurred:
PeriTriaxController run on aperiodic simulation.

How can I add spheres of differing material to a periodic simulation? Alternatively, is there any way to edit the material of spheres which have already been added to the simulation?

My (simplified) script:

from yade import pack,export,utils
import cPickle,math,threading
import pickle as pkl
import numpy as np

maxBadRun=5	#Maximum number of times the simulation is allowed to restart before exiting with failure
alMaxF=5e-2	#Divergence criteria: simulation stops and restarts if the average penetration force exceeds this value
alAvgF=5e-3	#Divergence criteria: simulation stops and restarts if the average penetration force exceeds this value
dtStart=8e-6	#Starting time step size (may be decreased if the simulation is in a bad state)

porCheckInterval = 5000		#How often the porosity is checked for convergence
checkPointInterval = 10000	#How often the simulation is checkpointed for potential restarts

r=3e-4			#Mean Radius (m)
s=1.5e-4		#Width of uniform distribution from which radii are selected (m)
N=100			#Number of spheres
t=0.065			#Surface tension coefficient (N/m)
p=0.8			#Desired porosity
c=0

utils.readParamsFromTable(
	Row=0,
	Por=p,
	rMean=r,
	rStd=s,
	sig=t,
	numSpheres=N,
	Save=1
)

from yade.params.table import *
tPorosity=Por
REVL=math.pow(5*numSpheres*(float(4)/3*math.pi*rMean**3),float(1)/3) 
O.dt=dtStart

done=False

#Create the pack of spheres
REVX = 3*REVL
O.materials.append(BubbleMat(density=1e5))
sp=pack.SpherePack()
tnum=sp.makeCloud((0,0,0),(REVX,REVL,REVL),rMean=rMean,rRelFuzz=s,periodic=True,num=numSpheres)
sphVol=sp.relDensity()*REVL**3
tStrain=-10
REVl=0

smin = 0.05
smax = 0.2

sphList = []
for sph in sp:
	st = sph[0][0]/REVX*(smax-smin)+smin
	matID = O.materials.append(BubbleMat(density=1e5,surfaceTension=st))
	O.bodies.append([sphere(center=sph[0],radius=sph[1])])

#sp.fromList(sphList)

#sp.toSimulation() 
O.engines=[
	ForceResetter(),
	InsertionSortCollider([Bo1_Sphere_Aabb()],verletDist=0.5*r,allowBiggerThanPeriod=True),
	InteractionLoop([Ig2_Sphere_Sphere_ScGeom()],[Ip2_BubbleMat_BubbleMat_BubblePhys()],[Law2_ScGeom_BubblePhys_Bubble(pctMaxForce=0.15,surfaceTension=sig)]),
	NewtonIntegrator(damping=0.01),
	PeriTriaxController(goal=(tStrain,tStrain,tStrain),stressMask=0b000,maxUnbalanced=alMaxF, globUpdate=1,doneHook='reachedTargetStrain()',label='triax',dynCell=True,mass=1e8),
	GlobalStiffnessTimeStepper(active=False),#,defaultDt=dtStart,targetDt=dtStart,timestepSafetyCoefficient=1,label='stepper', timeStepUpdateInterval=checkPointInterval*100,maxDt=dtStart,densityScaling=True),
]


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