stress/atom

Submitted by SergeiD on Fri, 05/20/2011 - 08:18

Hi.
I have a problem with per-atom stress calculation.
I modify examples/packing script in order to calculate and dump per-atom stresses. So, I add the line:

64: compute st all stress/atom ke pair

and modify the dump command:

68: dump dmp all custom 350 post/dump.packing id type type x y z ix iy iz vx vy vz fx fy fz omegax omegay omegaz radius c_st[1] c_st[2] c_st[3] c_st[4] c_st[5] c_st[6]

But I got a error:

ERROR: Per-atom virial was not tallied on needed timestep

What is this?
I attach modified script

======
Upd: The script

#Particle packing by insertion and successive growing of particles

atom_style granular
atom_modify map array
boundary m m m
newton off
#echo both

communicate single vel yes

units si

region reg block -0.05 0.05 -0.05 0.05 0. 0.15 units box
create_box 1 reg

neighbor 0.002 bin
neigh_modify delay 0

#Material properties required for new pair styles

fix m1 all property/global youngsModulus peratomtype 5.e6
fix m2 all property/global poissonsRatio peratomtype 0.45
fix m3 all property/global coefficientRestitution peratomtypepair 1 0.3
fix m4 all property/global coefficientFriction peratomtypepair 1 0.5

#New pair style
pair_style gran/hertz/history 1 0 #Hertzian without cohesion
pair_coeff * *

timestep 0.00001

fix xwalls all wall/gran/hertz/history 1 0 xplane -0.05 0.05 1
fix ywalls all wall/gran/hertz/history 1 0 yplane -0.05 0.05 1
fix zwalls all wall/gran/hertz/history 1 0 zplane 0.00 0.15 1

#distributions for insertion
fix pts1 all particletemplate/sphere 1 atom_type 1 density constant 2500 radius constant 0.01
fix pts2 all particletemplate/sphere 1 atom_type 1 density constant 2500 radius constant 0.016
fix pdd1 all particledistribution/discrete 1. 2 pts1 0.3 pts2 0.7

#parameters for gradually growing particle diameter
variable alphastart equal 0.25
variable alphatarget equal 0.67
variable growts equal 50000
variable growevery equal 40
variable relaxts equal 20000

#region and insertion
group nve_group region reg
fix ins nve_group pour/dev/packing 1 distributiontemplate pdd1 vol ${alphastart} 200 region reg

#apply nve integration to all particles that are inserted as single particles
fix integr nve_group nve/sphere

#output settings, include total thermal energy
compute 1 all erotate/sphere
thermo_style custom step atoms ke c_1 vol
thermo 1000
thermo_modify lost ignore norm no
compute_modify thermo_temp dynamic yes

#insert the first particles
run 1
unfix ins

#calculate grow rate
variable Rgrowrate equal (${alphatarget}/${alphastart})^(${growevery}/(3.*${growts}))
print "The radius grow rate is ${Rgrowrate}"

#do the diameter grow
compute rad all property/atom radius

variable d_grown atom ${Rgrowrate}*2.*c_rad
fix grow all adapt ${growevery} atom diameter d_grown
neigh_modify every ${growevery} check no

# Atom stresses
compute as all stress/atom ke pair

dump dmp all custom 350 post/dump.packing id type type x y z ix iy iz vx vy vz fx fy fz omegax omegay omegaz radius c_as[1] c_as[2] c_as[3] c_as[4] c_as[5] c_as[6]

#run
run ${growts}

#let the packing relax
unfix grow
neigh_modify check yes
run ${relaxts}

ckloss's picture

ckloss | Mon, 05/23/2011 - 14:49

Hi Sergei,

LAMMPS/LIGGGHTS calculate stress via the virial theorem, and the error is related to the way how this virial is calculated.
Could you attach the script? I would have a look then

best,
Christoph

ckloss's picture

ckloss | Thu, 05/26/2011 - 16:16

Hi Sergei,

as a quickfix, you can use the following script that invokes virial calculation via the thermo command.
I will work on a fix for the problem for the next release.

Christoph

#Particle packing by insertion and successive growing of particles

atom_style granular
atom_modify map array
boundary m m m
newton off
#echo both

