-
Notifications
You must be signed in to change notification settings - Fork 10
/
ORNL-TM-1933.txt
4162 lines (2437 loc) · 74.6 KB
/
ORNL-TM-1933.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
- -'1-. i.i i"
MASTE
OAK RIDGE NATIOEAS? LQQH'SRY
operated by
UNION CARBIDE CORPORATION
NUCLEAR DIVISION
for the
U.S. ATOMIC ENERGY COMMISSION
¥
ORNL- TM- 1933 7 = |
COPY ND-i 33
DATE - August 30, 1967
"MATEXP," A GENERAL PURPOSE DIGITAL COMPUTER PROGRAM FOR
SOLVING ORDINARY DIFFERENTIAL EQUATIONS
BY THE MATRIX EXPONENTIAL. METHOD
5. J. Ball R. K. Adams
ABSTRACT
MATEXP, a general purpose digital computer program, was
written for solving systems of ordinary differential equations
by the matrix exponential method. MATEXP has several advantages
over standard numerical integration routines. It gives virtually
exact solutions to constant-coefficient homogeneous equations
and to nonhomogeneous equations for which the forcing functions
are constant during the computation interval. The speed at which
the equations are solved and the accuracy of the solution are
essentially unaffected either by the degree of cross-coupling
of the equations or by whether or not the coefficient matrix is
nonsingular or that its eigenvalues are distinct.
The method has been extended to nonlinear equations and
equations with time-varying coefficients; this use is very
effective for engineering systems analysis problems.
NOTICE This document contains information of o preliminary nature
ond was prepared primarily for internal use at the Oak Ridge National
Laberatery. It is subject to revision or correction ond therefore does
not represent o final report.
LEGAL NOTICE
This report was prepored os on account of Government sponsered work. Meither the United States,
nor the Commission, nor any person acting on beholf of the Commission:
A. Mokes any warrenty or representation, expressed or implied, with respect te the accuracy,
completeness, or usefulness of rhe infermetion contained in this report, or that the use of
any information, cpparctus, mothod, or process disclosed in this report may neot infringe
privately owned rights; or
B. Assumes any liabilities with respact to the use of, or for domoges resulting from the use of
ony information, apporatus, method, or process disclosed in this report.
As used in the obove, "'person acting en behalf of the Commission' includes any employee or
contractor of the Commission, or employee of such contrector, to the extent that such employes
or confractor of the Commission, or employee of such contracter prepares, disseminates, or
provides access to, any information pursuant to his employment or controct with the Commission,
or his employment with such contractor.
‘CONTENTS
.Introduction.....l............-..C_..‘..t..l.llla..
Development of the Matrix Exponential Method
2.1 For Homogeneoué EquationsSeessseeescescceces
. 2.2 For Nonhomogeneous EqQuUatioOnSececssecsecacscas
2.3 Miscellaneous Features of the Matrix
Exponential..l.....l.l..l.........l.;...l
Description of MATEXP Program and Options
3.1 Basic Input Information........;...........
3,2 Alternative Methods of Generating the
Coefficient MatriX Accceececsccsescrccnns
3.3 Alternative Methods of Generating the
' Forcing Function Vector Zaeeeeeseeseesees
3.4 Methods for Solving Time-Varying-Parameter
| and Nonlinear Differential Equations.....
3.5 Spécial Forcing Function Subroutineés.esecese.
Sumnary and CONCIUSIONS e sssrerssnnsansesnsscanns
Appendix
5.1 Problems in_thé Evaluation of Exponéntial
Functions........................a;..;...
5.2 Detailed Description of ProgramsS.sececccesss
5.3 Fortran Listing of Programs..eccececscscsscss
Page
\O O O
11
13
13
15
16
19
20
27
28
28
30
13
1. INTRODUCTION
The matrix exponential method of solving differential equations
was first described to the authors by Prof: Henry Paynter of MIT,
who with his studentsl-3 developed this method into a practical
engineering tool. The basic technique was derived many years ago,
and even then it was an elegant method of obtaining exact solutions
for a set of constant coefficient, homogeneous differential equations.
The matrix exponential technique is ideally suited to digital
computation and is very simple to implemént, especially when compared
wifh most quadrature methods.
Ohly two persons besides Prof. denter have done extensive work
>
in this area. L. Pease” of Atomic Energy of Canada, Ltd., in-
dependently developed the method simultaneously with Paynter. The
work of Paynter and Pease formed the basis for our implementation
and, perhaps, refinement of the method, although the work of several
5-9
researchers established the rigor of the central technique.
J Suez, Automated Programming for Analog_Computers, M.S.
thesis, MIT, Aug. 1962.
2H.C.H. Lee, Some Finite Difference Models for Linear and
Nonlinear Control Studies Using Digital Computation, M.S. thesis,
MIT, Aug. 1962.
3H. M. Paynter and J. Suez, "Automatic Digital Setup and Scaling
of Analog Computers," Trans. ISA, 3, 55-64 (Jan. 1964).
hE. Artin, from O. Schreier and E. Sperner, Introduction to
Modern Algebra and Matrix Theory (1935); Translated from German,
Ch&lsea Publu CO., N-Yo’ 1951’ pp' 319‘320-
5L; Pease, DEEMS, A Fortran Program for Solving the First-=Degree
Coupled Differential Equations by Expansion in Matrix Series,
AECL-1898 (Oct. 1963, reprinted Feb. 1964).
6E. G. Keller, Mathematics of Modern Engineering, vol.Ill,
Mathematical Engineering, Wiley, N.Y., 1942, pp. 234-2L6.
TR Bellman, Introduction to Matrlx Analysis, McGraw-Hill, N.Y.
1960, pp. 165-173.
Ta
More recently, M. L. Liou of Bell Telephone Laboratories made 1mportant
contributions to the matrix exponentlal method. 10,11
Because this method can give virtually exact12 solutions to systems
of equations, it is of'considerable interest to most engineers engaged
in systems analysis, automatic control, and simulation. Also, systefis
engineers have long recognized that one essential difference between |
the analog computer and the digital computer is the:awkward (at best)
manner in which the digital macnine can performwintegration.‘ The
matrix exponential method, on}the‘other hand, requires the digital
computer to perform mainly matrix manipulations, which it can do in
a very straightforward and efficient manner.
The matrix exponential techniques have worked well for a large
general class of simulation problems which constitute the bulk of the
work in the systeme analysis>and automatic control fields. Indeed,
by use of the methods descrlbed in Sect. 3. k certain types of non-
linear equatlons can be solved as a natural exten51on of the basic
matrix exponential method.
8F, R. Gantmakher, Applications of the Theory of Matrices,
Interscience, N.Y., 1959, pp. 135-9 (translation of Russian
" original book: Theory of Matrices, 195k4). :
9L. A. Pipes, Applied Mathematics for Engineérs and Physicists,
24 ed., McGraw-Hill, N.Y., 1958, pp. 101-4,
Ly, 1. Liou, "A Novel Method of Evaluating Tran51ent Responses,
Proc. IEEE, 5u (1) 20-23 (Jan. 1966).
llF F. Kuo and J. F. Kaiser, eds., System Analy51s by Dlgltal
Computer, Wiley, .Y.,l966 pp. 99-129.
lE"Virtually exact" means that the solution can be calculated
to as great a precision as is desired, consistent with the precision
obtainable with & given computer word length. In other words, the
precision of the method is not necessarily limited by the convergence
of any approximate quadrature (integration) formula, simply because’
gquadrature is. not performed.
The matrix exponential meflhod has also been implemented and used
extensively in Fourier analyeis problems by simulating band-pass
fil‘c.e:rs.13’11L Instead of calculating correlation functions (and
subsequehtly their Fourier transforme) digital filtering can.be used
to obtain spectral density estimates and transfer functions from
noise data. Calculations using filtering technigues are of comparable
accuracy and typically more efficient than the conventional methods.
| MATEXP has also been used in a special technique to calculate the
sensitivities of the time response of a system to changes in parameter
values. 15 A descrlptlon of a subroutine which was written to
implement time response sensitivity caleulatlons is given in Sect.
5.2.3.
MATEXP has been developed and modified over a pefiod of several
~ years, and its present form reflects the considerable number of
helpful suggestions we have had from many people. We are particularly
grateful to Prof. H. M. Paynter.for first introducing us to the
method, and to Prof. T. W, Kerlin of the University of Tennessee,
and J. V. Wilson of ORNL for their help and encouragement.
2. DEVELOPMENT OF THE MATRIX EXPONENTIAL METHOD
2.1 For Homogeneous Equations
Consider the first-order scalar, linear, homogeneous differential
equation (with constant coefficient)
dx ' :
It + ax =0, - ) (1)
138. J. Ball, A Digital Filtering Technique for Efficient Fourier
Transform Calculations, ORNL-TM-1778 (July 1967).
lLLT. W. Kerlin and S, J. Ball, Experimental Dynamic Analysis of
the Molten-Salt Reactor Experiment, ORNL-TM-1647 (Oct. 1966).
Lo, oy, Kerlin, "Sensitivities by the State Variable Method,"
Simulation, 8(6), 337-345 (June 1967).
ra
whose solution is ‘ . o
x = e % (2)
o* '
An interesting characteristic of the solution is that, for any
time interval T, the value of x at the end of the interval is a
product of an exponential term e-aT_and the value of x at the beginning
of the interval, i.e.
X = € X, o (3)
This will be referred to as the "incremental solution.”
Now because & system of homogeneous linear equations of any
order can always be broken up into a set of first-order equations,
consider the following set of equations
dx : :
Lo x ta. x + a, X
dt 11 71 12 72 **** "1In "n’
dx2
TS %1 %1 *ag, Xy Foeees 8y X (4)
dx .
at "%t Tl Xp T overs By X
This array can be expressed compactly in matrix form as a first-
order, linear, homogeneous, matrix differential equation with constant
coefficients, i.e. | |
dX ' :
dt = AX 2 (5)
where X is the column vector of state variables Xi
50
33N'.... nfi
and A represents the coefficient matrix
all a]2 .o 08PN aln
a, a
A E 21 22 o e o0 98 a2n
anl an2 * &5 9 80 ann
This matrix equation has the solution
X, = X (6)
For a formal proof that Eq. (6) is the desired solution, the reader
is referred to Bellman.7 However, the following sinle proof is
somewhat less formal. First, if dX/dt = AX, then g{% = A.%% =
3 mx dt
AAX=4A" X; similarly, g;§-= a3 X, so that g—a-: A" x . (7)
dt dt
If Xt is expanded about zero in a Taylor's series,
x -x +F & | Lt ax . %
t 0 1! dt 21 th ' m! gt
t=0 t=0 t=0
With Eq. (7) substituted for the derivative,
2,2
At At
= +_ _+ * 8 9 80
S R Ty %o
or
At .
X, = ¢ X, (Q.E.D.) (8)
The "incremental solution" is
At |
Ko =€ %p (9)
A
where ¢ T, the matrix exponential, is defined analogously to the
scalar exponential as
32 3
eAT =1+ At + Légl—-+ ngl- + ..
X
4
in which I is the identity matrix
lOO .....O
Olo .88 89 O
0010 ... 0
*
O ..ll....ol
2.2 For Nonhomogeneous Equations
The matrix equation representing a system of first-order, constant
coefficient differemtial equations with nonzero forcing functions is
the nonhomogeneous equation
%=AX+Z, | (11)
where Z is the disturbanée, or forcing function,vector.
A general incremental solution of the ndnhomogeneous equation
as derived by Lioull is
C t+T R
AT A(t+'r)f =AT
= + ¢ . :
Xt+T € Xt € te _ ZT dt | (12)
An exact solution derived from Eq. (12) for the case where the
forcing function Z is constant over the interval t to t+7 is
At - AT -
Xt+T = ¢ Xt + (e -I)A th . (13)
It is important to note that the inverse of A need not be calculated
to evaluate Eq. (13) since
k! ?
10
2
= 7 :|:+-§':'E +£%T—L+
EAT}k-l
Kkl ?
o9 | k-1
Yy A (14)
k=1
Because this series is similar to that used to represent eAT,
the computer program can calculate the two required matrices
(c—:'}[\T-I)A-l series equals
concurrently, since the kth term of the
the (k-1)th term of the "' series times (7/k). In the MATEXP
program, the AT matrix is called the "C" matrix and the (EAT -I)A-l
matrix is called the "HP" matrix (in honor of H. Paynter).
At this point, two essential features of the matrix exponential
method are emphasized:
1. The exponential matrices can be computed by the series
approximation to nearly any,desired precision (typically,
1 part in 10° 1s specified for MATEXP calculations). Hence,
for homogeneous equations and for nonhomogeneous equations
in which the forcing functions remain constant over the
computation time interval, the solutions are virtually exact
solutions. _
2, The-solution vector can be updated successively»by a time
increment T by two matrix multiplications:
= +
XT- C XO HP ZO
XQT = C XT + HP 7.
eéc
If it i1s assumed that just one time increment value T‘iS
required, the C and HP matrices need to be evaluated only once.
An exact solution to the set of nonhomogeneous differential equations
can also be derived from Eq, (]12) for the case where the forcing |
function Z vqries linearly within the computation interval <.
In terms of the matrix exponential series approximations, the
.'.’
11
trapezoid forcing function incremental solution is
o0 _
A
AT 1.1 k-1
S zm)—) (hr)™" 2,
. k=1 .
20 () yk-1 |
T (et D)0 Ze4t ° | (15)4
k=1
C 11 : |
Liou = has also developed a recursive formula for accurate
approximations of continuous forcing functions which uses a Simpson's
rule approximation of the nonhomogeneous solution, Eq. (12), within
.the time interval =t:
At T 21 At/2 T
Xppr ™ € [Xt+6Zt]+3 € Zepcfo ¥ T Py (16)
As with the case of the step-wise varying forcing funétions, the
matrices required for Egs. (15) and (16) need to be evaluated just
once at the start. These features are not presently included in the
MATEXP code, but could readily be added as options. .
2.3 Miscellaneous Features of the Matrix Exponential
Since the matrix exponential prificiple has been a part of the
mathematical literature for many years, the matrix exponential has
had at least two other names: +the fundamental matrix, and the
transition matrix. Besides the series appfoximation method, an
9
analytical method is often used to calculate this matrix; however,
the eigenvalues of A and their eigenvectors must be calculated and
the initial condition vector must.be transformed by a matrix
comprised of the eigenvectors. It is emphasizéd-that the series
method used in MATEXP does not require that the coefficient matrix
be nonsingular (i.e., have a nonzero determinant) or that its
eigenvalues be distinct (a case where the analytical solution has
terms of the form te”" and cannot be expressed as the sum of
exponentials). The latter condition, which occurs in problems
where two time constants in a decay chain are egual, was one.of
12
the problems that Pease encountered in reactor burnup calculations -
that prompted him to develop the matrix exponential method.5
Another feature noted by Pease (but not included in MATEXP) is
that the average solution vector X could be obtained directly from
a matrix exponential type calculation,
From the mean value theorem,
T
X =%j' X, dt,
0
X can be obtained by integrating the equation for X in terms of C
and HP:
T T
= 1 1 [ 1
= = = = + .
X fot dt Tf cxo (HP) Zoj dt (17)
0 0
Term by term integration of the series approximations for C and
HP gives | '
. _ .
2 3
det='c I+§if—+'(§f) + A",f + ...|l=28P, (18)
o
and
; 2 |
fHPdt='12 "QI'TJ’E%JF A’f) T (19)
0 ,
The latter series, like the HP matrix calculation, could easily
be made concurrent with the other matrix exponential calculations.
The accuracy of MATEXP solutions, both in absolute terms and
compared with other methods, is difficult to estimate quantitatively
fér the general case. Even for those cases that are solved "exactly, "
the successive multiplications of the solution vector by the matrix
exponential naturally tend to accumulate errors. However, with
precise calculations of the C and HP matrices as recommended in the .
Appendix, Sect. 2.1, test cases have shown this error to be negligible
for large systems (L0 x LO), even after many thousands of updating
calculations. Lioull has developed an alternative method of évaluating
the C and HP matrices to a prescribed accuracy.
The nature of the matrix exponential method permits the use of
%
13
much larger computation time intervals 1 than would be feasible for
most numerical integration solutions. For constant-coefficient
equations and a given 1, it would be safe to assume that MATEXP would
be inherently mére accurate. As is usually the case, however, it
would be unwise to generélize about nonlinear equations. Nonlinear
solutions are discussed further in Sect. 3.4.
Eq. (20) gives a rough estimate of MATEXP so;ution times on the
IBM-7090 computer, assuming that a-negligible time is spent in the
peripheral subroutines:
Solution time(min) ® 3.0 x 1'66'(NE)2 NT , (20)
where NE is the number of equations, and NI is the number of
computation time intervals. For éxafiple, a 59 x 59 system run for
1000 time steps took 10 min, and an 8 x 8 run for 10,000 steps took
1.5 min., The solution time factor will vary from about 2 x 10-6 to
T x 10-6, depending on the amount of extra subroutine computation and
printout, and will be approximately halved for homogeneous equations.
The present "standard” version of the MATEXP program solves up
to 60th-order equations and uses about 22,000 words of‘core storage.
In a 32,000 word computer, the extra i0,000.words cafi be used for
special programming or storage, or the order of the equation’ can be
increased to about 80. Since, for larger probiéms, tape or other
slower storage devices would be required to calculate the matrix
exponential functions, the overall efficiency of the method would be
reduced. | |
Two other interesting, though perhaps purely academic, features
of the matrix exponential technique are that the solution timé
increment can be negative (allowing one to go backwards) and that the
A matrix can contain complex coefficients.
3. DESCRIPTION OF MATEXP FROGRAM AND OPTIONS
3.1 Basic Inpup Information
The MATEXP program was written with the intent that it should
be easy to use for a wide variety of differential equation problems.
1L
Unfortunately, as a program becomes more general, i.e. the more
options and special features the program has, it becomes more difficult
to explain the program and to use it for any given problem.
Consequently, any apparent awkwardness and complications in the
following discussion are due to a desire to make it general, and any
omissions are due to a desire to keep it simple.
The basic parts of the code are: +the main program, MATEXP; the
utility subroutine used for outputting, OUTPUT; and the subroutine
for calculating forcing(or disturbance)functions, DISTRB. To solve
linear, constant-coefficient differential equations that are
homogeneous (i.e. have no forcing functions) or which have only fixed
forcing functions, all the required data can be read'in>and no extra
programming is necessary. For equations of the form
%% = AX + 7,
the initial values of the X vector, the coefficient matrix A, and
the (fixed) disturbance vector 7 may be read in., Other information
required for each run is the following: |
1. number of equations,
2. initial time (or other independent variable),
3. compfitation time interval,
4., final time,
5. interval at which solution Vector X and disturbance vector z are
to be printed.
Since many elements of the coefficient matrix A are often zero,
only the nonzero elements need to be read in.. This makes it necessary
to identify each coefficient with its fow and column number. The
nonzero values of the initial condition and fixed disturbance vectors,
with theif row numbers, are read in similarly. |
Since successive runs might require no changes (or only a few)
in input data from the previous run, options are provided so that
only the altered data has to be read in. |
An option is also available whereby the last value of the X vector
from one run can be used as the starfing value of the succeeding run.
15
This option can be used if changes in the computation or printing.
interval are required in the middle of & solution or if certain
iteration or successive épproximation schemes are being used..
A complete description of the inputs and options 4is: given in
the Appendix, Sect. 5.
3.2 Alternative Methods of Generating the Coefficient Matrix A
Although the most straightforward method of inputting fifie
coeffiéien£ matrix 1s to read it in, very often it is advantageous
to have some or all of the elements calculated from system parameter
values. One option of MATEXP provides for this to be done by special
prbgramming on the first call of DISTRB.. An alternative is to use
an "algebra.table" routine developed by Kérlin and Lucius.16 This
routine calculates the matrix elements from‘input parameter values
without any specilal programming. The general expression uséd for
calculating an elemenf aij in terms of paramefiers Pk and their
exponents EkQ is
n1 Eo By . B3p Ep
E E E._ - E
11 o1 31
= 2 @& 8 + * 89 a & &
2, 5 ClPl P, P3 P CoPy P, 5 P +
or m n
a =) C, ;%fl | (21)
1] g .
1=1 k=1
A complete description of the program is given in reference 16.
Beside the fact that it is sometimes convenient to have the
coefficient matrix calculated by the computer, in some cases computer
computation is almost necessary to obtain accurate solutions. This
was the case fof one reactor dynamics calculation where the coefficients
were first carefully calculated on a 20-in. slide rule, then by the
machine. The difference in the steady-state solution for neutron
16T. W. Kerlin and J. L. Lucius, A Techniqpe'for Calculating
Frequency Response and its Sensitivity to Parameter Changes for Multi-
Variable Systems, ORNL-TM-1180 (June 1965).
16
level after a reactivity insertion was approximately a factor of 2.
3.3 Alternative Methods of Generating the Forcing Function Vector Z
When variable forcing functions are needed, a sfiecial program
must usually be written and included in DISTRB. Two‘special forcing
function subroutines have been written to simplify the programming:
DFG, for approximating arbitfafy functions; and TRIG, for approximating
variable transport lags. They are both described in Sect. 3.5.
For cases where the forcing function is a solution to an ordinary
diffefential equation, this equation can simply be added to the system
matrix, end an exact solution can be obtained. As an example, assume
that a sinuscidal forcing function is used to excite a damped spring-
mass system. The quadratic equation that describes the displacement
y of the mass with time is
2 - o
S¥ a4 vy =c sin (wt + ¢ | (22)
3t° dt C
where w is the frequency of the sinusoidal input (radians/time).
To arrange the equation in terms of first-order: derivatives, let
- 4y
xl' - dt J (23)
Xp 2 Y - (2k)
: 2 .2 B
Solving for d"y/dt" (or dxl/dt), we obtain
dx, |
T - bx, + ¢ sin (wt + ¢), (25)
and
dx
2
The equation for a pure oscillafor with frequency w is
2
d
Lo s=0- (e
17
- ds
If we let x3 = 3t and X, = ws, then
dx3'
x - —wx) (28)
dxLL
T - X3 e (29)
If the initial conditions of x_, and X) ‘are zero and -1, respectively,
3
then
sin wt , (30)
x3(t)
-cos wt . (31)
Xu(t)
. Thus éx3 could be substituted for ¢ sin (wt + @) in Eq.(25). The
required initial conditions of velocity xl(O) and displacement x2(0)
must also be specified.
The coefficient matrix for this example is
-a -b +c Ol
+1
A= 0 -
O 0 +w 0
If the sinusoidal input were introduced as a forcing functionm, it
would appear as a stair-step approximatiofi of a sine Wave, and the
accuracy of the solution would dépend on the accuracy of this
approximation. A comparison of the apfiroximate'and exact solutions
for a specific example is shown in Fig. 1. In the approximate
solution, a first-order extrapolation was uséd to approximate the
average value of the foréing function over the time interval.
In this example, the system has a natural frequéncy of 1.0
radian/sec and a damping factor of-0.25, and the driving sinusoid
has a frequency of 2.0 radians/sec. The computation interval of
0.5 sec for the afiproximatebcase gives about seveh cofipUtations
per cycle of the driving function. Figure 1 also shows the response
after a long time where the excellernt stability and accuracy of both
B ORNL DWG. 67-10215
1.0+ | ‘
S 1
Position - | N p] _ !
Xz 0 - ' ] T es [
| | | R Maximum error in
%\ ) Time (sec) approximate solution = 0.014
- Lk . ) .
™ Maximum error in initial transient ' Exact MATEXP solution
* .. approximate solution = 0.020 -
X Approximate solution, At = 0.5 sec
> : o ' :
. Fig. 1 - Comparison of Exact MATEXP and Approximate MATEXP
' . Solutions for Sinusoidal Input to Damped
- 1.0 3 o Spring-Mass System
19
solutions can be seen. This type of calculation is, historically,
very difficult to do wifih standard digital methods.l7.
3.4 Methods for Solving Time-Varying-Parameter and Nonlinear
Differential Equations
It was shown in Sect. 2 that the MATEXP method can provide exact
solutions to sets of constant-coefficient, homogeheous differential
equations and to nonhomogeneous equations for which the forcing
functions can be rebresentéd by stepwise-varying functions. oince
forcing functions are usually smoothly vérying,;the accuracy of the
solution would naturally depend on the accufacy of the stair-step
approximations.
Likewise, in the case of time-varying-parameter, or nonlinear,
equations, the variations in the coefficient matrix A can be
approximated by stepwise variations. For a variable A matrix, however,
the matrix exponentials (C and HP) would both have to be re-evaluated
at each computation interval. Although this may still be an efficient
method for low-order equations (~10 or less), it could be quite
time consuming for larger problems.
A more efficient method of solution is to modify, or "fudge;"
the forcing function vector so that it compensateé for the variation
in coefficients while the A, C, and HP matrices remain constant.
This is shown schematically in Fig. 2.
7R, A. Gaskill, "Fact and Fallacy in Digital Simulation,”
‘Simulation, 3 (5), 309 313 (Nov. 1965)
20
Nonlinear Equations N o
Z(t )= A = £(t,X) —> X(t) (Exact)
Z(t) Ay - X(t) (Approximate)
+
6A X 96'
L
Fig. 2. Approximate Solution Using Fudged Forcing Functions.
Each component of the fudged forcing-function vector is calculated
by adding all the coefficient perturbation quantities in the row. TFor
example, assume one row of the matrix equation is
S dx
1
where a l’ al3, and z, are variables and 810 is a constant.
Let _ '
ay (8) = (a))g * agy
and
—_ !
Then the equation can be rewritten .
)
|
+ 2 (t) + all xl + al3 x3 .
_
= Zf(t:x)
. |
| — +
7o = (811)0 ¥ * 2p % ¥ (813)4 X5
Again, the foreing function zf‘would'éctfially be smoothly varying,
but in the MATEXP difference equations, 1t is approximated by a
stair-step functlon.
21
For the case where the coefficients and/or the forcifig functions
are known functions éf time, much greater accuraéy*(for a givén
computation interval T) reéults.ffqm.using'approximate.mean values,
rather than initial values, of the functions in the computation
interval. First-order approximations of the mean values can be
obtained by evaluating the time-varying forcing functions and matrix
elements at (t + 7/2) instead of at (fi). First-order extrapolations
of the mean values of the solution vector X should also be used
where coefficients are functions of X, as shown in Fig. 3.
Straight-Line
Approximation
e
P time
Fig. 3. First-Order Extrapolation of Mean Values of z and x at (t+%),
The use of an auxiliary subroutine VARCO greatly simplifies the
programming required to use first-order extrapolation calculations to
find approximate mean values of the forcing function. VARCO is
described in detail in Sect. 5.2.
The only way of guaranteeing that the solution is accurate is to
reduce the computation interval T'fintil further reductions make no
significant difference in the solution. A simple, intuitive estimation
22
of the accuracy, however, may be obtained by noting the maximum amount
of change in the solution and coeff1c1ent values within a computatlon
interval. If these changes are only a few percent of the values of
the functions at the start of the interval, then the flrst-order