By default, I know that Mathematica makes the normal derivative of the potential function in Mathematica continuous across the boundary defined in my problem. My problem is that I need the normal derivative of the potential function times different dielectric constants to be continuous across the boundary. So in a more concrete sense I currently have the values (Potential[0.5, 1.5] - Potential[0.5, 1.5 - 10^-4])/10^-4
and (Potential[0.5, 1.5 + 10^-4] - Potential[0.5, 1.5])/10^-4
are very close.
What I need is:
43.6 *(Potential[0.5, 1.5] - Potential[0.5, 1.5 - 10^-4])/10^-4
and 3.9 *(Potential[0.5, 1.5 + 10^-4] - Potential[0.5, 1.5])/10^-4
to be very close.
Is there any way that I can do this?
To clarify a bit more: The function I need to make continuous across the boundaries is n*\[Epsilon]*grad(phi)
, where n is a normal unit vector, phi is the potential function, and [Epsilon] is a 2x2 diagonal matrix containing the dielectric constants that changes based on the region. There are two regions and for what I have written above I am considering the boundary at the top of the core of my shape which is located at d=1.5 and x= 0.5
Here is the full setup of geometry and boundary conditions for what I am working with:
ElectricIntensity[a1_, a2_, a3_, a4_, b1_, b2_, h_, c1_, c2_, d_,
H_] := Module[{}, \[CapitalOmega] =
RegionDifference[
RegionDifference[Rectangle[{-a4 - R, -R}, {a4 + R, b2 + R}],
Polygon[{{a1, b2}, {a2, b2}, {a3, b1}, {a4, b1}, {a4,
b1 + h}, {a3, b1 + h}, {a2, b2 + h}, {a1, b2 + h}}]],
Polygon[{{-a1, b2}, {-a2, b2}, {-a3, b1}, {-a4, b1}, {-a4,
b1 + h}, {-a3, b1 + h}, {-a2, b2 + h}, {-a1, b2 + h}}]];
\[CapitalOmega]Core =
Polygon[{{-a4, b1 - H}, {a4, b1 - H}, {a4, b1}, {c2, b1}, {c1,
d}, {-c1, d}, {-c2, b1}, {-a4, b1}}];
\[Epsilon][x_, y_] := If[{x, y} \[Element] \[CapitalOmega]Core, ( {
{29.16, 0},
{0, 43.6}
} ), ( {
{3.9, 0},
{0, 3.9}
} )];
Potential =
NDSolveValue[{Inactive[
Div][{\[Epsilon][x, y].Inactive[Grad][u[x, y], {x, y}]}, {x,
y}] == 0,
DirichletCondition[u[x, y] == 0.5,
a1 <= x <= a2 && y == b2 ||
a2 <= x <= a3 && y == (b1 - b2)/(a3 - a2) (x - a2) + b2 ||
a3 <= x <= a4 && y == b1 || a1 <= x <= a2 && y == b2 + h ||
a2 <= x <= a3 && y == (b1 - b2)/(a3 - a2) (x - a2) + b2 + h ||
a3 <= x <= a4 && y == b1 + h || x == a1 && b2 <= y <= b2 + h ||
x == a4 && b1 <= y <= b1 + h],
DirichletCondition[
u[x, y] == -0.5, -a2 <= x <= -a1 && y == b2 || -a3 <= x <= -a2 &&
y == (b2 - b1)/(a3 - a2) (x + a3) + b1 || -a4 <= x <=
a4 - 3 && y == b1 || -a2 <= x <= -a1 &&
y == b2 + h || -a3 <= x <= -a2 &&
y == (b2 - b1)/(a3 - a2) (x + a3) + b1 + h || -a4 <=
x <= -a3 && y == b1 + h || x == -a1 && b2 <= y <= b2 + h ||
x == -a4 && b1 <= y <= b1 + h]},
u, {x, y} \[Element] \[CapitalOmega]];
Derivative[1, 0][Potential][0.5, 1.5]]
Example of values used to run this code:
R = 1; AbsoluteTiming[
ElectricIntensity[1, 2, 3, 5, 1, 2, 0.1, 1, 2, 1.5, 0.2]]