Data Files for “Hopper Discharge” Tutorial
- hopper.p3dat (3D example)
 - hopper.p2dat (2D example)
 
Hopper.p3dat
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87  | ; fname: Hopper.p3dat
;==============================================================================
model new
model title 'Simple hopper discharge model'
fish define geometry
  W = 20.0
  W0 = 6.0
  Theta = 30
  H = 30.0
  A = (W-W0)*math.tan(Theta*math.pi/180)
end
@geometry
model domain extent ([-W*1.5],[W*1.5]) ([-W*1.5],[W*1.5]) ([-H*2],[H*2])
model domain condition destroy
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.2
contact cmat default type ball-facet model linear ...
    property kn 1e8 ks 1e8 fric 0.1 dp_nratio 0.2
model 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.7
model 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'
fish define makeMovie(dur,inc,name)
  i = 0
  curv = inc
  dur = dur
  namefile = name
  loop while (curv <= dur)
    i = i + 1
    dist = 150.0/(i*0.01)
    if dist > 150.0
      dist = 150.0
    endif
    local fname = string.build('%1_%2.png',name,i)
    command
      model result import @i skip-fish
      ;plot export bitmap filename @fname
    endcommand
    curv = curv + inc
  endloop
end
ball 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')
return
;==============================================================================
; eof: Hopper.p3dat
 | 
Hopper.p2dat
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94  | ; fname: hopper.p2dat
;
; simple hopper discharge tutorial
;==============================================================================
model new
program thread auto
fish define geometry
  W = 20.0
  W0 = 6.0
  Theta = 30
  H = 30.0
  A = (W-W0)*math.tan(Theta*math.pi/180)
end
@geometry
model domain extent ([-W*1.5],[W*1.5])([-H*2],[H*2.5])
model domain condition destroy
wall create id 1 vertices ([-W0*0.5],0.0) ([-W*0.5],@A)
wall create id 2 vertices ([W0*0.5],0.0) ([W*0.5],@A)
wall create id 3 vertices ([-W0*0.5],0.0) ([W0*0.5],0.0)
wall create id 4 vertices ([-W*0.5],@A) ([-W*0.5],@H)
wall create id 5 vertices ([W*0.5],@A) ([W*0.5],@H)
contact cmat default type ball-ball model linear ...
    property kn 1e7 ks 1e7 fric 0.577 dp_nratio 0.3
contact cmat default type ball-facet model linear ...
    property kn 1e8 ks 1e8 fric 0.1  dp_nratio 0.3
model random 10001
ball distribute porosity 0.5 box ([-W*0.5],[W*0.5]) (@A,[2.0*H]) ...
                radius 0.6 0.75
ball attribute density 2000
model cycle 1000 calm 50
model cycle 2000
model mechanical timestep scale
model gravity 0 -9.81
ball delete range position-x [W*0.5] 100
ball delete range position-x -100 [-W*0.5]
model solve ratio-average 1e-4
ball delete range position-y -100 0
model orientation-tracking on
model save 'Hopper2D'
ball group 'LevelOne'   range position-y 0.0 [H/6]
ball group 'LevelTwo'   range position-y [H/6][2*H/6]
ball group 'LevelThree' range position-y [2*H/6][3*H/6]
ball group 'LevelFour'  range position-y [3*H/6][4*H/6]
ball group 'LevelFive'  range position-y [4*H/6][5*H/6]
ball group 'LevelSix'   range position-y [5*H/6][H*1.5]
wall generate id 200 box ([-W*1.25],[W*1.25]) ([-H*1.5],0.0)
wall delete range set id 202
wall delete range set id 3
model mechanical time-total 0.0
model result interval mechanical 0.2 warn off
ball result active on add-attribute group add-attribute velocity
wall result active on
model mechanical timestep auto
fish define replay(name,plot)
  rmap  = map(0,0)
  map.remove(rmap,0)
  command
    model results map @rmap
  endcommand
  local rsize = map.size(rmap)
  local rkeys = map.keys(rmap)
  loop foreach local k rkeys
    local iname = map.value(rmap,k)
    local oname = string.build('%1_t%2.png',name,k)
    command
      model result import @iname skip-fish
    endcommand
    if plot = true
      command
        plot 'system' export bitmap filename @oname
      endcommand
    endif
  endloop
end
model solve time 25.0
model save 'final'
@replay('test',false)
;@replay('test',true)
return
;==============================================================================
; eof: hopper.p2dat
 | 
| Was this helpful? ... | PFC 6.0 © 2019, Itasca | Updated: Nov 19, 2021 |