文章目录
-
-
- [1.1 摩擦模拟基本流程](#1.1 摩擦模拟基本流程)
- [1.2 模拟摩擦石墨烯掺杂的高熵合金](#1.2 模拟摩擦石墨烯掺杂的高熵合金)
- [1.3 圆锥形SiC纳米磨削单晶硅模拟](#1.3 圆锥形SiC纳米磨削单晶硅模拟)
- [2.1 纳米压痕模拟基本流程](#2.1 纳米压痕模拟基本流程)
- [2.2 高熵合金纳米压痕模拟](#2.2 高熵合金纳米压痕模拟)
-
1.1 摩擦模拟基本流程
-
模型建立:
pythonlattice fcc 3.56 region box block 0 20 0 30 0 35 #建立box区域 create_box 2 box #box区域两种原子 region piece block 0 20 0 30 0 20 #建立piece区域 create_atoms 1 region piece #piece区域生成类型1原子 lattice diamond 3.52 #金刚石 region ball sphere 35 17 97 15 units box #使用盒子单位,以(35,17,97)为圆心,15为半径 create_atoms 2 region ball #ball区域生成类型2原子 -
模型分层:
pythonregion boundary1 block 0 20 0 60 0 150 units box #边界层 region boundary2 block 20 250 0 60 0 20 units box region boundary union 2 boundary1 boundary2 #将boundary1和boundary2区域合并为boundary region temp_layer1 block 20 40 0 60 20 150 units box #恒温层 region temp_layer2 block 40 250 0 60 20 40 units box region temp_layer union 2 temp_layer1 temp_layer2 #将temp_layer1和temp_layer2区域合并为temp_layer region newton_layer block 40 250 0 60 40 150 units box #牛顿层 region piece union 3 boundary temp_layer newton_layer #将boundary、temp_layer和newton_layer区域合并为piece -
设置球为刚体:
pythonfix myrigid tool rigid/nve single force 1 on on on torque 1 off off off #fix ID设为myrigid ,tool区域原子,rigid/nve刚体nve系综,single整个原子组视为一个刚体,force外力使平移,torque扭矩使旋转,on/off 开/关 velocity tool zero angular #tool区域原子角动量为零 velocity tool zero linear #tool区域原子线动量为零 #或者 fix 10 ball nve/noforce #对ball区域原子进行积分,但是不计算力 -
摩擦过程: 1.弛豫 2.压头下压到工件表面 3.压头压入工件 4.压头沿着摩擦方向运动
-
快速下压:
- 方法一
pythonvariable toollo equal bound(tool,zmin) #球下表面坐标,bound()边界函数 variable piecehi equal bound(piece,zmax) #工件上表面坐标 variable tool_to equal ${piecehi}+1 #+1防止原子重叠 variable tool_dis1 equal ${tool_to}-${toollo} #得出球与工件之间距离 displace_atoms tool move 0 0 v_tool_dis1 units box #tool原子区域,向z方向移动,使用盒子单位- 方法二
pythondump 1 all atom 100 movedown1.xyz #每100步将所有原子相关信息保存为文件 velocity ball set 0 0 -2 units box #设置ball区域速度(z方向),使用盒子单位 fix 1 ball nve/noforce #设置球为刚体 fix 2 piece nvt temp 300 300 0.1 #piece为nvt系综 run 5000 -
球压入工件:
pythondump 1 all atom 100 movedown2.xyz #每100步将所有原子相关信息保存为文件 velocity ball set 0 0 -1 units box #设置ball区域速度(z方向),低速,使用盒子单位 fix 1 ball nve/noforce #设置球为刚体 fix 2 piece nvt temp 300 300 0.1 #piece为nvt系综 run 9000 -
摩擦过程:
pythondump 1 all atom 1000 frc.xyz #每1000步将所有原子相关信息保存为文件 velocity ball set 0 1 0 units box #设置ball区域速度(y方向),使用盒子单位 fix 1 ball nve/noforce #设置球为刚体 fix 2 piece nvt temp 300 300 0.1 #piece为nvt系综 run 70000 -
摩擦力的计算:
- 方法一
pythoncompute fx0 tool reduce sum fx #fx原子在x方向受力,计算tool区域x方向受力和,保存fx0 compute fy0 tool reduce sum fy compute fz0 tool reduce sum fz variable fxx equal c_fx0 #将计算值储存为变量 variable fyy equal c_fy0 variable fzz equal c_fz0 fix def3 all print 100 "${fxx} ${fyy} ${fzz}" file friction.dat screen no #输出保存到文件中,不输出屏幕- 方法二
pythoncompute friction_force tool group/group piece #group/group计算组与组之间力,保存friction_force fix 1 tool ave/time 50 10 500 v_disx c_ friction_force[1] & c_ friction_force[2] c_ friction_force[3] file force_all.txt #每隔500步对摩擦位移,xyz方向力的平均保存为文件,每50步使用平均值,计算10次
1.2 模拟摩擦石墨烯掺杂的高熵合金
python
#系统基本参数设置
units metal #metal单位制
dimension 3 #维度
boundary p p s #边界条件,xy周期性,z非周期性且收缩
atom_style atomic #原子类型
neighbor 0.2 bin #邻居列表
timestep 0.001 #时间步长
#模型构建
lattice fcc 3.6149 #Cu原子
region box block 0 20 0 30 0 35 #定义box区域
create_box 7 box #设置box区域有7种原子
region bottom block 0 20 0 30 0 20 #定义底部合金区域
create_atoms 1 region bottom #合金区域生成类型1原子
set type 1 type/ratio 2 0.2 87393 #高熵合金,原子类型转换
set type 1 type/ratio 3 0.5 87393
set type 1 type/ratio 4 0.5 87393
set type 3 type/ratio 5 0.5 87393
lattice diamond 3.5668 #金刚石
region ball sphere 35 17 97 15 units box #定义球区域,使用盒子单位,圆心(35,17,97),半径15
create_atoms 7 region ball #球区域生成类型7原子
lattice custom 2.4768 a1 1.0 0.0 0.0 a2 0.0 1.732 0.0 a3 0.0 0.0 1.3727 &
basis 0.0 0.33333 0.0 &
basis 0.0 0.66667 0.0 &
basis 0.5 0.16667 0.0 &
basis 0.5 0.83333 0.0 #自定义石墨烯晶格
region del block 15 55 15 90 32 37 units box #定义待删除区域
delete_atoms region del compress yes #删除后对原子重新编号
region graphene block 17 53 17 87 32 37 units box #定义石墨烯区域
create_atoms 6 region graphene #石墨烯区域生成类型6原子
#设置原子质量
mass 1 55.845 #Fe
mass 2 58.6934 #Ni
mass 3 51.9961 #Cr
mass 4 58.933194 #Co
mass 5 63.546 #Cu
mass 6 12.011 #C 石墨烯
mass 7 12.011 #C 金刚石
write_data all.data #保存模型
#划分区域和原子组
region boundary block INF INF INF INF INF 2 #定义底部边界区域
region piece block INF INF INF INF 2 21 #定义工件区域
group ball region ball #定义原子组
group boundary region boundary
group piece region piece
#设置原子之间相互作用势
pair_style hybrid eam/alloy airebo 3.0 lj/cut 10 #混合势
pair_coeff * * eam/alloy FeNiCrCoCu-heafixed.setfl Fe Ni Cr Co Cu NULL NULL #高熵合金
pair_coeff * * airebo CH.airebo NULL NULL NULL NULL NULL C C #石墨烯、金刚石
pair_coeff 1 7 lj/cut 0.04895 2.99 #C与高熵合金
pair_coeff 2 7 lj/cut 0.04864 2.964
pair_coeff 3 7 lj/cut 0.05537 2.964
pair_coeff 4 7 lj/cut 0.00166 3.326
pair_coeff 5 7 lj/cut 0.04317 3.0
pair_coeff 6 7 lj/cut 0.00455 3.851
pair_coeff 1 6 lj/cut 0.04895 2.99
pair_coeff 2 6 lj/cut 0.04864 2.964
pair_coeff 3 6 lj/cut 0.05537 2.964
pair_coeff 4 6 lj/cut 0.00166 3.326
pair_coeff 5 6 lj/cut 0.04317 3.0
#计算相关信息,固定底部边界原子
compute 1 piece temp #计算piece组温度
fix b boundary setforce 0 0 0 #设置底部边界受力0
#设置输出信息
thermo 100 #每100步输出
thermo_style custom step temp ke pe lx ly lz #自定义输出
thermo_modify temp 1 #输出计算1的值
#能量最小化
dump 1 all atom 50 mini.xyz #每50步将原子相关信息保存为文件
min_style cg #以cg法进行能量最小化
minimize 1e-15 1e-15 5000 5000 #能量容差,力容差,最大迭代次数,最大评估次数
undump 1 #取消
reset_timestep 0 #设置当前步为第0步
#温度初始化
velocity piece create 300 88989 #工件初始温度300K
#npt弛豫
dump 1 all custom 1000 npt.xyz id type x y z #每1000步保存原子信息
fix 1 piece npt temp 300 300 0.1 x 0 0 1 y 0 0 1 #恒温,xy方向恒压
run 10000
undump 1 #取消
unfix 1
reset_timestep 0 #重新设置当前步
#压头快速移动到工件表面
dump 1 all custom 100 movedown1.xyz id type x y z #每100步保存原子信息
velocity ball set 0 0 -2 units box #设置球的速度 z方向
fix 1 ball nve/noforce #球nve系综,但是不对力积分
fix 2 piece nvt temp 300 300 0.1 #工件nvt系综
run 5000
undump 1 #取消
unfix 1
unfix 2
reset_timestep 0 #设置当前步为第0步
#压头下压
dump 1 all custom 100 movedown2.xyz id type x y z #每100步保存原子信息
velocity ball set 0 0 -1 units box #设置球的速度 z方向
fix 1 ball nve/noforce #球nve系综,但是不对力积分
fix 2 piece nvt temp 300 300 0.1 #工件nvt系综
run 9000
undump 1 #取消
unfix 1
unfix 2
reset_timestep 0 #设置当前步为第0步
#进行摩擦
compute fx0 ball reduce sum fx #fx为原子在x方向受力,计算ball区域x方向受力和,保存fx0
compute fy0 ball reduce sum fy
compute fz0 ball reduce sum fz
variable fxx equal c_fx0 #将计算值储存为变量
variable fyy equal c_fy0
variable fzz equal c_fz0
fix def3 all print 100 "${fxx} ${fyy} ${fzz}" file friction.dat screen no #每100步保存xyz方向受力,不输出屏幕
dump 1 all custom 1000 frc.xyz id type x y z #每1000步保存原子相关信息
velocity ball set 0 1 0 units box #设置球速度,y方向
fix 1 ball nve/noforce #球nve系综,但是不对力积分
fix 2 piece nvt temp 300 300 0.1 #工件nvt系综
run 70000
1.3 圆锥形SiC纳米磨削单晶硅模拟
python
#建立初始条件
units metal #单位
dimension 3 #维度
boundary s p s #s为非周期性,收缩边界
atom_style atomic #原子类型
neighbor 0.3 bin #邻居列表
neigh_modify delay 5
timestep 0.001 #时间步长
#建立工作区域
region boundary1 block 0 20 0 60 0 150 units box #建立边界区
region boundary2 block 20 250 0 60 0 20 units box
region boundary union 2 boundary1 boundary2 #union区域并集
region temp_layer1 block 20 40 0 60 20 150 units box #建立恒温区
region temp_layer2 block 40 250 0 60 20 40 units box
region temp_layer union 2 temp_layer1 temp_layer2
region newton_layer block 40 250 0 60 40 150 units box #建立牛顿区
region piece union 3 boundary temp_layer newton_layer #建立工件区
#磨粒区域
region tool cone z 300 30 15 75 130 210 units box
#cone锥形,z轴,轴心坐标(300,30),底半径15,顶半径75,z轴边界130-210
region box union 2 piece tool #建立box区域
create_box 5 box #设置box区域5种原子
#生成单晶硅工件
lattice diamond 5.4309 #Si晶格,diamond金刚石型
create_atoms 1 region boundary
create_atoms 2 region temp_layer
create_atoms 3 region newton_layer #在工件不同区域生成不同原子
#生成磨粒原子SiC
lattice custom 4.37956 a1 1.0 0 0 a2 0 1.0 0 a3 0 0 1.0 &
basis 0.25 0.25 0.75 &
basis 0.25 0.75 0.25 &
basis 0.75 0.25 0.25 &
basis 0.75 0.75 0.75 &
basis 0.0 0.0 0.0 &
basis 0.0 0.5 0.5 &
basis 0.5 0.0 0.5 &
basis 0.5 0.5 0.0 #自定义晶格
create_atoms 2 region tool &
basis 1 4 &
basis 2 4 &
basis 3 4 &
basis 4 4 &
basis 5 5 &
basis 6 5 &
basis 7 5 &
basis 8 5 #tool区域自定义生成2种原子
#设置原子质量
mass 1 28.085 #Si
mass 2 28.085
mass 3 28.085
mass 4 28.085
mass 5 12.011 #C
#原子分组
group boundary region boundary #边界区原子组
group temp_layer region temp_layer #恒温区原子组
group newton_layer region newton_layer #牛顿区原子组
group tool region tool #磨粒区原子组
group mobile union temp_layer newton_layer #流动区原子组
write_data SiC_Si.data #保存模型
#力场设置
pair_style tersoff #tersoff势
pair_coeff * * SiC.tersoff Si Si Si Si C
#固定边界层
fix 01 boundary setforce 0 0 0 #设置边界层受力为零
#能量最小化
dump 1 all atom 50 mini.xyz #每50步保存原子相关信息
thermo 100 #每100步输出
min_style cg #以cg法进行能量最小化
minimize 1e-15 1e-15 5000 5000 #能量容差、力容差、最大迭代次数、最大评估次数
undump 1 #取消
reset_timestep 0 #设置当前步为第0步
#恒温区弛豫
velocity temp_layer create 300 8877423 #恒温区初始化温度300K
fix 1 temp_layer nvt temp 300 300 0.1 #恒温区nvt系综,恒温
thermo 100 #每100步输出
thermo_style custom step temp etotal ke pe press pxx pyy pzz #自定义输出
dump 1 all atom 3000 nvt1.xyz #每3000步保存原子相关信息
run 30000
undump 1 #取消
unfix 1
reset_timestep 0 #设置当前步为第0步
#工件弛豫
fix 1 newton_layer nvt temp 0.1 0.1 0.1 #牛顿区nvt系综,恒温0.1K
thermo 100 #每100步输出
thermo_style custom step temp etotal ke pe press pxx pyy pzz #自定义输出
dump 1 all atom 3000 nvt2.xyz #每3000步保存原子相关信息
run 30000
undump 1 #取消
unfix 1
reset_timestep 0 #设置当前步为第0步
#开始磨削
velocity tool set -1.0 0.0 0.0 sum yes units box #设置tool区初始速度,sum yes将新速度添加到现速度
compute new_temp temp_layer temp/com #恒温区,计算减去质心速度的温度
thermo 100 #每100步输出
thermo_style custom step temp etotal ke pe press pxx pyy pzz #自定义输出
dump 1 all custom 1000 cut.xyz id type x y z vx vy vz fx fy fz
#每1000步保存文件,自定义类型,vx原子x方向速度,fx原子x方向受力
#设置工件为刚体
fix 1 tool nve/noforce #nve/noforce不受力的nve系综,更新位置,不更新速度
#设置牛顿区为nve系综
fix 2 newton_layer nve
#对恒温区使用温度标定法进行控温
fix 3 temp_layer nve
fix 4 temp_layer temp/rescale 10 300.0 300.0 10.0 1.0
#每10步进行重新缩放,初始温度300K,结束温度300K,窗口值10,超过窗口值进行重新缩放,1.0直接重置为所需值
fix_modify 4 temp new_temp #将fix为4的temp修改为new_temp计算值
#设置边界区为刚体
fix 5 boundary nve/noforce
run 200000
2.1 纳米压痕模拟基本流程
-
纳米压痕原理:
- 传统硬度测试:压头压入试样,根据卸载后的压痕半径或对角线长度计算压痕面积
- 纳米压痕技术:深度敏感压痕技术,在纳米尺度上测量材料的力学性质,如载荷-位移曲线、弹性模量、硬度、断裂韧性、应变硬化效应、粘弹性或蠕变行为等
-
纳米压痕建模: 只建底部被压材料模型
-
虚拟球参数设置: 虚拟球与工件原子间力的计算公式
F ( r ) = − K ( r − R ) 2 F\left(r\right)=-K\left(r-R\right)^{2} F(r)=−K(r−R)2
K K K:系数, r r r:虚拟球内原子到球心的距离, R R R:虚拟球半径 -
压痕过程:
pythonvariable k1 equal 10.0 #k1为压头表面力常数K variable z1 equal vdisplace(70,-1) #vdisplace()位置更新函数,初始位置,速度 fix 1 all indent ${k1} sphere 0 0 v_z1 15 units box #indent缩进,虚拟球圆心(0,0,z1),半径15 -
卸载过程:
pythonvariable z2 equal vdisplace(60,1) #vdisplace()位置更新函数,初始位置,速度 fix 2 all indent ${k1} sphere 0 0 v_z2 15 units box #indent缩进,虚拟球圆心(0,0,z2),半径15 -
计算加载力:
pythonvariable fz equal f_1[3]*1.602 #ID为1的fix过程中z方向的力,*1.602转换单位nN variable depth equal 70-v_z1 #压入深度 fix 3 all print 100 "${depth} ${fz]" file force.txt screen no #每100步保存压入深度和加载力,不输出屏幕
2.2 高熵合金纳米压痕模拟
python
#初始模型参数设置
units metal #单位
dimension 3 #维度
boundary p p s #边界条件,xy方向周期性,z方向非周期性且收缩
atom_style atomic #原子类型
neighbor 0.2 bin #邻居列表
timestep 0.001 #时间步长
#构建模型
lattice fcc 3.6149 #Cu晶格
region box block -10 10 -10 10 0 15 #定义box区域
create_box 5 box #设置box区域有5种原子
create_atoms 1 box #box区域生成类型1原子
set type 1 type/ratio 2 0.2 87393 #原子类型转换
set type 1 type/ratio 3 0.5 87393
set type 1 type/ratio 4 0.5 87393
set type 3 type/ratio 5 0.5 87393
region bottom block INF INF INF INF INF 2 #定义底部边界区域
group bottom region bottom #底部边界原子组
group piece subtract all bottom #所有原子减去底部边界原子
#设置摩尔质量
mass 1 55.845 #Fe
mass 2 58.6934 #Ni
mass 3 51.9961 #Cr
mass 4 58.933194 #Co
mass 5 63.546 #Cu
#力场设置
pair_style eam/alloy #eam势
pair_coeff * * FeNiCrCoCu-heafixed.setfl Fe Ni Cr Co Cu
#工件温度计算
compute new_temp piece temp
#输出信息
thermo 100 #每100步输出
thermo_style custom step temp #自定义输出,步数,整体温度
thermo_modify temp new_temp #输出工件温度
#合金融化
dump 1 all custom 10000 melt.xyz id type x y z #每10000步保存原子信息
velocity piece create 1500 88989 #设置工件初始温度1500K
fix 01 bottom setforce 0 0 0 #设置底部边界原子不受力
fix 1 piece nvt temp 1500 1500 0.1 #工件温度保持1500K
fix_modify 1 temp new_temp #修复计算的温度
run 20000
undump 1 #取消
unfix 1
reset_timestep 0 #设置当前为第0步
#合金冷却
dump 1 all custom 10000 cool.xyz id type x y z #每10000步保存原子信息
fix 1 piece nvt temp 1500 300 0.1 #工件温度从1500K降低至300K
fix_modify 1 temp new_temp #修复计算的温度
run 50000
undump 1 #取消
unfix 1
reset_timestep 0 #设置当前为第0步
#压痕过程
variable k equal 10.0 #k为压头表面力常数K
variable z equal vdisplace(70,-1) #vdisplace()位置更新函数,初始位置,速度
fix 1 all nvt temp 300 300 0.1 #恒温过程
fix 2 all indent $k sphere 0 0 v_z 15 units box #indent缩进,虚拟球圆心(0,0,z),半径15
dump 1 all custom 100 indent.xyz id type x y z #每100步保存原子相关信息
#计算加载力和压入深度
variable fz equal f_2[3]*1.602 #ID为1的fix过程中z方向的力,*1.602转换单位nN
variable depth equal 70-v_z #压入深度
fix 3 all print 100 "${depth} ${fz}" file force.txt screen no #每100步保存压入深度和加载力,不输出屏幕
#运行
run 15000