The TELEMAC-MASCARET system  trunk
cflp12.f
Go to the documentation of this file.
1 ! *****************
2  SUBROUTINE cflp12
3 ! *****************
4 !
5  &(u,v,x,y,ikle,nelem,nelmax,w1)
6 !
7 !***********************************************************************
8 ! BIEF V6P1 21/08/2010
9 !***********************************************************************
10 !
11 !brief COMPUTES THE COURANT NUMBER AT EACH POINT OF THE MESH
12 !+ AND FOR EACH TIMESTEP.
13 !+
14 !+ THE STABILITY CRITERION OF THE DISTRIBUTIVE SCHEME N
15 !+ IS HERE USED TO EVALUATE THE COURANT NUMBER.
16 !
17 !history C MOULIN (LNH)
18 !+
19 !+
20 !+
21 !
22 !history JMH
23 !+ 29/12/05
24 !+ V5P6
25 !+ MODIFICATIONS
26 !
27 !history N.DURAND (HRW), S.E.BOURBAN (HRW)
28 !+ 13/07/2010
29 !+ V6P0
30 !+ Translation of French comments within the FORTRAN sources into
31 !+ English comments
32 !
33 !history N.DURAND (HRW), S.E.BOURBAN (HRW)
34 !+ 21/08/2010
35 !+ V6P0
36 !+ Creation of DOXYGEN tags for automated documentation and
37 !+ cross-referencing of the FORTRAN sources
38 !
39 !history S.E.BOURBAN (HRW)
40 !+ 21/03/2017
41 !+ V7P3
42 !+ Replacement of the DATA declarations by the PARAMETER associates
43 !
44 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
45 !| IKLE |-->| CONNECTIVITY TABLE
46 !| NELEM |-->| NUMBER OF ELEMENTS IN THE MESH
47 !| NELMAX |-->| FIRST DIMENSION OF IKLE, MAXIMUM NUMBER OF ELEMENTS
48 !| | | IN THE MESH
49 !| U |-->| VELOCITY ALONG X.
50 !| V |-->| VELOCITY ALONG Y.
51 !| W1 |-->| RESULT IN NON ASSEMBLED FORM
52 !| X |-->| ABSCISSAE OF POINTS GIVEN PER ELEMENT
53 !| Y |-->| ORDINATES OF POINTS GIVEN PER ELEMENT
54 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
55 !
57  IMPLICIT NONE
58 !
59 !+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
60 !
61  INTEGER , INTENT(IN) :: NELEM,NELMAX
62  DOUBLE PRECISION, INTENT(IN) :: U(*),V(*)
63  DOUBLE PRECISION, INTENT(IN) :: X(nelmax*3),Y(nelmax*3)
64  INTEGER , INTENT(IN) :: IKLE(nelmax*4)
65  DOUBLE PRECISION, INTENT(OUT) :: W1(nelmax*4)
66 !
67 !+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
68 !
69  INTEGER IELEM,IT,IAD1,IAD2,IAD3,IG1,IG2,IG3
70 !
71  DOUBLE PRECISION USUR2,VSUR2
72  DOUBLE PRECISION SUR6,K1,K2,K3,L12,L13,L21,L23,L31,L32
73  DOUBLE PRECISION X1,X2,X3,Y1,Y2,Y3,TIERS
74 !
75  INTRINSIC max,min
76 !
77 !-----------------------------------------------------------------------
78 !
79 ! FOR A QUASI-BUBBLE TRIANGLE : NUMBERS OF THE VERTICES OF THE
80 ! SUB-TRIANGLES IN THE INITIAL TRIANGLE
81 ! IL(NUMBER OF THE SUB-TRIANGLE,LOCAL NUMBER IN THE SUB-TRIANGLE)
82 !
83  INTEGER :: IL(3,3)
84  parameter( il = reshape( (/
85  & 1,2,3,2,3,1,4,4,4 /), shape=(/ 3,3 /) ) )
86 !
87 !-----------------------------------------------------------------------
88 !
89  tiers= 1.d0 / 3.d0
90  sur6 = 1.d0 / 6.d0
91 !
92 ! INITIALISES W
93 !
94  DO ielem = 1 , 4*nelmax
95  w1(ielem) = 0.d0
96  ENDDO ! IELEM
97 !
98 ! USING THE PSI SCHEME,
99 ! LOOP ON THE 3 SUB-TRIANGLES AND PRE-ASSEMBLY
100 !
101  DO it=1,3
102  DO ielem = 1 , nelem
103 !
104 ! ADDRESSES IN AN ARRAY (NELMAX,*)
105  iad1= ielem + (il(it,1)-1)*nelmax
106  iad2= ielem + (il(it,2)-1)*nelmax
107  iad3= ielem + (il(it,3)-1)*nelmax
108 ! GLOBAL NUMBERS IN THE INITIAL TRIANGLE
109  ig1 = ikle(iad1)
110  ig2 = ikle(iad2)
111  ig3 = ikle(iad3)
112 ! COORDINATES OF THE SUB-TRIANGLE VERTICES
113  x1 = x(iad1)
114  x2 = x(iad2) - x1
115  y1 = y(iad1)
116  y2 = y(iad2) - y1
117 ! POINT 3 IS ALWAYS AT THE CENTRE OF THE INITIAL TRIANGLE
118  x3=tiers*(x(ielem)+x(ielem+nelmax)+x(ielem+2*nelmax))-x1
119  y3=tiers*(y(ielem)+y(ielem+nelmax)+y(ielem+2*nelmax))-y1
120 !
121  usur2 = (u(ig1)+u(ig2)+u(ig3))*sur6
122  vsur2 = (v(ig1)+v(ig2)+v(ig3))*sur6
123 !
124  k1 = usur2 * (y2-y3) - vsur2 * (x2-x3)
125  k2 = usur2 * (y3 ) - vsur2 * (x3 )
126  k3 = usur2 * ( -y2) - vsur2 * ( -x2)
127 !
128  l12 = max( min(k1,-k2) , 0.d0 )
129  l13 = max( min(k1,-k3) , 0.d0 )
130  l21 = max( min(k2,-k1) , 0.d0 )
131  l23 = max( min(k2,-k3) , 0.d0 )
132  l31 = max( min(k3,-k1) , 0.d0 )
133  l32 = max( min(k3,-k2) , 0.d0 )
134 !
135  w1(iad1) = w1(iad1) + l12 + l13
136  w1(iad2) = w1(iad2) + l21 + l23
137  w1(iad3) = w1(iad3) + l31 + l32
138 !
139  ENDDO ! IELEM
140  ENDDO ! IT
141 !
142 !-----------------------------------------------------------------------
143 !
144  RETURN
145  END
subroutine cflp12(U, V, X, Y, IKLE, NELEM, NELMAX, W1)
Definition: cflp12.f:7