communicate single vel yes

units si

region reg block -0.05 0.05 -0.05 0.05 0. 0.15 units box
create_box 1 reg

neighbor 0.002 bin
neigh_modify delay 0

#Material properties required for new pair styles

fix m1 all property/global youngsModulus peratomtype 5.e6
fix m2 all property/global poissonsRatio peratomtype 0.45
fix m3 all property/global coefficientRestitution peratomtypepair 1 0.3
fix m4 all property/global coefficientFriction peratomtypepair 1 0.5

#New pair style
pair_style gran/hertz/history 1 0 #Hertzian without cohesion
pair_coeff * *

timestep 0.00001

fix xwalls all wall/gran/hertz/history 1 0 xplane -0.05 0.05 1
fix ywalls all wall/gran/hertz/history 1 0 yplane -0.05 0.05 1
fix zwalls all wall/gran/hertz/history 1 0 zplane 0.00 0.15 1

#distributions for insertion
fix pts1 all particletemplate/sphere 1 atom_type 1 density constant 2500 radius constant 0.01
fix pts2 all particletemplate/sphere 1 atom_type 1 density constant 2500 radius constant 0.016
fix pdd1 all particledistribution/discrete 1. 2 pts1 0.3 pts2 0.7

#parameters for gradually growing particle diameter
variable alphastart equal 0.25
variable alphatarget equal 0.67
variable growts equal 50000
variable growevery equal 40
variable relaxts equal 20000

#region and insertion
group nve_group region reg
fix ins nve_group pour/dev/packing 1 distributiontemplate pdd1 vol ${alphastart} 200 region reg

#apply nve integration to all particles that are inserted as single particles
fix integr nve_group nve/sphere

# Atom stresses
compute as all stress/atom ke pair
compute p all reduce sum c_as[1] c_as[2] c_as[3]
variable press equal -(c_p[1]+c_p[2]+c_p[3])/(3*vol)

#output settings, include total thermal energy
compute 1 all erotate/sphere
thermo_style custom step atoms ke c_1 vol v_press
thermo 1000
thermo_modify lost ignore norm no
compute_modify thermo_temp dynamic yes

#insert the first particles
run 1
unfix ins

#calculate grow rate
variable Rgrowrate equal (${alphatarget}/${alphastart})^(${growevery}/(3.*${growts}))
print "The radius grow rate is ${Rgrowrate}"

#do the diameter grow
compute rad all property/atom radius

variable d_grown atom ${Rgrowrate}*2.*c_rad
fix grow all adapt ${growevery} atom diameter d_grown
neigh_modify every ${growevery} check no

dump dmp all custom 350 post/dump.packing id type type x y z ix iy iz vx vy vz fx fy fz omegax omegay omegaz radius c_as[1] c_as[2] c_as[3] c_as[4] c_as[5] c_as[6]

#run
run ${growts}

#let the packing relax
unfix grow
neigh_modify check yes
run ${relaxts}

prasantud | Sun, 11/20/2011 - 07:36

Hi everybody,
I am matching the solution of a static granular packing with the analytical solution sigma_zz=rho*g*(h-z)

1.
But the stress/atom gives me the solution of 0.6 at the bottom (z=0) of height 1 of simple cubic packing.
The pressure -(c_p[1]+c_p[2]+c_p[3])/(3*vol) gives 7246
Volume =1.32

So the stress/atom in si units 0.6*7246*1.3=5652;
Analytical solution give=rho*g*h=2500*9.8*1=25,000.

2. Intrestingly the DEM solution give sigma_xx=sigma_yy=sigma_zz.
But the analytical solution says, sigma_xx=0, sigma_yy=0, sigma_zz=rho*g*(h-z)

Any comments,
regards,
Samantaray

ckloss's picture

ckloss | Mon, 11/21/2011 - 13:03

No exactly sure what kind of configuration you examined, but I guess the most likely source of difference is the reference volume for the stress that you choose. what kind of stress are we talking about - average bulk stress in continuum sense or stress in a single particle?

>>sigma_zz=rho*g*(h-z)
I doubt that this is correct...what is rho here - bulk density?

Christoph