ADflow  v1.0
ADflow is a finite volume RANS solver tailored for gradient-based aerodynamic design optimization.
cgnsGrid.F90
Go to the documentation of this file.
1 module cgnsgrid
2 !
3 ! This module contains the derived data type for storing the
4 ! information of the original cgns grid file. Information stored
5 ! is number of blocks, block sizes, zone names, etc. this info
6 ! is needed again when the solution is written to file. Remember
7 ! that the original blocks may be split to obtain a better
8 ! load balance. Note that this info is stored on all processors.
9 ! Apart from the derived data type for the cgns blocks, this
10 ! module also contains the name of the base and the physical
11 ! dimensions of the problem.
12 !
13  use constants, only: inttype, realtype, maxcgnsnamelen, one
14 #ifndef USE_TAPENADE
15  use su_cgns
16 #endif
17  implicit none
18  save
19 !
20 ! The definition of the derived datatype to store the actual
21 ! data of the boundary conditions.
22 !
24 
25  ! The units in which the data is specified.
26 
27  integer :: mass, len, time, temp, angle
28 
29  ! The name of the array.
30 
31  character(len=maxCGNSNameLen) :: arrayname
32 
33  ! Number of dimensions for which the data is specified.
34 
35  integer :: ndimensions
36 
37  ! Number of data points of every dimensions. upper limit is
38  ! three, although for BC data the maximum is usually 2.
39 
40  integer(kind=cgsize_t), dimension(3) :: datadim
41 
42  ! The actual data. Assumed is that only floating point data
43  ! is prescribed and not integer or character data. Note that
44  ! dataArr is a 1D array even if the data is multi-dimensional.
45 
46  real(kind=realtype), pointer, dimension(:) :: dataarr
47 
48  end type cgnsbcdataarray
49 
50 #ifndef USE_TAPENADE
52  TYPE(cgnsbcdataarray_d), DIMENSION(:), POINTER :: dirichletarrays
53  END TYPE cgnsbcdatasettype_d
54 
56  REAL(kind=realtype), DIMENSION(:), POINTER :: dataarr
57  END TYPE cgnsbcdataarray_d
58 
60  TYPE(cgnsbcdataarray_b), DIMENSION(:), POINTER :: dirichletarrays
61  END TYPE cgnsbcdatasettype_b
62 
64  REAL(kind=realtype), DIMENSION(:), POINTER :: dataarr
65  END TYPE cgnsbcdataarray_b
66 
67 #endif
68 
69 !
70 ! The definition of the derived datatype to store the prescribed
71 ! boundary data for a boundary subface.
72 !
74 
75  ! Name of the dataset.
76 
77  character(len=maxCGNSNameLen) :: datasetname
78 
79  ! Boundary condition type.
80 
81  integer :: bctype
82 
83  ! The number of Dirichlet arrays in the data set.
84 
85  integer(kind=intType) :: ndirichletarrays
86 
87  ! The number of Neumann arrays in the data set.
88 
89  integer(kind=intType) :: nneumannarrays
90 
91  ! The Dirichlet arrays.
92 
93  type(cgnsbcdataarray), pointer, dimension(:) :: dirichletarrays
94 
95  ! The Neumann arrays.
96 
97  type(cgnsbcdataarray), pointer, dimension(:) :: neumannarrays
98 
99  end type cgnsbcdatasettype
100 !
101 ! The definition of the derived data type to store cgns 1 to 1
102 ! block to block, i.e. continuous grid lines across block
103 ! boundaries, connectivities.
104 !
106 
107  ! Name of the interface.
108 
109  character(len=maxCGNSNameLen) :: connectname
110 
111  ! Name of the zone/block interfacing with the current zone/block.
112 
113  character(len=maxCGNSNameLen) :: donorname
114 
115  ! Zone/block ID of the zone/block interfacing with the current
116  ! zone/block.
117 
118  integer(kind=intType) :: donorblock
119 
120  ! Range of points of this subface.
121 
122  integer(kind=intType) :: ibeg, jbeg, kbeg
123  integer(kind=intType) :: iend, jend, kend
124 
125  ! Range of points for the donor block.
126 
127  integer(kind=intType) :: dibeg, djbeg, dkbeg
128  integer(kind=intType) :: diend, djend, dkend
129 
130  ! Short hand notation defining the relative orientation of the
131  ! two zones.
132 
133  integer(kind=intType) :: l1, l2, l3
134 
135  ! Whether or not the subface is a periodic boundary.
136 
137  logical :: periodic
138 
139  ! The center of rotation for a periodic boundary.
140 
141  real(kind=realtype), dimension(3) :: rotationcenter
142 
143  ! The rotation angles for a periodic boundary.
144 
145  real(kind=realtype), dimension(3) :: rotationangles
146 
147  ! The translation vector for a periodic boundary.
148 
149  real(kind=realtype), dimension(3) :: translation
150 
151  end type cgns1to1conntype
152 !
153 ! The definition of the derived data type to store cgns
154 ! non-matching abutting block to block connectivities.
155 !
157 
158  ! Number of donor blocks. It is possible that the subface
159  ! abuts multiple donor blocks.
160 
161  integer(kind=intType) :: ndonorblocks
162 
163  ! Names of the interfaces. Dimension [nDonorBlocks].
164 
165  character(len=maxCGNSNameLen), pointer, dimension(:) :: &
166  connectnames
167 
168  ! Names of the zone/block interfacing with the current
169  ! zone/block. Dimension [nDonorBlocks].
170 
171  character(len=maxCGNSNameLen), pointer, dimension(:) :: &
172  donornames
173 
174  ! Zone/block IDs of the zones/blocks interfacing with the
175  ! current zone/block. Dimension [nDonorBlocks].
176 
177  integer(kind=intType), pointer, dimension(:) :: donorblocks
178 
179  ! Range of points of this subface.
180 
181  integer(kind=intType) :: ibeg, jbeg, kbeg
182  integer(kind=intType) :: iend, jend, kend
183 
184  ! Block face IDs of the donor blocks, which abut this subface.
185  ! Dimension [nDonorBlocks].
186 
187  integer(kind=intType), pointer, dimension(:) :: donorfaceids
188 
189  ! Whether or not the subface is a periodic boundary.
190 
191  logical :: periodic
192 
193  ! The center of rotation for a periodic boundary.
194 
195  real(kind=realtype), dimension(3) :: rotationcenter
196 
197  ! The rotation angles for a periodic boundary.
198 
199  real(kind=realtype), dimension(3) :: rotationangles
200 
201  ! The translation vector for a periodic boundary.
202 
203  real(kind=realtype), dimension(3) :: translation
204 
206 !
207 ! The definition of the derived data type to store cgns block
208 ! boundary conditions.
209 !
211 
212  ! Name of the boundary condition.
213 
214  character(len=maxCGNSNameLen) :: boconame
215 
216  ! CGNS and internal boundary condition type.
217 
218  integer :: bctypecgns
219  integer(kind=intType) :: bctype
220 
221  ! Name of the CGNS user defined data node if the CGNS
222  ! boundary condition is CG_UserDefined.
223 
224  character(len=maxCGNSNameLen) :: userdefinedname
225 
226  ! The way the boundary condition faces are specified; either
227  ! a point range or an individual set of points.
228 
229  integer :: ptsettype
230 
231  ! Number of points in the boundary condition set defining this
232  ! boundary region. For a point range this is 2.
233 
234  integer(kind=intType) :: npnts
235 
236  ! Index vector indicating the computational coordinate
237  ! direction of the boundary condition patch normal.
238 
239  integer :: normalindex(3)
240 
241  ! A flag indicating whether or not boundary normals are defined.
242  ! normalListFlag == 0: normals are not defined.
243  ! normalListFlag == 1: normals are defined.
244 
245  integer(kind=cgsize_t) :: normallistflag
246 
247  ! Data type used for the definition of the normals. Admissible
248  ! types are realSingle and realDouble.
249 
250  integer :: normaldatatype
251 
252  ! Corresponding family number. If the face does not belong to
253  ! a family this value is 0.
254 
255  integer(kind=intType) :: familyid
256 
257  ! The number of the sliding mesh interface of which this
258  ! boco is part. 0 means that this family is not part of a
259  ! sliding mesh interface. This value can be positive and
260  ! negative in order to distinguish between the two sides of the
261  ! interface. The absolute value is the actual ID of the
262  ! interface.
263 
264  integer(kind=intType) :: slidingid
265 
266  ! Number of boundary condition datasets for the current
267  ! boundary condition.
268 
269  integer(kind=intType) :: ndataset
270 
271  ! The actual boundary condition data sets.
272 
273  type(cgnsbcdatasettype), pointer, dimension(:) :: dataset
274 
275  ! Whether or not I actually allocated the memory for data_set.
276  ! It is possible that data_set points to corresponding entry
277  ! of a family.
278 
279  logical :: datasetallocated
280 
281  ! The rotation center and rotation rate of the boundary face.
282  ! It is possible that this differs from the rotation rate of
283  ! the corresponding block, e.g. for a casing in a
284  ! turbomachinery problem.
285 
286  real(kind=realtype), dimension(3) :: rotcenter, rotrate
287 
288  ! Range of points of this subface.
289 
290  integer(kind=intType) :: ibeg, jbeg, kbeg
291  integer(kind=intType) :: iend, jend, kend
292 
293  ! Whether or not this subface is an actual face. Some mesh
294  ! generators (such as ICEM CFD hexa) include edges and points
295  ! as boundary conditions. These should not be considered by
296  ! the flow solver. in those cases, actual_face is .false.
297 
298  logical :: actualface
299 
300  character(len=maxCGNSNameLen) :: wallbcname
301 
302  end type cgnsbocotype
303 !
304 ! The definition of the derived data type to store the data of a
305 ! cgns block.
306 !
308 !
309 ! Information read from the cgns file.
310 !
311  ! The type of the zone. Should be structured. Note that this
312  ! is an integer and not integer(kind=intType).
313 
314  integer :: zonetype
315 
316  ! Zone name for this block.
317 
318  character(len=maxCGNSNameLen) :: zonename
319 
320  ! The number or subblocks and the processor ID's on which they
321  ! are stored. Due to the possibility of splitting the block
322  ! during runtime, multiple processors could store a part of
323  ! the block.
324 
325  integer :: nsubblocks
326  integer, dimension(:), pointer :: procstored
327 
328  ! The local block ID's of the subblocks.
329 
330  integer, dimension(:), pointer :: localblockid
331 
332  ! The corresponding nodal ranges of the subblocks.
333 
334  integer, dimension(:), pointer :: ibegor, jbegor, kbegor
335  integer, dimension(:), pointer :: iendor, jendor, kendor
336 
337  ! The units in which the grid is specified.
338 
339  integer :: mass, len, time, temp, angle
340 
341  ! Whether or not grid units are specified.
342 
343  logical :: gridunitsspecified
344 
345  ! The conversion factor to meters for this block.
346 
347  real(kind=realtype) :: lref
348 
349  ! Corresponding family number. If the block does not belong to
350  ! a family this value is 0.
351 
352  integer(kind=intType) :: familyid
353 
354  ! Nodal block dimensions.
355 
356  integer(kind=intType) :: il, jl, kl
357 
358  ! Cell block dimensions.
359 
360  integer(kind=intType) :: nx, ny, nz
361 
362  ! Total number of 1 to 1 block to block connectivities, i.e.
363  ! continous grid lines, for this block. Also the number of
364  ! 1 to 1 connectivities stored in general connectivity nodes
365  ! is incorporated in n1to1.
366 
367  integer(kind=intType) :: n1to1
368 
369  ! Number of 1 to 1 block to block connectivities stored in
370  ! general connectivities.
371 
372  integer(kind=intType) :: n1to1general
373 
374  ! Array of 1 to 1 block to block connectivities.
375 
376  type(cgns1to1conntype), pointer, dimension(:) :: conn1to1
377 
378  ! Number of non-matching abutting block to block
379  ! connectivities.
380 
381  integer(kind=intType) :: nnonmatchabutting
382 
383  ! Array of non-matching abutting block to block connectivities.
384 
385  type(cgnsnonmatchabuttingconntype), pointer, dimension(:) :: &
386  connnonmatchabutting
387 
388  ! Number of boundary conditions for this block.
389 
390  integer(kind=intType) :: nbocos
391 
392  ! Array of boundary conditions.
393 
394  type(cgnsbocotype), pointer, dimension(:) :: bocoinfo
395 
396  ! Whether or not a rotating frame is specified.
397 
398  logical :: rotatingframespecified
399 
400  ! The corresponding rotation center and rotation rate.
401 
402  real(kind=realtype), dimension(3) :: rotcenter, rotrate
403 
404  ! Whether or not a the BCs in this zone have families.
405 
406  logical :: bcfamilies
407 
408  ! Cluster indentifier of multiblock "cluser" in overset mesh
409  integer(kind=intType) :: cluster
410 
411  ! Overset Priority scaling. Not currently read from CGNS
412  ! file, but could be in the future. Property of CGNS block so
413  ! it's stored here. Set from python options
414  real(kind=realtype) :: priority = one
415 
416  ! ViscousDir is whether or no there is a viscous direction in I/J/K
417  logical, dimension(3) :: viscousdir = [.false., .false., .false.]
418 
419  end type cgnsblockinfotype
420 !
421 ! The definition of the derived data type to store the data of a
422 ! cgns family.
423 !
425 
426  ! Name of the family.
427 
428  character(len=maxCGNSNameLen) :: familyname
429 
430  ! Type of the boundary condition and family BC name.
431 
432  integer :: bctypecgns
433  integer(kind=intType) :: bctype
434 
435  character(len=maxCGNSNameLen) :: bcname
436 
437  ! Name of the CGNS user defined data node if the CGNS
438  ! boundary condition is CG_UserDefined.
439 
440  character(len=maxCGNSNameLen) :: userdefinedname
441 
442  ! The number of the sliding mesh interface of which this
443  ! family is part. 0 means that this family is not part of a
444  ! sliding mesh interface. This value can be positive and
445  ! negative in order to distinguish between the two sides of the
446  ! interface. The absolute value is the actual ID of the
447  ! interface.
448 
449  integer(kind=intType) :: slidingid
450 
451  ! The number of the bleed flow region of which this family is
452  ! part. 0 means that this family does not belong to a bleed
453  ! flow region. There is no need to distinguish between an
454  ! inflow and an outflow bleed, because they have different
455  ! boundary conditions.
456 
457  integer(kind=intType) :: bleedregionid
458 
459  ! Whether or not the mass flow must be monitored for this family.
460 
461  logical :: monitormassflow
462 
463  ! Number of boundary condition datasets for this family.
464 
465  integer(kind=intType) :: ndataset
466 
467  ! The actual boundary condition data sets.
468 
469  type(cgnsbcdatasettype), pointer, dimension(:) :: dataset
470 
471  ! Whether or not a rotating frame is specified.
472 
473  logical :: rotatingframespecified
474 
475  ! The corresponding rotation center and rotation rate.
476 
477  real(kind=realtype), dimension(3) :: rotcenter, rotrate
478 
479  end type cgnsfamilytype
480 !
481 ! Definition of the variables stored in this module.
482 !
483  ! Dimensions of the cell and of the physical dimensions.
484  ! Both should be 3 for this code. Note that these are integers
485  ! and not integers(kind=intType).
486 
488 
489  ! Number of blocks (zones) in the cgns grid.
490 
491  integer(kind=intType) :: cgnsndom
492 
493  ! Array of cgns blocks.
494 
495  type(cgnsblockinfotype), allocatable, dimension(:) :: cgnsdoms
496  type(cgnsblockinfotype), allocatable, dimension(:) :: cgnsdomsd
497 
498  ! Number of families in the cgns grid.
499 
500  integer(kind=intType) :: cgnsnfamilies
501 
502  ! Array of families.
503 
504  type(cgnsfamilytype), allocatable, dimension(:) :: cgnsfamilies
505 
506  ! Number of sliding mesh interfaces in the grid.
507 
508  integer(kind=intType) :: cgnsnsliding
509 
510  ! The corresponding family ID's of the sliding interfaces.
511 
512  integer(kind=intType), allocatable, dimension(:, :) :: famidssliding
513 
514  ! Number of domain interfaces, i.e. interfaces with other CFD
515  ! codes, in the grid.
516 
517  integer(kind=intType) :: cgnsndomaininterfaces
518 
519  ! The family and BC ID's of the domain interfaces.
520 
521  integer(kind=intType), allocatable, dimension(:) :: &
523  integer(kind=intType), allocatable, dimension(:, :) :: &
525 
526  ! Name of the cgns base.
527 
528  character(len=maxCGNSNameLen) :: cgnsbasename
529 
530  ! massFlowFamilyInv(:,:): Array to store the local contributions
531  ! from the central part of the flux to
532  ! the mass flow of a family and the
533  ! sliding mesh interfaces. Dimension is
534  ! (0:nn,nTimeIntervalsSpectral, where
535  ! nn is the number of families for which
536  ! the mass flow must be monitored plus
537  ! 2*cgnsNSliding (if the mass flow through
538  ! the sliding interfaces must be monitored).
539  ! The reason for 2*cgnsNSliding is that each
540  ! side of a sliding interface is monitored.
541  ! The first index starts at 0 to store
542  ! all the faces that are not on a
543  ! sliding interface.
544  ! massFlowFamilyDiss(:,:): Idem for the dissipative part.
545 
546  real(kind=realtype), allocatable, dimension(:, :) :: massflowfamilyinv
547  real(kind=realtype), allocatable, dimension(:, :) :: massflowfamilydiss
548 
549 end module cgnsgrid
type(cgnsblockinfotype), dimension(:), allocatable cgnsdoms
Definition: cgnsGrid.F90:495
integer(kind=inttype), dimension(:, :), allocatable famidssliding
Definition: cgnsGrid.F90:512
integer(kind=inttype) cgnsndomaininterfaces
Definition: cgnsGrid.F90:517
integer(kind=inttype), dimension(:, :), allocatable bcidsdomaininterfaces
Definition: cgnsGrid.F90:523
type(cgnsfamilytype), dimension(:), allocatable cgnsfamilies
Definition: cgnsGrid.F90:504
character(len=maxcgnsnamelen) cgnsbasename
Definition: cgnsGrid.F90:528
real(kind=realtype), dimension(:, :), allocatable massflowfamilydiss
Definition: cgnsGrid.F90:547
integer(kind=inttype) cgnsnfamilies
Definition: cgnsGrid.F90:500
integer(kind=inttype) cgnsnsliding
Definition: cgnsGrid.F90:508
integer(kind=inttype), dimension(:), allocatable famidsdomaininterfaces
Definition: cgnsGrid.F90:521
real(kind=realtype), dimension(:, :), allocatable massflowfamilyinv
Definition: cgnsGrid.F90:546
integer cgnscelldim
Definition: cgnsGrid.F90:487
type(cgnsblockinfotype), dimension(:), allocatable cgnsdomsd
Definition: cgnsGrid.F90:496
integer cgnsphysdim
Definition: cgnsGrid.F90:487
integer(kind=inttype) cgnsndom
Definition: cgnsGrid.F90:491
real(kind=realtype), parameter one
Definition: constants.F90:72
integer, parameter maxcgnsnamelen
Definition: constants.F90:17