PFCdocumentation_ PFC examples_tutorials

2023-10-31 21:10

本文主要是介绍PFCdocumentation_ PFC examples_tutorials,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

目录

Inclusions in a Matrix

Hopper Discharge

Using FISH Callbacks

Table Tennis


Inclusions in a Matrix


       如何使用接触模型分配表 (CMAT)来构建具有异构机械属性的复杂模型。(对具有软夹杂物和硬夹杂物的均匀和异质材料进行的无侧限压缩试验)

        设置模型初始状态

; prepare for upcoming tests : add top and bottom platens and set up monitoring
contact cmat default type 'ball-facet' model linear ...property kn 1e8 ks 5e7 fric 0.25
wall generate id 1 plane position 0.0  4.015
wall generate id 2 plane position 0.0 -4.015
;生成墙壁wall attribute velocity-y -0.005 range id 1
wall attribute velocity-y  0.005 range id 2
;对墙壁施加速度wall history force-contact-y id 1
wall history force-contact-y id 2
wall history displacement-y id 2
;监测力和位移ball attribute displacement 0.0
model save 'initial1'

        第一次压缩测试

; perform UCS test (activate fragment tracking)
fragment register ball-ball
fragment activate time 0.1model solve time 5.0 
model save 'final1'

fragment register:Register contact types for fragment analysis. 

fragment activate:Activate fragment auto-computation. Either the number of cycles or the time between fragment computations (with the cycles or time keyword, respectively) must be specified.

        更改初始 BPM(具有均匀机械性能的粘合粒子模型) 以模拟选定模型区域中的夹杂物

; use groups to identify inclusions 
model restore 'initial1'
ball group 'inclusions' range circle center 1.0 3.0 rad 0.5
ball group 'inclusions' range circle center -0.5 1.0 rad 0.5
ball group 'inclusions' range circle center 0.5 -1.5 rad 0.5
ball group 'inclusions' range circle center -1.0 -3.0 rad 0.5
model save 'initial-groups'

        设置软弱夹层,改变夹杂物和基质内的接触特性。组标识符用于标识矩阵内和包含内的联系人。需要该命令才能将修改后的默认 CMAT 条目应用到现有联系人。然后重复压缩测试。此时夹杂物比基岩更软,也可以设置夹杂物比基岩更硬。

contact cmat default type ball-ball model linear ...property kn 1e7 ks 5e6 fric 0.25 lin_mode 1
contact cmat add 1 model linearpbond ...property kn 1e8 ks 5e7 fric 0.25 lin_mode 1 ...pb_kn 1e8 pb_ks 5e7 pb_ten 2e5 pb_coh 5e4 pb_fa 20 ...range group 'matrix' matches 2
contact cmat add 2 model linearpbond ...property kn 1e7 ks 5e6 fric 0.25 lin_mode 1 ...pb_kn 1e7 pb_ks 5e6 pb_ten 2e4 pb_coh 5e3 pb_fa 20 ...range group 'inclusions' matches 2contact cmat apply
contact method bond gap 0.0; repeat UCS test
fragment register ball-ball
fragment activate time 0.1
model solve time 5.0 
model save 'final2'

contact method bond gap 0.0以指定的间隙间隔解除接触。 如果仅指定一个值,则这是区间的上限。 如果指定了两个值,则它们分别对应于区间的下限和上限。默认为(负无穷,0]


Hopper Discharge


        介绍了执行料斗排放模拟的步骤,研究了填充高度和摩擦力对卸料速率的影响。

model new
model title 'Simple hopper discharge model'fish define geometryW = 20.0W0 = 6.0Theta = 30H = 30.0A = (W-W0)*math.tan(Theta*math.pi/180)
end
@geometrymodel domain extent ([-W*1.5],[W*1.5]) ([-W*1.5],[W*1.5]) ([-H*2],[H*2])
model domain condition destroy

        对于圆柱体,需要底面的中心位置、半径和高度。控制圆柱端是否闭合的cap关键字在两端都设置为false 。指定圆锥台顶面和底面的高度以及最小和最大半径。最小半径为 0 会生成一个圆锥体。对于圆锥体,设置了cap关键字,以便圆锥体的底端被封住,但顶部保持打开状态。

        同时设置接触,并生成球。重力已初始化,模型已通过命令求解到目标平均比率 1e-3 。

        请注意最初使用带有calm关键字的命令,以消除由于使用该命令而产生的大重叠造成的动能。在这种情况下,每 50 个周期,平移和旋转球速度都设置为 0。        

