FreeFEM Documentation on GitHub

stars - forks

An Example with Complex Numbers

In a microwave oven heat comes from molecular excitation by an electromagnetic field. For a plane monochromatic wave, amplitude is given by Helmholtz’s equation:

\[\beta v + \Delta v = 0.\]

We consider a rectangular oven where the wave is emitted by part of the upper wall. So the boundary of the domain is made up of a part \(\Gamma_1\) where \(v=0\) and of another part \(\Gamma_2=[c,d]\) where for instance \(\displaystyle v=\sin\left(\pi{y-c\over c-d}\right)\).

Within an object to be cooked, denoted by \(B\), the heat source is proportional to \(v^2\). At equilibrium, one has :

\[\begin{split}\begin{array}{rcl} -\Delta\theta &=& v^2 I_B\\ \theta_\Gamma &=& 0 \end{array}\end{split}\]

where \(I_B\) is \(1\) in the object and \(0\) elsewhere.

In the program below \(\beta = 1/(1-i/2)\) in the air and \(2/(1-i/2)\) in the object (\(i=\sqrt{-1}\)):

 1 // Parameters
 2 int nn = 2;
 3 real a = 20.;
 4 real b = 20.;
 5 real c = 15.;
 6 real d = 8.;
 7 real e = 2.;
 8 real l = 12.;
 9 real f = 2.;
10 real g = 2.;
11 
12 // Mesh
13 border a0(t=0, 1){x=a*t; y=0; label=1;}
14 border a1(t=1, 2){x=a; y=b*(t-1); label=1;}
15 border a2(t=2, 3){ x=a*(3-t); y=b; label=1;}
16 border a3(t=3, 4){x=0; y=b-(b-c)*(t-3); label=1;}
17 border a4(t=4, 5){x=0; y=c-(c-d)*(t-4); label=2;}
18 border a5(t=5, 6){x=0; y=d*(6-t); label=1;}
19 
20 border b0(t=0, 1){x=a-f+e*(t-1); y=g; label=3;}
21 border b1(t=1, 4){x=a-f; y=g+l*(t-1)/3; label=3;}
22 border b2(t=4, 5){x=a-f-e*(t-4); y=l+g; label=3;}
23 border b3(t=5, 8){x=a-e-f; y=l+g-l*(t-5)/3; label=3;}
24 
25 mesh Th = buildmesh(a0(10*nn) + a1(10*nn) + a2(10*nn) + a3(10*nn) +a4(10*nn) + a5(10*nn)
26    + b0(5*nn) + b1(10*nn) + b2(5*nn) + b3(10*nn));
27 real meat = Th(a-f-e/2, g+l/2).region;
28 real air= Th(0.01,0.01).region;
29 plot(Th, wait=1);
30 
31 // Fespace
32 fespace Vh(Th, P1);
33 Vh R=(region-air)/(meat-air);
34 Vh<complex> v, w;
35 Vh vr, vi;
36 
37 fespace Uh(Th, P1);
38 Uh u, uu, ff;
39 
40 // Problem
41 solve muwave(v, w)
42    = int2d(Th)(
43         v*w*(1+R)
44       - (dx(v)*dx(w) + dy(v)*dy(w))*(1 - 0.5i)
45    )
46    + on(1, v=0)
47    + on(2, v=sin(pi*(y-c)/(c-d)))
48    ;
49 
50 vr = real(v);
51 vi = imag(v);
52 
53 // Plot
54 plot(vr, wait=1, ps="rmuonde.ps", fill=true);
55 plot(vi, wait=1, ps="imuonde.ps", fill=true);
56 
57 // Problem (temperature)
58 ff=1e5*(vr^2 + vi^2)*R;
59 
60 solve temperature(u, uu)
61    = int2d(Th)(
62         dx(u)* dx(uu)+ dy(u)* dy(uu)
63    )
64    - int2d(Th)(
65         ff*uu
66    )
67    + on(1, 2, u=0)
68    ;
69 
70 // Plot
71 plot(u, wait=1, ps="tempmuonde.ps", fill=true);

Results are shown on Fig. 37, Fig. 38 and Fig. 39.

RealMicroWave

Fig. 37 Real part

ImaginaryMicrowave

Fig. 38 Imaginary part

TemperatureMicrowave

Fig. 39 Temperature

Microwave

Table of content