PFC初期简单练习程序.docx
- 文档编号:13132684
- 上传时间:2023-06-11
- 格式:DOCX
- 页数:23
- 大小:1.51MB
PFC初期简单练习程序.docx
《PFC初期简单练习程序.docx》由会员分享,可在线阅读,更多相关《PFC初期简单练习程序.docx(23页珍藏版)》请在冰点文库上搜索。
PFC初期简单练习程序
PFC简单程序1
Pfc2d程序1:
用ball生成球
;fname:
raft.dat
ballrad0.25id=1501x=0.25y=0.25
ballrad0.25id=1502x=0.75y=0.25
ballrad0.25id=1503x=1.25y=0.25
ballrad0.25id=1504x=1.75y=0.25
macroRaft'id=1501,1504';组群
propertydensity2000kn=1e9ks=1e9rangeRaft
propertyn_bond1e10s_bond1e10rangeRaft
propertypb_rad1.0pb_s1e20pb_n1e20rangeRaft
propertypb_kn1e10pb_ks1e10c_index1rangeRaft
inixv0rangeRaft
fixxrangeRaft
iniyforce-5.0e5rangeRaft
pladdballred
plshow
Pfc2d程序2:
用generate生成球
;fname:
gen1.dat
new
setrandom;生成随机数
macrobig'id1,20';用macro定义颗粒组
macrosmall'id51,100'
genbigrad=.6,.6x=0,10y=0,10
gensmallrad=.3,.3x=0,10y=0,10
changec_index0rangebig
changec_index1rangesmall
plotcreatefred
plotaddballlbluelmag
plotshow
扩展:
生成两种不同的球
new
setrandom;生成随机数
macrobig'id1,2000';用macro定义颗粒组
macrosmall'id5001,10000'
genbigrad=.15,.18x=0,40y=0,20
gensmallrad=.02,.03x=0,40y=20,50
changec_index0rangebig
changec_index1rangesmall
plotcreatefred
plotaddballlbluelmag
plotshow
wallid1ks=1e8kn=1e8node0,040,0
wallid2ks=1e8kn=1e8node40,040,20
wallid3ks=1e8kn=1e8node40,200,20
wallid4ks=1e8kn=1e8node0,200,0
wallid5ks=1e8kn=1e8node40,2040,50
wallid6ks=1e8kn=1e8node40,500,50
wallid7ks=1e8kn=1e8node0,500,20
wallid8ks=1e8kn=1e8node40,5040,60
wallid9ks=1e8kn=1e8node40,600,60
wallid10ks=1e8kn=1e8node0,600,50
wallid11ks=1e8kn=1e8node-2,-2-2,-32
wallid12ks=1e8kn=1e8node-2,-3242,-32
wallid13ks=1e8kn=1e8node42,-3242,-2
Pfc2d程序3:
用wall生成一组墙
new
defmake_walls
command
wallid=1nodes=(0,0)(5,0)
wallid=2nodes=(5,0)(5,3)
wallid=3nodes=(5,3)(0,3)
wallid=4nodes=(0,3)(0,0)
endcommand
end
make_walls
plotwallid=onred
Pfc2d程序4:
用wall生成一组墙
new
wallid1ks=1e8kn=1e8node0,010,0
wallid2ks=1e8kn=1e8node10,010,10
wallid3ks=1e8kn=1e8node10,100,10
wallid4ks=1e8kn=1e8node0,100,0
genid=1,500rad=0.12,0.17x=0,10y=0,10;生成球
propdens=1000kn=1e8ks=1e8;给球赋属性
iniradmul1.60;初始半径乘以1.6倍
cyc8000;运行8000步
plotcreatethe_view;创建显示框
plotaddwallblack;显示墙为黑色
plotaddballyellow;显示球为黄色
plotaddmeasblue;显示测量圈为蓝色
plotshow;显示
measureid1x5y5rad2.5;测量圈1以(5,5)为中心半径为2.5
printmeasure1;打印测量圈1
这里解释一下,这里测量的是孔隙率,滑动摩擦系数,应力和应变
Pfc2d程序5:
扩展墙与修改墙的刚度
;fname:
biax_1.DATbiaxialsample
new
SETrandom;生成随机数
SETdiskon;二维中生成的圆盘
;----------------------------------------------------
defmake_walls;创建扩展的墙壁
extend=1.0;扩展系数
_x0=-extend*width
_y0=0.0
_x1=width*(1.0+extend)
_y1=0.0
command
wallid=1kn=w_stiffnodes(_x0,_y0)(_x1,_y1)
end_command
_x0=width
_y0=-extend*height
_x1=width
_y1=height*(1.0+extend)
command
wallid=2kn=w_stiffnodes(_x0,_y0)(_x1,_y1)
end_command
_x0=width*(1.0+extend)
_y0=height
_x1=-extend*width
_y1=height
command
wallid=3kn=w_stiffnodes(_x0,_y0)(_x1,_y1)
end_command
_x0=0.0
_y0=height*(1.0+extend)
_x1=0.0
_y1=-extend*height
command
wallid=4kn=w_stiffnodes(_x0,_y0)(_x1,_y1)
end_command
end
defassemble;assemblesample
s_stiff=0.0;初始刚度
n_stiff=5e8;法向刚度
w_stiff=5e8;墙的法向刚度
tot_vol=height*width*1.0;总体积
rbar=0.5*(rlo+rhi);
num=int((1.0-poros)*tot_vol/(pi*rbar^2));产生的颗粒数目
mult=1.6;initialradiusmultiplicationfactor
rlo_0=rlo/mult
rhi_0=rhi/mult
make_walls;运行前面的墙命令
command
genid=1,numrad=rlo_0,rhi_0x=0,widthy=0,height
propdens=1000ks=s_stiffkn=n_stiff
end_command
ii=out(string(num)+'particleswerecreated');输出字符串
sum=0.0;getactualporosity
bp=ball_head
loopwhilebp#null
sum=sum+pi*b_rad(bp)^2
bp=b_next(bp)
end_loop
pmeas=1.0-sum/tot_vol;最终孔隙率
mult=sqrt((1.0-poros)/(1.0-pmeas))
command
iniradmulmult
cycle1000
propks=5e8fric0.25
cycle250
end_command
end
;----------------------------------------------------
defcws;改变侧壁刚度
command
wallid2kn=w_stiff
wallid4kn=w_stiff
end_command
end
;----------------------------------------------------
macrozero'inixvel0yvel0spin0'
SETheight=12.0width=6.0rlo=0.075rhi=0.100poros=0.14
assemble
SETw_stiff=5e7;makelateralwallstiffness=1/10ofballstiffness
cws
cyc500
zero
plotcreateassembly
plotaddballlorangewallblack
savebt_ass.SAV
return
;可以生成节理
Jsetid=2dip=0origin=(3.0,2.0)number=2spacing=5.0
plotaddcontactredrangejset2
Plotshow
Pfc2d程序6:
塌落隧道
;fname:
tun1.DAT
new;clearprogramstatetobeginnewproblem
setrandom;resetrandom-numbergenerator
setdiskon;treatballsasdisksofunitthickness
sethist_rep5;每5步记录一次
wallid=1kn=1e8ks=1e8node0-510-5
wallid=2kn=1e8ks=1e8node10-5100
wallid=3kn=1e8ks=1e8node10000
wallid=4kn=1e8ks=1e8node000-5
genid1500rad0.080.13x010y-5-0.5
propertydensity2000kn1e8ks1e8
iniradmul1.50;颗粒初始半径乘以1.5
histdiagmuf;记录不平衡力
histdiagmcf
histballyvelid442;记录442球y方向的速度
histballypos30;记录y方向位置在(3,0)附近
setdtdscale;设计时步
cycle3500
setgrav0-9.81
propfric1.0
cycle2500
printinfo;
plcreateModel
plsetcapsize25
pladdballyellow
pladdwallblack
pladdcforblack
plotshow
plotcurrent0
plothist1
pause
plothist12begin3000
pause
plothist3
pause
plothist4
pause
savetun1.sav
;------------
;fname:
tun2.dat
resttun1.sav;恢复tun1.sav
props_bond=2e5n_bond=2e5;addcontactbonds
;deletetopwallandaddfootingraftmadeofballs
delwall3
callraft.dat
setdtauto;turnoffdensityscaling
propxdisp0.0ydisp0.0;setdisplacementstozero
histreset
histdiagmuf
histdiagmcf
histballyposid1501
histballyvelid1501
solve
plotcurrent0
plothist3ymin-0.02
pause
plotcreatedisp_view
plotaddwallblack
plotadddispblack
plotshow
pause
plotshowmodel
savetun2.sav
;-------
;fname:
tun3_unl.DAT
resttun2.sav
;excavatetunnelbeneathandtorightoffooting
macroHole’circlecenter3-2.5rad1.3’
delballrangeHole
propxdisp0.0ydisp0.0;setdisplacementstozero
cycle8000
plotshowdisp_view
pause
plotshowmodel
pause
savetun3_unl.sav
生成边界的命令流
☐Walltypecylinderend1000,end2001,rad1,1,id=1,kn=1e6,ks=1e6,fric=0.2;生成半径为1的圆柱面;
☐
☐Walltypecylinderend1000,end2001,rad0.0,1,id=1,kn=1e6,ks=1e6,fric=0.2;生成底面半径为1的圆锥面;
☐
☐Walltypecylinderend1000,end2001,rad1,2,id=1,kn=1e6,ks=1e6,fric=0.2;生成上底面半径1,下底面半径为2的圆台面;
☐
☐Walltypespiralend1000,end21000,radin1radout2,pitch=2,id=1,kn=1e6,ks=1e6,fric=0.2;生成5个螺纹的螺旋面;
☐
☐wallid=5face(2,1,2)(5,1,2)(5,0,2)(2,0,2)
wallid=5face(5,0,2)(5,1,2)(5,1,5)(5,0,5)
wallid=5face(2,0,5)(5,0,5)(5,1,5)(2,1,5)
wallid=5face(2,1,2)(2,0,2)(2,0,5)(2,1,5)
注意:
当Generate命令使用no_shadow关键词时,颗粒只会在有效侧与阴影区生成,非阴影区则不能生成颗粒。
当在较复杂的非方体空间内生成颗粒时,No_shadow关键
词(结合边界函数)极为有用。
Pfc2d程序7:
颗粒规则排列
;fname:
GZKLSC.DATGeneratesasheetofclose-packedballs
new
title'Tutorialexample'
defhex
xc=x0
yc=y0
rc=radius
idc=id_start
r2=2.0*radius
yinc=radius*sqrt(3.0)
looprow(1,n_row);每排1到n_row
loopcol(1,n_col)
command
ballid=idcx=xcy=ycrad=rc
end_command
idc=idc+1
xc=xc+r2
end_loop
yc=yc+yinc
xc=x0+radius*(row-(row/2)*2)
end_loop
end
setechooff
setx0=0.15y0=0.15radius=0.1
setid_start=100n_col=7n_row=8
hex
setechoon
非规则排列之半径扩大法
非规则排列之颗粒排斥法
颗粒半径非均匀分区分布
当每个区域都生成颗粒组并分别达到平衡后,使用命令DELWALLID将隔墙删除。
也可以不设隔墙,采用坐标控制颗粒的生成区域,但这种方法生成颗粒组后,若经过CYCLE平衡后,颗粒将不能完全停留在各自的原始区域。
;fname
new
setrandom
genx05y05rad.07.07id=1,120annulus2.5,04,5
genx05y05rad.1.1id=121,240annulus2.5,02.5,4
plotcreatethe_annulus
plotaddballwhiteshadeon;添加球白色阴影
plotaddaxesmag;显示坐标轴为紫色
plotshow
Pfc2d程序8:
圆柱体中生成球
;FNAMEfilter_cylinder.dat
new;
setrandom;
wallid=1typecylinderend1=(0.00.00.0)end2=(0.00.03.0)&
rad=(1.01.0)kn=1.0e8ks=1.0e8fric=0.2;
wallid=2normal(001)origin(0.00.00.0);
wallid=3normal(00-1)origin(0.00.03.0);
;
defff_cylinder
_brad=fc_arg(0);
_bx=fc_arg
(1);
_by=fc_arg
(2);
_bz=fc_arg(3);
_rlim=1.0;
_rxy=sqrt(_bx*_bx+_by*_by);
if(_rxy+_brad)<=_rlim
ff_cylinder=0;
else
ff_cylinder=1;
end_if
end
genid=1,500rad=0.10.1x=-1.01.0y=-1.01.0z=0.0,3.0filterff_cylindertries400000000;
propkn=1.0e6ks=1.0e6dens=1.0e3fric=0.4
plotcreatfilter_test;
plotaddwallwhiteidon;
plotaddballyellow;
plotaddaxes;
plotsetbackwhite;
plotshow;
☐本例中定义了一个名为ff_cylinder的过滤器(filter),用于在一个半径为1.0m,高3.0m的圆柱形空间内生成500个半径等于0.1m的颗粒。
☐需注意的是,ff_cylinder(即fname)必须是一个有返回值的函数,且其返回值只有0或1,返回值必须赋予与函数名同名的变量。
☐第4—7行生成一个由圆柱壁面和2个无限平面组成的封闭圆柱形空间。
☐第9—21行即为过滤器ff_cylinder函数的定义过程,其中第11—13行的作用是将“试产球”的半径和位置信息通过fc_arg(0),fc_arg
(1),fc_arg
(2),fc_arg(3)(注:
fc_arg(N)是PFC3D的内嵌效用函数)分别传递给变量_brad,_bx,_by,_bz。
Generate生成颗粒的过程为不断尝试在特定位置生成特定大小的球,每次尝试时都会生成“试产球”的半径和位置的x,y,z坐标值,这些值分别保存在fc_arg(0),fc_arg
(1),fc_arg
(2),fc_arg(3)之中(必须注意对应关系),调用这些函数将“试产球”的状态信息传递给变量。
☐第14—20行的作用为设置过滤条件,是过滤器的关键语句。
_rxy为“试产球”在XOY平面上离圆柱壁面轴线的距离,当(_rxy+_brad)小于_rlim=1.0m(圆柱半径)时,ff_cylinder=0(接受),即当“试产球”处于圆柱壁面内部时,该球被接受并生成,否则不予生成。
Fish:
需注意的是FISH中的变量名、函数名以及语句,都要写全,不建议缩写。
此外,代码行不能续行,不过可以通过引入新变量解决此问题。
还有一点,FISH不区分大小写。
Pfc2d程序9:
记录曲线
new
wallid5kn1e8nodes-5,05,0
ballid1x0y1.1rad1
propdens1000kn1e8
setgrav0-10
setdtmax=2e-3;设置最大时步
defdown_force
down_force=b_yfob(ball_head)
end
histdown_force;记录时间
cyc500
plothis1;显示时间曲线
new
defbox_geometry
n_stiff=2e8
s_stiff=1e8
xx=5.0
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- PFC 初期 简单 练习 程序