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.
Files changed (81) hide show
  1. PyFishPack/__init__.py +86 -0
  2. PyFishPack/__pycache__/__init__.cpython-313.pyc +0 -0
  3. PyFishPack/__pycache__/apps.cpython-313.pyc +0 -0
  4. PyFishPack/_dummy.c +23 -0
  5. PyFishPack/_dummy.cp313-win_amd64.pyd +0 -0
  6. PyFishPack/apps.py +3640 -0
  7. PyFishPack/fishpack.cp313-win_amd64.dll.a +0 -0
  8. PyFishPack/fishpack.cp313-win_amd64.pyd +0 -0
  9. PyFishPack/meson.build +213 -0
  10. PyFishPack/src/archive/f77/Makefile +19 -0
  11. PyFishPack/src/archive/f77/blktri.f +1404 -0
  12. PyFishPack/src/archive/f77/cblktri.f +1414 -0
  13. PyFishPack/src/archive/f77/cmgnbn.f +1592 -0
  14. PyFishPack/src/archive/f77/comf.f +186 -0
  15. PyFishPack/src/archive/f77/fftpack.f +2968 -0
  16. PyFishPack/src/archive/f77/genbun.f +1335 -0
  17. PyFishPack/src/archive/f77/gnbnaux.f +314 -0
  18. PyFishPack/src/archive/f77/hstcrt.f +443 -0
  19. PyFishPack/src/archive/f77/hstcsp.f +683 -0
  20. PyFishPack/src/archive/f77/hstcyl.f +485 -0
  21. PyFishPack/src/archive/f77/hstplr.f +538 -0
  22. PyFishPack/src/archive/f77/hstssp.f +634 -0
  23. PyFishPack/src/archive/f77/hw3crt.f +687 -0
  24. PyFishPack/src/archive/f77/hwscrt.f +512 -0
  25. PyFishPack/src/archive/f77/hwscsp.f +728 -0
  26. PyFishPack/src/archive/f77/hwscyl.f +538 -0
  27. PyFishPack/src/archive/f77/hwsplr.f +602 -0
  28. PyFishPack/src/archive/f77/hwsssp.f +780 -0
  29. PyFishPack/src/archive/f77/pois3d.f +550 -0
  30. PyFishPack/src/archive/f77/poistg.f +875 -0
  31. PyFishPack/src/archive/f77/sepaux.f +361 -0
  32. PyFishPack/src/archive/f77/sepeli.f +1029 -0
  33. PyFishPack/src/archive/f77/sepx4.f +958 -0
  34. PyFishPack/src/centered_axisymmetric_spherical_solver.f90 +1002 -0
  35. PyFishPack/src/centered_cartesian_helmholtz_solver_3d.f90 +819 -0
  36. PyFishPack/src/centered_cartesian_solver.f90 +583 -0
  37. PyFishPack/src/centered_cylindrical_solver.f90 +634 -0
  38. PyFishPack/src/centered_helmholtz_solvers.f90 +156 -0
  39. PyFishPack/src/centered_polar_solver.f90 +746 -0
  40. PyFishPack/src/centered_real_linear_systems_solver.f90 +280 -0
  41. PyFishPack/src/centered_spherical_solver.f90 +928 -0
  42. PyFishPack/src/complex_block_tridiagonal_linear_systems_solver.f90 +1947 -0
  43. PyFishPack/src/complex_linear_systems_solver.f90 +1787 -0
  44. PyFishPack/src/fftpack_c_api.f90 +86 -0
  45. PyFishPack/src/fishpack.f90 +191 -0
  46. PyFishPack/src/fishpack.pyf +504 -0
  47. PyFishPack/src/fishpack_c_api.f90 +365 -0
  48. PyFishPack/src/fishpack_original.pyf +2119 -0
  49. PyFishPack/src/fishpack_precision.f90 +53 -0
  50. PyFishPack/src/general_linear_systems_solver_3d.f90 +296 -0
  51. PyFishPack/src/iterative_solvers.f90 +969 -0
  52. PyFishPack/src/main.f90 +10 -0
  53. PyFishPack/src/pyfishpack_module.c +1302 -0
  54. PyFishPack/src/real_block_tridiagonal_linear_systems_solver.f90 +319 -0
  55. PyFishPack/src/sepeli.f90 +1454 -0
  56. PyFishPack/src/sepx4.f90 +1338 -0
  57. PyFishPack/src/staggered_axisymmetric_spherical_solver.f90 +908 -0
  58. PyFishPack/src/staggered_cartesian_solver.f90 +553 -0
  59. PyFishPack/src/staggered_cylindrical_solver.f90 +630 -0
  60. PyFishPack/src/staggered_helmholtz_solvers.f90 +172 -0
  61. PyFishPack/src/staggered_polar_solver.f90 +651 -0
  62. PyFishPack/src/staggered_real_linear_systems_solver.f90 +258 -0
  63. PyFishPack/src/staggered_spherical_solver.f90 +758 -0
  64. PyFishPack/src/three_dimensional_solvers.f90 +602 -0
  65. PyFishPack/src/type_CenteredCyclicReductionUtility.f90 +1714 -0
  66. PyFishPack/src/type_CyclicReductionUtility.f90 +472 -0
  67. PyFishPack/src/type_FishpackWorkspace.f90 +290 -0
  68. PyFishPack/src/type_GeneralizedCyclicReductionUtility.f90 +1980 -0
  69. PyFishPack/src/type_PeriodicFastFourierTransform.f90 +3789 -0
  70. PyFishPack/src/type_SepAux.f90 +586 -0
  71. PyFishPack/src/type_StaggeredCyclicReductionUtility.f90 +893 -0
  72. pyfishpack-0.1.0.dist-info/DELVEWHEEL +2 -0
  73. pyfishpack-0.1.0.dist-info/METADATA +81 -0
  74. pyfishpack-0.1.0.dist-info/RECORD +81 -0
  75. pyfishpack-0.1.0.dist-info/WHEEL +5 -0
  76. pyfishpack-0.1.0.dist-info/licenses/LICENSE +21 -0
  77. pyfishpack-0.1.0.dist-info/top_level.txt +1 -0
  78. pyfishpack.libs/libgcc_s_seh-1-25d59ccffa1a9009644065b069829e07.dll +0 -0
  79. pyfishpack.libs/libgfortran-5-08f2195cfa0d823e13371c5c3186a82a.dll +0 -0
  80. pyfishpack.libs/libquadmath-0-c5abb9113f1ee64b87a889958e4b7418.dll +0 -0
  81. pyfishpack.libs/libwinpthread-1-83908d14abfafb8b3bfa38cf51ecee56.dll +0 -0
