The TELEMAC-MASCARET system  trunk
dir_spread.f
Go to the documentation of this file.
1 ! *********************
2  SUBROUTINE dir_spread
3 ! *********************
4 !
5  &( dirspr, f, ndire , nf, npoin2)
6 !
7 !***********************************************************************
8 ! TOMAWAC V7P2 05/06/2016
9 !***********************************************************************
10 !
11 !brief COMPUTES THE MEAN DIRECTIONAL SPREAD (=DIRECTIONAL
12 !+ WIDTH) S IN DEGREES.
13 !
14 !history M. BENOIT
15 !+ 28/12/95
16 !+ V1P1
17 !+ CREATED
18 !
19 !history M. BENOIT
20 !+ 05/07/96
21 !+ V1P2
22 !+ MODIFIED
23 !
24 !history N.DURAND (HRW), S.E.BOURBAN (HRW)
25 !+ 13/07/2010
26 !+ V6P0
27 !+ Translation of French comments within the FORTRAN sources into
28 !+ English comments
29 !
30 !history N.DURAND (HRW), S.E.BOURBAN (HRW)
31 !+ 21/08/2010
32 !+ V6P0
33 !+ Creation of DOXYGEN tags for automated documentation and
34 !+ cross-referencing of the FORTRAN sources
35 !
36 !history G.MATTAROLO (EDF - LNHE)
37 !+ 28/06/2011
38 !+ V6P1
39 !+ Translation of French names of the variables in argument
40 !
41 !history S.E.BOURBAN (HRW)
42 !+ 05/06/2016
43 !+ V7P2
44 !+ Name of the subroutine changed from SPREAD (an intrinsic Fortran
45 !+ routine) into DIR_SPREAD
46 !
47 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
48 !| COSMOY |<--| WORK TABLE
49 !| DIRSPR |<--| MEAN DIRECTIONAL SPREAD
50 !| F |-->| VARIANCE DENSITY DIRECTIONAL SPECTRUM
51 !| NF |-->| NUMBER OF FREQUENCIES
52 !| NDIRE |-->| NUMBER OF DIRECTIONS
53 !| NPOIN2 |-->| NUMBER OF POINTS IN 2D MESH
54 !| SINMOY |<--| WORK TABLE
55 !| TAUXC |<--| WORK TABLE
56 !| TAUXE |<--| WORK TABLE
57 !| TAUXS |<--| WORK TABLE
58 !| VARIAN |<--| WORK TABLE
59 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
60 !
62  & costet, sintet
63 !
64  USE interface_tomawac, ex_dir_spread => dir_spread
65  IMPLICIT NONE
66 !
67 !.....VARIABLES IN ARGUMENT
68 ! """"""""""""""""""""
69  INTEGER, INTENT(IN) :: NF , NDIRE , NPOIN2
70  DOUBLE PRECISION, INTENT(IN) :: F(npoin2,ndire,nf)
71  DOUBLE PRECISION, INTENT(INOUT) :: DIRSPR(npoin2)
72 !
73 !.....LOCAL VARIABLES
74 ! """""""""""""""""
75  INTEGER IP , JP , JF
76  DOUBLE PRECISION AUXC , AUXS , DFDTET, DTETAR, AUXI
77  DOUBLE PRECISION SEUIL , COEFT
78  DOUBLE PRECISION SINMOY, COSMOY
79  DOUBLE PRECISION VARIAN, TAUXE
80  DOUBLE PRECISION TAUXS, TAUXC
81 !
82 !
83  seuil=1.d-20
84  dtetar=deupi/dble(ndire)
85 !
86  DO ip=1,npoin2
87  cosmoy=0.d0
88  sinmoy=0.d0
89  varian=0.d0
90 !-----C-------------------------------------------------------C
91 !-----C SUMS UP THE DISCRETISED PART OF THE SPECTRUM C
92 !-----C-------------------------------------------------------C
93  DO jf=1,nf
94 !
95  tauxc=0.d0
96  tauxs=0.d0
97  tauxe=0.d0
98  dfdtet=dfreq(jf)*dtetar
99  DO jp=1,ndire
100  auxc=costet(jp)*dfdtet
101  auxs=sintet(jp)*dfdtet
102  tauxc=tauxc+f(ip,jp,jf)*auxc
103  tauxs=tauxs+f(ip,jp,jf)*auxs
104  tauxe=tauxe+f(ip,jp,jf)*dfdtet
105  ENDDO
106  cosmoy=cosmoy+tauxc
107  sinmoy=sinmoy+tauxs
108  varian=varian+tauxe
109  ENDDO ! JF
110 !-----C-------------------------------------------------------------C
111 !-----C TAKES INTO ACCOUNT THE HIGH FREQUENCY PART (OPTIONAL) C
112 !-----C-------------------------------------------------------------C
113  IF (tailf.GT.1.d0) THEN
114  coeft=freq(nf)/((tailf-1.d0)*dfreq(nf))
115  cosmoy=cosmoy+tauxc*coeft
116  sinmoy=sinmoy+tauxs*coeft
117  varian=varian+tauxe*coeft
118  ENDIF
119 !-----C-------------------------------------------------------------C
120 !-----C COMPUTES THE DIRECTIONAL WIDTH C
121 !-----C-------------------------------------------------------------C
122  IF (varian.GT.seuil) THEN
123  auxs=sinmoy/varian
124  auxc=cosmoy/varian
125  auxi=min(sqrt(auxs*auxs+auxc*auxc),1.d0)
126  dirspr(ip)=sqrt(2.d0*(1.d0-auxi))*gradeg
127  ELSE
128  dirspr(ip)=seuil
129  ENDIF
130  ENDDO ! IP
131 !
132  RETURN
133  END
subroutine dir_spread(DIRSPR, F, NDIRE, NF, NPOIN2)
Definition: dir_spread.f:7
double precision, dimension(:), pointer freq
double precision, dimension(:), pointer dfreq