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,583 @@
|
|
|
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
|
+
|
|
35
|
+
submodule(centered_helmholtz_solvers) centered_cartesian_solver
|
|
36
|
+
|
|
37
|
+
contains
|
|
38
|
+
|
|
39
|
+
! SUBROUTINE hwscrt(a, b, m, mbdcnd, bda, bdb, c, d, n, nbdcnd, bdc, bdd,
|
|
40
|
+
! elmbda, f, idimf, pertrb, ierror)
|
|
41
|
+
!
|
|
42
|
+
! DIMENSION OF bda(n), bdb(n), bdc(m), bdd(m),
|
|
43
|
+
! ARGUMENTS f(idimf, n)
|
|
44
|
+
!
|
|
45
|
+
! PURPOSE Solves the standard five-point finite
|
|
46
|
+
! difference approximation to the helmholtz
|
|
47
|
+
! equation in cartesian coordinates. this
|
|
48
|
+
! equation is
|
|
49
|
+
!
|
|
50
|
+
! (d/dx)(du/dx) + (d/dy)(du/dy)
|
|
51
|
+
! + lambda*u = f(x, y).
|
|
52
|
+
!
|
|
53
|
+
! USAGE call hwscrt (a, b, m, mbdcnd, bda, bdb, c, d, n,
|
|
54
|
+
! nbdcnd, bdc, bdd, elmbda, f, idimf,
|
|
55
|
+
! pertrb, ierror)
|
|
56
|
+
!
|
|
57
|
+
! ARGUMENTS
|
|
58
|
+
! ON INPUT a, b
|
|
59
|
+
!
|
|
60
|
+
! the range of x, i.e., a <= x <= b.
|
|
61
|
+
! a must be less than b.
|
|
62
|
+
!
|
|
63
|
+
! m
|
|
64
|
+
! the number of panels into which the
|
|
65
|
+
! interval (a, b) is subdivided.
|
|
66
|
+
! hence, there will be m+1 grid points
|
|
67
|
+
! in the x-direction given by
|
|
68
|
+
! x(i) = a+(i-1)dx for i = 1, 2, ..., m+1,
|
|
69
|
+
! where dx = (b-a)/m is the panel width.
|
|
70
|
+
! m must be greater than 3.
|
|
71
|
+
!
|
|
72
|
+
! mbdcnd
|
|
73
|
+
! indicates the type of boundary conditions
|
|
74
|
+
! at x = a and x = b.
|
|
75
|
+
!
|
|
76
|
+
! = 0 if the solution is periodic in x,
|
|
77
|
+
! i.e., u(i, j) = u(m+i, j).
|
|
78
|
+
! = 1 if the solution is specified at
|
|
79
|
+
! x = a and x = b.
|
|
80
|
+
! = 2 if the solution is specified at
|
|
81
|
+
! x = a and the derivative of the
|
|
82
|
+
! solution with respect to x is
|
|
83
|
+
! specified at x = b.
|
|
84
|
+
! = 3 if the derivative of the solution
|
|
85
|
+
! with respect to x is specified at
|
|
86
|
+
! at x = a and x = b.
|
|
87
|
+
! = 4 if the derivative of the solution
|
|
88
|
+
! with respect to x is specified at
|
|
89
|
+
! x = a and the solution is specified
|
|
90
|
+
! at x = b.
|
|
91
|
+
!
|
|
92
|
+
! bda
|
|
93
|
+
! a one-dimensional array of length n+1 that
|
|
94
|
+
! specifies the values of the derivative
|
|
95
|
+
! of the solution with respect to x at x = a.
|
|
96
|
+
!
|
|
97
|
+
! when mbdcnd = 3 or 4,
|
|
98
|
+
!
|
|
99
|
+
! bda(j) = (d/dx)u(a, y(j)), j = 1, 2, ..., n+1.
|
|
100
|
+
!
|
|
101
|
+
! when mbdcnd has any other value, bda is
|
|
102
|
+
! a dummy variable.
|
|
103
|
+
!
|
|
104
|
+
! bdb
|
|
105
|
+
! a one-dimensional array of length n+1
|
|
106
|
+
! that specifies the values of the derivative
|
|
107
|
+
! of the solution with respect to x at x = b.
|
|
108
|
+
!
|
|
109
|
+
! when mbdcnd = 2 or 3,
|
|
110
|
+
!
|
|
111
|
+
! bdb(j) = (d/dx)u(b, y(j)), j = 1, 2, ..., n+1
|
|
112
|
+
!
|
|
113
|
+
! when mbdcnd has any other value bdb is a
|
|
114
|
+
! dummy variable.
|
|
115
|
+
!
|
|
116
|
+
! c, d
|
|
117
|
+
! the range of y, i.e., c <= y <= d.
|
|
118
|
+
! c must be less than d.
|
|
119
|
+
!
|
|
120
|
+
! n
|
|
121
|
+
! the number of panels into which the
|
|
122
|
+
! interval (c, d) is subdivided. hence,
|
|
123
|
+
! there will be n+1 grid points in the
|
|
124
|
+
! y-direction given by y(j) = c+(j-1)dy
|
|
125
|
+
! for j = 1, 2, ..., n+1, where
|
|
126
|
+
! dy = (d-c)/n is the panel width.
|
|
127
|
+
! n must be greater than 3.
|
|
128
|
+
!
|
|
129
|
+
! nbdcnd
|
|
130
|
+
! indicates the type of boundary conditions at
|
|
131
|
+
! y = c and y = d.
|
|
132
|
+
!
|
|
133
|
+
! = 0 if the solution is periodic in y,
|
|
134
|
+
! i.e., u(i, j) = u(i, n+j).
|
|
135
|
+
! = 1 if the solution is specified at
|
|
136
|
+
! y = c and y = d.
|
|
137
|
+
! = 2 if the solution is specified at
|
|
138
|
+
! y = c and the derivative of the
|
|
139
|
+
! solution with respect to y is
|
|
140
|
+
! specified at y = d.
|
|
141
|
+
! = 3 if the derivative of the solution
|
|
142
|
+
! with respect to y is specified at
|
|
143
|
+
! y = c and y = d.
|
|
144
|
+
! = 4 if the derivative of the solution
|
|
145
|
+
! with respect to y is specified at
|
|
146
|
+
! y = c and the solution is specified
|
|
147
|
+
! at y = d.
|
|
148
|
+
!
|
|
149
|
+
! bdc
|
|
150
|
+
! a one-dimensional array of length m+1 that
|
|
151
|
+
! specifies the values of the derivative
|
|
152
|
+
! of the solution with respect to y at y = c.
|
|
153
|
+
!
|
|
154
|
+
! when nbdcnd = 3 or 4,
|
|
155
|
+
!
|
|
156
|
+
! bdc(i) = (d/dy)u(x(i), c), i = 1, 2, ..., m+1
|
|
157
|
+
!
|
|
158
|
+
! when nbdcnd has any other value, bdc is
|
|
159
|
+
! a dummy variable.
|
|
160
|
+
!
|
|
161
|
+
! bdd
|
|
162
|
+
! a one-dimensional array of length m+1 that
|
|
163
|
+
! specifies the values of the derivative
|
|
164
|
+
! of the solution with respect to y at y = d.
|
|
165
|
+
!
|
|
166
|
+
! when nbdcnd = 2 or 3,
|
|
167
|
+
!
|
|
168
|
+
! bdd(i) = (d/dy)u(x(i), d), i = 1, 2, ..., m+1
|
|
169
|
+
!
|
|
170
|
+
! when nbdcnd has any other value, bdd is
|
|
171
|
+
! a dummy variable.
|
|
172
|
+
!
|
|
173
|
+
! elmbda
|
|
174
|
+
! the constant lambda in the helmholtz
|
|
175
|
+
! equation. if lambda > 0, a solution
|
|
176
|
+
! may not exist. however, hwscrt will
|
|
177
|
+
! attempt to find a solution.
|
|
178
|
+
!
|
|
179
|
+
! f
|
|
180
|
+
! a two-dimensional array, of dimension at
|
|
181
|
+
! least (m+1)*(n+1), specifying values of the
|
|
182
|
+
! right side of the helmholtz equation and
|
|
183
|
+
! boundary values (if any).
|
|
184
|
+
!
|
|
185
|
+
! on the interior, f is defined as follows:
|
|
186
|
+
! for i = 2, 3, ..., m and j = 2, 3, ..., n
|
|
187
|
+
! f(i, j) = f(x(i), y(j)).
|
|
188
|
+
!
|
|
189
|
+
! on the boundaries, f is defined as follows:
|
|
190
|
+
! for j=1, 2, ..., n+1, i=1, 2, ..., m+1,
|
|
191
|
+
!
|
|
192
|
+
! mbdcnd f(1, j) f(m+1, j)
|
|
193
|
+
! ------ --------- --------
|
|
194
|
+
!
|
|
195
|
+
! 0 f(a, y(j)) f(a, y(j))
|
|
196
|
+
! 1 u(a, y(j)) u(b, y(j))
|
|
197
|
+
! 2 u(a, y(j)) f(b, y(j))
|
|
198
|
+
! 3 f(a, y(j)) f(b, y(j))
|
|
199
|
+
! 4 f(a, y(j)) u(b, y(j))
|
|
200
|
+
!
|
|
201
|
+
!
|
|
202
|
+
! nbdcnd f(i, 1) f(i, n+1)
|
|
203
|
+
! ------ --------- --------
|
|
204
|
+
!
|
|
205
|
+
! 0 f(x(i), c) f(x(i), c)
|
|
206
|
+
! 1 u(x(i), c) u(x(i), d)
|
|
207
|
+
! 2 u(x(i), c) f(x(i), d)
|
|
208
|
+
! 3 f(x(i), c) f(x(i), d)
|
|
209
|
+
! 4 f(x(i), c) u(x(i), d)
|
|
210
|
+
!
|
|
211
|
+
! note:
|
|
212
|
+
! if the table calls for both the solution u
|
|
213
|
+
! and the right side f at a corner then the
|
|
214
|
+
! solution must be specified.
|
|
215
|
+
!
|
|
216
|
+
! idimf
|
|
217
|
+
! the row (or first) dimension of the array
|
|
218
|
+
! f as it appears in the program calling
|
|
219
|
+
! hwscrt. this parameter is used to specify
|
|
220
|
+
! the variable dimension of f. idimf must
|
|
221
|
+
! be at least m+1 .
|
|
222
|
+
!
|
|
223
|
+
!
|
|
224
|
+
! ON OUTPUT f
|
|
225
|
+
! contains the solution u(i, j) of the finite
|
|
226
|
+
! difference approximation for the grid point
|
|
227
|
+
! (x(i), y(j)), i = 1, 2, ..., m+1,
|
|
228
|
+
! j = 1, 2, ..., n+1 .
|
|
229
|
+
!
|
|
230
|
+
! pertrb
|
|
231
|
+
! if a combination of periodic or derivative
|
|
232
|
+
! boundary conditions is specified for a
|
|
233
|
+
! poisson equation (lambda = 0), a solution
|
|
234
|
+
! may not exist. pertrb is a constant,
|
|
235
|
+
! calculated and subtracted from f, which
|
|
236
|
+
! ensures that a solution exists. hwscrt
|
|
237
|
+
! then computes this solution, which is a
|
|
238
|
+
! least squares solution to the original
|
|
239
|
+
! approximation. this solution plus any
|
|
240
|
+
! constant is also a solution. hence, the
|
|
241
|
+
! solution is not unique. the value of
|
|
242
|
+
! pertrb should be small compared to the
|
|
243
|
+
! right side f. otherwise, a solution is
|
|
244
|
+
! obtained to an essentially different
|
|
245
|
+
! problem. this comparison should always
|
|
246
|
+
! be made to insure that a meaningful
|
|
247
|
+
! solution has been obtained.
|
|
248
|
+
!
|
|
249
|
+
! ierror
|
|
250
|
+
! an error flag that indicates invalid input
|
|
251
|
+
! parameters. except for numbers 0 and 6,
|
|
252
|
+
! a solution is not attempted.
|
|
253
|
+
!
|
|
254
|
+
! = 0 no error
|
|
255
|
+
! = 1 a >= b
|
|
256
|
+
! = 2 mbdcnd < 0 or mbdcnd > 4
|
|
257
|
+
! = 3 c >= d
|
|
258
|
+
! = 4 n <= 3
|
|
259
|
+
! = 5 nbdcnd < 0 or nbdcnd > 4
|
|
260
|
+
! = 6 lambda > 0
|
|
261
|
+
! = 7 idimf < m+1
|
|
262
|
+
! = 8 m <= 3
|
|
263
|
+
! = 20 If the dynamic allocation of real and
|
|
264
|
+
! complex workspace required for solution
|
|
265
|
+
! fails (for example if n, m are too large
|
|
266
|
+
! for your computer)
|
|
267
|
+
!
|
|
268
|
+
! since this is the only means of indicating
|
|
269
|
+
! a possibly incorrect call to hwscrt, the
|
|
270
|
+
! user should test ierror after the call.
|
|
271
|
+
!
|
|
272
|
+
!
|
|
273
|
+
! HISTORY WRITTEN BY ROLAND SWEET AT NCAR IN THE LATE
|
|
274
|
+
! 1970'S. RELEASED ON NCAR'S PUBLIC SOFTWARE
|
|
275
|
+
! LIBRARIES IN January 1980.
|
|
276
|
+
! Revised in June 2004 by John Adams using
|
|
277
|
+
! Fortran 90 dynamically allocated workspace.
|
|
278
|
+
!
|
|
279
|
+
!
|
|
280
|
+
! ALGORITHM The routine defines the finite difference
|
|
281
|
+
! equations, incorporates boundary data, and
|
|
282
|
+
! adjusts the right side of singular systems
|
|
283
|
+
! and then calls genbun to solve the system.
|
|
284
|
+
!
|
|
285
|
+
! TIMING For large m and n, the operation count
|
|
286
|
+
! is roughly proportional to
|
|
287
|
+
!
|
|
288
|
+
! m*n*log2(n)
|
|
289
|
+
!
|
|
290
|
+
! but also depends on input parameters nbdcnd
|
|
291
|
+
! and mbdcnd.
|
|
292
|
+
!
|
|
293
|
+
! ACCURACY The solution process employed results in a loss
|
|
294
|
+
! of no more than three significant digits for n
|
|
295
|
+
! and m as large as 64. more details about
|
|
296
|
+
! accuracy can be found in the documentation for
|
|
297
|
+
! subroutine genbun which is the routine that
|
|
298
|
+
! solves the finite difference equations.
|
|
299
|
+
!
|
|
300
|
+
! REFERENCES Swarztrauber, P. and R. Sweet, "Efficient
|
|
301
|
+
! FORTRAN subprograms for the solution of
|
|
302
|
+
! elliptic equations"
|
|
303
|
+
! NCAR TN/IA-109, July, 1975, 138 pp.
|
|
304
|
+
!
|
|
305
|
+
module subroutine hwscrt(a, b, m, mbdcnd, bda, bdb, c, d, n, nbdcnd, bdc, &
|
|
306
|
+
bdd, elmbda, f, idimf, pertrb, ierror)
|
|
307
|
+
|
|
308
|
+
! Dummy arguments
|
|
309
|
+
integer(ip), intent(in) :: m
|
|
310
|
+
integer(ip), intent(in) :: mbdcnd
|
|
311
|
+
integer(ip), intent(in) :: n
|
|
312
|
+
integer(ip), intent(in) :: nbdcnd
|
|
313
|
+
integer(ip), intent(in) :: idimf
|
|
314
|
+
integer(ip), intent(out) :: ierror
|
|
315
|
+
real(wp), intent(in) :: a
|
|
316
|
+
real(wp), intent(in) :: b
|
|
317
|
+
real(wp), intent(in) :: c
|
|
318
|
+
real(wp), intent(in) :: d
|
|
319
|
+
real(wp), intent(in) :: elmbda
|
|
320
|
+
real(wp), intent(out) :: pertrb
|
|
321
|
+
real(wp), intent(in) :: bda(:)
|
|
322
|
+
real(wp), intent(in) :: bdb(:)
|
|
323
|
+
real(wp), intent(in) :: bdc(:)
|
|
324
|
+
real(wp), intent(in) :: bdd(:)
|
|
325
|
+
real(wp), intent(inout) :: f(:,:)
|
|
326
|
+
|
|
327
|
+
! Local variables
|
|
328
|
+
type(FishpackWorkspace) :: workspace
|
|
329
|
+
|
|
330
|
+
! Check input arguments
|
|
331
|
+
call hwscrt_check_input_arguments(a, b, m, mbdcnd, c, d, n, nbdcnd, idimf, ierror)
|
|
332
|
+
|
|
333
|
+
! Check error flag
|
|
334
|
+
if (ierror /= 0) return
|
|
335
|
+
|
|
336
|
+
! Allocate memory
|
|
337
|
+
call workspace%initialize_centered_workspace(n, m)
|
|
338
|
+
|
|
339
|
+
! Solve system
|
|
340
|
+
associate( rew => workspace%real_workspace)
|
|
341
|
+
call hwscrt_lower_routine(a, b, m, mbdcnd, bda, bdb, c, d, &
|
|
342
|
+
n, nbdcnd, bdc, bdd, elmbda, f, idimf, pertrb, ierror, rew)
|
|
343
|
+
end associate
|
|
344
|
+
|
|
345
|
+
! Release memory
|
|
346
|
+
call workspace%destroy()
|
|
347
|
+
|
|
348
|
+
end subroutine hwscrt
|
|
349
|
+
|
|
350
|
+
subroutine hwscrt_lower_routine(a, b, m, mbdcnd, bda, bdb, c, d, n, nbdcnd, bdc, &
|
|
351
|
+
bdd, elmbda, f, idimf, pertrb, ierror, w)
|
|
352
|
+
|
|
353
|
+
! Dummy arguments
|
|
354
|
+
integer(ip), intent(in) :: m
|
|
355
|
+
integer(ip), intent(in) :: mbdcnd
|
|
356
|
+
integer(ip), intent(in) :: n
|
|
357
|
+
integer(ip), intent(in) :: nbdcnd
|
|
358
|
+
integer(ip), intent(in) :: idimf
|
|
359
|
+
integer(ip), intent(out) :: ierror
|
|
360
|
+
real(wp), intent(in) :: a
|
|
361
|
+
real(wp), intent(in) :: b
|
|
362
|
+
real(wp), intent(in) :: c
|
|
363
|
+
real(wp), intent(in) :: d
|
|
364
|
+
real(wp), intent(in) :: elmbda
|
|
365
|
+
real(wp), intent(out) :: pertrb
|
|
366
|
+
real(wp), intent(in) :: bda(:)
|
|
367
|
+
real(wp), intent(in) :: bdb(:)
|
|
368
|
+
real(wp), intent(in) :: bdc(:)
|
|
369
|
+
real(wp), intent(in) :: bdd(:)
|
|
370
|
+
real(wp), intent(inout) :: f(idimf,*)
|
|
371
|
+
real(wp), intent(inout) :: w(:)
|
|
372
|
+
|
|
373
|
+
! Local variables
|
|
374
|
+
integer(ip) :: nperod, mperod, np, np1, mp, mp1, nstart, nstop, nskip
|
|
375
|
+
integer(ip) :: nunk, mstart, mstop, mskip, munk, id2, id3, id4
|
|
376
|
+
integer(ip) :: local_error_flag
|
|
377
|
+
real(wp) :: dx, twdelx, delxsq, dy
|
|
378
|
+
real(wp) :: twdely, delysq, s, two_s
|
|
379
|
+
type(CenteredCyclicReductionUtility) :: util
|
|
380
|
+
|
|
381
|
+
nperod = nbdcnd
|
|
382
|
+
|
|
383
|
+
if (mbdcnd > 0) then
|
|
384
|
+
mperod = 1
|
|
385
|
+
else
|
|
386
|
+
mperod = 0
|
|
387
|
+
end if
|
|
388
|
+
|
|
389
|
+
dx = (b - a)/m
|
|
390
|
+
twdelx = TWO/dx
|
|
391
|
+
delxsq = ONE/dx**2
|
|
392
|
+
dy = (d - c)/n
|
|
393
|
+
twdely = TWO/dy
|
|
394
|
+
delysq = ONE/dy**2
|
|
395
|
+
np = nbdcnd + 1
|
|
396
|
+
np1 = n + 1
|
|
397
|
+
mp = mbdcnd + 1
|
|
398
|
+
mp1 = m + 1
|
|
399
|
+
nstart = 1
|
|
400
|
+
nstop = n
|
|
401
|
+
nskip = 1
|
|
402
|
+
|
|
403
|
+
select case (np)
|
|
404
|
+
case (2)
|
|
405
|
+
nstart = 2
|
|
406
|
+
case (3)
|
|
407
|
+
nstart = 2
|
|
408
|
+
nstop = np1
|
|
409
|
+
nskip = 2
|
|
410
|
+
case (4)
|
|
411
|
+
nstop = np1
|
|
412
|
+
nskip = 2
|
|
413
|
+
end select
|
|
414
|
+
|
|
415
|
+
nunk = nstop - nstart + 1
|
|
416
|
+
!
|
|
417
|
+
! Enter boundary data for x-boundaries.
|
|
418
|
+
!
|
|
419
|
+
mstart = 1
|
|
420
|
+
mstop = m
|
|
421
|
+
mskip = 1
|
|
422
|
+
|
|
423
|
+
if (mp /= 1) then
|
|
424
|
+
select case (mp)
|
|
425
|
+
case (2)
|
|
426
|
+
mstart = 2
|
|
427
|
+
f(2, nstart:nstop) = f(2, nstart:nstop) - f(1, nstart:nstop)*delxsq
|
|
428
|
+
case (3)
|
|
429
|
+
mstart = 2
|
|
430
|
+
mstop = mp1
|
|
431
|
+
mskip = 2
|
|
432
|
+
f(2, nstart:nstop) = f(2, nstart:nstop) - f(1, nstart:nstop)*delxsq
|
|
433
|
+
case (4)
|
|
434
|
+
mstop = mp1
|
|
435
|
+
mskip = 2
|
|
436
|
+
f(1, nstart:nstop) = f(1, nstart:nstop) + bda(nstart:nstop)*twdelx
|
|
437
|
+
case (5)
|
|
438
|
+
f(1, nstart:nstop) = f(1, nstart:nstop) + bda(nstart:nstop)*twdelx
|
|
439
|
+
end select
|
|
440
|
+
|
|
441
|
+
select case (mskip)
|
|
442
|
+
case default
|
|
443
|
+
f(m, nstart:nstop) = f(m, nstart:nstop) - f(mp1, nstart:nstop)* &
|
|
444
|
+
delxsq
|
|
445
|
+
case (2)
|
|
446
|
+
f(mp1, nstart:nstop) = f(mp1, nstart:nstop) - bdb(nstart:nstop)* &
|
|
447
|
+
twdelx
|
|
448
|
+
end select
|
|
449
|
+
end if
|
|
450
|
+
|
|
451
|
+
munk = mstop - mstart + 1
|
|
452
|
+
!
|
|
453
|
+
! Enter boundary data for y-boundaries.
|
|
454
|
+
!
|
|
455
|
+
if (np /= 1) then
|
|
456
|
+
select case (np)
|
|
457
|
+
case (2:3)
|
|
458
|
+
f(mstart:mstop, 2) = f(mstart:mstop, 2) - f(mstart:mstop, 1)*delysq
|
|
459
|
+
case (4:5)
|
|
460
|
+
f(mstart:mstop, 1) = f(mstart:mstop, 1) + bdc(mstart:mstop)*twdely
|
|
461
|
+
end select
|
|
462
|
+
|
|
463
|
+
select case (nskip)
|
|
464
|
+
case default
|
|
465
|
+
f(mstart:mstop, n) = f(mstart:mstop, n) - f(mstart:mstop, np1)* &
|
|
466
|
+
delysq
|
|
467
|
+
case (2)
|
|
468
|
+
f(mstart:mstop, np1) = f(mstart:mstop, np1) - bdd(mstart:mstop)* &
|
|
469
|
+
twdely
|
|
470
|
+
end select
|
|
471
|
+
end if
|
|
472
|
+
|
|
473
|
+
! Multiply right side by deltay**2.
|
|
474
|
+
delysq = dy**2
|
|
475
|
+
f(mstart:mstop, nstart:nstop) = f(mstart:mstop, nstart:nstop)*delysq
|
|
476
|
+
|
|
477
|
+
! Define the a, b, c coefficients in w-array.
|
|
478
|
+
id2 = munk
|
|
479
|
+
id3 = id2 + munk
|
|
480
|
+
id4 = id3 + munk
|
|
481
|
+
s = delysq*delxsq
|
|
482
|
+
two_s = TWO*s
|
|
483
|
+
w(:munk) = s
|
|
484
|
+
w(id2+1:munk+id2) = (-two_s) + elmbda*delysq
|
|
485
|
+
w(id3+1:munk+id3) = s
|
|
486
|
+
|
|
487
|
+
if (mp /= 1) then
|
|
488
|
+
w(1) = ZERO
|
|
489
|
+
w(id4) = ZERO
|
|
490
|
+
end if
|
|
491
|
+
|
|
492
|
+
select case (mp)
|
|
493
|
+
case (3)
|
|
494
|
+
w(id2) = two_s
|
|
495
|
+
case (4)
|
|
496
|
+
w(id2) = two_s
|
|
497
|
+
w(id3+1) = two_s
|
|
498
|
+
case (5)
|
|
499
|
+
w(id3+1) = two_s
|
|
500
|
+
end select
|
|
501
|
+
|
|
502
|
+
pertrb = ZERO
|
|
503
|
+
if (elmbda >= ZERO) then
|
|
504
|
+
if (elmbda /= ZERO) then
|
|
505
|
+
ierror = 6
|
|
506
|
+
end if
|
|
507
|
+
end if
|
|
508
|
+
|
|
509
|
+
! Set worspace indices
|
|
510
|
+
associate( &
|
|
511
|
+
iw1 => 1, &
|
|
512
|
+
iw2 => id2 + 1, &
|
|
513
|
+
iw3 => id3 + 1, &
|
|
514
|
+
iw4 => id4 + 1 &
|
|
515
|
+
)
|
|
516
|
+
|
|
517
|
+
! Solve system
|
|
518
|
+
call util%genbun_lower_routine(nperod, nunk, mperod, munk, w(iw1:), w(iw2:), w(iw3:), &
|
|
519
|
+
idimf, f(mstart, nstart), local_error_flag, w(iw4:))
|
|
520
|
+
|
|
521
|
+
! Check error flag
|
|
522
|
+
if (local_error_flag /= 0) then
|
|
523
|
+
error stop 'fishpack library: genbun_lower_routine call failed in hwscrt_lower_routine'
|
|
524
|
+
end if
|
|
525
|
+
end associate
|
|
526
|
+
|
|
527
|
+
! Fill in identical values when have periodic boundary conditions.
|
|
528
|
+
if (nbdcnd == 0) f(mstart:mstop, np1) = f(mstart:mstop, 1)
|
|
529
|
+
|
|
530
|
+
if (mbdcnd == 0) then
|
|
531
|
+
f(mp1, nstart:nstop) = f(1, nstart:nstop)
|
|
532
|
+
if (nbdcnd == 0) f(mp1, np1) = f(1, np1)
|
|
533
|
+
end if
|
|
534
|
+
|
|
535
|
+
end subroutine hwscrt_lower_routine
|
|
536
|
+
|
|
537
|
+
pure subroutine hwscrt_check_input_arguments(a, b, m, mbdcnd, c, d, n, nbdcnd, idimf, ierror)
|
|
538
|
+
|
|
539
|
+
! Dummy arguments
|
|
540
|
+
integer(ip), intent(in) :: m
|
|
541
|
+
integer(ip), intent(in) :: mbdcnd
|
|
542
|
+
integer(ip), intent(in) :: n
|
|
543
|
+
integer(ip), intent(in) :: nbdcnd
|
|
544
|
+
integer(ip), intent(in) :: idimf
|
|
545
|
+
integer(ip), intent(out) :: ierror
|
|
546
|
+
real(wp), intent(in) :: a
|
|
547
|
+
real(wp), intent(in) :: b
|
|
548
|
+
real(wp), intent(in) :: c
|
|
549
|
+
real(wp), intent(in) :: d
|
|
550
|
+
|
|
551
|
+
! Check input arguments
|
|
552
|
+
if (ZERO <= (a - b)) then
|
|
553
|
+
ierror = 1
|
|
554
|
+
else if (mbdcnd < 0 .or. mbdcnd > 4) then
|
|
555
|
+
ierror = 2
|
|
556
|
+
else if (ZERO <= (c - d)) then
|
|
557
|
+
ierror = 3
|
|
558
|
+
else if (n <= 3) then
|
|
559
|
+
ierror = 4
|
|
560
|
+
else if (nbdcnd < 0 .or. nbdcnd > 4) then
|
|
561
|
+
ierror = 5
|
|
562
|
+
else if (idimf < m + 1) then
|
|
563
|
+
ierror = 7
|
|
564
|
+
else if (m <= 3) then
|
|
565
|
+
ierror = 8
|
|
566
|
+
else
|
|
567
|
+
ierror = 0
|
|
568
|
+
end if
|
|
569
|
+
|
|
570
|
+
end subroutine hwscrt_check_input_arguments
|
|
571
|
+
|
|
572
|
+
end submodule centered_cartesian_solver
|
|
573
|
+
!
|
|
574
|
+
! REVISION HISTORY
|
|
575
|
+
!
|
|
576
|
+
! September 1973 Version 1
|
|
577
|
+
! April 1976 Version 2
|
|
578
|
+
! January 1978 Version 3
|
|
579
|
+
! December 1979 Version 3.1
|
|
580
|
+
! February 1985 Documentation upgrade
|
|
581
|
+
! November 1988 Version 3.2, FORTRAN 77 changes
|
|
582
|
+
! June 2004 Version 5.0, Fortran 90 changes
|
|
583
|
+
! May 2016 Fortran 2008 changes
|