详细内容

LAMMPS讲解46-纳米流动in文件讲解

以下是in文件

####################### Global settings #######################

 

dimension    3

units       lj

boundary    p f p

atom_style     atomic

neighbor    0.3 bin

neigh_modify    delay 0 every 1 check yes

 

####################### Create geometry #####################

 

read_data    system.data

 

###################### Define liquid groups #################

 

group liquid type 1

group upwall type 2

group downwall type 3

group wall union upwall downwall

 

#################### Define wall three layers region and group ########

#利用region命令分别建立固定层,温控层和自由层的原子组

region up_fix block INF INF 39.6 INF INF INF units box

region down_fix block INF INF INF -10.8 INF INF units box

region up_thermo block INF INF 37.8 39.6 INF INF units box

region down_thermo block INF INF -10.8 -9.1 INF INF units box

group up_fix region up_fix

group down_fix region down_fix

group up_thermo region up_thermo

group down_thermo region down_thermo

group up_free subtract upwall up_fix up_thermo

group down_free subtract downwall down_fix down_thermo

 

group move subtract all up_fix down_fix

 

#################### Define LJ potentials ####################

 

#liquid=1 upwall=2 downwall=3

 

pair_style  lj/cut 2.5  

 

pair_coeff  1 1 1 1 2.5             #pair between liquid and liquid

pair_coeff  1 2 0.8 1 2.5            #pair between liquid and upwall

pair_coeff  1 3 0.8 1 2.5            #pair between liquid and downwall

pair_coeff  2 2 50 0.7342 2.5      #pair between upwall and downwall 0.521 2.5

pair_coeff  2 3 0 0 0                  #pair between upwall and downwall

pair_coeff  3 3 50 0.7342 2.5      #pair between downwall and downwall

 

#################### Min ####################

#通过setforce命令使得在能量最小化时固体的结构保持不变

fix 1 upwall setforce 0 0 0

fix 2 downwall setforce 0 0 0

minimize 1.0e-4 1.0e-6 100 1000

unfix 1

unfix 2

 

####################### Run settings ##################

 

compute       liquid_c_t move temp #系统默认的温度计算命令是计算所有原子的温度,我们期望的是监测流体的温度

#创建初始速度,通过修改种子数可以创建不同的初始速度,从而实现重复独立测量

velocity     move create 1.0 482748 dist gaussian rot yes temp liquid_c_t units box

timestep  0.002

thermo    100

thermo_style    custom step temp

thermo_modify temp liquid_c_t

dump myDump all atom 100 dump.lammpstrj

#对流体,温控层,自由层同时施加温度控制和系综使系统达到热力学平衡

fix       liquid_nvt liquid nvt temp 1.0 1.0 0.2

fix       upwall_nvt1 up_thermo nvt temp 1.0 1.0 0.2

fix       upwall_nvt2 up_free nvt temp 1.0 1.0 0.2

fix       downwall_nvt1 down_thermo nvt temp 1.0 1.0 0.2

fix       downwall_nvt2 down_free nvt temp 1.0 1.0 0.2  

#第一阶段run

run 1000000

 

unfix liquid_nvt

unfix upwall_nvt2

unfix downwall_nvt2

#取消自由层和流体上的温度控制,将其设置为nve系综

fix       liquid_nve liquid nve

fix       upwall_nve up_free nve

fix       downwall_nve down_free nve

 

fix add_F liquid addforce 0.1 0 0

#第二阶段run使流动达到定常

run    1000000

 

variable Ty atom (vz*vz)*mass

compute mype all pe/atom

 

compute cc2 all chunk/atom bin/1d y 0.0 0.2 units box

fix ave all ave/chunk 1 1000000 3000000 cc2 density/number vx v_Ty c_mype norm sample file v_T.profile

 #第三阶段run,统计平均输出想要的量

run 1000000

