File: N:\mfix\model\geometry_mod.f

1     !vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvC
2     !                                                                      C
3     !  Module name: geometry                                               C
4     !  Purpose: Common block containing geometry and discretization data   C
5     !                                                                      C
6     !  Author: M. Syamlal                                 Date: dd-mmm-yy  C
7     !                                                                      C
8     !                                                                      C
9     !^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^C
10     
11           MODULE geometry
12     
13           Use param, only: DIM_I, DIM_J, DIM_K
14     
15     
16     ! Coordinates: CARTESIAN, CYLINDRICAL
17           CHARACTER(LEN=16)     COORDINATES
18     
19     ! Indicates whether x or r direction is not considered
20           LOGICAL :: NO_I
21     ! Indicates whether x or r direction is considered
22           LOGICAL :: DO_I
23     ! Indicates whether y direction is not considered
24           LOGICAL :: NO_J
25     ! Indicates whether y direction is considered
26           LOGICAL :: DO_J
27     ! Indicates whether z or theta direction is not considered
28           LOGICAL :: NO_K
29     ! Indicates whether z or theta direction is considered
30           LOGICAL :: DO_K
31     
32     ! Reactor length in the x or r direction
33           DOUBLE PRECISION :: XLENGTH
34     ! Reactor length in the y direction
35           DOUBLE PRECISION :: YLENGTH
36     ! Reactor length in the z or theta direction
37           DOUBLE PRECISION :: ZLENGTH
38     
39     ! Starting index in the x or r direction
40           INTEGER :: IMIN1
41     ! Starting index in the y direction
42           INTEGER :: JMIN1
43     ! Starting index in the z or theta direction
44           INTEGER :: KMIN1
45     
46     ! Number of cells in the x or r direction
47           INTEGER :: IMAX
48     ! Number of cells in the y direction
49           INTEGER :: JMAX
50     ! Number of cells in the z or theta direction
51           INTEGER :: KMAX
52     
53     ! Number of cells in the x or r direction + 1
54           INTEGER :: IMAX1
55     ! Number of cells in the y direction + 1
56           INTEGER :: JMAX1
57     ! Number of cells in the z or theta direction + 1
58           INTEGER :: KMAX1
59     
60     ! Number of cells in the x or r direction + 2
61           INTEGER :: IMAX2
62     ! Number of cells in the y direction + 2
63           INTEGER :: JMAX2
64     ! Number of cells in the z or theta direction + 2
65           INTEGER :: KMAX2
66     
67     ! Cell sizes in the x or r direction
68           DOUBLE PRECISION :: DX (0:DIM_I)
69     ! Cell sizes in the y direction
70           DOUBLE PRECISION :: DY (0:DIM_J)
71     ! Cell sizes in the z or theta direction
72           DOUBLE PRECISION :: DZ (0:DIM_K)
73     ! Starting value of X.  This quantity is useful for
74     ! simulating an annular cylindrical region.
75           DOUBLE PRECISION :: XMIN
76     
77     ! IMAX2 * JMAX2
78           INTEGER :: IJMAX2
79     ! IMAX2 * JMAX2 * KMAX2
80           INTEGER :: IJKMAX2
81     ! IMAX2 * JMAX2 * KMAX2
82           INTEGER :: IJKMAX3
83     ! IJMAX2 + 1
84           INTEGER :: IJKMIN1
85     ! IJKMAX2 - IJMAX2
86           INTEGER :: IJKMAX1
87     
88     ! For discretization in parallel
89           INTEGER :: IMIN2, JMIN2, KMIN2
90           INTEGER :: IMIN3, JMIN3, KMIN3
91           INTEGER :: IMAX3, JMAX3, KMAX3
92     
93     ! For 4th order discretization in parallel
94           INTEGER :: IMIN4, JMIN4, KMIN4
95           INTEGER :: IMAX4, JMAX4, KMAX4
96           INTEGER :: IJKMAX4, IJKMIN4
97     
98     ! Cell flags.
99           INTEGER, DIMENSION(:), ALLOCATABLE :: FLAG
100     ! Cell flags with 3rd layer.
101           INTEGER, DIMENSION(:), ALLOCATABLE :: FLAG3
102     ! Flag for the East surface
103           INTEGER, DIMENSION(:), ALLOCATABLE :: FLAG_E
104     ! Flag for North surface
105           INTEGER, DIMENSION(:), ALLOCATABLE :: FLAG_N
106     ! Flag for Top surface
107           INTEGER, DIMENSION(:), ALLOCATABLE :: FLAG_T
108     ! Cell flags (bc/ic conditions)
109     ! Allocatable type causes PG internal error, Ed's soln: pointers
110     !      CHARACTER(LEN=3), DIMENSION(:), ALLOCATABLE :: ICBC_FLAG
111           character(LEN=3),  dimension(:), pointer :: icbc_flag
112     
113     ! 1 / dx_i
114           DOUBLE PRECISION, DIMENSION(:), ALLOCATABLE :: oDX
115     ! 1 / dy_j
116           DOUBLE PRECISION, DIMENSION(:), ALLOCATABLE :: oDY
117     ! 1 / dz_k
118           DOUBLE PRECISION, DIMENSION(:), ALLOCATABLE :: oDZ
119     
120     ! 1 / dx_i+1/2
121           DOUBLE PRECISION, DIMENSION(:), ALLOCATABLE :: oDX_E
122     ! 1 / dy_j+1/2
123           DOUBLE PRECISION, DIMENSION(:), ALLOCATABLE :: oDY_N
124     ! 1 / dz_k+1/2
125           DOUBLE PRECISION, DIMENSION(:), ALLOCATABLE :: oDZ_T
126     
127     ! Radial location at cell center (x_i).
128     ! X = 1 in Cartesian coordinates.
129           DOUBLE PRECISION, DIMENSION(:), ALLOCATABLE :: X
130     ! Azimuthal location at cell center (z_k).
131           DOUBLE PRECISION, DIMENSION(:), ALLOCATABLE :: Z
132     ! Radial location at East face (x_i+1/2).
133     ! X_E = 1 in Cartesian coordinates.
134           DOUBLE PRECISION, DIMENSION(:), ALLOCATABLE ::  X_E
135     !  Azimuthal location at top face (z_k+1/2).
136           DOUBLE PRECISION, DIMENSION(:), ALLOCATABLE :: Z_T
137     
138     ! Reciprocal of radial location at cell center (1/x_i).
139     ! oX = 1 in Cartesian coordinates.
140           DOUBLE PRECISION, DIMENSION(:), ALLOCATABLE ::  oX
141     ! Reciprocal of radial location at East face (1/x_i+1/2).
142     ! oX_E = 1 in Cartesian coordinates.
143           DOUBLE PRECISION, DIMENSION(:), ALLOCATABLE ::  oX_E
144     
145     
146     !  one or more periodic boundary condition is used
147           LOGICAL :: CYCLIC
148     ! Variable to flag periodic boundary condition in X
149           LOGICAL :: CYCLIC_X
150     ! Variable to flag periodic boundary condition in Y
151           LOGICAL :: CYCLIC_Y
152     ! Variable to flag periodic boundary condition in Z
153           LOGICAL :: CYCLIC_Z
154     ! Variable to flag periodic bc with pressure drop in X
155           LOGICAL :: CYCLIC_X_PD
156     ! Variable to flag periodic bc with pressure drop in Y
157           LOGICAL :: CYCLIC_Y_PD
158     ! Variable to flag periodic bc with pressure drop in Z
159           LOGICAL :: CYCLIC_Z_PD
160     ! Variable to flag periodic bc with mass flux in X
161           LOGICAL :: CYCLIC_X_MF
162     ! Variable to flag periodic bc with mass flux in Y
163           LOGICAL :: CYCLIC_Y_MF
164     ! Variable to flag periodic bc with mass flux in Z
165           LOGICAL :: CYCLIC_Z_MF
166     
167     ! Variable to flag cylindrical coordinates
168           LOGICAL :: CYLINDRICAL
169     
170     ! Variables for cylindrical_2d simulation
171     !------------------------------------------------------------>>>
172     ! Turn on the cylindrical_2d simulation
173           logical :: CYLINDRICAL_2D
174     ! Variables for cylindrical_2d simulation
175     ! Half width of the plate in term of cell count
176           integer :: I_CYL_NUM
177     ! Variables for cylindrical_2d simulation
178     ! Cell number used to smooth the transition from plate to wedge
179           integer :: I_CYL_TRANSITION
180     ! For cylindrical_2d simulation
181           DOUBLE PRECISION, DIMENSION(:), ALLOCATABLE :: cyl_X
182     ! For cylindrical_2d simulation
183           DOUBLE PRECISION, DIMENSION(:), ALLOCATABLE :: cyl_X_E
184     !------------------------------------------------------------<<<
185     
186     ! Factor for x direction averaging of U velocity: FX_i
187           DOUBLE PRECISION, DIMENSION(:), ALLOCATABLE :: FX
188     ! 1 - FX_i
189           DOUBLE PRECISION, DIMENSION(:), ALLOCATABLE :: FX_bar
190     ! Factor for x direction averaging of scalars: FX_i+1/2
191           DOUBLE PRECISION, DIMENSION(:), ALLOCATABLE :: FX_E
192     ! 1 - FX_i+1/2
193           DOUBLE PRECISION, DIMENSION(:), ALLOCATABLE :: FX_E_bar
194     
195     ! Factor for y direction averaging of scalars: FY_j+1/2
196           DOUBLE PRECISION, DIMENSION(:), ALLOCATABLE :: FY_N
197     ! 1 - FY_j+1/2
198           DOUBLE PRECISION, DIMENSION(:), ALLOCATABLE :: FY_N_bar
199     
200     ! Factor for z direction averaging of scalars: FZ_k+1/2
201           DOUBLE PRECISION, DIMENSION(:), ALLOCATABLE :: FZ_T
202     ! 1 - FZ_k+1/2
203           DOUBLE PRECISION, DIMENSION(:), ALLOCATABLE :: FZ_T_bar
204     
205     ! East face area - scalar cell
206           DOUBLE PRECISION, DIMENSION(:), ALLOCATABLE :: AYZ
207     ! North face area - scalar cell
208           DOUBLE PRECISION, DIMENSION(:), ALLOCATABLE :: AXZ
209     ! Top face area - scalar cell
210           DOUBLE PRECISION, DIMENSION(:), ALLOCATABLE :: AXY
211     ! Cell volume - scalar cell
212           DOUBLE PRECISION, DIMENSION(:), ALLOCATABLE :: VOL
213     
214     ! Total volume of cell's DES stencil neighbors
215           DOUBLE PRECISION, DIMENSION(:), ALLOCATABLE :: VOL_SURR
216     
217     ! East face area - U cell
218           DOUBLE PRECISION, DIMENSION(:), ALLOCATABLE :: AYZ_U
219     ! North face area - U cell
220           DOUBLE PRECISION, DIMENSION(:), ALLOCATABLE :: AXZ_U
221     ! Top face area - U cell
222           DOUBLE PRECISION, DIMENSION(:), ALLOCATABLE :: AXY_U
223     ! Cell volume - U cell
224           DOUBLE PRECISION, DIMENSION(:), ALLOCATABLE :: VOL_U
225     
226     ! East face area - V cell
227           DOUBLE PRECISION, DIMENSION(:), ALLOCATABLE :: AYZ_V
228     ! North face area - V cell
229           DOUBLE PRECISION, DIMENSION(:), ALLOCATABLE :: AXZ_V
230     ! Top face area - V cell
231           DOUBLE PRECISION, DIMENSION(:), ALLOCATABLE :: AXY_V
232     ! Cell volume - V cell
233           DOUBLE PRECISION, DIMENSION(:), ALLOCATABLE :: VOL_V
234     
235     ! East face area - W cell
236           DOUBLE PRECISION, DIMENSION(:), ALLOCATABLE :: AYZ_W
237     ! North face area - W cell
238           DOUBLE PRECISION, DIMENSION(:), ALLOCATABLE :: AXZ_W
239     ! Top face area - W cell
240           DOUBLE PRECISION, DIMENSION(:), ALLOCATABLE :: AXY_W
241     ! Cell volume - W cell
242           DOUBLE PRECISION, DIMENSION(:), ALLOCATABLE :: VOL_W
243     
244     ! Indicates whether to use loop over "core" cells (with same
245     ! CELL_CLASS) in LEQSOL_MOD for vectorization/performance
246           LOGICAL :: USE_CORECELL_LOOP
247     
248           INTEGER :: CORE_ISTART, CORE_IEND
249           INTEGER :: CORE_JSTART, CORE_JEND
250           INTEGER :: CORE_KSTART, CORE_KEND
251     
252           END MODULE geometry
253