The TELEMAC-MASCARET system  trunk
fpread.f
Go to the documentation of this file.
1 ! *****************
2  SUBROUTINE fpread
3 ! *****************
4 !
5  &( fread, f, nf, ndire, npoin2, expo)
6 !
7 !***********************************************************************
8 ! TOMAWAC V6P1 15/06/2011
9 !***********************************************************************
10 !
11 !brief COMPUTES THE PEAK FREQUENCY OF THE VARIANCE SPECTRUM
12 !+ USING THE SO-CALLED READ METHOD.
13 !
14 !history M. BENOIT
15 !+ 30/01/96
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 !+ 15/06/2011
38 !+ V6P1
39 !+ Translation of French names of the variables in argument
40 !
41 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
42 !| DENOM |<->| WORK TABLE
43 !| E |<->| WORK TABLE
44 !| EXPO |-->| EXPONENT OF READ METHOD
45 !| F |---| VARIANCE DENSITY DIRECTIONAL SPECTRUM
46 !| FREAD |<--| PEAK FREQUENCY (READ METHOD)
47 !| NF |-->| NUMBER OF FREQUENCIES
48 !| NDIRE |-->| NUMBER OF DIRECTIONS
49 !| NPOIN2 |-->| NUMBER OF POINTS IN 2D MESH
50 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
51 !
53 !
54  USE interface_tomawac, ex_fpread => fpread
55  IMPLICIT NONE
56 !
57 !.....VARIABLES IN ARGUMENT
58 ! """"""""""""""""""""
59  INTEGER, INTENT(IN) :: NF , NDIRE , NPOIN2
60  DOUBLE PRECISION, INTENT(IN) :: EXPO , F(npoin2,ndire,nf)
61  DOUBLE PRECISION, INTENT(INOUT) :: FREAD(npoin2)
62 !
63 !.....LOCAL VARIABLES
64 ! """""""""""""""""
65  INTEGER JP , JF , IP
66  DOUBLE PRECISION SEUIL , AUXI , COEFN , COEFD , DTETAR, DENOM,E
67 !
68 !
69  seuil =1.d-20
70  dtetar=deupi/dble(ndire)
71  DO ip = 1,npoin2
72  fread(ip)=0.d0
73  denom=0.d0
74 !
75 ! ------------------------------------------------------C
76 ! SUMS UP THE CONTRIBUTIONS FOR THE DISCRETISED PART OF THE SPECTRUM C
77 ! ------------------------------------------------------C
78  DO jf=1,nf
79 !
80 !.......INTEGRATES WRT DIRECTIONS TO GET E(F)
81 ! """""""""""""""""""""""""""""""""""""""""""""""""
82  e = 0.d0
83  DO jp=1,ndire
84  e = e + f(ip,jp,jf)*dtetar
85  ENDDO ! JP
86 !
87 !.......SUMS UP THE CONTRIBUTION OF THE FREQUENCY F
88 ! """""""""""""""""""""""""""""""""""""""""""
89  IF (e.GT.seuil) THEN
90  auxi = e**expo*dfreq(jf)
91  fread(ip) = fread(ip)+auxi*freq(jf)
92  denom = denom+auxi
93  ENDIF
94 !
95  ENDDO ! JF
96 !
97 !-----C-------------------------------------------------------------C
98 !-----C (OPTIONALLY) TAKES INTO ACCOUNT THE HIGH-FREQUENCY PART C
99 !-----C-------------------------------------------------------------C
100  IF (tailf.GT.1.d0) THEN
101  coefn=freq(nf)**2/(tailf*expo-2.d0)
102  coefd=freq(nf) /(tailf*expo-1.d0)
103  auxi=e**expo
104  fread(ip) = fread(ip)+auxi*coefn
105  denom = denom+auxi*coefd
106  ENDIF
107 !
108 !-----C-------------------------------------------------------------C
109 !-----C COMPUTES THE PEAK FREQUENCY C
110 !-----C-------------------------------------------------------------C
111  IF (denom.LT.1.d-90) THEN
112  fread(ip) = seuil
113  ELSE
114  fread(ip) = fread(ip)/denom
115  ENDIF
116  ENDDO ! IP
117 !
118  RETURN
119  END
double precision, dimension(:), pointer freq
double precision, dimension(:), pointer dfreq
subroutine fpread(FREAD, F, NF, NDIRE, NPOIN2, EXPO)
Definition: fpread.f:7