IT数码 购物 网址 头条 软件 日历 阅读 图书馆
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
图片批量下载器
↓批量下载图片,美女图库↓
图片自动播放器
↓图片自动播放器↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁
 
   -> 游戏开发 -> 不同速度、不同压力环境中的液滴对撞—一个代码循环速度和压力(氮气分子数) -> 正文阅读

[游戏开发]不同速度、不同压力环境中的液滴对撞—一个代码循环速度和压力(氮气分子数)

前言—液滴碰撞

不同速度、液滴大小以及环境中的液滴碰撞现象非常复杂,液滴会和环境之间存在对流现象,并且不同的表面张力和碰撞位置会产生不同的现象。
如何用一个代码循环,不同压力、不同速度下的液滴碰撞过程呢?


请添加图片描述
不 同 速 度 下 的 液 滴 碰 撞 现 象 : \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
#---------------------------------------------------------------------------#


  游戏开发 最新文章
6、英飞凌-AURIX-TC3XX: PWM实验之使用 GT
泛型自动装箱
CubeMax添加Rtthread操作系统 组件STM32F10
python多线程编程:如何优雅地关闭线程
数据类型隐式转换导致的阻塞
WebAPi实现多文件上传,并附带参数
from origin ‘null‘ has been blocked by
UE4 蓝图调用C++函数(附带项目工程)
Unity学习笔记(一)结构体的简单理解与应用
【Memory As a Programming Concept in C a
上一篇文章      下一篇文章      查看所有文章
加:2022-02-03 01:27:13  更:2022-02-03 01:27:47 
 
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁

360图书馆 购物 三丰科技 阅读网 日历 万年历 2024年11日历 -2024/11/27 18:28:25-

图片自动播放器
↓图片自动播放器↓
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
图片批量下载器
↓批量下载图片,美女图库↓
  网站联系: qq:121756557 email:121756557@qq.com  IT数码