1 | include(dom.inc)
2 | ! ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 | !
4 | ! module: avbp_exBound
5 | ! read *.exBound files
6 | !
7 | ! author: Andre Kaufmann, 03.08.2000
8 | ! status: untested
9 | ! ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
10 |
11 | module avbp_exBound
12 |
13 | implicit none
14 |
15 | character*80 exBoundfile
16 | DOM_INT :: exBound_npart = 1
17 | DOM_INT :: exBound_mnbpatch = 0
18 | DOM_INT :: exBound_ntbound = 0
19 | DOM_INT :: exBound_ntbface = 0
20 | DOM_INT :: exBound_npbound = 0
21 | DOM_INT :: exBound_nbbegin = 0
22 | DOM_INT :: exBound_nblength = 0
23 | DOM_INT :: exBound_nbfbegin = 0
24 | DOM_INT :: exBound_nbflength = 0
25 | DOM_INT :: exBound_nbaxipoints = 0
26 | DOM_INT :: exBound_nbbndyconn = 0
27 | DOM_INT :: exBound_ndim = 0
28 | logical :: exBound_readaxiinfo = .false.
29 | logical :: exBound_readconninfo = .false.
30 |
31 | logical :: exBound_debug = .false.
32 | logical :: exBound_itexists = .false.
33 | logical :: exBound_show = .true.
34 |
35 | DOM_INT,dimension(:),allocatable :: exBound_ibound
36 | DOM_INT,dimension(:),allocatable :: exBound_ibound1
37 | DOM_INT,dimension(:),allocatable :: exBound_ibound2
38 | DOM_INT,dimension(:),allocatable :: exBound_ibfael
39 | DOM_INT,dimension(:),allocatable :: exBound_axipoints
40 | DOM_INT,dimension(:),allocatable :: exBound_bndyconn
41 | DOM_INT,dimension(:,:),allocatable :: exBound_ifbound
42 |
43 | DOM_REAL,dimension(:),allocatable :: exBound_snbound
44 |
45 | contains
46 | ! ================================================================
47 | !
48 | ! deallocate memory
49 | !
50 | ! ================================================================
51 | subroutine destroyexBoundmemory
52 | implicit none
53 | if(exBound_debug) then
54 | write(*,*) ' deallocating exBound memory ... '
55 | endif
56 | if(allocated(exBound_ibound)) deallocate(exBound_ibound)
57 | if(allocated(exBound_ibound1)) deallocate(exBound_ibound1)
58 | if(allocated(exBound_ibound2)) deallocate(exBound_ibound2)
59 | if(allocated(exBound_snbound)) deallocate(exBound_snbound)
60 | if(allocated(exBound_ibfael)) deallocate(exBound_ibfael)
61 | if(allocated(exBound_axipoints)) deallocate(exBound_axipoints)
62 | if(allocated(exBound_bndyconn)) deallocate(exBound_bndyconn)
63 | if(allocated(exBound_ifbound)) deallocate(exBound_ifbound)
64 |
65 | return
66 | end subroutine destroyexBoundmemory
67 | ! ================================================================
68 | !
69 | ! get the boundary info
70 | !
71 | ! ================================================================
72 | subroutine getexBoundinfo
73 | implicit none
74 | DOM_INT n,m,n1,n2,n3,n4,n5,n6,k
75 | DOM_INT read_iostatus
76 |
77 | if(exBound_debug) then
78 | write(*,*) 'getexBoundinfo ... '
79 | endif
80 |
81 | inquire(file=exBoundfile,exist=exBound_itexists)
82 |
83 | if(exBound_itexists) then
84 |
85 | n = len_trim(exBoundfile)
86 |
87 | open(unit=2,file=exBoundfile,form='unformatted')
88 |
89 | read(2,IOSTAT=read_iostatus) &
90 | & exBound_npart,exBound_mnbpatch, &
91 | & exBound_ntbound,exBound_ntbface
92 |
93 | if(exBound_debug.or.(read_iostatus.ne.0)) then
94 | write(*,*) '==================================='
95 | write(*,*) ' npart = ',exBound_npart
96 | write(*,*) ' mnbpatch = ',exBound_mnbpatch
97 | write(*,*) ' ntbound = ',exBound_ntbound
98 | write(*,*) ' ntbface = ',exBound_ntbface
99 | write(*,*) ' IOSTATUS = ',read_iostatus
100 | endif
101 |
102 | read(2,IOSTAT=read_iostatus) &
103 | & exBound_npbound,exBound_nbbegin, &
104 | & exBound_nblength,exBound_nbfbegin, &
105 | & exBound_nbflength
106 |
107 | if(exBound_debug.or.(read_iostatus.ne.0)) then
108 | write(*,*) '==================================='
109 | write(*,*) ' npbound = ',exBound_npbound
110 | write(*,*) ' nbbegin = ',exBound_nbbegin
111 | write(*,*) ' nblength = ',exBound_nblength
112 | write(*,*) ' nbfbegin = ',exBound_nbfbegin
113 | write(*,*) ' nbflength = ',exBound_nbflength
114 | write(*,*) ' IOSTATUS = ',read_iostatus
115 | endif
116 |
117 | else
118 | write(*,*) ' could not read exBoundfile ',exBoundfile
119 | endif
120 |
121 | return
122 | end subroutine getexBoundinfo
123 | ! ================================================================
124 | !
125 | ! read exBound file
126 | !
127 | ! ================================================================
128 | subroutine readexBound
129 | implicit none
130 | !
131 | ! local varialbes
132 | !
133 | DOM_INT :: n,m,n1,n2,n3,n4,n5,n6,n7,k
134 | DOM_INT :: read_iostatus,allocstat
135 |
136 | if(exBound_debug) then
137 | write(*,*) 'readexBound ... '
138 | endif
139 |
140 |
141 | inquire(file=exBoundfile,exist=exBound_itexists)
142 |
143 | if(exBound_itexists) then
144 |
145 | n = len_trim(exBoundfile)
146 | if (exBound_show) then
147 | write(*,*) ' >>>> Reading the exBound file ',exBoundfile(1:n)
148 | end if
149 |
150 | open(unit=2,file=exBoundfile,form='unformatted')
151 | read(2,IOSTAT=read_iostatus) &
152 | & exBound_npart,exBound_mnbpatch, &
153 | & exBound_ntbound,exBound_ntbface
154 |
155 | if(exBound_debug.or.(read_iostatus.ne.0)) then
156 | write(*,*) '==================================='
157 | write(*,*) ' npart = ',exBound_npart
158 | write(*,*) ' mnbpatch = ',exBound_mnbpatch
159 | write(*,*) ' ntbound = ',exBound_ntbound
160 | write(*,*) ' ntbface = ',exBound_ntbface
161 | write(*,*) ' IOSTATUS = ',read_iostatus
162 | endif
163 | read(2,IOSTAT=read_iostatus) &
164 | & exBound_npbound,exBound_nbbegin, &
165 | & exBound_nblength,exBound_nbfbegin, &
166 | & exBound_nbflength
167 |
168 |
169 | if(exBound_debug.or.(read_iostatus.ne.0)) then
170 | write(*,*) '==================================='
171 | write(*,*) ' npbound = ',exBound_npbound
172 | write(*,*) ' nbbegin = ',exBound_nbbegin
173 | write(*,*) ' nblength = ',exBound_nblength
174 | write(*,*) ' nbfbegin = ',exBound_nbfbegin
175 | write(*,*) ' nbflength = ',exBound_nbflength
176 | write(*,*) ' ndim = ',exBound_ndim
177 | write(*,*) ' IOSTATUS = ',read_iostatus
178 | endif
179 |
180 | !
181 | ! allocate memory for this data
182 | !
183 | if(allocated(exBound_ibound)) deallocate(exBound_ibound)
184 | if(allocated(exBound_ibound1)) deallocate(exBound_ibound1)
185 | if(allocated(exBound_ibound2)) deallocate(exBound_ibound2)
186 | if(allocated(exBound_snbound)) deallocate(exBound_snbound)
187 | if(allocated(exBound_ibfael)) deallocate(exBound_ibfael)
188 | if(allocated(exBound_axipoints)) deallocate(exBound_axipoints)
189 | if(allocated(exBound_bndyconn)) deallocate(exBound_bndyconn)
190 | if(allocated(exBound_ifbound)) deallocate(exBound_ifbound)
191 |
192 | allocate(exBound_ibound(1:exBound_nblength))
193 | allocate(exBound_ibound1(1:exBound_npbound))
194 | allocate(exBound_ibound2(1:exBound_npbound))
195 | allocate(exBound_snbound(1:exBound_nblength*exBound_ndim))
196 | allocate(exBound_ifbound(1:4,1:exBound_npbound))
197 | allocate(exBound_ibfael(1:exBound_nbflength*2))
198 |
199 | !
200 | ! calculate the running index
201 | !
202 | n1 = exBound_nbbegin
203 | n2 = exBound_nbbegin+exBound_nblength - 1
204 | n3 = 1+(exBound_nbbegin-1)*exBound_ndim
205 | n4 = (exBound_nbbegin+exBound_nblength-1)*exBound_ndim
206 | n5 = 1+(exBound_nbfbegin -1)*2
207 | n6 = (exBound_nbfbegin+exBound_nbflength-1)*2
208 | !
209 | ! read start adress and length for each patch (nodes)
210 | !
211 | read(2,IOSTAT=read_iostatus) &
212 | & (exBound_ibound1(n), &
213 | & exBound_ibound2(n),n=1,exBound_npbound)
214 |
215 | if(exBound_debug.or.(read_iostatus.ne.0)) then
216 | write(*,*) '==================================='
217 | write(*,*) 'exBound_ibound1, ibound2 read '
218 | write(*,*) ' IOSTATUS = ',read_iostatus
219 | endif
220 |
221 | !
222 | ! pointer array from boundary nodes to global nodes
223 | !
224 | read(2,IOSTAT=read_iostatus) &
225 | & (exBound_ibound(n),n=n1,n2)
226 |
227 | if(exBound_debug.or.(read_iostatus.ne.0)) then
228 | write(*,*) '==================================='
229 | write(*,*) 'exBound_ibound read '
230 | write(*,*) ' IOSTATUS = ',read_iostatus
231 | endif
232 |
233 | !
234 | ! boundary normal vectors
235 | !
236 | read(2,IOSTAT=read_iostatus) (exBound_snbound(n),n=n3,n4)
237 |
238 | if(exBound_debug.or.(read_iostatus.ne.0)) then
239 | write(*,*) '==================================='
240 | write(*,*) 'exBound_snbound read '
241 | write(*,*) ' IOSTATUS = ',read_iostatus
242 | endif
243 | !
244 | ! for each patch start adress and length of boundary faces
245 | ! (quad and tri see hip doc)
246 | !
247 | read(2,IOSTAT=read_iostatus) &
248 | & ((exBound_ifbound(k,n),k=1,4),n=1,exBound_npbound)
249 |
250 | if(exBound_debug.or.(read_iostatus.ne.0)) then
251 | write(*,*) '==================================='
252 | write(*,*) 'exBound_snbound read '
253 | write(*,*) ' IOSTATUS = ',read_iostatus
254 | endif
255 | !
256 | ! boundary face to element pointer
257 | !
258 | read(2,IOSTAT=read_iostatus) (exBound_ibfael(n),n=n5,n6)
259 |
260 | if(exBound_debug.or.(read_iostatus.ne.0)) then
261 | write(*,*) '==================================='
262 | write(*,*) 'exBound_ibfael read '
263 | write(*,*) ' IOSTATUS = ',read_iostatus
264 | endif
265 |
266 | !
267 | ! read the axi information if present
268 | ! a) read the record length, and check if existance
269 | ! b) allocate mem
270 | ! c) read the record
271 | !
272 |
273 | if(exBound_readaxiinfo) then
274 |
275 | read(2,IOSTAT=read_iostatus) exBound_nbaxipoints
276 |
277 | if(exBound_debug.or.(read_iostatus.ne.0)) then
278 | write(*,*) '==================================='
279 | write(*,*) 'nbaxipoints = ',exbound_nbaxipoints
280 | write(*,*) ' IOSTATUS = ',read_iostatus
281 | endif
282 |
283 | if(read_iostatus.lt.0) then
284 | write(*,*) '==================================='
285 | write(*,*) 'nbaxipoints = ',exbound_nbaxipoints
286 | write(*,*) ' IOSTATUS = ',read_iostatus
287 | write(*,*) ' no axisymmetric information present', &
288 | & ' in this exBound; check exBound and ', &
289 | & ' run new hip ! '
290 | endif
291 |
292 | !
293 | ! does it exist ?
294 | !
295 | if(read_iostatus.ge.0) then
296 | !
297 | ! axi symmetric grid ?
298 | !
299 | if(exBound_nbaxipoints.gt.0) then
300 | !
301 | ! debug info
302 | !
303 | if(exBound_debug) then
304 | write(*,*) '==================================='
305 | write(*,*) ' reading axi information ... '
306 | endif
307 | !
308 | ! b) allocate mem
309 | !
310 | allocate(exBound_axipoints(1:exBound_nbaxipoints))
311 | !
312 | ! c) read the record
313 | !
314 | read(2,IOSTAT=read_iostatus) (exBound_axipoints(n), &
315 | & n=1,exBound_nbaxipoints)
316 |
317 | if(read_iostatus.ne.0) then
318 | write(*,*) 'avbp_exBound : could not read axisymmetric', &
319 | & 'boundary nodes; check exBound file '
320 | write(*,*) '(IOSTATUS = ',read_iostatus,' )'
321 | endif
322 |
323 | else
324 | !
325 | ! debug info
326 | !
327 | if(exBound_debug) then
328 | write(*,*) '==================================='
329 | write(*,*) ' no axi information empty read statement ... '
330 | endif
331 |
332 | !
333 | ! no axi points ==> empty read statement
334 | !
335 | read(2,IOSTAT=read_iostatus)
336 | !
337 | !
338 | endif
339 | !
340 | !
341 | endif
342 |
343 | if(exBound_readaxiinfo.and.exBound_readconninfo) then
344 | !
345 | ! read the boundary connectivity (same index as ibfael ...)
346 | ! a) calculate the number of entries
347 | ! b) allocate mem
348 | ! c) read the record and check for endof file
349 | !
350 | !
351 | !
352 | ! a) calculate the number of entries and b) allocate mem
353 | ! number of tri + number of quads per patch
354 | !
355 | n7 = 0
356 | if(exBound_ndim.eq.2) then
357 | do n=1,exBound_npbound
358 | n7 = n7 + exBound_ifbound(4,n) * 2
359 | enddo
360 | else if(exBound_ndim.eq.3) then
361 | do n=1,exBound_npbound
362 | n7 = n7 + exBound_ifbound(2,n) * 3 + &
363 | & exBound_ifbound(4,n) * 4
364 | enddo
365 | endif
366 | !
367 | ! give a warning if boundary connectivity is zero
368 | !
369 | if(exBound_debug) then
370 | write(*,*) '==================================='
371 | write(*,*) 'boundary connectivity : ',n7
372 | write(*,*) 'allocating boundary info ... '
373 | endif
374 |
375 | exBound_nbbndyconn = n7
376 |
377 | allocate(exBound_bndyconn(1:exBound_nbbndyconn),stat=allocstat)
378 | !
379 | ! debug info
380 | !
381 | if(exBound_debug) then
382 | write(*,*) '==================================='
383 | write(*,*) 'allocation status: ',allocstat
384 | endif
385 | !
386 | !
387 | !
388 |
389 | !
390 | ! c) read the record
391 | !
392 | read(2,IOSTAT=read_iostatus) (exBound_bndyconn(n), &
393 | & n=1,exBound_nbbndyconn)
394 |
395 | if(read_iostatus.ne.0) then
396 | write(*,*) 'avbp_exBound : could not read boundary ', &
397 | & 'boundary connectivity; check exBound file '
398 | endif
399 | if((read_iostatus.ne.0).or.exBound_debug) then
400 | write(*,*) '(IOSTATUS = ',read_iostatus,' )'
401 | endif
402 | !
403 | !
404 | endif
405 | !
406 | !
407 | endif
408 | !
409 | !
410 | close(2)
411 | !
412 | !
413 | else
414 | n = len_trim(exBoundfile)
415 | write(*,*) ' could not read the exBound file ', &
416 | & exBoundfile(1:n)
417 | endif
418 |
419 | return
420 | end subroutine readexBound
421 | ! ================================================================
422 | !
423 | ! write the ex Bound variables
424 | !
425 | ! ================================================================
426 | subroutine writeexBoundvariables
427 | DOM_INT n,m,n1,n2,n3,n4,n5,n6,k
428 |
429 | if(exBound_debug) then
430 | write(*,*) 'write exBoundvariables ... '
431 | endif
432 |
433 |
434 | write(*,*) exBound_npart,exBound_mnbpatch, &
435 | & exBound_ntbound,exBound_ntbface
436 |
437 | write(*,*) exBound_npbound,exBound_nbbegin, &
438 | & exBound_nblength,exBound_nbfbegin, &
439 | & exBound_nbflength
440 |
441 | n1 = exBound_nbbegin
442 | n2 = exBound_nbbegin+exBound_nblength-1
443 | n3 = 1+(exBound_nbbegin-1)*exBound_ndim
444 | n4 = (exBound_nbbegin+exBound_nblength-1)*exBound_ndim
445 | n5 = 1+(exBound_nbfbegin -1)*2
446 | n6 = (exBound_nbfbegin+exBound_nbflength-1)*2
447 |
448 | write(*,*) (exBound_ibound1(n), &
449 | & exBound_ibound2(n),n=1,exBound_npbound)
450 |
451 | write(*,*) (exBound_ibound(n),n=n1,n2)
452 | write(*,*) (exBound_snbound(n),n=n3,n4)
453 | write(*,*) ((exBound_ifbound(k,n),k=1,4),n=1,exBound_npbound)
454 | write(*,*) (exBound_ibfael(n),n=n5,n6)
455 | write(*,*) exBound_nbaxipoints
456 | if(exBound_nbaxipoints.gt.0) then
457 | write(*,*) (exBound_axipoints(n),n=1,exBound_nbaxipoints)
458 | endif
459 | write(*,*) exBound_nbbndyconn
460 | if(exBound_nbbndyconn.gt.0) then
461 | write(*,*) (exBound_bndyconn(n),n=1,exBound_nbbndyconn)
462 | endif
463 |
464 |
465 | end subroutine writeexBoundvariables
466 | ! ================================================================
467 | end module avbp_exBound
avbp_exBound.F could be called by: