A Fortran Program to determine diffusion constants

5
Com,wlm Bt Chemistry Vol. 5, No. 2-3, pp. 73-17, 1981 Printed in Gmal Britain lW74485/161BZ0?73-05SO2.03/0 Pergam0n Press Ltd. A FORTRAN PROGRAM TO DETERMINE DIFFUSION CONSTANTS ZOLTAN KovAcs Institute of Nuclear Research I-I4001 Debrecen, P.O. Box 51, Hungary and ISIY~~~N MEZEY East-Hungarian Design Company H-4002 Debrecen, P.O. Box 26, Hungary Ah&set-Diffusion of elements of ultramicro quantity produced in a metal target by high energy protons were studied. A program was written for a PDP-8 computer in FORTRAN-IV for the tabulation of the relationship describing the diffusion. Diffusion constants can be determined on the basis of the experimental data with this table. A procedure is described for summing an infinite series within known error bounds. INTRODUCTION Gasthermochromatography (Merinis & Bouissieres, 1961) is widely applied for the quick separation of car- rier-free isotopic mixtures present in ultra-micro con- centrations. This method has proved to be very quick and efficient for the elemental separation of isotopic mixtures resulting from spallation induced by high energy charged particle. The method has made possible on-line nuclear spectroscopic studies of some short-lived neutron-deficient isotopes (Gnpengiesser & Rudstam, 1973; Rudstam & Grapengiesser, 1973). Elements evaporated from the molten target at high temperature are deposited along the chromatographic column with decreasing temperature, in the form of their compounds of different oxidation degree, in the order corresponding to their adsorption enthalpy. Thereafter they can be separated under suitable experimental con- ditions (Bayer et al., 1978; Biichmann et aI., 1976) and even their thermodynamic properties can be studied (Steffen & Blchmann, 1978). EXPERIMENTALRBJLTS We studied the yield and gasthermochromatographic separation of elements developed in Ag target foils pre- viously irradiated with protons of 660MeV at the Joint Institute of Nuclear Research synchrocyclotron, Dubna (Novgorodov et al., 1980). During the gasthermoch- romatographic procedure the target of 10 to 15mg was melted, and it became of spherical shape. After the gasthermochromatographic procedure these droplets were dissolved layer by layer so that the diffusion mechanism might be studied (Kovacs et al., 1980). We have found that the experimental concentration distribution can be described well with the solution of the 2nd law of Fick for diffusion in a sphere towards the surface (except for a surface layer of 10 to 30 pm in the case of certain elements). Integration of the equation describing the concen- tration distribution gives the ratio of the material quan- tity remaining in the target after diffusion period I to the starting material quantity (m,): where a = (h/R*), R is the radius of the sphere and D is the diffusion constant. The value of m, can be determined experimentally (Kovacs et al., 1980) and so the value of D can be calculated from the results. Since the value of D cannot be determined explicitly from Eq. (l), evaluation can be carried out with the necessary accuracy only by a computer. This is parti- cularly true for small D values since a large number of terms has to be summed to reach proper accuracy. For instance the value of the diffusion constant for solid metals of high melting point is in the range of lOme to 10-‘Ocm’/s even at hinh temaeratures. This results in a very smait exponeniiajvalue’even in the case of a long diffusion period and a thin target. The equation describ- ing diffusion with conditions mentioned above has a similar form (Beyer & Novgorodov, 1976). For this reason it was particularly important to design a computer program for including a sufficient number of terms even for small E values while avoiding excessive calculation time. Our approach was to tabulate m, values as a function of II. From a known value of m, the value of n can be determined from the table and finally (as 7 and R are known) D can be calculated. MATHEMATICAL CONSIDEilATIONS Direct series summation cannot be applied to calculate the sum approximating a m, value, as the error caused by the omitted infinite number of terms of the sum, is hard to estimate. Therefore we have devised the follow- ing method for the summation of an infinite series with a given accuracy. The program tabulates m, over the range 1.0004.001 in 0.001 steos according to Ea. (11. The orocedure is to find an IY ialue throuih itera&, such-that the sum- mation of the series, yields an approximate value of the given m, within an accuracy of ? O.ooOl. The required accuracy of the approximation is the sum of the iteration error (c) and the summation error (cl). The accuracy of the summation can be estimated in the following way: When (Y = 0 than CAC Vol. 5, No. L&A 73

Transcript of A Fortran Program to determine diffusion constants

Page 1: A Fortran Program to determine diffusion constants

Com,wlm Bt Chemistry Vol. 5, No. 2-3, pp. 73-17, 1981 Printed in Gmal Britain

lW74485/161BZ0?73-05SO2.03/0 Pergam0n Press Ltd.

A FORTRAN PROGRAM TO DETERMINE DIFFUSION CONSTANTS

ZOLTAN KovAcs Institute of Nuclear Research I-I4001 Debrecen, P.O. Box 51, Hungary

and

ISIY~~~N MEZEY East-Hungarian Design Company H-4002 Debrecen, P.O. Box 26, Hungary

Ah&set-Diffusion of elements of ultramicro quantity produced in a metal target by high energy protons were studied. A program was written for a PDP-8 computer in FORTRAN-IV for the tabulation of the relationship describing the diffusion. Diffusion constants can be determined on the basis of the experimental data with this table. A procedure is described for summing an infinite series within known error bounds.

INTRODUCTION

Gasthermochromatography (Merinis & Bouissieres, 1961) is widely applied for the quick separation of car- rier-free isotopic mixtures present in ultra-micro con- centrations. This method has proved to be very quick and efficient for the elemental separation of isotopic mixtures resulting from spallation induced by high energy charged particle. The method has made possible on-line nuclear spectroscopic studies of some short-lived neutron-deficient isotopes (Gnpengiesser & Rudstam, 1973; Rudstam & Grapengiesser, 1973).

Elements evaporated from the molten target at high temperature are deposited along the chromatographic column with decreasing temperature, in the form of their compounds of different oxidation degree, in the order corresponding to their adsorption enthalpy. Thereafter they can be separated under suitable experimental con- ditions (Bayer et al., 1978; Biichmann et aI., 1976) and even their thermodynamic properties can be studied (Steffen & Blchmann, 1978).

EXPERIMENTAL RBJLTS

We studied the yield and gasthermochromatographic separation of elements developed in Ag target foils pre- viously irradiated with protons of 660MeV at the Joint Institute of Nuclear Research synchrocyclotron, Dubna (Novgorodov et al., 1980). During the gasthermoch- romatographic procedure the target of 10 to 15mg was melted, and it became of spherical shape. After the gasthermochromatographic procedure these droplets were dissolved layer by layer so that the diffusion mechanism might be studied (Kovacs et al., 1980).

We have found that the experimental concentration distribution can be described well with the solution of the 2nd law of Fick for diffusion in a sphere towards the surface (except for a surface layer of 10 to 30 pm in the case of certain elements).

Integration of the equation describing the concen- tration distribution gives the ratio of the material quan- tity remaining in the target after diffusion period I to the starting material quantity (m,):

where a = (h/R*), R is the radius of the sphere and D is the diffusion constant.

The value of m, can be determined experimentally (Kovacs et al., 1980) and so the value of D can be calculated from the results.

Since the value of D cannot be determined explicitly from Eq. (l), evaluation can be carried out with the necessary accuracy only by a computer. This is parti- cularly true for small D values since a large number of terms has to be summed to reach proper accuracy. For instance the value of the diffusion constant for solid metals of high melting point is in the range of lOme to 10-‘Ocm’/s even at hinh temaeratures. This results in a very smait exponeniiajvalue’even in the case of a long diffusion period and a thin target. The equation describ- ing diffusion with conditions mentioned above has a similar form (Beyer & Novgorodov, 1976). For this reason it was particularly important to design a computer program for including a sufficient number of terms even for small E values while avoiding excessive calculation time.

Our approach was to tabulate m, values as a function of II. From a known value of m, the value of n can be determined from the table and finally (as 7 and R are known) D can be calculated.

MATHEMATICAL CONSIDEilATIONS

Direct series summation cannot be applied to calculate the sum approximating a m, value, as the error caused by the omitted infinite number of terms of the sum, is hard to estimate. Therefore we have devised the follow- ing method for the summation of an infinite series with a given accuracy.

The program tabulates m, over the range 1.0004.001 in 0.001 steos according to Ea. (11. The orocedure is to find an IY ialue throuih itera&, such-that the sum- mation of the series, yields an approximate value of the given m, within an accuracy of ? O.ooOl.

The required accuracy of the approximation is the sum of the iteration error (c) and the summation error (cl). The accuracy of the summation can be estimated in the following way:

When (Y = 0 than

CAC Vol. 5, No. L&A 73

Page 2: A Fortran Program to determine diffusion constants

14 Z. KovAcs and I. MEZEY

Comparing the A = .y, (l/n’) exp (- rr*~*a) and B -

: (l/n*) series, it can be stated that the following n-1 relation is true for any n, a > 0

i.e. the corresponding elements of the B infinite series are the upper limits of the A series elements. Thus if for

a K>l 5 (l/n*)~l-E, then ~~,(l/nz)exp(-n2a’cr) n--l

will also approximate the infinite series limit (m,) with maximum E, accuracy because

2 “=~+,~exP(-n’*Za)<(,. -$ze,, so n-K+1 n

If the l error is set at 0.0001 and (6/a’) 5 (l/n’) = n-l

0.$@99, then M = 7233. This means that the summation of a maximum of M terms is sufficient to approximate any tabulated m, value with el accuracy. The maximum number of terms to be summed is determined by the least positive number which can be handled in the com- puter (in our case it was 10m6” = exp (- 1416)). Con- sequently exponents of the exponential terms of the series have to satisfy the following condition: - n2& 2 - P from that

where P = 1416. Theoretically the summation of the series can be con-

tinued up to the K = [(l/~)~(P/o)] term. This would mean a very large number of terms in the case of small a values (e.g. at (I = l.lO-’ it means 37878 terms to be summed), but this is unnecessary because after the summation of A4 terms the error is already smaller than the permitted E, value. If a has a higher value and K< M, the error resulting from the missing (M- K) terms in the sum is practically zero:

E’ <(M - K) lO-6’5 = l(P x 10P5 x 0.

Select value of P so that

c’ = (M - K) 1O-6’5 < M x IO-’ = O.lr,

from the relationship

P =-log Oh, $ ( > .

In this latter case the sum of the series will approximate the tabulated m, value with l.lr, rather than C, ac- curacy. Acceptance of this slight reduction in accuracy, which is practically permissible, saves significant com- puter time. For example, instead of the above mentioned 37878 terms only 2996 terms need to be summed.

Thus the number of terms to be summed for every tabulated value of m, is to be calculated by Eq. (2); the value of P is calculated from Eq. (3).

PROGRAM DRSCmON

The algorithm we have developed is presented in the form of a program listing in FORTRAN-IV for the PDP-8. Table 1 lists the mathematical symbols used in the text and the equivalent terms used in the programme listing.

The program to tabulate Eq, (I), consists of a main pro- gram and two subroutines (see Appendix). The run time with the given parameters for the specified tabulating range Cy, YA), step (DY) and accuracy (EPSl, EPS) was approximately two and a half hours.

As the PDP-8 uses only 6 significant digits, we had to start the summation of the series backward, i.e. on the least term. Summation in the order of increasing n would result in round-off to zero for terms having an index above a certain n value. This would result in neglecting a significant number of terms, particularly in the case of small (Y values when the convergence of the infinite series is slow.

The index bound KORA, which is necessary for the calculation of the AB value, is computed by the SUM- ING subroutine. This stores the sum of the l/n’ series into S(l), S(2), S(3), . . . , S(L), . . subtotals so that when the computer would add the actual term, already rounded off to zero, to the terms summed in the S(J) subtotal, it starts to sum in the S(J+ 1) subtotal. Sum- mation continues until it reaches the EPSl accuracy then it is carried out backward, in decreasing order of the n index from the K bound associated with the EPSl ac- curacy. When the backward sum does not reach the (1 - EPSl) value because of the rounding& error of the previous summation, the whole summation is repeated from the (K + 1) bound.

The actual SUM values approximating the (nY6)m,

value are computed with the SUMINF subroutine.

Table 1. List of mathematical symbols used in the text and their equivalent terms in the propam listing

t?athenaticel Equivalent terms in the program listing 8Ymbols

9, Y, YA, SUP KRP

6 ;ii2 m2.

SUM, SUMM. SUMU, SUML, RF’S, RPSM, RPSU,

RPSL

& AL. ALFI, ALFM. ALFl. ALFU, ALF&,

ALP KRP

6 EPS

Et EPSl

K KOR . KP KRP

M KORA

P AB

Page 3: A Fortran Program to determine diffusion constants

A FORTRAN program to determine diffusion constants 75

Iteration steps of the main program consist of four parts (Fig. 1).

First part. The first ALFl value of the (KRP)th term is the ALFM value associated with the (KRP-1)th term increased by 1.5 times the difference between ALFM values associated with the (KRP-l)th and (KRP-2)th terms (DALF). Knowing this, the SUMINF subroutine cal- culates the SUM total. If it is necessary, the ALFl value is increased with DALF until ALFU and ALFL values satisfying the following conditions are found:

value. As the figure shows, the error distribution of the iteration procedure was chosen to be asymmetric and for this reason the (6/r*) *(SUM) calculated from the ALFM value will approximate the tabulated value of Y with an error in the range of &(+ 1 * EPS). When the error due to the iterations and the above mentioned summation error (1.1 * EPSl), which results in a negative deviation from the value of Y, are added, the resulting

maximum tabulating error is i-I.O*EPS’ _ ,.l 8 EPSl

I ; this is = i

SUM (ALFU) < RPSL < SUM (ALFL). 0.0001 for the parameters used by us.

Arrows show the ranges where SUMS associated with the resultant ALFU and ALFL values are positioned on the figure.

As ALFM = 0 is associated with KRP = 1, calculation of the ALFl value associated with KRP = 2 requires that an estimated starting value (ALFI) must be given as an input parameter.

Second part. ALFU and ALFL values determined in the first part are modified with interval bisection in the appropriate direction so that RPSL < SUM (ALFU) < RPSM will be valid. During this procedure SUM (ALFL) can also approach the RPSU-RPSM range because if the result of the interval bisection should be larger than RPSM, this last result will be the new actual ALFL value.

In addition to Y and the associated ALFM values, the K index bound and the value of the ALFU-ALFM difference are also printed out in the table. The last one gives statistical information about the proper selection of EPS to determine the RPSL-RPSM and RPSM-RPSU ranges. The overlap of the ALFU-ALFM ranges asso- ciated with the (KRF’)th and (KRP-1)th SUM values causes uncertainty in the determination of the correct LY value because very close ALFM values are associated with the two adjacent tabulated SUM values. When overlapping becomes frequent, their number should be decreased by choosing a smaller EPS value. In our experience no significant number of overlapped ranges have been found with the given parameters.

REFERENCES

Third part. With interval bisections between the ALFU value determined in the previous part and the last actual ALFL value, a new ALFL value is calculated so that

RPSM <SUM (ALFL) < RPSU.

When SUM (ALFL) < RPSM is already valid, bisection of the intervals must be carried out with the above ALFL and with the ALFM value of the (KRP-1)th term.

Fourth part. The mean value of ALFL and ALFU determined in the previous parts defines the new ALFM

BBchmann, K., Matschoss, V., Rudolph, J., Steffen, A. t Tsalas, T. (1976), NucI. I&r. Methods 139,343.

Bayar, B., Novgorodov. A. F.. Votsilka, I. & Zaitseva, N. G. (1978), Radiochim. Radioanal. Lett. 35, 109.

Beyer, G.-I. & Novgorodov, A. F. (1976), ZfK-303, Rossendorf. Grapengiesser, B. & Rudstam, G. (1973) Radiochim. Acfa u), 85. Kovacs, Z., Adilbish, M., Kowalew, A., Novgorodov, A. F. C

gaitseva, N. G. (1980), J. Radioannl. Chem. 59, 157. Merinis, J. & Bouissieres, G. (I%]), Anal. Chim. Actu 25,498. Novgorodov, A. F., Adilbish, M., Zaitseva, M. G., Kowalew, A.

& Kovacs, 2. (1980), 1. Radioanal. Chem. 56, 37. Rudstam, G. L Grapengiesser, B. (1973), Radio&m. Acta 20,97. Stiffen, A. Br Richmann, K. (19783, Tczlanta 25,677.

WM(ALFM)-1JmEPSI I SUM(ALFM)

CD RPSL RPSM RPSU

& SUPOKRP) RPSL RPSM RPW

/ 1 \ / \ I I 1 \

I I SUP(KRP-1)

0 ’ SUML=SUM(ALFU) y

t 1 I I I I SUWJ=SUM(ALFL)

3

i LJA I qUML 1

(70 I SUW

‘I / / I I

k3 I

! I I

b-‘[ALFM=(ALFL+ALFU) no.51

XM(ALFM)-lJrEPS1 SUM(ALFM)

Fig. 1. Iteration steps of the main program.

0

ALFM =0

SJM(ALFt4) = $ 1

+ SUP(l)

RPSL=$V-.5eEPS)

RPSt++.5*EPS)

RPSU=$V+l5.EPS)

SUP(KRP)= Y

Page 4: A Fortran Program to determine diffusion constants

Z. Kovks and I. MEZEY

C=PIo/L. C C COYSTINT FOR YUBRUUllYL SUMING C

C IhIIlAL VALUE OF T4tlLE C

Yil. C C SlEP USED II1 THE TAHCE C

c “,:“.-tPS ILFPmrJ. SU**=t .LFI=-.aaa11

c c Its.“, P.C1*YETER FOR a”0RO”TlNe 3”YING, c TM S”***T*“N ““ST RE PCRF”**C” “IT” Ll_PW.O., c UNTIL THE au* RElE”E0 TN19 llP3 “ILUE C

RP0~C**“-CP.?,, S”*.YP* CALL S”“IHG~YYa.a”~,*“II,RNo,*~0F, CALL DITC ~MON,YoA”,MYE*Y, 1s=-1L061”~EPSL..ll*OYI) SOEI.S”RTIIR”ILOG~,G.))IPI aOFrSPRTI.RF*.LUC~,“.,,IPL *RITE ~3.5606~ *ON,*D*“,*“EIY,IRF.L4rN01ILsC,EPs1

L.I.II.0” c c F,RST S”*,rLF,cl., .ND * “.L”ES OF l,tlLC c

S”P~I,.SU”,C ALPfl,SO. DY~l~rO. I(PCI,II(OP. *HP=*

II!, DALF=,LLF*-ALFI~.L.5 )ILFI=LLFM

c c LINII “4LUE “F LCTUAL SUM wm1H I* Tl4E IARLE c

Y=*-D*

IF I*.Ll.rAl GO 1” “ODP t c OEFIHING OF ITCRAIIIIN INTERVIL FOR CALC”L.,,NG C OF ,CT”AL SUM C

11P3L=C*(l-EP3*.5, RPS”.C.“,CPS..5 RPSLl=C.~“*EPS*L.S~

C C LOWER LIMIT OF &LPI+& YILUE ,110 T”E CONJllGLTCD 9”M C

.LFL.u.FM s”rur5”w *LF”=*LFY *LF,=ALF”

C c CI*D*Nt OF “PPCR LIMIT OF LCPH. C l,lY ALFl=.LF,+DILF

&L=ILC L CALL L”“INF .LF”IALFI DLI”L.S”M IF (Su*.Ll.YPSL, 60 TO ,,,J

c C IF DIE NEED TO CONTlN”E 7”E SEhWCW FOR UPPER LIY,,. c T”E CALCULITED ALFl “lL”E ASS”WED THE WE* LWCR LIMIT C

LLFLHLF, s”*“Ia”* 00 70 ,110

C C AFTER PERFORMING THE LBOVL OPERATIOHS C a”YtlLFll < RPSL < S”M(LLF”, C C C 7HC WEXl ACTlOt Ia 1 SE.RCW FOR ,N ILF”, FOI) W,,CH C hE a”M 18 FOUMO IN THE HP.% - RPS” INrERVAL C ,113 AL=CALFL**LF”,“.5

CALL S”I4,NF

: OUAfNG INE 1fERITlON IHE ALP”, “,L”E C,N APPROLC” T,,E C RFSL - RPS” InfERYrL c

ALFL=hL S”*U~SL,* GO 70 Ill,

LO3 ILFLI.)IL 60 10 1113

r * C AFTER LBOVE OPERITIONS RPSC < SUM(ALFU, < RPSM C

: IHE HEX1 PROCEDURE IS TO FIND AN ALFL, FOR WclCH c THE S”Y 19 ,rlSIOE THE RPSM - RPB” 1HTERV.L c 4003

loa,

ALFUIIL SUML.S”II IF ~S”M”.GE.RPS”, to IF ~auw.w.~pam, 60 *LFL.~LCFU+*LFI,*.5 co 70 “0051

TO TO

0005 4001

i c T”E C,LC”C,TION OF 7°F NE*?4 YLLUE OF LLPYL &NO c TUE CON.J”GITEO 5”M

C C FILPING IlP ,W ““FFLR F”V PRELININ.“Y STOME OF T&ALE c 10 BE P~INlCO C

Page 5: A Fortran Program to determine diffusion constants

A FORTRAN program to determine diffusion constants

; RORt ICC”R.TE COHlROL dF I( YI‘UF “ITI RAC!t”ARD SWWIHG

; IMCHEASING THE K VALUE BlSEO ON THE CONTROL,

: IF NECESS’RY