Advertisement

lammps案例:溶液剪切流动模拟代码分享

阅读量:

本文分享了使用LAMMPS对溶液剪切流动进行的数值模拟案例研究。通过设置上下壁面沿相反方向移动以产生剪切流动,并利用分组计算的速度分布方法对流体内的速度场进行了详细分析。模拟结果通过文件vel.profile.dat和vel.solid.dat保存,并提供了完整的LAMMPS源代码供参考(来自Simon Gravelle主页)。

改写说明

改写说明

改写说明

在这里插入图片描述

在本研究案例中包含两个核心的模拟代码体系。(1)壁面受力与速度设定步骤 首先将壁面原子在其x轴方向上的受力值设定为零值;随后通过velocity命令实现上下两壁面向相反方向运动从而构建起剪切流动场

复制代码
    fix mysf1 gwalltop setforce 0 NULL NULL
    fix mysf2 gwallbot setforce 0 NULL NULL
    velocity gwallbot set -20e-5 NULL NULL
    velocity gwalltop set 20e-5 NULL NULL

(2)速度分布

复制代码
    compute cc1 gliquid chunk/atom bin/1d z 0.0 1.0
    fix myac1 gliquid ave/chunk 10 15000 200000 cc1 vx file vel.profile.dat

具体的in文件代码为:

复制代码
    #author:Simon Gravelle
    #模型基本设置
    boundary p p p
    units real
    atom_style full
    bond_style harmonic
    angle_style harmonic
    pair_style lj/cut/tip4p/long 1 2 1 1 0.1546 12.0
    kspace_style pppm/tip4p 1.0e-4
    #读取data文件
    read_data system.data
    change_box all z final -40 40
    #读取势函数参数
    include PARM.lammps
    #分组设置
    group gH2O type 1 2
    group gNa type 3
    group gCl type 4
    group gliquid type 1 2 3 4
    group gwall type 5
    region rtop block INF INF INF INF 0 INF
    region rbot block INF INF INF INF INF 0
    group gtop region rtop
    group gbot region rbot
    group gwalltop intersect gwall gtop
    group gwallbot intersect gwall gbot
    #分组弛豫
    fix mynve all nve
    compute tliq gliquid temp/partial 0 1 1
    fix myber1 gliquid temp/berendsen 300 300 100
    fix_modify myber1 temp tliq
    compute twall gwall temp/partial 0 1 1
    fix myber2 gwall temp/berendsen 300 300 100
    fix_modify myber2 temp twall
    fix myshk gH2O shake 1.0e-4 200 0 b 1 a 1
    fix myrct all recenter NULL NULL INIT
    #设置上下壁面的受力
    fix mysf1 gwalltop setforce 0 NULL NULL
    fix mysf2 gwallbot setforce 0 NULL NULL
    #设置向下壁面沿x方向双向移动
    velocity gwallbot set -20e-5 NULL NULL
    velocity gwalltop set 20e-5 NULL NULL
    # 输出模拟结果
    dump mydmp all atom 5000 dump.lammpstrj
    thermo 500
    thermo_modify temp tliq
    #计算溶液的速度分布
    compute cc1 gliquid chunk/atom bin/1d z 0.0 1.0
    fix myac1 gliquid ave/chunk 10 15000 200000 cc1 vx file vel.profile.dat  
    #计算壁面的速度分布
    compute cc2 gwall chunk/atom bin/1d z 0.0 1.0
    fix myac2 gwall ave/chunk 10 15000 200000 cc2 vx file vel.solid.dat # tag:200ps
    #输出壁面的受力
    fix myat1 all ave/time 10 100 1000 f_mysf1[1] f_mysf2[1] file forces.dat
    #步长1fs
    timestep 1.0
    #启动运算
    run 200000

全部源代码可到Simon Gravelle主页下载

复制代码
    https://lammpstutorials.github.io/tutorials/03-NanoconfinedElectrolyte.html

公众号:lammps加油站

全部评论 (0)

还没有任何评论哟~