DG - Numeical solution of the neuton diffusion equation Y. Danon Daft: /6/09 Oveview A simple numeical solution of the neuton diffusion equation in one dimension and two enegy goups was implemented. Both fast and themal fluxes, and the multiplication facto of the system ae solved fo. The implementation allows to divide the geomety to seveal egions and use diffeent meshing (numbe of gid points) in each egion. One example is a coe and eflecto, whee the themal flux peaking in the eflecto can be obseved. The teatment of the diffusion tem (Laplacian) allow geomety of slab, semi-cylinde and sphee.. Histoy The deivation and code wee developed as a final poject fo senio undegaduate couse in numeical computing that I took back in 988. The oiginal code was witten in Pascal (specifically Tubo Pascal) which was an upcoming pogamming language at that time. Late I used it in Physics of Nuclea Reacto couse at RPI as an example fo a numeical solution of the diffusion equation. The at pat of HW poblem the solution was compaed to simple analytic poblems. fo implementation in the couse tt was ewitten in MathCad and JavaScipt. The document is povided as a documentation of the methods used in the implementation. Solution method We stat by using the one dimension (-D) two goup (-G) diffusion equations deived in the class notes: Fast: D φ + Σ R φ = k (ν Σ f φ + ν Σ f φ ) () Themal: D φ + Σ a φ = Σ s φ () The oveall appoach was descibed in the class notes and will be epeated hee. Fo convenience we fist wite the equations using opeatos: We also define the souce tem as: L = D + Σ R (3) L = D + Σ a (4) S = ν Σ f φ + ν Σ f φ (5) S = Σ s φ (6)
The diffusion equations can be ewitten as:. Iteations L φ = k S (7) L φ = S (8) The method of solution is a vaiation of the simple souce iteation (also known as powe method). This is an iteative solution solves fo the multiplication facto k and the flux shapes φ () and φ (). Since this is a -D solution, we divide the spatial diection to N nodes (o N intevals) fom 0 to N. If needed the extapolation length can easily be added by making the coe size lage.. Guess an initial solution (iteation zeo) k 0, φ () 0 and φ () 0. Set iteation index i = 3. Calculate S i using S i = ν Σ f φ i + ν Σ f φ i 4. Solve fo φ () i using L φ i = S i k i 5. Calculate S i using S i = Σ s φ i 6. Solve fo φ () i using L φ i = S i 7. At this point we have new fluxes φ () i and φ () i 8. To solve fo k i use L φ i = S i k i and note that by integation we get: N k i 0 S i = () N k i 0 S i () (9) 9. Using the values fo iteation i the pocess can epeat fom step 3 until some convegence citeia is met. in this implementation we use: ki k i 00 < ɛ (0) k i Whee ɛ is a convegence citeia on k (fo example 0. %). Diffeence equation Now that the iteation pocess is defined a method to solve fo the spatial flux distibution is needed. This so called diffeence equation will solve the flux in equations 7 and 8. Fist wite a geneic -D diffusion equation: The leakage tem in -D can be witten as: D φ() + Σ a ()φ() = S() () D φ() = ρ [ d ( ρ D() dφ() ) ] ()
In this notation ρ = 0 is a slab, ρ = esembles infinite cylinde (z-axis is missing), and ρ = is fo a sphee. The poblem is defined between 0 a and the egion is divided to N nodes (N bins) such that the bin width is k = k+ k (k = 0..N ). Note that the bin widths ae not necessaily equal which povides some flexibility in the geomety desciption. Equation can thus be witten: d ( ρ D() dφ() ) = (Σ a φ() S()) ρ (3) To get a diffeence equation we integate fom k to k+ In this case k =,,..., N, we will deal with the bounday conditions of k = 0 and k = N in the next section. In this notation we use k+ = k + k and k ρ D() dφ() = k k k+ ρ D() dφ() k The ight tem is appoximated as constant in each bin: = k+ k (Σ a φ() S()) ρ (4) k+ k (Σ a φ() S()) ρ (Σ a ( k )φ( k ) S( k )) ρ k k k (5) fo the deivatives in 4 we used the following appoximations: dφ() dφ() k+ k The esults can now be placed back into 4: φ( k+) φ( k ) k+ k φ( k) φ( k ) k k = φ k+ φ k k (6) = φ k φ k k (7) ρ φ k+ φ k D k+ k+ ρ φ k φ k D k k k k = (Σ ak φ k S k ) ρ k k k (8) This equation can be eaanged to: whee: a k φ k + b k φ k + c k φ k+ = S k (9) a k = ρ k D k k ( k + k ) ρ k (0) ρ D k+ c k = k+ k ( k + k ) ρ k () b k = a k + c k Σ ak () 3
in this notation the diffusion coefficient as a function node numbe: and similaly fo D k+ D k = (D k + D k+ ) (3) = (D k + D k ) (4).3 Bounday conditions k+ k = ( k + k+ ) (5) = ( k + k ) (6) We use two bounday conditions (BC) at the cente of the coe (implies symmety) and at the dimension bounday. In this case the two bounday conditions ae: φ( N ) = 0 (7) dφ() = 0 =0 (8) The fist condition emove the last equation (N) and equation N becomes: a N φ N + b N φ N = S N (9) To deive the deivative BC we epeat the integation in equation 4, but this time with the inteval 0 to k+. Fo the case of ρ = 0 ( ρ = 0)we get: k+ 0 ρ D() dφ() (Σ a φ() S()) ρ (Σ a0 φ 0 S 0 ) 0 ρ D() dφ() = dφ() 0 k+ Thus the diffusion equation educes to: k+ (30) D 0 φ φ 0 0 (3) φ φ 0 D 0 = (Σ a0 φ 0 S 0 ) 0 0 (3) eaanging to the fom b 0 φ 0 + c 0 φ = S 0 esults in: b 0 = D 0 0 c 0 = D 0 0 + Σ a0 (33) fo the case of ρ > 0 we can appoximate = 0 fo this BC thus ρ = 0. which esults in: (34) D 0 φ φ 0 0 = S 0 (35) 4
and thus: b 0 = (36) c 0 = (37) When placed in matix notation we get: b 0 c 0 0.. φ 0 S 0 a b c 0.. φ S 0 a b c 0.. φ : : = S : : : :.. 0 a N b N c N φ N S N (38) In the implementation the a mateial matix is ceated fo the fast and themal egions..4 Matix invesion Thee ae seveal ways to solve equation 38 to get the flux vecto. In the implementation the Gaussian elimination method was selected because of its simplicity and efficiency. The deivation of the method can be found elsewhee. The fowad elimination: h 0 = c 0 b 0 (39) p 0 = S 0 (40) b 0 c k h k = k =,,..., N (4) b k a k h k p k = S k + a k p k b k a k h k k =,,..., N (4) Notice that if not constucted coectly, the paametes in the matix can cause division by zeo. Finally back substitution give the solution fo the neuton flux..5 Flux integation φ N = p N (43) φ k = p k + h k φ k+ k = N, N 3,..., 0 (44) In ode to solve fo the multiplication facto k, as descibed in equation 9, an integal of the flux is needed. Fo simplicity tapezoid integation can be used: RN 0 s () = N (S i + S i+ ) i (45) i=0 5