print mass within a region

Submitted by Rahul Kumar on Mon, 04/01/2019 - 08:45

Hello
I am trying to print mass of the particle in a particular region but I am unable to get. Please guide me

------------------------------------------------------------------Main Program ------------------------------------------------------------------------
#===================================================================================================
# Program
#===================================================================================================
atom_style granular
atom_modify map array
boundary f f f
newton off

communicate single vel yes

units si

region domain block -0.5 0.5 0.0 1.6 0.0 1.0 units box
region del_region block -0.5 0.5 0 0.5 0.0 1.0 units box side out #region to delete particles outside
region trace_region block -0.5 0.5 0 0.5 0 1.0 units box #region to trace particles in the region
create_box 2 domain
neighbor 0.001 bin
neigh_modify delay 0

# defining timestep and gravity
timestep 0.0001
fix gravi all gravity 9.81 vector 0.0 -1.0 0.0

#distributions for insertion
fix pts1 all particletemplate/multisphere 15485863 atom_type 1 density constant 2280 nspheres 4 ntry 1000000 spheres file data/particle1.multisphere scale 0.015 type 1
fix pts2 all particletemplate/multisphere 15485867 atom_type 1 density constant 2280 nspheres 4 ntry 1000000 spheres file data/particle2.multisphere scale 0.015 type 2
fix pts3 all particletemplate/multisphere 32452843 atom_type 1 density constant 2280 nspheres 3 ntry 1000000 spheres file data/particle3.multisphere scale 0.015 type 3
fix pts4 all particletemplate/multisphere 32452867 atom_type 1 density constant 2280 nspheres 2 ntry 1000000 spheres file data/particle4.multisphere scale 0.015 type 4
fix pts5 all particletemplate/multisphere 49979687 atom_type 1 density constant 2280 nspheres 3 ntry 1000000 spheres file data/particle5.multisphere scale 0.015 type 5
fix pts6 all particletemplate/multisphere 49979693 atom_type 1 density constant 2280 nspheres 3 ntry 1000000 spheres file data/particle6.multisphere scale 0.015 type 6
fix pts7 all particletemplate/multisphere 67867967 atom_type 1 density constant 2280 nspheres 3 ntry 1000000 spheres file data/particle7.multisphere scale 0.015 type 7
fix pts8 all particletemplate/multisphere 67867979 atom_type 1 density constant 2280 nspheres 3 ntry 1000000 spheres file data/particle8.multisphere scale 0.015 type 8

fix pdd1 all particledistribution/discrete 86028121 8 pts1 0.078 pts2 0.078 pts3 0.078 pts4 0.1532 pts5 0.1532 pts6 0.1532 pts7 0.1532 pts8 0.1532

#Defining geometry
fix cad all mesh/surface/stress file meshes/bulk_box.stl type 2 scale 0.001 curvature 1e-5
fix factory1 all mesh/surface file meshes/bulk_factory.stl type 1 scale 0.001 curvature 1e-5
fix factory2 all mesh/surface file meshes/bulk_factory2.stl type 1 scale 0.001 curvature 1e-5
fix factory3 all mesh/surface file meshes/bulk_factory3.stl type 1 scale 0.001 curvature 1e-5
fix granwalls all wall/gran model hertz tangential history mesh n_meshes 1 meshes cad

#Material properties required for new pair styles

fix m1 all property/global youngsModulus peratomtype 40e6 206e6
fix m2 all property/global poissonsRatio peratomtype 0.25 0.28
fix m3 all property/global coefficientRestitution peratomtypepair 2 0.2 0.2 0.2 0.2
fix m4 all property/global coefficientFriction peratomtypepair 2 0.81 0.36 0.36 0.81
fix m5 all property/global coefficientRollingFriction peratomtypepair 2 0.081 0.036 0.036 0.081
fix m6 all property/global cohesionEnergyDensity peratomtypepair 2 20 15 15 20
fix m7 all property/global k_finnie peratomtypepair 2 1.0 1.0 1.0 1.0

#Defining contact model
pair_style gran model hertz tangential history cohesion sjkr rolling_friction cdt #Hertzian with cohesion and rolling friction model
pair_coeff * *

#region and insertion
group trace_group region trace_region

#particle insertion
fix ins1 all insert/stream seed 86028157 distributiontemplate pdd1 &
nparticles INF particlerate 50 insert_every 2000 overlapcheck yes all_in no vel constant 0.0 -2.0 0.0 &
insertion_face factory1
fix ins2 all insert/stream seed 86028157 distributiontemplate pdd1 &
nparticles INF particlerate 50 insert_every 2000 overlapcheck yes all_in no vel constant 0.0 -2.0 0.0 &
insertion_face factory2
fix ins3 all insert/stream seed 86028157 distributiontemplate pdd1 &
nparticles INF particlerate 50 insert_every 2000 overlapcheck yes all_in no vel constant 0.0 -2.0 0.0 &
insertion_face factory3

#apply nve integration to all particles that are inserted as single particles
fix integr all multisphere allow_group_and_set yes
fix tr trace_group property/atom/tracer region_mark trace_region mark_step 100 marker_style dirac check_mark_every 10

#output settings, include total thermal energy
compute 1 all erotate/multisphere
compute 2 trace_group nparticles/tracer/region region_count trace_region tracer tr reset_marker yes
thermo_style custom step time atoms ke c_1 vol c_2[3] c_2[4]
thermo 1000
thermo_modify lost ignore norm no

# Defining variables
variable t equal time
variable ma equal mass(trace_group,trace_region)
variable ma2 equal c_2[3]

#insert the first particles so that dump is not empty
run 1
dump dmp all custom/vtk 1000 post/bulk_*.vtk id type type x y z ix iy iz vx vy vz fx fy fz omegax omegay omegaz radius
dump dumpstress all mesh/gran/VTK 1000 post/mesh_*.vtk stress cad

fix p_mass all print 1000 "${t},${ma},${ma2}" file graph/mass_region.dat screen no

#insert particles
run 60000 upto
delete_atoms region del_region
unfix ins3
unfix ins2
unfix ins1
run 70000 upto
---------------------------------------------------------------------------------------------------------------------------------------------------------