wall generate id 1 cylinder base (0.0,0.0,@A) height [H-A] ...radius [W*0.5] cap false false one-wall
wall generate id 2 cone radius [W0*0.5] [W*0.5] height @A cap true false contact cmat default type ball-ball model linear ...property kn 5e7 ks 5e7 fric 0.577 dp_nratio 0.2contact cmat default type ball-facet model linear ...property kn 1e8 ks 1e8 fric 0.1 dp_nratio 0.2model random 10001
ball distribute porosity 0.5 ...box ([-W*0.35],[W*0.35]) ([-W*0.35],[W*0.35]) (@A,[1.8*H]) ...radius 0.8 1.0
ball attribute density 1000.0 damp 0.7model gravity 0 0 -9.81
model cycle 1000 calm 50
model mechanical timestep scale
model solve ratio-average 1e-3

        根据球的初始高度创建六组球。这对于评估料斗卸料期间的流动模式很有用。球形图项目由文本值着色,以便可视化此分配。生成一个矩形盒子来收集从漏斗中流出的球,盒子的顶部被移除。

ball delete range cylinder end-1 (0.0,0.0,0.0) end-2 (0.0,0.0,@H) ...radius 0.0 [W*0.5] not 
ball group 'LevelOne' range position-z 0.0 [H/6]
ball group 'LevelTwo' range position-z [H/6][2*H/6]
ball group 'LevelThree' range position-z [2*H/6][3*H/6]
ball group 'LevelFour' range position-z [3*H/6][4*H/6]
ball group 'LevelFive' range position-z [4*H/6][5*H/6]
ball group 'LevelSix' range position-z [5*H/6][H*2]wall delete range position-z 0.0 set id 2
wall generate id 200 ...box ([-W*1.25],[W*1.25]) ([-W*0.25],[W*0.25]) ([-H*1.5],0.0)
wall delete range set id 201
;生成矩形区域model save 'initial'

        在从料斗中排出颗粒之前,局部阻尼设置为 0,时间步长计算模式设置为自动,并重置mech age。然后将模型求解到目标时间。

        结果逻辑提供了定期记录简化模型状态以用于后处理目的的能力。这些简化状态可以保存在内存中或输出为二进制文件。在这个例子中,除了球的位置/半径之外,它们的组标识符和速度也被记录下来。makeMovie函数可以在模拟完成后执行,以顺序加载球结果并将绘图视图导出到位图文件。

fish define makeMovie(dur,inc,name)i = 0curv = incdur = durnamefile = nameloop while (curv <= dur)i = i + 1dist = 150.0/(i*0.01)if dist > 150.0dist = 150.0endiflocal fname = string.build('%1_%2.png',name,i)commandmodel result import @i skip-fish;plot export bitmap filename @fnameendcommandcurv = curv + incendloop
endball attribute damp 0.0
model mechanical timestep auto
model mech time-total 0.0
model results interval mechanical 0.04
wall results active on
ball results active true add-attribute velocity
model solve time 15.0
model save 'final'
;@makeMovie(15,0.04,'test')

Using FISH Callbacks


        该命令可用于注册用户定义的FISH函数,以响应模拟期间的特定回调事件执行。

        在计算发生时干扰计算可能是危险的,是不允许的。例如,如果在计算时间步长时能够删除一个球,代码就会崩溃。结果,循环点被保留,因为不允许用户在这些循环点将FISH函数附加到回调事件。出于类似的原因,不允许用户在循环点 40.0(力-位移计算)和 42.0(确定性量的累加)之间进行干涉,以及创建和删除模型组件(球、团块或鹅卵石和墙或面)仅在循环点 0.0(时间步评估)之前允许。

