Message Boards Message Boards

Making normal derivative times corresponding multipliers continuous?

Posted 2 years ago

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]]
POSTED BY: Marissa Whitby
5 Replies

Two remarks:

1) Where exactly is your problem? 2) Unfortunately I have a stone-age version of Mathematica which doesn't know most of your commands, so I can only guess what you want to do, but sorry, I cannot help you.

POSTED BY: Hans Dolhaine
Posted 2 years ago
  1. My problem is that I need the values produced by the module for the left and right hand limits approaching y=1.5 to be close so that the overall function in the module, namely n*\[Epsilon]grad(phi), is continuous across the border I have defined in my geometry.
  2. Okay no worries thank you for trying to help!
POSTED BY: Marissa Whitby
Posted 2 years ago

Hi Hans,

Unfortunately I have a stone-age version of Mma which doesn't know most of your commands

At the Wolfram Technology Conference earlier this month a "retiree" license option was mentioned. The idea is to allow retired people to purchase a license for Mathematica or Wolfram Desktop at a very low cost. You can also use the latest version in a browser by signing up for a free Wolfram Cloud account

Marissa, sorry about the off-topic response.

POSTED BY: Rohit Namjoshi

For me it is by no means clear what you want to achieve. You could multipy your 1st expression by 3.9 and the 2nd by 43.6 and then they are close indeed, but I doubt that is an appropriate solution.

I assume that you have to regions in space. In one you have pot1, and in the other you have pot2. You could connect them from points short off the boundary by a polynomial so that the derivatives are equal. Is it this what you want to do?

p[x_] := Sum[a[i] x^i, {i, 0, 3}]

Solve[
 {
  p[x - d] == u phi[x - d],
  p[x + d] == v phi[x + d],
  D[p[x - d], x] == u (phi[x - d] - phi[x - d - eps])/eps,
  D[p[x + d], x] == D[p[x - d], x]
  },
 {a[0], a[1], a[2], a[3]}
 ]
POSTED BY: Hans Dolhaine
Posted 2 years ago

Thank you for your response. My apologies. I should've stated my question more clearly. I have added more details and more of the code I am working with. Please let me know if you have any other suggestions. Thank you!

POSTED BY: Marissa Whitby
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract