MFIX  2016-1
get_ps.f
Go to the documentation of this file.
1 !vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv!
2 ! !
3 ! SUBROUTINE: GET_PS !
4 ! Author: J.Musser Date: 19-MAR-14 !
5 ! !
6 ! Purpose: Find and validate i, j, k locations for PS's !
7 ! !
8 !^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^!
9  SUBROUTINE get_ps(PSV)
10 
11  USE param
12  USE param1
13  USE geometry
14  USE ps
15  USE indices
16  USE funits
17  USE compar
18 
19 ! Use the error manager for posting error messages.
20 !---------------------------------------------------------------------//
21  use error_manager
22 
23  IMPLICIT NONE
24 
25 ! Dummy Arguments:
26 !---------------------------------------------------------------------//
27 ! Loop/variable indices
28  INTEGER, INTENT(in) :: PSV
29 
30 ! Local Variables:
31 !---------------------------------------------------------------------//
32 ! Error flag.
33  INTEGER :: IER
34 ! Calculated indices of the wall boundary
35  INTEGER :: I_w , I_e , J_s , J_n , K_b , K_t
36 ! Surface indictors
37  LOGICAL :: X_CONSTANT, Y_CONSTANT, Z_CONSTANT
38 !......................................................................!
39 
40  CALL init_err_msg('GET_PS')
41 
42  x_constant = .true.
43  y_constant = .true.
44  z_constant = .true.
45 
46  IF(ps_x_w(psv)/=undefined .AND. ps_x_e(psv)/=undefined) THEN
47  CALL calc_cell(xmin, ps_x_w(psv), dx, imax, i_w)
48  CALL calc_cell(xmin, ps_x_e(psv), dx, imax, i_e)
49  IF (ps_x_w(psv) /= ps_x_e(psv)) THEN
50  x_constant = .false.
51  i_w = i_w + 1
52  IF(ps_i_w(psv)/=undefined_i .OR. &
53  ps_i_e(psv)/=undefined_i) THEN
54  CALL location_check(ps_i_w(psv), i_w, psv, 'PS - west')
55  CALL location_check(ps_i_e(psv), i_e, psv, 'PS - east')
56  ENDIF
57  ENDIF
58  ps_i_w(psv) = i_w
59  ps_i_e(psv) = i_e
60  ELSE
61  IF(ps_i_w(psv) /= undefined_i) &
62  CALL calc_loc(xmin, dx, ps_i_w(psv), ps_x_w(psv))
63  IF(ps_i_e(psv) /= undefined_i) &
64  CALL calc_loc(xmin, dx, ps_i_e(psv), ps_x_e(psv))
65  IF (ps_x_w(psv) /= ps_x_e(psv)) x_constant = .false.
66  ENDIF
67 
68 ! If there is no variation in the I direction set indices to 1
69  IF (no_i) THEN
70  ps_i_w(psv) = 1
71  ps_i_e(psv) = 1
72  ENDIF
73 !
74  IF (ps_y_s(psv)/=undefined .AND. ps_y_n(psv)/=undefined) THEN
75  CALL calc_cell(zero, ps_y_s(psv), dy, jmax, j_s)
76  CALL calc_cell(zero, ps_y_n(psv), dy, jmax, j_n)
77  IF (ps_y_s(psv) /= ps_y_n(psv)) THEN
78  y_constant = .false.
79  j_s = j_s + 1
80  IF(ps_j_s(psv)/=undefined_i .OR. &
81  ps_j_n(psv)/=undefined_i) THEN
82  CALL location_check(ps_j_s(psv), j_s, psv, 'PS - south')
83  CALL location_check(ps_j_n(psv), j_n, psv, 'PS - north')
84  ENDIF
85  ENDIF
86  ps_j_s(psv) = j_s
87  ps_j_n(psv) = j_n
88  ELSE
89  IF(ps_j_s(psv) /= undefined_i) &
90  CALL calc_loc(zero, dy, ps_j_s(psv), ps_y_s(psv))
91  IF(ps_j_n(psv) /= undefined_i) &
92  CALL calc_loc(zero, dy, ps_j_n(psv), ps_y_n(psv))
93  IF (ps_y_s(psv) /= ps_y_n(psv)) y_constant = .false.
94  ENDIF
95 
96 ! If there is no variation in the J direction set indices to 1
97  IF (no_j) THEN
98  ps_j_s(psv) = 1
99  ps_j_n(psv) = 1
100  ENDIF
101 
102  IF (ps_z_b(psv)/=undefined .AND. ps_z_t(psv)/=undefined) THEN
103  CALL calc_cell(zero, ps_z_b(psv), dz, kmax, k_b)
104  CALL calc_cell(zero, ps_z_t(psv), dz, kmax, k_t)
105  IF (ps_z_b(psv) /= ps_z_t(psv)) THEN
106  z_constant = .false.
107  k_b = k_b + 1
108  IF (ps_k_b(psv)/=undefined_i .OR. &
109  ps_k_t(psv)/=undefined_i) THEN
110  CALL location_check(ps_k_b(psv), k_b, psv, 'PS - bottom')
111  CALL location_check(ps_k_t(psv), k_t, psv, 'PS - top')
112  ENDIF
113  ENDIF
114  ps_k_b(psv) = k_b
115  ps_k_t(psv) = k_t
116  ELSE
117  IF(ps_k_b(psv) /= undefined_i) &
118  CALL calc_loc(zero, dz, ps_k_b(psv), ps_z_b(psv))
119  IF(ps_k_t(psv) /= undefined_i) &
120  CALL calc_loc(zero, dz, ps_k_t(psv), ps_z_t(psv))
121  IF (ps_z_b(psv) /= ps_z_t(psv)) z_constant = .false.
122  ENDIF
123 
124 ! If there is no variation in the K direction set indices to 1
125  IF (no_k) THEN
126  ps_k_b(psv) = 1
127  ps_k_t(psv) = 1
128  ENDIF
129 
130 ! CHECK FOR VALID VALUES
131  ier = 0
132  IF(ps_i_w(psv)<1 .OR. ps_i_w(psv)>imax2) ier = 1
133  IF(ps_i_e(psv)<1 .OR. ps_i_e(psv)>imax2) ier = 1
134  IF(ps_j_s(psv)<1 .OR. ps_j_s(psv)>jmax2) ier = 1
135  IF(ps_j_n(psv)<1 .OR. ps_j_n(psv)>jmax2) ier = 1
136  IF(ps_k_b(psv)<1 .OR. ps_k_b(psv)>kmax2) ier = 1
137  IF(ps_k_t(psv)<1 .OR. ps_k_t(psv)>kmax2) ier = 1
138  IF(ps_k_b(psv) > ps_k_t(psv)) ier = 1
139  IF(ps_j_s(psv) > ps_j_n(psv)) ier = 1
140  IF(ps_i_w(psv) > ps_i_e(psv)) ier = 1
141 
142  IF(ier /= 0)THEN
143  WRITE(err_msg,1101) psv, &
144  'X', ps_x_w(psv), ps_x_e(psv),'I',ps_i_w(psv),ps_i_e(psv), &
145  'Y', ps_y_s(psv), ps_y_n(psv),'J',ps_j_s(psv),ps_j_n(psv), &
146  'Z', ps_z_b(psv), ps_z_t(psv),'K',ps_k_b(psv),ps_k_t(psv)
147  CALL flush_err_msg(abort=.true.)
148  ENDIF
149 
150  1101 FORMAT('Error 1101: Invalid location specified for PS ',i3,'.', &
151  3(/3x,a1,': ',g12.5,',',g12.5,8x,a1,': ',i8,',',i8),/ &
152  'Please correct the mfix.dat file.')
153 
154  CALL finl_err_msg
155 
156  RETURN
157  END SUBROUTINE get_ps
integer, dimension(dimension_ps) ps_i_w
Definition: ps_mod.f:40
subroutine calc_cell(RMIN, REACTOR_LOC, D_DIR, N_DIR, CELL_LOC)
Definition: calc_cell.f:14
integer imax2
Definition: geometry_mod.f:61
subroutine finl_err_msg
logical no_i
Definition: geometry_mod.f:20
double precision, dimension(0:dim_j) dy
Definition: geometry_mod.f:70
integer, dimension(dimension_ps) ps_j_n
Definition: ps_mod.f:43
double precision, dimension(dimension_ps) ps_y_n
Definition: ps_mod.f:35
double precision, parameter undefined
Definition: param1_mod.f:18
double precision, dimension(0:dim_k) dz
Definition: geometry_mod.f:72
double precision, dimension(dimension_ps) ps_z_b
Definition: ps_mod.f:36
double precision, dimension(dimension_ps) ps_x_e
Definition: ps_mod.f:33
integer imax
Definition: geometry_mod.f:47
double precision, dimension(dimension_ps) ps_x_w
Definition: ps_mod.f:32
subroutine init_err_msg(CALLER)
integer, dimension(dimension_ps) ps_k_b
Definition: ps_mod.f:44
integer jmax2
Definition: geometry_mod.f:63
subroutine get_ps(PSV)
Definition: get_ps.f:10
double precision, dimension(0:dim_i) dx
Definition: geometry_mod.f:68
integer kmax2
Definition: geometry_mod.f:65
double precision, dimension(dimension_ps) ps_y_s
Definition: ps_mod.f:34
integer, dimension(dimension_ps) ps_k_t
Definition: ps_mod.f:45
Definition: param_mod.f:2
integer kmax
Definition: geometry_mod.f:51
subroutine location_check(CELL_SPECIFIED, CELL_CALCULATED, COUNTER, MESSAGE)
logical no_k
Definition: geometry_mod.f:28
logical no_j
Definition: geometry_mod.f:24
integer, parameter undefined_i
Definition: param1_mod.f:19
character(len=line_length), dimension(line_count) err_msg
double precision, dimension(dimension_ps) ps_z_t
Definition: ps_mod.f:37
double precision xmin
Definition: geometry_mod.f:75
integer jmax
Definition: geometry_mod.f:49
Definition: ps_mod.f:22
integer, dimension(dimension_ps) ps_j_s
Definition: ps_mod.f:42
integer, dimension(dimension_ps) ps_i_e
Definition: ps_mod.f:41
double precision, dimension(:), allocatable x
Definition: geometry_mod.f:129
double precision, parameter zero
Definition: param1_mod.f:27
subroutine calc_loc(RMIN, D_DIR, CELL_LOC, REACTOR_LOC)
Definition: calc_cell.f:76
subroutine flush_err_msg(DEBUG, HEADER, FOOTER, ABORT, LOG, CALL_TREE)