Anda di halaman 1dari 19

cm,

D i go O

RODCON - A FINITE DIFFERENCE HEAT CONDUCTION COMPUTER CODE IN CYLINDRICAL COORDINATES* J. C. Conklin Session 5 OECD-NEA C o o r d i n a t i n g Group on Gas-Cooled F a s t Reactor Development 6 t h GCFR Heat T r a n s f e r S p e c i a l i s t s Meeting September 16, 1980

R e s e a r c h sponsored by t h e O f f i c e of Advanced Nuclear Systems and P r o j e c t s , U . S . Department of Energy, under c o n t r a c t W-7405-eng-2'S with t h e Union Carbide C o r p o r a t i o n . NOTICE: This document c o n t a i n s information of a preliminary nature. It is subject to revision or correction and therefore does not represent a final report. It is provided for the information of those attending the 6th G F C R Heat Transfer Specialist Meeting, sponsored by the O C - E Coordinating E DN A B acceptance of this a r t i c l e , the publisher or y recipient acknowledges the U.S. Government's right to retain a non-exclusive, royalty-free license in and to any copyright covering the article.

Prepared by the OAK RIDGE NATIONAL LABORATORY Oak R i d g e , Tennessee 37830 o p e r a t e d by UNION CARBIDE CORPORATION for the
DEPARTMENT OF ENERGY

RODCON - A FINITE DIFFERENCE HEAT CONDUCTION COMPUTER CODE IN CYLINDRICAL COORDINATES J. C. Conklin ABSTRACT RODCON, a finite difference computer code, was developed to calculate the internal temperature distribution of the fuel rod simulator (FRS) for the Core Flow Test Loop (CFTL). RODCON solves the implicit, time-dependent forward-differencing heat transfer equation in 2-dimensional (R9) cylindrical coordinates at an axial plane with user specified radial material zones and surface conditions at the FRS periphery. Symmetry of the boundary conditions of coolant bulk temperatures and film coefficients at the FRS periphery is not necessary. Introduction The need for calculating the internal temperature distribution of the fuel rod simulator (FRS) for the Core Flow Test Loop (CFTL) had been identified for a proposed design condition.1 nar flow conditions. Rod thermal conduction effects were particularly significant for bundle periphery rods at lamiThe multichannel, thermal-hydraulic code used at DRNL to calculate the subchannel fluid conditions was in error for the bundle periphery rocis, because the rod model for the subchannel code assumed symmetry of the boundary conditions at the rod outer radius. Preliminary coding2 developed by General Atomic (GA) to calculate the rod internal temperature distribution was inappropriate for the CFTL, since the computational model was developed for the fuel rod of GA and did not have a complete heat path in the azimuthal direction. RODCON was developed for an arbitrary number of internal material zones, an arbitrary number of subchannel connections with differing boundary conditions, and a complete circumferential heat conduction path. RODCON was written for any consistent set of units. The number of temperature nodes

-2-

in either radial or azimuthal direction can easily be increased tc improve the accuracy of the calculation at the expense of increased computer time. RODCON can easily be used for fuel rods or fuel rod simulators with indirectly or directly heated clad.

The time-dependent governing equation in cylindrical coordinates for heat transfer with constant physical properties is:

121
3r 2 r 3r

L-ifl , l i l +
r 2 30 2 c 3t t

subject tc the boundary conditions of

|I = 0 3 r = 0

(2)

"kf?

= h(T

-V

rad

The boundary condition at r = 0 is perhaps not the best assumption for the problem being considered, that is, large rod diametral temperature differences are likely to induce a temperature gradient at the rod center. However, this assumption of zero temperature gradient at the rod center must be made so that this problem is mathematically determinate. The radiant heat flux q , has been linearized and added to the convecIterations are necessary between another tive heat flux at the rod periphery. converge upon a surface temperature. A computational node is placed in the center of a material region at the midpoint between the azimuthal boundaries delineating a subchannel. This was done in order to be consistent with the COBRA modelling of the subchannel.

subroutine that calculates the radiant heat flux and RODCON in order to

-3-

Equation 1 is recast into a physical model form in which the heat flux entering a volume element must balance with the energy stored plus the energy generated. This results in an implicit in time and a forward

difference approximation in space, which has an associated error on the order of the node spacing. Hence, the capability for increasing the

number of nodes was included in RODCON in order to check on the accuracy of the model ing. The resulting coefficient matrix is banded with a bandwidth equal to the number of subchannels. symmetric. The matrix is also positive definite and

There are inherent numerical advantages of this structure, Only the upper half of the symmetric

and these were used in the coding.

matrix is stored in a compressed fashion, and then matrix manipulations are used to solve i h governing equations that take advantage of the "e unique nature of this banded, positive definite matrix. a code that minimizes storage and computation time. The result is

Code Requirements As stated previously, any consistent set of units can be used in RODCON. The necessary input to RODCON for each material region consists

of: 1) thermal conductivity, 2) density, 3) specific heat, k) contact conductance at outer region radius, 5) outer radius of region, 6) linear power of region, 7) film coefficient at rod periphery, 8) corresponding bulk fluid temperature at rod periphery and 9) included angle. The

