完整word版PFC3D建模流程和代码解释.docx
《完整word版PFC3D建模流程和代码解释.docx》由会员分享,可在线阅读,更多相关《完整word版PFC3D建模流程和代码解释.docx(11页珍藏版)》请在冰豆网上搜索。
完整word版PFC3D建模流程和代码解释
本示例表示生成球体在一定的空间内进行运动的部分代码以及代码表示意义。
新建一个PFC3D模型必要部分生成的整体日志.PFC3D建模需要的部分和代码解释
**********************************************
*Loggingstartedat周三八月3016:
50:
552017
*Bypfc3dVersion5。
00Release025
*
*
*JobTitle:
Pandectexample
**********************************************
pfc3d>
pfc3d>;3—设置模型名称,可有可无.
pfc3d〉title'Pandectexample'
pfc3d〉
pfc3d>;4-设定计算区域(必要条件)
pfc3d〉;Setthedomainextent
pfc3d>domainextent-10.010。
0-2020;domain当中有两个关键词是condition和extent,condition指的是边界条件periodic;destroy;stop;reflect;condition默认值是stop.
extent指的是模型区域
pfc3d〉
pfc3d〉;5-指定随机种子(若不指定,种子随机)
pfc3d>setrandom10001;默认值是一万,且数量级是相同的数量级,也就是该随机数值10000不能过大,不能过小。
设置随机种子以后,生成的颗粒的半径和位置都在范围内随机.
pfc3d>
pfc3d〉;6—生成及修改模型组件(必要条件),有三种命令是来生成颗粒的,generate,create,distribute。
pfc3d〉;Generate30ballsinabox,wall就是一个生成颗粒的容器。
pfc3d〉wallgeneratebox-5。
05.0
———ThewallboxWallBottom1withid1and2facetshasbeencreated
--—ThewallboxWallTop2withid2and2facetshasbeencreated
---ThewallboxWallLeft3withid3and2facetshasbeencreated
--—ThewallboxWallRight4withid4and2facetshasbeencreated
--—ThewallboxWallFront5withid5and2facetshasbeencreated
——-ThewallboxWallBack6withid6and2facetshasbeencreated
pfc3d〉;ballcreate
pfc3d>ballgenerateradius1.01。
4box-5.05.0number1000
+++Fewerballsweregeneratedthanspecified!
34ballsoutof1000generatedin20000tries.
pfc3d〉;balldistribute
pfc3d〉
pfc3d>;7-组件分组,颗粒分组,墙体分组。
pfc3d>
pfc3d>ballgroupsmall_ballsrangeradius1。
01.2
---Groupsmall_ballsassignedto14Ballsinslot1.
pfc3d>ballgroupbig_ballsrangeradius1.21.4
———Groupbig_ballsassignedto20Ballsinslot1.
pfc3d>
pfc3d>;8-施加实体属性(必要条件),实体属性的意思是这些属性是作用在颗粒的中心的。
pfc3d〉;Assignballdensity,颗粒的实体属性一般都是由attribute这个属性来添加。
fix是来限制颗粒的移动方向和位移.
pfc3d〉ballattributedensity100.0
—-—Attributedensityinitializedin34ball(s)。
pfc3d>ballfixzvelocityrangegroupbig_balls
--—Fixityconditionschangedin20balls.
pfc3d〉
pfc3d〉pausekey
Pressanykeytocontinue—-
pfc3d〉
pfc3d〉ballattributeradiusmultiply1。
2;这是半径放大和缩小倍数的,这句话的意思是,生成的半径乘以1。
2倍。
-——Attributeradiusinitializedin34ball(s)。
pfc3d〉ballattributedamp0.7;局部阻尼,PFC3.0-4.0默认值是0。
7,在PFC5.0是0.0
—-—Attributedampinitializedin34ball(s)。
pfc3d〉
pfc3d〉pausekey
Pressanykeytocontinue—-
pfc3d〉
pfc3d>;9—指定接触模型(必要条件)
pfc3d〉;ModifythedefaultslotsoftheContactModelAssignmentTable
pfc3d>;Herewechoosethelinearcontactmodel(withkn=1e6)forallcontacttypes
pfc3d〉cmatdefaultmodellinearpropertykn1.0e6fric0.0;定义法向刚度为10的6次方。
pfc3d>
pfc3d〉;10—设置表面属性,也就是说这些属性是作用在颗粒表面的.
pfc3d>ballpropertykn2e6ks1e6fric0。
0;要通过属性转换才能转到50行的fric
---Propertyknassignedto34ball(s)inrange。
-—-Propertyksassignedto34ball(s)inrange。
—--Propertyfricassignedto34ball(s)inrange。
pfc3d〉
pfc3d〉;11-添加重力场
pfc3d>;Activategravity
pfc3d〉setgravity10。
0
pfc3d〉
pfc3d>;12-设定时间步长(若不指定,取默认值,默认值为模拟时间步长)
pfc3d〉settimestepmaximum5e—3
——-maximumtimestepsetto0。
005inmechanicalprocess。
pfc3d>
pfc3d>deftimestep
Def〉timestep=math.sqrt(m/K)
Def>time=mech。
age;得到模拟时间从而设置时间步长的时候要将时间步长设置的小于该模拟时间,否则该设置的时间步长将会被忽略。
Def>end
pfc3d>
pfc3d〉;13—记录数据
pfc3d>wallhistoryid1zcontactforceid1
———Createdhistory1Z—ContactForceofwall1
pfc3d>
pfc3d>pause5;现在是数字,指的是暂停五秒,如果是pausekey的话,则是摁任意键继续。
pfc3d>
pfc3d>;14-计算求解(必要条件)主要是三个命令,step,cycle,solvetime。
pfc3d>;Solveforagiventimeandsavethemodel
pfc3d〉;step1000,step很少用,几乎用不到。
step和cycle后面都是跟的步数。
pfc3d〉;cycle2002
pfc3d>solvetime10。
0
CycleTotalTimestepMechTimeClock
—--------—-——-————-——-—-———--—-—---————-----—————--——
200020005.00000E-031.000000e+0100:
00:
00:
241。
000000e+01
—-—Limittimeof1.000000e+01metinprocess(es):
mechBall(1.000000e+01),mechClump(1.000000e+01),mechWall(1。
000000e+01).
-—-Cyclingendedat:
2017-08—3016:
51:
36
pfc3d>
pfc3d>;15-输出数据
pfc3d>historywrite1filewzcforce;。
csv,如果不加扩展名默认的扩展名是.his,his文件可以用文本打开。
-—-HistorycontentswrittentofileD:
/安装程序/PFC/PFC学习版2d+3d+例子/01—模型基本组成/PFC5.0—3D/wzcforce。
his.
pfc3d>
pfc3d>;16-保存模型及模型调用,保存模型是以。
p3sav为扩展名的一个文件。
通过restore来调用模型。
pfc3d〉savepandect_example
—--ModelsavedtofileD:
/安装程序/PFC/PFC学习版2d+3d+例子/01-模型基本组成/PFC5。
0-3D/pandect_example.p3sav
pfc3d>
pfc3d>;pause
pfc3d〉;cmat命令一个模型当中前后计算设置不同的接触最好不要。
pfc3d>;ballattributedisplacementmultiply0.0,清空颗粒的位移.清空以后都是0.
pfc3d〉
pfc3d>setlogoff
**********************************************
*Loggingendedat周三八月3016:
51:
372017
**********************************************
建模部分代码—建立尾矿坝的一部分
new
domainextent-50350-50350
balldistributeporosity0.06radius0。
50.75box03000200
ballattributedensity2500damp0。
7
geometryimport01。
dxf
balldelranggeometry01count1not
wallimportgeometry01
geometryimport02。
dxf
wallimportgeometry02
[porosity=0.04]
[area=7948]
setrandom10001
defball_creat
i=50000
a=area*(1-porosity)
loopwhilearea_sum〈=a
f1=math.random。
uniform
f2=math。
random。
uniform
f3=math。
random.uniform
radius_1=0。
75+f3*(2-0。
75)
x_1=2+80*f1
y_1=2+42*f2
command
ballcreateid=@iradius=@radius_1x=@x_1y=@y_1
endcommand
i=i+1
area_1=radius_1*radius_1*math.pi
area_sum=area_sum+area_1
end_loop
end
@ball_creat
ballattributedensity2700
cmatdefaulttypeball—facetmodellinearpropertykn1e10
cmatdefaulttypeball-ballmodellinearpbondmethoddeformemod2e8kratio2
cyc100000calm1000
walldel
geometrydel
geometryimport02.dxf
geometryimport05。
dxf
geometryimport06.dxf
ballgroup1ranggeometry02count1
ballgroup2ranggeometry05count1
ballgroup3ranggeometry06count1
savemodel
接触模型的部分代码书写
例子一
;fname:
cmat1.p2dat
;
;IllustratesimpleusageoftheCMAT
;(Alldefaultslotsfilledwiththesamedata)
;==============================================================================
new
setrandom10001
domainextent-1.5e—21。
5e—2conditiondestroy;定义该计算区域
wallgeneratebox—1。
0e—21.0e—2onewall;生成墙体
ballgeneratenumber200radius0。
4e—30.6e—3box—1。
0e—21。
0e-2;生成了200个颗粒,也可能生成不了那么多的颗粒,半径为0。
4*10的-3次方,0.6*10的-3次方,颗粒范围为-1。
0*10的—2次方即为-0.01,0.01
ballattributedensity2500。
0;设置密度为2500
;setALLthedefaultslotsoftheCMAT
cmatdefaultmodellinearpropertykn1e6dp_nratio0。
0;指定了接触模型为线性接触模型,法向刚度为10的6次方,法向临界阻尼比为0。
0
setgravity9。
81;设置了重力加速度为9.81
cycle1000
pausekey
;setALLthedefaultslotsoftheCMAT
cmatdefaultmodellinearpropertykn1e7dp_nratio0。
2lin_mode1;指定了接触模型为线性接触模型,法向刚度为10的7次方,法向临界阻尼比为0。
2,控制接触力的法向接触更新模式为1。
cmatapplyrangex0.01.5e-2;接触模型的应用范围为x方向0。
0到0。
015,cmatapply指的是将新建的模型添加在已有的模型上。
solvearatio1e—4;solvearatio等于平均不平衡力与平均接触力的比值,默认值是10的-5次方。
但是不能太小,因为太小了以后会造成模型完成时间过长。
用step和cycle也是可以求解的。
savecmat1;保存接触模型为1。
return
;==============================================================================
;eof:
cmat1.p2dat
例子二
;fname:
cmat2。
p2dat
;
;IllustratesimpleusageoftheCMAT
;(Defaultslotsfilledwiththedifferentdata)
;==============================================================================
new
setrandom10001
domainextent-1.5e-21。
5e—2conditiondestroy
wallgeneratebox-1.0e—21.0e—2onewall
ballgeneratenumber200radius0.4e-30.6e-3box-1.0e-21.0e-2
ballattributedensity2500。
0;生成了和cmat1一样的模型,只是在接触模型上有了变化。
;setdifferentcontactmodelsfortheball—ballandball-facetcontacttypes
cmatdefaulttypeball—ball。
..
modelhertz。
。
.;赫兹接触模型,颗粒与颗粒之间
propertyhz_shear30e9hz_poiss0.3..。
;赫兹切向模量30的9次方,赫兹泊松比为0.3
fric0。
25。
..;摩擦系数0。
25
dp_nratio0.2;法向临界阻尼比为0.2
cmatdefaulttypeball—facet。
.。
modellinear...
propertykn1e6dp_nratio0。
2
setgravity9.81
solve
savecmat2
return;对两种接触模型分别定义
;==============================================================================
;eof:
cmat2。
p2dat
例子三
;fname:
cmat3.p2dat
;
;IllustrateadvancedusageoftheCMAT
;(DefaultandOptionalslotsfilledwithdifferentdata)
;==============================================================================
new
setrandom10001
domainextent—1.5e—21。
5e-2conditiondestroy;生成了两组颗粒,在ballgenerate当中用了group命令
wallgeneratebox-1。
0e—21。
0e—2onewall
ballgeneratenumber100radius0。
4e-30.6e-3box—1。
0e—21.0e-2groupglass;玻璃球
ballgeneratenumber100radius0。
4e—30.6e—3box-1.0e-21.0e—2groupsteel;钢球
ballattributedensity2500。
0rangegroupglass;定义密度
ballattributedensity7500。
0rangegroupsteel
;contactgroupleftrangex-1.5e—20
;contactgrouprightrangex01.5e-2
contactgroupbehaviorand;contactgroupbehavior后面有三个关键词,and,or,contact。
and关键词指的是颗粒与颗粒之间的接触是cmatadd定义的模型作用的范围只限于该组内部的接触,而对于另外组的接触则不定义.如果说是选的关键词是or定义的范围只要颗粒属于这个组,则定义的模型范围是所有与这个组相接触。
contact关键词是用来根据颗粒的分组来判断接触的.通过对接触分组来对某个范围内的颗粒定义接触。
;不论cmatadd1modelhertz,cmatadd2modelhertz,cmatdefaulttypeball-ball,cmatdefaulttypeball—facet这四个的顺序怎么样,总是按照这个顺序来执行
cmatadd1modelhertz.。
。
propertyhz_shear30e9hz_poiss0.3。
。
.;30Gpa的切向模量,0.3的泊松比
fric0.25..。
;0。
25的摩擦系数
dp_nratio0。
2...;0。
2的法向临界阻尼比
rangegroupglass;区域范围为玻璃球组合
cmatadd2modelhertz。
。
。
;添加赫兹模型2
propertyhz_shear70e9hz_poiss0。
3。
。
.
fric0.05。
。
。
dp_nratio0。
2...
rangegroupsteel;区域范围为钢球组合
cmatdefaulttypeball-ball。
。
.
modelhertz。
。
。
propertyhz_shear50e9hz_poiss0。
3.。
.
fric0.05。
。
。
dp_nratio0.2
cmatdefaulttypeball—facet.。
.
modellinear。
。
.
propertykn1e6dp_nratio0。
2
setgravity9.81
solve
savecmat3
return
;==============================================================================
;eof:
cmat3。
p2dat