PFC 5.0 常用命令行指令手册
1. 项目文件操作
1.1 文件加载
1
2
3
4
5
6
7
8
; 加载项目文件
project load 'filename.p2prj'
; 加载数据文件
restore 'filename.p2dat'
; 加载保存文件
restore 'filename.p2sav'
1.2 文件保存
1
2
3
4
5
6
7
8
; 保存数据文件
save 'filename.p2dat'
; 保存项目文件(会自动保存为.p2prj格式)
project save 'filename'
; 保存所有数据
save
2. 计算控制命令
2.1 计算初始化
1
2
3
4
5
; 初始化计算
new
; 清空所有对象
reset
2.2 求解控制
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
; 设置求解步数
solve 'time 1000.0'
; 设置收敛标准
solve accuracy 0.001
; 求解直到收敛
solve
; 暂停计算
pause
; 继续计算
continue
; 停止求解
stop
2.3 步长控制
1
2
3
4
5
6
7
8
9
10
11
; 设置时间步长
set dt 0.1
; 自动调整时间步长
set auto on
; 设置最大步长
set dt max 1.0
; 设置最小步长
set dt min 0.001
3. 对象创建命令
3.1 颗粒创建
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
; 创建圆形颗粒
ball create id 1 position 0 0 radius 0.5
; 创建多个随机颗粒
ball create radius 0.1 0.2 number 100 ...
position -5 5 -5 5
; 创建规则排列的颗粒
ball distribute hex packed ...
radius 0.5 0.6 ...
number 1000 ...
box -10 10 -10 10 -10 10
; 生成颗粒并填充区域
ball generate radius 0.5 ...
number 1000 ...
box -10 10 -10 10 -10 10
3.2 墙创建
1
2
3
4
5
6
7
8
9
10
11
12
13
14
; 创建平面墙
wall create plane position 0 0 0 normal 0 1 0
; 创建线段墙(2D)
wall create line position -10 0 10 0
; 创建立方体墙
wall create box -10 10 -10 10 -10 10
; 创建圆柱墙
wall create cylinder axis z ...
base -5 -5 0 ...
top -5 -5 10 ...
radius 5
3.3 块体创建
1
2
3
4
5
6
7
8
; 创建一个块体
block create brick 0 10 0 10 0 10
; 创建规则块体阵列
block distribute hex packed ...
size 1 1 1 ...
number 10 10 5 ...
box 0 10 0 10 0 5
4. 材料属性设置
4.1 接触模型设置
1
2
3
4
5
6
7
8
9
10
11
12
13
14
; 设置线接触模型
contact model linear
; 设置赫兹接触模型
contact model hertz
; 设置接触黏结模型
contact model contactbond
; 设置平行黏结模型
contact model parallelbond
; 设置摩擦接触模型
contact model friction
4.2 颗粒属性设置
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
; 设置密度
ball density 2650
; 设置弹性模量
ball young 50e9
; 设置泊松比
ball poisson 0.25
; 设置摩擦系数
ball friction 0.5
; 设置接触强度
ball contact stiffness shear 1e8
ball contact stiffness normal 1e8
4.3 墙属性设置
1
2
3
4
5
6
7
8
; 设置墙摩擦系数
wall friction 0.6
; 设置墙弹性模量
wall young 50e9
; 设置墙泊松比
wall poisson 0.2
5. 边界条件设置
5.1 重力设置
1
2
3
4
5
; 设置重力加速度
set gravity 0 0 -9.81
; 关闭重力
set gravity 0 0 0
5.2 速度/位移边界
1
2
3
4
5
6
7
8
; 设置颗粒速度
ball velocity 1 0 0 range id 1 100
; 设置墙速度
wall velocity 0.01 0 0 range id 1
; 固定边界(零速度)
ball velocity 0 0 0 range position-y 10 11
5.3 应力/力边界
1
2
3
4
5
; 施加均匀应力
apply stress 1000 0 0 0 0 0 range box -5 5 -5 5 -5 5
; 施加集中力
apply force 100 0 0 range id 1
6. 状态查询命令
6.1 系统信息
1
2
3
4
5
6
7
8
; 显示系统信息
info
; 显示FISH变量列表
list fish
; 显示材料模型列表
list contact model
6.2 统计信息
1
2
3
4
5
6
7
8
9
10
11
; 显示计算状态
print STEP
print TIME
; 显示力链信息
print contacts active
print contacts total
; 显示颗粒统计
print balls active
print balls total
6.3 变量监控
1
2
3
4
5
6
7
8
9
10
11
; 监控不平衡力
plot不平衡力 history
; 监控动能
plot KE history
; 监控势能
plot PE history
; 监控平均应力
plot平均应力 history
7. 图形显示命令
7.1 基本绘图
1
2
3
4
5
6
7
8
9
10
11
12
13
14
; 显示所有颗粒
plot ball
; 显示所有墙
plot wall
; 显示接触
plot contact
; 显示力链
plot contact force
; 显示速度矢量
plot ball velocity
7.2 绘图选项
1
2
3
4
5
6
7
8
9
10
11
12
13
; 设置颜色映射
plot add colorby vel-mag
; 设置显示范围
plot set xaxis -10 10
plot set yaxis -10 10
plot set zaxis -10 10
; 保存图片
plot export 'filename.png' width 1200 height 800
; 显示网格
plot set grid on
7.3 切片显示
1
2
3
4
5
; 创建切片
plot add slice origin 0 0 0 normal 1 0 0
; 切片显示应力
plot add slice colorby szz
8. FISH语言命令
8.1 FISH变量
1
2
3
4
5
6
7
; 定义FISH变量
fish define myvariable
myvariable = 10.5
end
; 运行FISH函数
fish run myfunction
8.2 循环结构
1
2
3
4
5
6
7
8
9
; FISH循环
loop while ( step < 1000)
; 循环体
endloop
; FISH计数循环
loop for ( i = 1 to 100)
; 循环体
endloop
8.3 条件判断
1
2
3
4
5
6
; 条件语句
if ( condition) then
; 执行语句
else
; 替代语句
endif
9. 测量命令
9.1 创建测量圆
1
2
3
4
5
; 创建测量圆(2D)
measure create position 0 0 radius 5
; 创建测量球(3D)
measure create position 0 0 0 radius 5
9.2 测量参数
1
2
3
4
5
6
7
8
9
10
11
; 设置测量参数
measure porosity weight
; 添加应力测量
measure stress
; 添加速度测量
measure velocity
; 添加孔隙率测量
measure porosity
10. 历史记录命令
10.1 创建历史记录
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
; 记录计算步数
history interval 10
; 记录不平衡力
history delete
history delete
history number 1
history unbalanced force
; 记录平均速度
history number 2
history average velocity
; 记录动能
history number 3
history kinetic energy
; 记录势能
history number 4
history potential energy
10.2 绘制历史曲线
1
2
3
; 绘制历史记录
plot history 1 vs history 2
plot history 1 vs time
11. 高级功能命令
11.1 平行计算
1
2
3
4
5
; 设置并行计算
set process 4
; 显示处理器数量
print processors
11.2 容差设置
1
2
3
4
5
; 设置接触容差
set contact tolerance 1e-6
; 设置搜索容差
set search tolerance 1e-6
11.3 内存管理
1
2
3
4
5
; 显示内存使用
print memory
; 清理未使用的对象
free memory
12. 批处理命令
12.1 加载批处理文件
1
2
3
4
5
; 执行命令文件
call 'commands.txt'
; 执行FISH文件
fish load 'script.fis'
12.2 循环求解
1
2
3
4
5
6
; 循环求解不同工况
loop while ( condition)
solve 'time 100.0'
save case_@i
i = i + 1
endloop
13. 错误诊断命令
13.1 检查模型
1
2
3
4
5
; 检查模型一致性
model check
; 显示错误信息
model verify
13.2 调试命令
1
2
3
4
5
6
7
8
; 显示接触列表
contact list
; 检查重叠
ball check overlap
; 显示力链
contact force plot
14. 常用组合命令示例
14.1 简单加载示例
1
2
3
4
5
new
project load 'myproject.p2prj'
solve
plot ball
plot export 'result.png'
14.2 创建颗粒填充示例
1
2
3
4
5
6
7
8
new
ball distribute hex radius 0.1 0.2 number 1000 ...
box -5 5 -5 5
ball density 2650
ball young 50e9
ball friction 0.5
set gravity 0 0 -9.81
solve
14.3 三轴压缩试验示例
1
2
3
4
5
6
7
8
9
10
11
12
13
; 创建试样
ball generate radius 0.2 number 1000 ...
box 0 5 0 5 0 10
; 施加围压
apply stress -10e6 0 0 0 0 0 range box 0 5 0 5 0 10
; 固结
solve time 1000
; 偏心加载
apply velocity 0 0 -0.01 range box 0 5 0 5 0 2
solve time 1000
15. 注意事项
命令格式 :PFC命令以分号结尾
注释 :使用分号表示注释开始
大小写 :PFC命令不区分大小写
坐标系统 :默认Z轴向上(3D),2D模型在XY平面
单位系统 :注意保持单位一致性
文件路径 :使用单引号包围文件路径
范围选择 :使用range关键字指定作用范围
版本 :PFC 5.0
最后更新 :2025-10-28
Licensed under CC BY-NC-SA 4.0
最后更新于 Dec 02, 2025 13:34 UTC