number of radial nodes and number of subchannels must be specified in the coding. RODCON is written so that any modifications of program size need only be done in the driver or main subroutine (called RODCON) and one COMMON block called FUEL in which the geometry and physical constants are stored. Subroutine CONROD is the heart * f the code. . This subroutine estab-

lishes the finite difference coefficient mafix and then calls the subroutines that solve the resulting system of linear equations. were directly t^ken from the UNPACK User's Guide.3 These

numerical solving subroutines are SPBFA, SPBSL, SAXPY, and SDOT, which

-kThe coding presented in the appendix is being used in COBRA/CFTL, which is the subchannel analysis code under development at ORNL for use in the thermal-flow analysis of rod bundles. The suhroutine MORCON was

added to generate pseudo-rod internal volume elements and pseudosubchannel boundary conditions for the case in which only a fraction of a rod is included in a bundle segment. Also, the capability to double

or triple thr number of computational nodes in the azimuthal direction was added as a jser option. This option might be necessary in order to

reduce numerical errors when a very large diametral temperature difference exists across a rod. Most of the codip^ of subroutine RODCON communicates the subchannel fluid conditions of COBRA/CFTL and the rod internal temperatures calculated by CONROD. These communication statements can be appropriately

modified to link RODCON with any other subchannel analysis code.

-5-

Nomenciature

T r

- Temperature - Rod radius - Rod radius at rod periphery - Angle - Thermal diffusivity - Time - Thermal conductivity - Film coefficient or contact conductance - Radiant heat flux - Volumetric heat generation

e
a
4-1

k h
q

rad vol

References

1.

J . C. C o n k l i n , " A p p l i c a t i o n of COBRA*GCFR to the CFTL Bundle," CFTL 7S"71, presented at the 5th G F Heat Transfer Specialists Meeting, OECD-NEA CR Coordinating Group on Gas-Cooled Fast Reactor Development, Wuerenlingen, Switzerland, May 14-16, 1979C. B. Baxi and C. J . Burhop, "Importance of Circumferential Conduction in G F Assemblies and Introduction of Circumferential Conduction in CR the COBRA-GCFK Code, presented at the 5ch G F Heat Transfer Specialists CR Meeting, OECD-NEA Coordinating Group on Gas-Cooled Fast Reactor Development, Wuerenlingen, Switzerland, May 1416, 1979J . J . Dongarra, et a l . , "UNPACK User's Guide," Society f o r and Applied Mathematics, Philadelphia (1979). Industrial

2.

3.

-6-

