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,758 @@
|
|
|
1
|
+
!
|
|
2
|
+
! file hstssp.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 hstssp(a, b, m, mbdcnd, bda, bdb, c, d, n, nbdcnd, bdc, bdd,
|
|
37
|
+
! elmbda, f, idimf, pertrb, ierror)
|
|
38
|
+
!
|
|
39
|
+
!
|
|
40
|
+
! DIMENSION OF bda(n), bdb(n), bdc(m), bdd(m), f(idimf, n)
|
|
41
|
+
! ARGUMENTS
|
|
42
|
+
!
|
|
43
|
+
! LATEST REVISION May 2016
|
|
44
|
+
!
|
|
45
|
+
! PURPOSE Solves the standard five-point finite
|
|
46
|
+
! difference approximation on a staggered grid
|
|
47
|
+
! to the helmholtz equation in spherical
|
|
48
|
+
! coordinates and on the surface of the unit
|
|
49
|
+
! sphere (radius of 1). the equation is
|
|
50
|
+
!
|
|
51
|
+
! (1/sin(theta))(d/dtheta)(sin(theta)
|
|
52
|
+
! (du/dtheta)) + (1/sin(theta)**2)
|
|
53
|
+
! (d/dphi)(du/dphi) + lambda*u = f(theta, phi)
|
|
54
|
+
!
|
|
55
|
+
! where theta is colatitude and phi is
|
|
56
|
+
! longitude.
|
|
57
|
+
!
|
|
58
|
+
! USAGE call hstssp (a, b, m, mbdcnd, bda, bdb, c, d, n,
|
|
59
|
+
! nbdcnd, bdc, bdd, elmbda, f, idimf,
|
|
60
|
+
! pertrb, ierror)
|
|
61
|
+
!
|
|
62
|
+
!
|
|
63
|
+
! ARGUMENTS
|
|
64
|
+
! ON INPUT
|
|
65
|
+
!
|
|
66
|
+
! a, b
|
|
67
|
+
! the range of theta (colatitude),
|
|
68
|
+
! i.e. a <= theta <= b.
|
|
69
|
+
! a must be less than b and a must be
|
|
70
|
+
! non-negative. a and b are in radians.
|
|
71
|
+
! a = 0 corresponds to the north pole and
|
|
72
|
+
! b = pi corresponds to the south pole.
|
|
73
|
+
!
|
|
74
|
+
!
|
|
75
|
+
! * * * important * * *
|
|
76
|
+
!
|
|
77
|
+
! if b is equal to pi, then b must be
|
|
78
|
+
! computed using the statement
|
|
79
|
+
! b = pi_mach(dum)
|
|
80
|
+
!
|
|
81
|
+
! this insures that b in the user"s program
|
|
82
|
+
! is equal to pi in this program which
|
|
83
|
+
! permits several tests of the input
|
|
84
|
+
! parameters that otherwise would not be
|
|
85
|
+
! possible.
|
|
86
|
+
!
|
|
87
|
+
! * * * * * * * * * * * *
|
|
88
|
+
! m
|
|
89
|
+
! the number of grid points in the interval
|
|
90
|
+
! (a, b). the grid points in the theta
|
|
91
|
+
! direction are given by
|
|
92
|
+
! theta(i) = a + (i-HALF)dtheta
|
|
93
|
+
! for i=1, 2, ..., m where dtheta =(b-a)/m.
|
|
94
|
+
! m must be greater than 2.
|
|
95
|
+
!
|
|
96
|
+
! mbdcnd
|
|
97
|
+
! indicates the type of boundary conditions
|
|
98
|
+
! at theta = a and theta = b.
|
|
99
|
+
!
|
|
100
|
+
! = 1 if the solution is specified at
|
|
101
|
+
! theta = a and theta = b.
|
|
102
|
+
! (see note 3 below)
|
|
103
|
+
!
|
|
104
|
+
! = 2 if the solution is specified at
|
|
105
|
+
! theta = a and the derivative of the
|
|
106
|
+
! solution with respect to theta is
|
|
107
|
+
! specified at theta = b
|
|
108
|
+
! (see notes 2 and 3 below).
|
|
109
|
+
!
|
|
110
|
+
! = 3 if the derivative of the solution
|
|
111
|
+
! with respect to theta is specified
|
|
112
|
+
! at theta = a
|
|
113
|
+
! (see notes 1, 2 below) and theta = b.
|
|
114
|
+
!
|
|
115
|
+
! = 4 if the derivative of the solution
|
|
116
|
+
! with respect to theta is specified
|
|
117
|
+
! at theta = a
|
|
118
|
+
! (see notes 1 and 2 below) and the
|
|
119
|
+
! solution is specified at theta = b.
|
|
120
|
+
!
|
|
121
|
+
! = 5 if the solution is unspecified at
|
|
122
|
+
! theta = a = 0 and the solution is
|
|
123
|
+
! specified at theta = b.
|
|
124
|
+
! (see note 3 below)
|
|
125
|
+
!
|
|
126
|
+
! = 6 if the solution is unspecified at
|
|
127
|
+
! theta = a = 0 and the derivative
|
|
128
|
+
! of the solution with respect to theta
|
|
129
|
+
! is specified at theta = b
|
|
130
|
+
! (see note 2 below).
|
|
131
|
+
!
|
|
132
|
+
! = 7 if the solution is specified at
|
|
133
|
+
! theta = a and the solution is
|
|
134
|
+
! unspecified at theta = b = pi.
|
|
135
|
+
! (see note 3 below)
|
|
136
|
+
!
|
|
137
|
+
! = 8 if the derivative of the solution
|
|
138
|
+
! with respect to theta is specified at
|
|
139
|
+
! theta = a (see note 1 below)
|
|
140
|
+
! and the solution is unspecified at
|
|
141
|
+
! theta = b = pi.
|
|
142
|
+
!
|
|
143
|
+
! = 9 if the solution is unspecified at
|
|
144
|
+
! theta = a = 0 and theta = b = pi.
|
|
145
|
+
!
|
|
146
|
+
! note 1:
|
|
147
|
+
! if a = 0, do not use mbdcnd = 3, 4, or 8,
|
|
148
|
+
! but instead use mbdcnd = 5, 6, or 9.
|
|
149
|
+
!
|
|
150
|
+
! note 2:
|
|
151
|
+
! if b = pi, do not use mbdcnd = 2, 3, or 6,
|
|
152
|
+
! but instead use mbdcnd = 7, 8, or 9.
|
|
153
|
+
!
|
|
154
|
+
! note 3:
|
|
155
|
+
! when the solution is specified at
|
|
156
|
+
! theta = 0 and/or theta = pi and the other
|
|
157
|
+
! boundary conditions are combinations
|
|
158
|
+
! of unspecified, normal derivative, or
|
|
159
|
+
! periodicity a singular system results.
|
|
160
|
+
! the unique solution is determined by
|
|
161
|
+
! extrapolation to the specification of the
|
|
162
|
+
! solution at either theta = 0 or theta = pi.
|
|
163
|
+
! but in these cases the right side of the
|
|
164
|
+
! system will be perturbed by the constant
|
|
165
|
+
! pertrb.
|
|
166
|
+
!
|
|
167
|
+
! bda
|
|
168
|
+
! a one-dimensional array of length n that
|
|
169
|
+
! specifies the boundary values (if any) of
|
|
170
|
+
! the solution at theta = a.
|
|
171
|
+
!
|
|
172
|
+
! when mbdcnd = 1, 2, or 7,
|
|
173
|
+
! bda(j) = u(a, phi(j)) , j=1, 2, ..., n.
|
|
174
|
+
!
|
|
175
|
+
! when mbdcnd = 3, 4, or 8,
|
|
176
|
+
! bda(j) = (d/dtheta)u(a, phi(j)) ,
|
|
177
|
+
! j=1, 2, ..., n.
|
|
178
|
+
!
|
|
179
|
+
! when mbdcnd has any other value,
|
|
180
|
+
! bda is a dummy variable.
|
|
181
|
+
!
|
|
182
|
+
! bdb
|
|
183
|
+
! a one-dimensional array of length n that
|
|
184
|
+
! specifies the boundary values of the
|
|
185
|
+
! solution at theta = b.
|
|
186
|
+
!
|
|
187
|
+
! when mbdcnd = 1, 4, or 5,
|
|
188
|
+
! bdb(j) = u(b, phi(j)) , j=1, 2, ..., n.
|
|
189
|
+
!
|
|
190
|
+
! when mbdcnd = 2, 3, or 6,
|
|
191
|
+
! bdb(j) = (d/dtheta)u(b, phi(j)) ,
|
|
192
|
+
! j=1, 2, ..., n.
|
|
193
|
+
!
|
|
194
|
+
! when mbdcnd has any other value, bdb is
|
|
195
|
+
! a dummy variable.
|
|
196
|
+
!
|
|
197
|
+
! c, d
|
|
198
|
+
! the range of phi (longitude),
|
|
199
|
+
! i.e. c <= phi <= d.
|
|
200
|
+
! c must be less than d. if d-c = 2*pi,
|
|
201
|
+
! periodic boundary conditions are usually
|
|
202
|
+
! usually prescribed.
|
|
203
|
+
!
|
|
204
|
+
! n
|
|
205
|
+
! the number of unknowns in the interval
|
|
206
|
+
! (c, d). the unknowns in the phi-direction
|
|
207
|
+
! are given by phi(j) = c + (j-HALF)dphi,
|
|
208
|
+
! j=1, 2, ..., n, where dphi = (d-c)/n.
|
|
209
|
+
! n must be greater than 2.
|
|
210
|
+
!
|
|
211
|
+
! nbdcnd
|
|
212
|
+
! indicates the type of boundary conditions
|
|
213
|
+
! at phi = c and phi = d.
|
|
214
|
+
!
|
|
215
|
+
! = 0 if the solution is periodic in phi,
|
|
216
|
+
! i.e. u(i, j) = u(i, n+j).
|
|
217
|
+
!
|
|
218
|
+
! = 1 if the solution is specified at
|
|
219
|
+
! phi = c and phi = d
|
|
220
|
+
! (see note below).
|
|
221
|
+
!
|
|
222
|
+
! = 2 if the solution is specified at
|
|
223
|
+
! phi = c and the derivative of the
|
|
224
|
+
! solution with respect to phi is
|
|
225
|
+
! specified at phi = d
|
|
226
|
+
! (see note below).
|
|
227
|
+
!
|
|
228
|
+
! = 3 if the derivative of the solution
|
|
229
|
+
! with respect to phi is specified
|
|
230
|
+
! at phi = c and phi = d.
|
|
231
|
+
!
|
|
232
|
+
! = 4 if the derivative of the solution
|
|
233
|
+
! with respect to phi is specified
|
|
234
|
+
! at phi = c and the solution is
|
|
235
|
+
! specified at phi = d
|
|
236
|
+
! (see note below).
|
|
237
|
+
!
|
|
238
|
+
! note:
|
|
239
|
+
! when nbdcnd = 1, 2, or 4, do not use
|
|
240
|
+
! mbdcnd = 5, 6, 7, 8, or 9
|
|
241
|
+
! (the former indicates that the solution
|
|
242
|
+
! is specified at a pole; the latter
|
|
243
|
+
! indicates the solution is unspecified).
|
|
244
|
+
! use instead mbdcnd = 1 or 2.
|
|
245
|
+
!
|
|
246
|
+
! bdc
|
|
247
|
+
! a one dimensional array of length m that
|
|
248
|
+
! specifies the boundary values of the
|
|
249
|
+
! solution at phi = c.
|
|
250
|
+
!
|
|
251
|
+
! when nbdcnd = 1 or 2,
|
|
252
|
+
! bdc(i) = u(theta(i), c) , i=1, 2, ..., m.
|
|
253
|
+
!
|
|
254
|
+
! when nbdcnd = 3 or 4,
|
|
255
|
+
! bdc(i) = (d/dphi)u(theta(i), c),
|
|
256
|
+
! i=1, 2, ..., m.
|
|
257
|
+
!
|
|
258
|
+
! when nbdcnd = 0, bdc is a dummy variable.
|
|
259
|
+
!
|
|
260
|
+
! bdd
|
|
261
|
+
! a one-dimensional array of length m that
|
|
262
|
+
! specifies the boundary values of the
|
|
263
|
+
! solution at phi = d.
|
|
264
|
+
!
|
|
265
|
+
! when nbdcnd = 1 or 4,
|
|
266
|
+
! bdd(i) = u(theta(i), d) , i=1, 2, ..., m.
|
|
267
|
+
!
|
|
268
|
+
! when nbdcnd = 2 or 3,
|
|
269
|
+
! bdd(i) = (d/dphi)u(theta(i), d) ,
|
|
270
|
+
! i=1, 2, ..., m.
|
|
271
|
+
!
|
|
272
|
+
! when nbdcnd = 0, bdd is a dummy variable.
|
|
273
|
+
!
|
|
274
|
+
! elmbda
|
|
275
|
+
! the constant lambda in the helmholtz
|
|
276
|
+
! equation. if lambda is greater than 0,
|
|
277
|
+
! a solution may not exist. however,
|
|
278
|
+
! hstssp will attempt to find a solution.
|
|
279
|
+
!
|
|
280
|
+
! f
|
|
281
|
+
! a two-dimensional array that specifies
|
|
282
|
+
! the values of the right side of the
|
|
283
|
+
! helmholtz equation.
|
|
284
|
+
! for i=1, 2, ..., m and j=1, 2, ..., n
|
|
285
|
+
!
|
|
286
|
+
! f(i, j) = f(theta(i), phi(j)) .
|
|
287
|
+
!
|
|
288
|
+
! f must be dimensioned at least m x n.
|
|
289
|
+
!
|
|
290
|
+
! idimf
|
|
291
|
+
! the row (or first) dimension of the array
|
|
292
|
+
! f as it appears in the program calling
|
|
293
|
+
! hstssp. this parameter is used to specify
|
|
294
|
+
! the variable dimension of f.
|
|
295
|
+
! idimf must be at least m.
|
|
296
|
+
!
|
|
297
|
+
!
|
|
298
|
+
! ON OUTPUT f
|
|
299
|
+
! contains the solution u(i, j) of the finite
|
|
300
|
+
! difference approximation for the grid point
|
|
301
|
+
! (theta(i), phi(j)) for
|
|
302
|
+
! i=1, 2, ..., m, j=1, 2, ..., n.
|
|
303
|
+
!
|
|
304
|
+
! pertrb
|
|
305
|
+
! if a combination of periodic, derivative,
|
|
306
|
+
! or unspecified boundary conditions is
|
|
307
|
+
! specified for a poisson equation
|
|
308
|
+
! (lambda = 0), a solution may not exist.
|
|
309
|
+
! pertrb is a constant, calculated and
|
|
310
|
+
! subtracted from f, which ensures that a
|
|
311
|
+
! solution exists. hstssp then computes
|
|
312
|
+
! this solution, which is a least squares
|
|
313
|
+
! solution to the original approximation.
|
|
314
|
+
! this solution plus any constant is also
|
|
315
|
+
! a solution; hence, the solution is not
|
|
316
|
+
! unique. the value of pertrb should be
|
|
317
|
+
! small compared to the right side f.
|
|
318
|
+
! otherwise, a solution is obtained to an
|
|
319
|
+
! essentially different problem.
|
|
320
|
+
! this comparison should always be made to
|
|
321
|
+
! insure that a meaningful solution has been
|
|
322
|
+
! obtained.
|
|
323
|
+
!
|
|
324
|
+
! ierror
|
|
325
|
+
! an error flag that indicates invalid input
|
|
326
|
+
! parameters. except to numbers 0 and 14,
|
|
327
|
+
! a solution is not attempted.
|
|
328
|
+
!
|
|
329
|
+
! = 0 no error
|
|
330
|
+
!
|
|
331
|
+
! = 1 a < 0 or b > pi
|
|
332
|
+
!
|
|
333
|
+
! = 2 a >= b
|
|
334
|
+
!
|
|
335
|
+
! = 3 mbdcnd < 1 or mbdcnd > 9
|
|
336
|
+
!
|
|
337
|
+
! = 4 c >= d
|
|
338
|
+
!
|
|
339
|
+
! = 5 n <= 2
|
|
340
|
+
!
|
|
341
|
+
! = 6 nbdcnd < 0 or nbdcnd > 4
|
|
342
|
+
!
|
|
343
|
+
! = 7 a > 0 and mbdcnd = 5, 6, or 9
|
|
344
|
+
!
|
|
345
|
+
! = 8 a = 0 and mbdcnd = 3, 4, or 8
|
|
346
|
+
!
|
|
347
|
+
! = 9 b < pi and mbdcnd >= 7
|
|
348
|
+
!
|
|
349
|
+
! = 10 b = pi and mbdcnd = 2, 3, or 6
|
|
350
|
+
!
|
|
351
|
+
! = 11 mbdcnd >= 5 and ndbcnd = 1, 2, or 4
|
|
352
|
+
!
|
|
353
|
+
! = 12 idimf < m
|
|
354
|
+
!
|
|
355
|
+
! = 13 m <= 2
|
|
356
|
+
!
|
|
357
|
+
! = 14 lambda > 0
|
|
358
|
+
!
|
|
359
|
+
! = 20 if the dynamic allocation of real and
|
|
360
|
+
! complex workspace required for solution
|
|
361
|
+
! fails (for example if n, m are too large
|
|
362
|
+
! for your computer)
|
|
363
|
+
!
|
|
364
|
+
! since this is the only means of indicating
|
|
365
|
+
! a possibly incorrect call to hstssp, the
|
|
366
|
+
! user should test ierror after the call.
|
|
367
|
+
!
|
|
368
|
+
! I/O None
|
|
369
|
+
!
|
|
370
|
+
! PRECISION 64-bit double precision
|
|
371
|
+
!
|
|
372
|
+
! REQUIRED FILES type_FishpackWorkspace.f90, genbun.f90, type_CyclicReductionUtility.f9090, poistg.f90
|
|
373
|
+
!
|
|
374
|
+
! HISTORY * Written by Roland Sweet at NCAR in 1977.
|
|
375
|
+
! released on NCAR's public software libraries
|
|
376
|
+
! in January 1980.
|
|
377
|
+
! * Revised in June 2004 by John Adams using
|
|
378
|
+
! Fortran 90 dynamically allocated workspace.
|
|
379
|
+
!
|
|
380
|
+
! PORTABILITY Fortran 2008
|
|
381
|
+
!
|
|
382
|
+
! ALGORITHM This subroutine defines the finite-
|
|
383
|
+
! difference equations, incorporates boundary
|
|
384
|
+
! data, adjusts the right side when the system
|
|
385
|
+
! is singular and calls either poistg or genbun
|
|
386
|
+
! which solves the linear system of equations.
|
|
387
|
+
!
|
|
388
|
+
! TIMING For large m and n, the operation count
|
|
389
|
+
! is roughly proportional to m*n*log2(n).
|
|
390
|
+
!
|
|
391
|
+
! ACCURACY The solution process employed results in
|
|
392
|
+
! a loss of no more than four significant
|
|
393
|
+
! digits for n and m as large as 64.
|
|
394
|
+
! more detailed information about accuracy
|
|
395
|
+
! can be found in the documentation for
|
|
396
|
+
! routine poistg which is the routine that
|
|
397
|
+
! actually solves the finite difference
|
|
398
|
+
! equations.
|
|
399
|
+
!
|
|
400
|
+
! REFERENCES U. Schumann and R. Sweet, "A direct method
|
|
401
|
+
! for the solution of poisson's equation with
|
|
402
|
+
! neumann boundary conditions on a staggered
|
|
403
|
+
! grid of arbitrary size, " J. Comp. Phys.
|
|
404
|
+
! 20(1976), pp. 171-182.
|
|
405
|
+
!
|
|
406
|
+
submodule(staggered_helmholtz_solvers) staggered_spherical_solver
|
|
407
|
+
|
|
408
|
+
contains
|
|
409
|
+
|
|
410
|
+
module subroutine hstssp(a, b, m, mbdcnd, bda, bdb, c, d, n, nbdcnd, bdc, &
|
|
411
|
+
bdd, elmbda, f, idimf, pertrb, ierror)
|
|
412
|
+
|
|
413
|
+
! Dummy arguments
|
|
414
|
+
|
|
415
|
+
integer(ip), intent(in) :: m
|
|
416
|
+
integer(ip), intent(in) :: mbdcnd
|
|
417
|
+
integer(ip), intent(in) :: n
|
|
418
|
+
integer(ip), intent(in) :: nbdcnd
|
|
419
|
+
integer(ip), intent(in) :: idimf
|
|
420
|
+
integer(ip), intent(out) :: ierror
|
|
421
|
+
real(wp), intent(in) :: a
|
|
422
|
+
real(wp), intent(in) :: b
|
|
423
|
+
real(wp), intent(in) :: c
|
|
424
|
+
real(wp), intent(in) :: d
|
|
425
|
+
real(wp), intent(in) :: elmbda
|
|
426
|
+
real(wp), intent(out) :: pertrb
|
|
427
|
+
real(wp), intent(in) :: bda(:)
|
|
428
|
+
real(wp), intent(in) :: bdb(:)
|
|
429
|
+
real(wp), intent(in) :: bdc(:)
|
|
430
|
+
real(wp), intent(in) :: bdd(:)
|
|
431
|
+
real(wp), intent(inout) :: f(:,:)
|
|
432
|
+
|
|
433
|
+
! Local variables
|
|
434
|
+
|
|
435
|
+
type(FishpackWorkspace) :: workspace
|
|
436
|
+
|
|
437
|
+
|
|
438
|
+
! Check input arguments
|
|
439
|
+
call hstssp_check_input_arguments(a, b, m, mbdcnd, c, d, n, nbdcnd, idimf, ierror)
|
|
440
|
+
|
|
441
|
+
if (ierror /= 0) return
|
|
442
|
+
|
|
443
|
+
! Allocate memory
|
|
444
|
+
call workspace%initialize_staggered_workspace(n, m)
|
|
445
|
+
|
|
446
|
+
! Solve system
|
|
447
|
+
associate( rew => workspace%real_workspace )
|
|
448
|
+
call hstssp_lower_routine(a, b, m, mbdcnd, bda, bdb, c, d, n, &
|
|
449
|
+
nbdcnd, bdc, bdd, elmbda, f, idimf, pertrb, ierror, rew)
|
|
450
|
+
end associate
|
|
451
|
+
|
|
452
|
+
! Release memory
|
|
453
|
+
call workspace%destroy()
|
|
454
|
+
|
|
455
|
+
end subroutine hstssp
|
|
456
|
+
|
|
457
|
+
pure subroutine hstssp_check_input_arguments(a, b, m, mbdcnd, c, d, n, nbdcnd, idimf, ierror)
|
|
458
|
+
|
|
459
|
+
! Dummy arguments
|
|
460
|
+
|
|
461
|
+
integer(ip), intent(in) :: m
|
|
462
|
+
integer(ip), intent(in) :: mbdcnd
|
|
463
|
+
integer(ip), intent(in) :: n
|
|
464
|
+
integer(ip), intent(in) :: nbdcnd
|
|
465
|
+
integer(ip), intent(in) :: idimf
|
|
466
|
+
integer(ip), intent(out) :: ierror
|
|
467
|
+
real(wp), intent(in) :: a
|
|
468
|
+
real(wp), intent(in) :: b
|
|
469
|
+
real(wp), intent(in) :: c
|
|
470
|
+
real(wp), intent(in) :: d
|
|
471
|
+
|
|
472
|
+
|
|
473
|
+
! Check input arguments
|
|
474
|
+
if (a < ZERO .or. b > PI) then
|
|
475
|
+
ierror = 1
|
|
476
|
+
return
|
|
477
|
+
else if (a >= b) then
|
|
478
|
+
ierror = 2
|
|
479
|
+
return
|
|
480
|
+
else if (mbdcnd <= 0 .or. mbdcnd > 9) then
|
|
481
|
+
ierror = 3
|
|
482
|
+
return
|
|
483
|
+
else if (c >= d) then
|
|
484
|
+
ierror = 4
|
|
485
|
+
return
|
|
486
|
+
else if (3 > n) then
|
|
487
|
+
ierror = 5
|
|
488
|
+
return
|
|
489
|
+
else if (nbdcnd < 0 .or. nbdcnd >= 5) then
|
|
490
|
+
ierror = 6
|
|
491
|
+
return
|
|
492
|
+
else if (a > ZERO) then
|
|
493
|
+
select case (mbdcnd)
|
|
494
|
+
case (5:6,9)
|
|
495
|
+
ierror = 7
|
|
496
|
+
return
|
|
497
|
+
end select
|
|
498
|
+
else if (a == ZERO) then
|
|
499
|
+
select case (mbdcnd)
|
|
500
|
+
case (3:4, 8)
|
|
501
|
+
ierror=8
|
|
502
|
+
return
|
|
503
|
+
end select
|
|
504
|
+
else if (b < PI .and. mbdcnd >= 7) then
|
|
505
|
+
ierror = 9
|
|
506
|
+
else if (b == PI) then
|
|
507
|
+
select case (mbdcnd)
|
|
508
|
+
case (2:3, 6)
|
|
509
|
+
ierror = 10
|
|
510
|
+
return
|
|
511
|
+
end select
|
|
512
|
+
else if (mbdcnd >= 5) then
|
|
513
|
+
select case (nbdcnd)
|
|
514
|
+
case (1:2, 4)
|
|
515
|
+
ierror = 11
|
|
516
|
+
return
|
|
517
|
+
end select
|
|
518
|
+
else if (idimf < m) then
|
|
519
|
+
ierror = 12
|
|
520
|
+
return
|
|
521
|
+
else if (3 > m) then
|
|
522
|
+
ierror = 13
|
|
523
|
+
return
|
|
524
|
+
else
|
|
525
|
+
ierror = 0
|
|
526
|
+
end if
|
|
527
|
+
|
|
528
|
+
end subroutine hstssp_check_input_arguments
|
|
529
|
+
|
|
530
|
+
subroutine hstssp_lower_routine(a, b, m, mbdcnd, bda, bdb, c, d, n, nbdcnd, bdc, &
|
|
531
|
+
bdd, elmbda, f, idimf, pertrb, ierror, w)
|
|
532
|
+
|
|
533
|
+
! Dummy arguments
|
|
534
|
+
integer(ip), intent(in) :: m
|
|
535
|
+
integer(ip), intent(in) :: mbdcnd
|
|
536
|
+
integer(ip), intent(in) :: n
|
|
537
|
+
integer(ip), intent(in) :: nbdcnd
|
|
538
|
+
integer(ip), intent(in) :: idimf
|
|
539
|
+
integer(ip), intent(out) :: ierror
|
|
540
|
+
real(wp), intent(in) :: a
|
|
541
|
+
real(wp), intent(in) :: b
|
|
542
|
+
real(wp), intent(in) :: c
|
|
543
|
+
real(wp), intent(in) :: d
|
|
544
|
+
real(wp), intent(in) :: elmbda
|
|
545
|
+
real(wp), intent(out) :: pertrb
|
|
546
|
+
real(wp), intent(in) :: bda(:)
|
|
547
|
+
real(wp), intent(in) :: bdb(:)
|
|
548
|
+
real(wp), intent(in) :: bdc(:)
|
|
549
|
+
real(wp), intent(in) :: bdd(:)
|
|
550
|
+
real(wp), intent(inout) :: f(:,:)
|
|
551
|
+
real(wp), intent(out) :: w(:)
|
|
552
|
+
|
|
553
|
+
! Local variables
|
|
554
|
+
integer(ip) :: np, isw, jsw, mb, iwb, iwc, iwr, iws
|
|
555
|
+
integer(ip) :: i, j, mm1, lp, local_error_flag
|
|
556
|
+
real(wp) :: dr, dr2, dth, dth2, a1, a2, a3
|
|
557
|
+
type(CenteredCyclicReductionUtility) :: centered_util
|
|
558
|
+
type(StaggeredCyclicReductionUtility) :: staggered_util
|
|
559
|
+
|
|
560
|
+
dr = (b - a)/m
|
|
561
|
+
dr2 = dr**2
|
|
562
|
+
dth = (d - c)/n
|
|
563
|
+
dth2 = dth**2
|
|
564
|
+
np = nbdcnd + 1
|
|
565
|
+
isw = 1
|
|
566
|
+
jsw = 1
|
|
567
|
+
mb = mbdcnd
|
|
568
|
+
|
|
569
|
+
if (elmbda == ZERO) then
|
|
570
|
+
case_construct: select case (mbdcnd)
|
|
571
|
+
case (1, 5, 7)
|
|
572
|
+
if (a /= ZERO .or. b /= PI) exit case_construct
|
|
573
|
+
mb = 9
|
|
574
|
+
jsw = 2
|
|
575
|
+
case (2)
|
|
576
|
+
if (a /= ZERO) exit case_construct
|
|
577
|
+
mb = 6
|
|
578
|
+
jsw = 2
|
|
579
|
+
case (4)
|
|
580
|
+
if (b /= PI) exit case_construct
|
|
581
|
+
mb = 8
|
|
582
|
+
jsw = 2
|
|
583
|
+
end select case_construct
|
|
584
|
+
end if
|
|
585
|
+
|
|
586
|
+
iwb = m
|
|
587
|
+
iwc = iwb + m
|
|
588
|
+
iwr = iwc + m
|
|
589
|
+
iws = iwr + m
|
|
590
|
+
|
|
591
|
+
do i = 1, m
|
|
592
|
+
j = iwr + i
|
|
593
|
+
w(j) = sin(a + (real(i, kind=wp) - HALF)*dr)
|
|
594
|
+
w(i) = sin(a + real(i - 1, kind=wp)*dr)/dr2
|
|
595
|
+
end do
|
|
596
|
+
|
|
597
|
+
mm1 = m - 1
|
|
598
|
+
w(iwc+1:mm1+iwc) = w(2:mm1+1)
|
|
599
|
+
w(iwb+1:mm1+iwb) = elmbda*w(iwr+1:mm1+iwr) - (w(:mm1)+w(2:mm1+1))
|
|
600
|
+
w(iwr) = sin(b)/dr2
|
|
601
|
+
w(iwc) = elmbda*w(iws) - (w(m)+w(iwr))
|
|
602
|
+
|
|
603
|
+
do i = 1, m
|
|
604
|
+
j = iwr + i
|
|
605
|
+
a1 = w(j)
|
|
606
|
+
f(i,:n) = a1*f(i,:n)
|
|
607
|
+
end do
|
|
608
|
+
|
|
609
|
+
!
|
|
610
|
+
! enter boundary data for theta-boundaries.
|
|
611
|
+
!
|
|
612
|
+
select case (mb)
|
|
613
|
+
case (1:2, 7)
|
|
614
|
+
a1 = TWO*w(1)
|
|
615
|
+
w(iwb+1) = w(iwb+1) - w(1)
|
|
616
|
+
f(1,:n) = f(1,:n) - a1*bda(:n)
|
|
617
|
+
case (3:4, 8)
|
|
618
|
+
a1 = dr*w(1)
|
|
619
|
+
w(iwb+1) = w(iwb+1) + w(1)
|
|
620
|
+
f(1,:n) = f(1,:n) + a1*bda(:n)
|
|
621
|
+
end select
|
|
622
|
+
|
|
623
|
+
select case (mb)
|
|
624
|
+
case (1, 4:5)
|
|
625
|
+
a1 = TWO*w(iwr)
|
|
626
|
+
w(iwc) = w(iwc) - w(iwr)
|
|
627
|
+
f(m,:n) = f(m,:n) - a1*bdb(:n)
|
|
628
|
+
case (2:3, 6)
|
|
629
|
+
a1 = dr*w(iwr)
|
|
630
|
+
w(iwc) = w(iwc) + w(iwr)
|
|
631
|
+
f(m,:n) = f(m,:n) - a1*bdb(:n)
|
|
632
|
+
end select
|
|
633
|
+
|
|
634
|
+
!
|
|
635
|
+
! Enter boundary data for phi-boundaries.
|
|
636
|
+
!
|
|
637
|
+
a1 = TWO/dth2
|
|
638
|
+
|
|
639
|
+
if (np /= 1) then
|
|
640
|
+
select case (np)
|
|
641
|
+
case (2:3)
|
|
642
|
+
f(:m, 1) = f(:m, 1) - a1*bdc(:m)/w(iwr+1:m+iwr)
|
|
643
|
+
case (4:5)
|
|
644
|
+
a1 = ONE/dth
|
|
645
|
+
f(:m, 1) = f(:m, 1) + a1*bdc(:m)/w(iwr+1:m+iwr)
|
|
646
|
+
end select
|
|
647
|
+
|
|
648
|
+
a1 = TWO/dth2
|
|
649
|
+
|
|
650
|
+
select case (np)
|
|
651
|
+
case (2, 5)
|
|
652
|
+
f(:m, n) = f(:m, n) - a1*bdd(:m)/w(iwr+1:m+iwr)
|
|
653
|
+
case (3:4)
|
|
654
|
+
a1 = ONE/dth
|
|
655
|
+
f(:m, n) = f(:m, n) - a1*bdd(:m)/w(iwr+1:m+iwr)
|
|
656
|
+
end select
|
|
657
|
+
end if
|
|
658
|
+
|
|
659
|
+
pertrb = ZERO
|
|
660
|
+
|
|
661
|
+
if_construct: if (elmbda >= ZERO) then
|
|
662
|
+
if (elmbda /= ZERO) then
|
|
663
|
+
ierror = 14
|
|
664
|
+
else
|
|
665
|
+
select case (mb)
|
|
666
|
+
case (1:2, 4:5, 7)
|
|
667
|
+
exit if_construct
|
|
668
|
+
end select
|
|
669
|
+
|
|
670
|
+
select case (np)
|
|
671
|
+
case (2:3, 5)
|
|
672
|
+
exit if_construct
|
|
673
|
+
end select
|
|
674
|
+
|
|
675
|
+
isw = 2
|
|
676
|
+
pertrb = pertrb + sum(f(:m,1:n))
|
|
677
|
+
|
|
678
|
+
a1 = real(n, kind=wp)*(cos(a) - cos(b))/(TWO*sin(HALF*dr))
|
|
679
|
+
pertrb = pertrb/a1
|
|
680
|
+
do i = 1, m
|
|
681
|
+
j = iwr + i
|
|
682
|
+
a1 = pertrb*w(j)
|
|
683
|
+
f(i,:n) = f(i,:n) - a1
|
|
684
|
+
end do
|
|
685
|
+
a2 = sum(f(1,:n))
|
|
686
|
+
a3 = sum(f(m,:n))
|
|
687
|
+
a2 = a2/w(iwr+1)
|
|
688
|
+
a3 = a3/w(iws)
|
|
689
|
+
end if
|
|
690
|
+
end if if_construct
|
|
691
|
+
|
|
692
|
+
do i = 1, m
|
|
693
|
+
j = iwr + i
|
|
694
|
+
a1 = dth2*w(j)
|
|
695
|
+
w(i) = a1*w(i)
|
|
696
|
+
j = iwc + i
|
|
697
|
+
w(j) = a1*w(j)
|
|
698
|
+
j = iwb + i
|
|
699
|
+
w(j) = a1*w(j)
|
|
700
|
+
f(i,:n) = a1*f(i,:n)
|
|
701
|
+
end do
|
|
702
|
+
|
|
703
|
+
lp = nbdcnd
|
|
704
|
+
w(1) = ZERO
|
|
705
|
+
w(iwr) = ZERO
|
|
706
|
+
!
|
|
707
|
+
! call poistg or genbun to solve the system of equations.
|
|
708
|
+
!
|
|
709
|
+
local_error_flag = 0
|
|
710
|
+
|
|
711
|
+
associate( &
|
|
712
|
+
iw0 => 1, &
|
|
713
|
+
iw1 => iwb + 1, &
|
|
714
|
+
iw2 => iwc + 1, &
|
|
715
|
+
iw3 => iwr + 1 &
|
|
716
|
+
)
|
|
717
|
+
|
|
718
|
+
if (nbdcnd /= 0) then
|
|
719
|
+
|
|
720
|
+
! Invoke poistg_lower_routine solver
|
|
721
|
+
call staggered_util%poistg_lower_routine(lp, n, iw0, m, w, w(iw1:), w(iw2:), idimf, f, local_error_flag, w(iw3:))
|
|
722
|
+
|
|
723
|
+
! Check error flag
|
|
724
|
+
if (local_error_flag /= 0) then
|
|
725
|
+
error stop 'fishpack library: poistg_lower_routine call failed in hstssp_lower_routine'
|
|
726
|
+
end if
|
|
727
|
+
else
|
|
728
|
+
|
|
729
|
+
! Invoke genbun_lower_routine solver
|
|
730
|
+
call centered_util%genbun_lower_routine(lp, n, iw0, m, w, w(iw1:), w(iw2:), idimf, f, local_error_flag, w(iw3:))
|
|
731
|
+
|
|
732
|
+
! Check error flag
|
|
733
|
+
if (local_error_flag /= 0) then
|
|
734
|
+
error stop 'fishpack library: genbun_lower_routine call failed in hstssp_lower_routine'
|
|
735
|
+
end if
|
|
736
|
+
end if
|
|
737
|
+
|
|
738
|
+
end associate
|
|
739
|
+
|
|
740
|
+
|
|
741
|
+
if (isw == 2 .and. jsw == 2) then
|
|
742
|
+
if (mb == 8) then
|
|
743
|
+
a1 = sum(f(m,:n))
|
|
744
|
+
a1 = (a1 - dr2*a3/16)/n
|
|
745
|
+
if (nbdcnd == 3) a1 = a1 + (bdd(m)-bdc(m))/(d - c)
|
|
746
|
+
a1 = bdb(1) - a1
|
|
747
|
+
else
|
|
748
|
+
a1 = sum(f(1,:n))
|
|
749
|
+
a1 = (a1 - dr2*a2/16)/n
|
|
750
|
+
if (nbdcnd == 3) a1 = a1 + (bdd(1)-bdc(1))/(d - c)
|
|
751
|
+
a1 = bda(1) - a1
|
|
752
|
+
end if
|
|
753
|
+
f(:m,:n) = f(:m,:n) + a1
|
|
754
|
+
end if
|
|
755
|
+
|
|
756
|
+
end subroutine hstssp_lower_routine
|
|
757
|
+
|
|
758
|
+
end submodule staggered_spherical_solver
|