MFIX  2016-1
mass_outflow_dem.f
Go to the documentation of this file.
1 !vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv!
2 ! !
3 ! Subroutine: MASS_OUTFLOW_DEM !
4 ! Author: J.Musser Date: 13-Jul-09 !
5 ! !
6 ! Purpose: This routine fills in the necessary information for new !
7 ! particles entereing the system. !
8 ! !
9 !^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^!
10  SUBROUTINE mass_outflow_dem(FORCE_NSEARCH)
11 
12  use derived_types, only: dg_pic
13  use discretelement
14  use des_bc
15  use bc
16  use functions
17  use param1, only: zero
18 
19  use mpi_utility, only: global_all_or
20 
21  implicit none
22 
23  LOGICAL, INTENT(INOUT) :: FORCE_NSEARCH
24 
25  INTEGER :: IJK
26  INTEGER :: LC, LP, NP, M
27  INTEGER :: BCV, BCV_I, IDX
28 
29  DOUBLE PRECISION :: SGN
30  DOUBLE PRECISION :: DIST
31 
32  LOGICAL :: FREEZE_VEL
33  DOUBLE PRECISION :: FREEZE(3)
34 
35  DO bcv_i = 1, dem_bcmo
36 
37  bcv = dem_bcmo_map(bcv_i)
38 
39  freeze_vel = (bc_type_enum(bcv) /= mass_outflow)
40 
41  SELECT CASE (bc_plane(bcv))
42  CASE('N'); freeze = (/0.0d0, 1.0d0, 0.0d0/); idx=2; sgn=-1.0d0
43  CASE('S'); freeze = (/0.0d0, 1.0d0, 0.0d0/); idx=2; sgn= 1.0d0
44  CASE('E'); freeze = (/1.0d0, 0.0d0, 0.0d0/); idx=1; sgn=-1.0d0
45  CASE('W'); freeze = (/1.0d0, 0.0d0, 0.0d0/); idx=1; sgn= 1.0d0
46  CASE('T'); freeze = (/0.0d0, 0.0d0, 1.0d0/); idx=3; sgn=-1.0d0
47  CASE('B'); freeze = (/0.0d0, 0.0d0, 1.0d0/); idx=3; sgn= 1.0d0
48  END SELECT
49 
50  DO lc=dem_bcmo_ijkstart(bcv_i), dem_bcmo_ijkend(bcv_i)
51  ijk = dem_bcmo_ijk(lc)
52  DO lp= 1,dg_pic(ijk)%ISIZE
53 
54  np = dg_pic(ijk)%P(lp)
55 
56  IF(is_nonexistent(np)) cycle
57  IF(is_any_ghost(np)) cycle
58  IF(is_entering(np)) cycle
59 
60  SELECT CASE (bc_plane(bcv))
61  CASE('S'); dist = yn(bc_j_s(bcv)-1) - des_pos_new(np,2)
62  CASE('N'); dist = des_pos_new(np,2) - yn(bc_j_s(bcv))
63  CASE('W'); dist = xe(bc_i_w(bcv)-1) - des_pos_new(np,1)
64  CASE('E'); dist = des_pos_new(np,1) - xe(bc_i_w(bcv))
65  CASE('B'); dist = zt(bc_k_b(bcv)-1) - des_pos_new(np,3)
66  CASE('T'); dist = des_pos_new(np,3) - zt(bc_k_b(bcv))
67  END SELECT
68 
69 ! The particle is still inside the domain
70  IF(dist > des_radius(np)) THEN
71  CALL set_normal(np)
72 
73 ! Check if the particle is crossing over the outlet plane.
74  ELSEIF(dist > zero) THEN
75 
76 ! The velocity is 'frozen' normal to the outflow plane. This approach
77 ! is strict because complex BCs (via STLs) can let particles pop through
78 ! the wall along the outlet.
79  IF(freeze_vel) THEN
80 ! Only 'freeze' a particle's velocy if it has it moving out of the
81 ! domain. Otherwise, particles flagged as exiting but moving away from
82 ! the BC appear to moon-walk through the domain until it crashes.
83  IF(des_vel_new(np,idx)*sgn > 0.0d0) THEN
84  des_vel_new(np,:) = des_vel_new(np,:)*freeze(:)
85 ! Set the flags for an exiting particle.
86  IF (is_ghost(np)) THEN
87  CALL set_exiting_ghost(np)
88  ELSE
89  CALL set_exiting(np)
90  ENDIF
91  ENDIF
92 
93 ! The user specified velocity is applied to the exiting particle. This
94 ! only applies to mass outflows where the speed at which particles
95 ! exit needs to be controled.
96  ELSE
97  m = pijk(np,5)
98  des_vel_new(np,1) = bc_u_s(bcv,m)
99  des_vel_new(np,2) = bc_v_s(bcv,m)
100  des_vel_new(np,3) = bc_w_s(bcv,m)
101 ! Set the flags for an exiting particle.
102  IF (is_ghost(np)) THEN
103  CALL set_exiting_ghost(np)
104  ELSE
105  CALL set_exiting(np)
106  ENDIF
107  ENDIF
108 
109 ! Ladies and gentlemen, the particle has left the building.
110  ELSE
111  CALL delete_particle(np)
112  force_nsearch = .true.
113  ENDIF
114 
115  ENDDO
116  ENDDO
117  ENDDO
118 
119 ! Sync the search flag across all processes.
120 ! CALL GLOBAL_ALL_OR(FORCE_NSEARCH)
121 
122  RETURN
123  END SUBROUTINE mass_outflow_dem
124 
125 !vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv!
126 ! !
127 ! Subroutine: DELETE_PARTICLE !
128 ! Author: J.Musser Date: 13-Jul-09 !
129 ! !
130 ! Purpose: This routine is used to check if a new particle has fully !
131 ! entered the domain. If so, the flag classifying the particle as new!
132 ! is removed, allowing the particle to respond to contact forces from !
133 ! walls and other particles. !
134 ! !
135 !^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^!
136  SUBROUTINE delete_particle(NP)
138  USE compar
139  USE constant
140  USE des_bc
141  USE discretelement
142  USE funits
143  USE geometry
144  USE indices
145  USE param1
146  USE physprop
147  USE functions
148 
149  IMPLICIT NONE
150 
151  INTEGER, INTENT(IN) :: NP
152 
153 !-----------------------------------------------
154 ! Local variables
155 !-----------------------------------------------
156 
157  iglobal_id(np) = -1
158  CALL set_nonexistent(np)
159 
160  des_pos_new(np,:) = zero
161  des_vel_new(np,:) = zero
162  omega_new(np,:) = zero
163 
164  IF(particle_orientation) orientation(1:3,np) = init_orientation
165 
166  IF (do_old) THEN
167  des_pos_old(np,:) = zero
168  des_vel_old(np,:) = zero
169  omega_old(np,:) = zero
170  ENDIF
171 
172  des_radius(np) = zero
173  pmass(np) = huge(0.0)
174  pvol(np) = huge(0.0)
175  ro_sol(np) = zero
176  omoi(np) = zero
177 
178  fc(np,:) = zero
179  tow(np,:) = zero
180 
181  ppos(np,:) = zero
182 
183  wall_collision_facet_id(:,np) = -1
184 
185  pip = pip - 1
186 
187  RETURN
188  END SUBROUTINE delete_particle
integer, dimension(dimension_bc) bc_k_b
Definition: bc_mod.f:70
integer, dimension(:), allocatable dem_bcmo_ijkstart
Definition: des_bc_mod.f:92
integer, dimension(:), allocatable dem_bcmo_ijk
Definition: des_bc_mod.f:95
integer, dimension(:), allocatable dem_bcmo_ijkend
Definition: des_bc_mod.f:93
subroutine mass_outflow_dem(FORCE_NSEARCH)
integer, dimension(dimension_bc) bc_i_w
Definition: bc_mod.f:54
double precision, dimension(dimension_bc, dim_m) bc_w_s
Definition: bc_mod.f:129
integer dem_bcmo
Definition: des_bc_mod.f:19
integer, dimension(dimension_bc) bc_type_enum
Definition: bc_mod.f:146
type(iap2), dimension(:), allocatable dg_pic
character, dimension(dimension_bc) bc_plane
Definition: bc_mod.f:217
integer, dimension(dimension_bc) bc_j_s
Definition: bc_mod.f:62
double precision, dimension(dimension_bc, dim_m) bc_v_s
Definition: bc_mod.f:121
double precision, dimension(dimension_bc, dim_m) bc_u_s
Definition: bc_mod.f:113
subroutine delete_particle(NP)
integer, dimension(dimension_bc) dem_bcmo_map
Definition: des_bc_mod.f:25
double precision, parameter zero
Definition: param1_mod.f:27
Definition: bc_mod.f:23