Re: [Yade-users] [Question #700843]: Difference between the internal friction angle of material and the interparticle friction angle?

2022-03-07 Thread Chien-Cheng Hung
Question #700843 on Yade changed:
https://answers.launchpad.net/yade/+question/700843

Status: Answered => Solved

Chien-Cheng Hung confirmed that the question is solved:
Thanks Jérôme Duriez, 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


Re: [Yade-users] [Question #700843]: Difference between the internal friction angle of material and the interparticle friction angle?

2022-03-07 Thread Chien-Cheng Hung
Question #700843 on Yade changed:
https://answers.launchpad.net/yade/+question/700843

Status: Needs information => Open

Chien-Cheng Hung gave more information on the question:
Hi Jan,

Sorry, let me make it clear.

As far as I know, the friction angle we assign or modify in [1] and [2] stands 
for the internal friction angle of the material.
In the meanwhile, these two parameters also represent the interparticle 
friction angle that describes the contact friction between particles.

I happened to see Luc's comment in [3] saying not to mix up the internal
friction angle of material and the interparticle friction angle which I
think are the same thing based on my understanding.

So I would like to ask whether the values in [1] and [2] can also be
considered as the interparticle friction coefficient?

Cheers,
Chien-Cheng

[1] 
https://yade-dem.org/doc/yade.wrapper.html?highlight=frictionangle#yade.wrapper.FrictMat.frictionAngle
[2] 
https://yade-dem.org/doc/yade.utils.html?highlight=setcontactfriction#yade._utils.setContactFriction
[3] https://answers.launchpad.net/yade/+question/678523

-- 
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 #678523]: frictionAngle vs μ(interparticle friction coefficient)

2022-03-07 Thread Chien-Cheng Hung
Question #678523 on Yade changed:
https://answers.launchpad.net/yade/+question/678523

Chien-Cheng Hung posted a new comment:
Okay, I will open a new question.
Thanks!

Chien-Cheng

-- 
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 #700843]: Difference between the internal friction angle of material and the interparticle friction angle?

2022-03-07 Thread Chien-Cheng Hung
New question #700843 on Yade:
https://answers.launchpad.net/yade/+question/700843

Hi all,

According to the comments in [1], Luc mentioned not to mix up the internal 
friction angle of a material and the interparticle friction angle.

I was wondering what the differences are between these two parameters.
Looking forward to getting your answer.

[1] https://answers.launchpad.net/yade/+question/678523

Cheers,
Chien-Cheng

-- 
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 #678523]: frictionAngle vs μ(interparticle friction coefficient)

2022-03-02 Thread Chien-Cheng Hung
Question #678523 on Yade changed:
https://answers.launchpad.net/yade/+question/678523

Chien-Cheng Hung requested more information:
Hi Luc,

Could you give some comments on the main difference between the internal 
friction angle of material and the interparticle friction angle?
I couldn't find this information on the Yade.
Or could you share some links with me for more detailed information?

Cheers,
Chien-Cheng

-- 
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 #697600]: Contact (dilation) angle between particles

2021-06-21 Thread Chien-Cheng Hung
Question #697600 on Yade changed:
https://answers.launchpad.net/yade/+question/697600

Chien-Cheng Hung gave more information on the question:
Just for further clarification.

In 2D, if there are two particles of the same size in contact with each other 
in the horizontal direction, then the contact angle between these two particles 
would be 90 degrees.
Similarly, if the one is right on top of the other one, then the contact angle 
would be 0 degrees.
The contact angle described here is what I want to output as a distribution.
I can imagine it would be a bit tricky for a 3D simulation since there are some 
vector issues...

Chien-Cheng

-- 
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 #697600]: Contact (dilation) angle between particles

2021-06-21 Thread Chien-Cheng Hung
Question #697600 on Yade changed:
https://answers.launchpad.net/yade/+question/697600

Status: Needs information => Open

Chien-Cheng Hung gave more information on the question:
Hi,

The contact angle using here means dilation angle (ψ). The value of ψ=0 
corresponds to the volume that preserves deformation while in shear.
Since the angle of dilation (ψ) controls the amount of plastic volumetric 
strain and macroscopic friction developed during plastic shearing, I would like 
to know how the dilation angle (or contact angle) distribute in the granular 
layer for different PSDs and to see its relation to the volumetric strain and 
macroscopic friction.
I hope this is clear for you.

Cheers,
Chien-Cheng

-- 
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 #697600]: Contact (dilation) angle between particles

2021-06-18 Thread Chien-Cheng Hung
New question #697600 on Yade:
https://answers.launchpad.net/yade/+question/697600

Hi all,

I am simulating the direct shear of a granular assemblage with different 
particle size distributions (PSD) (e.g., normal distribution and power-law 
distribution).
I want to output the contact angle between all the particles to see the 
distribution of it in the entire granular packing for different PSD models.
Is there any way to do that?
Thanks in advance!

Cheers,
Chien-Cheng

-- 
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 #696700]: Interparticle friction coefficient in Hertz-Mindlin contact law

2021-04-22 Thread Chien-Cheng Hung
Question #696700 on Yade changed:
https://answers.launchpad.net/yade/+question/696700

Status: Open => Solved

Chien-Cheng Hung confirmed that the question is solved:
I figured it out according to the comments in [1].
Thanks.

[1] https://answers.launchpad.net/yade/+question/225776

-- 
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 #696700]: Interparticle friction coefficient in Hertz-Mindlin contact law

2021-04-22 Thread Chien-Cheng Hung
New question #696700 on Yade:
https://answers.launchpad.net/yade/+question/696700

Hello,

If I want to simulate a simple shear with the Hertz-Mindlin contact law with an 
interparticle friction coefficient of 0.5, is it correct to just set the 
friction angle as 0.5 in the O.material [1] for each particle, or it has to be 
set in the Mindlinphys [2] for all particle interactions?
I think the friction angle used in O.material is the internal friction angle, 
which is not the interparticle friction angle, right?
I am a bit confused about this.

Thanks.

[1] 
https://yade-dem.org/doc/yade.wrapper.html?highlight=materials#yade.wrapper.FrictMat.frictionAngle
[2] 
https://yade-dem.org/doc/yade.wrapper.html?highlight=mindlinphys#yade.wrapper.Ip2_FrictMat_FrictMat_MindlinPhys.frictAngle

Chien-Cheng

-- 
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 #696150]: Output specific bodies using TW.setState

2021-03-22 Thread Chien-Cheng Hung
Question #696150 on Yade changed:
https://answers.launchpad.net/yade/+question/696150

Status: Answered => Solved

Chien-Cheng Hung confirmed that the question is solved:
Thanks Karol Brzezinski, 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


Re: [Yade-users] [Question #696150]: Output specific bodies using TW.setState

2021-03-21 Thread Chien-Cheng Hung
Question #696150 on Yade changed:
https://answers.launchpad.net/yade/+question/696150

Status: Answered => Open

Chien-Cheng Hung is still having a problem:
Hi Karol,

Thanks for showing me an example.

In your example, why do you add sp.fromSimulation() after shiftBodies(...)?
I can see the vtk file won't work if removing the sp.fromSimulation(), but I 
don't understand the use of it.
I am wondering if I am not using spherePack to generate granular packing but 
using ymport [1] from an exported sphere data, what I should add after 
shiftBodies(...)?
Thank you for your time again.

Cheers,
Chien-Cheng

[1] https://yade-
dem.org/doc/yade.ymport.html?highlight=ymport#yade.ymport.text

-- 
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 #696150]: Output specific bodies using TW.setState

2021-03-20 Thread Chien-Cheng Hung
Question #696150 on Yade changed:
https://answers.launchpad.net/yade/+question/696150

Status: Answered => Open

Chien-Cheng Hung is still having a problem:
Hi Karol,

Thank you for your reply. Those comments are very helpful.

>> You set something like "O.bodies[i].state.dynamics = False", I think
it should be "O.bodies[i].dynamic = False" as in the example

Thanks for pointing this out!

>> - I am not sure, but I think that periodic boundaries may be
problematic.

I am not sure if the periodic boundaries could be the reason. But I
guess the example offered in the user's manual [1] also applies periodic
boundaries. For my current simulation, I want to see if I can see any
high-strain zone using thus micro-strain methods.

>> If your only problem is excluding some bodies from tesselation, you
could save positions from state 0 and 1 only for desired bodies in
external files and then compute deformations using those files instead
of states (defToVtkFromPositions() instead of defToVtk() [2])

This seems a feasible way to do it. But I couldn't find any example of using 
defToVtkFromPositions().
Could you perhaps show me an example about using it?

Cheers,
Chien-Cheng

-- 
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 #696150]: Output specific bodies using TW.setState

2021-03-19 Thread Chien-Cheng Hung
Question #696150 on Yade changed:
https://answers.launchpad.net/yade/+question/696150

Status: Answered => Open

Chien-Cheng Hung is still having a problem:
Hi Bruno,

Thanks for your quick reply.

I've minimized my script as much as possible. I also tested it and the
running time should be within 30 seconds.

Below is the MWE.

###
from yade import pack,plot,export
import numpy as np
import math

sp1=pack.SpherePack()
sp2=pack.SpherePack()
sp3=pack.SpherePack()

O.periodic=True

RADIUS1=0.25
RADIUS2=0.125
length=3*(2*RADIUS1)
height=3*(2*RADIUS1)
width=3*(2*RADIUS1)
PI=1.e5
SN=5.e6
RATE_shear=1
wallFRIC=0
boundaryFRIC=0.5 # during compaction (controls porosity)
spFRIC=0.5
DAMPSHEAR=0.

O.cell.hSize=Matrix3(length,0,0,0,3*height,0,0,0,width)

O.materials.append(FrictMat(density=2500,young=5.5e10,poisson=0.25,frictionAngle=wallFRIC,label='boxMat'))
O.materials.append(FrictMat(density=2500,young=5.5e10,poisson=0.25,frictionAngle=boundaryFRIC,label='boundaryMat'))
O.materials.append(FrictMat(density=2500,young=5.5e10,poisson=0.25,frictionAngle=spFRIC,label='sphereMat'))

upBox = 
utils.box(center=(length/2,2*height+RADIUS1,1.5*width),orientation=Quaternion(1,0,0,0),extents=(5*length,RADIUS1/2,5*width),fixed=1,wire=False,color=(1,0,0),material='boxMat')
lowBox = 
utils.box(center=(length/2,height-RADIUS1,1.5*width),orientation=Quaternion(1,0,0,0),extents=(5*length,RADIUS1/2,5*width),fixed=1,wire=False,color=(1,0,0),material='boxMat')

O.bodies.append([upBox,lowBox])

sp1.makeCloud((0,height+1*RADIUS1,width),(length,2*height-1*RADIUS1,2*width), 
rMean=RADIUS2, periodic=True, seed =1)
sp2.makeCloud((0,height+0.1*RADIUS1,width),(length,height+0.1*RADIUS1-1e-10,2*width),
 rMean=RADIUS2, periodic=True, seed =1)
sp3.makeCloud((0,2*height-0.1*RADIUS1,width),(length,2*height-0.1*RADIUS1-1e-10,2*width),
 rMean=RADIUS2, periodic=True, seed =1)

sphere_id =
O.bodies.append([utils.sphere(s[0],s[1],color=(0,0,1),material='sphereMat')
for s in sp1])

bottomLayer_id =
O.bodies.append([utils.sphere(s[0],s[1],color=(1,0,1),material='boundaryMat')
for s in sp2])

topLayer_id =
O.bodies.append([utils.sphere(s[0],s[1],color=(1,0,1),material='boundaryMat')
for s in sp3])

effCellVol=(O.bodies[0].state.pos[1]-O.bodies[1].state.pos[1])*O.cell.hSize[0,0]*O.cell.hSize[2,2]
volRatio=(O.cell.hSize[0,0]*O.cell.hSize[1,1]*O.cell.hSize[2,2])/effCellVol

O.engines=[
 ForceResetter()
 
,InsertionSortCollider([Bo1_Box_Aabb(),Bo1_Sphere_Aabb()],verletDist=-0.1,allowBiggerThanPeriod=True)
 ,InteractionLoop(
  [Ig2_Sphere_Sphere_ScGeom6D
   (),Ig2_Box_Sphere_ScGeom6D()],
  [Ip2_FrictMat_FrictMat_MindlinPhys()],
  [Law2_ScGeom_MindlinPhys_Mindlin(includeMoment=True)]
 )
 
,GlobalStiffnessTimeStepper(active=1,timeStepUpdateInterval=1,timestepSafetyCoefficient=0.8,defaultDt=-1)
 
,PeriTriaxController(dynCell=True,mass=10,maxUnbalanced=1e-3,relStressTol=1e-4,stressMask=7,goal=(-PI/volRatio,-PI/volRatio,-PI/volRatio),globUpdate=1,maxStrainRate=(1,1,1),doneHook='triaxDone()',label='triax')
 ,NewtonIntegrator(gravity=(0,0,0),damping=0.3,label='newton')
 
,PyRunner(command='fixVelocity(RATE_shear)',iterPeriod=1,label='fixVel',dead=True)
 ]

def triaxDone():
 triax.dead=True
 O.pause()

O.run(100,1)

stage=0
stiff=fnPlaten=currentSN=0.
def servo():
 global stage,stiff,fnPlaten,currentSN
 if stage==0:
  currentSN=O.forces.f(0)[1]/(O.cell.hSize[0,0]*O.cell.hSize[2,2])
  unbF=unbalancedForce()
  boundaryVel=copysign(min(0.1,abs(0.5*(currentSN-SN))),currentSN-SN)
  O.bodies[0].state.vel[1]=boundaryVel
  if ( (abs(currentSN-SN)/SN)<0.001 and unbF<0.001 ):
   stage+=1
   fnPlaten=O.forces.f(0)[1]
   for i in O.interactions.withBody(O.bodies[0].id):
stiff+=i.phys.kn
   O.pause()
 if stage==1:
  fnDesired=SN*(O.cell.hSize[0,0]*O.cell.hSize[2,2])
  
boundaryVel=copysign(min(100,abs(0.333*(O.forces.f(0)[1]-fnDesired)/stiff/O.dt)),O.forces.f(0)[1]-fnDesired)
  O.bodies[0].state.vel[1]=boundaryVel
  
O.engines = 
O.engines[:5]+[PyRunner(command='servo()',iterPeriod=1,label='servo')]+O.engines[5:]

O.run(100,1)

 fixed bottom bottomLayer_id
for i in bottomLayer_id:
O.bodies[i].state.blockedDOFs='xyzXYZ'
O.bodies[i].state.dynamics = False
O.bodies[i].state.vel = Vector3(0,0,0)

newton.damping=DAMPSHEAR
fixVel.dead = False

initial_particle_pos = O.bodies[topLayer_id[0]].state.pos[0]

def fixVelocity(RATE_shear):
O.bodies[0].state.vel[0] = RATE_shear
for i in topLayer_id:
O.bodies[i].state.vel[0] = RATE_shear
slip = O.bodies[topLayer_id[0]].state.pos[0] - initial_particle_pos
h=O.bodies[0].state.pos[1]-O.bodies[1].state.pos[1]
ss = slip/h
if ss > 0.1:
O.pause()

O.run(10,1)
 
### Micro-strain analysis
TW=TesselationWrapper()
TW.triangulate()
TW.computeVolumes() 
TW.volume(10)  

[Yade-users] [Question #696150]: Output specific bodies using TW.setState

2021-03-19 Thread Chien-Cheng Hung
New question #696150 on Yade:
https://answers.launchpad.net/yade/+question/696150

Hi all,

Followed by my previous question [1], I found that the output micro-strain VTK 
plain text file from the TW.defToVtk [2] cannot be opened in the Paraview if 
the DOFs (degree of freedoms) of particles are blocked. For example, I wrote 
something like 
###
for b in bottomBoundary:
b.state.blockedDOFs='xyzXYZ'
###
to make sure part of the particles is fixed in all directions. When these 
particles are fixed, the output microstrain vtk text file cannot be opened in 
the Paraview. But when the particles are not fixed (without blockedDOFs), the 
vtk file works in the Paraview.

So I was wondering if I could only store the position of certain particles that 
are not fixed by adjusting the TW.setState [3] instead of using TW.setState(0) 
or TWsetState(1) to store the position of the entire body.
Thanks!

[1] https://answers.launchpad.net/yade/+question/691407
[2] 
https://yade-dem.org/doc/yade.wrapper.html#yade.wrapper.TesselationWrapper.defToVtk
[3] 
https://yade-dem.org/doc/yade.wrapper.html#yade.wrapper.TesselationWrapper.setState

Cheers,
Chien-Cheng



-- 
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 #694988]: Use of the yade.utils.psd

2021-03-12 Thread Chien-Cheng Hung
Question #694988 on Yade changed:
https://answers.launchpad.net/yade/+question/694988

Status: Answered => Solved

Chien-Cheng Hung confirmed that the question is solved:
Thanks Karol Brzezinski, 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


Re: [Yade-users] [Question #695851]: VTKRecorder: Aborted (core dumped) due to "intr" in VTKRecorder

2021-03-05 Thread Chien-Cheng Hung
Question #695851 on Yade changed:
https://answers.launchpad.net/yade/+question/695851

Status: Needs information => Open

Chien-Cheng Hung gave more information on the question:
Hi Janek,

I've tried to simplify my script as possible as I can. The MWE is below.
Thank you for your time.

Cheers,
Chien-Cheng

###
from yade import pack,plot,export
import numpy as np
import math

sp1=pack.SpherePack()
sp2=pack.SpherePack()
sp3=pack.SpherePack()

O.periodic=True

RADIUS1=0.25
RADIUS2=0.125
length=5*(2*RADIUS1)
height=5*(2*RADIUS1)
width=5*(2*RADIUS1)
thickness=RADIUS1

# boundary conditions
PI=1.e5
SN=5.e6
RATE_NS1=0.1
RATE_NS2=100
RATE_shear=1

# friction angles 
wallFRIC=0
boundaryFRIC=0.5 # during compaction (controls porosity)
spFRIC=0.5

# simulation control
DAMPSHEAR=0.

# Microproperties

O.cell.hSize=Matrix3(length,0,0,0,3*height,0,0,0,width)

O.materials.append(FrictMat(density=2500,young=5.5e10,poisson=0.25,frictionAngle=wallFRIC,label='boxMat'))
O.materials.append(FrictMat(density=2500,young=5.5e10,poisson=0.25,frictionAngle=boundaryFRIC,label='boundaryMat'))
O.materials.append(FrictMat(density=2500,young=5.5e10,poisson=0.25,frictionAngle=spFRIC,label='sphereMat'))

upBox = 
utils.box(center=(length/2,2*height+thickness,1.5*width),orientation=Quaternion(1,0,0,0),extents=(2*length,thickness/2,width),fixed=1,wire=False,color=(1,0,0),material='boxMat')
lowBox = 
utils.box(center=(length/2,height-thickness,1.5*width),orientation=Quaternion(1,0,0,0),extents=(2*length,thickness/2,width),fixed=1,wire=False,color=(1,0,0),material='boxMat')

O.bodies.append([upBox,lowBox])

sp1.makeCloud((0,height+1*RADIUS1,width),(length,2*height-1*RADIUS1,2*width), 
rMean=RADIUS2, periodic=True, seed =1)
sp2.makeCloud((0,height+0.1*thickness,width),(length,height+0.1*thickness-1e-10,2*width),
 rMean=RADIUS2, periodic=True, seed =1)
sp3.makeCloud((0,2*height-0.1*RADIUS1,width),(length,2*height-0.1*RADIUS1-1e-10,2*width),
 rMean=RADIUS2, periodic=True, seed =1)

sphere_id = 
O.bodies.append([utils.sphere(s[0],s[1],color=(0,0,1),material='sphereMat') for 
s in sp1])
bottomLayer_id = 
O.bodies.append([utils.sphere(s[0],s[1],color=(1,0,1),material='boundaryMat') 
for s in sp2])
topLayer_id = 
O.bodies.append([utils.sphere(s[0],s[1],color=(1,0,1),material='boundaryMat') 
for s in sp3])

effCellVol=(O.bodies[0].state.pos[1]-O.bodies[1].state.pos[1])*O.cell.hSize[0,0]*O.cell.hSize[2,2]
volRatio=(O.cell.hSize[0,0]*O.cell.hSize[1,1]*O.cell.hSize[2,2])/effCellVol

O.engines=[
 ForceResetter()
 
,InsertionSortCollider([Bo1_Box_Aabb(),Bo1_Sphere_Aabb()],verletDist=-0.1,allowBiggerThanPeriod=True)
 ,InteractionLoop(
  [Ig2_Sphere_Sphere_ScGeom6D(),Ig2_Box_Sphere_ScGeom6D()],
  [Ip2_FrictMat_FrictMat_MindlinPhys()],
  [Law2_ScGeom_MindlinPhys_Mindlin(includeMoment=True)]
 )
 
,GlobalStiffnessTimeStepper(active=1,timeStepUpdateInterval=1,timestepSafetyCoefficient=0.8,defaultDt=-1)
 
,PyRunner(command='fixVelocity(RATE_shear)',iterPeriod=1,label='fixVel',dead=True)
 
,PeriTriaxController(dynCell=True,mass=10,maxUnbalanced=1e-3,relStressTol=1e-4,stressMask=7,goal=(-PI/volRatio,-PI/volRatio,-PI/volRatio),globUpdate=1,maxStrainRate=(10,10,10),doneHook='triaxDone()',label='triax')
 ,NewtonIntegrator(gravity=(0,0,0),damping=0.3,label='newton')
 
,VTKRecorder(fileName='3d-vtk-',recorders=['all'],iterPeriod=1000,label='recVTK',dead=True)
 ]

def triaxDone():
 triax.dead=True
 O.pause()

O.run(100,1)

stage=0
stiff=fnPlaten=currentSN=0.
def servo():
 global stage,stiff,fnPlaten,currentSN
 if stage==0:
  currentSN=O.forces.f(0)[1]/(O.cell.hSize[0,0]*O.cell.hSize[2,2])
  unbF=unbalancedForce()
  boundaryVel=copysign(min(RATE_NS1,abs(0.5*(currentSN-SN))),currentSN-SN)
  O.bodies[0].state.vel[1]=boundaryVel
  if ( (abs(currentSN-SN)/SN)<0.001 and unbF<0.001 ):
   stage+=1
   fnPlaten=O.forces.f(0)[1]
   for i in O.interactions.withBody(O.bodies[0].id):
stiff+=i.phys.kn
   O.pause()
 if stage==1:
  fnDesired=SN*(O.cell.hSize[0,0]*O.cell.hSize[2,2])
  
boundaryVel=copysign(min(RATE_NS2,abs(0.333*(O.forces.f(0)[1]-fnDesired)/stiff/O.dt)),O.forces.f(0)[1]-fnDesired)
  O.bodies[0].state.vel[1]=boundaryVel
  
O.engines = 
O.engines[:5]+[PyRunner(command='servo()',iterPeriod=1,label='servo')]+O.engines[5:]

O.run(100,1)

 fixed bottom bottomLayer_id
for i in bottomLayer_id:
O.bodies[i].state.blockedDOFs='xyzXYZ'
O.bodies[i].state.dynamics = False
O.bodies[i].state.vel = Vector3(0,0,0)

recVTK.dead=False
newton.damping=DAMPSHEAR
fixVel.dead = False

initial_particle_pos = O.bodies[topLayer_id[0]].state.pos[0]

def fixVelocity(RATE_shear):
O.bodies[0].state.vel[0] = RATE_shear
for i in topLayer_id:
O.bodies[i].state.vel[0] = RATE_shear
slip = O.bodies[topLayer_id[0]].state.pos[0] - initial_p

Re: [Yade-users] [Question #695851]: VTKRecorder: Aborted (core dumped) due to "intr" in VTKRecorder

2021-03-05 Thread Chien-Cheng Hung
Question #695851 on Yade changed:
https://answers.launchpad.net/yade/+question/695851

Status: Answered => Open

Chien-Cheng Hung is still having a problem:
Hi Janek,

Thanks for your reply!

But I don't understand why I have zero interaction. In this direct shear
simulation, particles can interact with each other and function properly
to produce shearing.

Could you please tell me how to make sure I have more than zero
interactions?

Cheers,
Chien-Cheng

-- 
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 #695851]: VTKRecorder: Aborted (core dumped) due to "intr" in VTKRecorder

2021-03-03 Thread Chien-Cheng Hung
New question #695851 on Yade:
https://answers.launchpad.net/yade/+question/695851

Hi all,

I found that the terminal shows me "python3.5: 
/build/vtk6-YpT4yb/vtk6-6.2.0+dfsg1/IO/XML/vtkXMLOffsetsManager.h:142: void 
OffsetsManagerGroup::Allocate(int, int): Assertion `numElements > 0' failed. 
Aborted (core dumped)" when I put the base recorder "intr" in my VTKRecorder 
engine. The VTKRecorder works fine when there is no "intr" in my recorders. I 
can't figure out why. I've checked the previous question [1], but I don't think 
it's the same issue.

Cheers,
Chien-Cheng

[1] https://answers.launchpad.net/yade/+question/690820
 
My yade version and MWE are provided below. 

Yade version   :  2020-06-23.git-f03a37c
Linux version: Ubuntu 16.04.6 LTS

| library   | cmake| C++ |
| - |  | --- |
| boost | 105800   | 1.58.0  |
| cgal  |  | 4.7 |
| clp   | 1.15.10  | 1.15.10 |
| cmake | 3.5.1| |
| coinutils | 2.9.15   | 2.9.15  |
| compiler  | /usr/bin/c++ 5.4.0   | gcc 5.4.0   |
| eigen | 3.2.92   | 3.2.92  |
| freeglut  | 2.8.1| |
| gl|  | 20171010|
| ipython   | 2.4.1| |
| metis |  | 5.1.0   |
| mpi   |  | ompi:1.10.2 |
| mpi4py| 1.3.1| |
| openblas  |  |  OpenBLAS 0.2.18|
| python| 3.5.2| 3.5.2   |
| qglviewer |  | 2.6.3   |
| qt|  | 5.5.1   |
| sphinx| 1.3.6-final-0| |
| sqlite|  | 3.11.0  |
| suitesparse   | 4.4.6| 4.4.6   |
| vtk   | 6.2.0| 6.2.0   |

### MWE

readParamsFromTable(
a=5,
b=5,
c=5,
SN=5.e6,
coeff=0.1,
RATE_NS1=0.1,
RATE_NS2=100,   #original 0.1
RATE_shear=1,
TSSC=0.8,
shearStrain=0.5,
Ystep=10,
OUT='frictionlessWall_Hertz_uniform_test'
)

from yade.params.table import *
from yade import pack,plot,export
import numpy as np
import math

sp1=pack.SpherePack()
sp2=pack.SpherePack()
sp3=pack.SpherePack()

O.periodic=True

# dimensions of sample (fixed by particle size such as L/D~15)
RADIUS1=0.25# determine packing size 
RADIUS2=0.125   # determine particle size

length=a*(2*RADIUS1)
height=b*(2*RADIUS1)
width=c*(2*RADIUS1)
thickness=RADIUS1

### Guassian distribution
psdSizes1=[.000456,.000500,.000544]
psdSizes2=[.000228,.000250,.000272]
psdCumm=[0,0.5,1]

### PSD2.6
#psdSizes=[.625,.6251,.000125,.00012501,.00025,.00025001,.0005,.00050001]
#psdCumm=[0,.835770529,.835770529,.973753281,.973753281,.996250469,.996250469,1]

# friction angles 
wallFRIC=0
boundaryFRIC=0.5 # during compaction (controls porosity)
spFRIC=0.5

# boundary conditions
PI=1.e5
SN=SN # normal stress
RATE_NS1=RATE_NS1 # velocity of top plate during compaction
RATE_NS2=RATE_NS2 # velocity of top plate during shear
RATE_shear=RATE_shear # shear velocity
roll_stiff=0
roll_fric=0

# simulation control
DAMPSHEAR=0.
ITER=2e5
OUT=OUT

# microproperties

O.cell.hSize=Matrix3(length,0,0,0,3*height,0,0,0,width)

O.materials.append(FrictMat(density=2500,young=5.5e10,poisson=0.25,frictionAngle=wallFRIC,label='boxMat'))
O.materials.append(FrictMat(density=2500,young=5.5e10,poisson=0.25,frictionAngle=boundaryFRIC,label='boundaryMat'))
O.materials.append(FrictMat(density=2500,young=5.5e10,poisson=0.25,frictionAngle=spFRIC,label='sphereMat'))

upBox = 
utils.box(center=(length/2,2*height+thickness,1.5*width),orientation=Quaternion(1,0,0,0),extents=(2*length,thickness/2,width),fixed=1,wire=False,color=(1,0,0),material='boxMat')
lowBox = 
utils.box(center=(length/2,height-thickness,1.5*width),orientation=Quaternion(1,0,0,0),extents=(2*length,thickness/2,width),fixed=1,wire=False,color=(1,0,0),material='boxMat')

O.bodies.append([upBox,lowBox])

sp1.makeCloud((0,height+1*RADIUS1,width),(length,2*height-1*RADIUS1,2*width), 
rMean=RADIUS2, periodic=True, seed =1)
sp2.makeCloud((0,height+0.1*thickness,width),(length,height+0.1*thickness-1e-10,2*width),
 rMean=RADIUS2, periodic=True, seed =1)
sp3.makeCloud((0,2*height-0.1*RADIUS1,width),(length,2*height-0.1*RADIUS1-1e-10,2*width),
 rMean=RADIUS2, periodic=True, seed =1)

sphere_id = 
O.bodies.append([utils.sphere(s[0],s[1],color=(0,0,1),material='sphereMat') for 
s in sp1])

bottomLayer_id = 
O.bodies.append([utils.sphere(s[0],s[1],color=(1,0,1),material='boundaryMat') 
for s in sp2])

topLayer_id = 
O.bodies.append([u

Re: [Yade-users] [Question #695272]: Weighted averages of micro-stress tensor

2021-02-01 Thread Chien-Cheng Hung
Question #695272 on Yade changed:
https://answers.launchpad.net/yade/+question/695272

Chien-Cheng Hung confirmed that the question is solved:
Thanks Karol Brzezinski, 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


Re: [Yade-users] [Question #695272]: Weighted averages of micro-stress tensor

2021-02-01 Thread Chien-Cheng Hung
Question #695272 on Yade changed:
https://answers.launchpad.net/yade/+question/695272

Status: Answered => Solved

Chien-Cheng Hung confirmed that the question is solved:
Hi Karol,

Yes, you are right. Sorry I didn't read it carefully.
Thanks for clearing that up!

Chien-Cheng

-- 
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 #695272]: Weighted averages of micro-stress tensor

2021-01-30 Thread Chien-Cheng Hung
New question #695272 on Yade:
https://answers.launchpad.net/yade/+question/695272

Dear all,

I am trying to plot the micro stress [1] as a function of particle position the 
same as figure 10 in Catalano et al. (2014) [2].
The thing I don't really understand is the micro stress obtained from [1] is a 
tensor, not a scalar.
So how do I get the weighted averages of the micro stress tensor against the 
particle height?
Thanks!

[1] https://yade-dem.org/doc/user.html#micro-stress
[2] https://onlinelibrary.wiley.com/doi/abs/10.1002/nag.2198

Chien-Cheng




-- 
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 #694988]: Use of the yade.utils.psd

2021-01-14 Thread Chien-Cheng Hung
New question #694988 on Yade:
https://answers.launchpad.net/yade/+question/694988

Dear all,

I am trying to create a packing with log-normal particle size distribution.
I use yade.utils.psd [1] and [2] to check if the size distribution of the 
packing is consistent with the values I give.
It turns out that method [2] says yes, but method [1] says no. I am quite sure 
that the method [2] is the right way to calculate the particle size 
distribution. So I was wondering what exact parameter that yade.utils.psd [1] 
returns, especially the one called "binsProc" [1] which is named "bp" in the 
MWE.
Thanks!

[1] 
https://yade-dem.org/doc/yade.utils.html?highlight=yade%20utils%20psd#yade.utils.psd
[2] https://answers.launchpad.net/yade/+question/675926

###

from yade import plot
import numpy as np
import pylab
import matplotlib.pyplot as plt

mean = 2.2
stddev = 1.2

sp = yade.pack.SpherePack()
psdSizes = np.linspace(62.5, 500, 50)
pdf=[(1/x)*math.exp(-((np.log(x-mean))**2/(stddev*2)**2)) for x in psdSizes]
cdf=np.cumsum(pdf,axis=0)
psdCumm = cdf/max(cdf)
psdCumm[0] = 0
psdCumm[-1] = 1
sp.makeCloud((0,0,0),(5000,5000,5000),psdSizes=psdSizes,psdCumm=psdCumm, seed=1)
sp.toSimulation()
br,bp,bc = yade.utils.psd(bins=49)

def getDiameterArray():
diameter=[]
for b in O.bodies:
if isinstance(b.shape,Sphere):
diameter.append(b.shape.radius*2)
return diameter

diameter = getDiameterArray()
values, base = np.histogram(diameter, bins=50)
cumulative = np.array(np.cumsum(values),dtype=float)
perc = cumulative/max(cumulative)

pylab.plot(psdSizes,psdCumm,color="b")
pylab.plot(base[:-1],perc,color="r")
pylab.plot(br,bp,color="g")
pylab.xlabel("particle size")
pylab.ylabel("Cumulative particle density")
pylab.show()

###

Cheers,
Chien-Cheng



-- 
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 #694556]: Imported spheres go through the walls

2020-12-17 Thread Chien-Cheng Hung
Question #694556 on Yade changed:
https://answers.launchpad.net/yade/+question/694556

Status: Answered => Solved

Chien-Cheng Hung confirmed that the question is solved:
Hi Jan,

Thanks for your detailed explanation, it works!
Appreciate your help! 

Cheers,
Chien-Cheng

-- 
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 #694556]: Imported spheres go through the walls

2020-12-17 Thread Chien-Cheng Hung
Question #694556 on Yade changed:
https://answers.launchpad.net/yade/+question/694556

Chien-Cheng Hung 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


[Yade-users] [Question #694556]: Imported spheres go through the walls

2020-12-17 Thread Chien-Cheng Hung
New question #694556 on Yade:
https://answers.launchpad.net/yade/+question/694556

Dear all,

I find a question that is weird to me. This question is followed by my previous 
one [1].
I've created and saved a stress-free dense packing with a script (MWE 1) and 
then I load it with another script (MWE 2) and run isotropic compression.
While I was running the isotropic compression, some of the imported spheres 
went through the walls. To fix this problem, I've tried to decrease the 
timestep by setting a lower safety factor (0.8 --> 0.3) and also increase the 
stiffness of both particles and walls (1e8 --> 1e10). Unfortunately, both 
methods don't work. I have tried ever higher 
So I ran another simulation (MWE 3) to check if this also happens a 
non-imported loose packing where I generate particles with makeCloud with 
identical material properties (1e8) and timestep (factor 0.8). The process of 
isotropic compression is successful as I expected where no particles going 
through the walls. For this reason, I don't think the particle penetration 
issue is related to stiffness or timestep.
For the imported dense packing, I imagine it's also a "loose" packing since 
it's stress-free and there is no overlap between particles. 
Under this situation, why would I get particle penetration issue with imported 
dense packing?
Does someone have any idea about it? I've been struggling with this for a 
while... 
Thanks in advance!

The MWEs are provided below.

[1] https://answers.launchpad.net/yade/+question/694379

MWE 1
##
 Stress-free packing generation 
#

from yade import pack,plot,export
import numpy as np
sp=pack.SpherePack()
O.periodic=True
a=5
b=5
c=5
RADIUS_dimension=0.0250
OUT='mypacking'
length=a*(2*RADIUS_dimension)
height=b*(2*RADIUS_dimension)
width=c*(2*RADIUS_dimension)
thickness=RADIUS_dimension

### Particle size distribution
psdSizes=[.0232,.0254,.0276]
psdCumm=[0,0.5,1]

### friction angles
spFRIC=0.5

### boundary conditions
PI=1.e5

### material properties
O.materials.append(CohFrictMat(isCohesive=True,density=2500,young=1e8,poisson=0.5,frictionAngle=spFRIC,normalCohesion=-1,shearCohesion=-1,label='sphereMat'))

O.cell.hSize=Matrix3(length,0,0,0,3*height,0,0,0,width)
sp.makeCloud((0,0,0),(length,3*height,width), psdSizes = psdSizes, psdCumm = 
psdCumm, periodic=True, seed =1)
O.bodies.append([utils.sphere(s[0],s[1],color=(1,1,0),material='sphereMat') for 
s in sp])

O.engines=[
 ForceResetter()
 
,InsertionSortCollider([Bo1_Box_Aabb(),Bo1_Sphere_Aabb()],verletDist=-0.1,allowBiggerThanPeriod=True)
 ,InteractionLoop(
  [Ig2_Sphere_Sphere_ScGeom6D(),Ig2_Box_Sphere_ScGeom6D()],
  [Ip2_CohFrictMat_CohFrictMat_CohFrictPhys()],
  [Law2_ScGeom6D_CohFrictPhys_CohesionMoment()]
 )
 
,GlobalStiffnessTimeStepper(active=1,timeStepUpdateInterval=1,timestepSafetyCoefficient=0.8,defaultDt=-1)
 
,PeriTriaxController(dynCell=True,mass=10,maxUnbalanced=1e-3,relStressTol=1e-4,stressMask=7,goal=(-PI,-PI,-PI),globUpdate=1,maxStrainRate=(10,10,10),doneHook='stressFree()',label='triax')
 ,NewtonIntegrator(gravity=(0,0,0),damping=0.3,label='newton')
 ]

### To achieve stress-free condition using stress control to unload the packing
def stressFree():
print("start stress-free unloading")
O.cell.trsf=Matrix3.Identity
triax.stressMask=7
triax.goal=(0,0,0)
triax.maxStrainRate=(1,1,1)
triax.doneHook='triaxDone()'
triax.maxUnbalanced=10

def triaxDone():
 triax.dead=True
 O.pause()
 
O.run(1000,1)

### Check total contact stress within the system
print ('Total stress (contacts) = 
',getStress(O.cell.hSize[1,1]*O.cell.hSize[0,0]*O.cell.hSize[2,2]))

### Reduce the radius of all particles to further make sure there is no overlap 
between particles
for b in range(len(O.bodies)):
O.bodies[b].shape.radius = O.bodies[b].shape.radius * 0.99

O.step()
print ('Total stress (contacts) after size reduction = 
',getStress(O.cell.hSize[1,1]*O.cell.hSize[0,0]*O.cell.hSize[2,2]))

export.text(OUT+".isoCompression") 

### Save the cell size
a = O.cell.size
np.save('cellSize',a)

MWE 2
###
 Isotropic compression for imported dense packing 
##

from yade import pack,plot,export,ymport
import numpy as np

sp=pack.SpherePack()

O.periodic=True


RADIUS_dimension=0.0250
a = np.load('cellSize.npy')

length= a[0]
height= a[1]/3
width= a[2]
thickness=RADIUS_dimension

# friction angles
wallFRIC=90
spFRIC=0.5

# boundary conditions
PI=1.e5

### Material properties
O.materials.append(CohFrictMat(isCohesive=True,density=2500,young=1e8,poisson=0.5,frictionAngle=radians(wallFRIC),normalCohesion=-1,shearCohesion=-1,label='boxMat'))
O.materials.append(CohFrictMat(isCohesive=True,density=2500,young=1e8,poisson=0.5,frictionAngle=spFRIC,normalCohesion=-1,shearCohesion=-1,label='sphereMat'))

O.cell.hSi

Re: [Yade-users] [Question #694379]: How to freeze the particles in the imported dense granular packing

2020-12-06 Thread Chien-Cheng Hung
Question #694379 on Yade changed:
https://answers.launchpad.net/yade/+question/694379

Status: Answered => Open

Chien-Cheng Hung is still having a problem:
Hi Jan,

Thanks for your reply.

> Basic dualism in mechanics, either you know/prescribe displacement
(rotation,strain,...) or force (moment, stress,...), never both.

I see the reason why... thanks for the explanation.

> Yes, you saved not-stress-free (overlapping) packing, so after
loading, repulsive forces are computed (from the overlaps).

Is it possible that I can save a stress-free packing? Or by any chance
that I could temporarily remove the repulsive forces, do the isotropic
compression, and then recover the initial repulsive forces (just a
thought)?

> What is "their original energy states"?

I just meant the initial repulsive forces. I will try to be careful with
the word I use next time...

> In the second simulation, I see large gap between spherical particles
and walls. Why are there the gaps? They are reason that "all the
particles start to move around in any direction", so maybe reducing the
gap would make the simulation "nicer"?

I've tried that but the simulation does not really get better since the
real problem is that the moving particles would always go through the
boundary walls. I've tried to increase the stiffness of the walls but
still get the same. Do you have any idea about this?

Thanks, again.

Cheers,
Chien-Cheng

-- 
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 #694379]: How to freeze the particles in the imported dense granular packing

2020-12-06 Thread Chien-Cheng Hung
New question #694379 on Yade:
https://answers.launchpad.net/yade/+question/694379

Hi all,

This question follows my previous one [1].
After successfully imported a dense packing with a specific range of size, I 
would like to further isotropically compress the cropped dense packing with 
additional two boundary walls. 
When the isotropic compression is running, I find that all the particles also 
start to move around in any direction. I don't want this to happen since I want 
to maintain the initial thickness of the packing and all the particle position. 
I can imagine the reason behind this is that there are forces stored at the 
grain contacts whenever it is compacted.
I've tried to use "blockDOFs" to fix the position of all the particles but in 
this way, the desired state of isotropic compression cannot be reached.
So my question is how do I freeze the position of all the particles without 
removing their original energy states and still reach the desired state of 
isotropic compression?

Thanks in advance!

[1] https://answers.launchpad.net/yade/+question/694288

Below are my two MWEs for packing generation and imported dense packing.

### Packing generation MWE ### 

from yade import pack,plot,export
sp=pack.SpherePack()
O.periodic=True
a=5
b=5
c=5
RADIUS_dimension=0.0250
OUT='mypacking'
length=a*(2*RADIUS_dimension)
height=b*(2*RADIUS_dimension)
width=c*(2*RADIUS_dimension)
thickness=RADIUS_dimension

### Particle size distribution
psdSizes=[.0232,.0254,.0276]
psdCumm=[0,0.5,1]
### friction angles 
spFRIC=0.5
### boundary conditions
PI=1.e5
#Mair and Hazzard (2007)'s microproperties
O.materials.append(CohFrictMat(isCohesive=True,density=2500,young=1e8,poisson=0.5,frictionAngle=spFRIC,normalCohesion=-1,shearCohesion=-1,label='sphereMat'))

O.cell.hSize=Matrix3(length,0,0,0,3*height,0,0,0,width)
sp.makeCloud((0,0,0),(length,3*height,width), psdSizes = psdSizes, psdCumm = 
psdCumm, periodic=True, seed =1)
O.bodies.append([utils.sphere(s[0],s[1],color=(1,1,0),material='sphereMat') for 
s in sp])

O.engines=[
 ForceResetter()
 
,InsertionSortCollider([Bo1_Box_Aabb(),Bo1_Sphere_Aabb()],verletDist=-0.1,allowBiggerThanPeriod=True)
 ,InteractionLoop(
  [Ig2_Sphere_Sphere_ScGeom6D(),Ig2_Box_Sphere_ScGeom6D()],
  [Ip2_CohFrictMat_CohFrictMat_CohFrictPhys()],
  [Law2_ScGeom6D_CohFrictPhys_CohesionMoment()]
 )
 
,GlobalStiffnessTimeStepper(active=1,timeStepUpdateInterval=1,timestepSafetyCoefficient=0.8,defaultDt=-1)
 
,PeriTriaxController(dynCell=True,mass=10,maxUnbalanced=1e-3,relStressTol=1e-4,stressMask=7,goal=(-PI,-PI,-PI),globUpdate=1,maxStrainRate=(10,10,10),doneHook='triaxDone()',label='triax')
 ,NewtonIntegrator(gravity=(0,0,0),damping=0.3,label='newton')
 ] 

def triaxDone():
 triax.dead=True
 O.pause()
 
O.run(1000,1)
export.text(OUT+".isoCompression")


 Isotropic compression MWE ###

from yade import pack,plot,export,ymport

sp=pack.SpherePack()

O.periodic=True

a=2.5
b=2.5
c=2.5
RADIUS_dimension=0.0250
OUT='mypacking'
length=a*(2*RADIUS_dimension)
height=b*(2*RADIUS_dimension)
width=c*(2*RADIUS_dimension)
thickness=RADIUS_dimension

# Old packing size for spheres generation
a_old=5
b_old=5
c_old=5
length_old=a_old*(2*RADIUS_dimension)
height_old=b_old*(2*RADIUS_dimension)
width_old=c_old*(2*RADIUS_dimension)
thickness_old=RADIUS_dimension

### Packing ratio
packingRatio = a / a_old

### Particle size distribution
psdSizes=[.0232,.0254,.0276]
psdCumm=[0,0.5,1]

# friction angles 
wallFRIC=90
spFRIC=0.5

# boundary conditions
PI=1.e5

### Material properties
O.materials.append(CohFrictMat(isCohesive=True,density=2500,young=1e8,poisson=0.5,frictionAngle=radians(wallFRIC),normalCohesion=-1,shearCohesion=-1,label='boxMat'))
O.materials.append(CohFrictMat(isCohesive=True,density=2500,young=1e8,poisson=0.5,frictionAngle=spFRIC,normalCohesion=-1,shearCohesion=-1,label='sphereMat'))

O.cell.hSize=Matrix3(length,0,0,0,3*height,0,0,0,width)

upBox = 
utils.box(center=(length/2,2*height+1.5*thickness,1.5*width),orientation=Quaternion(1,0,0,0),extents=(2*length,thickness/5.,width),fixed=1,wire=True,color=(1,0,0),material='boxMat')
lowBox = 
utils.box(center=(length/2,height-1.5*thickness,1.5*width),orientation=Quaternion(1,0,0,0),extents=(2*length,thickness/5.,width),fixed=1,wire=True,color=(1,0,0),material='boxMat')

O.bodies.append([upBox,lowBox])

### Import isotropic-compressed packing and boundary
packing = 
ymport.text("mypacking.isoCompression",color=(1,1,0),material='sphereMat')

### Filter only desired packing
def sphereWanted(b):
x,y,z = b.state.pos
return x >= 0 and x <= packingRatio*length_old and y >= 
packingRatio*height_old and y <= 2*packingRatio*height_old and z >= 0 and z <= 
packingRatio*width_old

packing = [b for b in packing if sphereWanted(b)]

O.bodies.append(packing)

### Fix particle position
#for b in O.bodies:
#if isinstance(b.shape,Sphere):
#b.state.blockedDOFs='xyzXYZ'  

Re: [Yade-users] [Question #694288]: Crop a specific range of the imported packing and distribute it to a specific position

2020-12-02 Thread Chien-Cheng Hung
Question #694288 on Yade changed:
https://answers.launchpad.net/yade/+question/694288

Status: Answered => Solved

Chien-Cheng Hung 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


Re: [Yade-users] [Question #694288]: Crop a specific range of the imported packing and distribute it to a specific position

2020-12-02 Thread Chien-Cheng Hung
Question #694288 on Yade changed:
https://answers.launchpad.net/yade/+question/694288

Status: Needs information => Open

Chien-Cheng Hung gave more information on the question:
> Also, what is "particles", "a pack", ...?

Sorry, it should be just "a packing"..

> A MWE [1] would be great

Here's the MWE showing how I follow what you suggested previously

#
from yade import pack, ymport

a=5
b=5
c=5
RADIUS_dimension=0.00025

length=a*(2*RADIUS_dimension)
height=b*(2*RADIUS_dimension)
width=c*(2*RADIUS_dimension)
thickness=RADIUS_dimension

O.periodic=True

O.cell.hSize=Matrix3(length,0,0,0,3*height,0,0,0,width)

### load whole packing
packing = ymport.text("mypacking.spheresisoCompression")

### filter only desired particles
for i in range(0,len(packing)):
if packing[i].state.pos[1] > height and packing[i].state.pos[1] < 2*height: 
### distribute it to desired position<-- not sure how to do 
this part
packing[i].state.pos[0] = packing[i].state.pos[0] + 5*thickness
packing[i].state.pos[1] = packing[i].state.pos[1] + 5*thickness
packing[i].state.pos[2] = packing[i].state.pos[2] + 5*thickness
O.bodies.append(packing[i])
#

I can obtain the desired packing but they still remain at the same
position. So my question is how to distribute (or move) the desired
particles to a desired position. I hope this is clear to you. I will ask
more specifically next time!

Cheers,
Chien-Cheng

-- 
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 #694288]: Crop a specific range of the imported packing and distribute it to a specific position

2020-12-02 Thread Chien-Cheng Hung
Question #694288 on Yade changed:
https://answers.launchpad.net/yade/+question/694288

Status: Solved => Open

Chien-Cheng Hung is still having a problem:
Hi Jan,

Is it possible that you could show me an example about how to move particles?
For example, a pack of particles range from (0,0,0) to (1,1,1) and move all of 
them with equal distance to the coordinates of (2,2,2) and (3,3,3).
Or it there an example in the Yade documentation?
I'd appreciate that, thanks!

Cheers,
Chien-Cheng

-- 
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 #694288]: Crop a specific range of the imported packing and distribute it to a specific position

2020-12-01 Thread Chien-Cheng Hung
Question #694288 on Yade changed:
https://answers.launchpad.net/yade/+question/694288

Status: Open => Solved

Chien-Cheng Hung 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


Re: [Yade-users] [Question #694288]: Crop a specific range of the imported packing and distribute it to a specific position

2020-12-01 Thread Chien-Cheng Hung
Question #694288 on Yade changed:
https://answers.launchpad.net/yade/+question/694288

Status: Answered => Open

Chien-Cheng Hung is still having a problem:
Hi Jan,

Thanks for your quick reply.

> randomDensePack itself does not support psd input, but the code can be
"copy-pasted" to a new function.

I don't really understand this part. How do I create a dense pack with psd by 
using "copy-pasted the code to a new function" ?
I thought about using randomDensePack instead of using makeCloud and isotropic 
compression but not sure how to input psd in randomDensePack. Is there an 
example for it?

> a simple for loop with if condition should do the job..

Okay, I will try this. Thanks!

Cheers,
Chien-Cheng

-- 
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 #694288]: Crop a specific range of the imported packing and distribute it to a specific position

2020-12-01 Thread Chien-Cheng Hung
New question #694288 on Yade:
https://answers.launchpad.net/yade/+question/694288

Dear all,

I am trying to simulate a direct shear experiment on a dense packing with 
particle size distribution (PSD).
For creating a dense packing with PSD, I use makeCloud to generate a loose 
packing first and then apply isotropic compression to the packing.
To save time for each simulation, I first create a massive loose packing, and 
after isotropic compression, I export the dense packing as a list for further 
simulation.

My question is, how do I crop this massive packing into a smaller desired size 
of packing and distribute it to the position I want?
The purpose of doing this is to achieve identical thickness of the packing for 
each simulation since different PSD can result in different layer thickness 
after isotropic compression.

For example, if there is a list of packing with the size of (0,0,0) to (5,5,5) 
and I want to import this packing in a smaller size of range from (1,1,1) to 
(4,4,4) and get rid of the rest of packing. After that, I want to distribute 
this specific size of packing to the position of (10,10,10) to (13,13,13). How 
can I do to achieve this?

Thanks in advance!

Chien-Cheng 


-- 
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 #692823]: How to output a list throughout timestep

2020-09-10 Thread Chien-Cheng Hung
Question #692823 on Yade changed:
https://answers.launchpad.net/yade/+question/692823

Chien-Cheng Hung posted a new comment:
Hi Robert,

Thanks for your answer.

I use another way which is basically the same:

np.savetxt(OUT+'-Force-%s' % O.iter,list_force, delimiter=',')

Cheers,
Chien-Cheng

-- 
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 #692823]: How to output a list throughout timestep

2020-09-09 Thread Chien-Cheng Hung
Question #692823 on Yade changed:
https://answers.launchpad.net/yade/+question/692823

Status: Open => Solved

Chien-Cheng Hung confirmed that the question is solved:
problem solved

-- 
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 #692823]: How to output a list throughout timestep

2020-09-09 Thread Chien-Cheng Hung
New question #692823 on Yade:
https://answers.launchpad.net/yade/+question/692823

Hi all,

I am simulating a direct shear experiment with a granular layer.
I would like to see how the force in the X direction (O.force(b).[1]) transmit 
within the granular layer during initial shearing.
I define a weighted average function called "getForce" to calculate the 
weighted average force of each particle at a certain Y position (Ystep).
Then, I define another function called "forceExport" to save the weighted force 
and the corresponded depth as a list with "np.savetxt".
I would like to output the list every 1000 iteration so I use Pyrunner to do 
this.
However, I cannot think of a way to save the list with a filename that is 
corresponded to the iteration period because it would overwrite the previous 
file. 
Is there another way to save a list throughout the iteration period?
Thanks!

Here's part of my code:
###
O.engines=[
 ForceResetter()
 
,InsertionSortCollider([Bo1_Box_Aabb(),Bo1_Sphere_Aabb()],verletDist=-0.1,allowBiggerThanPeriod=True)
 ,InteractionLoop(
  [Ig2_Sphere_Sphere_ScGeom6D(),Ig2_Box_Sphere_ScGeom6D()],
  [Ip2_FrictMat_FrictMat_MindlinPhys(krot=roll_stiff,eta=roll_fric)],
  [Law2_ScGeom_MindlinPhys_Mindlin(includeMoment=True)]
 )
 
,GlobalStiffnessTimeStepper(active=1,timeStepUpdateInterval=1,timestepSafetyCoefficient=TSSC,defaultDt=-1)
 
,PyRunner(command='fixVelocity(RATE_shear)',iterPeriod=1,label='fixVel',dead=True)
 
,PeriTriaxController(dynCell=True,mass=10,maxUnbalanced=1e-3,relStressTol=1e-4,stressMask=7,goal=(-PI/volRatio,-PI/volRatio,-PI/volRatio),globUpdate=1,maxStrainRate=(1,1,1),doneHook='triaxDone()',label='triax')
 ,NewtonIntegrator(gravity=(0,0,0),damping=0.3,label='newton')
 ,PyRunner(command='dataRecorder()',iterPeriod=1000,label='recData',dead=True)
 ,PyRunner(command="forceExport()",iterPeriod=1000,label='forceExp',dead=True)
 ]

def weight_function_force(y,y1,coeff):
return(math.exp(-(((y-y1)**2)/(2*(coeff**2)

def getForce(y1):
  weight=0
  weightedForce=0
  totalWeightedForce=0
  totalWeight=0
  for i in range(2,len(O.bodies)):
weight = weight_function_force(O.bodies[i].state.pos[1], y1, coeff)
weightedForce = O.forces.f(i).[0] * weight
totalWeightedForce = totalWeightedForce + weightedForce
totalWeight = totalWeight + weight
  return (totalWeightedForce/totalWeight)

def forceExport():
dh = (O.bodies[0].state.pos[1] - O.bodies[1].state.pos[1]) / Ystep
list_force = []
for i in range(Ystep):
y1 = dh*i + O.bodies[1].state.pos[1]
list_force.append([getForce(y1),y1])
np.savetxt(OUT+'-Force',list_force, delimiter=',') 
###

Cheers,
Chien-Cheng

-- 
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 #691407]: Paraview crashes when pressing apply buttom of the micro-strain vtk file

2020-07-08 Thread Chien-Cheng Hung
Question #691407 on Yade changed:
https://answers.launchpad.net/yade/+question/691407

Status: Open => Solved

Chien-Cheng Hung confirmed that the question is solved:
Hi Jan,

I think I find the reason why the microstrain vtk file crashed.
The vtk file can be applied in Paraview when the degree of freedom of particles 
is not blocked. 
So I guess when the particles are fixed, the microstrain vtk file can not work 
functionally.

Cheers,
Chien-Cheng

-- 
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 #691407]: Paraview crashes when pressing apply buttom of the micro-strain vtk file

2020-06-29 Thread Chien-Cheng Hung
Question #691407 on Yade changed:
https://answers.launchpad.net/yade/+question/691407

Chien-Cheng Hung posted a new comment:
Hi Jan,

Sorry for my inconsistency and thank you for your time.
I will keep looking for other possibilities.

Cheers,
Chien-Cheng

-- 
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 #691407]: Paraview crashes when pressing apply buttom of the micro-strain vtk file

2020-06-29 Thread Chien-Cheng Hung
Question #691407 on Yade changed:
https://answers.launchpad.net/yade/+question/691407

Chien-Cheng Hung gave more information on the question:
Hi Jan,

Thanks for your email.

I've tested your microstrain vtk file and it works with my Paraview. So
I think the crash is not related to the Paraview version (btw my
Paraview version is 5.0.1 (64-bit)). Maybe it's related to my code.
Could you help me have a look? I'd appreciate that.

### My simplified code (direct shear simulation of a granular layer)
from yade import pack,plot,export
import numpy as np
import math

sp1=pack.SpherePack()
sp2=pack.SpherePack()
sp3=pack.SpherePack()

O.periodic=True

# dimensions of sample
RADIUS=0.25
a=15
b=1
c=1
length=a*(2*RADIUS)
height=length/b
width=length/c
thickness=RADIUS

### Guassian distribution
psdSizes=[.456,.5,.544]
psdCumm=[0,0.5,1]

# friction angles 
wallFRIC=0
boundaryFRIC=0.5
spFRIC=0.5

# boundary conditions
PI=1.e5
SN=5.e6 # normal stress
RATE_NS1=1 # velocity of top plate during compaction
RATE_NS2=1 # velocity of top plate during shear
RATE_shear=1 # shear velocity
roll_stiff=0
roll_fric=0

# simulation control
DAMPSHEAR=0.

O.cell.hSize=Matrix3(length,0,0,0,3*height,0,0,0,width)

O.materials.append(FrictMat(density=3000,young=1e8,poisson=0.5,frictionAngle=wallFRIC,label='boxMat'))
O.materials.append(FrictMat(density=3000,young=1e8,poisson=0.5,frictionAngle=boundaryFRIC,label='boundaryMat'))
O.materials.append(FrictMat(density=3000,young=1e8,poisson=0.5,frictionAngle=spFRIC,label='sphereMat'))

upBox = 
utils.box(center=(length/2,2*height+thickness,1.5*width),orientation=Quaternion(1,0,0,0),extents=(2*length,thickness/2.,width),fixed=1,wire=False,color=(1,0,0),material='boxMat')
lowBox = 
utils.box(center=(length/2,height-thickness,1.5*width),orientation=Quaternion(1,0,0,0),extents=(2*length,thickness/2.,width),fixed=1,wire=False,color=(1,0,0),material='boxMat')

O.bodies.append([upBox,lowBox])

sp1.makeCloud((0,height+3*RADIUS,width),(length,2*height-3*RADIUS,2*width), 
psdSizes =psdSizes, psdCumm =psdCumm, periodic=True, seed =1)
sp2.makeCloud((0,height+RADIUS,width),(length,height+RADIUS-1e-10,2*width), 
rMean=RADIUS, periodic=True, seed =1)
sp3.makeCloud((0,2*height-RADIUS,width),(length,2*height-RADIUS-1e-10,2*width), 
rMean=RADIUS, periodic=True, seed =1)

sphere_id = 
O.bodies.append([utils.sphere(s[0],s[1],color=(0,0,1),material='sphereMat') for 
s in sp1])
bottomLayer_id = 
O.bodies.append([utils.sphere(s[0],s[1],color=(1,0,1),material='boundaryMat') 
for s in sp2])
topLayer_id = 
O.bodies.append([utils.sphere(s[0],s[1],color=(1,0,1),material='boundaryMat') 
for s in sp3])

effCellVol=(O.bodies[0].state.pos[1]-O.bodies[1].state.pos[1])*O.cell.hSize[0,0]*O.cell.hSize[2,2]
volRatio=(O.cell.hSize[0,0]*O.cell.hSize[1,1]*O.cell.hSize[2,2])/effCellVol

O.engines=[
 ForceResetter()
 
,InsertionSortCollider([Bo1_Box_Aabb(),Bo1_Sphere_Aabb()],verletDist=-0.1,allowBiggerThanPeriod=True)
 ,InteractionLoop(
  [Ig2_Sphere_Sphere_ScGeom6D(),Ig2_Box_Sphere_ScGeom6D()],
  [Ip2_FrictMat_FrictMat_MindlinPhys(krot=roll_stiff,eta=roll_fric)],
  [Law2_ScGeom_MindlinPhys_Mindlin(includeMoment=True)]
 )
 
,GlobalStiffnessTimeStepper(active=1,timeStepUpdateInterval=1,timestepSafetyCoefficient=0.8,defaultDt=-1)
 
,PyRunner(command='fixVelocity(RATE_shear)',iterPeriod=1,label='fixVel',dead=True)
 
,PeriTriaxController(dynCell=True,mass=10,maxUnbalanced=1e-3,relStressTol=1e-4,stressMask=7,goal=(-PI/volRatio,-PI/volRatio,-PI/volRatio),globUpdate=1,maxStrainRate=(1,1,1),doneHook='triaxDone()',label='triax')
 ,NewtonIntegrator(gravity=(0,0,0),damping=0.3,label='newton')
 ]

def triaxDone():
 global phase
 
volRatio=(O.cell.hSize[0,0]*O.cell.hSize[1,1]*O.cell.hSize[2,2])/((O.bodies[0].state.pos[1]-O.bodies[1].state.pos[1])*O.cell.hSize[0,0]*O.cell.hSize[2,2])
 h=O.bodies[0].state.pos[1]-O.bodies[1].state.pos[1]
 vol=h*O.cell.hSize[0,0]*O.cell.hSize[2,2]
 contactStress=getStress(vol)
 vol_s=Rmean=Rmax=nbSph=0
 Rmin=1e6
 x_ref=O.bodies[0].state.pos[0]
 for o in O.bodies:
  if isinstance(o.shape,Sphere):
   nbSph+=1
   Rmean+=o.shape.radius
   if o.shape.radius>Rmax: Rmax=o.shape.radius
   if o.shape.radius 1:
O.pause()

O.run(1,1)

TW=TesselationWrapper()
TW.triangulate()
TW.computeVolumes()
TW.volume(10)
TW.setState(0)
O.run(100,True)
TW.setState(1)
TW.defToVtk("strain.vtk")

###

Cheers,
Chien-Cheng

-- 
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 #691407]: Paraview crashes when pressing apply buttom of the micro-strain vtk file

2020-06-29 Thread Chien-Cheng Hung
Question #691407 on Yade changed:
https://answers.launchpad.net/yade/+question/691407

Chien-Cheng Hung gave more information on the question:
Hi Jan,

I've updated my Yade version to the latest one - 2020-06-23.git-f03a37c and 
reran the simulation to get a new microstrain file.
But the Paraview still crashes when I apply the file.
Is it possible that Paraview cannot read the output microstrain file (a plain 
text file)? Or perhaps you could share me a workable microstrain file for 
letting me test it?
Thank you.

Cheers,
Chien-Cheng

-- 
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 #691407]: Paraview crashes when pressing apply buttom of the micro-strain vtk file

2020-06-19 Thread Chien-Cheng Hung
Question #691407 on Yade changed:
https://answers.launchpad.net/yade/+question/691407

Status: Answered => Open

Chien-Cheng Hung is still having a problem:
Hi Jan,

Thanks for helping me test the file.

Would you suggest me to update the Yade version to 2020-04-26.git-
59c7045 and rerun the simulation?

Cheers,
Chien-Cheng

-- 
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 #691407]: Paraview crashes when pressing apply buttom of the micro-strain vtk file

2020-06-19 Thread Chien-Cheng Hung
Question #691407 on Yade changed:
https://answers.launchpad.net/yade/+question/691407

Status: Needs information => Open

Chien-Cheng Hung gave more information on the question:
Hi Jan,

Thanks for your quick reply.

> Are you using the script from [1], or something else?

I am using the same script from [1].

> What version of OS, Yade and Paraview are you using?

My operating system is Ubuntu 16.04 LTS. My Yade version is 2019-11-18
.git-b1a2767 and Paraview version is 5.0.1 (64-bit).

> The resulting "strain.vtk" is a plain text file. Please copy-paste it
here.

Yes, it's a plain text file and the content is very long. I will email
it to you privately.

Thank you for your time!

Cheers,
Chien-Cheng

-- 
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 #691407]: Paraview crashes when pressing apply buttom of the micro-strain vtk file

2020-06-19 Thread Chien-Cheng Hung
New question #691407 on Yade:
https://answers.launchpad.net/yade/+question/691407

Dear all,

I am not sure this question is suitable to be asked here but I really can't 
figure it out.
I am simulating direct shear experiments and trying to visualize the 
micro-strain field after shearing by using [1].
I did obtain a vtk file after running the simulation, but when I open it in the 
Paraview and click the apply button, the Paraview crashes. I can successfully 
visualize other vtk files but not this one.
I wonder why this happens? Does anyone have any idea about it?
Thank you for your help.

Cheers,
Chien-Cheng

[1] https://yade-dem.org/doc/user.html?highlight=micro%20strain#micro-strain

-- 
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 #690948]: Making a sphere layer with certain orientation

2020-05-27 Thread Chien-Cheng Hung
Question #690948 on Yade changed:
https://answers.launchpad.net/yade/+question/690948

Status: Answered => Solved

Chien-Cheng Hung 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


Re: [Yade-users] [Question #690948]: Making a sphere layer with certain orientation

2020-05-27 Thread Chien-Cheng Hung
Question #690948 on Yade changed:
https://answers.launchpad.net/yade/+question/690948

Status: Answered => Open

Chien-Cheng Hung is still having a problem:
Hi Jan,

Thanks for your information. It's very useful.

I tried to apply the same trick to "sp.makeCloud()" because I would like
to assign material properties and different particles size to the
spheres.

###
sp=pack.SpherePack()
sp.makeCloud((0,0,0),(20,20,5), rMean = 1)
center = Vector3(0,0,0)
rotation = Quaternion((1,0,0),.25*pi) 
for b in sp: 
b.state.pos = center + rotation * (b.state.pos - center)
O.bodies.append([utils.sphere(s[0],s[1]) for s in sp])
###

However, the terminal shows "AttributeError: 'tuple' object has no
attribute 'state'" after I ran the above code.

How do I rotate a random loose packing by using makeCloud?

Cheers,
Chien-Cheng

-- 
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 #690948]: Making a sphere layer with certain orientation

2020-05-25 Thread Chien-Cheng Hung
Question #690948 on Yade changed:
https://answers.launchpad.net/yade/+question/690948

Status: Needs information => Open

Chien-Cheng Hung gave more information on the question:
Hi Jan,

Thanks for your quick reply!

> - what "sphere layer" is

I should say a "granular" layer instead of a sphere layer. It means a
layer composed of several spheres.

> - if / what you have tried / thought of, why it did not work...

Currently, I'm using the function makeCloud [1] to generate a random
loose packing of spheres, and then I would apply the isotropic
compaction to make a dense packing (I call it a granular layer). But in
this function, I can only assign a vector to minCorner and maxCorner so
that the length of generated loose packing is always parallel to the X-,
Y-, Z-axis. What I would like to do is to generate a random packing in
which its length can be oriented to the axis with certain degrees. Is
this clear to you?

Thanks again!

Cheers,
Chien-Cheng

[1] https://yade-
dem.org/doc/yade.pack.html?highlight=makecloud#yade._packSpheres.SpherePack.makeCloud

-- 
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 #690948]: Making a sphere layer with certain orientation

2020-05-25 Thread Chien-Cheng Hung
New question #690948 on Yade:
https://answers.launchpad.net/yade/+question/690948

Dear all,

I am trying to generating a sphere layer with a certain orientation.
For example, I would like to generate a layer intersecting Z-axis with 45 
degrees (taking X-axis as the front).
Is it possible to do this in Yade?
Thanks!

Cheers,
Chien-Cheng

-- 
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 #689234]: How to export relative velocity of spheres to Paraview

2020-05-19 Thread Chien-Cheng Hung
Question #689234 on Yade changed:
https://answers.launchpad.net/yade/+question/689234

Status: Answered => Solved

Chien-Cheng Hung confirmed that the question is solved:
Thanks, Jan. That's really helpful!

-- 
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 #689234]: How to export relative velocity of spheres to Paraview

2020-05-18 Thread Chien-Cheng Hung
Question #689234 on Yade changed:
https://answers.launchpad.net/yade/+question/689234

Status: Solved => Open

Chien-Cheng Hung is still having a problem:
Hi Jan,

In my "vtk.exportInteractions" command, I don't want to export the
interactions that are related to O.bodies[0] and O.bodies[1]. How do
exclude specific interactions from my export vtk files?

I tried as follow but it seems not to work. 
I'd appreciate it if you could give some hints. Thank you!

###
def weakeningTemp(i):
heatCapacity = 900 # [J/kg*K]
density = 2500 # [kg/m3]
thermal_diff = 1.e-6
shear_modulus = 22e9
tau_c = 0.1*shear_modulus
initialTemp = 20
penetrationDepth = i.geom.penetrationDepth
radius1 = i.geom.refR1
radius2 = i.geom.refR2
effectiveRadius = (i.geom.refR1 * i.geom.refR2 )/( 
i.geom.refR1+i.geom.refR2  ) 
contactRadius = math.sqrt( i.geom.penetrationDepth *effectiveRadius)   
Da = 2 * contactRadius
contactArea = np.pi*(contactRadius**2)
relativeVelocity = i.geom.shearInc.norm()/O.dt
weakeningTemp = 
(math.sqrt((relativeVelocity*Da)/(np.pi*thermal_diff))*tau_c)/(density*heatCapacity)
 + initialTemp
return weakeningTemp

builtins.weakeningTemp = weakeningTemp # such that VTKExporter has
access to it

vtk = export.VTKExporter("weakingTemp_test")
def vtkExport():
for a in range(2,len(O.bodies)):
b = O.bodies[a]
for i in b.intrs():
O.interactions.erase(i.id1,0)
O.interactions.erase(i.id1,1)
O.interactions.erase(0,i.id2)
O.interactions.erase(1,i.id2)
vtk.exportInteractions(what=dict(weakeningTemp="weakeningTemp(i)"))
###

Cheers,
Chien-Cheng

-- 
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 #689234]: How to export relative velocity of spheres to Paraview

2020-05-18 Thread Chien-Cheng Hung
Question #689234 on Yade changed:
https://answers.launchpad.net/yade/+question/689234

Status: Answered => Solved

Chien-Cheng Hung 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


Re: [Yade-users] [Question #689234]: How to export relative velocity of spheres to Paraview

2020-05-17 Thread Chien-Cheng Hung
Question #689234 on Yade changed:
https://answers.launchpad.net/yade/+question/689234

Status: Answered => Open

Chien-Cheng Hung is still having a problem:
Hi Jan,

Thanks for your reply.

I still get the same error message after following your instruction.

The complete error message:
###
NameError Traceback (most recent call last)
/home/hung/YadeNov2019/bins/yade-2019-11-18.git-b1a2767 in ()

/home/hung/YadeNov2019/bins/yade-2019-11-18.git-b1a2767 in vtkExport()
183 vtk = export.VTKExporter("weakingTemp")
184 def vtkExport():
--> 185 
vtk.exportSpheres(ids=list(range(2,len(O.bodies))),what=dict(weakeningTemp="weakeningTemp(i)"))
186 
187 ##

/home/hung/YadeNov2019/build/lib/x86_64-linux-gnu/yade-2019-11-18.git-b1a2767/py/yade/export.py
 in exportSpheres(self, ids, what, comment, numLabel, useRef)
427 # write additional data from 'what' param
428 for name,command in what.items(): # for each name...
--> 429 test = eval(command) # ... eval one example to 
see what type (float, Vector3, Matrix3) the result is ...
430 # ... and write appropriate header line and 
loop over all bodies and write appropriate vtk line(s)
431 if isinstance(test,Matrix3):

/home/hung/YadeNov2019/build/lib/x86_64-linux-gnu/yade-2019-11-18.git-
b1a2767/py/yade/export.py in ()

NameError: name 'i' is not defined
###

Part of my code looks like:
###
O.engines=[
 ForceResetter()
 
,InsertionSortCollider([Bo1_Box_Aabb(),Bo1_Sphere_Aabb()],verletDist=-0.1,allowBiggerThanPeriod=True)
 ,InteractionLoop(
  [Ig2_Sphere_Sphere_ScGeom6D(),Ig2_Box_Sphere_ScGeom6D()],
  [Ip2_FrictMat_FrictMat_MindlinPhys()],
  [Law2_ScGeom_MindlinPhys_Mindlin()]
 )
 
,GlobalStiffnessTimeStepper(active=1,timeStepUpdateInterval=1,timestepSafetyCoefficient=TSSC,defaultDt=utils.PWaveTimeStep())
 
,PeriTriaxController(dynCell=True,mass=10,maxUnbalanced=1e-3,relStressTol=1e-4,stressMask=7,goal=(-PI/volRatio,-PI/volRatio,-PI/volRatio),globUpdate=1,maxStrainRate=(1,1,1),doneHook='triaxDone()',label='triax')
 ,NewtonIntegrator(gravity=(0,0,0),damping=0.3,label='newton')
 ,PyRunner(command='dataRecorder()',iterPeriod=10,label='recData',dead=True)
 
,PyRunner(command='fixVelocity(RATE_shear)',iterPeriod=1,label='fixVel',dead=True)
 ,PyRunner(iterPeriod=1,command="weakeningTemp",label='weakenTemp',dead=True)
 ,PyRunner(iterPeriod=1,command="vtkExport()",label='vtkExp',dead=True)
 ]

def weakeningTemp(interaction):
heatCapacity = 900 # [J/kg*K]
density = 2500 # [kg/m3]
totalHeat = 0
thermal_diff = 1.e-6
shear_modulus = 22e9
tau_c = 0.1*shear_modulus
initialTemp = 20
penetrationDepth = i.geom.penetrationDepth
radius1 = i.geom.refR1
radius2 = i.geom.refR2
effectiveRadius = (i.geom.refR1 * i.geom.refR2 )/( 
i.geom.refR1+i.geom.refR2  ) 
contactRadius = math.sqrt( i.geom.penetrationDepth *effectiveRadius)   
Da = 2 * contactRadius
contactArea = np.pi*(contactRadius**2)
relativeVelocity = i.geom.shearInc.norm()/O.dt
weakeningTemp = 
math.sqrt((relativeVelocity*Da)/(np.pi*thermal_diff))*tau_c/(density*heatCapacity)
 + initialTemp
return weakeningTemp

builtins.weakeningTemp = weakeningTemp # such that VTKExporter has
access to it

vtk = export.VTKExporter("weakingTemp")
def vtkExport():

vtk.exportSpheres(ids=list(range(2,len(O.bodies))),what=dict(weakeningTemp="weakeningTemp(i)"))
###

Cheers,
Chien-Cheng

-- 
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 #689234]: How to export relative velocity of spheres to Paraview

2020-05-17 Thread Chien-Cheng Hung
Question #689234 on Yade changed:
https://answers.launchpad.net/yade/+question/689234

Chien-Cheng Hung gave more information on the question:
Hi Jan,

I would like to export the function in vtk files as below. I adjust the body of 
function unlike the above you showed me.
But it shows me that "name i is not defined". How do I modify my code?
Thank you for your help again!

###
def weakeningTemp(interaction):
heatCapacity = 900 # [J/kg*K]
density = 2500 # [kg/m3]
totalHeat = 0
thermal_diff = 1.e-6
shear_modulus = 22e9
tau_c = 0.1*shear_modulus
initialTemp = 20
for i in O.interactions():
if O.bodies[i.id1].isReal and O.bodies[i.id2].isReal:
penetrationDepth = i.geom.penetrationDepth
radius1 = i.geom.refR1
radius2 = i.geom.refR2
effectiveRadius = (i.geom.refR1 * i.geom.refR2 )/( 
i.geom.refR1+i.geom.refR2 )
contactRadius = math.sqrt( i.geom.penetrationDepth *effectiveRadius)
Da = 2 * contactRadius
contactArea = np.pi*(contactRadius**2)
relativeVelocity = i.geom.shearInc.norm()/O.dt
weakeningTemp = 
math.sqrt((relativeVelocity*Da)/(np.pi*thermal_diff))*tau_c/(density*heatCapacity)
 + initialTemp
return weakeningTemp

builtins.weakeningTemp = weakeningTemp # such that VTKExporter has
access to it

vtk = export.VTKExporter("weakingTemp")
def vtkExport():

vtk.exportSpheres(ids=list(range(2,len(O.bodies))),what=dict(weakeningTemp="weakeningTemp(i)"))
###

Cheers,
Chien-Cheng

-- 
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 #689234]: How to export relative velocity of spheres to Paraview

2020-05-17 Thread Chien-Cheng Hung
Question #689234 on Yade changed:
https://answers.launchpad.net/yade/+question/689234

Status: Solved => Open

Chien-Cheng Hung is still having a problem:
Hi Jan,

I would like to export the function in vtk files as below. I adjust the body of 
function unlike the above you showed me.
But it shows me that "name i is not defined". How do I modify my code?
Thank you for your help again!

###
def weakeningTemp(interaction):
heatCapacity = 900 # [J/kg*K]
density = 2500 # [kg/m3]
totalHeat = 0
thermal_diff = 1.e-6
shear_modulus = 22e9
tau_c = 0.1*shear_modulus
initialTemp = 20
for i in O.interactions():
if O.bodies[i.id1].isReal and  O.bodies[i.id2].isReal:
penetrationDepth = i.geom.penetrationDepth
radius1 = i.geom.refR1
radius2 = i.geom.refR2
effectiveRadius = (i.geom.refR1 * i.geom.refR2 )/( 
i.geom.refR1+i.geom.refR2  ) 
contactRadius = math.sqrt( i.geom.penetrationDepth 
*effectiveRadius)   

Cheers,
Chien-Cheng
Da = 2 * contactRadius
contactArea = np.pi*(contactRadius**2)
relativeVelocity = i.geom.shearInc.norm()/O.dt
weakeningTemp = 
math.sqrt((relativeVelocity*Da)/(np.pi*thermal_diff))*tau_c/(density*heatCapacity)
 + initialTemp
return weakeningTemp

builtins.weakeningTemp = weakeningTemp # such that VTKExporter has
access to it

vtk = export.VTKExporter("weakingTemp")
def vtkExport():

vtk.exportSpheres(ids=list(range(2,len(O.bodies))),what=dict(weakeningTemp="weakeningTemp(i)"))

-- 
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 #690020]: Rolling friction coefficient in Hertz-Mindlin contact law

2020-04-22 Thread Chien-Cheng Hung
Question #690020 on Yade changed:
https://answers.launchpad.net/yade/+question/690020

Status: Answered => Solved

Chien-Cheng Hung confirmed that the question is solved:
Thanks Jérôme Duriez, 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


[Yade-users] [Question #690020]: Rolling friction coefficient in Hertz-Mindlin contact law

2020-04-17 Thread Chien-Cheng Hung
New question #690020 on Yade:
https://answers.launchpad.net/yade/+question/690020

Dear all,

I found from the previous question that the rolling resistance is implemented 
in Hertz-Mindlin contact law [1][2][3].
As far as I know, rolling resistance can be defined by the rolling stiffness 
(Krot) and the coefficient of rolling friction.
My question is although I found that I can define rolling stiffness by [3], I 
am not sure how to define the coefficient of rolling friction with what 
parameter? Is the eta [2] refers to the coefficient of rolling friction?

Thanks!
Chien-Cheng

[1] 
https://yade-dem.org/doc/yade.wrapper.html?highlight=includemoment#yade.wrapper.Law2_ScGeom_MindlinPhys_Mindlin.includeMoment
[2] 
https://yade-dem.org/doc/yade.wrapper.html#yade.wrapper.Ip2_FrictMat_FrictMat_MindlinPhys.eta
[3] 
https://yade-dem.org/doc/yade.wrapper.html?highlight=krot#yade.wrapper.Ip2_FrictMat_FrictMat_MindlinCapillaryPhys.krot

-- 
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 #689919]: Accumulation effect of heat over time steps

2020-04-17 Thread Chien-Cheng Hung
Question #689919 on Yade changed:
https://answers.launchpad.net/yade/+question/689919

Status: Answered => Solved

Chien-Cheng Hung confirmed that the question is solved:
Hi Jan,

My mistake... the iterPeriod value I input for "someCalculator.collect()" and 
"someCalculator.pprint()" is different.
That explains the reason why I saw the zero value in cumulative data and 
temperature.

Cheers,
Chien-Cheng

-- 
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 #689919]: Accumulation effect of heat over time steps

2020-04-17 Thread Chien-Cheng Hung
Question #689919 on Yade changed:
https://answers.launchpad.net/yade/+question/689919

Chien-Cheng Hung 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


Re: [Yade-users] [Question #689919]: Accumulation effect of heat over time steps

2020-04-17 Thread Chien-Cheng Hung
Question #689919 on Yade changed:
https://answers.launchpad.net/yade/+question/689919

Status: Answered => Open

Chien-Cheng Hung is still having a problem:
Hi Jan,

Thanks again for your reply and suggestion.

I am still learning programming with Python and am also a beginner in
Yade. I am really thankful for these codes which save me plenty of time
and allow me to learn faster. I will try to modify it with my own needs
after getting more familiar with the details.

I tried your code but it turned out the cumulative and temperature
cannot be printed out...

###
class SomeCalculator:
def __init__(self):
self.cumulativeHeatData = dict((a,0) for a in range(2,10))
self.currentHeatData = dict(self.cumulativeHeatData)
self.temperatureData = dict(self.cumulativeHeatData)
def collect(self):
for key,value in self.currentHeatData.items():
   self.cumulativeHeatData[key] += value
self.currentHeatData = dict((a,self.getHeatFromOneParticle(a)) for a in 
range(2,10))
self.computeTemperature()
def getHeatFromOneParticle(self,a):
b = O.bodies[a]
totalHeat = 0
for i in b.intrs():
O.interactions.erase(i.id1,0)
O.interactions.erase(i.id1,1)
O.interactions.erase(0,i.id2)
O.interactions.erase(1,i.id2)
if not i.isReal: continue
penetrationDepth = i.geom.penetrationDepth 
radius1 = i.geom.refR1 
radius2 = i.geom.refR2 
effectiveRadius = (radius1*radius2)/(radius1+radius2)  
contactRadius = math.sqrt(penetrationDepth*effectiveRadius)
contactArea = np.pi*(contactRadius**2) 
relativeVelocity = i.geom.shearInc.norm()/O.dt 
generatedHeat = 
(i.phys.shearForce.norm()/contactArea)/(i.phys.normalForce.norm()/contactArea) 
* i.phys.normalForce.norm() * relativeVelocity   
totalHeat = totalHeat + generatedHeat
return totalHeat
def computeTemperature(self): 
heatCapacity = 900 # [J/kg*K]
density = 2500 # [kg/m3]
for key,cur in self.currentHeatData.items():
cum = self.cumulativeHeatData[key]
for a in range(2,10):
b = O.bodies[a]   
temperature = 0.5 * cum * O.dt / heatCapacity / density * (4/3 
* np.pi * b.shape.radius**3)
self.temperatureData[key] = temperature
def pprint(self):
print()
print("current heat")
print("")
for key,value in self.currentHeatData.items():
print(key,value)
print("cumulative heat")
print("==")
for key,value in self.cumulativeHeatData.items():
print(key,value)
print("temperatures")
print("")
for key,valve in self.temperatureData.items():
print(key,valve)
###

Is there something wrong with my code?

Cheers,
Chien-Cheng

-- 
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 #689919]: Accumulation effect of heat over time steps

2020-04-16 Thread Chien-Cheng Hung
Question #689919 on Yade changed:
https://answers.launchpad.net/yade/+question/689919

Status: Solved => Open

Chien-Cheng Hung is still having a problem:
Dear Jan,

Sorry that I still have one more question...

If I would like to further use the cumulative data to calculate other
parameters, such as temperature, how can I adjust the "singleton" class
to print out the temperature?

thanks for your help again!
Chien-Cheng

-- 
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 #689919]: Accumulation effect of heat over time steps

2020-04-15 Thread Chien-Cheng Hung
Question #689919 on Yade changed:
https://answers.launchpad.net/yade/+question/689919

Chien-Cheng Hung 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


Re: [Yade-users] [Question #689919]: Accumulation effect of heat over time steps

2020-04-15 Thread Chien-Cheng Hung
Question #689919 on Yade changed:
https://answers.launchpad.net/yade/+question/689919

Status: Answered => Solved

Chien-Cheng Hung confirmed that the question is solved:
Thanks, Jan! This really solves my questions.
Thanks again for your help!

-- 
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 #689919]: Accumulation effect of heat over time steps

2020-04-15 Thread Chien-Cheng Hung
Question #689919 on Yade changed:
https://answers.launchpad.net/yade/+question/689919

Status: Needs information => Open

Chien-Cheng Hung gave more information on the question:
>is it possible to make it run shorter to demonstrate the error?

Yes, I also adjusted other parameters to make it run shorter to display
the error.

I sent the modified script to you by email to avoid making the layout here too 
messy.
Hope you don't mind.

thanks!
Chien-Cheng

-- 
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 #689919]: Accumulation effect of heat over time steps

2020-04-15 Thread Chien-Cheng Hung
Question #689919 on Yade changed:
https://answers.launchpad.net/yade/+question/689919

Status: Answered => Open

Chien-Cheng Hung is still having a problem:
Dear Jan,

I simplified my script and hope that you could have a look.

###
from __future__ import print_function
import builtins
from yade import pack,plot,export
import numpy as np
import math

sp1=pack.SpherePack()
sp2=pack.SpherePack()
sp3=pack.SpherePack()

O.periodic=True

# dimensions of sample
RADIUS=0.025
a=15
b=1
c=1
length=a*(2*RADIUS)
height=length/b
width=length/c
thickness=RADIUS
psdSizes=[.0456,.05,.0544]
psdCumm=[0,0.5,1]

# friction angles
wallFRIC=0
spFRIC=26.6

# boundary conditions
PI=1.e5
SN=5.e6
RATE_shear=1

# simulation control
DAMPSHEAR=0.

O.cell.hSize=Matrix3(length,0,0,0,3*height,0,0,0,width)

O.materials.append(FrictMat(density=2500,young=5.5e10,poisson=0.25,frictionAngle=radians(wallFRIC),label='boxMat'))
O.materials.append(FrictMat(density=2500,young=5.5e10,poisson=0.25,frictionAngle=radians(spFRIC),label='sphereMat'))

upBox = 
utils.box(center=(length/2,2*height+thickness,1.5*width),orientation=Quaternion(1,0,0,0),extents=(2*length,thickness/2.,width),fixed=1,wire=True,color=(1,0,0),material='boxMat')
lowBox = 
utils.box(center=(length/2,height-thickness,1.5*width),orientation=Quaternion(1,0,0,0),extents=(2*length,thickness/2.,width),fixed=1,wire=True,color=(1,0,0),material='boxMat')

O.bodies.append([upBox,lowBox])

sp1.makeCloud((0,height+3*RADIUS,width),(length,2*height-3*RADIUS,2*width), 
psdSizes =psdSizes, psdCumm =psdCumm, periodic=True, seed =1)
sp2.makeCloud((0,height+RADIUS,width),(length,height+RADIUS-1e-10,2*width), 
rMean=RADIUS, periodic=True, seed =1)
sp3.makeCloud((0,2*height-RADIUS,width),(length,2*height-RADIUS-1e-10,2*width), 
rMean=RADIUS, periodic=True, seed =1)

sphere_id = 
O.bodies.append([utils.sphere(s[0],s[1],color=(0,0,1),material='sphereMat') for 
s in sp1])
bottomLayer_id = 
O.bodies.append([utils.sphere(s[0],s[1],color=(1,0,1),material='sphereMat') for 
s in sp2])
topLayer_id = 
O.bodies.append([utils.sphere(s[0],s[1],color=(1,0,1),material='sphereMat') for 
s in sp3])

effCellVol=(O.bodies[0].state.pos[1]-O.bodies[1].state.pos[1])*O.cell.hSize[0,0]*O.cell.hSize[2,2]
volRatio=(O.cell.hSize[0,0]*O.cell.hSize[1,1]*O.cell.hSize[2,2])/effCellVol

class SomeCalculator:
def __init__(self):
self.cumulativeData = dict((a,0) for a in range(2,10))
self.currentData = dict(self.cumulativeData)
def collect(self):
"""Collect data from simulation"""
# acumulate cumulative data
for key,valve in self.currentData.items():
   self.cumulativeData[key] += valve
# compute new current data
self.currentData = dict((a,self.getDataFromOneParticle(a)) for a in 
range(2,10))
def getDataFromOneParticle(self,a):
b = O.bodies[a]
totalHeat = 0
for i in b.intrs():
O.interactions.erase(i.id1,0)
O.interactions.erase(i.id1,1)
O.interactions.erase(0,i.id2)
O.interactions.erase(1,i.id2)
if not i.isReal: continue
penetrationDepth = i.geom.penetrationDepth 
radius1 = i.geom.refR1 
radius2 = i.geom.refR2 
effectiveRadius = (radius1*radius2)/(radius1+radius2)  
contactRadius = math.sqrt(penetrationDepth*effectiveRadius)
contactArea = np.pi*(contactRadius**2) 
relativeVelocity = i.geom.shearInc.norm()/O.dt 
generatedHeat = 
(i.phys.shearForce.norm()/contactArea)/(i.phys.normalForce.norm()/contactArea) 
* i.phys.normalForce.norm() * relativeVelocity   
totalHeat = totalHeat + generatedHeat
return totalHeat
def pprint(self):
print()
print("current step")
print("")
for key,valve in self.currentData.items():
print(key,valve)
print("cumulative")
print("==")
for key,valve in self.cumulativeData.items():
print(key,valve)
def getCurrent(self,b):
return self.currentData[b.id]
def getCumulative(self,b):
return self.cumulativeData[b.id]

O.engines=[
 ForceResetter()
 
,InsertionSortCollider([Bo1_Box_Aabb(),Bo1_Sphere_Aabb()],verletDist=-0.1,allowBiggerThanPeriod=True)
 ,InteractionLoop(
  [Ig2_Sphere_Sphere_ScGeom6D(),Ig2_Box_Sphere_ScGeom6D()],
  [Ip2_FrictMat_FrictMat_MindlinPhys()],
  [Law2_ScGeom_MindlinPhys_Mindlin()]
 )
 
,GlobalStiffnessTimeStepper(active=1,timeStepUpdateInterval=1,timestepSafetyCoefficient=0.8,defaultDt=utils.PWaveTimeStep())
 
,PeriTriaxController(dynCell=True,mass=10,maxUnbalanced=1e-3,relStressTol=1e-4,stressMask=7,go

Re: [Yade-users] [Question #689919]: Accumulation effect of heat over time steps

2020-04-15 Thread Chien-Cheng Hung
Question #689919 on Yade changed:
https://answers.launchpad.net/yade/+question/689919

Status: Answered => Open

Chien-Cheng Hung is still having a problem:
Hi Jan,

Many thanks again!

This time I got some errors as below. The cumulative data can still be
printed out but the exported vtk file cannot be opened in the Paraview.

---
KeyError  Traceback (most recent call last)
/home/hung/YadeNov2019/bins/yade-2019-11-18.git-b1a2767 in ()

/home/hung/YadeNov2019/bins/yade-2019-11-18.git-b1a2767 in vtkExport()
223 vtk = export.VTKExporter("someData")
224 def vtkExport():
--> 225 
vtk.exportSpheres(what=dict(current="someCalculator.getCurrent(b)",cumulative="someCalculator.getCumulative(b)"))
226 
227 import builtins

/home/hung/YadeNov2019/build/lib/x86_64-linux-gnu/yade-2019-11-18.git-b1a2767/py/yade/export.py
 in exportSpheres(self, ids, what, comment, numLabel, useRef)
427 # write additional data from 'what' param
428 for name,command in what.items(): # for each name...
--> 429 test = eval(command) # ... eval one example to 
see what type (float, Vector3, Matrix3) the result is ...
430 # ... and write appropriate header line and 
loop over all bodies and write appropriate vtk line(s)
431 if isinstance(test,Matrix3):

/home/hung/YadeNov2019/build/lib/x86_64-linux-gnu/yade-2019-11-18.git-
b1a2767/py/yade/export.py in ()

/home/hung/YadeNov2019/bins/yade-2019-11-18.git-b1a2767 in getCumulative(self, 
b)
127 return self.currentData[b.id]
128 def getCumulative(self,b):
--> 129 return self.cumulativeData[b.id]
130 
131 

KeyError: 1666
---

Do you have any ideas about this?

Cheers,
Chien-Cheng

-- 
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 #689919]: Accumulation effect of heat over time steps

2020-04-15 Thread Chien-Cheng Hung
Question #689919 on Yade changed:
https://answers.launchpad.net/yade/+question/689919

Status: Answered => Open

Chien-Cheng Hung is still having a problem:
Hi Jan,

Thanks for your code and prompt reply! It works well.

So if I want to export these accumulate values and visualize in the Paraview, 
what could I do?
I would be grateful if you could provide me more instructions.

Cheers,
Chien-Cheng

-- 
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 #689919]: Accumulation effect of heat over time steps

2020-04-14 Thread Chien-Cheng Hung
New question #689919 on Yade:
https://answers.launchpad.net/yade/+question/689919

Dear all,

I am trying to simulate the heat generation at the contacts of all interacting 
spheres over time steps.
Considering generated heat at each time step can accumulate on the contact 
through time, how can I calculate the total generated heat within total time?
For example, at t1=0.05s, I can obtain the total heat of each sphere (H1) from 
the last time step, and after a time step (5e-6s) where t2=0.050005, I can 
again obtain the total heat of each sphere (H2) from last time step. 
So my question is how to calculate the accumulative heat of each sphere over 
time step?

Here's the code I use for calculating the total generated heat of the sphere 
from the last time step:
###
def get_totalHeat():
list_totalHeat=[]
for a in range(2,len(O.bodies)):
totalHeat = 0
for i in O.bodies[a].intrs():
O.interactions.erase(i.id1,0)
O.interactions.erase(i.id1,1)
O.interactions.erase(0,i.id2)
O.interactions.erase(1,i.id2)
if i.isReal:
penetrationDepth = i.geom.penetrationDepth 
radius1 = i.geom.refR1 
radius2 = i.geom.refR2 
effectiveRadius = (radius1*radius2)/(radius1+radius2)  
contactRadius = math.sqrt(penetrationDepth*effectiveRadius)
contactArea = np.pi*(contactRadius**2) 
relativeVelocity = i.geom.shearInc.norm()/O.dt 
generatedHeat = 
(i.phys.shearForce.norm()/contactArea)/(i.phys.normalForce.norm()/contactArea) 
* i.phys.normalForce.norm() * relativeVelocity   
totalHeat = totalHeat + generatedHeat
list_totalHeat.append([a,totalHeat])
return list_totalHeat
###

How to modify if I want to involve the accumulation effect of heat by time step?
Thanks!

Cheers,
Chien-Cheng

-- 
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 #689234]: How to export relative velocity of spheres to Paraview

2020-03-23 Thread Chien-Cheng Hung
Question #689234 on Yade changed:
https://answers.launchpad.net/yade/+question/689234

Status: Answered => Solved

Chien-Cheng Hung 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


Re: [Yade-users] [Question #689439]: How to glue spheres to the box?

2020-03-23 Thread Chien-Cheng Hung
Question #689439 on Yade changed:
https://answers.launchpad.net/yade/+question/689439

Status: Answered => Open

Chien-Cheng Hung is still having a problem:
Hi Jan,

Thanks for your reply!

> please be more specific. I have tried your code, and it seemed to work
ok (the box and boundary particles behaved like rigid body)

Sorry for the vague description. What I mean is after pressing the
"play" button, isotropic compression begins and the spheres penetrate
into the box. If I use walls as top and bottom boundaries instead of the
clump, I can successfully confine the spheres within the middle space
without any penetrating issue happen. It's not the thing whether the box
and boundary particles behaved like a rigid body or not.

> if this is the problem, then it is probably due to stiffness and/or
loading conditions

I am wondering whether I can "turn off" the periodic boundary condition
in the Y direction to avoid this issue. Do you know how to do that?

Thanks again!

Chien-Cheng

-- 
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 #689439]: How to glue spheres to the box?

2020-03-22 Thread Chien-Cheng Hung
New question #689439 on Yade:
https://answers.launchpad.net/yade/+question/689439

Dear all,

I am trying to simulate direct shear experiments.

In my simulation, the periodic boundary condition is applied and in addition, 
the top and bottom are confined by a box.
To simulate a rough boundary surface similar to the experiment conditions, I 
tried to glue some spheres on the box.
I thought "clump" spheres and boxes together could be a feasible way. However, 
it seems not to work (or maybe I did it wrong).
It turns out the spheres penetrate into the box during isotropic compression.
I also tried to glue them together by playing with cohesive, but the contact 
model I use is a non-cohesive Hertz contact model.

I am wondering if there are other ways I can glue the spheres and box together 
and therefore, the glued material can also act as confinement. Thanks!

Hereby I attach the simplified code:

##
from yade import pack
import math

sp=pack.SpherePack()

O.periodic=True

RADIUS=0.025
length=0.75
height=0.375
width=0.375
thickness=RADIUS
PI=1.e5
spFRIC=26.6


O.cell.hSize=Matrix3(length,0,0,0,3*height,0,0,0,width)

O.materials.append(FrictMat(density=2500,young=5.5e10,poisson=0.25,frictionAngle=radians(spFRIC),label='boxMat'))

upBoundary=[]
lowBoundary=[]

### Creat top and bottom box
upBoundary.append(O.bodies.append(utils.box(center=(length/2,2*height+thickness,1.5*width),orientation=Quaternion(1,0,0,0),extents=(2*length,thickness/2.,width),fixed=1,wire=True,color=(1,0,0),material='boxMat')))
lowBoundary.append(O.bodies.append(utils.box(center=(length/2,height-thickness,1.5*width),orientation=Quaternion(1,0,0,0),extents=(2*length,thickness/2.,width),fixed=1,wire=True,color=(1,0,0),material='boxMat')))

### Roughness setting
wallLength=15
wallWidth=10
roughnessPara=2

### top spheres 
for c in range(1, wallLength):
for d in range(0, wallWidth):

upBoundary.append(O.bodies.append(sphere([c*RADIUS*roughnessPara,2*height-thickness,d*RADIUS],RADIUS,fixed=1,color=(72/255.,72/255.,147/255.),material='boxMat')))
 

### low spheres
for a in range(1, wallLength):
for b in range(0, wallWidth):

lowBoundary.append(O.bodies.append(sphere([a*RADIUS*roughnessPara,height+thickness,b*RADIUS],RADIUS,fixed=1,color=(72/255.,72/255.,147/255.),material='boxMat')))
 

### Clump spheres and box together
idClump1=O.bodies.clump(upBoundary)
idClump2=O.bodies.clump(lowBoundary)

sp.makeCloud((0,height+3*RADIUS,0),(length,2*height-3*RADIUS,width), 
rMean=0.025, periodic=True, seed =1)
sphere_id = 
O.bodies.append([utils.sphere(s[0],s[1],color=(0,0,1),material='boxMat') for s 
in sp])

effCellVol=(O.bodies[idClump1].state.pos[1]-O.bodies[idClump2].state.pos[1])*O.cell.hSize[0,0]*O.cell.hSize[2,2]
volRatio=(O.cell.hSize[0,0]*O.cell.hSize[1,1]*O.cell.hSize[2,2])/effCellVol

O.engines=[
 ForceResetter()
 
,InsertionSortCollider([Bo1_Box_Aabb(),Bo1_Sphere_Aabb()],verletDist=-0.1,allowBiggerThanPeriod=True)
 ,InteractionLoop(
  [Ig2_Sphere_Sphere_ScGeom6D(),Ig2_Box_Sphere_ScGeom6D()],
  [Ip2_FrictMat_FrictMat_MindlinPhys()],
  [Law2_ScGeom_MindlinPhys_Mindlin()]
 )
 
,GlobalStiffnessTimeStepper(active=1,timeStepUpdateInterval=1,timestepSafetyCoefficient=0.8,defaultDt=utils.PWaveTimeStep())
 
,PeriTriaxController(dynCell=True,mass=10,maxUnbalanced=1e-3,relStressTol=1e-4,stressMask=7,goal=(-PI/volRatio,-PI/volRatio,-PI/volRatio),globUpdate=1,maxStrainRate=(1,1,1),doneHook='triaxDone()',label='triax')
 ,NewtonIntegrator(gravity=(0,0,0),damping=0.3,label='newton')
 ]


def triaxDone():
 global phase
 vol=h*O.cell.hSize[0,0]*O.cell.hSize[2,2]
 contactStress=getStress(vol)
 vol_s=Rmean=Rmax=nbSph=0
 Rmin=1e6
 for o in O.bodies:
  if isinstance(o.shape,Sphere):
   nbSph+=1
   Rmean+=o.shape.radius
   if o.shape.radius>Rmax: Rmax=o.shape.radius
   if o.shape.radiushttps://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 #689234]: How to export relative velocity of spheres to Paraview

2020-03-11 Thread Chien-Cheng Hung
Question #689234 on Yade changed:
https://answers.launchpad.net/yade/+question/689234

Status: Answered => Open

Chien-Cheng Hung is still having a problem:
Hi Jan,

Thanks a lot!

> you can write a function to it and call the function in
exportInteractions / exportContactPoints

Is it possible that instead of calling the function, I can make a list
of data of relative velocity that is recognized in Paraview

Cheers,
Chien-Cheng

-- 
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 #689234]: How to export relative velocity of spheres to Paraview

2020-03-10 Thread Chien-Cheng Hung
Question #689234 on Yade changed:
https://answers.launchpad.net/yade/+question/689234

Status: Answered => Open

Chien-Cheng Hung is still having a problem:
Hi Jan,

Thanks for your quick reply!

> relative velocity with respect to what? relative velocity of
interacting bodies for all interactions?

Sorry I didn't describe clearly. But, yes, the relative velocity of interacting 
bodies for all interactions.
The relative velocity of the spheres that I want to obtain is described in 
ScGeom [1].

> above, b.state.vel and i.phys.normalForce is only illustrative, needs
to be replaced by actual formula for relative velocity.

Can I get the formula for relative velocity [1] somewhere in Yade? Or I
have to define one by myself?

Cheers,
Chien-Cheng

[1] https://yade-
dem.org/doc/yade.wrapper.html?highlight=scgeom#yade.wrapper.ScGeom

-- 
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 #689234]: How to export relative velocity of spheres to Paraview

2020-03-10 Thread Chien-Cheng Hung
New question #689234 on Yade:
https://answers.launchpad.net/yade/+question/689234

Hi all,

I am simulating direct shear experiments and I would like to visualize the 
relative velocity of all interacted spheres.
I've tried to record the interaction of bodies using VTKRecorder but it seems 
there is no relative velocity in this recorder.

So I am wondering how do I export the relative velocity of all interactive 
spheres to Paraview to visualize it?
Thanks!

Chien-Cheng


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