model new
model random 10001
model title 'Using FISH Callbacks'; Define the domain and the default contact model 
model domain extent -3 3
contact cmat default model linear property kn 1.0e6 dp_nratio 0.5; Generate a box and set gravity
wall generate box -2 2
model gravity 10.0; Define the add_ball function, which will be registered as a fish callback
; and will insert balls at a given frequency in the model
fish define add_balllocal tcurrent = mech.time.totalif tcurrent < tnext thenexitendiftnext = tcurrent + freqlocal xvel = (math.random.uniform -0.5) * 2.0local yvel = (math.random.uniform -0.5) * 2.0local bp = ball.create(0.3,vector(0.0,0.0,1.75))ball.vel(bp) = vector(xvel,yvel,-2.0)ball.density(bp) = 1.1e3ball.damp(bp) = 0.1
end
; Set parameters and register the function add_ball with a fish callback at 
; position -11.0 in the cycle sequence. Model components cannot be inserted 
; in the model after the timestep has been evaluated, which corresponds to 
; position 0.0 in the cycle sequence
[freq = 0.25]
[time_start = mech.time.total]
[tnext  = time_start ]
fish callback add @add_ball -11.0; Solve to a target time of 10.0 time-units
model solve time 10.0
model save 'intermediate'; Continue cycling to an additional target time of 15.0 time-units
; Note that the fish callback is still active
model solve time 15.0; Deactivate the fish callback and solve to equilibrium (default limit
; corresponds to an average ratio of 1e-5) 
fish callback remove @add_ball -11.0
model solve
model save 'settled'
return

Table Tennis


model new;define the initial velocity of the ball
;定义初始速度
[XballInitialVelocity = -3.0]
[ZballInitialVelocity = 2.0]; definition of extent and condition
model domain extent -1 1
model domain condition destroy;creation of the table
call 'CreateTable.p3dat';creation of the ball
ball create id 1 ...radius   [Lx*0.005]                      ...position [xTable(1,2)*0.98]              ...[(yTable(1,1)+yTable(1,2))*0.5] ...[zTable+Ly*0.3]
ball trace id 1
;记录球的轨迹
ball attribute density 10            ...velocity-x @XballInitialVelocity ...velocity-z @ZballInitialVelocity
;球的密度和球的速度;linear model for ball-facet contacts
contact cmat default type ball-facet model linear ...property kn 1e6 ks 1e6 fric 0.009
;接触赋值model gravity 0 0 -9.81;check for ball-net contacts
;设置ball-net接触模型
fish define checknet(arr)ct=arr(1);in case of ball-facet contacts, contact.end1 refers to the ball, ;contact.end2 refers to the facetif wall.group(wall.facet.wall(contact.end2(ct))) == "net"io.out("Net!!")bp = ball.find(1)ball.vel(bp,1)=0ball.vel(bp,3)=0endif
end;check fi=ot ball-table contacts!
;设置ball-table接触
fish define tablecontact(ct)con = ct(1);in case of ball-facet contacts, contact.end1 refers to the ball,;contact.end2 refers to the facetif wall.group(wall.facet.wall(contact.end2(con))) == "table"moveracketsendif
end;compute the new position of the racket and move it!
;计算出球拍的新位置并移动它
fish define moveracketsbp = ball.find(1)xvel = ball.vel.x(bp)zvel = ball.vel.z(bp)xpos = ball.pos.x(bp)zpos = ball.pos.z(bp)if xvel < 0if xpos > 0   ball.vel(bp,1)=0ball.vel(bp,3)=0io.out("Fault!!")endifwp = wall.find(7)L = xTable(1,1) - xposelseif xpos < 0   ball.vel(bp,1)=0ball.vel(bp,3)=0io.out("Fault!!")endifwp = wall.find(8)L = xTable(1,2) - xposendifzM = (zvel/xvel)*L + (-9.81/2)*((L/xvel)^2)if zM > domain.min.zif zM < domain.max.zwall.pos.z(wp) = zM + zposendifendif
end;set fish callbacks to check if the ball touches the net
;设置callback检查球体有没有碰到球王
fish callback add @checknet event contact_activated
;set fish callback to prepare the racket position
fish callback add @tablecontact event contact_activatedmodel solve time 1.0
model save 'game'

这篇关于PFCdocumentation_ PFC examples_tutorials的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/318151

相关文章

Image Transformation can make Neural Networks more robust against Adversarial Examples

Image Transformation can make Neural Networks more robust against Adversarial Examples 创新点 1.旋转解决误分类 总结 可以说简单粗暴有效

CloudWatch Examples

原文连接:《AWS SDK for Java——Developer Guide》 译文↓↓↓ 这部分提供了使用Java的AWS开发工具包编写CloudWatch程序的示例。 CloudWatch实时监控AWS资源以及运行在AWS上的应用。您可以使用CloudWatch收集和跟踪指标,这些指标是用来测量资源和应用程序的可变因素。CloudWatch警报根据您定义的规则发送通知或自动

论文《Adversarial Examples on Graph Data: Deep Insights into Attack and Defense》笔记

【IG-Attack 2019 IJCAI】本文提出了一种基于integrated gradients的对抗攻击和防御算法。对于攻击,本文证明了通过引入integrated gradients可以很容易解决离散问题,integrated gradients可以准确反映扰动某些特征或边的影响,同时仍然受益于并行计算。对于防御,本文观察到目标攻击的被攻击图在统计上不同于正常图。在此基础上,本文提出了一

Java Programming Examples

Java Programming Examples Example - Environment How to compile a java file? How to debug a java file? How to set classpath? java -cpjava -classpath How to view current classpath? windows C:> e

【Bazel 】- Examples to build C++ code

Examples to build C++ code This folder is part of the C++ Bazel Tutorial, found at https://bazel.build/start/cpp This package will showcase how to build C++ code in stages. 此文件夹是 C++ Bazel 教程的一部分,位于

规避攻击和毒化攻击Evasion Attacks and Adversarial Examples

"规避攻击(evasion attacks)"和"毒化攻击(poisoning attacks)"是两种常见的网络安全攻击类型,它们针对机器学习和深度学习模型进行攻击。 规避攻击(Evasion Attacks) 规避攻击是指攻击者通过修改输入数据,使得机器学习模型无法正确分类或预测。这种攻击通常利用模型对输入数据的处理方式来产生意想不到的结果,从而误导模型做出错误的判断。规避攻击可以通过以下

【对抗样本】【FGSM】Explaining and Harnessing Adversarial Examples 代码复现

简介 参考Pytorch官方的代码Adversarial Example Generation 参数设置(main.py) # 模型选择:GPUdevice = 'mps' if torch.backends.mps.is_available() else 'cpu'# 数据集位置dataset_path = '../../../Datasets'batch_size =

PyTorch tutorials:快速学会使用PyTorch

准备深入学习transformer,并参考一些资料和论文实现一个大语言模型,顺便做一个教程,今天是番外篇,介绍下PyTorch,后面章节实现代码主要使用这个框架。 本系列禁止转载,主要是为了有不同见解的同学可以方便联系我,我的邮箱 fanzexuan135@163.com 快速学会PyTorch PyTorch是一个流行的基于Python的深度学习库,在本书的其余部分将作为我们实现大型语言模型

Get your Advanced Java Programming Degree with these Tutorials and Courses

Getting started as a Java developer these days is quite straightforward. There are countless books on the subject, and of course an abundance of online material to study. 最近,入门成为一名java开发人员是非常简单的

Qt5官方demo解析集33——Qt Quick Examples - Window and Screen

本系列所有文章可以在这里查看http://blog.csdn.net/cloud_castle/article/category/2123873 接上文Qt5官方demo解析集32——Qt Quick Examples - Threading 来到我们Qt Quick Examples的第二个例子了,之所以挑这个demo,主要是我们使用Qt开发界面(尤其是跨平台界面)时,本地屏幕信息与窗