Particle counting problem

Submitted by shawnwuch on Tue, 09/30/2014 - 03:54

Dear Liggghts users,

I am having three problems counting the number of particles of 2 different sizes flowing through a rectangular slot. My Liggghts version is 2.3.6.

The first problem is that when I use group function with variable function as shown below in the input script, the output of particle count is always zero. I don't quite understand why this happens. (Here I simplify the problem by using fewer timesteps and try to count to particle in the insert region, named as inbox.)

Here is the script I wrote:

atom_style granular
atom_modify map array sort 1000 0.0
boundary m m f
newton off
communicate single vel yes

units cgs

region reg block -0.3075 0.3075 -0.1 0.1 0 0.8 units box
region inbox block -0.265 0.265 -0.1 0.1 0.4 0.8 units box
region output block -0.265 0.265 -0.1 0.1 0 0.4 units box

create_box 2 reg

neighbor 0.001 bin
neigh_modify check yes delay 0

#Material properties required for new pair styles

fix m1 all property/global youngsModulus peratomtype 1e7 1e7
fix m2 all property/global poissonsRatio peratomtype 0.2 0.2
fix m3 all property/global coefficientRestitution peratomtypepair 2 0.3 0.3 0.3 0.3
fix m4 all property/global coefficientFriction peratomtypepair 2 0.4 0.4 0.4 0.4
fix m5 all property/global coefficientRollingFriction peratomtypepair 2 0.35 0.35 0.35 0.35

pair_style gran/hertz/history rolling_friction cdt tangential_damping on viscous off
pair_coeff * *

timestep 2.5e-7

fix ts_check all check/timestep/gran 1000 0.2 0.2

fix zwallbottom all wall/gran/hertz/history primitive type 1 zplane 0 rolling_friction cdt tangential_damping on viscous off
fix zwalltop all wall/gran/hertz/history primitive type 1 zplane 0.8 rolling_friction cdt tangential_damping on viscous off
fix zwallmid all wall/gran/hertz/history primitive type 1 zplane 0.4 rolling_friction cdt tangential_damping on viscous off
fix xwall_lo all wall/gran/hertz/history primitive type 1 xplane -0.265 rolling_friction cdt tangential_damping on viscous off
fix xwall_hi all wall/gran/hertz/history primitive type 1 xplane 0.265 rolling_friction cdt tangential_damping on viscous off
fix ywall_lo all wall/gran/hertz/history primitive type 1 yplane -0.1 rolling_friction cdt tangential_damping on viscous off
fix ywall_hi all wall/gran/hertz/history primitive type 1 yplane 0.1 rolling_friction cdt tangential_damping on viscous off
fix cad all mesh/surface file 150WWS.stl type 1 scale 1e-4 move 0 0 0.4
fix scrwall all wall/gran/hertz/history mesh n_meshes 1 meshes cad

#distributions for insertion
fix pts1 all particletemplate/sphere 911 atom_type 1 density constant 2.650 radius constant 294.46e-4
fix pts2 all particletemplate/sphere 1092 atom_type 2 density constant 2.650 radius constant 256.84e-4

fix pdd1 all particledistribution/discrete 5430 2 pts1 0.5 pts2 0.5

#parameters for gradually growing particle diameter
variable alphastart equal 0.30
variable alphatarget equal 0.60
variable growts equal 60000
variable growevery equal 40
variable relaxts equal 40000

#region and insertion
group nve_group region reg
fix ins nve_group insert/pack seed 24 distributiontemplate pdd1 insert_every once overlapcheck yes all_in yes region inbox volumefraction_region ${alphastart}

#group particles of different sizes
group pt1 type 1
group pt2 type 2

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

#output settings, include total thermal energy
compute fc all pair/gran/local id pos force
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

dump dumpstl all stl 200 post/dump150WWS_*.stl

#insert the first particles
run 1
dump dmp all custom 20000 post/dump.150WWS_*.liggghts id type x y z ix iy iz vx vy vz fx fy fz omegax omegay omegaz radius #20000
unfix ins
undump dumpstl

#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 dgrown atom ${Rgrowrate}*2.*c_rad
fix grow nve_group adapt ${growevery} atom diameter v_dgrown
neigh_modify every ${growevery} check no

#run
run ${growts}

#let the packing relax
unfix grow

neigh_modify check yes

run ${relaxts}

##Downward force and flow through screen
fix gr nve_group gravity 2500 vector 0 0 -1

timestep 2.5e-7

run 10000

