Rigid Body Output Error

Submitted by willsmithumich on Wed, 03/21/2012 - 14:32

Hi all,

I am trying to run a simulation with a rigid body (using fix rigid). When I output from the fix (using a variables) the x-axis velocity, force, and torque are always almost zero (order e-322). The other output data appears reasonable. Does anyone have any ideas?

Here is a basic example code:

#System Information
boundary f f f
newton off
communicate single vel yes
units si
echo both
neighbor 0.01 bin
neigh_modify delay 0
timestep 5.0e-6

#Atom Information
atom_style granular
atom_modify map array

#Create Atoms
lattice sc 0.25
region reg block -2.0 2.0 -2.0 2.0 -1.0 3.0 units box
create_box 1 reg
region reg1 block -0.5 0.5 -0.5 0.5 0.5 1.0 units box
create_atoms 1 region reg1 units box
set region reg1 diameter 0.2 density 5000

#Material Properties
fix m1 all property/global youngsModulus peratomtype 6.24e7
fix m2 all property/global poissonsRatio peratomtype 0.3
fix m3 all property/global coefficientRestitution peratomtypepair 1 0.9
fix m4 all property/global coefficientFriction peratomtypepair 1 0.5

#Pair Style
pair_style gran/hertz/history 1 0
pair_coeff * *

#System Fixes
fix gravi all gravity 9.81 vector 0.0 0.0 -1.0
fix xwalls all wall/gran/hertz/history 1 0 xplane -1.0 1.0 1
fix ywalls all wall/gran/hertz/history 1 0 yplane -1.0 1.0 1
fix zwalls all wall/gran/hertz/history 1 0 zplane 0.0 2.0 1

#Select Groups
group boxGroup region reg1

#Modify Groups
fix boxFix boxGroup rigid single
neigh_modify exclude group boxGroup boxGroup

#Create Variables to Save Box to File
variable BxPos equal f_boxFix[1][1]
variable ByPos equal f_boxFix[1][2]
variable BzPos equal f_boxFix[1][3]
variable BxVel equal f_boxFix[1][4]
variable ByVel equal f_boxFix[1][5]
variable BzVel equal f_boxFix[1][6]
variable BxForce equal f_boxFix[1][7]
variable ByForce equal f_boxFix[1][8]
variable BzForce equal f_boxFix[1][9]
variable BxTorque equal f_boxFix[1][10]
variable ByTorque equal f_boxFix[1][11]
variable BzTorque equal f_boxFix[1][12]

#Run One Step and Configure Output Files
run 1
dump dmpBox boxGroup custom 1000 post/dump.tempBox id type type x y z ix iy iz vx vy vz fx fy fz omegax omegay omegaz radius
fix dmpText all print 1000 "${BxPos} ${ByPos} ${BzPos} ${BxVel} ${ByVel} ${BzVel} ${BxForce} ${ByForce} ${BzForce} ${BxTorque} ${ByTorque} ${BzTorque}" screen no title "x y z vx vy vz fx fy fz tx ty tz " file post/COMdata.txt

#Run Simulation
fix appliedForce boxGroup addforce 100.00 100.0 0.0
run 100000 upto

And here is one timestep of the fix output:
0.2069424257 0.2069424257 0.5278820055 7.954456898e-322 0.341879434 0.8083703145 1.72011998e-316 7500 -15409.51197 1.630416631e-322 -2.870592652e-12 -8.881784197e-14

ckloss's picture

ckloss | Thu, 03/22/2012 - 23:43

Hi willsmithumich,

what if you cross-check the per-atom data from the dump file with the per-body data from the fix print, is that consistent?

Cheers, Christoph

willsmithumich | Fri, 03/23/2012 - 20:25

Thanks for responding Christoph,

The per-atom data is consistent with the fix print for Y and Z axis data only, not for X-axis data (except for position).

The dump file shows different X-axis values for velocity, angular velocity, and force compared to the fix print. For instance, on the last time step the X-axis velocity is 0.679675.

I have also checked this by using a "compute property/atom", then using a "compute reduce sum" to calculate force. The Y-axis and Z-axis forces are the same as from the "fix print." The X-axis data is correct for the compute property/atom.

I have also checked in the past by placing one atom at the rigid body COM, then use a "compute property/atom" and "compute reduce sum" to make variables that output position, velocity, and angular velocity. When I compare these values to the "fix print," the Y-axis and Z-axis values are once again consistent. The fix print outputs a correct X-axis position only.

Calculating the rigid body torque is the most difficult, as I believe it would require a loop that calculates the torque contribution of each particle. If you can think of a simpler work-around for torque output, please let me know.

Best regards,
willsmithumich