PyFishPack 0.1.0__cp313-cp313-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- PyFishPack/__init__.py +86 -0
- PyFishPack/__pycache__/__init__.cpython-313.pyc +0 -0
- PyFishPack/__pycache__/apps.cpython-313.pyc +0 -0
- PyFishPack/_dummy.c +23 -0
- PyFishPack/_dummy.cp313-win_amd64.pyd +0 -0
- PyFishPack/apps.py +3640 -0
- PyFishPack/fishpack.cp313-win_amd64.dll.a +0 -0
- PyFishPack/fishpack.cp313-win_amd64.pyd +0 -0
- PyFishPack/meson.build +213 -0
- PyFishPack/src/archive/f77/Makefile +19 -0
- PyFishPack/src/archive/f77/blktri.f +1404 -0
- PyFishPack/src/archive/f77/cblktri.f +1414 -0
- PyFishPack/src/archive/f77/cmgnbn.f +1592 -0
- PyFishPack/src/archive/f77/comf.f +186 -0
- PyFishPack/src/archive/f77/fftpack.f +2968 -0
- PyFishPack/src/archive/f77/genbun.f +1335 -0
- PyFishPack/src/archive/f77/gnbnaux.f +314 -0
- PyFishPack/src/archive/f77/hstcrt.f +443 -0
- PyFishPack/src/archive/f77/hstcsp.f +683 -0
- PyFishPack/src/archive/f77/hstcyl.f +485 -0
- PyFishPack/src/archive/f77/hstplr.f +538 -0
- PyFishPack/src/archive/f77/hstssp.f +634 -0
- PyFishPack/src/archive/f77/hw3crt.f +687 -0
- PyFishPack/src/archive/f77/hwscrt.f +512 -0
- PyFishPack/src/archive/f77/hwscsp.f +728 -0
- PyFishPack/src/archive/f77/hwscyl.f +538 -0
- PyFishPack/src/archive/f77/hwsplr.f +602 -0
- PyFishPack/src/archive/f77/hwsssp.f +780 -0
- PyFishPack/src/archive/f77/pois3d.f +550 -0
- PyFishPack/src/archive/f77/poistg.f +875 -0
- PyFishPack/src/archive/f77/sepaux.f +361 -0
- PyFishPack/src/archive/f77/sepeli.f +1029 -0
- PyFishPack/src/archive/f77/sepx4.f +958 -0
- PyFishPack/src/centered_axisymmetric_spherical_solver.f90 +1002 -0
- PyFishPack/src/centered_cartesian_helmholtz_solver_3d.f90 +819 -0
- PyFishPack/src/centered_cartesian_solver.f90 +583 -0
- PyFishPack/src/centered_cylindrical_solver.f90 +634 -0
- PyFishPack/src/centered_helmholtz_solvers.f90 +156 -0
- PyFishPack/src/centered_polar_solver.f90 +746 -0
- PyFishPack/src/centered_real_linear_systems_solver.f90 +280 -0
- PyFishPack/src/centered_spherical_solver.f90 +928 -0
- PyFishPack/src/complex_block_tridiagonal_linear_systems_solver.f90 +1947 -0
- PyFishPack/src/complex_linear_systems_solver.f90 +1787 -0
- PyFishPack/src/fftpack_c_api.f90 +86 -0
- PyFishPack/src/fishpack.f90 +191 -0
- PyFishPack/src/fishpack.pyf +504 -0
- PyFishPack/src/fishpack_c_api.f90 +365 -0
- PyFishPack/src/fishpack_original.pyf +2119 -0
- PyFishPack/src/fishpack_precision.f90 +53 -0
- PyFishPack/src/general_linear_systems_solver_3d.f90 +296 -0
- PyFishPack/src/iterative_solvers.f90 +969 -0
- PyFishPack/src/main.f90 +10 -0
- PyFishPack/src/pyfishpack_module.c +1302 -0
- PyFishPack/src/real_block_tridiagonal_linear_systems_solver.f90 +319 -0
- PyFishPack/src/sepeli.f90 +1454 -0
- PyFishPack/src/sepx4.f90 +1338 -0
- PyFishPack/src/staggered_axisymmetric_spherical_solver.f90 +908 -0
- PyFishPack/src/staggered_cartesian_solver.f90 +553 -0
- PyFishPack/src/staggered_cylindrical_solver.f90 +630 -0
- PyFishPack/src/staggered_helmholtz_solvers.f90 +172 -0
- PyFishPack/src/staggered_polar_solver.f90 +651 -0
- PyFishPack/src/staggered_real_linear_systems_solver.f90 +258 -0
- PyFishPack/src/staggered_spherical_solver.f90 +758 -0
- PyFishPack/src/three_dimensional_solvers.f90 +602 -0
- PyFishPack/src/type_CenteredCyclicReductionUtility.f90 +1714 -0
- PyFishPack/src/type_CyclicReductionUtility.f90 +472 -0
- PyFishPack/src/type_FishpackWorkspace.f90 +290 -0
- PyFishPack/src/type_GeneralizedCyclicReductionUtility.f90 +1980 -0
- PyFishPack/src/type_PeriodicFastFourierTransform.f90 +3789 -0
- PyFishPack/src/type_SepAux.f90 +586 -0
- PyFishPack/src/type_StaggeredCyclicReductionUtility.f90 +893 -0
- pyfishpack-0.1.0.dist-info/DELVEWHEEL +2 -0
- pyfishpack-0.1.0.dist-info/METADATA +81 -0
- pyfishpack-0.1.0.dist-info/RECORD +81 -0
- pyfishpack-0.1.0.dist-info/WHEEL +5 -0
- pyfishpack-0.1.0.dist-info/licenses/LICENSE +21 -0
- pyfishpack-0.1.0.dist-info/top_level.txt +1 -0
- pyfishpack.libs/libgcc_s_seh-1-25d59ccffa1a9009644065b069829e07.dll +0 -0
- pyfishpack.libs/libgfortran-5-08f2195cfa0d823e13371c5c3186a82a.dll +0 -0
- pyfishpack.libs/libquadmath-0-c5abb9113f1ee64b87a889958e4b7418.dll +0 -0
- pyfishpack.libs/libwinpthread-1-83908d14abfafb8b3bfa38cf51ecee56.dll +0 -0
|
@@ -0,0 +1,602 @@
|
|
|
1
|
+
module three_dimensional_solvers
|
|
2
|
+
|
|
3
|
+
use fishpack_precision, only: &
|
|
4
|
+
wp, & ! Working precision
|
|
5
|
+
ip, & ! Integer precision
|
|
6
|
+
PI
|
|
7
|
+
|
|
8
|
+
use type_FishpackWorkspace, only: &
|
|
9
|
+
FishpackWorkspace
|
|
10
|
+
|
|
11
|
+
use type_PeriodicFastFourierTransform, only: &
|
|
12
|
+
PeriodicFastFourierTransform
|
|
13
|
+
|
|
14
|
+
! Explicit typing only
|
|
15
|
+
implicit none
|
|
16
|
+
|
|
17
|
+
! Everything is private unless stated otherwise
|
|
18
|
+
private
|
|
19
|
+
public :: pois3d
|
|
20
|
+
public :: hw3crt
|
|
21
|
+
public :: SolverUtility3D
|
|
22
|
+
|
|
23
|
+
! Parameters confined to the module
|
|
24
|
+
real(wp), parameter :: ZERO = 0.0_wp
|
|
25
|
+
real(wp), parameter :: HALF = 0.5_wp
|
|
26
|
+
real(wp), parameter :: ONE = 1.0_wp
|
|
27
|
+
real(wp), parameter :: TWO = 2.0_wp
|
|
28
|
+
real(wp), parameter :: FOUR = 4.0_wp
|
|
29
|
+
integer(ip), parameter :: SIZE_OF_WORKSPACE_INDICES = 6
|
|
30
|
+
|
|
31
|
+
type, public :: SolverUtility3D
|
|
32
|
+
! Type components
|
|
33
|
+
integer(ip) :: IIWK = SIZE_OF_WORKSPACE_INDICES
|
|
34
|
+
contains
|
|
35
|
+
! Type-bound procedures
|
|
36
|
+
procedure, nopass :: pois3dd
|
|
37
|
+
procedure, nopass :: check_input_arguments
|
|
38
|
+
procedure, nopass :: get_workspace_indices
|
|
39
|
+
end type SolverUtility3D
|
|
40
|
+
|
|
41
|
+
! Declare interfaces for submodule implementation
|
|
42
|
+
interface
|
|
43
|
+
module subroutine pois3d(lperod, l, c1, mperod, m, c2, nperod, n, a, b, c, &
|
|
44
|
+
ldimf, mdimf, f, ierror)
|
|
45
|
+
|
|
46
|
+
! Dummy arguments
|
|
47
|
+
integer(ip), intent(in) :: lperod
|
|
48
|
+
integer(ip), intent(in) :: l
|
|
49
|
+
integer(ip), intent(in) :: mperod
|
|
50
|
+
integer(ip), intent(in) :: m
|
|
51
|
+
integer(ip), intent(in) :: nperod
|
|
52
|
+
integer(ip), intent(in) :: n
|
|
53
|
+
integer(ip), intent(in) :: ldimf
|
|
54
|
+
integer(ip), intent(in) :: mdimf
|
|
55
|
+
integer(ip), intent(out) :: ierror
|
|
56
|
+
real(wp), intent(in) :: c1
|
|
57
|
+
real(wp), intent(in) :: c2
|
|
58
|
+
real(wp), intent(inout) :: a(:)
|
|
59
|
+
real(wp), intent(inout) :: b(:)
|
|
60
|
+
real(wp), intent(inout) :: c(:)
|
|
61
|
+
real(wp), intent(inout) :: f(:,:,:)
|
|
62
|
+
end subroutine pois3d
|
|
63
|
+
|
|
64
|
+
module subroutine hw3crt(xs, xf, l, lbdcnd, bdxs, bdxf, ys, yf, m, mbdcnd, &
|
|
65
|
+
bdys, bdyf, zs, zf, n, nbdcnd, bdzs, bdzf, elmbda, ldimf, &
|
|
66
|
+
mdimf, f, pertrb, ierror)
|
|
67
|
+
|
|
68
|
+
! Dummy arguments
|
|
69
|
+
integer(ip), intent(in) :: l
|
|
70
|
+
integer(ip), intent(in) :: lbdcnd
|
|
71
|
+
integer(ip), intent(in) :: m
|
|
72
|
+
integer(ip), intent(in) :: mbdcnd
|
|
73
|
+
integer(ip), intent(in) :: n
|
|
74
|
+
integer(ip), intent(in) :: nbdcnd
|
|
75
|
+
integer(ip), intent(in) :: ldimf
|
|
76
|
+
integer(ip), intent(in) :: mdimf
|
|
77
|
+
integer(ip), intent(out) :: ierror
|
|
78
|
+
real(wp), intent(in) :: xs
|
|
79
|
+
real(wp), intent(in) :: xf
|
|
80
|
+
real(wp), intent(in) :: ys
|
|
81
|
+
real(wp), intent(in) :: yf
|
|
82
|
+
real(wp), intent(in) :: zs
|
|
83
|
+
real(wp), intent(in) :: zf
|
|
84
|
+
real(wp), intent(in) :: elmbda
|
|
85
|
+
real(wp), intent(out) :: pertrb
|
|
86
|
+
real(wp), intent(in) :: bdxs(:,:)
|
|
87
|
+
real(wp), intent(in) :: bdxf(:,:)
|
|
88
|
+
real(wp), intent(in) :: bdys(:,:)
|
|
89
|
+
real(wp), intent(in) :: bdyf(:,:)
|
|
90
|
+
real(wp), intent(in) :: bdzs(:,:)
|
|
91
|
+
real(wp), intent(in) :: bdzf(:,:)
|
|
92
|
+
real(wp), intent(inout) :: f(:,:,:)
|
|
93
|
+
end subroutine hw3crt
|
|
94
|
+
end interface
|
|
95
|
+
|
|
96
|
+
contains
|
|
97
|
+
|
|
98
|
+
subroutine pois3dd(lperod, l, c1, mperod, m, c2, nperod, n, a, b, &
|
|
99
|
+
c, ldimf, mdimf, f, ierror, w, workspace_indices)
|
|
100
|
+
|
|
101
|
+
! Dummy arguments
|
|
102
|
+
integer(ip), intent(in) :: lperod
|
|
103
|
+
integer(ip), intent(in) :: l
|
|
104
|
+
integer(ip), intent(in) :: mperod
|
|
105
|
+
integer(ip), intent(in) :: m
|
|
106
|
+
integer(ip), intent(in) :: nperod
|
|
107
|
+
integer(ip), intent(in) :: n
|
|
108
|
+
integer(ip), intent(in) :: ldimf
|
|
109
|
+
integer(ip), intent(in) :: mdimf
|
|
110
|
+
integer(ip), intent(out) :: ierror
|
|
111
|
+
integer(ip), intent(in) :: workspace_indices(:)
|
|
112
|
+
real(wp), intent(in) :: c1
|
|
113
|
+
real(wp), intent(in) :: c2
|
|
114
|
+
real(wp), intent(inout) :: a(n)
|
|
115
|
+
real(wp), intent(inout) :: b(n)
|
|
116
|
+
real(wp), intent(inout) :: c(n)
|
|
117
|
+
real(wp), intent(inout) :: f(:,:,:)
|
|
118
|
+
real(wp), intent(inout) :: w(:)
|
|
119
|
+
|
|
120
|
+
! Local variables
|
|
121
|
+
integer(ip) :: nh, nhm1, nodd, i, j, k
|
|
122
|
+
real(wp) :: temp_save(SIZE_OF_WORKSPACE_INDICES)
|
|
123
|
+
|
|
124
|
+
! Check input arguments
|
|
125
|
+
call check_input_arguments(lperod, l, mperod, m, nperod, n, &
|
|
126
|
+
a, b, c, ldimf, mdimf, ierror)
|
|
127
|
+
|
|
128
|
+
! Check error flag
|
|
129
|
+
if (ierror /= 0) return
|
|
130
|
+
|
|
131
|
+
associate( &
|
|
132
|
+
lp => lperod + 1, &
|
|
133
|
+
mp => mperod + 1, &
|
|
134
|
+
np => nperod + 1, &
|
|
135
|
+
iwyrt => workspace_indices(1), &
|
|
136
|
+
iwt => workspace_indices(2), &
|
|
137
|
+
iwd => workspace_indices(3), &
|
|
138
|
+
iwbb => workspace_indices(4), &
|
|
139
|
+
iwx => workspace_indices(5), &
|
|
140
|
+
iwy => workspace_indices(6) &
|
|
141
|
+
)
|
|
142
|
+
|
|
143
|
+
if (np == 1) then
|
|
144
|
+
! Reorder unknowns when nperod = 0
|
|
145
|
+
nh = (n + 1)/2
|
|
146
|
+
nhm1 = nh - 1
|
|
147
|
+
|
|
148
|
+
if (2*nh == n) then
|
|
149
|
+
nodd = 2
|
|
150
|
+
else
|
|
151
|
+
nodd = 1
|
|
152
|
+
end if
|
|
153
|
+
|
|
154
|
+
do i = 1, l
|
|
155
|
+
do j = 1, m
|
|
156
|
+
do k = 1, nhm1
|
|
157
|
+
w(k) = f(i, j, nh-k) - f(i, j, k+nh)
|
|
158
|
+
w(k+nh) = f(i, j, nh-k) + f(i, j, k+nh)
|
|
159
|
+
end do
|
|
160
|
+
|
|
161
|
+
w(nh) = TWO*f(i, j, nh)
|
|
162
|
+
|
|
163
|
+
select case (nodd)
|
|
164
|
+
case (1)
|
|
165
|
+
f(i, j,:n) = w(:n)
|
|
166
|
+
case (2)
|
|
167
|
+
w(n) = TWO * f(i, j, n)
|
|
168
|
+
f(i, j,:n) = w(:n)
|
|
169
|
+
end select
|
|
170
|
+
|
|
171
|
+
end do
|
|
172
|
+
end do
|
|
173
|
+
|
|
174
|
+
temp_save(1) = c(nhm1)
|
|
175
|
+
temp_save(2) = a(nh)
|
|
176
|
+
temp_save(3) = c(nh)
|
|
177
|
+
temp_save(4) = b(nhm1)
|
|
178
|
+
temp_save(5) = b(n)
|
|
179
|
+
temp_save(6) = a(n)
|
|
180
|
+
|
|
181
|
+
c(nhm1) = ZERO
|
|
182
|
+
a(nh) = ZERO
|
|
183
|
+
c(nh) = TWO*c(nh)
|
|
184
|
+
|
|
185
|
+
select case (nodd)
|
|
186
|
+
case (2)
|
|
187
|
+
a(n) = c(nh)
|
|
188
|
+
case default
|
|
189
|
+
b(nhm1) = b(nhm1) - a(nh-1)
|
|
190
|
+
b(n) = b(n) + a(n)
|
|
191
|
+
end select
|
|
192
|
+
end if
|
|
193
|
+
|
|
194
|
+
call pois3dd_lower_routine(lp, l, mp, m, n, a, b, c, f, &
|
|
195
|
+
w, w(iwyrt:), w(iwt:), w(iwd:), w(iwx:), w(iwy:), c1, c2, w(iwbb:))
|
|
196
|
+
|
|
197
|
+
if (np == 1) then
|
|
198
|
+
do i = 1, l
|
|
199
|
+
do j = 1, m
|
|
200
|
+
w(nh-1:nh-nhm1:(-1))= &
|
|
201
|
+
HALF *(f(i, j, nh+1:nhm1+nh)+f(i, j,:nhm1))
|
|
202
|
+
w(nh+1:nhm1+nh) = &
|
|
203
|
+
HALF *(f(i, j, nh+1:nhm1+nh)-f(i, j,:nhm1))
|
|
204
|
+
w(nh) = HALF *f(i, j, nh)
|
|
205
|
+
select case (nodd)
|
|
206
|
+
case (1)
|
|
207
|
+
f(i, j,:n) = w(:n)
|
|
208
|
+
case (2)
|
|
209
|
+
w(n) = HALF * f(i, j, n)
|
|
210
|
+
f(i, j,:n) = w(:n)
|
|
211
|
+
end select
|
|
212
|
+
end do
|
|
213
|
+
end do
|
|
214
|
+
|
|
215
|
+
c(nhm1) = temp_save(1)
|
|
216
|
+
a(nh) = temp_save(2)
|
|
217
|
+
c(nh) = temp_save(3)
|
|
218
|
+
b(nhm1) = temp_save(4)
|
|
219
|
+
b(n) = temp_save(5)
|
|
220
|
+
a(n) = temp_save(6)
|
|
221
|
+
end if
|
|
222
|
+
end associate
|
|
223
|
+
|
|
224
|
+
end subroutine pois3dd
|
|
225
|
+
|
|
226
|
+
pure subroutine check_input_arguments(lperod, l, mperod, m, nperod, n, &
|
|
227
|
+
a, b, c, ldimf, mdimf, ierror)
|
|
228
|
+
|
|
229
|
+
! Dummy arguments
|
|
230
|
+
integer(ip), intent(in) :: lperod
|
|
231
|
+
integer(ip), intent(in) :: l
|
|
232
|
+
integer(ip), intent(in) :: mperod
|
|
233
|
+
integer(ip), intent(in) :: m
|
|
234
|
+
integer(ip), intent(in) :: nperod
|
|
235
|
+
integer(ip), intent(in) :: n
|
|
236
|
+
integer(ip), intent(in) :: ldimf
|
|
237
|
+
integer(ip), intent(in) :: mdimf
|
|
238
|
+
integer(ip), intent(out) :: ierror
|
|
239
|
+
real(wp), intent(in) :: a(n)
|
|
240
|
+
real(wp), intent(in) :: b(n)
|
|
241
|
+
real(wp), intent(in) :: c(n)
|
|
242
|
+
|
|
243
|
+
associate( &
|
|
244
|
+
lp => lperod + 1, &
|
|
245
|
+
mp => mperod + 1, &
|
|
246
|
+
np => nperod + 1 &
|
|
247
|
+
)
|
|
248
|
+
|
|
249
|
+
if (lp < 1 .or. lp > 5) then
|
|
250
|
+
ierror = 1
|
|
251
|
+
else if (l < 3) then
|
|
252
|
+
ierror = 2
|
|
253
|
+
else if (mp < 1 .or. mp > 5) then
|
|
254
|
+
ierror = 3
|
|
255
|
+
else if (m < 3) then
|
|
256
|
+
ierror = 4
|
|
257
|
+
else if (np < 1 .or. np > 2) then
|
|
258
|
+
ierror = 5
|
|
259
|
+
else if (n < 3) then
|
|
260
|
+
ierror = 6
|
|
261
|
+
else if (ldimf < l) then
|
|
262
|
+
ierror = 7
|
|
263
|
+
else if (mdimf < m) then
|
|
264
|
+
ierror = 8
|
|
265
|
+
else if (np == 1) then
|
|
266
|
+
if (any(a /= c(1)) .or. any(c /= c(1)) .or. any(b /= b(1))) then
|
|
267
|
+
ierror = 9
|
|
268
|
+
end if
|
|
269
|
+
else if (nperod == 1 .and. (a(1) /= ZERO .or. c(n) /= ZERO)) then
|
|
270
|
+
ierror = 10
|
|
271
|
+
else
|
|
272
|
+
ierror = 0
|
|
273
|
+
end if
|
|
274
|
+
end associate
|
|
275
|
+
|
|
276
|
+
end subroutine check_input_arguments
|
|
277
|
+
|
|
278
|
+
pure function get_workspace_indices(l, m, n) &
|
|
279
|
+
result (return_value)
|
|
280
|
+
|
|
281
|
+
! Dummy arguments
|
|
282
|
+
integer(ip), intent(in) :: l
|
|
283
|
+
integer(ip), intent(in) :: m
|
|
284
|
+
integer(ip), intent(in) :: n
|
|
285
|
+
integer(ip) :: return_value(SIZE_OF_WORKSPACE_INDICES)
|
|
286
|
+
|
|
287
|
+
associate( indx => return_value )
|
|
288
|
+
indx(1) = l + 1
|
|
289
|
+
indx(2) = indx(1) + m
|
|
290
|
+
indx(3) = indx(2) + max(l, m, n) + 1
|
|
291
|
+
indx(4) = indx(3) + n
|
|
292
|
+
indx(5) = indx(4) + n
|
|
293
|
+
indx(6) = indx(5) + 7*((l + 1)/2) + 15
|
|
294
|
+
end associate
|
|
295
|
+
|
|
296
|
+
end function get_workspace_indices
|
|
297
|
+
|
|
298
|
+
subroutine pois3dd_lower_routine(lp, l, mp, m, n, a, b, c, &
|
|
299
|
+
f, xrt, yrt, t, d, wx, wy, c1, c2, bb)
|
|
300
|
+
|
|
301
|
+
! Dummy arguments
|
|
302
|
+
integer(ip), intent(in) :: lp
|
|
303
|
+
integer(ip), intent(in) :: l
|
|
304
|
+
integer(ip), intent(in) :: mp
|
|
305
|
+
integer(ip), intent(in) :: m
|
|
306
|
+
integer(ip), intent(in) :: n
|
|
307
|
+
real(wp), intent(in) :: c1
|
|
308
|
+
real(wp), intent(in) :: c2
|
|
309
|
+
real(wp), intent(inout) :: a(n)
|
|
310
|
+
real(wp), intent(in) :: b(n)
|
|
311
|
+
real(wp), intent(inout) :: c(n)
|
|
312
|
+
real(wp), intent(inout) :: f(:,:,:)
|
|
313
|
+
real(wp), intent(inout) :: xrt(:)
|
|
314
|
+
real(wp), intent(inout) :: yrt(:)
|
|
315
|
+
real(wp), intent(inout) :: t(:)
|
|
316
|
+
real(wp), intent(inout) :: d(:)
|
|
317
|
+
real(wp), intent(inout) :: wx(:)
|
|
318
|
+
real(wp), intent(inout) :: wy(:)
|
|
319
|
+
real(wp), intent(inout) :: bb(:)
|
|
320
|
+
|
|
321
|
+
! Local variables
|
|
322
|
+
integer(ip) :: lr, mr, nr, lrdel, i, mrdel, j, ifwrd, is, k
|
|
323
|
+
real(wp) :: scalx, dx, di, scaly, dy, dj
|
|
324
|
+
type(PeriodicFastFourierTransform) :: fft
|
|
325
|
+
|
|
326
|
+
lr = l
|
|
327
|
+
mr = m
|
|
328
|
+
nr = n
|
|
329
|
+
|
|
330
|
+
! generate transform roots
|
|
331
|
+
lrdel = ((lp - 1)*(lp - 3)*(lp - 5))/3
|
|
332
|
+
scalx = lr + lrdel
|
|
333
|
+
dx = PI/(TWO*scalx)
|
|
334
|
+
|
|
335
|
+
select case (lp)
|
|
336
|
+
case (1)
|
|
337
|
+
xrt(1) = ZERO
|
|
338
|
+
xrt(lr) = -FOUR*c1
|
|
339
|
+
|
|
340
|
+
do i = 3, lr, 2
|
|
341
|
+
xrt(i-1) = -FOUR*c1*sin(real(i - 1, kind=wp)*dx)**2
|
|
342
|
+
xrt(i) = xrt(i-1)
|
|
343
|
+
end do
|
|
344
|
+
|
|
345
|
+
call fft%rffti(lr, wx)
|
|
346
|
+
|
|
347
|
+
case default
|
|
348
|
+
|
|
349
|
+
select case (lp)
|
|
350
|
+
case (2)
|
|
351
|
+
di = ZERO
|
|
352
|
+
case (3, 5)
|
|
353
|
+
di = HALF
|
|
354
|
+
scalx = TWO*scalx
|
|
355
|
+
case (4)
|
|
356
|
+
di = ONE
|
|
357
|
+
end select
|
|
358
|
+
|
|
359
|
+
do i = 1, lr
|
|
360
|
+
xrt(i) = -FOUR*c1*sin((real(i, kind=wp) - di)*dx)**2
|
|
361
|
+
end do
|
|
362
|
+
|
|
363
|
+
scalx = TWO*scalx
|
|
364
|
+
|
|
365
|
+
if (lp /= 1) then
|
|
366
|
+
select case (lp)
|
|
367
|
+
case (2)
|
|
368
|
+
call fft%sinti(lr, wx)
|
|
369
|
+
case (3)
|
|
370
|
+
call fft%sinqi(lr, wx)
|
|
371
|
+
case (4)
|
|
372
|
+
call fft%costi(lr, wx)
|
|
373
|
+
case (5)
|
|
374
|
+
call fft%cosqi(lr, wx)
|
|
375
|
+
case default
|
|
376
|
+
|
|
377
|
+
xrt(1) = ZERO
|
|
378
|
+
xrt(lr) = -FOUR*c1
|
|
379
|
+
|
|
380
|
+
do i = 3, lr, 2
|
|
381
|
+
xrt(i-1) = -FOUR*c1*sin(real(i - 1)*dx)**2
|
|
382
|
+
xrt(i) = xrt(i-1)
|
|
383
|
+
end do
|
|
384
|
+
|
|
385
|
+
call fft%rffti(lr, wx)
|
|
386
|
+
end select
|
|
387
|
+
end if
|
|
388
|
+
end select
|
|
389
|
+
|
|
390
|
+
mrdel = ((mp - 1)*(mp - 3)*(mp - 5))/3
|
|
391
|
+
scaly = mr + mrdel
|
|
392
|
+
dy = PI/(TWO*scaly)
|
|
393
|
+
|
|
394
|
+
select case (mp)
|
|
395
|
+
case (1)
|
|
396
|
+
yrt(1) = ZERO
|
|
397
|
+
yrt(mr) = -FOUR*c2
|
|
398
|
+
|
|
399
|
+
do j = 3, mr, 2
|
|
400
|
+
yrt(j-1) = -FOUR*c2*sin(real(j - 1, kind=wp)*dy)**2
|
|
401
|
+
yrt(j) = yrt(j-1)
|
|
402
|
+
end do
|
|
403
|
+
|
|
404
|
+
call fft%rffti(mr, wy)
|
|
405
|
+
|
|
406
|
+
case default
|
|
407
|
+
|
|
408
|
+
select case (mp)
|
|
409
|
+
case (2)
|
|
410
|
+
dj = ZERO
|
|
411
|
+
case (3, 5)
|
|
412
|
+
dj = HALF
|
|
413
|
+
scaly = TWO*scaly
|
|
414
|
+
case (4)
|
|
415
|
+
dj = ONE
|
|
416
|
+
end select
|
|
417
|
+
|
|
418
|
+
do j = 1, mr
|
|
419
|
+
yrt(j) = -FOUR*c2*sin((real(j, kind=wp) - dj)*dy)**2
|
|
420
|
+
end do
|
|
421
|
+
|
|
422
|
+
scaly = TWO * scaly
|
|
423
|
+
|
|
424
|
+
select case (mp)
|
|
425
|
+
case (1)
|
|
426
|
+
yrt(1) = ZERO
|
|
427
|
+
yrt(mr) = -FOUR*c2
|
|
428
|
+
|
|
429
|
+
do j = 3, mr, 2
|
|
430
|
+
yrt(j-1) = -FOUR*c2*sin(real(j - 1, kind=wp)*dy)**2
|
|
431
|
+
yrt(j) = yrt(j-1)
|
|
432
|
+
end do
|
|
433
|
+
|
|
434
|
+
call fft%rffti(mr, wy)
|
|
435
|
+
|
|
436
|
+
case default
|
|
437
|
+
|
|
438
|
+
select case (mp)
|
|
439
|
+
case (2)
|
|
440
|
+
call fft%sinti(mr, wy)
|
|
441
|
+
case (3)
|
|
442
|
+
call fft%sinqi(mr, wy)
|
|
443
|
+
case (4)
|
|
444
|
+
call fft%costi(mr, wy)
|
|
445
|
+
case (5)
|
|
446
|
+
call fft%cosqi(mr, wy)
|
|
447
|
+
end select
|
|
448
|
+
|
|
449
|
+
end select
|
|
450
|
+
end select
|
|
451
|
+
|
|
452
|
+
ifwrd = 1
|
|
453
|
+
is = 1
|
|
454
|
+
|
|
455
|
+
x_transform: do
|
|
456
|
+
do j=1, mr
|
|
457
|
+
do k=1, nr
|
|
458
|
+
do i=1, lr
|
|
459
|
+
t(i) = f(i, j, k)
|
|
460
|
+
end do
|
|
461
|
+
select case (lp)
|
|
462
|
+
case (1)
|
|
463
|
+
select case (ifwrd)
|
|
464
|
+
case (1)
|
|
465
|
+
call fft%rfftf(lr, t, wx)
|
|
466
|
+
case (2)
|
|
467
|
+
call fft%rfftb(lr, t, wx)
|
|
468
|
+
end select
|
|
469
|
+
case (2)
|
|
470
|
+
call fft%sint(lr, t, wx)
|
|
471
|
+
case (3)
|
|
472
|
+
select case (ifwrd)
|
|
473
|
+
case (1)
|
|
474
|
+
call fft%sinqf(lr, t, wx)
|
|
475
|
+
case (2)
|
|
476
|
+
call fft%sinqb(lr, t, wx)
|
|
477
|
+
end select
|
|
478
|
+
case (4)
|
|
479
|
+
call fft%cost(lr, t, wx)
|
|
480
|
+
case (5)
|
|
481
|
+
select case (ifwrd)
|
|
482
|
+
case (1)
|
|
483
|
+
call fft%cosqf(lr, t, wx)
|
|
484
|
+
case (2)
|
|
485
|
+
call fft%cosqb(lr, t, wx)
|
|
486
|
+
end select
|
|
487
|
+
end select
|
|
488
|
+
|
|
489
|
+
do i=1, lr
|
|
490
|
+
f(i, j, k) = t(i)
|
|
491
|
+
end do
|
|
492
|
+
end do
|
|
493
|
+
end do
|
|
494
|
+
|
|
495
|
+
if (ifwrd == 2) then
|
|
496
|
+
f(:lr,:mr,:nr) = f(:lr,:mr,:nr)/(scalx*scaly)
|
|
497
|
+
return
|
|
498
|
+
end if
|
|
499
|
+
|
|
500
|
+
y_transform: do
|
|
501
|
+
do i=1, lr
|
|
502
|
+
do k=1, nr
|
|
503
|
+
t(1:mr) = f(i,1:mr, k)
|
|
504
|
+
select case (mp)
|
|
505
|
+
case (1)
|
|
506
|
+
select case (ifwrd)
|
|
507
|
+
case (1)
|
|
508
|
+
call fft%rfftf(mr, t, wy)
|
|
509
|
+
case (2)
|
|
510
|
+
call fft%rfftb(mr, t, wy)
|
|
511
|
+
end select
|
|
512
|
+
case (2)
|
|
513
|
+
call fft%sint(mr, t, wy)
|
|
514
|
+
case (3)
|
|
515
|
+
select case (ifwrd)
|
|
516
|
+
case (1)
|
|
517
|
+
call fft%sinqf(mr, t, wy)
|
|
518
|
+
case (2)
|
|
519
|
+
call fft%sinqb(mr, t, wy)
|
|
520
|
+
end select
|
|
521
|
+
case (4)
|
|
522
|
+
call fft%cost(mr, t, wy)
|
|
523
|
+
case (5)
|
|
524
|
+
select case (ifwrd)
|
|
525
|
+
case (1)
|
|
526
|
+
call fft%cosqf(mr, t, wy)
|
|
527
|
+
case (2)
|
|
528
|
+
call fft%cosqb(mr, t, wy)
|
|
529
|
+
end select
|
|
530
|
+
end select
|
|
531
|
+
f(i,1:mr, k) = t(1:mr)
|
|
532
|
+
end do
|
|
533
|
+
end do
|
|
534
|
+
|
|
535
|
+
select case (ifwrd)
|
|
536
|
+
case (1)
|
|
537
|
+
do i = 1, lr
|
|
538
|
+
do j = 1, mr
|
|
539
|
+
bb(:nr) = b(:nr) + xrt(i) + yrt(j)
|
|
540
|
+
t(:nr) = f(i, j,:nr)
|
|
541
|
+
|
|
542
|
+
call solve_tridiag(nr, a, bb, c, t, d)
|
|
543
|
+
|
|
544
|
+
f(i, j,:nr) = t(:nr)
|
|
545
|
+
end do
|
|
546
|
+
end do
|
|
547
|
+
ifwrd = 2
|
|
548
|
+
is = -1
|
|
549
|
+
cycle y_transform
|
|
550
|
+
case (2)
|
|
551
|
+
cycle x_transform
|
|
552
|
+
end select
|
|
553
|
+
|
|
554
|
+
exit y_transform
|
|
555
|
+
end do y_transform
|
|
556
|
+
|
|
557
|
+
exit x_transform
|
|
558
|
+
end do x_transform
|
|
559
|
+
|
|
560
|
+
f(:lr,:mr,:nr) = f(:lr,:mr,:nr)/(scalx*scaly)
|
|
561
|
+
|
|
562
|
+
end subroutine pois3dd_lower_routine
|
|
563
|
+
|
|
564
|
+
subroutine solve_tridiag(m, a, b, c, y, d)
|
|
565
|
+
|
|
566
|
+
! Dummy arguments
|
|
567
|
+
integer(ip), intent(in) :: m
|
|
568
|
+
real(wp), intent(in) :: a(m) ! subdiagonal, i.e., the diagonal below the main diagonal
|
|
569
|
+
real(wp), intent(in) :: b(m) ! the main diagonal
|
|
570
|
+
real(wp), intent(in) :: c(m) ! supdiagonal, i.e, the diagonal above the main diagonal
|
|
571
|
+
real(wp), intent(inout) :: y(m) ! the answer
|
|
572
|
+
real(wp), intent(inout) :: d(m) ! right part
|
|
573
|
+
|
|
574
|
+
! Local variables
|
|
575
|
+
integer(ip) :: i
|
|
576
|
+
real(wp) :: temp
|
|
577
|
+
|
|
578
|
+
! Initialize
|
|
579
|
+
d(1) = c(1)/b(1)
|
|
580
|
+
y(1) = y(1)/b(1)
|
|
581
|
+
|
|
582
|
+
do i = 2, m - 1
|
|
583
|
+
temp = b(i) - d(i - 1) * a(i)
|
|
584
|
+
d(i) = c(i)/temp
|
|
585
|
+
y(i) = (y(i) - a(i) * y(i - 1))/temp
|
|
586
|
+
end do
|
|
587
|
+
|
|
588
|
+
temp = b(m) - a(m) * d(m - 1)
|
|
589
|
+
|
|
590
|
+
if (temp == ZERO) then
|
|
591
|
+
y(m) = ZERO
|
|
592
|
+
else
|
|
593
|
+
y(m) = (y(m) - a(m) * y(m - 1))/temp
|
|
594
|
+
end if
|
|
595
|
+
|
|
596
|
+
do i = m - 1, 1, -1
|
|
597
|
+
y(i) = y(i) - d(i) * y(i + 1)
|
|
598
|
+
end do
|
|
599
|
+
|
|
600
|
+
end subroutine solve_tridiag
|
|
601
|
+
|
|
602
|
+
end module three_dimensional_solvers
|