The TELEMAC-MASCARET system  trunk
qwindl.f
Go to the documentation of this file.
1 ! *****************
2  SUBROUTINE qwindl
3 ! *****************
4 !
5  &( tstot , usold , usnew , twold , twnew , nf , ndire ,
6  & npoin2, usn , uso , fpmo , fpmn )
7 !
8 !**********************************************************************
9 ! TOMAWAC V6P3 27/06/2011
10 !**********************************************************************
11 !
12 !brief COMPUTES THE CONTRIBUTION OF THE LINEAR WAVE GENERATION
13 !+ (BY WIND) SOURCE TERM BASED ON CAVALERI AND
14 !+ MALANOTTE-RIZZOLI (1981)
15 !
16 !reference CAVALERI L. & P. MALANOTTE-RIZZOLI, 1981 :
17 !+ "WIND WAVE PREDICTION IN SHALLOW WATER : THEORY AND
18 !+ APPLICATIONS". J. GEOPHYS. RES., 86(C5),10,961-975
19 !
20 !reference TOLMAN (1992) : EFFECT OF NUMERICS ON THE PHYSICS IN
21 !+ A THIRD-GENERATION WIND-WAVE MODEL, JPO, VOL 22,
22 !+ PP 1095-1111.
23 !
24 !history E. GAGNAIRE-RENOU (EDF/LNHE)
25 !+ 09/2010
26 !+ V6P0
27 !+
28 !
29 !history G.MATTAROLO (EDF - LNHE)
30 !+ 27/06/2011
31 !+ V6P1
32 !+ Translation of French names of the variables in argument
33 !
34 !history J-M HERVOUET (EDF/LNHE)
35 !+ 23/12/2012
36 !+ V6P3
37 !+ A first optimisation.
38 !
39 !history J-M HERVOUET (EDF/LNHE)
40 !+ 09/07/2013
41 !+ V6P3
42 !+ (1.D0/1.D-90)**4 triggers an overflow, 20 put instead of 90.
43 !
44 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
45 !| FPMN |<->| WORK TABLE
46 !| FPMO |<->| WORK TABLE
47 !| NF |-->| NUMBER OF FREQUENCIES
48 !| NDIRE |-->| NUMBER OF DIRECTIONS
49 !| NPOIN2 |-->| NUMBER OF POINTS IN 2D MESH
50 !| TSDER |<->| DERIVED PART OF THE SOURCE TERM CONTRIBUTION
51 !| TSTOT |<->| TOTAL PART OF THE SOURCE TERM CONTRIBUTION
52 !| TWNEW |-->| WIND DIRECTION AT TIME N+1
53 !| TWOLD |-->| WIND DIRECTION AT TIME N
54 !| USNEW |-->| FRICTION VELOCITY AT TIME N+1
55 !| USOLD |-->| FRICTION VELOCITY AT TIME N
56 !| XK |-->| DISCRETIZED WAVE NUMBER
57 !| USN |<--| WORK TABLE
58 !| USO |<--| WORK TABLE
59 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
60 !
61 ! APPELS : - PROGRAMME(S) APPELANT : SEMIMP
62 ! ******** - PROGRAMME(S) APPELE(S) : -
63 !**********************************************************************
64 !
66  & t0,t1
67 !FROM TOMAWAC MODULE
68 ! CIMPLI IMPLICITATION COEFFICIENT FOR SOURCE TERMS
69 !
70  USE interface_tomawac, ex_qwindl => qwindl
71  IMPLICIT NONE
72 !
73 !+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
74 !
75  INTEGER, INTENT(IN) :: NF,NDIRE,NPOIN2
76  DOUBLE PRECISION, INTENT(INOUT) :: FPMO(npoin2),FPMN(npoin2)
77  DOUBLE PRECISION, INTENT(IN) :: TWOLD(npoin2),TWNEW(npoin2)
78  DOUBLE PRECISION, INTENT(IN) :: USNEW(npoin2),USOLD(npoin2)
79  DOUBLE PRECISION, INTENT(INOUT) :: USO(npoin2,ndire)
80  DOUBLE PRECISION, INTENT(INOUT) :: USN(npoin2,ndire)
81  DOUBLE PRECISION, INTENT(INOUT) :: TSTOT(npoin2,ndire,nf)
82 !
83 !+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
84 !
85  INTEGER JP,JF,IP
86  DOUBLE PRECISION C1,C2,DIREC,ALPHAN,ALPHAO,SURFREQ4
87  DOUBLE PRECISION :: COSDIREC , SINDIREC
88  DOUBLE PRECISION, DIMENSION(:), POINTER ::COSTW,SINTW,
89  & expfpmo,expfpmn
90 !
91 !-----------------------------------------------------------------------
92 !
93  costw=>t0
94  sintw=>t1
95  expfpmo=>t0
96  expfpmn=>t1
97 
98  c1 = 1.5d-3/gravit**2
99  c2 = gravit/(deupi*28.d0)
100 !
101 ! ARRAYS DEPENDING ONLY ON POINTS
102 !
103 ! ABR: ADDED EXPONETIAL HERE
104  DO ip=1,npoin2
105  fpmo(ip)=exp(-(c2/max(usold(ip),1.d-20))**4)
106  ENDDO
107  DO ip=1,npoin2
108  fpmn(ip)=exp(-(c2/max(usnew(ip),1.d-20))**4)
109  ENDDO
110 
111 !
112 ! ARRAYS DEPENDING ONLY ON POINTS AND DIRECTIONS
113 ! COULD BE OPTIMISED MORE BY DECOMPOSING THE COS...
114 !
115 ! abr: done
116  DO ip=1,npoin2
117  costw(ip)=cos(twold(ip))
118  ENDDO
119  DO ip=1,npoin2
120  sintw(ip)=sin(twold(ip))
121  ENDDO
122 
123  DO jp=1,ndire
124  direc=teta(jp)
125  cosdirec = cos(direc)
126  sindirec = sin(direc)
127  DO ip=1,npoin2
128  uso(ip,jp)=c1*(max(usold(ip)*(cosdirec*costw(ip)+
129  & sindirec*sintw(ip)),0.d0))**4
130  ENDDO
131  ENDDO
132 
133  DO ip=1,npoin2
134  costw(ip)=cos(twnew(ip))
135  ENDDO
136  DO ip=1,npoin2
137  sintw(ip)=sin(twnew(ip))
138  ENDDO
139 
140  DO jp=1,ndire
141  direc=teta(jp)
142  cosdirec = cos(direc)
143  sindirec = sin(direc)
144  DO ip=1,npoin2
145  usn(ip,jp)=c1*(max(usnew(ip)*(cosdirec*costw(ip)+
146  & sindirec*sintw(ip)),0.d0))**4
147  ENDDO
148  ENDDO
149 
150 
151 !
152 ! LOOP ON THE DISCRETISED FREQUENCIES
153 !
154  DO jf=1,nf
155  surfreq4=1.d0/freq(jf)**4
156  DO ip=1,npoin2
157  expfpmo(ip)= fpmo(ip)**surfreq4
158  ENDDO
159  DO ip=1,npoin2
160  expfpmn(ip)= fpmn(ip)**surfreq4
161  ENDDO
162  DO jp=1,ndire
163  DO ip=1,npoin2
164  alphao=uso(ip,jp)*expfpmo(ip)
165  alphan=usn(ip,jp)*expfpmn(ip)
166 ! TAKES THE SOURCE TERM INTO ACCOUNT
167  tstot(ip,jp,jf) = tstot(ip,jp,jf)
168  & + (alphao + cimpli*(alphan-alphao))
169  ENDDO
170  ENDDO
171  ENDDO
172 !
173 !-----------------------------------------------------------------------
174 !
175  RETURN
176  END
double precision, dimension(:), pointer freq
double precision, dimension(:), pointer teta
subroutine qwindl(TSTOT, USOLD, USNEW, TWOLD, TWNEW, NF, NDIRE, NPOIN2, USN, USO, FPMO, FPMN)
Definition: qwindl.f:8