You are on page 1of 5

Andrew Gross

10/26/2011
NucE 403 HW#4
a) Derive the finite difference form of the appropriate one-speed diffusion equation using
boundary conditions. Use 30 mesh points and equal mesh spacing.

One-speed diffusion equation for a uniform non-multiplying slab containing an arbitrary source
distribution:

() ()
Boundary Conditions:
() ()

The region is broken into 30 equally spaced mesh points:




Integrating over a mesh interval:

()()

()

()

()



Where:





1
1
2 /
1
+
+
A +
A

~
+
i
i i
x
i i
dx
d | | |
( )
1 ,
1
1
2
2 /
+
+
+

= A +
i i
i i
i i
D
D D
x D
i
i i
x
i i
dx
d
A

~

A
1
2 /
| | |
( )
1 ,
1
2
2 /


+
= A
i i
i i
i i
D
D D
x D
Andrew Gross
10/26/2011
Set of N-1 differential equations for N+1 unknowns:



Where:






Applying slab geometry, uniform mesh spacing, and the vacuum boundary conditions:



Therefore:




b) Write these equations in matrix form
[

]
[


]
( )
1
1
1 ,
1
+

A + A
|
|
.
|

\
|
A
+
=
i i i
i i
i i
D D
a
1
1
1
1
,
1
+

+
+
A + A
|
|
.
|

\
|
A
+
+
A
+
+ E =
i i i
i i
i
i i
a i i
D D D D
a
i
1
1
1 ,
1
+
+
+
A + A
|
|
.
|

\
|
A
+
=
i i i
i i
i i
D D
a
Andrew Gross
10/26/2011

]





c) Derive the steps necessary to solve this equation using the simultaneous relaxation method
Simultaneous Relaxation Method (SOR):



Substitution:


Rearranging:

()


Begin iteration loop by guessing initial flux

()

()

(
()
)


Iteration continues until:

()

()

()

(
()
)

()

()

()





Andrew Gross
10/26/2011

d) Write the necessary algorithm (flow chart) and corresponding computer code program. Input
should consist of slab thickness, diffusion coefficient, macroscopic absorption cross-section,
and source. Output should include a tabulation of the distance, the flux, and the source.

Flow Chart:





Matlab Code:
%Andrew Gross 10/28/11
%all values were given in class
a=30; %thickness
s=0.7; %arbitrary source
sigma_A=0.066; %aborption cross-section
diff_coef=0.9; %diffusion coefficient
epsilon=0.0001; %divergence criteria
N=a-1;
delta=a/N; %thickness between the meshes
delta_2=delta^2;

1
Input
a, D,


2
Guess Initial Flux

()

3

()
/


4
max (
()
-
()
)/
()
<
Loop to step 3
5
Print
x,
Andrew Gross
10/26/2011
flux=zeros(a,1); % flux values
B=-diff_coef/delta_2; % non diaganol terms
D=((2*diff)/deltasq) + sigmaA; % diaganol terms
max_flux=1; guess_flux=0; % flux values for iteration

i=0; j=1; % loop counter and iteration counter

while abs(max_flux-guess_flux)/max_flux > epsilon %loop for divergence
criteria
j=j+1;
for i=1:a
if i<=2 %calculating flux for edge of slab at begining
if i == 1
flux(i)=0;
else
flux(i)=(1/D)*(s-B*flux(i-1));
end

elseif i>28 %calculating flux for edge of slab at end (same
calculation as begining)
if i==29
flux(i)=(1/D)*(s-B*flux(i-1));
else
flux(i)=0;
end

elseif i>2 && i<=28 %calculating flux for middle part of slab
flux(i)=(1/D)*(s-B*flux(i-1)-B*flux(i+1));
end

if i>1
if flux(i)> flux(i-1)
max_flux=flux(i);
end

end
guess_flux=flux(i);

end

if j>a
break
end
end

flux %flux values at each mesh
plot(1:a,flux) %plot of flux values per mesh number
distance=disp(i) %measured distance of slab
Source=s %constant source throughout slab

You might also like