MFIX  2016-1
init_settling_dem.f
Go to the documentation of this file.
1 !vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv!
2 ! Module name: MAKE_ARRAYS_DES !
3 ! Author: Jay Boyalakuntla Date: 12-Jun-04 !
4 ! !
5 ! Purpose: DES - allocating DES arrays
6 ! !
7 !^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^!
8 
9 #include "version.inc"
10 
11  SUBROUTINE init_settling_dem
12 
13  USE desgrid, ONLY: desgrid_pic
14  USE derived_types, only: multisap, boxhandle
15  USE discretelement
16  USE error_manager
18  USE run
19  use functions, only: is_nonexistent
21  use geometry
22 
23  IMPLICIT NONE
24 !-----------------------------------------------
25 ! Local variables
26 !-----------------------------------------------
27  INTEGER :: FACTOR, nn
28 
29  type(aabb_t) :: aabb
30 
31  real :: mins(3), maxs(3), rad
32 
33 !-----------------------------------------------
34 ! Include statement functions
35 !-----------------------------------------------
36 
37 
38 ! Skip this routine if there are no particles.
39  IF(particles == 0) RETURN
40 ! Skip this routine if not a new run.
41  IF(run_type /= 'NEW') RETURN
42 
43 ! Skip if not coupled.
44  IF(.NOT.des_continuum_coupled) RETURN
45 
46 ! Write the initial configuration before settling
47  IF(print_des_data .AND. nfactor>0) CALL write_des_data
48 
49  WRITE(err_msg, 1100) trim(ival(nfactor))
50  CALL flush_err_msg(header=.false., footer=.false.)
51  1100 FORMAT('Beginning DEM settling period: ',a,' steps.')
52 
53 ! Disable the coupling flag.
54  des_continuum_coupled = .false.
55 
56  mins(1) = 0
57  mins(2) = 0
58  mins(3) = 0
59  maxs(1) = xlength
60  maxs(2) = ylength
61  maxs(3) = zlength
62 
63 #ifdef do_sap
64  rad = 100*maxval(des_radius)
65  print *,"rad = ",rad
66  print *,"XLENGTH = ",xlength
67  print *,"YLENGTH = ",ylength
68  print *,"ZLENGTH = ",zlength
69  call init_multisap(multisap,floor(xlength/rad),floor(ylength/rad),floor(zlength/rad),mins,maxs)
70  ! initialize SAP
71  do nn=1, max_pip
72  if(is_nonexistent(nn)) cycle
73  aabb%minendpoint(:) = des_pos_new(nn,:)-des_radius(nn)
74  aabb%maxendpoint(:) = des_pos_new(nn,:)+des_radius(nn)
75 
76  if ( any(des_radius(nn)*multisap%one_over_cell_length(1:merge(2,3,no_k)) > 0.5 ) ) then
77  print *,"BAD RADIUS..grid too fine, need to have radius=",des_radius(nn)," less than half cell length= ",0.5/multisap%one_over_cell_length(:)
78  error_stop __line__
79  endif
80 
81  call multisap_add(multisap,aabb,nn,boxhandle(nn))
82  enddo
83 
86 #endif
87 
88  DO factor = 1, nfactor
89 ! calculate forces
90 
91  CALL calc_force_dem
92 ! update particle position/velocity
93 
94  CALL cfnewvalues
95 ! set the flag do_nsearch before calling particle in cell (for mpi)
96  do_nsearch = (mod(factor,neighbor_search_n)==0)
97 
98 ! Bin the particles to the DES grid.
99  CALL desgrid_pic(.true.)
100 ! exchange particle crossing boundaries and updates ghost particles
101  CALL des_par_exchange
102 ! find particles on grid
103  CALL particles_in_cell
104 ! perform neighbor search
105  IF(do_nsearch) CALL neighbour
106  ENDDO
107 
108 ! Reset the comoupling flag.
109  des_continuum_coupled = .true.
110 
111  WRITE(err_msg, 1200)
112  CALL flush_err_msg(header=.false., footer=.false.)
113  1200 FORMAT('DEM settling period complete.')
114 
115 ! this write_des_data is needed to properly show the initial state of
116 ! the simulation (granular or coupled). In the coupled case, the
117 ! particles may have 'settled' according to above. In the granular
118 ! case, the initial state won't be written until after the particles
119 ! have moved without this call.
120 ! IF(PRINT_DES_DATA) CALL WRITE_DES_DATA
121 
122  RETURN
123  END SUBROUTINE init_settling_dem
subroutine, public multisap_add(this, aabb, particle_id, handlelist)
Definition: multisap.f:193
subroutine write_des_data
subroutine init_settling_dem
subroutine cfnewvalues
Definition: cfnewvalues.f:20
subroutine desgrid_pic(plocate)
Definition: desgrid_mod.f:711
subroutine des_par_exchange()
subroutine, public multisap_sweep(this)
Definition: multisap.f:420
subroutine calc_force_dem
character(len=16) run_type
Definition: run_mod.f:33
double precision xlength
Definition: geometry_mod.f:33
Definition: run_mod.f:13
subroutine particles_in_cell
type(multisap_t) multisap
logical no_k
Definition: geometry_mod.f:28
subroutine neighbour
Definition: neighbour.f:16
character(len=line_length), dimension(line_count) err_msg
subroutine, public init_multisap(this, x_grid, y_grid, z_grid2, minbounds, maxbounds)
Definition: multisap.f:80
double precision ylength
Definition: geometry_mod.f:35
subroutine, public multisap_quicksort(this)
Definition: multisap.f:392
type(boxhandlelist_t), dimension(:), allocatable boxhandle
double precision zlength
Definition: geometry_mod.f:37
subroutine flush_err_msg(DEBUG, HEADER, FOOTER, ABORT, LOG, CALL_TREE)