@@ -0,0 +1,819 @@
1
+ !
2
+ ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
3
+ ! * *
4
+ ! * copyright (c) 2005 by UCAR *
5
+ ! * *
6
+ ! * University Corporation for Atmospheric Research *
7
+ ! * *
8
+ ! * all rights reserved *
9
+ ! * *
10
+ ! * Fishpack *
11
+ ! * *
12
+ ! * A Package of Fortran *
13
+ ! * *
14
+ ! * Subroutines and Example Programs *
15
+ ! * *
16
+ ! * for Modeling Geophysical Processes *
17
+ ! * *
18
+ ! * by *
19
+ ! * *
20
+ ! * John Adams, Paul Swarztrauber and Roland Sweet *
21
+ ! * *
22
+ ! * of *
23
+ ! * *
24
+ ! * the National Center for Atmospheric Research *
25
+ ! * *
26
+ ! * Boulder, Colorado (80307) U.S.A. *
27
+ ! * *
28
+ ! * which is sponsored by *
29
+ ! * *
30
+ ! * the National Science Foundation *
31
+ ! * *
32
+ ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
33
+ !
34
+ submodule(three_dimensional_solvers) centered_cartesian_helmholtz_solver_3d
35
+
36
+ contains
37
+
38
+ ! SUBROUTINE hw3crt (xs, xf, l, lbdcnd, bdxs, bdxf, ys, yf, m, mbdcnd, bdys,
39
+ ! bdyf, zs, zf, n, nbdcnd, bdzs, bdzf, elmbda, ldimf,
40
+ ! mdimf, f, pertrb, ierror)
41
+ !
42
+ !
43
+ ! DIMENSION OF bdxs(mdimf, n+1), bdxf(mdimf, n+1),
44
+ ! ARGUMENTS bdys(ldimf, n+1), bdyf(ldimf, n+1),
45
+ ! bdzs(ldimf, m+1), bdzf(ldimf, m+1),
46
+ ! f(ldimf, mdimf, n+1)
47
+ !
48
+ ! PURPOSE Solves the standard five-point finite
49
+ ! difference approximation to the helmholtz
50
+ ! equation in cartesian coordinates. this
51
+ ! equation is
52
+ !
53
+ ! (d/dx)(du/dx) + (d/dy)(du/dy) +
54
+ ! (d/dz)(du/dz) + lambda*u = f(x, y, z).
55
+ !
56
+ ! USAGE call hw3crt(xs, xf, l, lbdcnd, bdxs, bdxf, ys, yf, m,
57
+ ! mbdcnd, bdys, bdyf, zs, zf, n, nbdcnd,
58
+ ! bdzs, bdzf, elmbda, ldimf, mdimf, f,
59
+ ! pertrb, ierror)
60
+ !
61
+ ! ARGUMENTS
62
+ !
63
+ ! ON INPUT xs, xf
64
+ !
65
+ ! the range of x, i.e. xs <= x <= xf .
66
+ ! xs must be less than xf.
67
+ !
68
+ ! l
69
+ ! the number of panels into which the
70
+ ! interval (xs, xf) is subdivided.
71
+ ! hence, there will be l+1 grid points
72
+ ! in the x-direction given by
73
+ ! x(i) = xs+(i-1)dx for i=1, 2, ..., l+1,
74
+ ! where dx = (xf-xs)/l is the panel width.
75
+ ! l must be at least 5.
76
+ !
77
+ ! lbdcnd
78
+ ! indicates the type of boundary conditions
79
+ ! at x = xs and x = xf.
80
+ !
81
+ ! = 0 if the solution is periodic in x,
82
+ ! i.e. u(l+i, j, k) = u(i, j, k).
83
+ ! = 1 if the solution is specified at
84
+ ! x = xs and x = xf.
85
+ ! = 2 if the solution is specified at
86
+ ! x = xs and the derivative of the
87
+ ! solution with respect to x is
88
+ ! specified at x = xf.
89
+ ! = 3 if the derivative of the solution
90
+ ! with respect to x is specified at
91
+ ! x = xs and x = xf.
92
+ ! = 4 if the derivative of the solution
93
+ ! with respect to x is specified at
94
+ ! x = xs and the solution is specified
95
+ ! at x=xf.
96
+ !
97
+ ! bdxs
98
+ ! a two-dimensional array that specifies the
99
+ ! values of the derivative of the solution
100
+ ! with respect to x at x = xs.
101
+ !
102
+ ! when lbdcnd = 3 or 4,
103
+ !
104
+ ! bdxs(j, k) = (d/dx)u(xs, y(j), z(k)),
105
+ ! j=1, 2, ..., m+1, k=1, 2, ..., n+1.
106
+ !
107
+ ! when lbdcnd has any other value, bdxs
108
+ ! is a dummy variable. bdxs must be
109
+ ! dimensioned at least (m+1)*(n+1).
110
+ !
111
+ ! bdxf
112
+ ! a two-dimensional array that specifies the
113
+ ! values of the derivative of the solution
114
+ ! with respect to x at x = xf.
115
+ !
116
+ ! when lbdcnd = 2 or 3,
117
+ !
118
+ ! bdxf(j, k) = (d/dx)u(xf, y(j), z(k)),
119
+ ! j=1, 2, ..., m+1, k=1, 2, ..., n+1.
120
+ !
121
+ ! when lbdcnd has any other value, bdxf is
122
+ ! a dummy variable. bdxf must be
123
+ ! dimensioned at least (m+1)*(n+1).
124
+ !
125
+ ! ys, yf
126
+ ! the range of y, i.e. ys <= y <= yf.
127
+ ! ys must be less than yf.
128
+ !
129
+ ! m
130
+ ! the number of panels into which the
131
+ ! interval (ys, yf) is subdivided.
132
+ ! hence, there will be m+1 grid points in
133
+ ! the y-direction given by y(j) = ys+(j-1)dy
134
+ ! for j=1, 2, ..., m+1,
135
+ ! where dy = (yf-ys)/m is the panel width.
136
+ ! m must be at least 5.
137
+ !
138
+ ! mbdcnd
139
+ ! indicates the type of boundary conditions
140
+ ! at y = ys and y = yf.
141
+ !
142
+ ! = 0 if the solution is periodic in y, i.e.
143
+ ! u(i, m+j, k) = u(i, j, k).
144
+ ! = 1 if the solution is specified at
145
+ ! y = ys and y = yf.
146
+ ! = 2 if the solution is specified at
147
+ ! y = ys and the derivative of the
148
+ ! solution with respect to y is
149
+ ! specified at y = yf.
150
+ ! = 3 if the derivative of the solution
151
+ ! with respect to y is specified at
152
+ ! y = ys and y = yf.
153
+ ! = 4 if the derivative of the solution
154
+ ! with respect to y is specified at
155
+ ! at y = ys and the solution is
156
+ ! specified at y=yf.
157
+ !
158
+ ! bdys
159
+ ! A two-dimensional array that specifies
160
+ ! the values of the derivative of the
161
+ ! solution with respect to y at y = ys.
162
+ !
163
+ ! when mbdcnd = 3 or 4,
164
+ !
165
+ ! bdys(i, k) = (d/dy)u(x(i), ys, z(k)),
166
+ ! i=1, 2, ..., l+1, k=1, 2, ..., n+1.
167
+ !
168
+ ! when mbdcnd has any other value, bdys
169
+ ! is a dummy variable. bdys must be
170
+ ! dimensioned at least (l+1)*(n+1).
171
+ !
172
+ ! bdyf
173
+ ! A two-dimensional array that specifies
174
+ ! the values of the derivative of the
175
+ ! solution with respect to y at y = yf.
176
+ !
177
+ ! when mbdcnd = 2 or 3,
178
+ !
179
+ ! bdyf(i, k) = (d/dy)u(x(i), yf, z(k)),
180
+ ! i=1, 2, ..., l+1, k=1, 2, ..., n+1.
181
+ !
182
+ ! when mbdcnd has any other value, bdyf
183
+ ! is a dummy variable. bdyf must be
184
+ ! dimensioned at least (l+1)*(n+1).
185
+ !
186
+ ! zs, zf
187
+ ! The range of z, i.e. zs <= z <= zf.
188
+ ! zs must be less than zf.
189
+ !
190
+ ! n
191
+ ! The number of panels into which the
192
+ ! interval (zs, zf) is subdivided.
193
+ ! hence, there will be n+1 grid points
194
+ ! in the z-direction given by
195
+ ! z(k) = zs+(k-1)dz for k=1, 2, ..., n+1,
196
+ ! where dz = (zf-zs)/n is the panel width.
197
+ ! n must be at least 5.
198
+ !
199
+ ! nbdcnd
200
+ ! Indicates the type of boundary conditions
201
+ ! at z = zs and z = zf.
202
+ !
203
+ ! = 0 if the solution is periodic in z, i.e.
204
+ ! u(i, j, n+k) = u(i, j, k).
205
+ ! = 1 if the solution is specified at
206
+ ! z = zs and z = zf.
207
+ ! = 2 if the solution is specified at
208
+ ! z = zs and the derivative of the
209
+ ! solution with respect to z is
210
+ ! specified at z = zf.
211
+ ! = 3 if the derivative of the solution
212
+ ! with respect to z is specified at
213
+ ! z = zs and z = zf.
214
+ ! = 4 if the derivative of the solution
215
+ ! with respect to z is specified at
216
+ ! z = zs and the solution is specified
217
+ ! at z=zf.
218
+ !
219
+ ! bdzs
220
+ ! A two-dimensional array that specifies
221
+ ! the values of the derivative of the
222
+ ! solution with respect to z at z = zs.
223
+ !
224
+ ! When nbdcnd = 3 or 4,
225
+ !
226
+ ! bdzs(i, j) = (d/dz)u(x(i), y(j), zs),
227
+ ! i=1, 2, ..., l+1, j=1, 2, ..., m+1.
228
+ !
229
+ ! When nbdcnd has any other value, bdzs
230
+ ! is a dummy variable. bdzs must be
231
+ ! dimensioned at least (l+1)*(m+1).
232
+ !
233
+ ! bdzf
234
+ ! A two-dimensional array that specifies
235
+ ! the values of the derivative of the
236
+ ! solution with respect to z at z = zf.
237
+ !
238
+ ! when nbdcnd = 2 or 3,
239
+ !
240
+ ! bdzf(i, j) = (d/dz)u(x(i), y(j), zf),
241
+ ! i=1, 2, ..., l+1, j=1, 2, ..., m+1.
242
+ !
243
+ ! when nbdcnd has any other value, bdzf
244
+ ! is a dummy variable. bdzf must be
245
+ ! dimensioned at least (l+1)*(m+1).
246
+ !
247
+ ! elmbda
248
+ ! The constant lambda in the helmholtz
249
+ ! equation. if lambda > 0, a solution
250
+ ! may not exist. however, hw3crt will
251
+ ! attempt to find a solution.
252
+ !
253
+ ! ldimf
254
+ ! The row (or first) dimension of the
255
+ ! arrays f, bdys, bdyf, bdzs, and bdzf as it
256
+ ! appears in the program calling hw3crt.
257
+ ! this parameter is used to specify the
258
+ ! variable dimension of these arrays.
259
+ ! ldimf must be at least l+1.
260
+ !
261
+ ! mdimf
262
+ ! the column (or second) dimension of the
263
+ ! array f and the row (or first) dimension
264
+ ! of the arrays bdxs and bdxf as it appears
265
+ ! in the program calling hw3crt. this
266
+ ! parameter is used to specify the variable
267
+ ! dimension of these arrays.
268
+ ! mdimf must be at least m+1.
269
+ !
270
+ ! f
271
+ ! a three-dimensional array of dimension at
272
+ ! at least (l+1)*(m+1)*(n+1), specifying the
273
+ ! values of the right side of the helmholz
274
+ ! equation and boundary values (if any).
275
+ !
276
+ ! on the interior, f is defined as follows:
277
+ ! for i=2, 3, ..., l, j=2, 3, ..., m,
278
+ ! and k=2, 3, ..., n
279
+ ! f(i, j, k) = f(x(i), y(j), z(k)).
280
+ !
281
+ ! on the boundaries, f is defined as follows:
282
+ ! for j=1, 2, ..., m+1, k=1, 2, ..., n+1,
283
+ ! and i=1, 2, ..., l+1
284
+ !
285
+ ! lbdcnd f(1, j, k) f(l+1, j, k)
286
+ ! ------ --------------- ---------------
287
+ !
288
+ ! 0 f(xs, y(j), z(k)) f(xs, y(j), z(k))
289
+ ! 1 u(xs, y(j), z(k)) u(xf, y(j), z(k))
290
+ ! 2 u(xs, y(j), z(k)) f(xf, y(j), z(k))
291
+ ! 3 f(xs, y(j), z(k)) f(xf, y(j), z(k))
292
+ ! 4 f(xs, y(j), z(k)) u(xf, y(j), z(k))
293
+ !
294
+ ! mbdcnd f(i, 1, k) f(i, m+1, k)
295
+ ! ------ --------------- ---------------
296
+ !
297
+ ! 0 f(x(i), ys, z(k)) f(x(i), ys, z(k))
298
+ ! 1 u(x(i), ys, z(k)) u(x(i), yf, z(k))
299
+ ! 2 u(x(i), ys, z(k)) f(x(i), yf, z(k))
300
+ ! 3 f(x(i), ys, z(k)) f(x(i), yf, z(k))
301
+ ! 4 f(x(i), ys, z(k)) u(x(i), yf, z(k))
302
+ !
303
+ ! nbdcnd f(i, j, 1) f(i, j, n+1)
304
+ ! ------ --------------- ---------------
305
+ !
306
+ ! 0 f(x(i), y(j), zs) f(x(i), y(j), zs)
307
+ ! 1 u(x(i), y(j), zs) u(x(i), y(j), zf)
308
+ ! 2 u(x(i), y(j), zs) f(x(i), y(j), zf)
309
+ ! 3 f(x(i), y(j), zs) f(x(i), y(j), zf)
310
+ ! 4 f(x(i), y(j), zs) u(x(i), y(j), zf)
311
+ !
312
+ ! Note:
313
+ ! If the table calls for both the solution
314
+ ! u and the right side f on a boundary,
315
+ ! then the solution must be specified.
316
+ !
317
+ !
318
+ ! ON OUTPUT f
319
+ ! Contains the solution u(i, j, k) of the
320
+ ! finite difference approximation for the
321
+ ! grid point (x(i), y(j), z(k)) for
322
+ ! i=1, 2, ..., l+1, j=1, 2, ..., m+1,
323
+ ! and k=1, 2, ..., n+1.
324
+ !
325
+ ! pertrb
326
+ ! If a combination of periodic or derivative
327
+ ! boundary conditions is specified for a
328
+ ! poisson equation (lambda = 0), a solution
329
+ ! may not exist. pertrb is a constant,
330
+ ! calculated and subtracted from f, which
331
+ ! ensures that a solution exists. pwscrt
332
+ ! then computes this solution, which is a
333
+ ! least squares solution to the original
334
+ ! approximation. This solution is not
335
+ ! unique and is unnormalized. The value of
336
+ ! pertrb should be small compared to the
337
+ ! the right side f. Otherwise, a solution
338
+ ! is obtained to an essentially different
339
+ ! problem. This comparison should always
340
+ ! be made to insure that a meaningful
341
+ ! solution has been obtained.
342
+ !
343
+ ! ierror
344
+ ! An error flag that indicates invalid input
345
+ ! parameters. except for numbers 0 and 12,
346
+ ! a solution is not attempted.
347
+ !
348
+ ! = 0 no error
349
+ ! = 1 xs >= xf
350
+ ! = 2 l < 5
351
+ ! = 3 lbdcnd < 0 .or. lbdcnd > 4
352
+ ! = 4 ys >= yf
353
+ ! = 5 m < 5
354
+ ! = 6 mbdcnd < 0 .or. mbdcnd > 4
355
+ ! = 7 zs >= zf
356
+ ! = 8 n < 5
357
+ ! = 9 nbdcnd < 0 .or. nbdcnd > 4
358
+ ! = 10 ldimf < l+1
359
+ ! = 11 mdimf < m+1
360
+ ! = 12 lambda > 0
361
+ ! = 20 If the dynamic allocation of real and
362
+ ! complex workspace required for solution
363
+ ! fails (for example if n, m are too large
364
+ ! for your computer)
365
+ !
366
+ ! Since this is the only means of indicating
367
+ ! a possibly incorrect call to hw3crt, the
368
+ ! user should test ierror after the call.
369
+ !
370
+ ! HISTORY * Written by Roland Sweet at NCAR in the late
371
+ ! 1970's.
372
+ ! * Released on ncar's public software
373
+ ! libraries in January 1980.
374
+ ! * Revised in June 2004 by John Adams using
375
+ ! Fortran 90 dynamically allocated workspace.
376
+ !
377
+ ! ALGORITHM This subroutine defines the finite difference
378
+ ! equations, incorporates boundary data, and
379
+ ! adjusts the right side of singular systems and
380
+ ! then calls pois3d to solve the system.
381
+ !
382
+ ! TIMING For large l, m and n, the operation count
383
+ ! is roughly proportional to
384
+ !
385
+ ! l*m*n*(log2(l)+log2(m)+5),
386
+ !
387
+ ! but also depends on input parameters lbdcnd
388
+ ! and mbdcnd.
389
+ !
390
+ ! ACCURACY The solution process employed results in
391
+ ! a loss of no more than four significant
392
+ ! digits for l, m and n as large as 32.
393
+ ! more detailed information about accuracy
394
+ ! can be found in the documentation for
395
+ ! routine pois3d which is the routine that
396
+ ! actually solves the finite difference
397
+ ! equations.
398
+ !
399
+ module subroutine hw3crt(xs, xf, l, lbdcnd, bdxs, bdxf, ys, yf, m, mbdcnd, &
400
+ bdys, bdyf, zs, zf, n, nbdcnd, bdzs, bdzf, elmbda, ldimf, &
401
+ mdimf, f, pertrb, ierror)
402
+
403
+ ! Dummy arguments
404
+ integer(ip), intent(in) :: l
405
+ integer(ip), intent(in) :: lbdcnd
406
+ integer(ip), intent(in) :: m
407
+ integer(ip), intent(in) :: mbdcnd
408
+ integer(ip), intent(in) :: n
409
+ integer(ip), intent(in) :: nbdcnd
410
+ integer(ip), intent(in) :: ldimf
411
+ integer(ip), intent(in) :: mdimf
412
+ integer(ip), intent(out) :: ierror
413
+ real(wp), intent(in) :: xs
414
+ real(wp), intent(in) :: xf
415
+ real(wp), intent(in) :: ys
416
+ real(wp), intent(in) :: yf
417
+ real(wp), intent(in) :: zs
418
+ real(wp), intent(in) :: zf
419
+ real(wp), intent(in) :: elmbda
420
+ real(wp), intent(out) :: pertrb
421
+ real(wp), intent(in) :: bdxs(:,:)
422
+ real(wp), intent(in) :: bdxf(:,:)
423
+ real(wp), intent(in) :: bdys(:,:)
424
+ real(wp), intent(in) :: bdyf(:,:)
425
+ real(wp), intent(in) :: bdzs(:,:)
426
+ real(wp), intent(in) :: bdzf(:,:)
427
+ real(wp), intent(inout) :: f(:,:,:)
428
+
429
+ ! Local variables
430
+ type(FishpackWorkspace) :: workspace
431
+
432
+ ! Check input arguments
433
+ call hw3crt_check_input_arguments(l, lbdcnd, m, mbdcnd, n, nbdcnd, &
434
+ ldimf, mdimf, xs, xf, ys, yf, zs, zf, ierror)
435
+
436
+ ! Check error flag
437
+ if (ierror /= 0) return
438
+
439
+ ! Allocate memory
440
+ call hw3crt_initialize_workspace(n, m, l, workspace)
441
+
442
+ ! Solve system
443
+ associate( &
444
+ rew => workspace%real_workspace, &
445
+ indx => workspace%workspace_indices &
446
+ )
447
+ call hw3crt_lower_routine(xs, xf, l, lbdcnd, bdxs, bdxf, ys, yf, m, mbdcnd, bdys, &
448
+ bdyf, zs, zf, n, nbdcnd, bdzs, bdzf, elmbda, ldimf, &
449
+ mdimf, f, pertrb, ierror, rew, indx)
450
+ end associate
451
+
452
+ ! Release memory
453
+ call workspace%destroy()
454
+
455
+ end subroutine hw3crt
456
+
457
+ subroutine hw3crt_lower_routine(xs, xf, l, lbdcnd, bdxs, bdxf, ys, yf, m, &
458
+ mbdcnd, bdys, bdyf, zs, zf, n, nbdcnd, bdzs, bdzf, elmbda, &
459
+ ldimf, mdimf, f, pertrb, ierror, w, workspace_indices)
460
+
461
+ ! Dummy arguments
462
+ integer(ip), intent(in) :: l
463
+ integer(ip), intent(in) :: lbdcnd
464
+ integer(ip), intent(in) :: m
465
+ integer(ip), intent(in) :: mbdcnd
466
+ integer(ip), intent(in) :: n
467
+ integer(ip), intent(in) :: nbdcnd
468
+ integer(ip), intent(in) :: ldimf
469
+ integer(ip), intent(in) :: mdimf
470
+ integer(ip), intent(out) :: ierror
471
+ integer(ip), intent(in) :: workspace_indices(:)
472
+ real(wp), intent(in) :: xs
473
+ real(wp), intent(in) :: xf
474
+ real(wp), intent(in) :: ys
475
+ real(wp), intent(in) :: yf
476
+ real(wp), intent(in) :: zs
477
+ real(wp), intent(in) :: zf
478
+ real(wp), intent(in) :: elmbda
479
+ real(wp), intent(out) :: pertrb
480
+ real(wp), intent(in) :: bdxs(:,:)
481
+ real(wp), intent(in) :: bdxf(:,:)
482
+ real(wp), intent(in) :: bdys(:,:)
483
+ real(wp), intent(in) :: bdyf(:,:)
484
+ real(wp), intent(in) :: bdzs(:,:)
485
+ real(wp), intent(in) :: bdzf(:,:)
486
+ real(wp), intent(inout) :: f(:,:,:)
487
+ real(wp), intent(out) :: w(:)
488
+
489
+ ! Local variables
490
+ integer(ip) :: mstart, mstop, mp1, mp, munk, np, np1
491
+ integer(ip) :: nstart, nstop, nunk, lp1, lp, lstart
492
+ integer(ip) :: lstop, j, k, lunk, iwb, iwc, iww
493
+ integer(ip) :: mstpm1, lstpm1, nstpm1, nperod
494
+ real(wp) :: dy, twbydy, c2, dz, twbydz, c3, dx
495
+ real(wp) :: c1, twbydx, xlp, ylp, zlp, s1, s2, s
496
+ type(SolverUtility3D) :: util3d
497
+
498
+ dy = (yf - ys)/m
499
+ twbydy = TWO/dy
500
+ c2 = ONE/dy**2
501
+ mstart = 1
502
+ mstop = m
503
+ mp1 = m + 1
504
+ mp = mbdcnd + 1
505
+
506
+ select case (mp)
507
+ case (2:3)
508
+ mstart = 2
509
+ select case (mp)
510
+ case (3:4)
511
+ mstop = mp1
512
+ end select
513
+ case (4:5)
514
+ select case (mp)
515
+ case (3:4)
516
+ mstop = mp1
517
+ end select
518
+ end select
519
+
520
+ munk = mstop - mstart + 1
521
+ dz = (zf - zs)/n
522
+ twbydz = TWO/dz
523
+ np = nbdcnd + 1
524
+ c3 = ONE/dz**2
525
+ np1 = n + 1
526
+ nstart = 1
527
+ nstop = n
528
+
529
+ select case (np)
530
+ case (2)
531
+ nstart = 2
532
+ case (3)
533
+ nstart = 2
534
+ nstop = np1
535
+ case (5)
536
+ nstop = np1
537
+ end select
538
+
539
+ nunk = nstop - nstart + 1
540
+ lp1 = l + 1
541
+ dx = (xf - xs)/l
542
+ c1 = ONE/dx**2
543
+ twbydx = TWO/dx
544
+ lp = lbdcnd + 1
545
+ lstart = 1
546
+ lstop = l
547
+
548
+ ! Enter boundary data for x-boundaries.
549
+ select case (lp)
550
+ case (2:3)
551
+ lstart = 2
552
+ f(2, mstart:mstop, nstart:nstop) = &
553
+ f(2, mstart:mstop, nstart:nstop) &
554
+ - c1*f(1, mstart:mstop, nstart:nstop)
555
+ case (4:5)
556
+ f(1, mstart:mstop, nstart:nstop) = &
557
+ f(1, mstart:mstop, nstart:nstop) &
558
+ + twbydx*bdxs(mstart:mstop, nstart:nstop)
559
+ end select
560
+
561
+ select case (lp)
562
+ case (2, 5)
563
+ f(l, mstart:mstop, nstart:nstop) = &
564
+ f(l, mstart:mstop, nstart:nstop) &
565
+ - c1*f(lp1, mstart:mstop, nstart:nstop)
566
+ case (3:4)
567
+ lstop = lp1
568
+ f(lp1, mstart:mstop, nstart:nstop) = &
569
+ f(lp1, mstart:mstop, nstart:nstop) &
570
+ - twbydx*bdxf(mstart:mstop, nstart:nstop)
571
+ end select
572
+
573
+ lunk = lstop - lstart + 1
574
+
575
+ ! Enter boundary data for y-boundaries.
576
+ select case (mp)
577
+ case (2:3)
578
+ f(lstart:lstop, 2, nstart:nstop) = &
579
+ f(lstart:lstop, 2, nstart:nstop)&
580
+ - c2*f(lstart:lstop, 1, nstart:nstop)
581
+ case (4:5)
582
+ f(lstart:lstop, 1, nstart:nstop) = &
583
+ f(lstart:lstop, 1, nstart:nstop) &
584
+ + twbydy*bdys(lstart:lstop, nstart:nstop)
585
+ end select
586
+
587
+ select case (mp)
588
+ case (2, 5)
589
+ f(lstart:lstop, m, nstart:nstop) = &
590
+ f(lstart:lstop, m, nstart:nstop) &
591
+ - c2*f(lstart:lstop, mp1, nstart:nstop)
592
+ case (3:4)
593
+ f(lstart:lstop, mp1, nstart:nstop) = &
594
+ f(lstart:lstop, mp1, nstart:nstop) &
595
+ - twbydy*bdyf(lstart:lstop, nstart:nstop)
596
+ end select
597
+
598
+ select case (np)
599
+ case (2:3)
600
+ f(lstart:lstop, mstart:mstop, 2) = &
601
+ f(lstart:lstop, mstart:mstop, 2) &
602
+ - c3*f(lstart:lstop, mstart:mstop, 1)
603
+ case (4:5)
604
+ f(lstart:lstop, mstart:mstop, 1) = &
605
+ f(lstart:lstop, mstart:mstop, 1) &
606
+ + twbydz*bdzs(lstart:lstop, mstart:mstop)
607
+ end select
608
+
609
+
610
+ select case (np)
611
+ case (2, 5)
612
+ f(lstart:lstop, mstart:mstop, n) = &
613
+ f(lstart:lstop, mstart:mstop, n) &
614
+ - c3*f(lstart:lstop, mstart:mstop, np1)
615
+ case (3:4)
616
+ f(lstart:lstop, mstart:mstop, np1) = &
617
+ f(lstart:lstop, mstart:mstop, np1) &
618
+ - twbydz*bdzf(lstart:lstop, mstart:mstop)
619
+ end select
620
+
621
+ ! Define a, b, c coefficients in w-array.
622
+ iwb = nunk + 1
623
+ iwc = iwb + nunk
624
+ iww = iwc + nunk
625
+ w(:nunk) = c3
626
+ w(iwc:nunk-1+iwc) = c3
627
+ w(iwb:nunk-1+iwb) = (-TWO*c3) + elmbda
628
+
629
+ select case (np)
630
+ case (3:4)
631
+ w(iwb-1) = TWO*c3
632
+ end select
633
+
634
+ select case (np)
635
+ case (4:5)
636
+ w(iwc) = TWO*c3
637
+ end select
638
+
639
+ pertrb = ZERO
640
+
641
+ ! For singular problems adjust data to insure a solution will exist.
642
+ select case (lp)
643
+ case (1, 4)
644
+ select case (mp)
645
+ case (1, 4)
646
+ select case (np)
647
+ case (1, 4)
648
+ if (ZERO <= elmbda) then
649
+ if (elmbda /= ZERO) then
650
+ ierror = 12
651
+ return
652
+ else
653
+ mstpm1 = mstop - 1
654
+ lstpm1 = lstop - 1
655
+ nstpm1 = nstop - 1
656
+ xlp = (2 + lp)/3
657
+ ylp = (2 + mp)/3
658
+ zlp = (2 + np)/3
659
+ s1 = ZERO
660
+
661
+ do k = 2, nstpm1
662
+ do j = 2, mstpm1
663
+ s1 = s1 + sum(f(2:lstpm1, j, k))
664
+ s1 = s1 + (f(1, j, k)+f(lstop, j, k))/xlp
665
+ end do
666
+ s2 = sum(f(2:lstpm1, 1, k)+f(2:lstpm1, mstop, k))
667
+ s2 = (s2 + (f(1, 1, k) + f(1, mstop, k) &
668
+ + f(lstop, 1, k) + f(lstop,mstop, k))/xlp)/ylp
669
+ s1 = s1 + s2
670
+ end do
671
+
672
+ s = (f(1, 1, 1)+f(lstop, 1, 1) &
673
+ + f(1, 1, nstop)+f(lstop, 1, nstop) &
674
+ + f(1, mstop, 1)+f(lstop, mstop, 1) &
675
+ + f(1, mstop, nstop)+f(lstop, mstop, nstop))/(xlp*ylp)
676
+
677
+ do j = 2, mstpm1
678
+ s = s + sum(f(2:lstpm1, j, 1)+f(2:lstpm1, j, nstop))
679
+ end do
680
+
681
+ s2 = ZERO
682
+ s2 = sum(f(2:lstpm1, 1, 1)+f(2:lstpm1, 1, nstop) &
683
+ + f(2:lstpm1, mstop, 1)+f(2:lstpm1, mstop, nstop))
684
+ s = s2/ylp + s
685
+ s2 = ZERO
686
+ s2 = sum(f(1, 2:mstpm1, 1)+f(1, 2:mstpm1, nstop) &
687
+ + f(lstop, 2:mstpm1, 1)+f(lstop, 2:mstpm1, nstop))
688
+ s = s2/xlp + s
689
+ pertrb = &
690
+ (s/zlp + s1)/((real(lunk + 1, kind=wp) - xlp) &
691
+ *(real(munk + 1, kind=wp) - ylp)*(real(nunk + 1, kind=wp) - zlp))
692
+ f(:lunk,:munk,:nunk) = &
693
+ f(:lunk,:munk,:nunk) - pertrb
694
+ end if
695
+ end if
696
+ end select
697
+ end select
698
+ end select
699
+
700
+ select case (nbdcnd)
701
+ case (0)
702
+ nperod = 0
703
+ case default
704
+ nperod = 1
705
+ w(1) = ZERO
706
+ w(iww - 1) = ZERO
707
+ end select
708
+
709
+ ! Solve system
710
+ call util3d%pois3dd(lbdcnd, lunk, c1, mbdcnd, munk, c2, nperod, nunk, w, &
711
+ w(iwb:), w(iwc:), ldimf, mdimf, f(lstart:, mstart:, nstart:), &
712
+ ierror, w(iww:), workspace_indices)
713
+
714
+ ! Check error flag
715
+ if (ierror /= 0) then
716
+ error stop 'fishpack library: pois3dd call failed in hw3crt_lower_routine'
717
+ end if
718
+
719
+ ! Fill in sides for periodic boundary conditions.
720
+ if (lp == 1) then
721
+ if (mp == 1) then
722
+ f(1, mp1, nstart:nstop) = f(1, 1, nstart:nstop)
723
+ mstop = mp1
724
+ end if
725
+ if (np == 1) then
726
+ f(1, mstart:mstop, np1) = f(1, mstart:mstop, 1)
727
+ nstop = np1
728
+ end if
729
+ f(lp1, mstart:mstop, nstart:nstop) = &
730
+ f(1, mstart:mstop, nstart: nstop)
731
+ end if
732
+
733
+ if (mp == 1) then
734
+ if (np == 1) then
735
+ f(lstart:lstop, 1, np1) = f(lstart:lstop, 1, 1)
736
+ nstop = np1
737
+ end if
738
+ f(lstart:lstop, mp1, nstart:nstop) = &
739
+ f(lstart:lstop, 1, nstart:nstop)
740
+ end if
741
+
742
+ if (np == 1) then
743
+ f(lstart:lstop, mstart:mstop, np1) = &
744
+ f(lstart:lstop, mstart:mstop,1)
745
+ end if
746
+
747
+ end subroutine hw3crt_lower_routine
748
+
749
+ pure subroutine hw3crt_check_input_arguments(l, lbdcnd, m, mbdcnd, n, nbdcnd, &
750
+ ldimf, mdimf, xs, xf, ys, yf, zs, zf, ierror)
751
+
752
+ ! Dummy arguments
753
+ integer(ip), intent(in) :: l
754
+ integer(ip), intent(in) :: lbdcnd
755
+ integer(ip), intent(in) :: m
756
+ integer(ip), intent(in) :: mbdcnd
757
+ integer(ip), intent(in) :: n
758
+ integer(ip), intent(in) :: nbdcnd
759
+ integer(ip), intent(in) :: ldimf
760
+ integer(ip), intent(in) :: mdimf
761
+ real(wp), intent(in) :: xs
762
+ real(wp), intent(in) :: xf
763
+ real(wp), intent(in) :: ys
764
+ real(wp), intent(in) :: yf
765
+ real(wp), intent(in) :: zs
766
+ real(wp), intent(in) :: zf
767
+ integer(ip), intent(out) :: ierror
768
+
769
+ if (xf <= xs) then
770
+ ierror = 1
771
+ else if (l < 5) then
772
+ ierror = 2
773
+ else if (lbdcnd < 0 .or. lbdcnd > 4) then
774
+ ierror = 3
775
+ else if (yf <= ys) then
776
+ ierror = 4
777
+ else if (m < 5) then
778
+ ierror = 5
779
+ else if (mbdcnd < 0 .or. mbdcnd > 4) then
780
+ ierror = 6
781
+ else if (zf <= zs) then
782
+ ierror = 7
783
+ else if (n < 5) then
784
+ ierror = 8
785
+ else if (nbdcnd < 0 .or. nbdcnd > 4) then
786
+ ierror = 9
787
+ else if (ldimf < l + 1) then
788
+ ierror = 10
789
+ else if (mdimf < m + 1) then
790
+ ierror = 11
791
+ else
792
+ ierror = 0
793
+ end if
794
+
795
+ end subroutine hw3crt_check_input_arguments
796
+
797
+ subroutine hw3crt_initialize_workspace(n, m, l, workspace)
798
+
799
+ ! Dummy arguments
800
+ integer(ip), intent(in) :: n, m, l
801
+ class(FishpackWorkspace), intent(out) :: workspace
802
+
803
+ ! Local variables
804
+ integer(ip) :: irwk, icwk
805
+ type(SolverUtility3D) :: util3d
806
+
807
+ ! Adjust workspace for hw3crt
808
+ irwk = 30 + l + m + (5 * n) + max(n, m, l) + 7*((l+1)/2 + (m+1)/2)
809
+ icwk = 0
810
+
811
+ ! Allocate memory
812
+ call workspace%create(irwk, icwk, util3d%IIWK)
813
+
814
+ ! Set workspace indices
815
+ workspace%workspace_indices = util3d%get_workspace_indices(l, m, n)
816
+
817
+ end subroutine hw3crt_initialize_workspace
818
+
819
+ end submodule centered_cartesian_helmholtz_solver_3d