bvsup.f 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694
  1. *DECK BVSUP
  2. SUBROUTINE BVSUP (Y, NROWY, NCOMP, XPTS, NXPTS, A, NROWA, ALPHA,
  3. + NIC, B, NROWB, BETA, NFC, IGOFX, RE, AE, IFLAG, WORK, NDW,
  4. + IWORK, NDIW, NEQIVP)
  5. C***BEGIN PROLOGUE BVSUP
  6. C***PURPOSE Solve a linear two-point boundary value problem using
  7. C superposition coupled with an orthonormalization procedure
  8. C and a variable-step integration scheme.
  9. C***LIBRARY SLATEC
  10. C***CATEGORY I1B1
  11. C***TYPE SINGLE PRECISION (BVSUP-S, DBVSUP-D)
  12. C***KEYWORDS ORTHONORMALIZATION, SHOOTING,
  13. C TWO-POINT BOUNDARY VALUE PROBLEM
  14. C***AUTHOR Scott, M. R., (SNLA)
  15. C Watts, H. A., (SNLA)
  16. C***DESCRIPTION
  17. C
  18. C **********************************************************************
  19. C Subroutine BVSUP solves a LINEAR two-point boundary-value problem
  20. C of the form
  21. C dY/dX = MATRIX(X,U)*Y(X) + G(X,U)
  22. C A*Y(Xinitial) = ALPHA , B*Y(Xfinal) = BETA
  23. C
  24. C Coupled with the solution of the initial value problem
  25. C
  26. C dU/dX = F(X,U)
  27. C U(Xinitial) = ETA
  28. C
  29. C **********************************************************************
  30. C Abstract
  31. C The method of solution uses superposition coupled with an
  32. C orthonormalization procedure and a variable-step integration
  33. C scheme. Each time the superposition solutions start to
  34. C lose their numerical linear independence, the vectors are
  35. C reorthonormalized before integration proceeds. The underlying
  36. C principle of the algorithm is then to piece together the
  37. C intermediate (orthogonalized) solutions, defined on the various
  38. C subintervals, to obtain the desired solutions.
  39. C
  40. C **********************************************************************
  41. C INPUT to BVSUP
  42. C **********************************************************************
  43. C
  44. C NROWY = Actual row dimension of Y in calling program.
  45. C NROWY must be .GE. NCOMP
  46. C
  47. C NCOMP = Number of components per solution vector.
  48. C NCOMP is equal to number of original differential
  49. C equations. NCOMP = NIC + NFC.
  50. C
  51. C XPTS = Desired output points for solution. They must be monotonic.
  52. C Xinitial = XPTS(1)
  53. C Xfinal = XPTS(NXPTS)
  54. C
  55. C NXPTS = Number of output points
  56. C
  57. C A(NROWA,NCOMP) = Boundary condition matrix at Xinitial,
  58. C must be contained in (NIC,NCOMP) sub-matrix.
  59. C
  60. C NROWA = Actual row dimension of A in calling program,
  61. C NROWA must be .GE. NIC.
  62. C
  63. C ALPHA(NIC+NEQIVP) = Boundary conditions at Xinitial.
  64. C If NEQIVP .GT. 0 (see below), the boundary
  65. C conditions at Xinitial for the initial value
  66. C equations must be stored starting in
  67. C position (NIC + 1) of ALPHA.
  68. C Thus, ALPHA(NIC+K) = ETA(K).
  69. C
  70. C NIC = Number of boundary conditions at Xinitial.
  71. C
  72. C B(NROWB,NCOMP) = Boundary condition matrix at Xfinal,
  73. C must be contained in (NFC,NCOMP) sub-matrix.
  74. C
  75. C NROWB = Actual row dimension of B in calling program,
  76. C NROWB must be .GE. NFC.
  77. C
  78. C BETA(NFC) = Boundary conditions at Xfinal.
  79. C
  80. C NFC = Number of boundary conditions at Xfinal
  81. C
  82. C IGOFX =0 -- The inhomogeneous term G(X) is identically zero.
  83. C =1 -- The inhomogeneous term G(X) is not identically zero.
  84. C (if IGOFX=1, then subroutine GVEC (or UVEC) must be
  85. C supplied).
  86. C
  87. C RE = Relative error tolerance used by the integrator
  88. C (see one of the integrators)
  89. C
  90. C AE = Absolute error tolerance used by the integrator
  91. C (see one of the integrators)
  92. C **NOTE- RE and AE should not both be zero.
  93. C
  94. C IFLAG = A status parameter used principally for output.
  95. C However, for efficient solution of problems which
  96. C are originally defined as complex valued (but
  97. C converted to real systems to use this code), the
  98. C user must set IFLAG=13 on input. See the comment below
  99. C for more information on solving such problems.
  100. C
  101. C WORK(NDW) = Floating point array used for internal storage.
  102. C
  103. C NDW = Actual dimension of WORK array allocated by user.
  104. C An estimate for NDW can be computed from the following
  105. C NDW = 130 + NCOMP**2 * (6 + NXPTS/2 + expected number of
  106. C orthonormalizations/8)
  107. C For the DISK or TAPE storage mode,
  108. C NDW = 6 * NCOMP**2 + 10 * NCOMP + 130
  109. C However, when the ADAMS integrator is to be used, the estimates are
  110. C NDW = 130 + NCOMP**2 * (13 + NXPTS/2 + expected number of
  111. C orthonormalizations/8)
  112. C and NDW = 13 * NCOMP**2 + 22 * NCOMP + 130 , respectively.
  113. C
  114. C IWORK(NDIW) = Integer array used for internal storage.
  115. C
  116. C NDIW = Actual dimension of IWORK array allocated by user.
  117. C An estimate for NDIW can be computed from the following
  118. C NDIW = 68 + NCOMP * (1 + expected number of
  119. C orthonormalizations)
  120. C **NOTE -- The amount of storage required is problem dependent and may
  121. C be difficult to predict in advance. Experience has shown
  122. C that for most problems 20 or fewer orthonormalizations
  123. C should suffice. If the problem cannot be completed with the
  124. C allotted storage, then a message will be printed which
  125. C estimates the amount of storage necessary. In any case, the
  126. C user can examine the IWORK array for the actual storage
  127. C requirements, as described in the output information below.
  128. C
  129. C NEQIVP = Number of auxiliary initial value equations being added
  130. C to the boundary value problem.
  131. C **NOTE -- Occasionally the coefficients MATRIX and/or G may be
  132. C functions which depend on the independent variable X and
  133. C on U, the solution of an auxiliary initial value problem.
  134. C In order to avoid the difficulties associated with
  135. C interpolation, the auxiliary equations may be solved
  136. C simultaneously with the given boundary value problem.
  137. C This initial value problem may be LINEAR or NONLINEAR.
  138. C See SAND77-1328 for an example.
  139. C
  140. C
  141. C The user must supply subroutines FMAT, GVEC, UIVP and UVEC, when
  142. C needed (they MUST be so named), to evaluate the derivatives
  143. C as follows
  144. C
  145. C A. FMAT must be supplied.
  146. C
  147. C SUBROUTINE FMAT(X,Y,YP)
  148. C X = Independent variable (input to FMAT)
  149. C Y = Dependent variable vector (input to FMAT)
  150. C YP = dY/dX = Derivative vector (output from FMAT)
  151. C
  152. C Compute the derivatives for the HOMOGENEOUS problem
  153. C YP(I) = dY(I)/dX = MATRIX(X) * Y(I) , I = 1,...,NCOMP
  154. C
  155. C When (NEQIVP .GT. 0) and MATRIX is dependent on U as
  156. C well as on X, the following common statement must be
  157. C included in FMAT
  158. C COMMON /MLIVP/ NOFST
  159. C For convenience, the U vector is stored at the bottom
  160. C of the Y array. Thus, during any call to FMAT,
  161. C U(I) is referenced by Y(NOFST + I).
  162. C
  163. C
  164. C Subroutine BVDER calls FMAT NFC times to evaluate the
  165. C homogeneous equations and, if necessary, it calls FMAT once
  166. C in evaluating the particular solution. Since X remains
  167. C unchanged in this sequence of calls it is possible to
  168. C realize considerable computational savings for complicated
  169. C and expensive evaluations of the MATRIX entries. To do this
  170. C the user merely passes a variable, say XS, via COMMON where
  171. C XS is defined in the main program to be any value except
  172. C the initial X. Then the non-constant elements of MATRIX(X)
  173. C appearing in the differential equations need only be
  174. C computed if X is unequal to XS, whereupon XS is reset to X.
  175. C
  176. C
  177. C B. If NEQIVP .GT. 0 , UIVP must also be supplied.
  178. C
  179. C SUBROUTINE UIVP(X,U,UP)
  180. C X = Independent variable (input to UIVP)
  181. C U = Dependent variable vector (input to UIVP)
  182. C UP = dU/dX = Derivative vector (output from UIVP)
  183. C
  184. C Compute the derivatives for the auxiliary initial value eqs
  185. C UP(I) = dU(I)/dX, I = 1,...,NEQIVP.
  186. C
  187. C Subroutine BVDER calls UIVP once to evaluate the
  188. C derivatives for the auxiliary initial value equations.
  189. C
  190. C
  191. C C. If NEQIVP = 0 and IGOFX = 1 , GVEC must be supplied.
  192. C
  193. C SUBROUTINE GVEC(X,G)
  194. C X = Independent variable (input to GVEC)
  195. C G = Vector of inhomogeneous terms G(X) (output from GVEC)
  196. C
  197. C Compute the inhomogeneous terms G(X)
  198. C G(I) = G(X) values for I = 1,...,NCOMP.
  199. C
  200. C Subroutine BVDER calls GVEC in evaluating the particular
  201. C solution provided G(X) is NOT identically zero. Thus, when
  202. C IGOFX=0, the user need NOT write a GVEC subroutine. Also,
  203. C the user does not have to bother with the computational
  204. C savings scheme for GVEC as this is automatically achieved
  205. C via the BVDER subroutine.
  206. C
  207. C
  208. C D. If NEQIVP .GT. 0 and IGOFX = 1 , UVEC must be supplied.
  209. C
  210. C SUBROUTINE UVEC(X,U,G)
  211. C X = Independent variable (input to UVEC)
  212. C U = Dependent variable vector from the auxiliary initial
  213. C value problem (input to UVEC)
  214. C G = Array of inhomogeneous terms G(X,U)(output from UVEC)
  215. C
  216. C Compute the inhomogeneous terms G(X,U)
  217. C G(I) = G(X,U) values for I = 1,...,NCOMP.
  218. C
  219. C Subroutine BVDER calls UVEC in evaluating the particular
  220. C solution provided G(X,U) is NOT identically zero. Thus,
  221. C when IGOFX=0, the user need NOT write a UVEC subroutine.
  222. C
  223. C
  224. C
  225. C The following is optional input to BVSUP to give the user more
  226. C flexibility in use of the code. See SAND75-0198 , SAND77-1328 ,
  227. C SAND77-1690,SAND78-0522, and SAND78-1501 for more information.
  228. C
  229. C ****CAUTION -- The user MUST zero out IWORK(1),...,IWORK(15)
  230. C prior to calling BVSUP. These locations define optional
  231. C input and MUST be zero UNLESS set to special values by
  232. C the user as described below.
  233. C
  234. C IWORK(1) -- Number of orthonormalization points.
  235. C A value need be set only if IWORK(11) = 1
  236. C
  237. C IWORK(9) -- Integrator and orthonormalization parameter
  238. C (default value is 1)
  239. C 1 = RUNGE-KUTTA-FEHLBERG code using GRAM-SCHMIDT test.
  240. C 2 = ADAMS code using GRAM-SCHMIDT TEST.
  241. C
  242. C IWORK(11) -- Orthonormalization points parameter
  243. C (default value is 0)
  244. C 0 - Orthonormalization points not pre-assigned.
  245. C 1 - Orthonormalization points pre-assigned in
  246. C the first IWORK(1) positions of WORK.
  247. C
  248. C IWORK(12) -- Storage parameter
  249. C (default value is 0)
  250. C 0 - All storage IN CORE
  251. C LUN - Homogeneous and inhomogeneous solutions at
  252. C output points and orthonormalization information
  253. C are stored on DISK. The logical unit number to be
  254. C used for DISK I/O (NTAPE) is set to IWORK(12).
  255. C
  256. C WORK(1),... -- Pre-assigned orthonormalization points, stored
  257. C monotonically, corresponding to the direction
  258. C of integration.
  259. C
  260. C
  261. C
  262. C ******************************
  263. C *** COMPLEX VALUED PROBLEM ***
  264. C ******************************
  265. C **NOTE***
  266. C Suppose the original boundary value problem is NC equations
  267. C of the form
  268. C dW/dX = MAT(X,U)*W(X) + H(X,U)
  269. C R*W(Xinitial)=GAMMA , S*W(Xfinal)=DELTA
  270. C
  271. C where all variables are complex valued. The BVSUP code can be
  272. C used by converting to a real system of size 2*NC. To solve the
  273. C larger dimensioned problem efficiently, the user must initialize
  274. C IFLAG=13 on input and order the vector components according to
  275. C Y(1)=real(W(1)),...,Y(NC)=real(W(NC)),Y(NC+1)=imag(W(1)),....,
  276. C Y(2*NC)=imag(W(NC)). Then define
  277. C ...........................
  278. C . real(MAT) -imag(MAT) .
  279. C MATRIX = . .
  280. C . imag(MAT) real(MAT) .
  281. C ...........................
  282. C
  283. C The matrices A,B and vectors G,ALPHA,BETA must be defined
  284. C similarly. Further details can be found in SAND78-1501.
  285. C
  286. C
  287. C **********************************************************************
  288. C OUTPUT from BVSUP
  289. C **********************************************************************
  290. C
  291. C Y(NROWY,NXPTS) = Solution at specified output points.
  292. C
  293. C IFLAG output values
  294. C =-5 Algorithm ,for obtaining starting vectors for the
  295. C special complex problem structure, was unable to obtain
  296. C the initial vectors satisfying the necessary
  297. C independence criteria.
  298. C =-4 Rank of boundary condition matrix A is less than NIC,
  299. C as determined by LSSUDS.
  300. C =-2 Invalid input parameters.
  301. C =-1 Insufficient number of storage locations allocated for
  302. C WORK or IWORK.
  303. C
  304. C =0 Indicates successful solution
  305. C
  306. C =1 A computed solution is returned but UNIQUENESS of the
  307. C solution of the boundary-value problem is questionable.
  308. C For an eigenvalue problem, this should be treated as a
  309. C successful execution since this is the expected mode
  310. C of return.
  311. C =2 A computed solution is returned but the EXISTENCE of the
  312. C solution to the boundary-value problem is questionable.
  313. C =3 A nontrivial solution approximation is returned although
  314. C the boundary condition matrix B*Y(Xfinal) is found to be
  315. C nonsingular (to the desired accuracy level) while the
  316. C right hand side vector is zero. To eliminate this type
  317. C of return, the accuracy of the eigenvalue parameter
  318. C must be improved.
  319. C ***NOTE- We attempt to diagnose the correct problem behavior
  320. C and report possible difficulties by the appropriate
  321. C error flag. However, the user should probably resolve
  322. C the problem using smaller error tolerances and/or
  323. C perturbations in the boundary conditions or other
  324. C parameters. This will often reveal the correct
  325. C interpretation for the problem posed.
  326. C
  327. C =13 Maximum number of orthonormalizations attained before
  328. C reaching Xfinal.
  329. C =20-flag from integrator (DERKF or DEABM) values can range
  330. C from 21 to 25.
  331. C =30 Solution vectors form a dependent set.
  332. C
  333. C WORK(1),...,WORK(IWORK(1)) = Orthonormalization points
  334. C determined by BVPOR.
  335. C
  336. C IWORK(1) = Number of orthonormalizations performed by BVPOR.
  337. C
  338. C IWORK(2) = Maximum number of orthonormalizations allowed as
  339. C calculated from storage allocated by user.
  340. C
  341. C IWORK(3),IWORK(4),IWORK(5),IWORK(6) Give information about
  342. C actual storage requirements for WORK and IWORK
  343. C arrays. In particular,
  344. C required storage for WORK array is
  345. C IWORK(3) + IWORK(4)*(expected number of orthonormalizations)
  346. C
  347. C required storage for IWORK array is
  348. C IWORK(5) + IWORK(6)*(expected number of orthonormalizations)
  349. C
  350. C IWORK(8) = Final value of exponent parameter used in tolerance
  351. C test for orthonormalization.
  352. C
  353. C IWORK(16) = Number of independent vectors returned from MGSBV.
  354. C It is only of interest when IFLAG=30 is obtained.
  355. C
  356. C IWORK(17) = Numerically estimated rank of the boundary
  357. C condition matrix defined from B*Y(Xfinal)
  358. C
  359. C **********************************************************************
  360. C
  361. C Necessary machine constants are defined in the function
  362. C routine R1MACH. The user must make sure that the values
  363. C set in R1MACH are relevant to the computer being used.
  364. C
  365. C **********************************************************************
  366. C
  367. C***REFERENCES M. R. Scott and H. A. Watts, SUPORT - a computer code
  368. C for two-point boundary-value problems via
  369. C orthonormalization, SIAM Journal of Numerical
  370. C Analysis 14, (1977), pp. 40-70.
  371. C B. L. Darlow, M. R. Scott and H. A. Watts, Modifications
  372. C of SUPORT, a linear boundary value problem solver
  373. C Part I - pre-assigning orthonormalization points,
  374. C auxiliary initial value problem, disk or tape storage,
  375. C Report SAND77-1328, Sandia Laboratories, Albuquerque,
  376. C New Mexico, 1977.
  377. C B. L. Darlow, M. R. Scott and H. A. Watts, Modifications
  378. C of SUPORT, a linear boundary value problem solver
  379. C Part II - inclusion of an Adams integrator, Report
  380. C SAND77-1690, Sandia Laboratories, Albuquerque,
  381. C New Mexico, 1977.
  382. C M. E. Lord and H. A. Watts, Modifications of SUPORT,
  383. C a linear boundary value problem solver Part III -
  384. C orthonormalization improvements, Report SAND78-0522,
  385. C Sandia Laboratories, Albuquerque, New Mexico, 1978.
  386. C H. A. Watts, M. R. Scott and M. E. Lord, Computational
  387. C solution of complex*16 valued boundary problems,
  388. C Report SAND78-1501, Sandia Laboratories,
  389. C Albuquerque, New Mexico, 1978.
  390. C***ROUTINES CALLED EXBVP, MACON, XERMSG
  391. C***COMMON BLOCKS ML15TO, ML17BW, ML18JR, ML5MCO, ML8SZ
  392. C***REVISION HISTORY (YYMMDD)
  393. C 750601 DATE WRITTEN
  394. C 890531 Changed all specific intrinsics to generic. (WRB)
  395. C 890831 Modified array declarations. (WRB)
  396. C 890921 Realigned order of variables in certain COMMON blocks.
  397. C (WRB)
  398. C 890921 REVISION DATE from Version 3.2
  399. C 891214 Prologue converted to Version 4.0 format. (BAB)
  400. C 900510 Convert XERRWV calls to XERMSG calls. (RWC)
  401. C 920501 Reformatted the REFERENCES section. (WRB)
  402. C***END PROLOGUE BVSUP
  403. C **********************************************************************
  404. C
  405. C
  406. DIMENSION Y(NROWY,*),A(NROWA,*),ALPHA(*),B(NROWB,*),
  407. 1 BETA(*),WORK(*),IWORK(*),XPTS(*)
  408. CHARACTER*8 XERN1, XERN2, XERN3, XERN4
  409. C
  410. C **********************************************************************
  411. C THE COMMON BLOCK BELOW IS USED TO COMMUNICATE WITH SUBROUTINE
  412. C BVDER. THE USER SHOULD NOT ALTER OR USE THIS COMMON BLOCK IN THE
  413. C CALLING PROGRAM.
  414. C
  415. COMMON /ML8SZ/ C,XSAV,IGOFXD,INHOMO,IVP,NCOMPD,NFCD
  416. C
  417. C **********************************************************************
  418. C THESE COMMON BLOCKS AID IN REDUCING THE NUMBER OF SUBROUTINE
  419. C ARGUMENTS PREVALENT IN THIS MODULAR STRUCTURE
  420. C
  421. COMMON /ML18JR/ AED,RED,TOL,NXPTSD,NICD,NOPG,MXNON,NDISK,NTAPE,
  422. 1 NEQ,INDPVT,INTEG,NPS,NTP,NEQIVD,NUMORT,NFCC,
  423. 2 ICOCO
  424. COMMON /ML17BW/ KKKZPW,NEEDW,NEEDIW,K1,K2,K3,K4,K5,K6,K7,K8,K9,
  425. 1 K10,K11,L1,L2,KKKINT,LLLINT
  426. C
  427. C **********************************************************************
  428. C THIS COMMON BLOCK IS USED IN SUBROUTINES BVSUP,BVPOR,RKFAB,
  429. C REORT, AND STWAY. IT CONTAINS INFORMATION NECESSARY
  430. C FOR THE ORTHONORMALIZATION TESTING PROCEDURE AND A BACKUP
  431. C RESTARTING CAPABILITY.
  432. C
  433. COMMON /ML15TO/ PX,PWCND,TND,X,XBEG,XEND,XOT,XOP,INFO(15),ISTKOP,
  434. 1 KNSWOT,KOP,LOTJP,MNSWOT,NSWOT
  435. C
  436. C **********************************************************************
  437. C THIS COMMON BLOCK CONTAINS THE MACHINE DEPENDENT PARAMETERS
  438. C USED BY THE CODE
  439. C
  440. COMMON /ML5MCO/ URO,SRU,EPS,SQOVFL,TWOU,FOURU,LPAR
  441. C
  442. C **********************************************************************
  443. C SET UP MACHINE DEPENDENT CONSTANTS.
  444. C
  445. C***FIRST EXECUTABLE STATEMENT BVSUP
  446. CALL MACON
  447. C
  448. C **********************************************************************
  449. C TEST FOR INVALID INPUT
  450. C
  451. IF (NROWY .LT. NCOMP) GO TO 20
  452. IF (NCOMP .NE. NIC+NFC) GO TO 20
  453. IF (NXPTS .LT. 2) GO TO 20
  454. IF (NIC .LE. 0) GO TO 20
  455. IF (NROWA .LT. NIC) GO TO 20
  456. IF (NFC .LE. 0) GO TO 20
  457. IF (NROWB .LT. NFC) GO TO 20
  458. IF (IGOFX .LT. 0 .OR. IGOFX .GT. 1) GO TO 20
  459. IF (RE .LT. 0.0) GO TO 20
  460. IF (AE .LT. 0.0) GO TO 20
  461. IF (RE .EQ. 0.0 .AND. AE .EQ. 0.0) GO TO 20
  462. IS = 1
  463. IF (XPTS(NXPTS) .LT. XPTS(1)) IS = 2
  464. NXPTSM = NXPTS - 1
  465. DO 13 K = 1,NXPTSM
  466. IF (IS .EQ. 2) GO TO 12
  467. IF (XPTS(K+1) .LE. XPTS(K)) GO TO 20
  468. GO TO 13
  469. 12 IF (XPTS(K) .LE. XPTS(K+1)) GO TO 20
  470. 13 CONTINUE
  471. GO TO 30
  472. 20 IFLAG = -2
  473. RETURN
  474. 30 CONTINUE
  475. C
  476. C **********************************************************************
  477. C CHECK FOR DISK STORAGE
  478. C
  479. KPTS = NXPTS
  480. NDISK = 0
  481. IF (IWORK(12) .EQ. 0) GO TO 35
  482. NTAPE = IWORK(12)
  483. KPTS = 1
  484. NDISK = 1
  485. 35 CONTINUE
  486. C
  487. C **********************************************************************
  488. C SET INTEG PARAMETER ACCORDING TO CHOICE OF INTEGRATOR.
  489. C
  490. INTEG = 1
  491. IF (IWORK(9) .EQ. 2) INTEG = 2
  492. C
  493. C **********************************************************************
  494. C COMPUTE INHOMO
  495. C
  496. IF (IGOFX .EQ. 1) GO TO 43
  497. DO 40 J = 1,NIC
  498. IF (ALPHA(J) .NE. 0.0) GO TO 43
  499. 40 CONTINUE
  500. DO 41 J = 1,NFC
  501. IF (BETA(J) .NE. 0.0) GO TO 42
  502. 41 CONTINUE
  503. INHOMO = 3
  504. GO TO 45
  505. 42 INHOMO = 2
  506. GO TO 45
  507. 43 INHOMO = 1
  508. 45 CONTINUE
  509. C
  510. C **********************************************************************
  511. C TO TAKE ADVANTAGE OF THE SPECIAL STRUCTURE WHEN SOLVING A
  512. C COMPLEX VALUED PROBLEM,WE INTRODUCE NFCC=NFC WHILE CHANGING
  513. C THE INTERNAL VALUE OF NFC
  514. C
  515. NFCC=NFC
  516. IF (IFLAG .EQ. 13) NFC=NFC/2
  517. C
  518. C **********************************************************************
  519. C DETERMINE NECESSARY STORAGE REQUIREMENTS
  520. C
  521. C FOR BASIC ARRAYS IN BVPOR
  522. KKKYHP = NCOMP*(NFC+1) + NEQIVP
  523. KKKU = NCOMP*NFC*KPTS
  524. KKKV = NCOMP*KPTS
  525. KKKCOE = NFCC
  526. KKKS = NFC+1
  527. KKKSTO = NCOMP*(NFC+1) + NEQIVP + 1
  528. KKKG = NCOMP
  529. C
  530. C FOR ORTHONORMALIZATION RELATED MATTERS
  531. NTP = (NFCC*(NFCC+1))/2
  532. KKKZPW = 1 + NTP + NFCC
  533. LLLIP = NFCC
  534. C
  535. C FOR ADDITIONAL REQUIRED WORK SPACE
  536. C (LSSUDS)
  537. KKKSUD = 4*NIC + (NROWA+1)*NCOMP
  538. LLLSUD = NIC
  539. C (SVECS)
  540. KKKSVC = 1 + 4*NFCC + 2*NFCC**2
  541. LLLSVC = 2*NFCC
  542. C
  543. NDEQ=NCOMP*NFC+NEQIVP
  544. IF (INHOMO .EQ. 1) NDEQ=NDEQ+NCOMP
  545. GO TO (51,52),INTEG
  546. C (DERKF)
  547. 51 KKKINT = 33 + 7*NDEQ
  548. LLLINT = 34
  549. GO TO 55
  550. C (DEABM)
  551. 52 KKKINT = 130 + 21*NDEQ
  552. LLLINT = 51
  553. C
  554. C (COEF)
  555. 55 KKKCOF = 5*NFCC + NFCC**2
  556. LLLCOF = 3 + NFCC
  557. C
  558. KKKWS = MAX(KKKSUD,KKKSVC,KKKINT,KKKCOF)
  559. LLLIWS = MAX(LLLSUD,LLLSVC,LLLINT,LLLCOF)
  560. C
  561. NEEDW = KKKYHP + KKKU + KKKV + KKKCOE + KKKS + KKKSTO + KKKG +
  562. 1 KKKZPW + KKKWS
  563. NEEDIW = 17 + LLLIP + LLLIWS
  564. C **********************************************************************
  565. C COMPUTE THE NUMBER OF POSSIBLE ORTHONORMALIZATIONS WITH THE
  566. C ALLOTTED STORAGE
  567. C
  568. IWORK(3) = NEEDW
  569. IWORK(4) = KKKZPW
  570. IWORK(5) = NEEDIW
  571. IWORK(6) = LLLIP
  572. NRTEMP = NDW - NEEDW
  573. NITEMP = NDIW - NEEDIW
  574. IF (NRTEMP .LT. 0) GO TO 70
  575. IF (NITEMP .GE. 0) GO TO 75
  576. C
  577. 70 IFLAG = -1
  578. IF (NDISK .NE. 1) THEN
  579. WRITE (XERN1, '(I8)') NEEDW
  580. WRITE (XERN2, '(I8)') KKKZPW
  581. WRITE (XERN3, '(I8)') NEEDIW
  582. WRITE (XERN4, '(I8)') LLLIP
  583. CALL XERMSG ('SLATEC', 'BVSUP',
  584. * 'REQUIRED STORAGE FOR WORK ARRAY IS ' // XERN1 // ' + ' //
  585. * XERN2 // '*(EXPECTED NUMBER OF ORTHONORMALIZATIONS) $$' //
  586. * 'REQUIRED STORAGE FOR IWORK ARRAY IS ' // XERN3 // ' + ' //
  587. * XERN4 // '*(EXPECTED NUMBER OF ORTHONORMALIZATIONS)', 1, 0)
  588. ELSE
  589. WRITE (XERN1, '(I8)') NEEDW
  590. WRITE (XERN2, '(I8)') NEEDIW
  591. CALL XERMSG ('SLATEC', 'BVSUP',
  592. * 'REQUIRED STORAGE FOR WORK ARRAY IS ' // XERN1 //
  593. * ' + NUMBER OF ORTHONOMALIZATIONS. $$' //
  594. * 'REQUIRED STORAGE FOR IWORK ARRAY IS ' // XERN2, 1, 0)
  595. ENDIF
  596. RETURN
  597. C
  598. 75 IF (NDISK .EQ. 0) GO TO 77
  599. NON = 0
  600. MXNON = NRTEMP
  601. GO TO 78
  602. C
  603. 77 MXNONR = NRTEMP / KKKZPW
  604. MXNONI = NITEMP / LLLIP
  605. MXNON = MIN(MXNONR,MXNONI)
  606. NON = MXNON
  607. C
  608. 78 IWORK(2) = MXNON
  609. C
  610. C **********************************************************************
  611. C CHECK FOR PRE-ASSIGNED ORTHONORMALIZATION POINTS
  612. C
  613. NOPG = 0
  614. IF (IWORK(11) .NE. 1) GO TO 85
  615. IF (MXNON .LT. IWORK(1)) GO TO 70
  616. NOPG = 1
  617. MXNON = IWORK(1)
  618. WORK(MXNON+1) = 2. * XPTS(NXPTS) - XPTS(1)
  619. 85 CONTINUE
  620. C
  621. C **********************************************************************
  622. C ALLOCATE STORAGE FROM WORK AND IWORK ARRAYS
  623. C
  624. C (Z)
  625. K1 = 1 + (MXNON+1)
  626. C (P)
  627. K2 = K1 + NTP*(NON+1)
  628. C (W)
  629. K3 = K2 + NFCC*(NON+1)
  630. C (YHP)
  631. K4 = K3 + KKKYHP
  632. C (U)
  633. K5 = K4 + KKKU
  634. C (V)
  635. K6 = K5 + KKKV
  636. C (COEF)
  637. K7 = K6 + KKKCOE
  638. C (S)
  639. K8 = K7 + KKKS
  640. C (STOWA)
  641. K9 = K8 + KKKSTO
  642. C (G)
  643. K10 = K9 + KKKG
  644. K11 = K10 + KKKWS
  645. C REQUIRED ADDITIONAL REAL WORK SPACE STARTS AT WORK(K10)
  646. C AND EXTENDS TO WORK(K11-1)
  647. C
  648. C FIRST 17 LOCATIONS OF IWORK ARE USED FOR OPTIONAL
  649. C INPUT AND OUTPUT ITEMS
  650. C (IP)
  651. L1 = 18 + NFCC*(NON+1)
  652. L2 = L1 + LLLIWS
  653. C REQUIRED INTEGER WORK SPACE STARTS AT IWORK(L1)
  654. C AND EXTENDS TO IWORK(L2-1)
  655. C
  656. C **********************************************************************
  657. C SET INDICATOR FOR NORMALIZATION OF PARTICULAR SOLUTION
  658. C
  659. NPS = 0
  660. IF (IWORK(10) .EQ. 1) NPS = 1
  661. C
  662. C **********************************************************************
  663. C SET PIVOTING PARAMETER
  664. C
  665. INDPVT=0
  666. IF (IWORK(15) .EQ. 1) INDPVT=1
  667. C
  668. C **********************************************************************
  669. C SET OTHER COMMON BLOCK PARAMETERS
  670. C
  671. NFCD = NFC
  672. NCOMPD = NCOMP
  673. IGOFXD = IGOFX
  674. NXPTSD = NXPTS
  675. NICD = NIC
  676. RED = RE
  677. AED = AE
  678. NEQIVD = NEQIVP
  679. MNSWOT = 20
  680. IF (IWORK(13) .EQ. -1) MNSWOT=MAX(1,IWORK(14))
  681. XBEG=XPTS(1)
  682. XEND=XPTS(NXPTS)
  683. XSAV=XEND
  684. ICOCO=1
  685. IF (INHOMO .EQ. 3 .AND. NOPG .EQ. 1) WORK(MXNON+1)=XEND
  686. C
  687. C **********************************************************************
  688. C
  689. CALL EXBVP(Y,NROWY,XPTS,A,NROWA,ALPHA,B,NROWB,BETA,IFLAG,WORK,
  690. 1 IWORK)
  691. NFC=NFCC
  692. IWORK(17)=IWORK(L1)
  693. RETURN
  694. END