The TELEMAC-MASCARET system  trunk
identify_liq_bnd.f
Go to the documentation of this file.
1 ! ************************
2  PROGRAM identify_liq_bnd
3 ! ************************
4 !
5 !
6 !***********************************************************************
7 ! IDENTIFY_LIQ_BND
8 !***********************************************************************
9 !
10 !brief Returns the liquid boundary informations
11 !
12 !history Y. AUDOUIN (EDF)
13 !+ 01/2018
14 !+ V8P0
15 !+ FIRST VERSION
16 !
17 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
18 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
19 !
22  USE bief, ONLY : nbmaxnshare, nptir,
23  & read_mesh_info, front2, ncsize
26  IMPLICIT NONE
27 !
28 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
29 !
30  CHARACTER(LEN=PATH_LEN) :: NAMEGEO
31  CHARACTER(LEN=PATH_LEN) :: NAMECLI
32  CHARACTER(LEN=8) :: FFORMAT
33 !
34  CHARACTER(LEN=80) :: TITLE
35  LOGICAL :: IS
36  INTEGER NVAR, NPLAN, NPTFR, NELEBD
37  INTEGER NELEM, NPOIN, NDP, NELEM2, NPOIN2, NDP_BND
38  INTEGER TYP_ELEM, TYP_BND_ELEM
39  INTEGER DIM_MESH
40 !
41  INTEGER, ALLOCATABLE :: IKLES(:)
42  INTEGER, ALLOCATABLE :: IKLES3D(:)
43  INTEGER, ALLOCATABLE :: LIHBOR(:),LIUBOR(:)
44  INTEGER, ALLOCATABLE :: LIVBOR(:),LITBOR(:),COLOR(:)
45  DOUBLE PRECISION, ALLOCATABLE :: HBOR(:),UBOR(:),VBOR(:)
46  DOUBLE PRECISION, ALLOCATABLE :: CHBORD(:)
47  DOUBLE PRECISION, ALLOCATABLE :: TBOR(:),ATBOR(:),BTBOR(:)
48  INTEGER, ALLOCATABLE :: NBOR(:),IKLE_BND(:)
49  INTEGER, ALLOCATABLE :: NUMLIQ(:)
50  INTEGER, ALLOCATABLE :: IFABOR(:,:), NELBOR(:)
51  INTEGER, ALLOCATABLE :: IKLE(:,:)
52  INTEGER, ALLOCATABLE :: KP1BOR(:,:)
53 !
54 ! FOR DOUBLE PRECISION SERAFIN FORMAT
55 !
56  DOUBLE PRECISION, ALLOCATABLE :: F(:,:)
57 !
58  INTEGER :: NINP
59  INTEGER :: NOUT
60  INTEGER TIME(3),DATE(3), DATE_TMP(6)
61  INTEGER :: I,J,K,IERR
62  INTEGER :: FIRST, LAST, NFRLIQ
63 !
64 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
65 !
66 !
67  lng=2 ! JE NE PARLE PAS FRANCAIS, JE SUIS BARBARIEN
68  lu=6 ! FORTRAN STANDARD OUPUT CHANNEL
69  li=5 ! FORTRAN STANDARD INPUT CHANNEL
70 !
71 !----------------------------------------------------------------------
72 ! INTRODUCE YOURSELF
73 !
74 !----------------------------------------------------------------------
75 ! NAMES OF THE INPUT FILES:
76 !
77 !
78  WRITE(lu,*) '--INPUT GEOMETRY FILE NAME <INPUT_NAME>: '
79  READ(li,*) namegeo
80 !
81  IF (namegeo.EQ.' ') THEN
82  WRITE (lu,*) ' NO FILENAME '
83  CALL plante(1)
84  stop
85  ELSE
86  WRITE(lu,*) 'INPUT: ',trim(namegeo)
87  ENDIF
88 
89  INQUIRE (file=namegeo,exist=is)
90  IF (.NOT.is) THEN
91  WRITE (lu,*)' FILE DOES NOT EXIST: ',trim(namegeo)
92  CALL plante(1)
93  stop
94  ENDIF
95 !
96  WRITE(lu,*)
97  & '--INPUT FILE FORMAT <FFORMAT> [MED,SERAFIN,SERAFIND]: '
98  READ(li,*) fformat
99  IF ( (fformat .NE. 'MED ') .AND.
100  & (fformat(1:7) .NE. 'SERAFIN') ) THEN
101  WRITE(lu,*)
102  & ' FILE FORMAT MUST BE "MED" OR "SERAFIN" OR "SERAFIND" '
103  CALL plante(1)
104  stop
105  ELSE
106  WRITE(lu,*) ' INPUT: ', fformat
107  ENDIF
108 !
109  WRITE(lu, *) '--BOUNDARY CONDITIONS FILE NAME: '
110  READ(li,*) namecli
111  IF (namecli.EQ.' ') THEN
112  WRITE (lu,*) ' NO FILENAME '
113  CALL plante(1)
114  stop
115  ELSE
116  WRITE(lu,*) 'INPUT: ',trim(namecli)
117  ENDIF
118 !
119  INQUIRE (file=namecli,exist=is)
120  IF (.NOT.is) THEN
121  WRITE (lu,*) 'FILE DOES NOT EXIST: ',trim(namecli)
122  CALL plante(1)
123  stop
124  ENDIF
125 !
126 ! Reading mesh informations
127 !
128  ! SET NCSIZE TO 1 TO USE VOISIN AND READ_MESH_INFO IN SERIAL MODE
129  ncsize=1
130 !
131  CALL open_mesh(fformat, namegeo, ninp, 'READ ', ierr)
132  CALL check_call(ierr, 'PARTEL:OPENMESH:INP')
133 !
134  CALL open_bnd(fformat,namecli,ninp,'READ ',ierr)
135  CALL check_call(ierr,'PARTEL:OPEN_BND:NCLI')
136 !
137 !----------------------------------------------------------------------
138 !
139 ! START READING THE GEOMETRY OR RESULT FILE
140 !
141  CALL read_mesh_info(fformat,ninp,title,nvar,npoin,typ_elem,nelem,
142  & nptfr,nptir,ndp,nplan,x_orig,y_orig,
143  & typ_bnd_elem,nelebd)
144 !
145 ! READ THE REST OF THE SELAFIN FILE
146 ! 10 INTEGERS, THE FIRST IS THE NUMBER OF RECORDS (TIMESTEPS)
147 !
148  CALL get_mesh_date(fformat,ninp,date_tmp,ierr)
149  CALL check_call(ierr,'PARTEL:GET_MESH_DATE:INP')
150  DO i=1,3
151  date(i) = date_tmp(i)
152  time(i) = date_tmp(i+3)
153  ENDDO
154 !
155  IF(nplan.GT.1) THEN
156  npoin2 = npoin/nplan
157  nelem2 = nelem/(nplan-1)
158  dim_mesh = 3
159  ELSE
160  npoin2 = npoin
161  nelem2 = nelem
162  dim_mesh = 2
163  ENDIF
164 !
165 ! NOW LET US ALLOCATE
166 !
167  ALLOCATE (ikles(nelem2*3),stat=ierr)
168  CALL check_allocate(ierr, 'IKLES')
169  IF(nplan.GT.1) THEN
170  ALLOCATE (ikles3d(nelem*ndp),stat=ierr)
171  CALL check_allocate(ierr, 'IKLES3D')
172  ENDIF
173 !
174 ! SIZE 3: FIRST TWO FUNCTIONS ARE X AND Y, 3 IS ALL OTHER
175 ! VARIABLES (THEY WILL BE COPIED AND WRITTEN
176 ! ONE AFTER THE OTHER...)
177 ! NPOIN IS 3D HERE IN 3D
178 !
179  ALLOCATE (f(npoin,2),stat=ierr)
180  CALL check_allocate(ierr, 'F')
181 !
182 ! CONNECTIVITY TABLE:
183 !
184  IF(nplan.LE.1) THEN
185  CALL get_mesh_connectivity(fformat,ninp,typ_elem,ikles,
186  & nelem,ndp,ierr)
187  CALL check_call(ierr,'PARTEL:GET_MESH_CONNECTIVITY:2D')
188  ELSE
189  CALL get_mesh_connectivity(fformat,ninp,typ_elem,ikles3d,
190  & nelem,ndp,ierr)
191  CALL check_call(ierr,'PARTEL:GET_MESH_CONNECTIVITY:3D')
192 ! BUILDING IKLES
193  DO j=1,3
194  DO k=1,nelem2
195  ikles((k-1)*3+j)=ikles3d((k-1)*6+j)
196  ENDDO
197  ENDDO
198  ENDIF
199 !
200 ! X-, Y-COORDINATES
201 !
202  CALL get_mesh_coord(fformat,ninp,1,2,npoin,f(:,1),ierr)
203  CALL check_call(ierr,'PARTEL:GET_MESH_COORD:X')
204  CALL get_mesh_coord(fformat,ninp,2,2,npoin,f(:,2),ierr)
205  CALL check_call(ierr,'PARTEL:GET_MESH_COORD:Y')
206 !
207 !----------------------------------------------------------------------
208 !
209 ! READ THE BOUNDARY CONDITIONS FILE
210 !
211  !
212  CALL get_nodes_per_element(typ_bnd_elem,ndp_bnd)
213  ! GET THE NUMBER OF BOUNDARY POINTS AND ELEMENTS
214  CALL get_bnd_nelem(fformat,ninp,typ_bnd_elem,nelebd,ierr)
215  CALL check_call(ierr,'PARTEL:GET_BND_NELEBD:NCLI')
216  CALL get_bnd_npoin(fformat,ninp,typ_bnd_elem,nptfr,ierr)
217  CALL check_call(ierr,'PARTEL:GET_BND_NPOIN:NCLI')
218  !
219  ALLOCATE(ikle_bnd(nelebd*ndp_bnd),stat=ierr)
220  CALL check_allocate(ierr,'PARTEL:IKLE_BND')
221  ALLOCATE(nbor(nptfr),stat=ierr)
222  CALL check_allocate(ierr,'PARTEL:NBOR')
223  ! ALLOCATING ARRAY FOR THE BOUNDARY CONDITIONS
224  ALLOCATE(lihbor(nptfr),stat=ierr)
225  CALL check_allocate(ierr,'PARTEL:LIHBOR')
226  ALLOCATE(liubor(nptfr),stat=ierr)
227  CALL check_allocate(ierr,'PARTEL:LIUBOR')
228  ALLOCATE(livbor(nptfr),stat=ierr)
229  CALL check_allocate(ierr,'PARTEL:LIVBOR')
230  ALLOCATE(hbor(nptfr),stat=ierr)
231  CALL check_allocate(ierr,'PARTEL:HBOR')
232  ALLOCATE(ubor(nptfr),stat=ierr)
233  CALL check_allocate(ierr,'PARTEL:UBOR')
234  ALLOCATE(vbor(nptfr),stat=ierr)
235  CALL check_allocate(ierr,'PARTEL:VBOR')
236  ALLOCATE(chbord(nptfr),stat=ierr)
237  CALL check_allocate(ierr,'PARTEL:CHBORD')
238  ALLOCATE(litbor(nptfr),stat=ierr)
239  CALL check_allocate(ierr,'PARTEL:LITBOR')
240  ALLOCATE(tbor(nptfr),stat=ierr)
241  CALL check_allocate(ierr,'PARTEL:TBOR')
242  ALLOCATE(atbor(nptfr),stat=ierr)
243  CALL check_allocate(ierr,'PARTEL:ATBOR')
244  ALLOCATE(btbor(nptfr),stat=ierr)
245  CALL check_allocate(ierr,'PARTEL:BTBOR')
246  ALLOCATE (numliq(nptfr),stat=ierr)
247  CALL check_allocate(ierr, 'NUMLIQ')
248  ALLOCATE (color(nptfr),stat=ierr)
249  CALL check_allocate(ierr, 'COLOR')
250  ! Get the connectivity table for the boundary elements
251  CALL get_bnd_connectivity(fformat,ninp,typ_bnd_elem,nelebd,
252  & ndp_bnd,ikle_bnd,ierr)
253  CALL check_call(ierr,'PARTEL:GET_BND_CONNECTIVITY:NCLI')
254  ! FILL NBOR
255  CALL get_bnd_numbering(fformat,ninp,typ_bnd_elem,nptfr,nbor,ierr)
256  ! GET THE VALUE OF EACH BOUNDARY
257  CALL get_bnd_value(fformat,ninp,typ_bnd_elem,nelebd,
258  & lihbor,liubor,
259  & livbor,hbor,ubor,vbor,chbord,.true.,
260  & litbor,tbor,atbor,btbor,nptfr,ierr)
261  CALL check_call(ierr,'PARTEL:GET_BND_VALUE:NCLI')
262  CALL get_bnd_color(fformat,ninp,typ_bnd_elem,nelebd,
263  & color,ierr)
264  CALL check_call(ierr,'PARTEL:GET_BND_COLOR:NCLI')
265 !
266 ! Computing liquid bounndaries info
267 !
269  & (namegeo, ikle, ikles,
270  & kp1bor, numliq, dim_mesh, npoin2, nptfr, npoin, nelem2,
271  & nelbor, liubor, lihbor, nbor, ifabor, f, .true.)
272 
273  ! Closing the files
274  CALL close_bnd(fformat,ninp,ierr)
275  CALL check_call(ierr,'PARTEL:CLOSE_BND:NCLI')
276  CALL close_mesh(fformat,ninp,ierr)
277  CALL check_call(ierr,'PARTEL:CLOSE_MESH:NINP')
278 !
279 ! Output informations in file
280 !
281  CALL get_free_id(nout)
282  OPEN(file="liq_bnd.txt", action='WRITE', unit=nout,
283  & form='FORMATTED', iostat=ierr)
284  CALL check_call(ierr, 'opening liq_bnd.txt')
285  ! Finding the first liquid boundary
286  nfrliq = maxval(numliq)
287  WRITE(nout,*) nfrliq
288  DO i=1,nfrliq
289 !
290 ! MARKS THE NUMBERS OF THE LIQUID BOUNDARIES
291 !
292  ! LOKKING FOR FIRST POINT
293  DO j=1,nptfr
294  IF(numliq(j).NE.i .AND. numliq(mod(j,nptfr)+1).EQ.i) THEN
295  first = mod(j,nptfr)+1
296  EXIT
297  ENDIF
298  ENDDO
299  ! LOOKING FOR LAST POINT
300  DO j=1,nptfr
301  IF(numliq(j).EQ.i .AND. numliq(mod(j,nptfr)+1).NE.i) THEN
302  last = j
303  EXIT
304  ENDIF
305  ENDDO
306  WRITE(nout,*) i, first, nbor(first),
307  & f(nbor(first),1), f(nbor(first),2),
308  & last, nbor(last),
309  & f(nbor(last),1), f(nbor(last),2)
310  ENDDO
311 
312  CLOSE(nout)
313 !
314 ! Deallocation
315 !
316  DEALLOCATE(ikles)
317  IF(nplan.GT.1) THEN
318  DEALLOCATE(ikles3d)
319  ENDIF
320  DEALLOCATE(f)
321  DEALLOCATE(ikle_bnd)
322  DEALLOCATE(nbor)
323  DEALLOCATE(lihbor)
324  DEALLOCATE(liubor)
325  DEALLOCATE(livbor)
326  DEALLOCATE(hbor)
327  DEALLOCATE(ubor)
328  DEALLOCATE(vbor)
329  DEALLOCATE(chbord)
330  DEALLOCATE(litbor)
331  DEALLOCATE(tbor)
332  DEALLOCATE(atbor)
333  DEALLOCATE(btbor)
334  DEALLOCATE (numliq)
335  DEALLOCATE (color)
336  stop 0
337  END PROGRAM
subroutine get_bnd_npoin(FFORMAT, FID, TYPE_BND_ELEM, NPTFR, IERR)
Definition: get_bnd_npoin.f:7
subroutine close_mesh(FFORMAT, FILE_ID, IERR, MESH_NUMBER)
Definition: close_mesh.f:7
subroutine get_bnd_connectivity(FFORMAT, FID, TYP_BND_ELEM, NELEBD, NDP, IKLE_BND, IERR)
subroutine get_bnd_color(FFORMAT, FID, TYP_BND_ELEM, NELEBD, COLOR, IERR)
Definition: get_bnd_color.f:7
program identify_liq_bnd
subroutine numbering_open_boundaries(NAMEINP, IKLE, IKLES, KP1BOR, NUMLIQ, DIM_MESH, NPOIN2, NPTFR, NPOIN, NELEM2, NELBOR, LIUBOR, LIHBOR, NBOR, IFABOR, F, LISTIN)
subroutine get_bnd_nelem(FFORMAT, FID, TYPE_BND_ELEM, NELEM, IERR)
Definition: get_bnd_nelem.f:7
subroutine close_bnd(FFORMAT, FILE_ID, IERR, MESH_NUMBER)
Definition: close_bnd.f:7
subroutine read_mesh_info(FFORMAT, NFIC, TITLE, NVAR, NPOIN, TYP_ELEM, NELEM, NPTFR, NPTIR, NDP, NPLAN, X_ORIG, Y_ORIG, TYP_BND_ELEM, NELEBD)
Definition: read_mesh_info.f:8
subroutine front2(NFRLIQ, LIHBOR, LIUBOR, X, Y, NBOR, KP1BOR, DEJAVU, NPOIN, NPTFR, KLOG, LISTIN, NUMLIQ, MAXFRO)
Definition: front2.f:8
subroutine get_bnd_numbering(FFORMAT, FID, TYP_BND_ELEM, NPTFR, NBOR, IERR)
subroutine get_mesh_date(FFORMAT, FID, DATE, IERR)
Definition: get_mesh_date.f:7
subroutine get_mesh_coord(FFORMAT, FID, JDIM, NDIM, NPOIN, COORD, IERR)
Definition: get_mesh_coord.f:7
subroutine get_bnd_value(FFORMAT, FID, TYP_BND_ELEM, NELEBD, LIHBOR, LIUBOR, LIVBOR, HBOR, UBOR, VBOR, CHBORD, TRAC, LITBOR, TBOR, ATBOR, BTBOR, NPTFR, IERR)
Definition: get_bnd_value.f:9
subroutine get_mesh_connectivity(FFORMAT, FID, TYP_ELEM, IKLE, NELEM, NDP, IERR)
subroutine open_mesh(FFORMAT, FILE_NAME, FILE_ID, OPENMODE, IERR, MESH_NUMBER)
Definition: open_mesh.f:7
subroutine open_bnd(FFORMAT, FILE_NAME, FILE_ID, OPENMODE, IERR, MESH_NUMBER)
Definition: open_bnd.f:7
Definition: bief.f:3