PFC_lobby_第二章10-12讲

目录

FISH入门

随机数和随机生成颗粒

自带随机生成颗粒命令

回调函数


FISH入门

        代码为pfc5.02d。


随机数和随机生成颗粒

new
domain extent -10 10
set random 10001
;把随机数数目设定之后,就可以得到一样的状态。
def test
    random=math.random.uniform 
    loop n(1,50)
        random_x_pos=math.random.uniform
        x_pos=random_x_pos*10-5
        ;范围在-5到5之间
        random_y_pos=math.random.uniform
        y_pos=random_y_pos*10-5
        ;范围在-5到5之间
        
        random_rad=math.random.uniform
        rad=random_rad*0.2+0.1   
        ;半径范围为0.1到0.3     
        pos=vector(x_pos,y_pos)
        bp=ball.create(rad,pos)
    endloop
end
@test
;random=math.random.uniform 生成的数值在0-1之间

        最大的数学库math.math.random.uniform为均匀分布,math.random.guess为高斯分布。


自带随机生成颗粒命令

new
domain extent -10 10

;ball generate radius 0.1 0.3 number 50 box -5 5

wall generate box -5 5
ball distribute radius 0.1 0.3 porosity 0.7 box -5 5
;指定孔隙率,有重叠量

ball attribute density 2e3
cmat default model linear property kn 1e6
;指定密度,线性模型和刚度

cycle 1000 calm 5
;calm把所有颗粒速度清零,能够尽可能减小初始重叠量对于运行的影响
;每运行1000步就把速度清零5步

        如果不进行calm,有的颗粒会跑到墙的外面。


回调函数

        call back功能。

new
domain extent -10 10

ball create position 0 -8 radius 1 

ball attribute yvel 1.0 range id 1

ball attribute density 2e7

set timestep fix 1e-3

set mech age 0
def add_x_vel
    bp=ball.find(1)
    ;bp表示指针变量
    time=mech.age
    x_vel=5.0*math.sin(2*math.pi*1*time)
    ball.vel.x(bp)=x_vel
end

history id 1 @time
history id 2 @x_vel
set fish callback -1.0 @add_x_vel
solve time 8
;用callback来回调函数,实现在每个cycle中都计算该函数 
;PFC操作会把8s分成8000步去算,每一步的时间步长为timestep fix 1e-3

        时间 age、time、clock;其中age和time都是模拟的时间,而clock则是模型实际运行的时间。age表示累计的solve time值,但是time不累计。如果要让age的时间和solve的时间等价,那么需要在求解前加上set mech time 0

        callback一般设置为-1.0。

  • 4
    点赞
  • 13
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
1. Which of the following phrases means "to cancel a flight"? A. Boarding pass B. Flight delay C. Flight cancellation D. Flight itinerary Answer: C 2. What is the meaning of the abbreviation "ATC"? A. Air Traffic Control B. Airline Ticket Center C. Aircraft Transport Carrier D. Airport Terminal Concourse Answer: A 3. What is the term used for the area where passengers wait for their flight to depart? A. Boarding gate B. Baggage claim C. Security checkpoint D. Terminal lobby Answer: D 4. What is the purpose of a "pre-flight briefing"? A. To sell duty-free items to passengers B. To provide safety instructions to passengers C. To serve food and drinks to passengers D. To check passports and visas Answer: B 5. Which of the following phrases means "the act of taking off"? A. Landing B. Takeoff C. Flight delay D. Boarding Answer: B 6. What is the term used for the document that allows a passenger to enter a foreign country? A. Passport B. Visa C. Boarding pass D. Ticket Answer: B 7. What is the meaning of the phrase "ground crew"? A. Passengers waiting to board a flight B. Airline employees who work on the plane C. Air traffic controllers in the tower D. Airport security personnel Answer: B 8. Which of the following phrases means "to land a plane"? A. Takeoff B. Boarding C. Landing D. Flight delay Answer: C 9. What is the term used for the area where passengers retrieve their checked luggage? A. Boarding gate B. Baggage claim C. Security checkpoint D. Terminal lobby Answer: B 10. What is the meaning of the abbreviation "FAA"? A. Federal Aviation Administration B. Flight Attendant Association C. Flight Academy of America D. First Aid for Airplanes Answer: A

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值