atom_style 	granular
boundary 	p f p 
atom_modify 	map array
newton 		off
communicate single vel yes
units 		si
processors 	2 3 1

variable dt equal 1e-6

# Definition of simulation box 
region 		reg block 0 0.5 -0.01 0.1 0 0.1 units box 
region 		particle_reg block 0.05 0.11 -0.01 0 0.02 0.08 units box 
create_box 	2 reg
neighbor 	0.001 bin
neigh_modify 	delay 0

# Definition of contact models
pair_style gran model hertz tangential history
pair_coeff * *

timestep ${dt}

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

# Definition of material properties
fix 	m1 all property/global youngsModulus peratomtype 5e6 5e6  
fix 	m2 all property/global poissonsRatio peratomtype 0.3 0.3
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 coefficientRollingFriction peratomtypepair 2 0.1 0.1 0.1 0.1

# Generation and loading of the geometry.stl 
fix 	tbc all mesh/surface file top_bottom_cylinder.stl type 1 scale 0.001 curvature 1e-5 curvature_tolerant yes
fix	ins_mesh all mesh/surface/planar file insert_face.stl type 1 scale 0.001 curvature 1e-5 curvature_tolerant yes
fix	mixer all mesh/surface file mixer_face.stl type 1  scale 0.001 curvature 1e-5 curvature_tolerant yes

fix 	walls all wall/gran model hertz tangential history mesh n_meshes 2 meshes tbc mixer

# Generation and insertion of the particles 
fix 	pts1 all particletemplate/sphere 10487 atom_type 1 density constant 1300 radius constant 0.0001 volume_limit 1e-15 	# 颗粒半径0.1mm
fix 	pdd1 all particledistribution/discrete 32452867 1 pts1 1.0
										
# insert	
variable inserttime		equal	0.0001				# 插入颗粒时间0.001s 
variable insertmass		equal	0.00075				# 共插入颗粒的重量
variable insertmassrate		equal	${insertmass}/${inserttime}	# kg/s
variable insertsteps 		equal	${inserttime}/${dt}		# 共100步

# settle
variable	settletime	equal	0.05 				# 沉降时间 2s
variable	settlesteps	equal	${settletime}/${dt}		# 共2w步


fix 	ins all insert/stream seed 86028157 distributiontemplate pdd1 &					
        mass 0.00075 massrate ${insertmassrate} overlapcheck yes all_in yes vel constant 0.0 -0.01 0.0 &
        insertion_face ins_mesh extrude_length 0.01			# 使用${insertmassrate}代表着一次性插入所有颗粒
       
# Dumping of the data for post-processing to visualize 

shell mkdir post

dump 	dmpparticle all custom/vtk 500 post/particles_*.vtk id type type x y z vx vy vz fx fy fz mass radius
dump 	dmptbc all mesh/stl 100000 post/tbc*.stl tbc
dump	dmpmixer_face all mesh/stl 500 post/mixer_mesh*.stl mixer


# Run the simulation filling
run 	${insertsteps}		# 1000步
unfix	ins

run	${settlesteps}		# 5W步


variable	mixer_period	equal	0.01		# 每 0.05 s旋转一圈
fix		rot_mixer all move/mesh mesh mixer rotate origin 0.08 0.0 0.05 axis 0 1 0 period ${mixer_period}

run	50000