SUBROUTINE CONROD (A, T, RHS, Q, QPRIME, QRAD, TB, OT, THETA, DT, 1 MSP1,MS,NDIM,NR) C DIMENSION IPVT(29) DIMENSION QRAD(l) DIMENSION T (1) ,Q (1),QPRIME (1) ,TB (1) ,HT (1) ,THETA(1) DIMENSION A(MSP1,1),RHS(1) CCMMON/FUEL/R (5),XK ( 5 ) , HGAP (4) ,CP (5),QPFRAC (5),RHO ( 5 ) , 1 FLX(55,50),PHI(8,7),RADIAL(3),D(8),P0WER,TREF,MSC,LR(S,7) DR(I)=0.5E0*(R(I)-R(I-D) DST(I,J)=(R(I-l)+DR(I))*{0.5E0*(THETA(J)+THETA(J+l))) DATA PI/3.141592S53539793EO/ DO 10 J=1,NDM D 10 I=1,MSP1 O 10 A(I,J)=G.E0 CRP1=R(1)*(1.EO/(R(1)AK(1)+DR(2)AK(2)+1.EO/HGAP(1))) CS=RHO (1)*PI*R (1 )*R (1)*CP(1) /OT CG=QPRIME (1) C WRITE(6,10210)CRPl,CS,CG C10210 FORMAT (' CRP1/CS/CG 1 ,3G15. 6) DO 20 J=1,MS CRP1T=THETA (J) *CRP1 C A(1,1)=CRP1T+A(1,1) A(MS+1,1)=CRP1T+A(MS+1,1) C 10 A(1,J+1)=-CRP1T 20 A(MS-J+1,J+1)=-CRP1T C 10 A(1,J+1)=-CRP1T A(MS+lr 1)=A(MS+1,1)+CS C A(1,1)=A(1,1)4CS RHS(1)=CS*T(1)-K:G C WRITE ( 6 , 1 0 0 1 2 ) ( A ( l , J ) , J = l , 8 ) , R H S ( l ) C10012 FORMAT (1H ,16F8.3) NRM1=R-1 DO 90 I=2,t>lRMl II=(I-2)*MS+1 CRM1=(I-1)*(1.EO/{DR(I-1)AK(I-1)+DR(I)AK(I)+1.EO/HGAP(I-1))) CRP1=R(I)*(1.EO/(DR(I)AK(I)+DR(I+1)/XK(I+1)+1.EO/HGAP(I))) CS=HO(I)*PI*(R(I)*R(I}-R(I-l)*R(I-l))*CP(I)Ani CG=QPRIME (I} / (2. EO*PI) DO 90 J=1,MS CRP1T=THETA (J) *CRPl IF(I.EQ.2)GOTO30 CRM1T=THETA (J) *CRM 1
GOTO40

30 CaMlT=-A(MS-J+l f J+l) 6 CRM1T=-A(1,J+1) 40 CONTINUE IF(J.EQ.l)GOTO50 CTM1= (R (I) -R (1-1)) *XK (I) /DST ( I , J - l )
GOTOfiO

-7-

50 CTM1=(R(I)-R(I-1))*XK(I)/ 1 ((R (1-1) +DR (I)} *0. 5E0* (THETA (1) +THETA (MS))) 60 IF(J.EQ.MS)GOTO70 CTP1= (R (I )-R (1-1)) *XK (I)/DST (I, J) JP1=O JM1=1 JP1=J+1 GOTO80 "70 CTP1=(R(I)-R(I-1))*XK(I)/ 1 ((R(I-l)+DR(I))*0.5E0*(THETA(l)+THETA(MS))) JPl=2-MS C JP1=1 80 CST=THETA(J)*CS CGT=THETA(J)*CG A (MS-KL, II+J)^CRPlT+CRMlT+CTPl+CTMl+CST A(II+J, II+J)=CRP1T4CRM1T+CTP14CTO1+CST A(MS+JP1, II+J+JM1)=-CTP1 A(II+J,II+JP1)=-CTP1 A(II+J, II+JMJ.)=-CTM1 A(1,II+J-K4S)=-CRP1T A(II+J,II+J+MS)=-CRP1T A(II+J,MAXO(1,II+J-MS))=-CRM1T RHS (II+J)=CST*T (II+J)4GT JJJ=MAX0 (1, II+J-MS) JJJJ=JJJ+14 WRITS (6,10012) ( A ( I I + J , J J ) f J J = a J J , J J J J ) , R H S (II+J) 90 CONTINUE II=(NR-2)*MS+1 CRM1=R (NR-1)*(1.EO/(DR (NR-1)/XK (NR-1) + 1 DR(NR)/XK(NR)+l.EO/HGAP([gR-l))) CS=HO (NR) *PI * (R (NR) *R (NR) -R (NR-1) *R (NR-1)) *CP (NR) /DT COQPRIME (fJR) / (2. E0 *PI) DO 140 J=1,MS CRPIT^HETA (J) *R (NR) * ( 1 . E0/ (DR (NR) AK (NR) +1. E0/HT (J) IF(J.EQ.MS)GOT0100 CTP1= (R (NR) -R (NR-1)) *XK (NR) /DST (NF, J) JP1=O JM1=1 JPl=a+l GOTO110 100 CTP1= (R (NR)-R (NR-1)) *XK (NR)/( (R (NR-1) + 1 OR (NR)) * 0 . 5E0* (THETA (1 )+THETA (fnS))) JP1=2-MS JM1=O JP1=1 110 IF(J.EQ.l)GOTOl20 CTO1= (R (NR)-R (NR-1)) *XK (NRJ/DST (NR, J - l )

C C C C C C C C

-8-

JM1=J-1 GOTO 130 120 CTM1=(R(NR)-R(NR-1))*XK(NR)/((R(NR-1) + 1 DR(NR))*0.5E0*(THETA(l)+THETA(MS))) 130 CST=THETA(J)*CS CGT=THETA(J)*CG A (MS+1, I I + J ) =CRP1T+CRM 1T+CTP1+CTM 1-tCST A ( I I + J , II+JJ^RPIT+CRMIT+CTPI+CTMI+CST A(MS+JP1, II+J+JMJ.)=-CTP1 A(II+J,II+JP1)=-CTP1 A(II+J,II+JMl)=-CTMl A(II+J,II+J-MS)=-CRM1T RHS (II+J)=CST*T (II+J )+CGT+CRPlT*T3 (J) LINEARIZE RADIANT HEAT TRANSFER AS IF HEAT SOURCE FOR INTERIM RHS ( I I + J ) =RHS (II+J)-QRAD(J) NEED TO CHECK ON SIGN CONVENTION FOR QRAD (SUBTRACT IF RADIANT HEAT LEAVES SURFACE)

C C C C C C C C C C C

J J J=MAX0 ( 1 , I I + J -MS) JJJJ=JJJ+14-J WRITE(6,10012) (A(II+J, J J ) , J J = J J J , J J J J ) ,RHS (II+.7) 140 CONTINUE C WRITE(6,10313)((A(I,J),1=1,MSP1),J=1,NDIM) C10313 FORMAT(1H , 29(8F13. 3 , / ) ) NMAX=(NR-1)*MS+1 CALL SP3FA(A,MSP1,!NMAX,MS,INFO) C CALL DECOMP(NDIM,Nr'1AX,A,COND,IPVT,WORK) IF (INFO. NE. 0) WRITE {ft, 10010) INFO C IF(COND.GE.l.E0)WRITE(5,10013)CO>JD C10013 FORMAT(f CONDITION NUMBER ' , G 1 3 . 6 ) CALL SPBSL(A,MSP1,NMAX,"1S,RHS) C CALL SOLVE (NDIM,N!vlAXf A, RHS, IPVT) DO 150 J = l , m A X 150 T(J)=RHS(J) DO 160 J=1,MS C DETERMINE IF SURFACE OR LINEAR HEAT FLUX IS DESIRED 160 Q(J)=(T((NR-2)*MS+1+J)-TB(J))/ C 40 Q (J) = (T ((NR--2) *MS+1 + J) -TB ( J ) ) *R (NR) *THETA (J) / 1 (0.5E0*(R(NR)-R(NR-l))AK(NR)+l.E0/HT(J)) RETURN 10010 FORMATC INFO ' , 1 5 ) END

-9-

SUBROUTINE RODCON (NROD,JX,TBLK,HTC,DFX,DT) COMMCN/FUEL/R(5) ,XK(5) ,HGAP(4) f CP(5) ,QPFRAC(5) ,RHO(5), 1 FLX(55,50),FHI(8,7),RADIAL(8),D(8),POWER,TREF,MSC,LR(3,7) C0MMCN/RAD/QR(55,50),1SF(55),HFA(550),IIS ( 5 5 0 ) , J J S ( 5 5 0 ) COMMCN/RADV/NSF, IRAD, ICON, NCONR, IFL, IJM COMMON/ICOMR/ICONR (8) DIMENSION ORAD(24) DIMENSION TBLK(1),HTC(1) C DIMENSIONS OF T,Q,RHS ARE NDIM=(MR-1)*MS+1 C DIMENSIONS OF HT,T3,THETA ARE MS=BANEWIDTH=?4AX NUMBER OF CHANMELS C LEADING DIMENSION OF A MATRIX=*1S+1 DIMENSION T(97),Q(97),HT(24),TB(24),THETA(24),QPRIME(5) DIMENSION A(25,97),RHS(97) C C LR(N,K) - THE NUMBER OF THE KTH SUBCHANNEL CONNECTED TO ROD N. C PHI(N,K) - THE FRACTION OF THE KTH SUBCHANNEL CONNECTED TO ROD N. C TBLK(I,J) - BULK TEMPERATURE OF SUBCHANNEL I AT AXIAL LOCATION J C DFLX(N,J) - HEAT FLUX FOR ROD N AT AXIAL LOCATION J C H S ( N , I , J ) - HEAT TRANSFER COEFFICIENT FOR ROD N, SUBCHANNEL CONNEC C AXIAL LOCATION J C C MUST USE CONSISTANT U N I T S ! ! ! ! ! DATA TWOPI/6.283185307E0/ C DEFINE NR AND ITHETA NOW. INPUT THEM LATER NR=3 ITHETA=1 C C MT=0 DO 280 N=1,NROD DF LX=DFX*RADIAL (N) M=0 DO 10 II=1 ; MSC I=LR(N,II) IF(I.EQ.0)GOTO20 M=M+1 THETA(II) =TWOPI *PHI (N, I I ) TB(II)=TBLK(I) HT(II)=HTC(I) C MUST LINEARIZE RADIANT HEAT FLUX AS LINEAR HEAT SINK (SOURCE) IN CLAD QRAD(II)=QR (II-tMT, JX) *R (NR)*THETA(II) C 10 CONTINUE 20 CONTINUE DO 30 I=l,tCONR IF (N. EQ. ICONR (I))GOTO50 30 CONTINUE C DO NOT CONSIDER CONDUCTION ON THIS ROD DO 40 J=1,M FLX(MT+J,JX)=DFLX

-10-

TSF (MT+J)=TB ( J ) + 2 7 3 . 40 CONTINUE MT=MT4M GOTO280 50 CONTINUE C CONROD NEEDS LINEAR HEAT FLUX FOR EACH INTERNAL RADIAL RING DO 60 1=1,NR 60 QFRIME (I )=DFLX*IWOPI*R (NR) *QPFRAC ( I ) MS=M IF(M.LT.5) CALL MCRCON (M,MS,THETA,HT,TB/QRAD)

moms
GO TO (70,80,100),ITHETA 70 CONTINUE MSPl=MS+l GO TO 120 80 CONTINUE
MS=2*MS0 MSP1=MS+1

DO 90 I=1,MSM1,2 THETA(MSP1-I)=THETA(MS0-I/2)/2.0 THETA(MS-I)=THETA(MSO-I/2)/2.0 HT(MSP1-I)=HT (MSO-I/2) HT (MS-I)=HT (MSO-I/2) TB(MSP1-I)=TB(MSO-I/2) TB (MS-I )=TB (MSO-I/2) QRAD(MSP1-I)=QRAD(MSO-I/2) QRAD (MS-I)=QRAD (MSO-I/2) 90 CONTINUE GO TO 120 100 CONTINUE MS=3*MS0 MSP1=MS+1

MSM2=MS-2 DO 110 I=1,MSM2,3 THETA(MSPl-I)=THETA(MS0-I/3)/3.0 THETA(MS-I)=THETA(MSO-I/3)/3.0 THETA(MSM1-I)=THETA(MSO-I/3)/3- 0 HT(MSP1-I)=HT (MSO-I/3) HT(MS-I)=HT (MSO-I/3) HT (MSM1-I )=HT (MSO-I/3) TB (MSP1-I )=TB (MSO-I/3) TB(MS-I)=TB(MSO-I/3) TB (MSM1-I)=TB(MSO-I/3) QRAD(MSP1-I)=QRAD(MSO-I/3) QRAD(MS-I)=QRAD (MSO-I/3) QRAD(nS41-I)=QRAD(MSO-I/3) 110 CONTINUE 120 CONTINUE

-11-

NDIf4=(NR-l)*MS+l DO 130 I=1,NDIM 130 T ( I ) = 0 . E 0 C CALCULATIONS C CALL CONROD(A, T,RHS, Q,QPRIME,QRAD/iIB,HT/THETA,Dr,MSPl/MS#NDF4,NR) C ISTRT=NDIf4-MS+l C WRITE(S,lC010)T(l),(T(I),I=ISTRT,NDL*4) C10010 FORMAT (1H , F 1 0 . 3,7 (3F10. 3 , / ) ) C WRITE ((">, 10010 )T ( 1 ) , (T ( I ) , 1=2, NDIM) C10010 FORMAT (1H , "TEMPS ' , / , F 1 0 . 2 , / , 5 ' 7 F 9 . 1 , / ) ) GO TO ( 1 3 0 , 1 4 0 , P t t ) , ITIIETA 3 40 CONTINUE DO 150 I=1,MS,'41,2 150 Q (1/2+1)= (Q (I ) + 'j (1+1)) / 2 . EO GO TO 180 160 CONTINUE
DO 170 I=1,M.SM2#3

Q (1/3+1 )= (Q (1 )+g (I +1) n (1+2)) / 3 . EO 170 CONTINUE 180 CONTINUE 190 CONTINUE 200 CONTINUE QS=O. PHIT=0. DO 125 J=1,M QS=QS+ (Q (J) +QRAD (J) / (R (MR) *THETA ( J ) ) ) *PH I (N, J ) 125 PHIT=PHIT+PHI(N,J) IF(DFLX.EQ.0)GO TO 127 QS=QS/(PHIT*DFLX) DO 126 J=1,M 126 Q(J)=Q(J)/QS GO TO 129 127 CONTINUE QS=QS/PHIT DO 128 J=1,M 128 Q(J)=Q(J)-QS 129 CONTINUE DO 270 J=1,M FLX(MT+J,JX)=Q(J) TSF(MT+J)=T3(J)+Q(J)/HT(J)+273. 270 CONTINUE MT=f4T+M 280 CONTINUE C IF(MT.CT.NSF)CALL ERROR RETURN END

-12-

SUBROUTINE MORCON (M, MS, THETA, HT,TB, QRAD) DIMQ4SION THETA {1), HT (1) ,TB ( i ) , QRAD (1) DATA P I / 3 . 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3 E 0 / GO TO ( 1 0 , 2 0 , 4 0 , 6 0 ) , M 10 WRITE(6,10010) RETURN C ASSUME 60 DEG SW1ETRY 20 MS=8 THETA(3)=(2.E0*PI- (THETA(1)+THETA(2)))/6.EO DO 30 I=3,MS THETA(I)=THETA(3) HT(I)=HT(MOD(I,2)+1) TB(I)=T3(MOD(I,2)+1) QRAD (I )=3RAD (MOD ( 1 , 2 ) + l 1 30 CONTINUE RETURN 40 MS=6 DO 50 1 = 1 , 3 THETA(7-I)=THETA(I) HT(7-I)=HT{I)

TS(7-I)=T3(I) QRAD(7-I)=QRAD(I) 50 CONTINUE


RETURTvI 60 MS=8 DO 70 1 = 1 , 4 THETA ( 9 - 1 )=THETA(I) HT ( 9 - 1 )=HT ( I ) TB(9-I)=T3(I) QRAD(9-I)=QRAD(I) 70 CONTINUE RETURN 10010 FORMAT (' ERROR . ONE CHANNEL PER ROD ') END

-13-

SUBROUTINE SPBFA(ABD, LDA, N,M,INFO) INTEGER LDA,N,M,INFO REAL ABD(LDA,1)

c c c c c c c c c c c c c
r

SP3FA FACTORS A REAL SYMMETRIC POSITIVE DEFINITE MATRIX STORED IN BAND FORM. SPBFA I S USUALLY CALLED BY SPBCO, BUT I T CAN 3 E CALLED DIRECTLY WITH A SAVING IN TIME I F RCOND I S NOT NEEDED. ON ENTRY

ABD

REAL(LDA, N) THE MATRIX TO BE FACTORED. THL COLIMMS OF THE UPPER TRIANGLE ARE STORED IN THE COLUMNS OF ABD AMD THE DIAGONALS OF THE UPPER TRIANGLE ARE STORED IM THE ROWS OF ASD . SEE THE COMMENTS 3ELOW FJR DETAILS. INTEGER THE LEADING DIMENSION OF THE ARRAY LDA MUST 3 E . G E . M + I . INTEGER THE ORDER OF THE MATRIX

c c c c c c c c c c c c c c c c c c c c c c c c c c c c c

LDA

ABD .

A .

INTEGER THE NUMBER OF DIAGONALS ABOVE THE MAIN DIAGONAL. 0 .LE. M .LT. N .

ON RETURN ABD

AN UPPER TRIANGULAR MATRIX R , STORED IN BAND FORM, SO THAT A = TRANS(R)*R .


INTEGER = 0 FOR NORMAL RETURN. = K I F THE LEADING MINOR OF ORDER POSITIVE DEFINITE.

INFO

I S NOT

BAND STORAGE I F A I S A SYMMETRIC POSITIVE DEFINITE BAND MATRIX, THE FOLLOWING PROGRAM SEGMENT WILL SET UP THE INPUT. M = (BAND WIDTH ABOVE DIAGONAL) DO 20 J = 1 , N I I = MAX0(l, J-M) DO 10 I = I I , J K = I-J^M+1 ABD(K,J) =

-14-

C C C C C C

10 CONTINUE 20 CONTINUE UNPACK. THIS VERSION DATED 0 8 / 1 4 / 7 8 . CLEVE MOLER, UNIVERSITY OF NEW MEXICO, ARGONNE NATIONAL LAB.

C C C C C C C

SUBROUTINES AND FUNCTIONS BLAS SDOT FORTRAN MAX0,SQRT INTERNAL VARIABLES REAL SDOT,T REAL S INTEGER IK,J,JK,K,MU BEGIN BLOCK 'WITH . . . E X I T S TO 40

C C C

10 20 C

30 40

DO 30 J = 1 , N INFO = J S = 0.0E0 IK = H + 1 JK = MAX0(J-M,l) M = MAXQ(M+-2-J,l) U I F (M .LT. MU) GO TO 20 DO 10 R = MU, M T = A3D(K,J) - SDOT(K-MU,ABD(IK,JK),l,ABD(MU,J) r l) T = T/ABL 'M+l, JK) ABD(K,J) = T S = S + T*T IK = IK - 1 JK = JK + 1 CONTINUE CONTINUE S = ABD(M+1,J) - S EXIT IF (S .LE. 0.0E0) GO TO 40 ABD(M+1,J) = SQRT(S) CONTINUE INFO = 0 CONTINUE RETURN END

-15-

SUBROITTINE SPBSL(ABD,LDA,N,M,B) INTEGER LDA,N,M REAL A B D ( L D A , 1 ) , B ( 1 ) C C C C C C C C C C C C C Z C C C C C C C C C C C C C C C C C C C C SPBSL SOLVES THE REAL SYMMETRIC POSITIVE DEFINITE BAND SYSTEM A*X = B USING THE FACTORS COMPUTED BY SPBCO OR SPBFA. ON ENTRY ABD REALfLDA, N) THE OUTPUT FROM SPBCO OR SPBFA. INTEGER THE LEADING DIMENSION OF THE ARRAY INTEGER THE ORDER OF THE 'MATRIX

LDA

ABD .

A .

INTEGER THE NUMBER OF DIAGONALS ABOVE THE >4AIN DIAGONAL. REAL(N) THE RIGHT HAND SIDE VECTOR.

ON RETURN B THE SOLUTION VECTOR X .

ERROR CONDITION A DIVISION BY ZERO WILL OCCUR IF THE A ZERO ON THE DIAGONAL. TECHNICALLY SINGULARITY BUT I T I S USUALLY CAUSED ARGUMENTS. IT WILL NOT OCCUR IF THE CORRECTLY AND INFO . E Q . 0 . INPUT FACTOR CONTAINS THIS INDICATES BY IMPROPER SUBROUTINE SUBROUTINES ARE CALLED

C C C
C C C C C C C

TO CCMPUTE INVERSE (A) * C WHERE C IS A MATRIX WITH P COLUMNS CALL SPBCO(ABD,LDA,N,RCOND,Z,INFO)


I F (RCOMD I S TOO SMALL .OR. INFO . N E . 0 ) GO TO . . . DO 10 J = 1 , P CALL S P B S L f A B D , L D A , N , C ( 1 , J ) ) 10 CONTINUE LINPACK. THIS VERSION DATED 0 8 / 1 4 / 7 8 . CLEVE MOLER, UNIVERSITY OF NEW MEXICO, ARGONNE NATIONAL LAB.

C C

SUBROUTINES AND FUNCTIONS

-16-

C C C C C

BIAS SAXPY,SDOT FORTRAN MINO INTERNAL VARIABLES REAL SDOT.T INTEGER K,KB,LA,LB,LM

C C C

SOLVE TRANS(R)*Y = 3 DO 10 K = 1 , N LM = MINO(K-1,M) LA = M + 1 - LM LB = K - LM T = SDOT(L^,ABD(LA,K),1,B(LB) , 1 ) B(K) = (B(K) - T)/ABD(M+l r K) 10 CONTINUE

C C C

SOLVE R*X = Y DO 20 KB = 1 , N K = N + 1 - KB LM = MIMO(K-1,M) LA = M + 1 - LM LB = K - LM B(K) = B(K)/ABD(M+1,K) T = -B(K) CALL S A X P Y ( L M , T , A B D ( L A f K ) , l , B ( L B ) , l ) 20 CONTINUE RETURN END

-17-

SUBROUTINE SAXPY (N, SA, SX, INCX, SY, INCY) C C C C C CONSTANT TIMES A VECTOR PLUS A VECTOR. USES UNROLLED LOOP FOR INCREMENTS EQUAL TO ONE. JACK DONGARRA, LINPACK, 3 / 1 1 / 7 8 . REAL S X ( 1 ) , S Y ( 1 ) , S A INTEGER I,INCX, INCY,IX,IY,MMP1,N C IF(N.LE.O)RETURN IF (SA . E Q . 0 . 0 ) RETURN IF (INCX. EQ. LAND. INCY. EQ.1)GO TO 20 C C C CODE FOR UNEQUAL INCREMENTS OR EQUAL INCREMENTS NOT EQUAL TO 1 IX = 1 IY = 1 IF (INCX. L T . 0 ) I X = (-N+1)*INCX + 1 IF(INCY.LT.O)IY = (-N+1)*INCY + 1 DO 10 I = 1,N SY(IY) = SY(IY) + SA*SX(IX) IX = IX + INCX IY = IY + INCY 10 CONTINUE RETURN C C C C C C CODE FOR BOTH INCREMENTS EQUAL TO 1

CLEAN-UP LOOP 20 M = MOD(N,4) I F ( M .EQ. 0 ) GO TO 40 DO 30 I = 1,M SY(I) = S Y ( I ) + SA*SX(I) 30 CONTINUE IF( N . L T . 4 ) RETURN 40 MP1 = M + 1 DO 50 I = MP1,N,4 SY(I) = S Y ( I ) + SA*SX(I) SY(I + 1) = SY(I + 1) + SA*SX(I + 1) SY(I + 2} = SY(I + 2) + SA*SX(I + 2) SY(I + 3) = SY(I + 3) + SA*SX(I + 3) 50 CONTINUE RETURN END

-18-

REAL FUNCTION SDOT (N,SX, INCX,SY, INCY) C C C C C FORMS THE DOT PRODUCT OF TWO VECTORS. USES UNROLLED LOOPS FOR INCREMENTS EQUAL TO ONE. JACK DONGARRA, LIN'PACK, 3 / 1 1 / 7 8 . REAL SX(1),SY(1),3TEMP INTEGER I,INCX,INCY,IX,IY,M,MP1,N C STEMP = 0.0EO SDOT = 0.0E0 I F (N.LE.O) RETURN IF (INCX.EQ.1. AND.INCY.EQ.1)GO TO 20 C C C C CODE FOR UNFQUAL INCREMENTS OR EQUAL INCREMENTS NOT EQUAL TO 1 IX = 1 IY = 1 IF(INCX.LT.O)IX = (-M+1)*INCX + 1 IF(INCY.LT.O)IY = (-N+1)*INCY + 1 DO 10 I = 1,N STEMP = STEMP + SX(IX)*SY(IY) IX = IX + INCX IY = IY + INCY 10 CONTINUE SDOT = STEMP RETURN C C C C C C CODE FOR BOTH INCREMENTS EQUAL TO 1

CLEAN-UP LOOP 20 M = M0D(N,5) I F ( M .EQ. 0 ) GO TO 40 DO 30 I = 1,M STEMP = STEMP + SX(I)*SY(I) 30 CONTINUE I F ( N .LT. 5 ) GO TO 60 40 MP1 = M + 1 DO 50 I = M P 1 , N , 5

STEMP = STEMP + SX(I)*SY(I) + SX(I + 1)*SY(I + 1) + * SX(I + 2)*SY(I + 2) + SX(I + 3!*SY(I + 3) + SX(I + 4)*SY(I + 4) 50 CONTINUE 60 SDOT = STEMP RETURN END

Anda mungkin juga menyukai