上面讲了怎么设置in文件来输出密度,速度和温度分布。这里面需要讲一下compute chunk/atomfix ave/chunk命令。compute chunk/atom可以把具有部分特征的原子归结为一个chunk,然后供后面带chunkcomputefix style进行计算。如本例中将模型在y方向上分为不同的层,将属于同一层的原子的速度和温度和密度进行时间平均。compute chunk/atom中的bin/1dbin/2dbin/3d可以将模拟盒子分解为一维,二维和三维网格,如下图:

image.png


bin/1d是用一个个薄片层将整个模拟盒子进行划分,bin/2d是用一个个细条将整个模拟盒子进行划分,bin/3d是用一个个小块将整个模拟盒子进行划分。每一个方向上在划分的时候都会设定起点和这个方向上间隔的大小。如上面的命令例子中y 0.0 0.2的意思就是在y方向上以0.0为起点0.2为间隔将模拟盒子进行划分。bin/2d设置方式的例子是x 0.0 0.2 y 0.0 0.2,类似 bin/2d设置方式的例子是x 0.0 0.2 y 0.0 0.2 z 0.0 0.2。起点和间隔大小都是自己定义的。LAMMPS在划分网格时有时会额外多出一两个bin以能完全盖住整个盒子。

fix ave all ave/chunk 1 1000000 3000000 cc2 density/number vx v_Ty c_mype norm sample file v_T.profile。当你需要统计某个分布的时候就可以采用这个的命令。这个命令平均的是per-atom量,globallocal量不能用这个命令进行时间平均计算。该命令中ave/chunk后面的三个数分别称为Nevery Nrepeat Nfreq。根据我的经验这个命令设置完后,紧接着就会run,假设runnum_run步,那么比较好的做法是num_run=Nevery*NrepeatNfreq=num_run+之前所有run的步数。Nfreq的含义是当时间步数是Nfreq的整数倍的时候这个命令就会执行平均,Nrepeat的含义是去多少步的数据进行平均,Nevery的含义是从这个命令执行平均的时间步往前数,每多少个步取一次数据,直到取了Nrepeat个步数的数据。

下面我们看看fix ave/chunk输出了什么?井号开头的都是注释。数字部分第一行是输出信息分别是在哪一个输出的结果,总共有多少个bin,所有bin中总共有多少个原子。接下来每一列别是bin的编号,bin的坐标,bin中平均有多少原子,取值1,取值2。。。这里的取值与fix ave/chunk中的设置一致(见下面的命令)。有了输出结果就可以后处理画图了。

compute cc2 all chunk/atom bin/1d y 0.0 0.2 units box

fix ave all ave/chunk 1 100000 210000 cc2 density/number vx v_Ty c_mype norm sample file v_T.profile

v_T.profile的内容

# Chunk-averaged data for fix ave and group vx

# Timestep Number-of-chunks Total-count

# Chunk Coord1 Ncount density/number vx v_Ty c_mype

210000 260 19202

  1 -11.5 0 0 0 0 0

  2 -11.3 0 0 0 0 0

  3 -11.1 0 0 0 0 0

  4 -10.9 350 7.54503 0 0 -275.14

  5 -10.7 0 0 0 0 0

  6 -10.5 0.00011 2.37129e-06 -6.29937e-05 5.4045e-05 -0.0420899

  7 -10.3 350 7.54502 1.12873e-05 1.02235 -392.174

  8 -10.1 0 0 0 0 0

  9 -9.9 268.517 5.78848 0.000169106 1.04341 -411.428

  10 -9.7 81.4828 1.75654 -0.000584359 1.04091 -411.533

  11 -9.5 0 0 0 0 0

  12 -9.3 350 7.54503 1.16908e-05 1.07065 -415.646

  13 -9.1 0 0 0 0 0

  14 -8.9 0 0 0 0 0

  。。。。。。

 

 

感谢鲍路瑶老师的分享,内容来自于鲍老师分享出来的资料

如有需要添加微信:lmp_zhushou  进入微信群,帮助他人,共建社区

获取完整版lammps讲义可以加微信lmp_zhushou或加入QQ群994359511


最新评论
请先登录才能进行回复登录
技术支持: CLOUD | 管理登录
seo seo