MFIX  2016-1
set_ic.f
Go to the documentation of this file.
1 !vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv!
2 ! !
3 ! Subroutine: SET_IC !
4 ! Author: M. Syamlal Date: 21-JAN-92 !
5 ! !
6 ! Purpose: This module sets all the initial conditions. !
7 ! !
8 !^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^!
9 
10  SUBROUTINE set_ic
11 
12 !-----------------------------------------------
13 ! Modules
14 !-----------------------------------------------
15  USE param
16  USE param1
17  USE geometry
18  USE constant
19  USE physprop
20  USE ic
21  USE fldvar
22  USE visc_g
23  USE indices
24  USE scales
25  USE energy
26  USE scalars
27  USE compar
28  USE run
29  USE sendrecv
30  USE solids_pressure
31  USE functions
32  IMPLICIT NONE
33 !-----------------------------------------------
34 ! Local variables
35 !-----------------------------------------------
36 ! indices
37  INTEGER :: I, J, K, IJK, M
38 ! Local index for initial condition
39  INTEGER :: L
40 ! Temporary variable for storing IC_EP_g
41  DOUBLE PRECISION :: EPGX
42 ! Temporary variable for storing IC_P_g
43  DOUBLE PRECISION :: PGX
44 ! Temporary variable for storing P_star
45  DOUBLE PRECISION :: PSX
46 ! Temporary variable for storing IC_T_g
47  DOUBLE PRECISION :: TGX
48 ! Temporary variable for storing IC_U_g
49  DOUBLE PRECISION :: UGX
50 ! Temporary variable for storing IC_V_g
51  DOUBLE PRECISION :: VGX
52 ! Temporary variable for storing IC_W_g
53  DOUBLE PRECISION :: WGX
54 ! Temporary variable for storing IC_ROP_s
55  DOUBLE PRECISION :: ROPSX (dimension_m)
56 ! Temporary variable for storing IC_T_s
57  DOUBLE PRECISION :: TSX (dimension_m)
58 ! Temporary variable for storing IC_U_s
59  DOUBLE PRECISION :: USX (dimension_m)
60 ! Temporary variable for storing IC_V_s
61  DOUBLE PRECISION :: VSX (dimension_m)
62 ! Temporary variable for storing IC_W_s
63  DOUBLE PRECISION :: WSX (dimension_m)
64 ! number density for GHD theory
65  DOUBLE PRECISION :: nM, nTOT
66 !-----------------------------------------------
67 
68 ! Set the initial conditions.
69  DO l = 1, dimension_ic
70  IF (ic_defined(l)) THEN
71 
72  epgx = ic_ep_g(l)
73  pgx = ic_p_g(l)
74  psx = ic_p_star(l)
75  IF (psx==undefined .AND. ic_type(l)/='PATCH') psx = zero
76  tgx = ic_t_g(l)
77  ugx = ic_u_g(l)
78  vgx = ic_v_g(l)
79  wgx = ic_w_g(l)
80 
81  m = 1
82  IF (mmax > 0) THEN
83  ropsx(:mmax) = ic_rop_s(l,:mmax)
84  tsx(:mmax) = ic_t_s(l,:mmax)
85  usx(:mmax) = ic_u_s(l,:mmax)
86  vsx(:mmax) = ic_v_s(l,:mmax)
87  wsx(:mmax) = ic_w_s(l,:mmax)
88  m = mmax + 1
89  ENDIF
90 
91  DO k = ic_k_b(l), ic_k_t(l)
92  DO j = ic_j_s(l), ic_j_n(l)
93  DO i = ic_i_w(l), ic_i_e(l)
94  IF (.NOT.is_on_mype_plus2layers(i,j,k)) cycle
95  IF (dead_cell_at(i,j,k)) cycle ! skip dead cells
96  ijk = funijk(i,j,k)
97 
98  IF (.NOT.wall_at(ijk)) THEN
99  IF (epgx /= undefined) ep_g(ijk) = epgx
100 
101  IF (ic_type(l) == 'PATCH') THEN
102  IF (pgx /= undefined) p_g(ijk) = scale_pressure(pgx)
103  ELSE
104  p_g(ijk) = merge(scale_pressure(pgx), undefined, &
105  pgx /= undefined)
106  ENDIF
107 
108  IF (psx /= undefined) p_star(ijk) = psx
109  IF (tgx /= undefined) t_g(ijk) = tgx
110  IF (ic_l_scale(l) /= undefined) l_scale(ijk) = &
111  ic_l_scale(l)
112 
113  IF (nmax(0) > 0) THEN
114  WHERE (ic_x_g(l,:nmax(0)) /= undefined) &
115  x_g(ijk,:nmax(0)) = ic_x_g(l,:nmax(0))
116  ENDIF
117 
118  IF (nscalar > 0) THEN
119  WHERE (ic_scalar(l,:nscalar) /= undefined) &
120  scalar(ijk,:nscalar) = ic_scalar(l,:nscalar)
121  ENDIF
122 
123  IF (k_epsilon) THEN
124  IF (ic_k_turb_g(l) /= undefined) &
125  k_turb_g(ijk) = ic_k_turb_g(l)
126  IF (ic_e_turb_g(l) /= undefined) &
127  e_turb_g(ijk) = ic_e_turb_g(l)
128  ENDIF
129 
130  IF (ugx /= undefined) u_g(ijk) = ugx
131  IF (vgx /= undefined) v_g(ijk) = vgx
132  IF (wgx /= undefined) w_g(ijk) = wgx
133 
134  gama_rg(ijk) = ic_gama_rg(l)
135  t_rg(ijk) = merge(ic_t_rg(l), zero, &
136  ic_t_rg(l) /= undefined)
137 
138  DO m = 1, mmax
139  IF (ropsx(m) /= undefined) rop_s(ijk,m) = ropsx(m)
140  IF (tsx(m) /= undefined) t_s(ijk,m) = tsx(m)
141  IF (ic_theta_m(l,m) /= undefined) &
142  theta_m(ijk,m) = ic_theta_m(l,m)
143  IF (usx(m) /= undefined) u_s(ijk,m) = usx(m)
144  IF (vsx(m) /= undefined) v_s(ijk,m) = vsx(m)
145  IF (wsx(m) /= undefined) w_s(ijk,m) = wsx(m)
146 
147  gama_rs(ijk,m) = ic_gama_rs(l,m)
148  t_rs(ijk,m) = merge(ic_t_rs(l,m),zero, &
149  ic_t_rs(l,m) /= undefined)
150 
151  IF (nmax(m) > 0) THEN
152  WHERE (ic_x_s(l,m,:nmax(m)) /= undefined) &
153  x_s(ijk,m,:nmax(m)) = ic_x_s(l,m,:nmax(m))
154  ENDIF
155  ENDDO
156 
157 ! for GHD theory to compute mixture IC of velocity and density
158  IF(kt_type_enum == ghd_2007) THEN
159  rop_s(ijk,mmax) = zero
160  u_s(ijk,mmax) = zero
161  v_s(ijk,mmax) = zero
162  w_s(ijk,mmax) = zero
163  theta_m(ijk,mmax) = zero
164  ntot = zero
165  nm = zero
166  DO m = 1, smax
167  IF (ropsx(m) /= undefined) THEN
168  rop_s(ijk,mmax) = rop_s(ijk,mmax) + ropsx(m)
169  nm = ropsx(m)*6d0 / &
170  (pi*d_p(ijk,m)**3*ro_s(ijk,m))
171  ntot = ntot + nm
172  ENDIF
173  IF (ic_theta_m(l,m) /= undefined) &
174  theta_m(ijk,mmax) = theta_m(ijk,mmax) + &
175 
176  nm*ic_theta_m(l,m)
177  IF(usx(m) /= undefined .AND. &
178  ropsx(m) /= undefined) u_s(ijk,mmax) = &
179  u_s(ijk,mmax) + ropsx(m)*usx(m)
180 
181  IF(vsx(m) /= undefined .AND. &
182  ropsx(m) /= undefined) v_s(ijk,mmax) = &
183  v_s(ijk,mmax) + ropsx(m)*vsx(m)
184 
185  IF(wsx(m) /= undefined .AND. &
186  ropsx(m) /= undefined) w_s(ijk,mmax) = &
187  w_s(ijk,mmax) + ropsx(m)*wsx(m)
188  ENDDO
189 
190 ! If ropsTotal > 0 then RoN_T > 0
191  IF(rop_s(ijk,mmax) > zero) THEN
192  u_s(ijk,mmax) = u_s(ijk,mmax) / rop_s(ijk,mmax)
193  v_s(ijk,mmax) = v_s(ijk,mmax) / rop_s(ijk,mmax)
194  w_s(ijk,mmax) = w_s(ijk,mmax) / rop_s(ijk,mmax)
195  theta_m(ijk,mmax) = theta_m(ijk,mmax) / ntot
196 ! For initially empty bed:
197  ELSE
198  u_s(ijk,mmax) = u_s(ijk,mmax)
199  v_s(ijk,mmax) = v_s(ijk,mmax)
200  w_s(ijk,mmax) = w_s(ijk,mmax)
201 ! Set T > 0 in case Ti > 0
202  DO m = 1, smax
203  theta_m(ijk,mmax) = theta_m(ijk,m)
204  ENDDO
205  IF(theta_m(ijk,mmax)==zero) &
206  theta_m(ijk,mmax) = small_number
207  ENDIF
208  ENDIF
209 ! end of modifications for GHD theory
210  ENDIF ! Fluid at
211  ENDDO ! over i
212  ENDDO ! over j
213  ENDDO ! over k
214  ENDIF ! if (ic_defined)
215  ENDDO ! over dimension_ic
216 
217  CALL send_recv(l_scale,2)
218 
219  RETURN
220  END SUBROUTINE set_ic
double precision, dimension(dimension_ic) ic_p_star
Definition: ic_mod.f:68
double precision, dimension(dimension_ic) ic_e_turb_g
Definition: ic_mod.f:132
integer, parameter dimension_ic
Definition: param_mod.f:59
double precision, dimension(:,:), allocatable v_s
Definition: fldvar_mod.f:105
double precision, dimension(dimension_ic) ic_l_scale
Definition: ic_mod.f:71
double precision, dimension(dimension_ic, dim_m) ic_rop_s
Definition: ic_mod.f:74
double precision, dimension(:), allocatable ep_g
Definition: fldvar_mod.f:15
subroutine set_ic
Definition: set_ic.f:11
double precision, dimension(dimension_ic) ic_t_g
Definition: ic_mod.f:80
double precision, dimension(:), allocatable k_turb_g
Definition: fldvar_mod.f:161
integer, dimension(dimension_ic) ic_j_s
Definition: ic_mod.f:47
double precision, dimension(dimension_ic, dim_m) ic_theta_m
Definition: ic_mod.f:86
double precision, dimension(dimension_ic, dim_scalar) ic_scalar
Definition: ic_mod.f:128
double precision, dimension(:,:), allocatable w_s
Definition: fldvar_mod.f:117
integer, dimension(dimension_ic) ic_j_n
Definition: ic_mod.f:50
double precision, dimension(:), allocatable t_g
Definition: fldvar_mod.f:63
double precision function scale_pressure(XXX)
Definition: scales_mod.f:18
double precision, dimension(:,:), allocatable scalar
Definition: fldvar_mod.f:155
logical, dimension(dimension_ic) ic_defined
Definition: ic_mod.f:107
double precision, dimension(:), allocatable p_g
Definition: fldvar_mod.f:26
double precision, parameter undefined
Definition: param1_mod.f:18
character(len=16), dimension(dimension_ic) ic_type
Definition: ic_mod.f:59
double precision, dimension(dimension_ic, dim_m) ic_gama_rs
Definition: ic_mod.f:122
double precision, dimension(:), allocatable l_scale
Definition: visc_g_mod.f:24
double precision, dimension(:,:), allocatable u_s
Definition: fldvar_mod.f:93
double precision, dimension(dimension_ic) ic_u_g
Definition: ic_mod.f:89
Definition: ic_mod.f:9
double precision, dimension(dimension_ic) ic_k_turb_g
Definition: ic_mod.f:131
double precision, dimension(dimension_ic, dim_m) ic_w_s
Definition: ic_mod.f:104
double precision, dimension(:,:), allocatable d_p
Definition: fldvar_mod.f:57
integer, dimension(dimension_ic) ic_i_w
Definition: ic_mod.f:41
integer mmax
Definition: physprop_mod.f:19
logical, dimension(:,:,:), allocatable dead_cell_at
Definition: compar_mod.f:127
double precision, dimension(:,:,:), allocatable x_s
Definition: fldvar_mod.f:78
double precision, parameter small_number
Definition: param1_mod.f:24
double precision, dimension(:,:), allocatable t_s
Definition: fldvar_mod.f:66
double precision, dimension(:,:), allocatable x_g
Definition: fldvar_mod.f:75
integer, dimension(dimension_ic) ic_i_e
Definition: ic_mod.f:44
double precision, dimension(dimension_ic) ic_v_g
Definition: ic_mod.f:95
integer, dimension(dimension_ic) ic_k_b
Definition: ic_mod.f:53
double precision, dimension(:,:), allocatable t_rs
Definition: energy_mod.f:24
double precision, dimension(:), allocatable t_rg
Definition: energy_mod.f:21
double precision, dimension(:,:), allocatable theta_m
Definition: fldvar_mod.f:149
double precision, dimension(:), allocatable v_g
Definition: fldvar_mod.f:99
double precision, dimension(dimension_ic, dim_m, dim_n_s) ic_x_s
Definition: ic_mod.f:113
double precision, dimension(dimension_ic) ic_w_g
Definition: ic_mod.f:101
double precision, dimension(dimension_ic) ic_gama_rg
Definition: ic_mod.f:116
double precision, dimension(:), allocatable w_g
Definition: fldvar_mod.f:111
Definition: run_mod.f:13
integer, dimension(dimension_ic) ic_k_t
Definition: ic_mod.f:56
Definition: param_mod.f:2
double precision, dimension(:,:), allocatable ro_s
Definition: fldvar_mod.f:45
double precision, dimension(dimension_ic, dim_m) ic_v_s
Definition: ic_mod.f:98
integer, dimension(0:dim_m) nmax
Definition: physprop_mod.f:119
double precision, dimension(dimension_ic) ic_p_g
Definition: ic_mod.f:65
logical k_epsilon
Definition: run_mod.f:97
double precision, dimension(:), allocatable p_star
Definition: fldvar_mod.f:142
double precision, dimension(:), allocatable gama_rg
Definition: energy_mod.f:15
double precision, dimension(:), allocatable u_g
Definition: fldvar_mod.f:87
integer nscalar
Definition: scalars_mod.f:7
double precision, dimension(dimension_ic, dim_m) ic_u_s
Definition: ic_mod.f:92
double precision, dimension(dimension_ic, dim_n_g) ic_x_g
Definition: ic_mod.f:110
double precision, dimension(dimension_ic) ic_ep_g
Definition: ic_mod.f:62
double precision, dimension(:,:), allocatable rop_s
Definition: fldvar_mod.f:51
integer smax
Definition: physprop_mod.f:22
double precision, parameter pi
Definition: constant_mod.f:158
double precision, dimension(:,:), allocatable gama_rs
Definition: energy_mod.f:18
double precision, dimension(:), allocatable e_turb_g
Definition: fldvar_mod.f:162
integer dimension_m
Definition: param_mod.f:18
double precision, dimension(dimension_ic) ic_t_rg
Definition: ic_mod.f:119
double precision, dimension(dimension_ic, dim_m) ic_t_s
Definition: ic_mod.f:83
double precision, parameter zero
Definition: param1_mod.f:27
double precision, dimension(dimension_ic, dim_m) ic_t_rs
Definition: ic_mod.f:125