-
Notifications
You must be signed in to change notification settings - Fork 1
/
wwm_femean_local.F90
131 lines (95 loc) · 3.46 KB
/
wwm_femean_local.F90
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
SUBROUTINE FEMEAN_LOCAL (IP, F, EM, FM, LLAK)
! ----------------------------------------------------------------------
!**** *FEMEAN* - COMPUTATION OF MEAN FREQUENCY AT EACH GRID POINT
! AND MEAN WAVE NUMBER .
! THE COMPUTATION OF THE MEAN WAVE ENERGU WAS ALSO
! ADDED SUCH THAT A CALL TO FEMEAN DOES NOT NEED
! TO BE PRECEDED BY A CALL TO SEMEAN.
! S.D. HASSELMANN
! MODIFIED : P.JANSSEN (INTEGRATION OF F**-4 TAIL)
! OPTIMIZED BY : L. ZAMBRESKY AND H. GUENTHER
!* PURPOSE.
! --------
! COMPUTE MEAN FREQUENCY AT EACH GRID POINT.
!** INTERFACE.
! ----------
! *CALL* *FEMEAN (F, IJS, IJL, EM, FM, LLAK)*
! *F* - SPECTRUM.
! *IJS* - INDEX OF FIRST GRIDPOINT
! *IJL* - INDEX OF LAST GRIDPOINT
! *EM* - MEAN WAVE ENERGY (INPUT)
! *FM* - MEAN WAVE FREQUENCY (OUTPUT)
! *LLAK*- TRUE IF MEAN WAVE NUMBER IS COMPUTED
! METHOD.
! -------
! NONE.
! EXTERNALS.
! ----------
! NONE.
! REFERENCE.
! ----------
! NONE.
! ----------------------------------------------------------------------
! USE YOWFRED , ONLY : FR ,DFIM ,DFIMOFR ,DELTH ,
! & WETAIL ,FRTAIL
! USE YOWPARAM , ONLY : NANG ,NFRE
! USE YOWPCONS , ONLY : G ,ZPI ,EPSMIN
! USE YOWSTAT , ONLY : ISHALLO
! USE YOWSHAL , ONLY : TFAK ,INDEP
USE DATAPOOL, ONLY : FR, WETAIL, FRTAIL, WP1TAIL, ISHALLO, &
& DFIM, DFIMOFR, DFFR, DFFR2, WK, RKIND, &
& DELTH => DDIR, &
& G => G9, &
& ZPI => PI2, &
& EPSMIN => SMALL, &
& NANG => MDC, &
& NFRE => MSC, &
& INDEP => DEP
! ----------------------------------------------------------------------
IMPLICIT NONE
INTEGER, INTENT(IN) :: IP
INTEGER :: M,K
REAL(rkind) :: DELT25, DELT2, DEL2
REAL(rkind) :: F(NANG,NFRE)
REAL(rkind) :: TEMP1, TEMP2, EM, FM
LOGICAL :: LLAK
! ----------------------------------------------------------------------
!* 1. INITIALISE MEAN FREQUENCY ARRAY AND TAIL FACTOR.
! ------------------------------------------------
EM = EPSMIN
FM = EPSMIN
DELT25 = WETAIL*FR(NFRE)*DELTH
DELT2 = FRTAIL*DELTH
!* 2. INTEGRATE OVER FREQUENCIES AND DIRECTIONS.
! ------------------------------------------
IF (ISHALLO.EQ.1 .OR. .NOT.LLAK) THEN
!* 2.1 DEEP WATER INTEGRATION.
! -----------------------
!* 2.2 SHALLOW WATER INTEGRATION.
! --------------------------
DO M=1,NFRE
K=1
TEMP1 = DFIM(M)/SQRT(WK(IP,M))
TEMP2 = F(K,M)
DO K=2,NANG
TEMP2 = TEMP2+F(K,M)
ENDDO
EM = EM+TEMP2*DFIM(M)
FM = FM+DFIMOFR(M)*TEMP2
ENDDO
ENDIF
!* 3. ADD TAIL CORRECTION TO MEAN FREQUENCY AND
!* NORMALIZE WITH TOTAL ENERGY.
! ------------------------------------------
IF (ISHALLO.EQ.1 .OR. .NOT.LLAK) THEN
EM = EM+DELT25*TEMP2
FM = FM+DELT2*TEMP2
FM = EM/FM
ELSE
DEL2 = DELT2*SQRT(G)/ZPI
EM = EM+DELT25*TEMP2
FM = FM+DELT2*TEMP2
FM = EM/FM
ENDIF
RETURN
END SUBROUTINE FEMEAN_LOCAL