前言—液滴碰撞
不同速度、液滴大小以及环境中的液滴碰撞现象非常复杂,液滴会和环境之间存在对流现象,并且不同的表面张力和碰撞位置会产生不同的现象。 如何用一个代码循环,不同压力、不同速度下的液滴碰撞过程呢?
不
同
速
度
下
的
液
滴
碰
撞
现
象
:
\color{red}不同速度下的液滴碰撞现象:
不同速度下的液滴碰撞现象:
(
1
)
不
同
速
度
下
的
液
滴
碰
撞
现
象
:
(1) 不同速度下的液滴碰撞现象:
(1)不同速度下的液滴碰撞现象:
(
2
)
不
同
速
度
下
的
液
滴
碰
撞
现
象
:
(2) 不同速度下的液滴碰撞现象:
(2)不同速度下的液滴碰撞现象:
一、物理过程
液滴在氮气环境中,以一定速度进行碰撞。这里主要循环,速度以及氮气分子数。
###################
# initial setting #
###################
#---------------------------------------------------------------------------#
#---------------------------------------------------------------------------#
# loop make all_file
echo screen
print " ------------------------------------------------"
print " -----------------NOW making files---------------"
print " ------------------------------------------------"
label out_makefile
variable number_out loop 1
variable file_name_out index 500
shell mkdir ${file_name_out}
shell cp WN.in ${file_name_out}
shell cp N2.txt ${file_name_out}
shell cp WT_mW.sw ${file_name_out}
shell cd ${file_name_out}
# loop make in_file
label in_makefile
variable number_in loop 4
variable file_name_in index 10 15 20 25
shell mkdir ${file_name_in}
shell cp WN.in ${file_name_in}
shell cp N2.txt ${file_name_in}
shell cp WT_mW.sw ${file_name_in}
next number_in
next file_name_in
jump WN.in in_makefile
clear
# loop make in_file
shell cd ..
next number_out
next file_name_out
jump WN.in out_makefile
clear
print " ------------------------------------------"
print " ------------------Finish!-----------------"
print " ------------------------------------------"
二、液滴平衡以及分子模板模型构建
###################
# initial setting #
###################
#----------------------------------------------------------#
variable x equal 1000
variable y equal 300
variable z equal 300
#----------------------------------------------------------#
#----------------------------------------------------------#
echo screen
units metal
dimension 3
boundary p p p
atom_style full
bond_style harmonic
angle_style harmonic
###
#----------------------------------------------------------#
variable TS equal 0.0005 ### ${TS} timestep
variable Tdamp equal 100*${TS} ### ${Tdamp} Tdamp
variable T equal 300 ### ${T} initial temperature
##############
# create box #
##############
#----------------------------------------------------------#
region box block 0 $x 0 $y 0 $z units box
create_box 3 box
#----------------------------------------------------------#
#
#----------------------------------------------------------#
variable radius equal 30
variable radius_out equal 55
variable water_x1 equal 125
variable water_y1 equal $z*0.5
variable water_z1 equal $z*0.5
variable water_x2 equal 875
variable water_y2 equal $z*0.5
variable water_z2 equal $z*0.5
#----------------------------------------------------------#
region makewater1 sphere ${water_x1} &
${water_y1} &
${water_z1} &
${radius} &
side in units box
region makewater2 sphere ${water_x2} &
${water_y2} &
${water_z2} &
${radius} &
side in units box
#----------------------------------------------------------#
region N2 union 2 makewater1 makewater2 side out units box
#----------------------------------------------------------#
#molecule water1 N2.txt
#create_atoms 0 random 5000 12345 makewater1 mol water1 12345 units box
lattice fcc 6
create_atoms 1 region makewater1
create_atoms 2 region makewater2
#create_atoms 3 region N2
#molecule water2 N2.txt toff 1
#create_atoms 0 random 5000 12345 makewater2 mol water2 12345 units box
molecule N2 N2.txt toff 2
create_atoms 0 random ${loop_file_out_name} 12345 N2 mol N2 12345 units box
#----------------------------------------------------------#
###################
# group setting #
###################
#----------------------------------------------------------#
# setting mass
mass 1 18 #
mass 2 18 # h1
mass 3 28 # o2
#---------------------------------------------------------#
group water1 type 1
group water2 type 2
group N2 type 3
#----------------------------------------------------------#
#----------------------------------------------------------#
### pair - settings
velocity water1 create ${T} 12345 loop local #
velocity water2 create ${T} 12345 loop local #
velocity N2 create 500 12345 loop local #
minimize 1.0e-5 1.0e-7 1000 10000
write_data 1.data
#----------------------------------------------------------#
fix recenter1 water1 recenter INIT INIT INIT units box
fix recenter2 water2 recenter INIT INIT INIT units box
#----------------------------------------------------------#
compute water1 water1 temp
compute water2 water2 temp
compute N2 N2 temp
#----------------------------------------------------------#
#--------------------------------------------------------------#
pair_style hybrid sw lj/cut 13.0
pair_coeff * * sw WT_mW.sw WT WT NULL #WT-WT 3
###
# water epsilon = 0.26838 ev sigma = 2.3925 Am
#--------------------------------------------------------------#
### N2-N2
pair_coeff 3 3 lj/cut 0.14397 0.072
#
variable N_W_ev equal sqrt(0.14397*0.26838)
variable N_W_A equal 0.5*(2.3925+0.072)
pair_coeff 1 3 lj/cut ${N_W_ev} ${N_W_A}
pair_coeff 2 3 lj/cut ${N_W_ev} ${N_W_A}
#--------------------------------------------------------------#
neighbor 0.5 bin
neigh_modify every 5 delay 0 check no
#--------------------------------------------------------------#
fix water1 water1 nvt temp ${T} ${T} ${Tdamp}
fix water2 water2 nvt temp ${T} ${T} ${Tdamp}
variable T_N2 equal 500
fix N2 N2 nvt temp ${T_N2} ${T_N2} ${Tdamp}
compute pe all pe/atom
compute ke all ke/atom
#--------------------------------------------------------------#
###################
# run 1 #
###################
thermo 1000
thermo_style custom step temp press c_water1 c_water2 c_N2
dump 1 all custom 5000 dump.1 &
id type x y z vx vy vz
timestep ${TS}
variable 1ns equal 20/${TS}
run ${1ns}
#run 10
write_data after_run2_.data
unfix recenter1
unfix recenter2
unfix water1
unfix water2
三、在X方向上进行碰撞,温度控制需要剔除X方向
velocity water1 set ${loop_file_in_name} 0 0 sum yes units box
velocity water2 set -10 0 0 sum yes units box
compute newT1 water1 temp/partial 0 1 1
compute newT2 water2 temp/partial 0 1 1
fix water1 water1 nvt temp ${T} ${T} ${Tdamp}
fix water2 water2 nvt temp ${T} ${T} ${Tdamp}
fix N2 N2 nvt temp ${T_N2} ${T_N2} ${Tdamp}
fix_modify water1 temp newT1
fix_modify water2 temp newT2
dump 2 all custom 1000 dump.moving &
id type x y z vx vy vz c_pe c_ke
#----------------------------------------------------------#
###################
# run 2 #
###################
thermo 1000
thermo_style custom step temp press c_water1 c_water2 c_N2
timestep ${TS}
variable 1ns equal 20/${TS}
run ${1ns}
#run 10
#run 10
unfix water1
unfix water2
#----------------------------------------------------------#
四、NVE系综下,在X方向上进行碰撞过程
###################
# run 3 #
###################
fix water11 water1 nve
fix water22 water2 nve
dump 3 all custom 5000 final.collision &
id type x y z vx vy vz c_pe c_ke
thermo 1000
thermo_style custom step temp press c_water1 c_water2 c_N2
timestep ${TS}
variable 2ns equal 500/${TS}
run ${2ns}
#run 10
五、结束循环
#--------------------------------------------------------------#
shell cd ..
clear
next loop_file_in_name
jump WN.in calculation_in_infile
#---------------------------------------------------------------------------#
shell cd ..
clear
next loop_file_out_name
jump WN.in calculation_in_outfile
#---------------------------------------------------------------------------#
六、全部in代码
###################
# initial setting #
###################
#---------------------------------------------------------------------------#
#---------------------------------------------------------------------------#
# loop make all_file
echo screen
print " ------------------------------------------------"
print " -----------------NOW making files---------------"
print " ------------------------------------------------"
label out_makefile
variable number_out loop 1
variable file_name_out index 500
shell mkdir ${file_name_out}
shell cp WN.in ${file_name_out}
shell cp N2.txt ${file_name_out}
shell cp WT_mW.sw ${file_name_out}
shell cd ${file_name_out}
# loop make in_file
label in_makefile
variable number_in loop 4
variable file_name_in index 10 15 20 25
shell mkdir ${file_name_in}
shell cp WN.in ${file_name_in}
shell cp N2.txt ${file_name_in}
shell cp WT_mW.sw ${file_name_in}
next number_in
next file_name_in
jump WN.in in_makefile
clear
# loop make in_file
shell cd ..
next number_out
next file_name_out
jump WN.in out_makefile
clear
print " ------------------------------------------"
print " ------------------Finish!-----------------"
print " ------------------------------------------"
# loop make all_file
#---------------------------------------------------------------------------#
#---------------------------------------------------------------------------#
label calculation_in_outfile
variable loop_number_out loop 1
# water fraction
variable loop_file_out_name index 500
shell cd ${loop_file_out_name}
log ${loop_file_out_name}.log
#---------------------------------------------------------------------------#
label calculation_in_infile
variable loop_number_in loop 4
variable loop_file_in_name index 15 20 25 30
shell cd ${loop_file_in_name}
log ${loop_file_in_name}.log
#---------------------------------------------------------------------------#
###################
# initial setting #
###################
#----------------------------------------------------------#
variable x equal 1000
variable y equal 300
variable z equal 300
#----------------------------------------------------------#
#----------------------------------------------------------#
echo screen
units metal
dimension 3
boundary p p p
atom_style full
bond_style harmonic
angle_style harmonic
###
#----------------------------------------------------------#
variable TS equal 0.0005 ### ${TS} timestep
variable Tdamp equal 100*${TS} ### ${Tdamp} Tdamp
variable T equal 300 ### ${T} initial temperature
##############
# create box #
##############
#----------------------------------------------------------#
region box block 0 $x 0 $y 0 $z units box
create_box 3 box
#----------------------------------------------------------#
#
#----------------------------------------------------------#
variable radius equal 30
variable radius_out equal 55
variable water_x1 equal 125
variable water_y1 equal $z*0.5
variable water_z1 equal $z*0.5
variable water_x2 equal 875
variable water_y2 equal $z*0.5
variable water_z2 equal $z*0.5
#----------------------------------------------------------#
region makewater1 sphere ${water_x1} &
${water_y1} &
${water_z1} &
${radius} &
side in units box
region makewater2 sphere ${water_x2} &
${water_y2} &
${water_z2} &
${radius} &
side in units box
#----------------------------------------------------------#
region N2 union 2 makewater1 makewater2 side out units box
#----------------------------------------------------------#
#molecule water1 N2.txt
#create_atoms 0 random 5000 12345 makewater1 mol water1 12345 units box
lattice fcc 6
create_atoms 1 region makewater1
create_atoms 2 region makewater2
#create_atoms 3 region N2
#molecule water2 N2.txt toff 1
#create_atoms 0 random 5000 12345 makewater2 mol water2 12345 units box
molecule N2 N2.txt toff 2
create_atoms 0 random ${loop_file_out_name} 12345 N2 mol N2 12345 units box
#----------------------------------------------------------#
###################
# group setting #
###################
#----------------------------------------------------------#
# setting mass
mass 1 18 #
mass 2 18 # h1
mass 3 28 # o2
#---------------------------------------------------------#
group water1 type 1
group water2 type 2
group N2 type 3
#----------------------------------------------------------#
#----------------------------------------------------------#
### pair - settings
velocity water1 create ${T} 12345 loop local #
velocity water2 create ${T} 12345 loop local #
velocity N2 create 500 12345 loop local #
minimize 1.0e-5 1.0e-7 1000 10000
write_data 1.data
#----------------------------------------------------------#
fix recenter1 water1 recenter INIT INIT INIT units box
fix recenter2 water2 recenter INIT INIT INIT units box
#----------------------------------------------------------#
compute water1 water1 temp
compute water2 water2 temp
compute N2 N2 temp
#----------------------------------------------------------#
#--------------------------------------------------------------#
pair_style hybrid sw lj/cut 13.0
pair_coeff * * sw WT_mW.sw WT WT NULL #WT-WT 3
###
#--------------------------------------------------------------#
### N2-N2
pair_coeff 3 3 lj/cut 0.14397 0.072
#
variable N_W_ev equal sqrt(0.14397*0.26838)
variable N_W_A equal 0.5*(2.3925+0.072)
pair_coeff 1 3 lj/cut ${N_W_ev} ${N_W_A}
pair_coeff 2 3 lj/cut ${N_W_ev} ${N_W_A}
#--------------------------------------------------------------#
neighbor 0.5 bin
neigh_modify every 5 delay 0 check no
#--------------------------------------------------------------#
fix water1 water1 nvt temp ${T} ${T} ${Tdamp}
fix water2 water2 nvt temp ${T} ${T} ${Tdamp}
variable T_N2 equal 500
fix N2 N2 nvt temp ${T_N2} ${T_N2} ${Tdamp}
compute pe all pe/atom
compute ke all ke/atom
#--------------------------------------------------------------#
###################
# run 1 #
###################
thermo 1000
thermo_style custom step temp press c_water1 c_water2 c_N2
dump 1 all custom 5000 dump.1 &
id type x y z vx vy vz
timestep ${TS}
variable 1ns equal 20/${TS}
run ${1ns}
#run 10
write_data after_run2_.data
unfix recenter1
unfix recenter2
unfix water1
unfix water2
#--------------------------------------------------------------#
# water collision
# 1A = 1e-12 m
# 1ps = 1e-12 s
#
# time = 0.0005 ps all time = 0.0005*run*v = length
#--------------------------------------------------------------#
velocity water1 set ${loop_file_in_name} 0 0 sum yes units box
velocity water2 set -10 0 0 sum yes units box
compute newT1 water1 temp/partial 0 1 1
compute newT2 water2 temp/partial 0 1 1
fix water1 water1 nvt temp ${T} ${T} ${Tdamp}
fix water2 water2 nvt temp ${T} ${T} ${Tdamp}
fix N2 N2 nvt temp ${T_N2} ${T_N2} ${Tdamp}
fix_modify water1 temp newT1
fix_modify water2 temp newT2
dump 2 all custom 1000 dump.moving &
id type x y z vx vy vz c_pe c_ke
#----------------------------------------------------------#
###################
# run 2 #
###################
thermo 1000
thermo_style custom step temp press c_water1 c_water2 c_N2
timestep ${TS}
variable 1ns equal 20/${TS}
run ${1ns}
#run 10
#run 10
unfix water1
unfix water2
#----------------------------------------------------------#
###################
# run 3 #
###################
fix water11 water1 nve
fix water22 water2 nve
dump 3 all custom 5000 final.collision &
id type x y z vx vy vz c_pe c_ke
thermo 1000
thermo_style custom step temp press c_water1 c_water2 c_N2
timestep ${TS}
variable 2ns equal 500/${TS}
run ${2ns}
#run 10
#--------------------------------------------------------------#
shell cd ..
clear
next loop_file_in_name
jump WN.in calculation_in_infile
#---------------------------------------------------------------------------#
shell cd ..
clear
next loop_file_out_name
jump WN.in calculation_in_outfile
#---------------------------------------------------------------------------#
|