fix damp nve_group viscous 0.189
run 10000
unfix damp
unfix zwallmid

run 100000
########

variable finaltimestep equal step
variable N1 equal count(pt1,inbox)
variable N2 equal count(pt2,inbox)

fix extra all print 1 "Timestep = ${finaltimestep};${N1};${N2}" append result.txt
run 1
unfix extra

Secondly, I wonder if there is any way to extract the radius information for each type of particles that's been inserted into the domain? I tried to use command like the following:
variable R1 equal f_pts1[2]*1e4; But it didn't work.

The third problem is that when having 9 particle types, is there a better way of doing the above task instead of having to assign lots of values in the fix property/global peratomtypepair commands? (9 atom types would require over 90000 values being assigned for each pair type, if my understanding is correct.)

Any suggestion would be deeply appreciated. Thank you very much for your time.

Regards,
Shawn

richti83's picture

richti83 | Tue, 09/30/2014 - 08:15

Hi Shawn,

first you should update your liggghts installation to 3.0.3.
Than have a look in doc/fix_massflow_mesh.html maybe this is a better way to calc the flow through a rectangular slot.

The Problem in your script is, that you assign the groups to the types before the particles are inserted. The group command acts at the moment it is invoced and only on present particles.
Try the group command in the line before the count command, this should work.
About the particle types: when you use 9 types you need 9*9=81 values for every property peratomtypepair and 9 for every peratomtype.
I don't know how to restrict the count function to only applay for a specific radius, maybe you should have a look in the variable.cpp and write your own filter (count only if atom->radius[i]==arg[?])).

Best,
Christian.

I'm not an associate of DCS GmbH and not a core developer of LIGGGHTS®
ResearchGate | Contact

shawnwuch | Thu, 10/02/2014 - 18:12

Christian,

Thank you very much! Moving the group function solved my problem.

shawnwuch | Thu, 07/23/2015 - 03:08

Dear LIGGGHTS users,

I am trying to count the number of particles of different sizes through a planar surface.
And I Would like to separate the particle count by the particle sizes, for example, "5 particles of size A" passed the surface, "6 particles of size B" passed the surface etc..
I tried to use "fix massflow/mesh" command along with "group" but did not find a way to make it work. I wonder if anybody can share his/her experience on this problem?
(P.S. I think this is possible because there's a line that says "Only particles part of group are eligible for counting." in the document for "fix massflow/mesh". However, changing the group input for that command did not work. It still gave me the total number of particle instead of the number of particle of a specific group.)

Thanks,
Shawn

ckloss's picture

ckloss | Wed, 08/05/2015 - 22:59

Hi,

as outlined below, this feature has been incorporated in version 3.2.1, so you will have to update

Best wishes
Christoph

richti83's picture

richti83 | Thu, 07/23/2015 - 10:44


LIGGGHTS® 3.2.1: (released 21.07.2015)

Added a new "EPSD3" rolling friction model that is similar to EPSD1, but allows the user explicit control over the rolling stiffness. See doc for more detail. Thanks to Thomas Puffitsch (TUG) for the contribution.
The default length unit for commands "fix ave/spatial", "fix deform", "fix move", "fix dt/reset", "fix wall", "change_box", "region", "velocity", and "create_atoms" was changed from "lattice" to "box" units
Added two more outputs for compute pair gran local: "force_normal" and "force_tangential" can now also be output
In preparation of species coupling using ParScale, added a new fix couple/cfd/speciesConvection. Thanks to the group of Stefan Radl (TUG) for the collaboration on this topic.
Richard Berger (JKU) added a "modify_timing" command that can give fine-grained information about the run-time of each fix (rather than lumping all times together in "Other"). Thanks for this nice feature!
Added number based distribution definition to fix particletemplate/discrete. Thanks to Rouven Weiler (BASF) for the suggestion
Fixed a rare bug where restart data was not correctly assigned to fixes after restart. Thanks to Andreas Aigner (DCS) for providing a testcase.
Fixed a bug in fix ave/euler concerning the calculation of average velocity. Thanks to Daniel Queteschiner (JKU) for posting a bugfix!
Fixed an issue with the "dynamic" feature of the region command
Added support for fix group for fix massflow/mesh, i.e. the command now only counts the particles in the specified fix group
Added a new tangential model "off", which corresponds to no tangential model. For consistency, this model is now the default if no tangential model is specified

means, this feature has been just introduced in version 3.2.1.

I'm not an associate of DCS GmbH and not a core developer of LIGGGHTS®
ResearchGate | Contact