The TELEMAC-MASCARET system  trunk
caltetap.f
Go to the documentation of this file.
1 ! *******************
2  SUBROUTINE caltetap
3 ! *******************
4  &(teta,xsgbor,ysgbor,adir,nptfr)
5 !
6 !
7 !***********************************************************************
8 ! ARTEMIS V7P3 Aug 2017
9 !***********************************************************************
10 !
11 !brief COMPUTES ANGLE TETAP ON THE BOUNDARY FROM THE WAVE INCIDENCE
12 !+ ON THE DOMAIN
13 ! TETAP is given in degrees, in the interval [0 ; 90]
14 !
15 !history C. PEYRARD (LNHE)
16 !+ 18/03/2014
17 !+ V7P0
18 !+ NEW SUBROUTINE CREATED / IMPLEMENTED
19 !
20 !history N.DURAND (HRW)
21 !+ August 2017
22 !+ V7P3
23 !+ RADDEG now defined in DECLARATIONS_ARTEMIS
24 !
25 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
26 !| TETA |-->| ANGLE BETWEEN WAVE DIRECTION AND BOUNDARY NORMAL
27 ! (TETAP)
28 !| XSGBOR |-->| X COMPONENT OF THE NORMAL TO THE BOUNDARY SEGMENT
29 !| YSGBOR |-->| Y COMPONENT OF THE NORMAL TO THE BOUNDARY SEGMENT
30 !| ADIR |-->| INCIDENCE ANGLE OF WAVES
31 !| NPTFR |-->| NUMBER OF BOUNDARY POINTS
32 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
33 !
34  USE bief
35 !
37  USE declarations_artemis, ONLY : raddeg
38  IMPLICIT NONE
39 !
40  INTEGER I,NPTFR
41 !
42  DOUBLE PRECISION PSCALA,XNA,YNA,XI,YI,PSCALB,XNB,YNB
43  DOUBLE PRECISION, INTENT(IN) :: XSGBOR(nptfr,4),YSGBOR(nptfr,4)
44  DOUBLE PRECISION :: TETA(nptfr),ADIR(nptfr)
45 !
46  INTRINSIC sqrt, atan2, mod, abs, cos, sin, atan
47 !
48 !-----------------------------------------------------------------------
49 !
50  DO i=1,nptfr
51 !
52 ! STEP 1 : VECTOR NORMAL TO "THE POINT" (SEGMENT AFTER/BEFORE)
53 ! ======================================================
54 ! NORMAL TO SEGMENT AFTER
55  xna=xsgbor(i,1)
56  yna=ysgbor(i,1)
57 ! NORMAL TO SEGMENT BEFORE
58  xnb=xsgbor(i,2)
59  ynb=ysgbor(i,2)
60 ! NORMALIZATION NOT NECESSARY AS (XSGBOR(K,1),YSGBOR(K,1)) AND
61 ! (XSGBOR(K,2),YSGBOR(K,2)) ARE ALREADY OF NORM 1
62 !
63 ! STEP 2 : VECTOR INCIDENCE AT NODE
64 ! =========================
65  xi=cos(adir(i))
66  yi=sin(adir(i))
67 !
68 ! STEP 3 : ANGLE BETWEEN NORMAL DIRECTION AND INCIDENCE DIRECTION
69 ! ===============================================================
70  pscala=xna*xi+yna*yi
71  pscalb=xnb*xi+ynb*yi
72 ! SMALLEST ANGLE BETWEEN NORMAL AND INCIDENCE (0<TETAP<90)
73  IF(pscala.LT.0d0) THEN
74  pscala=-pscala
75  ENDIF
76  IF(pscalb.LT.0d0) THEN
77  pscalb=-pscalb
78  ENDIF
79 !
80 ! STEP 4 = TETAP IS GIVEN IN DEGRES
81 ! =================================
82 ! CHOOSE OF THE LOWER VALUE OF TETA (SEEMS BETTER AT CORNER CONSIDERING
83 ! THE PHBOR ROUTINE RULES)
84  teta(i)=min(acos(pscala)*raddeg,acos(pscalb)*raddeg)
85  ENDDO
86 !=======================================================================
87 !
88  RETURN
89  END
subroutine caltetap(TETA, XSGBOR, YSGBOR, ADIR, NPTFR)
Definition: caltetap.f:6
Definition: bief.f:3