MFIX  2016-1
calc_pg_grad.f
Go to the documentation of this file.
1 !vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv!
2 ! !
3 ! Subroutine: CALC_PG_GRAD !
4 ! Purpose: Calculate cell centered pressure force exerted on the !
5 ! particles in the cell by the gas/fluid phase !
6 ! Note that P_force is evaluated as -dp/dx !
7 ! !
8 ! Notes: This pressure force only needs to be calculated once during !
9 ! the DEM loop (at the beginning) since the gas/fluid phase !
10 ! is essentially static at that point (i.e., gas field is not !
11 ! updated during DEM loop !
12 ! !
13 !^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^!
14  SUBROUTINE calc_pg_grad
15 
16 ! Model B momentum equation
17  use run, only: model_b
18 ! Particle volume.
19  use discretelement, only: pvol
20 ! Gas pressure force by fluid cell
21  use discretelement, only: p_force
22 ! Particle drag force
23  use discretelement, only: drag_fc
24 ! Flag for 3D simulatoins.
25  use geometry, only: do_k
26 ! Loop bounds for fluid grid
27  USE compar, only: ijkstart3, ijkend3
28 ! Flags for cyclic BC with pressure drop
30 ! Specified pressure drop
31  use bc, only: delp_x, delp_y, delp_z
32 ! Domain length
33  use geometry, only: xlength, ylength, zlength
34 ! Gas phase pressure
35  use fldvar, only: p_g
36 
37  use discretelement, only: max_pip, pijk, des_explicitly_coupled
38  use particle_filter, only: filter_cell
41 
42  use functions, only: fluid_at
43 
44  use functions, only: is_normal
45 
46 ! Global Parameters:
47 !---------------------------------------------------------------------//
48 ! Double precision values.
49  use param1, only: zero
50 
51  implicit none
52 
53 ! Loop counters: Particle, fluid cell, neighbor cells
54  INTEGER :: NP, IJK, LC
55 ! Interpolation weight
56  DOUBLE PRECISION :: WEIGHT
57 ! Interpolated gas phase quanties.
58  DOUBLE PRECISION :: lPF(3)
59 ! Loop bound for
60  INTEGER :: LP_BND
61 ! mean pressure gradient for the case of periodic boundaries
62  DOUBLE PRECISION :: cPG(3)
63 !......................................................................!
64 
65 ! Calculate the gas phase pressure gradient. (dP/dx)
66  CALL calc_grad_des(p_g, p_force)
67 
68 
69 ! Add in cyclic BC pressure drop.
70  cpg(1) = merge(delp_x/xlength, zero, cyclic_x_pd)
71  cpg(2) = merge(delp_y/ylength, zero, cyclic_y_pd)
72  cpg(3) = merge(delp_z/zlength, zero, cyclic_z_pd)
73 
74  DO ijk=ijkstart3, ijkend3
75  p_force(:,ijk) = cpg - p_force(:,ijk)
76  ENDDO
77 
78 
79  IF(des_explicitly_coupled .AND. .NOT.model_b) THEN
80 
81 ! Loop bounds for interpolation.
82  lp_bnd = merge(27,9,do_k)
83 
84 ! Calculate the gas phase forces acting on each particle.
85 
86 !$omp parallel do default(none) &
87 !$omp private(NP,lPF,lc,ijk,weight) &
88 !$omp shared(MAX_PIP,DES_INTERP_ON,LP_BND,p_force,drag_fc, &
89 !$omp filter_cell,filter_weight,pijk,pvol)
90  DO np=1,max_pip
91 
92  IF(is_normal(np)) THEN
93  IF(.NOT.fluid_at(pijk(np,4))) cycle
94 
95  IF(des_interp_on) THEN
96  lpf = zero
97  DO lc=1,lp_bnd
98  ijk = filter_cell(lc,np)
99  weight = filter_weight(lc,np)
100  lpf = lpf + p_force(:,ijk)*weight
101  ENDDO
102  ELSE
103  lpf = p_force(:,pijk(np,4))
104  ENDIF
105 
106 ! Include gas pressure and gas-solids drag
107  drag_fc(np,:) = drag_fc(np,:) + lpf*pvol(np)
108  ENDIF
109 
110  ENDDO
111  ENDIF
112 
113  RETURN
114  END SUBROUTINE calc_pg_grad
subroutine calc_pg_grad
Definition: calc_pg_grad.f:15
integer ijkend3
Definition: compar_mod.f:80
integer, dimension(:,:), allocatable filter_cell
double precision delp_z
Definition: bc_mod.f:278
double precision delp_x
Definition: bc_mod.f:272
double precision, dimension(:), allocatable p_g
Definition: fldvar_mod.f:26
logical cyclic_z_pd
Definition: geometry_mod.f:159
double precision, dimension(:,:), allocatable filter_weight
logical cyclic_y_pd
Definition: geometry_mod.f:157
double precision xlength
Definition: geometry_mod.f:33
Definition: run_mod.f:13
logical do_k
Definition: geometry_mod.f:30
logical cyclic_x_pd
Definition: geometry_mod.f:155
integer ijkstart3
Definition: compar_mod.f:80
subroutine calc_grad_des(PHI, DEL_PHI)
Definition: calc_grad_des.f:15
double precision delp_y
Definition: bc_mod.f:275
logical model_b
Definition: run_mod.f:88
double precision ylength
Definition: geometry_mod.f:35
double precision, parameter zero
Definition: param1_mod.f:27
double precision zlength
Definition: geometry_mod.f:37
Definition: bc_mod.f:23