Adding force to a group of particles

Submitted by megoplay20 on Tue, 02/02/2016 - 11:59

Hello!
I am using LIGGGHTS 3.0.7.
I am trying to add a force to the group of particles of a particular type.

Here, what i do:
//create region in which the force should be applied
region field_region block -0.1 0.1 -0.1 +0.1 0 0.1 units box
//define group gg which consists only of particles of type 1
group gg type 1
//trying to apply the force which will try to decrease the speed of the particles
fix mag_field gg addforce 0.0 0.0 +0.3 region field_region

This code does not work.
If I replace gg to all in:
fix mag_field gg addforce 0.0 0.0 +0.3 region field_region
Then everything is OK and force is applied.

The problem seems to be in the group definition.
I tried to check if there are some particles inside the group using this code:
compute 1 gg com
thermo_style custom step atoms c_1[1] c_1[2] c_1[3]

But c_1[1] c_1[2] c_1[3] always show 0 during computation.

What is wrong with my code?

Thank you in advance!

Full code:

atom_style granular
atom_modify map array
boundary f f f
newton off
communicate single vel yes
units si

region reg block -0.36 0.36 -0.36 0.36 -0.05 0.23 units box
create_box 2 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 5.e6
fix m2 all property/global poissonsRatio peratomtype 0.45 0.45
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.5 0.5 0.5 0.5
fix m5 all property/global k_finnie peratomtypepair 2 1.0 1.0 1.0 1.0
fix m6 all property/global coefficientRollingFriction peratomtypepair 2 0.2 0.2 0.2 0.2

#New pair style
pair_style gran model hertz tangential history rolling_friction cdt#Hertzian without cohesion
#pair_style gran model hertz tangential history #Hertzian without cohesion

pair_coeff * *

timestep 0.00003125

fix gravi all gravity 9.81 vector 0.0 0.0 -1.0
fix integrate all nve/sphere

fix surface all mesh/surface/stress file meshes/surface_big.stl type 2

fix granwalls all wall/gran model hertz tangential history rolling_friction cdt mesh n_meshes 1 meshes surface
#fix granwalls all wall/gran model hertz tangential history mesh n_meshes 1 meshes surface

#distributions for insertion
fix pts1 all particletemplate/sphere 1 atom_type 1 density constant 4500 radius gaussian number 0.0006 0.000066667
fix pdd1 all particledistribution/discrete 1. 1 pts1 1.0

#region and insertion
#group nve_group region reg
region bc1 cylinder z 0 0 0.06 0.03 0.18 units box

region field_region block -0.1 0.1 -0.1 +0.1 0 0.1 units box
group gg type 1
fix mag_field gg addforce 0.0 0.0 +0.3 region field_region

fix ins1 all insert/rate/region seed 5330 distributiontemplate pdd1 &
nparticles 7000 particlerate 2700 insert_every 1000 overlapcheck no all_in no vel constant 0.0 0.0 -1.0 &
region bc1

compute 1 gg com
thermo_style custom step atoms c_1[1] c_1[2] c_1[3]
thermo 100
thermo_modify lost ignore norm no

#insert the first particles so that dump is not empty
run 1
dump dmp all custom 1000 post/particles*.mixer id type type x y z ix iy iz vx vy vz fx fy fz omegax omegay omegaz radius
#insert particles
run 50000 upto
unfix ins1

AttachmentSize
Plain text icon src_code.txt2.48 KB
Image icon 1.png112.66 KB
Image icon 2.png112.66 KB

Daniel Queteschiner | Tue, 02/02/2016 - 14:47

You're creating the group before any particles are inserted into the simulation, thus the group is empty.

megoplay20 | Wed, 02/03/2016 - 03:57

Thank you for your reply!

Is this a way to somehow update this group during simulation?
My aim is to apply the force to a given type of particles which are inside the specified region.
How can I do this?

megoplay20 | Thu, 02/04/2016 - 12:21

I have implemented this behaviour by inserting necessary amount of particles first and then i have created a group as usual.
The problem with this approach that i have to know amount of particles beforehand which is not really convinient.
I hope there is some method to solve this problem in some other way.

Daniel Queteschiner | Thu, 02/04/2016 - 15:48

I don't think there is an easy way to build dynamic groups from atom types in an input script (LAMMPS has dynamic groups that may be able to do it but that feature has not been ported to LIGGGHTS).
IMHO, modifying the source code of the fix addforce command to filter for the atom type would be much easier in this case.