[Yade-users] [Question #698498]: How to use cellRepeat

2021-08-24 Thread Leonard
New question #698498 on Yade:
https://answers.launchpad.net/yade/+question/698498

Hi,
I'd like to ask how to use cellRepeat[1] function to stack several copies of a 
cell along one direction. One illustration can be found in Fig. 3 in [2].

I use the following MWE (from[3]) to make a sample in a cell, the MWE pauses 
after the sample reaches the target isotropic state. I'd like to reproduce 
several of the cell at that state, and stack them together along one direction, 
but I didn't make it after some attempts. Here is the MWE, it may take around 
50 seconds for running.
 MWE begins ###
from __future__ import print_function
sigmaIso = -100e3

from yade import pack, qt, plot
mn,mx=Vector3(0,0,0),Vector3(0.07,0.14,0.07)
O.periodic = True
O.cell.setBox(.07,.14,.07)
sp = pack.SpherePack()
sp.makeCloud(mn,mx,-1,0.,num=7000, periodic=True)
sp.toSimulation()

O.engines = [
ForceResetter(),
InsertionSortCollider([Bo1_Sphere_Aabb()]),
InteractionLoop([Ig2_Sphere_Sphere_ScGeom()], 
[Ip2_FrictMat_FrictMat_FrictPhys()], [Law2_ScGeom_FrictPhys_CundallStrack()]),
PeriTriaxController(
label='triax',
goal=(sigmaIso, sigmaIso, sigmaIso),
stressMask=7,
dynCell=True,
maxStrainRate=(10, 10, 10),
maxUnbalanced=.1,
relStressTol=1e-3,
doneHook='compactionFinished()'
),
NewtonIntegrator(damping=.2),
]
O.dt = .5 * PWaveTimeStep()
O.trackEnergy = True

def compactionFinished():
print('stage1 
finished','sxx',triax.stress[0],'syy',triax.stress[1],'szz',triax.stress[2])
O.cell.trsf=Matrix3.Identity
triax.goal = (sigmaIso, -0.1, sigmaIso)
triax.stressMask = 5
triax.maxStrainRate = (1., 0.5, 1.)
triax.maxUnbalanced = 10
O.pause()
# here I want to repeat the current cell

def triaxFinished():
print('Finished')
O.pause()

 MWE finish ###
Thanks very much!
Leonard

[1]https://yade-dev.gitlab.io/trunk/yade.pack.html?highlight=cell#yade._packSpheres.SpherePack.cellRepeat
[2]Cheng, Hongyang, Stefan Luding, Kuniyasu Saitoh, and Vanessa Magnanimo. 
"Elastic wave propagation in dry granular media: effects of probing 
characteristics and stress history." International journal of solids and 
structures 187 (2020): 85-99.
[3]https://gitlab.com/yade-dev/trunk/blob/master/doc/sphinx/tutorial/06-periodic-triaxial-test.py


-- 
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


Re: [Yade-users] [Question #698493]: Spheres overlap in periodic simulations

2021-08-24 Thread Andres Escobar
Question #698493 on Yade changed:
https://answers.launchpad.net/yade/+question/698493

Description changed to:
Hello,

I am currently performing a simulation of an inclined flume that goes
across the X-axis with periodic walls on the sides(Y-axis). This runs
without any major concern mainly thanks to the help provided on this
website to many other users. However, when it comes to doing the post-
processing, I have noticed that when a sphere crosses the periodic
border the following thing occurs:

The sphere's Y-axis(width) coordinates do not restart despite being now
on the opposite side of the flume. Instead, they keep increasing "out of
the flume". This is not a big concern since this can be easily adjusted
on the post-processing and I'm aware this could be useful in other
scenarios. Nevertheless, When the sphere crosses the periodic border, it
seems that no contact is considered against those particles that did not
cross the periodic boundary(or did it more than once). This is observed
after manually calculating each contact overlap. When doing this,
spheres on the same "coordinates" do have normal overlaps but those who
are not on the same boundary have a huge range of overlap(up to one
radius) as if no interaction occurs.

Based on this I am curious if this could be a bug or if I am missing any 
contact law that would allow contact between particles that are not on the same 
"coordinates". 
Finally, I have attached a few code lines regarding the engines used and how I 
add the spheres. 
If any additional information is required, or if there are any suggestions(or 
ideas), I'd be delighted to read about it.
Best,

Andrés

Additional information:

How spheres are added:
(This is not really relevant, just to emphasize that I add spheres through  
O.bodies.append(utils.sphere()) command. 

for i in np.arange(4*d,lr,2*d):
  for j in np.arange(d+hr,5*hr,2*d):
  for k in np.arange(-wc/2+3*d,wc/2-3*d,2*d):
  
O.bodies.append(utils.sphere((i,k,j),radius=float(random.randint(int(10*(d-disp)),int(10*(d+disp/10,material=sphereMat))


Engines:
O.engines=[
   ForceResetter(),
   
InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Box_Aabb()],allowBiggerThanPeriod=True),
   InteractionLoop(
#  handle sphere+sphere and box+sphere collisions
   [Ig2_Sphere_Sphere_ScGeom(),Ig2_Box_Sphere_ScGeom()],
   [Ip2_ViscElMat_ViscElMat_ViscElPhys()],
   [Law2_ScGeom_ViscElPhys_Basic()]),
   NewtonIntegrator(gravity=(g*sin(slope),0,-g*cos(slope)), damping=0), #add 
gravity
   
VTKRecorder(fileName=addrec+'3d-'+str(zeta)+'-vtk-',recorders=['all'],iterPeriod=it),
]

-- 
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


Re: [Yade-users] [Question #697783]: BoxFactory for creating spheres on periodic conditions

2021-08-24 Thread Andres Escobar
Question #697783 on Yade changed:
https://answers.launchpad.net/yade/+question/697783

Andres Escobar posted a new comment:
Hi Jérôme,

I did finally work on a function that performs the same task without any 
problems, thanks for your help with letting me know the source of the problem! 
Finally, I apologize for my late reply since I did read this earlier but I was 
convinced I had answered.
Best, 

Andrés

-- 
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


[Yade-users] [Question #698493]: Spheres overlap in periodic simulations

2021-08-24 Thread Andres Escobar
New question #698493 on Yade:
https://answers.launchpad.net/yade/+question/698493

Hello, 

I am currently performing a simulation of an inclined flume that goes across 
the X-axis with periodic walls on the sides(Y-axis). This runs without any 
major concern mainly thanks to the help provided on this website to many other 
users. However, when it comes to doing the post-processing, I have noticed that 
when a sphere crosses the periodic border the following thing occurs:

The sphere's Y-axis(width) coordinates do not restart despite being now on the 
opposite side of the flume. Instead, they keep increasing "out of the flume". 
This is not a big concern since this can be easily adjusted on the 
post-processing and I'm aware this could be useful in other scenarios. 
Nevertheless, When the sphere crosses the periodic border, it seems that no 
contact is detected against those particles that did not cross the periodic 
boundary(or did it more than once). This is observed after manually calculating 
each contact overlap. When doing this, spheres on the same "coordinates" do 
have normal overlaps but those who are not on the same boundary have a huge 
range of overlap(up to one radius) as if no interaction occurs.

Based on this I am curious if this could be a bug or if I am missing any 
contact law that would allow contact between particles that are not on the same 
"coordinates". 
Finally, I have attached a few code lines regarding the engines used and how I 
add the spheres. 
If any additional information is required, or if there are any suggestions(or 
ideas), I'd be delighted to read about it.
Best,

Andrés 

Additional information:

How spheres are added:
(This is not really relevant, just to emphasize that I add spheres through  
O.bodies.append(utils.sphere()) command. 

for i in np.arange(4*d,lr,2*d):
  for j in np.arange(d+hr,5*hr,2*d):
  for k in np.arange(-wc/2+3*d,wc/2-3*d,2*d):
  
O.bodies.append(utils.sphere((i,k,j),radius=float(random.randint(int(10*(d-disp)),int(10*(d+disp/10,material=sphereMat))


Engines:
O.engines=[
   ForceResetter(),
   
InsertionSortCollider([Bo1_Sphere_Aabb(),Bo1_Box_Aabb()],allowBiggerThanPeriod=True),
   InteractionLoop(
#  handle sphere+sphere and box+sphere collisions
   [Ig2_Sphere_Sphere_ScGeom(),Ig2_Box_Sphere_ScGeom()],
   [Ip2_ViscElMat_ViscElMat_ViscElPhys()],
   [Law2_ScGeom_ViscElPhys_Basic()]),
   NewtonIntegrator(gravity=(g*sin(slope),0,-g*cos(slope)), damping=0), #add 
gravity
   
VTKRecorder(fileName=addrec+'3d-'+str(zeta)+'-vtk-',recorders=['all'],iterPeriod=it),
]


-- 
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


[Yade-users] [Question #698487]: Change boundary condition from rigid wall to periodic boundary

2021-08-24 Thread Leonard
New question #698487 on Yade:
https://answers.launchpad.net/yade/+question/698487

Hi,
I'd like to ask is it possible that change model boundary from rigid wall to 
periodic boundary? My attempt is as follow:

I use script1 (from Bruno [1]) to generate a sample with rigid wall boundary, 
note that I set periodic=True in makeCloud. And then I save the sample as 
sample.yade.gz.

Then I import the sample.yade.gz into script2 (from periodic-triax example[2]), 
and I remove the rigid walls and give it a periodic boundary.

However, I failed in switching the boundary. The sample exploded immediately 
after one O.step() forward. I am not sure whether it is impossible to switch 
the boundary or I have not found out the correct way. Thereby, I'd like to ask 
for you advice for that: 
-Is it possible that change model boundary from rigid wall to periodic boundary 
after I generate a sample under the condition of rigid wall?
-The reason why I want to switch the boundary is that using the example code[1] 
(which is rigid wall) is easy to make a sample with target confining presure 
and porosity by using radii expansion methods (by setting 
internalCompaction=True), but it seems that there is no radii expansion method 
for periodic engine. Which makes it uneasy for using only periodic engine to 
generate target sample. Do you have any idea about how to integrate [1] and 
[2], specifically, making sample by using [1] and carrying out triaxial loading 
by using periodic engine as [2]?

Below are the MWE:
script1 begin##Around 15 second for running ##
from yade import pack, plot
nRead=readParamsFromTable(
 num_spheres=1000,
 compFricDegree = 30,
 key='_triax_base_',
 unknownOk=True
)
from yade.params import table

num_spheres=table.num_spheres
key=table.key
targetPorosity = 0.43
compFricDegree = table.compFricDegree
finalFricDegree = 30
rate=-0.02
damp=0.2
stabilityThreshold=0.01
young=5e6
mn,mx=Vector3(0,0,0),Vector3(0.7,0.7,1.4)

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'))
walls=aabbWalls([mn,mx],thickness=0,material='walls')
wallIds=O.bodies.append(walls)

sp=pack.SpherePack()
sp.makeCloud(mn,mx,-1,0.,num_spheres,periodic=True,porosity=0.95,seed=1)
O.bodies.append([sphere(center,rad,material='spheres') for center,rad in sp])

Gl1_Sphere.quality=3

### DEFINING ENGINES ###
triax=TriaxialStressController(
 maxMultiplier=1.+2e4/young,
 finalMaxMultiplier=1.+2e3/young,
 thickness = 0,
 stressMask = 7,
 internalCompaction=True,## please change True to False here to look at what I 
say
)

newton=NewtonIntegrator(damping=damp)

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,
 newton
]

Gl1_Sphere.stripes=0
if nRead==0: yade.qt.Controller(), yade.qt.View()

### APPLYING CONFINING PRESSURE ###
triax.goal1=triax.goal2=triax.goal3=-1
while 1:
 O.run(1000, True)
 unb=unbalancedForce()
 print 'unbalanced force:',unb,' mean stress: ',triax.meanStress
 if unbtargetPorosity:
 # we decrease friction value and apply it to all the bodies and contacts
 compFricDegree = 0.95*compFricDegree
 setContactFriction(radians(compFricDegree))
 print "\r Friction: ",compFricDegree," porosity:",triax.porosity,
 sys.stdout.flush()
 O.run(500,1)
print "### Compacted state saved ###"
O.save('sample.yade.gz')
script1 done##

script2 begin
from __future__ import print_function
sigmaIso = -10e3
from yade import pack, qt, plot

O.load('sample.yade.gz')

for i in range(6):
O.bodies.erase(i)

O.periodic = True
O.cell.setBox(0.7,0.7,1.4)
sp = pack.SpherePack()
sp.fromSimulation()
sp.toSimulation()

O.engines = [
ForceResetter(),
InsertionSortCollider([Bo1_Sphere_Aabb()]),
InteractionLoop([Ig2_Sphere_Sphere_ScGeom()], 
[Ip2_FrictMat_FrictMat_FrictPhys()], [Law2_ScGeom_FrictPhys_CundallStrack()]),
PeriTriaxController(
label='triax',
# specify target values and whether they are strains or stresses
goal=(sigmaIso, sigmaIso, sigmaIso),
stressMask=7,
# type of servo-control
dynCell=True,
maxStrainRate=(10, 10, 10),
# wait until the unbalanced force goes below this value
maxUnbalanced=.1,
relStressTol=1e-3,
# call this function when goal is reached and the packing is 
stable
doneHook='compactionFinished()'
),
NewtonIntegrator(damping=.2),
# PyRunner(command='addPlotDat

Re: [Yade-users] [Question #698377]: How to correct the strain

2021-08-24 Thread Jan Stránský
Question #698377 on Yade changed:
https://answers.launchpad.net/yade/+question/698377

Jan Stránský posted a new comment:
Please try to mark "the best answers" according to the relation to the original 
problem, not necessarily the last one.
According to the OP description, Robert's answer #1 is the answer.
My post #4 was reaction to your post #3, which actually should be a separate 
question according to [1]
Cheers
Jan

[1] https://www.yade-dem.org/wiki/Howtoask

-- 
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


Re: [Yade-users] [Question #698377]: How to correct the strain

2021-08-24 Thread Zhicheng Gao
Question #698377 on Yade changed:
https://answers.launchpad.net/yade/+question/698377

Status: Answered => Solved

Zhicheng Gao confirmed that the question is solved:
Thanks Jan Stránský, that solved my question.

-- 
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