72 class(*),
target,
intent(inout) :: data
73 type(
mesh_t),
pointer :: msh
74 real(kind=
dp),
pointer :: params(:)
75 character(len=3),
pointer :: cbc(:, :)
76 integer,
allocatable :: curve_type(:, :)
77 logical,
allocatable :: curve_element(:)
78 character(len=1) :: chtemp
79 integer :: ndim, nparam, nskip, nlogic, ncurve
80 integer :: nelgs, nelgv, i, j, ierr, l
81 integer :: el_idx, pt_idx
82 logical :: read_param, read_bcs, read_map
83 real(kind=
dp) :: xc(8), yc(8), zc(8),
curve(5)
84 real(kind=
dp),
allocatable :: bc_data(:, :, :)
85 real(kind=
dp),
allocatable :: curve_data(:, :, :)
89 character(len=1024) :: re2_fname, map_fname, fname
90 integer :: start_el, end_el, nel, edge
94 integer :: sym_facet, pids(4), p_el_idx, p_facet
96 integer,
parameter,
dimension(6) :: facet_map = [3, 2, 4, 1, 5, 6]
97 logical :: curve_skip = .false.
98 character(len=LOG_SIZE) :: log_buf
101 integer :: user_labeled_zones(NEKO_MSH_MAX_ZLBLS)
102 integer :: labeled_zone_offsets(NEKO_MSH_MAX_ZLBLS)
103 integer :: total_labeled_zone_offset, current_internal_zone
104 total_labeled_zone_offset = 0
105 labeled_zone_offsets = 0
106 user_labeled_zones = 0
107 current_internal_zone = 1
114 params => data%params
126 if (read_param .and. read_bcs .and.
pe_size .gt. 1)
then
127 call neko_error(
'Reading NEKTON session data only implemented in serial')
130 fname = this%get_fname()
131 open(newunit = file_unit,
file = trim(fname), status =
'old', &
133 call neko_log%message(
'Reading NEKTON file ' // fname)
137 read(file_unit, *) ndim
138 read(file_unit, *) nparam
140 if (.not. read_param)
then
146 allocate(params(nparam))
148 read(file_unit, *) params(i)
153 read(file_unit, *) nskip
159 read(file_unit, *) nlogic
167 read(file_unit, *) nelgs, ndim, nelgv
168 if (nelgs .lt. 0)
then
169 re2_fname = trim(fname(1:scan(trim(fname),
'.', back = .true.))) //
're2'
173 write(log_buf, 1) ndim, nelgv
1741
format(
'gdim = ', i1,
', nelements = ', i7)
178 inquire(
file = map_fname, exist = read_map)
180 call nm%init(nelgv, 2**ndim)
184 call neko_log%warning(
'No NEKTON map file found')
189 nel = dist%num_local()
190 start_el = dist%start_idx() + 1
191 end_el = dist%end_idx() + 1
193 call msh%init(ndim, dist)
195 call htp%init(2**ndim * nel, ndim)
201 if (ndim .eq. 2)
then
202 read(file_unit, *) (xc(j), j = 1, 4)
203 read(file_unit, *) (yc(j), j = 1, 4)
204 if (i .ge. start_el .and. i .le. end_el)
then
211 call msh%add_element(el_idx, el_idx, p(1), p(2), p(4), p(3))
213 else if (ndim .eq. 3)
then
214 read(file_unit, *) (xc(j), j = 1, 4)
215 read(file_unit, *) (yc(j), j = 1, 4)
216 read(file_unit, *) (zc(j), j = 1, 4)
217 read(file_unit, *) (xc(j), j = 5, 8)
218 read(file_unit, *) (yc(j), j = 5, 8)
219 read(file_unit, *) (zc(j), j = 5, 8)
220 if (i .ge. start_el .and. i .le. end_el)
then
222 call p(j)%init(
real(xc(j), dp),
real(yc(j), dp), &
227 call msh%add_element(el_idx, el_idx, &
228 p(1), p(2), p(4), p(3), p(5), p(6), p(8), p(7))
231 if (i .ge. start_el .and. i .le. end_el)
then
239 read(file_unit, *) ncurve
240 allocate(curve_data(5, 8, nelgv))
241 allocate(curve_element(nelgv))
242 allocate(curve_type(8, nelgv))
244 curve_element(i) = .false.
248 curve_data(l, j, i) = 0d0
253 read(file_unit, *) edge, el_idx, (
curve(j), j = 1, 5), chtemp
255 curve_data(j, edge, el_idx) =
curve(j)
257 curve_element(el_idx) = .true.
258 select case (trim(chtemp))
260 curve_type(edge, el_idx) = 1
263 curve_type(edge, el_idx) = 2
266 curve_type(edge, el_idx) = 3
268 curve_type(edge, el_idx) = 4
272 call neko_log%warning(
'Curve type: s, e are not supported, ' // &
273 'treating mesh as non-curved.')
276 if (curve_element(el_idx))
then
277 call msh%mark_curve_element(el_idx, &
278 curve_data(1, 1, el_idx), curve_type(1, el_idx))
282 deallocate(curve_data)
283 deallocate(curve_element)
284 deallocate(curve_type)
289 if (.not. read_bcs)
then
291 allocate(cbc(6, nelgv))
292 allocate(bc_data(6, 2*ndim, nelgv))
295 if (nelgv .lt. 1000) off = 1
297 if (i .ge. start_el .and. i .le. end_el)
then
298 el_idx = i - start_el + 1
300 read(file_unit, *) cbc(j, i), (bc_data(l, j, i), l = 1, 6)
301 sym_facet = facet_map(j)
303 select case (trim(cbc(j, i)))
307 current_internal_zone = current_internal_zone + 1
320 current_internal_zone = current_internal_zone + 1
332 current_internal_zone = current_internal_zone + 1
344 current_internal_zone = current_internal_zone + 1
356 current_internal_zone = current_internal_zone + 1
365 case (
's',
'sl',
'sh',
'shl',
'S',
'SL',
'SH',
'SHL')
368 current_internal_zone = current_internal_zone + 1
378 p_el_idx = int(bc_data(2+off, j, i))
379 p_facet = facet_map(int(bc_data(3+off, j, i)))
380 call msh%get_facet_ids(sym_facet, el_idx, pids)
381 call msh%mark_periodic_facet(sym_facet, el_idx, &
382 p_facet, p_el_idx, pids)
389 if (i .ge. start_el .and. i .le. end_el)
then
390 el_idx = i - start_el + 1
392 sym_facet = facet_map(j)
393 select case (trim(cbc(j, i)))
395 p_el_idx = int(bc_data(2+off, j, i))
396 p_facet = facet_map(int(bc_data(3+off, j, i)))
397 call msh%create_periodic_ids(sym_facet, el_idx, &
404 if (i .ge. start_el .and. i .le. end_el)
then
405 el_idx = i - start_el + 1
407 sym_facet = facet_map(j)
408 select case (trim(cbc(j, i)))
410 p_el_idx = int(bc_data(2+off, j, i))
411 p_facet = facet_map(int(bc_data(3+off, j, i)))
412 call msh%create_periodic_ids(sym_facet, el_idx, &
419 if (i .ge. start_el .and. i .le. end_el)
then
420 el_idx = i - start_el + 1
422 sym_facet = facet_map(j)
423 select case (trim(cbc(j, i)))
425 p_el_idx = int(bc_data(2+off, j, i))
426 p_facet = facet_map(int(bc_data(3+off, j, i)))
427 call msh%create_periodic_ids(sym_facet, el_idx, &
436 allocate(cbc(6, nelgv))
439 read(file_unit,
'(a1, a3)') chtemp, cbc(j, i)