find_ivirt.F [SRC] [CPP] [JOB] [SCAN] SOURCES / FUNCTIONS

1 | include(dom.inc)
2 |
3 |       SUBROUTINE FIND_IVIRT(cell,face, index)
4 | !     ================================================================!
5 | !                                                                     !
6 | !     findibnd.F : Find the virtual face number from the              !
7 | !                  number of the cell and the number of the face      !
8 | !                  with a dichotomy                                   !
9 | !                                                                     !
10 | !     author         : D. Poitou (sept2011)                           !
11 | !                                                                     !
12 | !     ================================================================!
13 |
14 |       use mod_slave
15 |       use mod_pmm
16 |
17 |       IMPLICIT NONE
18 |
19 | !     IN
20 |       DOM_INT :: cell, face
21 |
22 | !     LOCAL
23 |       DOM_INT :: imin, imax, di
24 |
25 | !     OUT
26 |       DOM_INT :: index
27 |
28 | !     ---------------!
29 | !     Initialisation !
30 | !     ---------------!
31 | !     index  = 1
32 |
33 | !     --------------------------------------------!
34 | !     Test des cellules par itÃ©rations dichotomie !
35 | !     --------------------------------------------!
36 |       imin = is_vfacebeg
37 |       imax = is_vfacebeg + is_nvfaces
38 |       di   = 1
39 |
40 |       DO WHILE (ts_virtbound(index)%icell.ne.cell)
41 |
42 |         IF(ts_virtbound(di)%icell.le.cell) THEN
43 |           imin = di + 1
44 |         ELSE
45 |           imax = di
46 |         ENDIF
47 |
48 |         di = int(imax + imin)/2
49 |
50 |         IF(ts_virtbound(di)%icell.eq.cell) THEN
51 |           index = di
52 |         ENDIF
53 | !       PRINT*, "loop", imax, imin, di
54 | !       PRINT*, "cell",cell, ts_virtbound(di)%icell
55 | !       PRINT*, index
56 |       ENDDO
57 |
58 |       DO WHILE (ts_virtbound(index)%iface.ne.face)
59 |         IF(ts_virtbound(index)%iface.ge.face) THEN
60 |           index = index - 1
61 |         ELSE
62 |           index = index + 1
63 |         ENDIF
64 |       ENDDO
65 |
66 | !      PRINT*, cell, face
67 | !      PRINT*, "index with dichotomy        :", index
68 |
69 |        END SUBROUTINE FIND_IVIRT

find_ivirt.F could be called by:
 Makefile [SOURCES] - 129 spatial_scheme.F [SOURCES/SCHEMES] - 255