Multi-region Finite Difference- Interface between materials

2 replies · 3K views · last reply
timman_24
Messages
52
Reaction score
0
I am writing a multi-region diffusion code. The two regions have different material properties, so the analytical solution shows a discontinuity at the interface between the regions.

As can be seen here:

Red curve of a numerical solution rising slowly from near zero, peaking sharply near x = 25 at about 1.2 x 10^6, then falling steeply to zero by x = 30; the curve is smooth with no visible jump.


The numerical code I am running is (Mathematica):

Code:
While[converge > .00001,
 count = count + 1;
 list1[[1]] = list1[[2]];
 For[i = 2, i < Ai + 1, i++,
  list1[[i]] = Dw (list1[[i - 1]] + list1[[i + 1]])/(H^2 Ea1 + 2 Dw)];
 For[j = Ai + 1, j < (Ai + Bi), j++,
  list1[[j]] = .5*(-H^2 (list1[[j]] Ea2/Dc - S/Dc) + list1[[j - 1]] + 
      list1[[j + 1]])];
 converge = Max[Abs[list2 - list1]];
 list2 = list1;]

This works great if the material properties between the two regions are identical, but if I use differing material properties, I still get a smooth curve:

Line graph of a smooth curve rising gently from near zero, peaking near 600000 around x = 27, then dropping sharply to zero at x = 30.


Is there a trick to getting this to work with finite difference method? How do I deal with this type of interface condition?

Thanks guys
 
Attachments
  • Red line graph of a smooth curve rising from near zero, peaking sharply near x = 25 at about 1.2 x 10^6, then dropping to zero at x = 30; y-axis ticks from 200000 to 1 x 10^6, x-axis ticks 5 to 30.
    Analyticalpart1.png
    2.3 KB · Views: 584
  • Line graph with x-axis ticks at 5, 10, 15, 20, 25, 30 and y-axis ticks from 0 to 600000; the curve stays near zero, rises steeply after about x = 20, peaks near 600000 around x = 27, then drops sharply to zero at x = 30.
    Analyticalpart1num.png
    2.3 KB · Views: 653
Colud you please post the problem you're trying to solve? I'm not sure, but it looks like you're missing some sort of jump condition. You should check if your algorithm is correct when j = Ai, because that's where the coupling occurs.
 
I ended up adding an interface condition to the solver.

To conserve current, we need this condition to be satisfied at the boundary:

[tex]D_{1}J_{1}(x)=D_{2}J_{2}(x)[/tex]

To satisfy this condition, I stopped at the interface and applied this condition at that point. Then I continued. I used a backward difference scheme for the [tex]J_{1}[/tex] and a forward difference approx for the [tex]J_{2}[/tex] and rearranged for i.

This gave me the kink I was looking for.

BTW, this was a neutron diffusion model in a slab with two materials.