-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSwanGridobjects.ftn90
194 lines (189 loc) · 10 KB
/
SwanGridobjects.ftn90
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
module SwanGridobjects
!
! --|-----------------------------------------------------------|--
! | Delft University of Technology |
! | Faculty of Civil Engineering and Geosciences |
! | Environmental Fluid Mechanics Section |
! | P.O. Box 5048, 2600 GA Delft, The Netherlands |
! | |
! | Programmer: Marcel Zijlema |
! --|-----------------------------------------------------------|--
!
!
! SWAN (Simulating WAves Nearshore); a third generation wave model
! Copyright (C) 1993-2024 Delft University of Technology
!
! This program is free software: you can redistribute it and/or modify
! it under the terms of the GNU General Public License as published by
! the Free Software Foundation, either version 3 of the License, or
! (at your option) any later version.
!
! This program is distributed in the hope that it will be useful,
! but WITHOUT ANY WARRANTY; without even the implied warranty of
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! GNU General Public License for more details.
!
! You should have received a copy of the GNU General Public License
! along with this program. If not, see <http://www.gnu.org/licenses/>.
!
!
! Authors
!
! 40.80: Marcel Zijlema
! 40.92: Marcel Zijlema
!
! Updates
!
! 40.80, July 2007: New Module
! 40.92, June 2008: new attribute for vertices: BPOL
!
! Purpose
!
! Module containing data structure for unstructured grids
!
! Method
!
! This module contains derived types for grid vertices, cells and faces
!
! Modules used
!
! none
!
implicit none
!
! Module parameters
!
!
! parameters for vertices
!
integer, parameter :: MINVERTCELL = 4 ! mininum number of cells around a vertex
integer, parameter :: MAXVERTCELL = 10 ! maximum number of cells around a vertex
!
integer, parameter :: MAXVERTATTI = 6 ! maximum number of attributes of type integer
! in data structure of vertices
integer, parameter :: VERTID = 1 ! identification number
integer, parameter :: VMARKER = 2 ! boundary marker for vertices
! vert(j)%atti(VMARKER) = 1 is a boundary vertex
! vert(j)%atti(VMARKER) = 0 is an internal vertex
integer, parameter :: VBC = 3 ! marker for vertices with boundary condition
! vert(j)%atti(VBC) = 1 is a vertex where b.c. is given
! vert(j)%atti(VBC) = 0 is a vertex where no b.c. is given
integer, parameter :: VERTF1 = 4 ! first face connecting to present vertex
integer, parameter :: VERTF2 = 5 ! second face connecting to present vertex
integer, parameter :: BPOL = 6 ! sequence number of boundary polygons
!
integer, parameter :: MAXVERTATTR = 2 ! maximum number of attributes of type real
! in data structure of vertices
integer, parameter :: VERTX = 1 ! x-component of vertex
integer, parameter :: VERTY = 2 ! y-component of vertex
!
! parameters for cells
!
integer, parameter :: MINCELLVERT = 3 ! mininum number of vertices in a cell
integer, parameter :: MAXCELLVERT = 5 ! maximum number of vertices in a cell
integer, parameter :: MINCELLFACE = 3 ! mininum number of faces in a cell
integer, parameter :: MAXCELLFACE = 5 ! maximum number of faces in a cell
!
integer, parameter :: MAXCELLATTI = 7 ! maximum number of attributes of type integer
! in data structure of cells
integer, parameter :: CELLID = 1 ! identification number
integer, parameter :: CMARKER = 2 ! boundary marker for cells
! cell(j)%atti(CMARKER) = 1 is a boundary cell
! cell(j)%atti(CMARKER) = 0 is an internal cell
integer, parameter :: NEXTCELL = 3 ! cell next to considered cell in counterclockwise direction
integer, parameter :: CELLRECT = 4 ! /=0 if cell is rectangle
integer, parameter :: CELLV1 = 5 ! first vertex number of present cell
integer, parameter :: CELLV2 = 6 ! second vertex number of present cell
integer, parameter :: CELLV3 = 7 ! third vertex number of present cell
!
integer, parameter :: MAXCELLATTR = 5 ! maximum number of attributes of type real
! in data structure of cells
integer, parameter :: CELLAREA = 1 ! area of cell
integer, parameter :: CELLCX = 2 ! x-component of cell centroid
integer, parameter :: CELLCY = 3 ! y-component of cell centroid
integer, parameter :: CELLCCX = 4 ! x-component of cell circumcenter
integer, parameter :: CELLCCY = 5 ! y-component of cell circumcenter
!
! parameters for faces
!
integer, parameter :: MAXFACEATTI = 9 ! maximum number of attributes of type integer
! in data structure of faces
integer, parameter :: FACEID = 1 ! identification number
integer, parameter :: FMARKER = 2 ! boundary marker for faces
! face(j)%atti(FMARKER) = 1 is a boundary face
! face(j)%atti(FMARKER) = 0 is an internal face
integer, parameter :: FACEV1 = 3 ! first vertex number of present face
integer, parameter :: FACEV2 = 4 ! second vertex number of present face
integer, parameter :: FACEC1 = 5 ! first cell number containing present face
integer, parameter :: FACEC2 = 6 ! second cell number containing present face
! The ordening is such, that:
! - face(j)%atti(FACEC1) < face(j)%atti(FACEC2) always
! - the first cell lies left of translation vector
! (second vertex - first vertex) and the second cell
! consequently lies right of this vector
integer, parameter :: FACECL = 7 ! left cell number containing present face
integer, parameter :: FACECR = 8 ! right cell number containing present face
! - the ordering is such that the normal to face is
! always pointing from left to right
integer, parameter :: FBTYPE = 9 ! boundary type given at boundary face
!
integer, parameter :: MAXFACEATTR = 8 ! maximum number of attributes of type real
! in data structure of faces
integer, parameter :: FACELEN = 1 ! length of face
integer, parameter :: FACENORMX = 2 ! x-component of normal to present face
integer, parameter :: FACENORMY = 3 ! y-component of normal to present face
integer, parameter :: FACEMX = 4 ! x-component of midpoint of present face
integer, parameter :: FACEMY = 5 ! y-component of midpoint of present face
integer, parameter :: FACEDISTC = 6 ! the distance between two circumcenters that lie on either
! side of face
integer, parameter :: FACEDISTG = 7 ! the distance between two centroids that lie on either
! side of face
integer, parameter :: FACELINPF = 8 ! the interpolation factor when interpolating two quantities
! in cell circumcenters adjacent to face j according to
! q_face = q_r + face(j)%attr(FACELINPF) (q_l - q_r),
! where l = face(j)%atti(FACECL) and r = face(j)%atti(FACECR)
!
! Module variables
!
! ---
!
! Source text
!
type geomtype
real :: det ! determinant
real :: dx1 , dx2 ! two components of covariant base vector a_(1)
real :: dy1 , dy2 ! two components of covariant base vector a_(2)
real :: rdx1, rdx2 ! first component of contravariant base vector rdx(b) = a^(b)_1
real :: rdy1, rdy2 ! second component of contravariant base vector rdy(b) = a^(b)_2
real :: th1 , th2 ! direction of faces pointing to present vertex
end type geomtype
type facetype
integer :: atti(MAXFACEATTI)
real :: attr(MAXFACEATTR)
end type facetype
type celltype
integer :: nov ! actual number of vertices in a cell
integer :: nof ! actual number of faces in a cell
logical :: active ! true if cell is active
type(geomtype) :: geom(MAXCELLVERT)
type(facetype) :: face(MAXCELLFACE)
integer :: atti(MAXCELLATTI)
real :: attr(MAXCELLATTR)
integer :: updated(MAXCELLVERT)
end type celltype
type verttype
integer :: noc ! actual number of cells around a vertex
logical :: active ! true if vertex is active
logical :: fullupdated ! true if vertex is updated in both geographic and spectral spaces
type(celltype) :: cell(MAXVERTCELL)
integer :: atti(MAXVERTATTI)
real :: attr(MAXVERTATTR)
integer :: updated(MAXVERTCELL)
end type verttype
type gridtype
type (verttype), dimension(:), pointer :: vert_grid
type (celltype), dimension(:), pointer :: cell_grid
type (facetype), dimension(:), pointer :: face_grid
end type gridtype
type(gridtype), target :: gridobject
end module SwanGridobjects