File: RELATIVE:/../../../mfix.git/model/des/init_settling_dem.f

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           SUBROUTINE INIT_SETTLING_DEM
9     
10           USE desgrid, ONLY: desgrid_pic
11           USE discretelement
12           USE error_manager
13           USE mpi_funs_des, ONLY: DES_PAR_EXCHANGE
14           USE run
15     
16           IMPLICIT NONE
17     !-----------------------------------------------
18     ! Local variables
19     !-----------------------------------------------
20           INTEGER :: FACTOR
21     
22     !-----------------------------------------------
23     ! Include statement functions
24     !-----------------------------------------------
25     
26     
27     ! Skip this routine if there are no particles.
28           IF(PARTICLES == 0) RETURN
29     ! Skip this routine if not a new run.
30           IF(RUN_TYPE /= 'NEW') RETURN
31     ! Skip if not coupled.
32           IF(.NOT.DES_CONTINUUM_COUPLED) THEN
33              IF(PRINT_DES_DATA) CALL WRITE_DES_DATA
34              RETURN
35           ENDIF
36     
37     ! Skip if using cohesion. (Why?)
38           IF(USE_COHESION) RETURN
39     
40           WRITE(ERR_MSG, 1100) trim(iVal(NFACTOR))
41           CALL FLUSH_ERR_MSG(HEADER=.FALSE., FOOTER=.FALSE.)
42      1100 FORMAT('Beginning DEM settling period: ',A,' steps.')
43     
44     
45     ! Disable the coupling flag.
46           DES_CONTINUUM_COUPLED = .FALSE.
47     
48     
49           DO FACTOR = 1, NFACTOR
50     ! calculate forces
51              CALL CALC_FORCE_DEM
52     ! update particle position/velocity
53              CALL CFNEWVALUES
54     ! set the flag do_nsearch before calling particle in cell (for mpi)
55              DO_NSEARCH = (MOD(FACTOR,NEIGHBOR_SEARCH_N)==0)
56     ! Bin the particles to the DES grid.
57              CALL DESGRID_PIC(.TRUE.)
58     ! exchange particle crossing boundaries and updates ghost particles
59              CALL DES_PAR_EXCHANGE
60     ! find particles on grid
61              CALL PARTICLES_IN_CELL
62     ! perform neighbor search
63              IF(DO_NSEARCH) CALL NEIGHBOUR
64           ENDDO
65     
66     ! Reset the comoupling flag.
67           DES_CONTINUUM_COUPLED = .TRUE.
68     
69           WRITE(ERR_MSG, 1200)
70           CALL FLUSH_ERR_MSG(HEADER=.FALSE., FOOTER=.FALSE.)
71      1200 FORMAT('DEM settling period complete.')
72     
73     ! this write_des_data is needed to properly show the initial state of
74     ! the simulation (granular or coupled). In the coupled case, the
75     ! particles may have 'settled' according to above.  In the granular
76     ! case, the initial state won't be written until after the particles
77     ! have moved without this call.
78           IF(PRINT_DES_DATA) CALL WRITE_DES_DATA
79     
80           RETURN
81           END SUBROUTINE INIT_SETTLING_DEM
82     
83