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,908 @@
|
|
|
1
|
+
!
|
|
2
|
+
! file hstcsp.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 hstcsp(intl, a, b, m, mbdcnd, bda, bdb, c, d, n, nbdcnd, bdc,
|
|
37
|
+
! bdd, elmbda, f, idimf, pertrb, ierror, w)
|
|
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
|
|
47
|
+
! grid to the modified helmholtz equation in
|
|
48
|
+
! spherical coordinates assuming axisymmetry
|
|
49
|
+
! (no dependence on longitude).
|
|
50
|
+
!
|
|
51
|
+
! the equation is
|
|
52
|
+
!
|
|
53
|
+
! (1/r**2)(d/dr)(r**2(du/dr)) +
|
|
54
|
+
! 1/(r**2*sin(theta))(d/dtheta)
|
|
55
|
+
! (sin(theta)(du/dtheta)) +
|
|
56
|
+
! (lambda/(r*sin(theta))**2)u = f(theta, r)
|
|
57
|
+
!
|
|
58
|
+
! where theta is colatitude and r is the
|
|
59
|
+
! radial coordinate. this two-dimensional
|
|
60
|
+
! modified helmholtz equation results from
|
|
61
|
+
! the fourier transform of the three-
|
|
62
|
+
! dimensional poisson equation.
|
|
63
|
+
!
|
|
64
|
+
!
|
|
65
|
+
! USAGE call hstcsp(intl, a, b, m, mbdcnd, bda, bdb, c, d, n,
|
|
66
|
+
! nbdcnd, bdc, bdd, elmbda, f, idimf,
|
|
67
|
+
! pertrb, ierror, w)
|
|
68
|
+
!
|
|
69
|
+
! ARGUMENTS
|
|
70
|
+
! ON INPUT intl
|
|
71
|
+
!
|
|
72
|
+
! = 0 on initial entry to hstcsp or if any
|
|
73
|
+
! of the arguments c, d, n, or nbdcnd
|
|
74
|
+
! are changed from a previous call
|
|
75
|
+
!
|
|
76
|
+
! = 1 if c, d, n, and nbdcnd are all
|
|
77
|
+
! unchanged from previous call to hstcsp
|
|
78
|
+
!
|
|
79
|
+
! note:
|
|
80
|
+
! a call with intl = 0 takes approximately
|
|
81
|
+
! 1.5 times as much time as a call with
|
|
82
|
+
! intl = 1. once a call with intl = 0
|
|
83
|
+
! has been made then subsequent solutions
|
|
84
|
+
! corresponding to different f, bda, bdb,
|
|
85
|
+
! bdc, and bdd can be obtained faster with
|
|
86
|
+
! intl = 1 since initialization is not
|
|
87
|
+
! repeated.
|
|
88
|
+
!
|
|
89
|
+
! a, b
|
|
90
|
+
! the range of theta (colatitude),
|
|
91
|
+
! i.e. a <= theta <= b. a
|
|
92
|
+
! must be less than b and a must be
|
|
93
|
+
! non-negative. a and b are in radians.
|
|
94
|
+
! a = 0 corresponds to the north pole and
|
|
95
|
+
! b = pi corresponds to the south pole.
|
|
96
|
+
!
|
|
97
|
+
! * * * important * * *
|
|
98
|
+
!
|
|
99
|
+
! if b is equal to pi, then b must be
|
|
100
|
+
! computed using the statement
|
|
101
|
+
! b = pi_mach(dum)
|
|
102
|
+
! this insures that b in the user's program
|
|
103
|
+
! is equal to pi in this program, permitting
|
|
104
|
+
! several tests of the input parameters that
|
|
105
|
+
! otherwise would not be possible.
|
|
106
|
+
!
|
|
107
|
+
! * * * * * * * * * * * *
|
|
108
|
+
!
|
|
109
|
+
! m
|
|
110
|
+
! the number of grid points in the interval
|
|
111
|
+
! (a, b). the grid points in the theta-
|
|
112
|
+
! direction are given by
|
|
113
|
+
! theta(i) = a + (i-0.5)dtheta
|
|
114
|
+
! for i=1, 2, ..., m where dtheta =(b-a)/m.
|
|
115
|
+
! m must be greater than 4.
|
|
116
|
+
!
|
|
117
|
+
! mbdcnd
|
|
118
|
+
! indicates the type of boundary conditions
|
|
119
|
+
! at theta = a and theta = b.
|
|
120
|
+
!
|
|
121
|
+
! = 1 if the solution is specified at
|
|
122
|
+
! theta = a and theta = b.
|
|
123
|
+
! (see notes 1, 2 below)
|
|
124
|
+
!
|
|
125
|
+
! = 2 if the solution is specified at
|
|
126
|
+
! theta = a and the derivative of the
|
|
127
|
+
! solution with respect to theta is
|
|
128
|
+
! specified at theta = b
|
|
129
|
+
! (see notes 1, 2 below).
|
|
130
|
+
!
|
|
131
|
+
! = 3 if the derivative of the solution
|
|
132
|
+
! with respect to theta is specified
|
|
133
|
+
! at theta = a (see notes 1, 2 below)
|
|
134
|
+
! and theta = b.
|
|
135
|
+
!
|
|
136
|
+
! = 4 if the derivative of the solution
|
|
137
|
+
! with respect to theta is specified at
|
|
138
|
+
! theta = a (see notes 1, 2 below) and
|
|
139
|
+
! the solution is specified at theta = b.
|
|
140
|
+
!
|
|
141
|
+
! = 5 if the solution is unspecified at
|
|
142
|
+
! theta = a = 0 and the solution is
|
|
143
|
+
! specified at theta = b.
|
|
144
|
+
! (see note 2 below)
|
|
145
|
+
!
|
|
146
|
+
! = 6 if the solution is unspecified at
|
|
147
|
+
! theta = a = 0 and the derivative of
|
|
148
|
+
! the solution with respect to theta is
|
|
149
|
+
! specified at theta = b
|
|
150
|
+
! (see note 2 below).
|
|
151
|
+
!
|
|
152
|
+
! = 7 if the solution is specified at
|
|
153
|
+
! theta = a and the solution is
|
|
154
|
+
! unspecified at theta = b = pi.
|
|
155
|
+
!
|
|
156
|
+
! = 8 if the derivative of the solution
|
|
157
|
+
! with respect to theta is specified at
|
|
158
|
+
! theta = a (see note 1 below)
|
|
159
|
+
! and the solution is unspecified at
|
|
160
|
+
! theta = b = pi.
|
|
161
|
+
!
|
|
162
|
+
! = 9 if the solution is unspecified at
|
|
163
|
+
! theta = a = 0 and theta = b = pi.
|
|
164
|
+
!
|
|
165
|
+
! note 1:
|
|
166
|
+
! if a = 0, do not use mbdcnd = 1, 2, 3, 4, 7
|
|
167
|
+
! or 8, but instead use mbdcnd = 5, 6, or 9.
|
|
168
|
+
!
|
|
169
|
+
! note 2:
|
|
170
|
+
! if b = pi, do not use mbdcnd = 1, 2, 3, 4, 5,
|
|
171
|
+
! or 6, but instead use mbdcnd = 7, 8, or 9.
|
|
172
|
+
!
|
|
173
|
+
! note 3:
|
|
174
|
+
! when a = 0 and/or b = pi the only
|
|
175
|
+
! meaningful boundary condition is
|
|
176
|
+
! du/dtheta = 0. see d. greenspan,
|
|
177
|
+
! 'numerical analysis of elliptic
|
|
178
|
+
! boundary value problems, '
|
|
179
|
+
! harper and row, 1965, chapter 5.)
|
|
180
|
+
!
|
|
181
|
+
! bda
|
|
182
|
+
! a one-dimensional array of length n that
|
|
183
|
+
! specifies the boundary values (if any) of
|
|
184
|
+
! the solution at theta = a.
|
|
185
|
+
!
|
|
186
|
+
! when mbdcnd = 1, 2, or 7,
|
|
187
|
+
! bda(j) = u(a, r(j)), j=1, 2, ..., n.
|
|
188
|
+
!
|
|
189
|
+
! when mbdcnd = 3, 4, or 8,
|
|
190
|
+
! bda(j) = (d/dtheta)u(a, r(j)), j=1, 2, ..., n.
|
|
191
|
+
!
|
|
192
|
+
! when mbdcnd has any other value, bda is a
|
|
193
|
+
! dummy variable.
|
|
194
|
+
!
|
|
195
|
+
! bdb
|
|
196
|
+
! a one-dimensional array of length n that
|
|
197
|
+
! specifies the boundary values of the
|
|
198
|
+
! solution at theta = b.
|
|
199
|
+
!
|
|
200
|
+
! when mbdcnd = 1, 4, or 5,
|
|
201
|
+
! bdb(j) = u(b, r(j)), j=1, 2, ..., n.
|
|
202
|
+
!
|
|
203
|
+
! when mbdcnd = 2, 3, or 6,
|
|
204
|
+
! bdb(j) = (d/dtheta)u(b, r(j)), j=1, 2, ..., n.
|
|
205
|
+
!
|
|
206
|
+
! when mbdcnd has any other value, bdb is
|
|
207
|
+
! a dummy variable.
|
|
208
|
+
!
|
|
209
|
+
! c, d
|
|
210
|
+
! the range of r , i.e. c <= r <= d.
|
|
211
|
+
! c must be less than d and non-negative.
|
|
212
|
+
!
|
|
213
|
+
! n
|
|
214
|
+
! the number of unknowns in the interval
|
|
215
|
+
! (c, d). the unknowns in the r-direction
|
|
216
|
+
! are given by r(j) = c + (j-0.5)dr,
|
|
217
|
+
! j=1, 2, ..., n, where dr = (d-c)/n.
|
|
218
|
+
! n must be greater than 4.
|
|
219
|
+
!
|
|
220
|
+
! nbdcnd
|
|
221
|
+
! indicates the type of boundary conditions
|
|
222
|
+
! at r = c and r = d.
|
|
223
|
+
!
|
|
224
|
+
!
|
|
225
|
+
! = 1 if the solution is specified at
|
|
226
|
+
! r = c and r = d.
|
|
227
|
+
!
|
|
228
|
+
! = 2 if the solution is specified at
|
|
229
|
+
! r = c and the derivative of the
|
|
230
|
+
! solution with respect to r is
|
|
231
|
+
! specified at r = d. (see note 1 below)
|
|
232
|
+
!
|
|
233
|
+
! = 3 if the derivative of the solution
|
|
234
|
+
! with respect to r is specified at
|
|
235
|
+
! r = c and r = d.
|
|
236
|
+
!
|
|
237
|
+
! = 4 if the derivative of the solution
|
|
238
|
+
! with respect to r is
|
|
239
|
+
! specified at r = c and the solution
|
|
240
|
+
! is specified at r = d.
|
|
241
|
+
!
|
|
242
|
+
! = 5 if the solution is unspecified at
|
|
243
|
+
! r = c = 0 (see note 2 below) and the
|
|
244
|
+
! solution is specified at r = d.
|
|
245
|
+
!
|
|
246
|
+
! = 6 if the solution is unspecified at
|
|
247
|
+
! r = c = 0 (see note 2 below)
|
|
248
|
+
! and the derivative of the solution
|
|
249
|
+
! with respect to r is specified at
|
|
250
|
+
! r = d.
|
|
251
|
+
!
|
|
252
|
+
! note 1:
|
|
253
|
+
! if c = 0 and mbdcnd = 3, 6, 8 or 9, the
|
|
254
|
+
! system of equations to be solved is
|
|
255
|
+
! singular. the unique solution is
|
|
256
|
+
! determined by extrapolation to the
|
|
257
|
+
! specification of u(theta(1), c).
|
|
258
|
+
! but in these cases the right side of the
|
|
259
|
+
! system will be perturbed by the constant
|
|
260
|
+
! pertrb.
|
|
261
|
+
!
|
|
262
|
+
! note 2:
|
|
263
|
+
! nbdcnd = 5 or 6 cannot be used with
|
|
264
|
+
! mbdcnd =1, 2, 4, 5, or 7
|
|
265
|
+
! (the former indicates that the solution is
|
|
266
|
+
! unspecified at r = 0; the latter indicates
|
|
267
|
+
! solution is specified).
|
|
268
|
+
! use instead nbdcnd = 1 or 2.
|
|
269
|
+
!
|
|
270
|
+
! bdc
|
|
271
|
+
! a one dimensional array of length m that
|
|
272
|
+
! specifies the boundary values of the
|
|
273
|
+
! solution at r = c. when nbdcnd = 1 or 2,
|
|
274
|
+
! bdc(i) = u(theta(i), c), i=1, 2, ..., m.
|
|
275
|
+
!
|
|
276
|
+
! when nbdcnd = 3 or 4,
|
|
277
|
+
! bdc(i) = (d/dr)u(theta(i), c), i=1, 2, ..., m.
|
|
278
|
+
!
|
|
279
|
+
! when nbdcnd has any other value, bdc is
|
|
280
|
+
! a dummy variable.
|
|
281
|
+
!
|
|
282
|
+
! bdd
|
|
283
|
+
! a one-dimensional array of length m that
|
|
284
|
+
! specifies the boundary values of the
|
|
285
|
+
! solution at r = d. when nbdcnd = 1 or 4,
|
|
286
|
+
! bdd(i) = u(theta(i), d) , i=1, 2, ..., m.
|
|
287
|
+
!
|
|
288
|
+
! when nbdcnd = 2 or 3,
|
|
289
|
+
! bdd(i) = (d/dr)u(theta(i), d), i=1, 2, ..., m.
|
|
290
|
+
!
|
|
291
|
+
! when nbdcnd has any other value, bdd is
|
|
292
|
+
! a dummy variable.
|
|
293
|
+
!
|
|
294
|
+
! elmbda
|
|
295
|
+
! the constant lambda in the modified
|
|
296
|
+
! helmholtz equation. if lambda is greater
|
|
297
|
+
! than 0, a solution may not exist.
|
|
298
|
+
! however, hstcsp will attempt to find a
|
|
299
|
+
! solution.
|
|
300
|
+
!
|
|
301
|
+
! f
|
|
302
|
+
! a two-dimensional array that specifies the
|
|
303
|
+
! values of the right side of the modified
|
|
304
|
+
! helmholtz equation. for i=1, 2, ..., m and
|
|
305
|
+
! j=1, 2, ..., n
|
|
306
|
+
!
|
|
307
|
+
! f(i, j) = f(theta(i), r(j)) .
|
|
308
|
+
!
|
|
309
|
+
! f must be dimensioned at least m x n.
|
|
310
|
+
!
|
|
311
|
+
! idimf
|
|
312
|
+
! the row (or first) dimension of the array
|
|
313
|
+
! f as it appears in the program calling
|
|
314
|
+
! hstcsp. this parameter is used to specify
|
|
315
|
+
! the variable dimension of f.
|
|
316
|
+
! idimf must be at least m.
|
|
317
|
+
!
|
|
318
|
+
! w
|
|
319
|
+
! A derived type(FishpackWorkspace) variable
|
|
320
|
+
! that must be declared by the user. the first
|
|
321
|
+
! two declarative statements in the user program
|
|
322
|
+
! calling hstcsp must be:
|
|
323
|
+
!
|
|
324
|
+
! use type_fishpackworkspace
|
|
325
|
+
! type(FishpackWorkspace) :: w
|
|
326
|
+
!
|
|
327
|
+
! the first statement makes the fishpack module
|
|
328
|
+
! defined in the file "type_fishpackworkspace.f90" available to the
|
|
329
|
+
! user program calling hstcsp. the second statement
|
|
330
|
+
! declares a derived type variable (defined in
|
|
331
|
+
! the module "type_fishpackworkspace.f90") which is used internally
|
|
332
|
+
! in blktri to dynamically allocate real and complex
|
|
333
|
+
! workspace used in solution. an error flag
|
|
334
|
+
! (ierror = 20) is set if the required workspace
|
|
335
|
+
! allocation fails (for example if n, m are too large)
|
|
336
|
+
! real and complex values are set in the components
|
|
337
|
+
! of w on a initial (iflg=0) call to hstcsp. these
|
|
338
|
+
! must be preserved on non-initial calls (intl=1)
|
|
339
|
+
! to hstcsp. this eliminates redundant calculations
|
|
340
|
+
! and saves compute time.
|
|
341
|
+
!
|
|
342
|
+
! **** IMPORTANT! the user program calling hstcsp should
|
|
343
|
+
! include the statement:
|
|
344
|
+
!
|
|
345
|
+
! call workspace%destroy()
|
|
346
|
+
!
|
|
347
|
+
! after the final approximation is generated by
|
|
348
|
+
! hstcsp. the will deallocate the real and complex
|
|
349
|
+
! workspace of w. failure to include this statement
|
|
350
|
+
! could result in serious memory leakage.
|
|
351
|
+
!
|
|
352
|
+
!
|
|
353
|
+
!
|
|
354
|
+
! ON OUTPUT f
|
|
355
|
+
! contains the solution u(i, j) of the finite
|
|
356
|
+
! difference approximation for the grid point
|
|
357
|
+
! (theta(i), r(j)) for i=1, 2, .., m, j=1, 2, ..., n.
|
|
358
|
+
!
|
|
359
|
+
! pertrb
|
|
360
|
+
! if a combination of periodic, derivative,
|
|
361
|
+
! or unspecified boundary conditions is
|
|
362
|
+
! specified for a poisson equation
|
|
363
|
+
! (lambda = 0), a solution may not exist.
|
|
364
|
+
! pertrb is a constant, calculated and
|
|
365
|
+
! subtracted from f, which ensures that a
|
|
366
|
+
! solution exists. hstcsp then computes this
|
|
367
|
+
! solution, which is a least squares solution
|
|
368
|
+
! to the original approximation.
|
|
369
|
+
! this solution plus any constant is also
|
|
370
|
+
! a solution; hence, the solution is not
|
|
371
|
+
! unique. the value of pertrb should be
|
|
372
|
+
! small compared to the right side f.
|
|
373
|
+
! otherwise, a solution is obtained to an
|
|
374
|
+
! essentially different problem.
|
|
375
|
+
! this comparison should always be made to
|
|
376
|
+
! insure that a meaningful solution has been
|
|
377
|
+
! obtained.
|
|
378
|
+
!
|
|
379
|
+
! ierror
|
|
380
|
+
! an error flag that indicates invalid input
|
|
381
|
+
! parameters. except for numbers 0 and 10,
|
|
382
|
+
! a solution is not attempted.
|
|
383
|
+
!
|
|
384
|
+
! = 0 no error
|
|
385
|
+
!
|
|
386
|
+
! = 1 a < 0 or b > pi
|
|
387
|
+
!
|
|
388
|
+
! = 2 a >= b
|
|
389
|
+
!
|
|
390
|
+
! = 3 mbdcnd < 1 or mbdcnd > 9
|
|
391
|
+
!
|
|
392
|
+
! = 4 c < 0
|
|
393
|
+
!
|
|
394
|
+
! = 5 c >= d
|
|
395
|
+
!
|
|
396
|
+
! = 6 nbdcnd < 1 or nbdcnd > 6
|
|
397
|
+
!
|
|
398
|
+
! = 7 n < 5
|
|
399
|
+
!
|
|
400
|
+
! = 8 nbdcnd = 5 or 6 and
|
|
401
|
+
! mbdcnd = 1, 2, 4, 5, or 7
|
|
402
|
+
!
|
|
403
|
+
! = 9 c > 0 and 5 <= nbdcnd
|
|
404
|
+
!
|
|
405
|
+
! = 10 elmbda > 0
|
|
406
|
+
!
|
|
407
|
+
! = 11 idimf < m
|
|
408
|
+
!
|
|
409
|
+
! = 12 m < 5
|
|
410
|
+
!
|
|
411
|
+
! = 13 a = 0 and mbdcnd =1, 2, 3, 4, 7 or 8
|
|
412
|
+
!
|
|
413
|
+
! = 14 b = pi and mbdcnd <= 6
|
|
414
|
+
!
|
|
415
|
+
! = 15 a > 0 and mbdcnd = 5, 6, or 9
|
|
416
|
+
!
|
|
417
|
+
! = 16 b < pi and 7 <= mbdcnd
|
|
418
|
+
!
|
|
419
|
+
! = 17 lambda /= 0 and 5 <= nbdcnd
|
|
420
|
+
!
|
|
421
|
+
! since this is the only means of indicating
|
|
422
|
+
! a possibly incorrect call to hstcsp,
|
|
423
|
+
! the user should test ierror after the call.
|
|
424
|
+
!
|
|
425
|
+
! = 20 If the dynamic allocation of real and
|
|
426
|
+
! complex workspace in the derived type
|
|
427
|
+
! (FishpackWorkspace) variable w fails (e.g.,
|
|
428
|
+
! if n, m are too large for the platform used)
|
|
429
|
+
!
|
|
430
|
+
! w
|
|
431
|
+
! The derived type(FishpackWorkspace) variable w
|
|
432
|
+
! contains real and complex values that must not
|
|
433
|
+
! be destroyed if hstcsp is called again with
|
|
434
|
+
! iflg=1.
|
|
435
|
+
!
|
|
436
|
+
!
|
|
437
|
+
! I/O None
|
|
438
|
+
!
|
|
439
|
+
! PRECISION 64-bit double precision
|
|
440
|
+
!
|
|
441
|
+
! REQUIRED LIBRARY type_FishpackWorkspace.f90, blktri.f90
|
|
442
|
+
! FILES
|
|
443
|
+
!
|
|
444
|
+
! HISTORY * Written by Roland Sweet at NCAR in 1977.
|
|
445
|
+
! released on NCAR's public software libraries
|
|
446
|
+
! in January 1980.
|
|
447
|
+
! * Revised by John Adams in June
|
|
448
|
+
! 2004 using Fortan 90 dynamically allocated work
|
|
449
|
+
! space and derived data types to eliminate mixed
|
|
450
|
+
! mode conflicts in the earlier versions.
|
|
451
|
+
!
|
|
452
|
+
! STANDARD Fortran 2008
|
|
453
|
+
!
|
|
454
|
+
! ALGORITHM This subroutine defines the finite-difference
|
|
455
|
+
! equations, incorporates boundary data, adjusts
|
|
456
|
+
! the right side when the system is singular
|
|
457
|
+
! and calls blktri which solves the linear
|
|
458
|
+
! system of equations.
|
|
459
|
+
!
|
|
460
|
+
!
|
|
461
|
+
! TIMING For large m and n, the operation count is
|
|
462
|
+
! roughly proportional to
|
|
463
|
+
!
|
|
464
|
+
! m*n*log2(n).
|
|
465
|
+
!
|
|
466
|
+
! The timing also depends on input parameter intl.
|
|
467
|
+
!
|
|
468
|
+
! ACCURACY The solution process employed results in
|
|
469
|
+
! a loss of no more than four significant
|
|
470
|
+
! digits for n and m as large as 64.
|
|
471
|
+
! more detailed information about accuracy
|
|
472
|
+
! can be found in the documentation for
|
|
473
|
+
! subroutine blktri which is the routine
|
|
474
|
+
! solves the finite difference equations.
|
|
475
|
+
!
|
|
476
|
+
! REFERENCES P.N. Swarztrauber, "A direct method for
|
|
477
|
+
! the discrete solution of separable elliptic
|
|
478
|
+
! equations", SIAM J. Numer. Anal. 11(1974),
|
|
479
|
+
! pp. 1136-1150.
|
|
480
|
+
!
|
|
481
|
+
! U. Schumann and R. Sweet, "A direct method for
|
|
482
|
+
! the solution of poisson's equation with neumann
|
|
483
|
+
! boundary conditions on a staggered grid of
|
|
484
|
+
! arbitrary size, " J. Comp. Phys. 20(1976),
|
|
485
|
+
! pp. 171-182.
|
|
486
|
+
!
|
|
487
|
+
submodule(staggered_helmholtz_solvers) staggered_axisymmetric_spherical_solver
|
|
488
|
+
|
|
489
|
+
!---------------------------------------------------------------
|
|
490
|
+
! Parameters confined to the submodule
|
|
491
|
+
!---------------------------------------------------------------
|
|
492
|
+
integer(ip), parameter :: IIWK = 8_ip ! Size of workspace indices
|
|
493
|
+
!---------------------------------------------------------------
|
|
494
|
+
|
|
495
|
+
contains
|
|
496
|
+
|
|
497
|
+
module subroutine hstcsp(intl, a, b, m, mbdcnd, bda, bdb, c, d, n, nbdcnd, &
|
|
498
|
+
bdc, bdd, elmbda, f, idimf, pertrb, ierror, workspace)
|
|
499
|
+
!-----------------------------------------------
|
|
500
|
+
! Dummy arguments
|
|
501
|
+
!-----------------------------------------------
|
|
502
|
+
integer(ip), intent(inout) :: intl
|
|
503
|
+
integer(ip), intent(in) :: m
|
|
504
|
+
integer(ip), intent(in) :: mbdcnd
|
|
505
|
+
integer(ip), intent(in) :: n
|
|
506
|
+
integer(ip), intent(in) :: nbdcnd
|
|
507
|
+
integer(ip), intent(in) :: idimf
|
|
508
|
+
integer(ip), intent(out) :: ierror
|
|
509
|
+
real(wp), intent(in) :: a
|
|
510
|
+
real(wp), intent(in) :: b
|
|
511
|
+
real(wp), intent(in) :: c
|
|
512
|
+
real(wp), intent(in) :: d
|
|
513
|
+
real(wp), intent(in) :: elmbda
|
|
514
|
+
real(wp), intent(out) :: pertrb
|
|
515
|
+
real(wp), intent(in) :: bda(:)
|
|
516
|
+
real(wp), intent(in) :: bdb(:)
|
|
517
|
+
real(wp), intent(in) :: bdc(:)
|
|
518
|
+
real(wp), intent(in) :: bdd(:)
|
|
519
|
+
real(wp), intent(inout) :: f(:,:)
|
|
520
|
+
class(FishpackWorkspace), intent(inout) :: workspace
|
|
521
|
+
!-----------------------------------------------
|
|
522
|
+
|
|
523
|
+
! Check for invalid input parameters
|
|
524
|
+
call hstcsp_check_input_arguments(a, b, m, mbdcnd, c, d, n, nbdcnd, elmbda, idimf, ierror)
|
|
525
|
+
|
|
526
|
+
if (ierror /= 0) return
|
|
527
|
+
|
|
528
|
+
! Initialize workspace on first call
|
|
529
|
+
if (intl == 0) call hstcsp_initialize_workspace(n, m, workspace)
|
|
530
|
+
|
|
531
|
+
! Solve system
|
|
532
|
+
associate( &
|
|
533
|
+
iwam => workspace%workspace_indices(1), &
|
|
534
|
+
iwbm => workspace%workspace_indices(2), &
|
|
535
|
+
iwcm => workspace%workspace_indices(3), &
|
|
536
|
+
iwan => workspace%workspace_indices(4), &
|
|
537
|
+
iwbn => workspace%workspace_indices(5), &
|
|
538
|
+
iwcn => workspace%workspace_indices(6), &
|
|
539
|
+
iwsnth => workspace%workspace_indices(7), &
|
|
540
|
+
iwrsq => workspace%workspace_indices(8), &
|
|
541
|
+
rew => workspace%real_workspace, &
|
|
542
|
+
cxw => workspace%complex_workspace &
|
|
543
|
+
)
|
|
544
|
+
associate( &
|
|
545
|
+
am => rew(iwam:), &
|
|
546
|
+
bm => rew(iwbm:), &
|
|
547
|
+
cm => rew(iwcm:), &
|
|
548
|
+
an => rew(iwan:), &
|
|
549
|
+
bn => rew(iwbn:), &
|
|
550
|
+
cn => rew(iwcn:), &
|
|
551
|
+
snth => rew(iwsnth:), &
|
|
552
|
+
rsq => rew(iwrsq:), &
|
|
553
|
+
w => rew, &
|
|
554
|
+
wc => cxw &
|
|
555
|
+
)
|
|
556
|
+
call hstcsp_lower_routine(intl, a, b, m, mbdcnd, bda, bdb, c, d, n, nbdcnd, bdc, bdd, &
|
|
557
|
+
elmbda, f, idimf, pertrb, ierror, am, bm, cm, an, bn, &
|
|
558
|
+
cn, snth, rsq, w, wc)
|
|
559
|
+
end associate
|
|
560
|
+
end associate
|
|
561
|
+
|
|
562
|
+
end subroutine hstcsp
|
|
563
|
+
|
|
564
|
+
subroutine hstcsp_initialize_workspace(n, m, workspace)
|
|
565
|
+
!-----------------------------------------------
|
|
566
|
+
! Dummy arguments
|
|
567
|
+
!-----------------------------------------------
|
|
568
|
+
integer(ip), intent(in) :: n
|
|
569
|
+
integer(ip), intent(in) :: m
|
|
570
|
+
class(FishpackWorkspace), intent(out) :: workspace
|
|
571
|
+
!-----------------------------------------------
|
|
572
|
+
! Local variables
|
|
573
|
+
!-----------------------------------------------
|
|
574
|
+
integer(ip) :: irwk, icwk, indx(IIWK)
|
|
575
|
+
!-----------------------------------------------
|
|
576
|
+
|
|
577
|
+
! Compute blktri requirements in irwk, icwk
|
|
578
|
+
call workspace%compute_blktri_workspace_lengths(n, m, irwk, icwk)
|
|
579
|
+
|
|
580
|
+
! Compute indices
|
|
581
|
+
associate( &
|
|
582
|
+
iw1 => indx(1), &
|
|
583
|
+
iwbm => indx(2), &
|
|
584
|
+
iwcm => indx(3), &
|
|
585
|
+
iwan => indx(4), &
|
|
586
|
+
iwbn => indx(5), &
|
|
587
|
+
iwcn => indx(6), &
|
|
588
|
+
iwsnth => indx(7), &
|
|
589
|
+
iwrsq => indx(8) &
|
|
590
|
+
)
|
|
591
|
+
|
|
592
|
+
! Set workspace indices
|
|
593
|
+
iw1 = irwk + 1
|
|
594
|
+
iwbm = iw1 + m
|
|
595
|
+
iwcm = iwbm + m
|
|
596
|
+
iwan = iwcm + m
|
|
597
|
+
iwbn = iwan + n
|
|
598
|
+
iwcn = iwbn + n
|
|
599
|
+
iwsnth = iwcn + n
|
|
600
|
+
iwrsq = iwsnth + m
|
|
601
|
+
|
|
602
|
+
! Adjust real and complex workspace arrays for hstcsp
|
|
603
|
+
irwk = iwrsq + n
|
|
604
|
+
icwk = icwk + 3 * (m + 1)
|
|
605
|
+
end associate
|
|
606
|
+
|
|
607
|
+
! Allocate required memory for workspace arrays
|
|
608
|
+
call workspace%create(irwk, icwk, IIWK)
|
|
609
|
+
|
|
610
|
+
! Copy indices
|
|
611
|
+
workspace%workspace_indices = indx
|
|
612
|
+
|
|
613
|
+
end subroutine hstcsp_initialize_workspace
|
|
614
|
+
|
|
615
|
+
pure subroutine hstcsp_check_input_arguments(a, b, m, mbdcnd, c, d, n, nbdcnd, elmbda, idimf, ierror)
|
|
616
|
+
!-----------------------------------------------
|
|
617
|
+
! Dummy arguments
|
|
618
|
+
!-----------------------------------------------
|
|
619
|
+
integer(ip), intent(in) :: m
|
|
620
|
+
integer(ip), intent(in) :: mbdcnd
|
|
621
|
+
integer(ip), intent(in) :: n
|
|
622
|
+
integer(ip), intent(in) :: nbdcnd
|
|
623
|
+
integer(ip), intent(in) :: idimf
|
|
624
|
+
integer(ip), intent(out) :: ierror
|
|
625
|
+
real(wp), intent(in) :: a
|
|
626
|
+
real(wp), intent(in) :: b
|
|
627
|
+
real(wp), intent(in) :: c
|
|
628
|
+
real(wp), intent(in) :: d
|
|
629
|
+
real(wp), intent(in) :: elmbda
|
|
630
|
+
!-----------------------------------------------
|
|
631
|
+
|
|
632
|
+
if (a < ZERO .or. b > PI) then
|
|
633
|
+
ierror = 1
|
|
634
|
+
return
|
|
635
|
+
else if (a >= b) then
|
|
636
|
+
ierror = 2
|
|
637
|
+
return
|
|
638
|
+
else if (mbdcnd < 1 .or. mbdcnd > 9) then
|
|
639
|
+
ierror = 3
|
|
640
|
+
return
|
|
641
|
+
else if (c < ZERO) then
|
|
642
|
+
ierror = 4
|
|
643
|
+
return
|
|
644
|
+
else if (c >= d) then
|
|
645
|
+
ierror = 5
|
|
646
|
+
return
|
|
647
|
+
else if (nbdcnd < 1 .or. nbdcnd > 6) then
|
|
648
|
+
ierror = 6
|
|
649
|
+
return
|
|
650
|
+
else if (n < 5) then
|
|
651
|
+
ierror = 7
|
|
652
|
+
return
|
|
653
|
+
else if (nbdcnd == 5 .or. nbdcnd == 6) then
|
|
654
|
+
select case (mbdcnd)
|
|
655
|
+
case (1:2, 4:5, 7)
|
|
656
|
+
ierror = 8
|
|
657
|
+
return
|
|
658
|
+
end select
|
|
659
|
+
else if (c > ZERO .and. 5 <= nbdcnd) then
|
|
660
|
+
ierror = 9
|
|
661
|
+
return
|
|
662
|
+
else if (idimf < m) then
|
|
663
|
+
ierror = 11
|
|
664
|
+
return
|
|
665
|
+
else if (m < 5) then
|
|
666
|
+
ierror = 12
|
|
667
|
+
return
|
|
668
|
+
else if (a == ZERO .and. mbdcnd /= 5.and. mbdcnd /= 6.and. mbdcnd /= 9) then
|
|
669
|
+
ierror = 13
|
|
670
|
+
return
|
|
671
|
+
else if (b == PI .and. mbdcnd <= 6) then
|
|
672
|
+
ierror = 14
|
|
673
|
+
return
|
|
674
|
+
else if (a > ZERO) then
|
|
675
|
+
select case (mbdcnd)
|
|
676
|
+
case (5:6, 9)
|
|
677
|
+
ierror=15
|
|
678
|
+
return
|
|
679
|
+
end select
|
|
680
|
+
else if (b < PI .and. 7 <= mbdcnd) then
|
|
681
|
+
ierror = 16
|
|
682
|
+
return
|
|
683
|
+
else if (elmbda /= ZERO .and. 5 <= nbdcnd) then
|
|
684
|
+
ierror = 17
|
|
685
|
+
return
|
|
686
|
+
else
|
|
687
|
+
ierror = 0
|
|
688
|
+
end if
|
|
689
|
+
|
|
690
|
+
end subroutine hstcsp_check_input_arguments
|
|
691
|
+
|
|
692
|
+
subroutine hstcsp_lower_routine(intl, a, b, m, mbdcnd, bda, bdb, c, d, n, nbdcnd, &
|
|
693
|
+
bdc, bdd, elmbda, f, idimf, pertrb, ierror, am, bm, cm, an, bn, &
|
|
694
|
+
cn, snth, rsq, w, wc)
|
|
695
|
+
!-----------------------------------------------
|
|
696
|
+
! Dummy arguments
|
|
697
|
+
!-----------------------------------------------
|
|
698
|
+
integer(ip), intent(in) :: intl
|
|
699
|
+
integer(ip), intent(in) :: m
|
|
700
|
+
integer(ip), intent(in) :: mbdcnd
|
|
701
|
+
integer(ip), intent(in) :: n
|
|
702
|
+
integer(ip), intent(in) :: nbdcnd
|
|
703
|
+
integer(ip), intent(in) :: idimf
|
|
704
|
+
integer(ip), intent(out) :: ierror
|
|
705
|
+
real(wp), intent(in) :: a
|
|
706
|
+
real(wp), intent(in) :: b
|
|
707
|
+
real(wp), intent(in) :: c
|
|
708
|
+
real(wp), intent(in) :: d
|
|
709
|
+
real(wp), intent(in) :: elmbda
|
|
710
|
+
real(wp), intent(out) :: pertrb
|
|
711
|
+
real(wp), intent(in) :: bda(:)
|
|
712
|
+
real(wp), intent(in) :: bdb(:)
|
|
713
|
+
real(wp), intent(in) :: bdc(:)
|
|
714
|
+
real(wp), intent(in) :: bdd(:)
|
|
715
|
+
real(wp), intent(inout) :: f(:,:)
|
|
716
|
+
real(wp), intent(out) :: am(:)
|
|
717
|
+
real(wp), intent(out) :: bm(:)
|
|
718
|
+
real(wp), intent(out) :: cm(:)
|
|
719
|
+
real(wp), intent(out) :: an(:)
|
|
720
|
+
real(wp), intent(out) :: bn(:)
|
|
721
|
+
real(wp), intent(out) :: cn(:)
|
|
722
|
+
real(wp), intent(out) :: snth(:)
|
|
723
|
+
real(wp), intent(out) :: rsq(:)
|
|
724
|
+
real(wp), intent(out) :: w(:)
|
|
725
|
+
complex(wp), intent(out) :: wc(:)
|
|
726
|
+
!-----------------------------------------------
|
|
727
|
+
! Local variables
|
|
728
|
+
!-----------------------------------------------
|
|
729
|
+
integer(ip) :: i, j, isw, nb
|
|
730
|
+
real(wp) :: dth, dthsq, dr, x, y, a2, a1, a3
|
|
731
|
+
type(GeneralizedCyclicReductionUtility) :: util
|
|
732
|
+
!-----------------------------------------------
|
|
733
|
+
|
|
734
|
+
dth = (b - a)/m
|
|
735
|
+
dthsq = dth**2
|
|
736
|
+
|
|
737
|
+
do i = 1, m
|
|
738
|
+
snth(i) = sin(a + (real(i, kind=wp) - HALF)*dth)
|
|
739
|
+
end do
|
|
740
|
+
|
|
741
|
+
dr = (d - c)/n
|
|
742
|
+
|
|
743
|
+
do j = 1, n
|
|
744
|
+
rsq(j) = (c + (real(j, kind=wp) - HALF)*dr)**2
|
|
745
|
+
end do
|
|
746
|
+
!
|
|
747
|
+
! multiply right side by r(j)**2
|
|
748
|
+
!
|
|
749
|
+
do j = 1, n
|
|
750
|
+
x = rsq(j)
|
|
751
|
+
f(:m, j) = x*f(:m, j)
|
|
752
|
+
end do
|
|
753
|
+
!
|
|
754
|
+
! define coefficients am, bm, cm
|
|
755
|
+
!
|
|
756
|
+
x = ONE/(TWO*cos(dth/2))
|
|
757
|
+
am(2:m) = (snth(:m-1)+snth(2:m))*x
|
|
758
|
+
cm(:m-1) = am(2:m)
|
|
759
|
+
am(1) = sin(a)
|
|
760
|
+
cm(m) = sin(b)
|
|
761
|
+
do i = 1, m
|
|
762
|
+
x = ONE/snth(i)
|
|
763
|
+
y = x/dthsq
|
|
764
|
+
am(i) = am(i)*y
|
|
765
|
+
cm(i) = cm(i)*y
|
|
766
|
+
bm(i) = elmbda*(x**2) - am(i) - cm(i)
|
|
767
|
+
end do
|
|
768
|
+
!
|
|
769
|
+
! Define coefficients an, bn, cn
|
|
770
|
+
!
|
|
771
|
+
x = c/dr
|
|
772
|
+
do j = 1, n
|
|
773
|
+
an(j) = (x + real(j - 1, kind=wp))**2
|
|
774
|
+
cn(j) = (x + real(j, kind=wp))**2
|
|
775
|
+
bn(j) = -(an(j)+cn(j))
|
|
776
|
+
end do
|
|
777
|
+
isw = 1
|
|
778
|
+
nb = nbdcnd
|
|
779
|
+
|
|
780
|
+
if (c == ZERO .and. nb == 2) nb = 6
|
|
781
|
+
!
|
|
782
|
+
! Enter data on theta boundaries
|
|
783
|
+
!
|
|
784
|
+
select case (mbdcnd)
|
|
785
|
+
case (1:2, 7)
|
|
786
|
+
bm(1) = bm(1) - am(1)
|
|
787
|
+
x = TWO*am(1)
|
|
788
|
+
f(1, :n) = f(1, :n) - x*bda
|
|
789
|
+
case (3:4, 8)
|
|
790
|
+
bm(1) = bm(1) + am(1)
|
|
791
|
+
x = dth*am(1)
|
|
792
|
+
f(1, :n) = f(1, :n) + x*bda
|
|
793
|
+
end select
|
|
794
|
+
|
|
795
|
+
select case (mbdcnd)
|
|
796
|
+
case (1, 4:5)
|
|
797
|
+
bm(m) = bm(m) - cm(m)
|
|
798
|
+
x = TWO*cm(m)
|
|
799
|
+
f(m, :n) = f(m, :n) - x*bdb
|
|
800
|
+
case (2:3, 6)
|
|
801
|
+
bm(m) = bm(m) + cm(m)
|
|
802
|
+
x = dth*cm(m)
|
|
803
|
+
f(m, :n) = f(m, :n) - x*bdb
|
|
804
|
+
end select
|
|
805
|
+
|
|
806
|
+
select case (nb)
|
|
807
|
+
case (1:2)
|
|
808
|
+
bn(1) = bn(1) - an(1)
|
|
809
|
+
x = TWO*an(1)
|
|
810
|
+
f(:m, 1) = f(:m, 1) - x*bdc
|
|
811
|
+
case (3:4)
|
|
812
|
+
bn(1) = bn(1) + an(1)
|
|
813
|
+
x = dr*an(1)
|
|
814
|
+
f(:m, 1) = f(:m, 1) + x*bdc
|
|
815
|
+
end select
|
|
816
|
+
|
|
817
|
+
select case (nb)
|
|
818
|
+
case (1, 4:5)
|
|
819
|
+
bn(n) = bn(n) - cn(n)
|
|
820
|
+
x = TWO*cn(n)
|
|
821
|
+
f(:m, n) = f(:m, n) - x*bdd
|
|
822
|
+
case (2:3, 6)
|
|
823
|
+
bn(n) = bn(n) + cn(n)
|
|
824
|
+
x = dr*cn(n)
|
|
825
|
+
f(:m, n) = f(:m, n) - x*bdd
|
|
826
|
+
end select
|
|
827
|
+
|
|
828
|
+
pertrb = ZERO
|
|
829
|
+
|
|
830
|
+
case_construct: select case (mbdcnd)
|
|
831
|
+
case (1:2, 4:5, 7)
|
|
832
|
+
exit case_construct
|
|
833
|
+
case (3, 6, 8:9)
|
|
834
|
+
select case (nb)
|
|
835
|
+
case (1:2, 4:5)
|
|
836
|
+
exit case_construct
|
|
837
|
+
case (3, 6)
|
|
838
|
+
if (elmbda >= ZERO) then
|
|
839
|
+
if (elmbda /= ZERO) then
|
|
840
|
+
ierror = 10
|
|
841
|
+
else
|
|
842
|
+
isw = 2
|
|
843
|
+
do i = 1, m
|
|
844
|
+
x = ZERO
|
|
845
|
+
x = sum(f(i, :n))
|
|
846
|
+
pertrb = pertrb + x*snth(i)
|
|
847
|
+
end do
|
|
848
|
+
x = ZERO
|
|
849
|
+
x = sum(rsq(:n))
|
|
850
|
+
pertrb = TWO*(pertrb*sin(dth/2))/(x*(cos(a) - cos(b)))
|
|
851
|
+
do j = 1, n
|
|
852
|
+
x = rsq(j)*pertrb
|
|
853
|
+
f(:m, j) = f(:m, j) - x
|
|
854
|
+
end do
|
|
855
|
+
end if
|
|
856
|
+
end if
|
|
857
|
+
end select
|
|
858
|
+
end select case_construct
|
|
859
|
+
|
|
860
|
+
a2 = sum(f(:m, 1))/rsq(1)
|
|
861
|
+
|
|
862
|
+
if (intl == 0) then
|
|
863
|
+
!
|
|
864
|
+
! Initialize blktri
|
|
865
|
+
!
|
|
866
|
+
call util%blktrii(0, 1, n, an, bn, cn, 1, m, am, bm, cm, idimf, f, ierror, w, wc)
|
|
867
|
+
|
|
868
|
+
! Check error flag
|
|
869
|
+
if (ierror /= 0) then
|
|
870
|
+
error stop 'fishpack library: blktrii initialization call failed in hstcsp_lower_routine'
|
|
871
|
+
end if
|
|
872
|
+
|
|
873
|
+
end if
|
|
874
|
+
|
|
875
|
+
call util%blktrii(1, 1, n, an, bn, cn, 1, m, am, bm, cm, idimf, f, ierror, w, wc)
|
|
876
|
+
|
|
877
|
+
! Check error flag
|
|
878
|
+
if (ierror /= 0) then
|
|
879
|
+
error stop 'fishpack library: blktrii call failed in hstcsp_lower_routine'
|
|
880
|
+
end if
|
|
881
|
+
|
|
882
|
+
if (.not.(isw /=2 .or. c /= ZERO .or. nbdcnd /= 2)) then
|
|
883
|
+
a3 = ZERO
|
|
884
|
+
a1 = dot_product(snth(:m), f(:m, 1))
|
|
885
|
+
a3 = sum(snth(:m))
|
|
886
|
+
a1 = a1 + rsq(1)*a2/2
|
|
887
|
+
|
|
888
|
+
if (mbdcnd == 3) a1=a1+(sin(b)*bdb(1)-sin(a)*bda(1))/(TWO*(b-a))
|
|
889
|
+
|
|
890
|
+
a1 = a1/a3
|
|
891
|
+
a1 = bdc(1) - a1
|
|
892
|
+
f(:m, :n) = f(:m, :n) + a1
|
|
893
|
+
end if
|
|
894
|
+
|
|
895
|
+
end subroutine hstcsp_lower_routine
|
|
896
|
+
|
|
897
|
+
end submodule staggered_axisymmetric_spherical_solver
|
|
898
|
+
!
|
|
899
|
+
! REVISION HISTORY
|
|
900
|
+
!
|
|
901
|
+
! September 1973 Version 1
|
|
902
|
+
! April 1976 Version 2
|
|
903
|
+
! January 1978 Version 3
|
|
904
|
+
! December 1979 Version 3.1
|
|
905
|
+
! February 1985 Documentation upgrade
|
|
906
|
+
! November 1988 Version 3.2, FORTRAN 77 changes
|
|
907
|
+
! June 2004 Version 5.0, Fortran 90 changes
|
|
908
|
+
!-----------------------------------------------------------------------
|