-
Notifications
You must be signed in to change notification settings - Fork 0
/
tgreen.f90
executable file
·344 lines (294 loc) · 7.45 KB
/
tgreen.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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
!
! G=-1/4/pi*(1/r+1/r1)
!
!
SUBROUTINE TGRN(H,X,X0,Y,Y0,Z,Z0,XHF)
!
IMPLICIT NONE
INTEGER I
REAL*8,INTENT(IN):: H,X,Y,Z,X0,Y0,Z0
REAL*8,INTENT(OUT):: XHF(4)
REAL*8 DX,DY,DZ,DZ1
REAL*8 RXY2,DZ02,DZ12,SR2,ST2,SR,SR1,PI,PI4
!
DATA PI/3.14159265358979/
!C
!C H: water depth, negtive for infinity water depth
!C
PI4 = 4.0D0*PI
DX =X-X0
DY =Y-Y0
DZ =Z- Z0
DZ1=Z+ Z0 +2.0*H
RXY2=DX*DX+DY*DY
DZ02=DZ*DZ
DZ12=DZ1*DZ1
!
IF(H .GT. 0) THEN
SR2=RXY2+DZ02
ST2=RXY2+DZ12
SR =DSQRT(SR2)
SR1=DSQRT(ST2)
!
XHF(1)= 1.D0/SR + 1.D0/SR1
XHF(2)=-DX/SR**3 - DX /SR1**3
XHF(3)=-DY/SR**3 - DY /SR1**3
XHF(4)=-DZ/SR**3 - DZ1/SR1**3
!
ELSE
SR2=RXY2+DZ02
SR =DSQRT(SR2)
!
XHF(1)= 1.D0/SR
XHF(2)=-DX/SR**3
XHF(3)=-DY/SR**3
XHF(4)=-DZ/SR**3
!
ENDIF
!
DO 120 I=1, 4
XHF(I)=-XHF(I)/PI4
120 CONTINUE
!
RETURN
END
!
! ==================================================================
!
! G=-1/4/pi*(1/r+1/r1)
! XF(1) : dG(x,x0)/dz0
! XF(2) :d^2G/dx/dz0; XF(3):d^2G/dy/dz0; XF(4):d^2G/dz/dz0
!
! ==================================================================
!
SUBROUTINE DTGRN(H,X,X0,Y,Y0,Z,Z0,XHF)
!
IMPLICIT NONE
INTEGER I
REAL*8,INTENT(IN):: H,X,Y,Z,X0,Y0,Z0
REAL*8,INTENT(OUT):: XHF(4)
REAL*8 DX,DY,DZ,DZ1
REAL*8 RXY2,DZ02,DZ12,SR,SR2,SR3,SR5,ST,ST2,ST3,ST5
REAL*8 PI,PI4
!
DATA PI/3.14159265358979/
!
! H: water depth, negtive for infinity water depth
!
PI4 = 4.0D0*PI
DX=X-X0
DY=Y-Y0
DZ =Z- Z0
DZ1=Z+ Z0 +2.0*H
RXY2=DX*DX+DY*DY
DZ02=DZ*DZ
DZ12=DZ1*DZ1
!
IF(H .GT. 0) THEN
SR2=RXY2+DZ02
SR =DSQRT(SR2)
SR3=SR*SR2
SR5=SR3*SR2
ST2=RXY2+DZ12
ST=DSQRT(ST2)
ST3=ST*ST2
ST5=ST3*ST2
!
XHF(1)=DZ/SR3 -DZ1/ST3
XHF(2)=3.0d0*DX*(-DZ/SR5 + DZ1/ST5)
XHF(3)=3.0d0*DY*(-DZ/SR5 + DZ1/ST5)
XHF(4)=-3.0d0*DZ02/SR5+1.0d0/SR3+3.0d0*DZ12/ST5-1.0d0/ST3
!
ELSE
SR2=RXY2+DZ02
SR =DSQRT(SR2)
SR3=SR*SR2
SR5=SR3*SR2
!
XHF(1)=DZ/SR3
XHF(2)=-3.0d0*DX*DZ/SR5
XHF(3)=-3.0d0*DY*DZ/SR5
XHF(4)=-3.0d0*DZ02/SR5+1.0d0/SR3
!
ENDIF
!
DO 120 I=1, 4
XHF(I)=-XHF(I)/PI4
120 CONTINUE
!
RETURN
END
!
! ==================================================================
!
! G=-1/4/pi*1/r
! XF(1) : dG(x,x0)/dz0
! XF(2) :d^2G/dx/dz0; XF(3):d^2G/dy/dz0; XF(4):d^2G/dz/dz0
!
! ==================================================================
!
SUBROUTINE DTGRN0(H,X,X0,Y,Y0,Z,Z0,XHF)
!
IMPLICIT NONE
INTEGER I
REAL*8,INTENT(IN):: H,X,Y,Z,X0,Y0,Z0
REAL*8,INTENT(OUT):: XHF(4)
REAL*8 DX,DY,DZ
REAL*8 RXY2,DZ02,SR,SR2,SR3,SR5
REAL*8 PI,PI4
!
DATA PI/3.14159265358979/
!
! H: water depth, negtive for infinity water depth
!
DX=X-X0
DY=Y-Y0
DZ=Z-Z0
RXY2=DX*DX+DY*DY
DZ02=DZ*DZ
!
SR2=RXY2+DZ02
SR =DSQRT(SR2)
SR3=SR*SR2
SR5=SR3*SR2
!
XHF(1)=DZ/SR3
XHF(2)=-3.0d0*DX*DZ/SR5
XHF(3)=-3.0d0*DY*DZ/SR5
XHF(4)=-3.0d0*DZ02/SR5+1.0d0/SR3
!
PI4 = 4.0D0*PI
!
DO 120 I=1, 4
XHF(I)=-XHF(I)/PI4
120 CONTINUE
!
RETURN
END
!
!
!===================================================
! G=-1/4/pi*(1/r1)
! XF(1) : dG(x,x0)/dz0
! XF(2) :d^2G/dx/dz0; XF(3):d^2G/dy/dz0; XF(4):d^2G/dz/dz0
!
!
SUBROUTINE DTGRN1(H,X,X0,Y,Y0,Z,Z0,XHF)
!
IMPLICIT NONE
INTEGER I
REAL*8,INTENT(IN):: H,X,Y,Z,X0,Y0,Z0
REAL*8,INTENT(OUT):: XHF(4)
REAL*8 DX,DY,DZ,DZ1
REAL*8 RXY2,DZ02,DZ12,SR2,ST2,SR,SR3,SR5,ST,ST3,ST5
REAL*8 PI,PI4
!
DATA PI/3.14159265358979/
!C
!C H: water depth, negtive for infinity water depth
!C
PI4 = 4.0D0*PI
DX=X-X0
DY=Y-Y0
DZ1 =Z+ Z0 +2.0*H
RXY2=DX*DX+DY*DY
DZ12=DZ1*DZ1
!
IF(H .GT. 0) THEN
ST2=RXY2+DZ12
ST=DSQRT(ST2)
ST3=ST*ST2
ST5=ST3*ST2
!
XHF(1)= -DZ1/ST3
XHF(2)=3.0d0*DX*DZ1/ST5
XHF(3)=3.0d0*DY*DZ1/ST5
XHF(4)=3.0d0*DZ12/ST5-1.0d0/ST3
!
ELSE
!
XHF(:)=0.0d0
!
ENDIF
!
DO 120 I=1, 4
XHF(I)=-XHF(I)/PI4
120 CONTINUE
!
RETURN
END
!===================================================
! G=-1/4/pi*(1/r+1/r1) !!没有写完整
! XF(1) : G(x,x0)
! XF(2) :dG/dx; XF(3):dG/dy; XF(4):dG/dz
! XF(5):dG/dx/dx0; XF(6):dG/dx/dy0; XF(7):dG/dx/dz0
! XF(8):dG/dy/dx0; XF(9):dG/dy/dy0; XF(10):dG/dy/dz0
! XF(11):dG/dz/dx0; XF(12):dG/dz/dy0; XF(13):dG/dz/dz0
!
SUBROUTINE GREEN1(H,X,X0,Y,Y0,Z,Z0,XFF)
IMPLICIT NONE
REAL*8,INTENT(IN):: H,X,X0,Y,Y0,Z,Z0
REAL*8,INTENT(OUT):: XFF(13)
REAL*8 DX,DY,DZ,DZ1,RXY
REAL*8 DX2,DY2,DZ02,DZ12
REAL*8 RXY2,SR2,ST2,R,R1
REAL*8 PI,PI4
!
DATA PI/3.14159265358979/
!
! H: water depth, negtive for infinity water depth
!
PI4 = 4.*PI
IF(H .GT. 0) THEN
DX = X-X0
DY = Y-Y0
DZ = Z-Z0
DZ1= Z+Z0+2*H
DX2 = DX*DX
DY2 = DY*DY
RXY2= DX2 + DY2
RXY = DSQRT(RXY2)
DZ02= DZ*DZ
DZ12= DZ1*DZ1
SR2=RXY2+DZ02
ST2=RXY2+DZ12
R =DSQRT(SR2)
R1=DSQRT(ST2)
XFF(1) =(-1./R -1./R1)/PI4
XFF(2) =(DX/R**3+ DX/R1**3)/PI4
XFF(3) =(DY/R**3+ DY /R1**3)/PI4
XFF(4) =(DZ/R**3+ DZ1/R1**3)/PI4
XFF(5) =((3.*DX2-SR2)/R**5+(3.*DX2-ST2)/R1**5)/PI4
XFF(6) =(3.*DX*DY*(1./R**5+1./R1**5))/PI4
XFf(7) =(3.*DX*(DZ/R**5))/PI4 !-DZ1/R1**5))/PI4
XFF(8) =(3.*DX*DY*(1./R**5+1./R1**5))/PI4
XFF(9)=((3.*DY2-SR2)/R**5+(3.*DY2-ST2) /R1**5)/PI4
XFf(10)=(3.*DY*(DZ/R**5))/PI4 !-DZ1/R1**5))/PI4
XFF(11)=(3.*DX*(DZ/R**5+DZ1/R1**5))/PI4
XFF(12)=(3.*DY*(DZ/R**5+DZ1/R1**5))/PI4
XFf(13)=((3.*DZ02-SR2)/R**5)/PI4 !-(3.*DZ12-ST2) /R1**5)/PI4
ELSE
DZ = Z-Z0
DX2 = DX*DX
DY2 = DY*DY
RXY2= DX2 + DY2
RXY = DSQRT(RXY2)
DZ02= DZ*DZ
SR2=RXY2+DZ02
R =DSQRT(SR2)
XFF(1) =-1./R /PI4
XFF(2) =DX/R**3/PI4
XFF(3) =DY/R**3/PI4
XFF(4) =DZ/R**3/PI4
XFF(5) =(3.*DX2-SR2)/R**5/PI4
XFF(6) =3.*DX*DY/R**5/PI4
XFf(7) =3.*DX*DZ/R**5/PI4 !-DZ1/R1**5))/PI4
XFF(8) =3.*DX*DY/R**5/PI4
XFF(9) =(3.*DY2-SR2)/R**5/PI4
XFf(10)=3.*DY*DZ/R**5/PI4 !-DZ1/R1**5))/PI4
XFF(11)=3.*DX*DZ/R**5/PI4
XFF(12)=3.*DY*DZ/R**5/PI4
XFf(13)=(3.*DZ02-SR2)/R**5/PI4 !-(3.*DZ12-ST2) /R1**5)/PI4
ENDIF
RETURN
END