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,553 @@
|
|
|
1
|
+
!
|
|
2
|
+
! file hstcrt.f90
|
|
3
|
+
!
|
|
4
|
+
! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
5
|
+
! * *
|
|
6
|
+
! * copyright (c) 2005 by UCAR *
|
|
7
|
+
! * *
|
|
8
|
+
! * University Corporation for Atmospheric Research *
|
|
9
|
+
! * *
|
|
10
|
+
! * all rights reserved *
|
|
11
|
+
! * *
|
|
12
|
+
! * Fishpack *
|
|
13
|
+
! * *
|
|
14
|
+
! * A Package of Fortran *
|
|
15
|
+
! * *
|
|
16
|
+
! * Subroutines and Example Programs *
|
|
17
|
+
! * *
|
|
18
|
+
! * for Modeling Geophysical Processes *
|
|
19
|
+
! * *
|
|
20
|
+
! * by *
|
|
21
|
+
! * *
|
|
22
|
+
! * John Adams, Paul Swarztrauber and Roland Sweet *
|
|
23
|
+
! * *
|
|
24
|
+
! * of *
|
|
25
|
+
! * *
|
|
26
|
+
! * the National Center for Atmospheric Research *
|
|
27
|
+
! * *
|
|
28
|
+
! * Boulder, Colorado (80307) U.S.A. *
|
|
29
|
+
! * *
|
|
30
|
+
! * which is sponsored by *
|
|
31
|
+
! * *
|
|
32
|
+
! * the National Science Foundation *
|
|
33
|
+
! * *
|
|
34
|
+
! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
35
|
+
!
|
|
36
|
+
! SUBROUTINE hstcrt (a, b, m, mbdcnd, bda, bdb, c, d, n, nbdcnd, bdc, bdd,
|
|
37
|
+
! elmbda, f, idimf, pertrb, ierror)
|
|
38
|
+
!
|
|
39
|
+
! DIMENSION OF bda(n), bdb(n), bdc(m), bdd(m), f(idimf, n)
|
|
40
|
+
! ARGUMENTS
|
|
41
|
+
!
|
|
42
|
+
! LATEST REVISION May 2016
|
|
43
|
+
!
|
|
44
|
+
! PURPOSE Solves the standard five-point finite
|
|
45
|
+
! difference approximation to the helmholtz
|
|
46
|
+
! equation
|
|
47
|
+
! (d/dx)(du/dx) + (d/dy)(du/dy) + lambda*u
|
|
48
|
+
! = f(x, y)
|
|
49
|
+
! on a staggered grid in cartesian coordinates.
|
|
50
|
+
!
|
|
51
|
+
! USAGE call hstcrt (a, b, m, mbdcnd, bda, bdb, c, d
|
|
52
|
+
! n, nbdcnd, bdc, bdd, elmbda,
|
|
53
|
+
! f, idimf, pertrb, ierror)
|
|
54
|
+
!
|
|
55
|
+
! ARGUMENTS
|
|
56
|
+
! ON INPUT
|
|
57
|
+
!
|
|
58
|
+
! a, b
|
|
59
|
+
! the range of x, i.e. a <= x <= b.
|
|
60
|
+
! a must be less than b.
|
|
61
|
+
!
|
|
62
|
+
! m
|
|
63
|
+
! the number of grid points in the
|
|
64
|
+
! interval (a, b). the grid points
|
|
65
|
+
! in the x-direction are given by
|
|
66
|
+
! x(i) = a + (i-0.5)dx for i=1, 2, ..., m
|
|
67
|
+
! where dx =(b-a)/m. m must be greater
|
|
68
|
+
! than 2.
|
|
69
|
+
!
|
|
70
|
+
! mbdcnd
|
|
71
|
+
! indicates the type of boundary conditions
|
|
72
|
+
! at x = a and x = b.
|
|
73
|
+
!
|
|
74
|
+
! = 0 if the solution is periodic in x,
|
|
75
|
+
! u(m+i, j) = u(i, j).
|
|
76
|
+
!
|
|
77
|
+
! = 1 if the solution is specified at
|
|
78
|
+
! x = a and x = b.
|
|
79
|
+
!
|
|
80
|
+
! = 2 if the solution is specified at
|
|
81
|
+
! x = a and the derivative
|
|
82
|
+
! of the solution with respect to x
|
|
83
|
+
! is specified at x = b.
|
|
84
|
+
!
|
|
85
|
+
! = 3 if the derivative of the solution
|
|
86
|
+
! with respect to x is specified
|
|
87
|
+
! at x = a and x = b.
|
|
88
|
+
!
|
|
89
|
+
! = 4 if the derivative of the solution
|
|
90
|
+
! with respect to x is specified
|
|
91
|
+
! at x = a and the solution is
|
|
92
|
+
! specified at x = b.
|
|
93
|
+
!
|
|
94
|
+
! bda
|
|
95
|
+
! a one-dimensional array of length n
|
|
96
|
+
! that specifies the boundary values
|
|
97
|
+
! (if any) of the solution at x = a.
|
|
98
|
+
!
|
|
99
|
+
! when mbdcnd = 1 or 2,
|
|
100
|
+
! bda(j) = u(a, y(j)) , j=1, 2, ..., n.
|
|
101
|
+
!
|
|
102
|
+
! when mbdcnd = 3 or 4,
|
|
103
|
+
! bda(j) = (d/dx)u(a, y(j)) , j=1, 2, ..., n.
|
|
104
|
+
!
|
|
105
|
+
! bdb
|
|
106
|
+
! a one-dimensional array of length n
|
|
107
|
+
! that specifies the boundary values
|
|
108
|
+
! of the solution at x = b.
|
|
109
|
+
!
|
|
110
|
+
! when mbdcnd = 1 or 4
|
|
111
|
+
! bdb(j) = u(b, y(j)) , j=1, 2, ..., n.
|
|
112
|
+
!
|
|
113
|
+
! when mbdcnd = 2 or 3
|
|
114
|
+
! bdb(j) = (d/dx)u(b, y(j)) , j=1, 2, ..., n.
|
|
115
|
+
!
|
|
116
|
+
! c, d
|
|
117
|
+
! the range of y, i.e. c <= y <= d.
|
|
118
|
+
! c must be less than d.
|
|
119
|
+
!
|
|
120
|
+
!
|
|
121
|
+
! n
|
|
122
|
+
! the number of unknowns in the interval
|
|
123
|
+
! (c, d). the unknowns in the y-direction
|
|
124
|
+
! are given by y(j) = c + (j-0.5)dy,
|
|
125
|
+
! j=1, 2, ..., n, where dy = (d-c)/n.
|
|
126
|
+
! n must be greater than 2.
|
|
127
|
+
!
|
|
128
|
+
! nbdcnd
|
|
129
|
+
! indicates the type of boundary conditions
|
|
130
|
+
! at y = c and y = d.
|
|
131
|
+
!
|
|
132
|
+
!
|
|
133
|
+
! = 0 if the solution is periodic in y, i.e.
|
|
134
|
+
! u(i, j) = u(i, n+j).
|
|
135
|
+
!
|
|
136
|
+
! = 1 if the solution is specified at y = c
|
|
137
|
+
! and y = d.
|
|
138
|
+
!
|
|
139
|
+
! = 2 if the solution is specified at y = c
|
|
140
|
+
! and the derivative of the solution
|
|
141
|
+
! with respect to y is specified at
|
|
142
|
+
! y = d.
|
|
143
|
+
!
|
|
144
|
+
! = 3 if the derivative of the solution
|
|
145
|
+
! with respect to y is specified at
|
|
146
|
+
! y = c and y = d.
|
|
147
|
+
!
|
|
148
|
+
! = 4 if the derivative of the solution
|
|
149
|
+
! with respect to y is specified at
|
|
150
|
+
! y = c and the solution is specified
|
|
151
|
+
! at y = d.
|
|
152
|
+
!
|
|
153
|
+
! bdc
|
|
154
|
+
! a one dimensional array of length m that
|
|
155
|
+
! specifies the boundary values of the
|
|
156
|
+
! solution at y = c.
|
|
157
|
+
!
|
|
158
|
+
! when nbdcnd = 1 or 2,
|
|
159
|
+
! bdc(i) = u(x(i), c) , i=1, 2, ..., m.
|
|
160
|
+
!
|
|
161
|
+
! when nbdcnd = 3 or 4,
|
|
162
|
+
! bdc(i) = (d/dy)u(x(i), c), i=1, 2, ..., m.
|
|
163
|
+
!
|
|
164
|
+
! when nbdcnd = 0, bdc is a dummy variable.
|
|
165
|
+
!
|
|
166
|
+
! bdd
|
|
167
|
+
! a one-dimensional array of length m that
|
|
168
|
+
! specifies the boundary values of the
|
|
169
|
+
! solution at y = d.
|
|
170
|
+
!
|
|
171
|
+
! when nbdcnd = 1 or 4,
|
|
172
|
+
! bdd(i) = u(x(i), d) , i=1, 2, ..., m.
|
|
173
|
+
!
|
|
174
|
+
! when nbdcnd = 2 or 3,
|
|
175
|
+
! bdd(i) = (d/dy)u(x(i), d) , i=1, 2, ..., m.
|
|
176
|
+
!
|
|
177
|
+
! when nbdcnd = 0, bdd is a dummy variable.
|
|
178
|
+
!
|
|
179
|
+
! elmbda
|
|
180
|
+
! the constant lambda in the helmholtz
|
|
181
|
+
! equation. if lambda is greater than 0,
|
|
182
|
+
! a solution may not exist. however,
|
|
183
|
+
! hstcrt will attempt to find a solution.
|
|
184
|
+
!
|
|
185
|
+
! f
|
|
186
|
+
! a two-dimensional array that specifies
|
|
187
|
+
! the values of the right side of the
|
|
188
|
+
! helmholtz equation. for i=1, 2, ..., m
|
|
189
|
+
! and j=1, 2, ..., n
|
|
190
|
+
!
|
|
191
|
+
! f(i, j) = f(x(i), y(j)) .
|
|
192
|
+
!
|
|
193
|
+
! f must be dimensioned at least m x n.
|
|
194
|
+
!
|
|
195
|
+
! idimf
|
|
196
|
+
! the row (or first) dimension of the array
|
|
197
|
+
! f as it appears in the program calling
|
|
198
|
+
! hstcrt. this parameter is used to specify
|
|
199
|
+
! the variable dimension of f.
|
|
200
|
+
! idimf must be at least m.
|
|
201
|
+
!
|
|
202
|
+
!
|
|
203
|
+
! ON OUTPUT f
|
|
204
|
+
! contains the solution u(i, j) of the finite
|
|
205
|
+
! difference approximation for the grid point
|
|
206
|
+
! (x(i), y(j)) for i=1, 2, ..., m, j=1, 2, ..., n.
|
|
207
|
+
!
|
|
208
|
+
! pertrb
|
|
209
|
+
! If a combination of periodic or derivative
|
|
210
|
+
! boundary conditions is specified for a
|
|
211
|
+
! poisson equation (lambda = 0), a solution
|
|
212
|
+
! may not exist. pertrb is a constant,
|
|
213
|
+
! calculated and subtracted from f, which
|
|
214
|
+
! ensures that a solution exists. hstcrt
|
|
215
|
+
! then computes this solution, which is a
|
|
216
|
+
! least squares solution to the original
|
|
217
|
+
! approximation. this solution plus any
|
|
218
|
+
! constant is also a solution; hence, the
|
|
219
|
+
! solution is not unique. the value of
|
|
220
|
+
! pertrb should be small compared to the
|
|
221
|
+
! right side f. otherwise, a solution is
|
|
222
|
+
! obtained to an essentially different problem.
|
|
223
|
+
! this comparison should always be made to
|
|
224
|
+
! insure that a meaningful solution has been
|
|
225
|
+
! obtained.
|
|
226
|
+
!
|
|
227
|
+
! ierror
|
|
228
|
+
! an error flag that indicates invalid input
|
|
229
|
+
! parameters. except to numbers 0 and 6,
|
|
230
|
+
! a solution is not attempted.
|
|
231
|
+
!
|
|
232
|
+
! = 0 no error
|
|
233
|
+
!
|
|
234
|
+
! = 1 a >= b
|
|
235
|
+
!
|
|
236
|
+
! = 2 mbdcnd < 0 or mbdcnd > 4
|
|
237
|
+
!
|
|
238
|
+
! = 3 c >= d
|
|
239
|
+
!
|
|
240
|
+
! = 4 n <= 2
|
|
241
|
+
!
|
|
242
|
+
! = 5 nbdcnd < 0 or nbdcnd > 4
|
|
243
|
+
!
|
|
244
|
+
! = 6 lambda > 0
|
|
245
|
+
!
|
|
246
|
+
! = 7 idimf < m
|
|
247
|
+
!
|
|
248
|
+
! = 8 m <= 2
|
|
249
|
+
!
|
|
250
|
+
! Since this is the only means of indicating
|
|
251
|
+
! a possibly incorrect call to hstcrt, the
|
|
252
|
+
! user should test ierror after the call.
|
|
253
|
+
!
|
|
254
|
+
! = 20 If the dynamic allocation of real and
|
|
255
|
+
! complex workspace required for solution
|
|
256
|
+
! fails (for example if n, m are too large
|
|
257
|
+
! for your computer)
|
|
258
|
+
!
|
|
259
|
+
!
|
|
260
|
+
! I/O None
|
|
261
|
+
!
|
|
262
|
+
! PRECISION 64-bit double precision
|
|
263
|
+
!
|
|
264
|
+
! REQUIRED LIBRARY type_FishpackWorkspace.f90, genbun.f90, type_CyclicReductionUtility.f9090, poistg.f90
|
|
265
|
+
! FILES
|
|
266
|
+
!
|
|
267
|
+
! LANGUAGE Fortran
|
|
268
|
+
!
|
|
269
|
+
! HISTORY * Written by Roland Sweet at NCAR in 1977.
|
|
270
|
+
! released on NCAR's public software libraries
|
|
271
|
+
! in January 1980.
|
|
272
|
+
! * Revised in June 2004 by John Adams using
|
|
273
|
+
! Fortran 90 dynamically allocated workspace.
|
|
274
|
+
!
|
|
275
|
+
! PORTABILITY Fortran 2008
|
|
276
|
+
!
|
|
277
|
+
! ALGORITHM This subroutine defines the finite-difference
|
|
278
|
+
! equations, incorporates boundary data, adjusts
|
|
279
|
+
! the right side when the system is singular
|
|
280
|
+
! and calls either poistg or genbun which solves
|
|
281
|
+
! the linear system of equations.
|
|
282
|
+
!
|
|
283
|
+
! TIMING For large m and n, the operation count
|
|
284
|
+
! is roughly proportional to m*n*log2(n).
|
|
285
|
+
!
|
|
286
|
+
! ACCURACY The solution process employed results in a
|
|
287
|
+
! loss of no more than four significant digits
|
|
288
|
+
! for n and m as large as 64. more detailed
|
|
289
|
+
! information about accuracy can be found in
|
|
290
|
+
! the documentation for package poistg which
|
|
291
|
+
! solves the finite difference equations.
|
|
292
|
+
!
|
|
293
|
+
! REFERENCES U. Schumann and R. Sweet, "A direct method
|
|
294
|
+
! for the solution of Poisson's equation with
|
|
295
|
+
! boundary conditions on a staggered grid of
|
|
296
|
+
! arbitrary size, " J. Comp. Phys. 20(1976),
|
|
297
|
+
! PP. 171-182.
|
|
298
|
+
!
|
|
299
|
+
submodule(staggered_helmholtz_solvers) staggered_cartesian_solver
|
|
300
|
+
|
|
301
|
+
contains
|
|
302
|
+
|
|
303
|
+
module subroutine hstcrt(a, b, m, mbdcnd, bda, bdb, c, d, n, nbdcnd, bdc, &
|
|
304
|
+
bdd, elmbda, f, idimf, pertrb, ierror)
|
|
305
|
+
|
|
306
|
+
! Dummy arguments
|
|
307
|
+
integer(ip), intent(in) :: m
|
|
308
|
+
integer(ip), intent(in) :: mbdcnd
|
|
309
|
+
integer(ip), intent(in) :: n
|
|
310
|
+
integer(ip), intent(in) :: nbdcnd
|
|
311
|
+
integer(ip), intent(in) :: idimf
|
|
312
|
+
integer(ip), intent(out) :: ierror
|
|
313
|
+
real(wp), intent(in) :: a
|
|
314
|
+
real(wp), intent(in) :: b
|
|
315
|
+
real(wp), intent(in) :: c
|
|
316
|
+
real(wp), intent(in) :: d
|
|
317
|
+
real(wp), intent(in) :: elmbda
|
|
318
|
+
real(wp), intent(out) :: pertrb
|
|
319
|
+
real(wp), intent(in) :: bda(:)
|
|
320
|
+
real(wp), intent(in) :: bdb(:)
|
|
321
|
+
real(wp), intent(in) :: bdc(:)
|
|
322
|
+
real(wp), intent(in) :: bdd(:)
|
|
323
|
+
real(wp), intent(inout) :: f(:,:)
|
|
324
|
+
|
|
325
|
+
! Local variables
|
|
326
|
+
type(FishpackWorkspace) :: workspace
|
|
327
|
+
|
|
328
|
+
! Check input arguments
|
|
329
|
+
call hstcrt_check_input_arguments(a, b, m, mbdcnd, c, d, n, nbdcnd, idimf, ierror)
|
|
330
|
+
|
|
331
|
+
! Check error flag
|
|
332
|
+
if (ierror /= 0) return
|
|
333
|
+
|
|
334
|
+
! Allocate memory
|
|
335
|
+
call workspace%initialize_staggered_workspace(n, m)
|
|
336
|
+
|
|
337
|
+
! Solve system
|
|
338
|
+
associate( rew => workspace%real_workspace )
|
|
339
|
+
call hstcrt_lower_routine(a, b, m, mbdcnd, bda, bdb, &
|
|
340
|
+
c, d, n, nbdcnd, bdc, bdd, &
|
|
341
|
+
elmbda, f, idimf, pertrb, ierror, rew)
|
|
342
|
+
end associate
|
|
343
|
+
|
|
344
|
+
! Release memory
|
|
345
|
+
call workspace%destroy()
|
|
346
|
+
|
|
347
|
+
end subroutine hstcrt
|
|
348
|
+
|
|
349
|
+
pure subroutine hstcrt_check_input_arguments(a, b, m, mbdcnd, c, d, n, nbdcnd, idimf, ierror)
|
|
350
|
+
|
|
351
|
+
! Dummy arguments
|
|
352
|
+
integer(ip), intent(in) :: m
|
|
353
|
+
integer(ip), intent(in) :: mbdcnd
|
|
354
|
+
integer(ip), intent(in) :: n
|
|
355
|
+
integer(ip), intent(in) :: nbdcnd
|
|
356
|
+
integer(ip), intent(in) :: idimf
|
|
357
|
+
integer(ip), intent(out) :: ierror
|
|
358
|
+
real(wp), intent(in) :: a
|
|
359
|
+
real(wp), intent(in) :: b
|
|
360
|
+
real(wp), intent(in) :: c
|
|
361
|
+
real(wp), intent(in) :: d
|
|
362
|
+
|
|
363
|
+
if (ZERO <= (a-b)) then
|
|
364
|
+
ierror = 1
|
|
365
|
+
return
|
|
366
|
+
else if (mbdcnd < 0 .or. mbdcnd > 4) then
|
|
367
|
+
ierror = 2
|
|
368
|
+
return
|
|
369
|
+
else if (ZERO <= (c-d)) then
|
|
370
|
+
ierror = 3
|
|
371
|
+
return
|
|
372
|
+
else if(3 > n) then
|
|
373
|
+
ierror = 4
|
|
374
|
+
return
|
|
375
|
+
else if (nbdcnd < 0 .or. nbdcnd > 4) then
|
|
376
|
+
ierror = 5
|
|
377
|
+
return
|
|
378
|
+
else if (idimf < m) then
|
|
379
|
+
ierror = 7
|
|
380
|
+
return
|
|
381
|
+
else if (3 > m) then
|
|
382
|
+
ierror = 8
|
|
383
|
+
return
|
|
384
|
+
else
|
|
385
|
+
ierror = 0
|
|
386
|
+
end if
|
|
387
|
+
|
|
388
|
+
end subroutine hstcrt_check_input_arguments
|
|
389
|
+
|
|
390
|
+
subroutine hstcrt_lower_routine(a, b, m, mbdcnd, bda, bdb, c, d, n, nbdcnd, bdc, &
|
|
391
|
+
bdd, elmbda, f, idimf, pertrb, ierror, w)
|
|
392
|
+
|
|
393
|
+
! Dummy arguments
|
|
394
|
+
integer(ip), intent(in) :: m
|
|
395
|
+
integer(ip), intent(in) :: mbdcnd
|
|
396
|
+
integer(ip), intent(in) :: n
|
|
397
|
+
integer(ip), intent(in) :: nbdcnd
|
|
398
|
+
integer(ip), intent(in) :: idimf
|
|
399
|
+
integer(ip), intent(out) :: ierror
|
|
400
|
+
real(wp), intent(in) :: a
|
|
401
|
+
real(wp), intent(in) :: b
|
|
402
|
+
real(wp), intent(in) :: c
|
|
403
|
+
real(wp), intent(in) :: d
|
|
404
|
+
real(wp), intent(in) :: elmbda
|
|
405
|
+
real(wp), intent(out) :: pertrb
|
|
406
|
+
real(wp), intent(in) :: bda(:)
|
|
407
|
+
real(wp), intent(in) :: bdb(:)
|
|
408
|
+
real(wp), intent(in) :: bdc(:)
|
|
409
|
+
real(wp), intent(in) :: bdd(:)
|
|
410
|
+
real(wp), intent(inout) :: f(:,:)
|
|
411
|
+
real(wp), intent(inout) :: w(:)
|
|
412
|
+
|
|
413
|
+
! Local variables
|
|
414
|
+
integer(ip) :: nperod, mperod, np, mp
|
|
415
|
+
integer(ip) :: id2, id3, id4, local_error_flag
|
|
416
|
+
real(wp) :: dx, twdelx, delxsq, dy
|
|
417
|
+
real(wp) :: twdely, dy2, twdysq, s, two_s
|
|
418
|
+
type(CenteredCyclicReductionUtility) :: centered_util
|
|
419
|
+
type(StaggeredCyclicReductionUtility) :: staggered_util
|
|
420
|
+
|
|
421
|
+
nperod = nbdcnd
|
|
422
|
+
|
|
423
|
+
if (mbdcnd > 0) then
|
|
424
|
+
mperod = 1
|
|
425
|
+
else
|
|
426
|
+
mperod = 0
|
|
427
|
+
end if
|
|
428
|
+
|
|
429
|
+
dx = (b - a)/m
|
|
430
|
+
twdelx = ONE/dx
|
|
431
|
+
delxsq = TWO/dx**2
|
|
432
|
+
dy = (d - c)/n
|
|
433
|
+
twdely = ONE/dy
|
|
434
|
+
dy2 = dy**2
|
|
435
|
+
twdysq = TWO/dy2
|
|
436
|
+
np = nbdcnd + 1
|
|
437
|
+
mp = mbdcnd + 1
|
|
438
|
+
!
|
|
439
|
+
! define the a, b, c coefficients in w-array.
|
|
440
|
+
!
|
|
441
|
+
id2 = m
|
|
442
|
+
id3 = id2 + m
|
|
443
|
+
id4 = id3 + m
|
|
444
|
+
s = (dy/dx)**2
|
|
445
|
+
two_s = TWO*s
|
|
446
|
+
w(:m) = s
|
|
447
|
+
w(id2+1:m+id2) = (-two_s) + elmbda*dy2
|
|
448
|
+
w(id3+1:m+id3) = s
|
|
449
|
+
!
|
|
450
|
+
! Set boundary data for x-boundaries.
|
|
451
|
+
!
|
|
452
|
+
if (mp /= 1) then
|
|
453
|
+
select case (mp)
|
|
454
|
+
case (2:3)
|
|
455
|
+
f(1, :n) = f(1, :n) - bda(:n)*delxsq
|
|
456
|
+
w(id2+1) = w(id2+1) - w(1)
|
|
457
|
+
case (4:5)
|
|
458
|
+
f(1, :n) = f(1, :n) + bda(:n)*twdelx
|
|
459
|
+
w(id2+1) = w(id2+1) + w(1)
|
|
460
|
+
end select
|
|
461
|
+
|
|
462
|
+
select case (mp)
|
|
463
|
+
case (2, 5)
|
|
464
|
+
f(m, :n) = f(m, :n) - bdb(:n)*delxsq
|
|
465
|
+
w(id3) = w(id3) - w(1)
|
|
466
|
+
case (3:4)
|
|
467
|
+
f(m, :n) = f(m, :n) - bdb(:n)*twdelx
|
|
468
|
+
w(id3) = w(id3) + w(1)
|
|
469
|
+
end select
|
|
470
|
+
end if
|
|
471
|
+
|
|
472
|
+
if (np /= 1) then
|
|
473
|
+
select case (np)
|
|
474
|
+
case (2:3)
|
|
475
|
+
f(:m, 1) = f(:m, 1) - bdc(:m)*twdysq
|
|
476
|
+
case (4:5)
|
|
477
|
+
f(:m, 1) = f(:m, 1) + bdc(:m)*twdely
|
|
478
|
+
end select
|
|
479
|
+
|
|
480
|
+
select case (np)
|
|
481
|
+
case (2, 5)
|
|
482
|
+
f(:m, n) = f(:m, n) - bdd(:m)*twdysq
|
|
483
|
+
case (3:4)
|
|
484
|
+
f(:m, n) = f(:m, n) - bdd(:m)*twdely
|
|
485
|
+
end select
|
|
486
|
+
end if
|
|
487
|
+
|
|
488
|
+
f(:m, :n) = f(:m, :n)*dy2
|
|
489
|
+
|
|
490
|
+
if (mperod /= 0) then
|
|
491
|
+
w(1) = ZERO
|
|
492
|
+
w(id4) = ZERO
|
|
493
|
+
end if
|
|
494
|
+
|
|
495
|
+
pertrb = ZERO
|
|
496
|
+
|
|
497
|
+
if (elmbda >= ZERO) then
|
|
498
|
+
if (elmbda /= ZERO) then
|
|
499
|
+
ierror = 6
|
|
500
|
+
return
|
|
501
|
+
else
|
|
502
|
+
select case (mp)
|
|
503
|
+
case (1, 4)
|
|
504
|
+
select case (np)
|
|
505
|
+
case (1, 4)
|
|
506
|
+
!
|
|
507
|
+
! For singular problems must adjust data to
|
|
508
|
+
! insure that a solution will exist.
|
|
509
|
+
!
|
|
510
|
+
s = sum(f(:m, 1:n))
|
|
511
|
+
|
|
512
|
+
pertrb = s/(m*n)
|
|
513
|
+
f(:m, :n) = f(:m, :n) - pertrb
|
|
514
|
+
pertrb = pertrb/dy2
|
|
515
|
+
end select
|
|
516
|
+
end select
|
|
517
|
+
end if
|
|
518
|
+
end if
|
|
519
|
+
|
|
520
|
+
associate( &
|
|
521
|
+
iw1 => 1, &
|
|
522
|
+
iw2 => id2 + 1, &
|
|
523
|
+
iw3 => id3 + 1, &
|
|
524
|
+
iw4 => id4 + 1 &
|
|
525
|
+
)
|
|
526
|
+
select case (nperod)
|
|
527
|
+
case (0)
|
|
528
|
+
|
|
529
|
+
! Solve system with call to genbun_lower_routine
|
|
530
|
+
call centered_util%genbun_lower_routine(nperod, n, mperod, m, w(iw1:), w(iw2:), w(iw3:), &
|
|
531
|
+
idimf, f, local_error_flag, w(iw4:))
|
|
532
|
+
|
|
533
|
+
! Check error flag
|
|
534
|
+
if (local_error_flag /= 0) then
|
|
535
|
+
error stop 'fishpack library: genbun_lower_routine call failed in hstcrt_lower_routine'
|
|
536
|
+
end if
|
|
537
|
+
|
|
538
|
+
case default
|
|
539
|
+
|
|
540
|
+
! Solve system with call to poistg_lower_routine
|
|
541
|
+
call staggered_util%poistg_lower_routine(nperod, n, mperod, m, w(iw1:), w(iw2:), w(iw3:), &
|
|
542
|
+
idimf, f, local_error_flag, w(iw4:))
|
|
543
|
+
|
|
544
|
+
! Check error flag
|
|
545
|
+
if (local_error_flag /= 0) then
|
|
546
|
+
error stop 'fishpack library: poistg_lower_routine call failed in hstcrt_lower_routine'
|
|
547
|
+
end if
|
|
548
|
+
end select
|
|
549
|
+
end associate
|
|
550
|
+
|
|
551
|
+
end subroutine hstcrt_lower_routine
|
|
552
|
+
|
|
553
|
+
end submodule staggered_cartesian_solver
|