yade-users team mailing list archive
-
yade-users team
-
Mailing list archive
-
Message #18425
[Question #676326]: Can I control the seed in randomdensepack?
New question #676326 on Yade:
https://answers.launchpad.net/yade/+question/676326
Hello to everyone,
I am trying to make a simulation of cutting of a synthetic sample (i will post the code above).
I am creating the sample with randomdensepack, but every time i am making the simulation , i take different diagramm of the force. This is due to the seed, that is in randomdensepack (which i can control).
My question is: If i want to put a constant value of the seed number, how i do it?
I haven't build yade from trunk, i install it via < sudo ....>
My ubuntu distribution is Bionic 18.04.
Thanks a lot.
The code is:
!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import division
from yade import plot,pack,timing, utils, geom
import time, sys, os, copy
# default parameters or from table
readParamsFromTable(noTableOk=True, # unknownOk=True,
density = 2674.3,
frictionAngle= 44, #frictionAngle
tensileStrength = 65e6, #Tensile Strength
poisson=.20,
cohesion = 65e6, #Shear Strength
young = 60e9,
intRadius=1.00, # to set initial contacts to larger neighbours
dtSafety=.8,
damping=0.6,
# Characteristic of sample:
x = 75e-3, #75e-3
y = 27e-3,
z= 6.35e-3, # edw to exoume balei na einai idio me to platos tou koptikou
# Characteristic of shperes
sphereRadius=1e-3, #0.35e-3
rRelFuzz=.34,
#characteristic of cutter
x_cutter = 5e-3, # mhkos kata ton x-axona
y_cutter = 1e-3, # ipsos koptikou (y-axona)
z_cutter = 6.35e-3, # platos koptikou
DOC = 5e-3, #Bathos kopis
)
from yade.params.table import *
if 'description' in O.tags.keys(): O.tags['id']=O.tags['id']+O.tags['description']
#material properties
sample = O.materials.append(JCFpmMat(young=young, poisson=poisson, frictionAngle=radians(frictionAngle), cohesion=cohesion, tensileStrength=tensileStrength,density = density, label='spheres'))
sps=SpherePack()
sp=pack.randomDensePack(pack.inAlignedBox((-x,-y,-z),(x,y,z)),radius=sphereRadius,rRelFuzz=rRelFuzz,spheresInCell=1000,returnSpherePack=True) #spheresInCell=2000
sp.toSimulation(color=(1.09,1.0,0.0),wire=False,material=sample)
#kataskeuh koptikou
bx = geom.facetBox(center=(-80e-3,27e-3+y_cutter,0.0),extents=(x_cutter,-(5e-3+DOC),z_cutter),orientation=Quaternion((0,0,1),-pi/36), wallMask=(2+8))
O.bodies.append(bx)
for facet in bx:
facet.state.blockedDOFs='xyzXYZ' #block e.w na metakineitai mono kata ton x-axona
facet.state.vel=(5.0,0,0) # taxuthta kata ton x-axona
O.dt=dtSafety*PWaveTimeStep()
O.engines=[
ForceResetter(),
InsertionSortCollider([Bo1_Sphere_Aabb(aabbEnlargeFactor=intRadius,label='is2aabb'),Bo1_Facet_Aabb()],verletDist=.05*sphereRadius),
InteractionLoop(
[Ig2_Sphere_Sphere_ScGeom(interactionDetectionFactor=intRadius,label='ss2sc'), Ig2_Facet_Sphere_ScGeom()],
[Ip2_JCFpmMat_JCFpmMat_JCFpmPhys(cohesiveTresholdIteration=1)], # Ip2_FrictMat_FrictMat_FrictPhys(),
[Law2_ScGeom_JCFpmPhys_JointedCohesiveFrictionalPM(Key='cracks',recordCracks=True,cracksFileExist=True,label='interactionLaw')],
),
GlobalStiffnessTimeStepper(),
VTKRecorder(fileName='3d-vtk-',recorders=['spheres','intr','all','cracks','jcfpm','facets'],Key='cracks',iterPeriod=150),
NewtonIntegrator(damping=damping,label='damper'),
PyRunner(command='addPlotData()',realPeriod=2),
PyRunner(command='StopSimulation()',iterPeriod=50),
]
def addPlotData():
global Fx
global dx
Fx = 0.0
Fx = abs(sum(O.forces.f(facet.id)[0] for facet in bx))
plot.addData(i = O.iter , Fx=Fx, dx = bx[0].state.pos[0], tc=interactionLaw.nbTensCracks, sc=interactionLaw.nbShearCracks)
plot.saveDataTxt(O.tags['d.id']+'.txt')
def StopSimulation():
if bx[0].state.pos[0] >= 0.0:
O.pause()
plot.plots={'dx':('Fx'), ' dx':('tc', 'sc')}
plot.plot()
print " Number of particles: %s" %(len(O.bodies))
print " Number of Interactions per Particle: %s" %(utils.avgNumInteractions())
print " Porosity of sample is: %s" %(utils.porosity())
print "\n"
O.step()
is2aabb.aabbEnlargeFactor = 1.00
ss2sc.interactionDetectionFactor = 1.00
print " Number of particles: %s" %(len(O.bodies))
print " Number of Interactions per Particle: %s" %(utils.avgNumInteractions())
print " Porosity of sample is: %s" %(utils.porosity())
--
You received this question notification because your team yade-users is
an answer contact for Yade.