dbvsup.f 31 KB

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