-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.f90
217 lines (158 loc) · 4.19 KB
/
main.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
PROGRAM stokes2
USE prms
USE data
USE rkmod
USE membrane
USE outmod
USE icmod
USE areamod
USE pme
USE expint
IMPLICIT none
call init
! call testQflow; stop
! call testNb2Nf; stop
! call testderNbb; stop
! call testMp; stop
! call testb; stop
! call testFFT; stop
call solve
call final
CONTAINS
SUBROUTINE init
call initEi!; call testEi; stop
call initprms
call initdata
call initRK
call initmembrane
call ic
call initout(lt0)
! call initQflow; print *,"INITIALIZED QFLOW"
call initsurfor; print *,"SURFOR DONE"
call nlister(X,lt0*dt); print *,"NLISTER DONE"
call initrhs; print *,"INITIALIZED RHS"
call mknlist(X,lt0*dt); print *,"MADE INITIAL NBRLIST"
call initPME; print *,"INITIALIZED PME"
call output(lt0,time0); print *,"IC OUTPUT"
END SUBROUTINE init
SUBROUTINE solve
real :: time
integer :: lt,k,l
do lt = lt0+1,lt0+Nt
print *,lt
time = time0 + REAL(lt-1-lt0)*dt
if (Nti.gt.0.and.MOD(lt,Nti).eq.0) then
print *,"SHOCK SHOCK SHOCK SHOCK"
Umax = 0.
X(1,:) = X(1,:) + Ueps_in*COS(4.*Pi*X(2,:)/Lb(1))
! X(1,:) = X(1,:) + Ueps_in*(X(2,:)-Lb(2)/2)/Lb(2)
end if
call rk2(time,lt)
call adjustareas(X)
call correctareas(X)
if (MOD(lt,inlist).eq.0) then
call nlister(X,time)
call mknlist(X,time)
end if
call output(lt,time)
end do
END SUBROUTINE solve
SUBROUTINE final
call finaldata
call finalmembrane
call finalout
END SUBROUTINE final
SUBROUTINE testFFT
real, dimension(NcP(1),NcP(2),2) :: QQ
real :: xx,yy
integer :: i,j
do j = 1,NcP(2)
yy = Lb(2)*REAL(j-1)/REAL(NcP(2))
do i = 1,NcP(1)
xx = Lb(1)*REAL(i-1)/REAL(NcP(1))
! QVm(i,j,:) = SIN(2.*Pi*xx/Lb) + 1. + SIN(4.*Pi*xx/Lb + 4.*Pi*yy/Lb)
QVm(i,j,:) = EXP(SIN(4.*Pi*xx/Lb(1) + 4.*Pi*yy/Lb(2)))
! QQ(i,j,:) = 8.*Pi**2/Lb**2*EXP(SIN(4.*Pi*xx/Lb(1) + 4.*Pi*yy/Lb(2)))*(1.+COS(8.*Pi*(xx+yy)/Lb)-2.*SIN(4.*Pi*(xx/Lb(1)+yy/Lb(2))))
! QQ(i,j,:) = - 16.*Pi**2/Lb**2*SIN(4.*Pi*xx/Lb + 4.*Pi*yy/Lb)
end do
end do
! QQ = QVm
call poissonG
!print *,MAXVAL((QVm-QQ)**2)
do i = 1,NcP(1)
write(42,*)i,QQ(i,1,1)
end do
do j = 1,NcP(2)
write(50,"(16F8.4)")(QQ(i,j,2),i=1,NcP(1))
end do
do j = 1,NcP(2)
write(51,"(16F8.4)")(QVm(i,j,2),i=1,NcP(1))
end do
END SUBROUTINE testFFT
SUBROUTINE testb
integer :: i
integer, parameter :: N = 32
integer, parameter :: p = 6
complex, dimension(-N/2:N/2-1) :: b
complex :: a
real :: u
integer :: k,m
! call makeb(p,N,b)
do k = -N/2,N/2-1
write(61,"(I5,2F20.10)")k,b(k)
end do
k = 13
do i = 1,1001
u = -20. + 40.*REAL(i-1)/1000
a = 0.
do m = INT(u)-p,INT(u)
a = a + Mp(u-REAL(m),p)*EXP(2.*Pi*(0.,1.)*REAL(k*m)/REAL(N))
end do
write(60,"(5F20.10)")u,EXP(2.*Pi*(0.,1.)*REAL(k)*u/REAL(N)),b(k)*a
end do
END SUBROUTINE testb
SUBROUTINE testMp
integer :: i
real :: u,b
do i = 1,101
u = -5. + 10.*REAL(i-1)/100
b = Mp(u,3)
write(60,*)u,b
end do
END SUBROUTINE testMp
SUBROUTINE testder
real, dimension(Nb) :: f,df
integer :: i
real :: th,l0
l0 = 2.*Pi
do i = 1,Nb
th = 2.*Pi*REAL(i-1)/REAL(Nb)
f(i) = EXP(COS(th))
end do
call dersp(f,l0,df)
do i = 1,Nb
th = 2.*Pi*REAL(i-1)/REAL(Nb)
write(2,"(I4,3F20.10)")i,f(i),df(i),-SIN(th)*f(i)
end do
END SUBROUTINE testder
!!$ SUBROUTINE testderNbb
!!$
!!$ real, dimension(Nbb) :: f,df
!!$ integer :: i
!!$ real :: th,l0
!!$
!!$ l0 = 2.*Pi
!!$ do i = 1,Nbb
!!$ th = 2.*Pi*REAL(i-1)/REAL(Nbb)
!!$ f(i) = EXP(COS(th))
!!$ end do
!!$
!!$ call derspNbb(f,l0,df)
!!$
!!$ do i = 1,Nbb
!!$ th = 2.*Pi*REAL(i-1)/REAL(Nbb)
!!$ write(20,"(I4,3F20.10)")i,f(i),df(i),-SIN(th)*f(i)
!!$ end do
!!$
!!$ END SUBROUTINE testderNbb
END PROGRAM stokes2