2
$\begingroup$

I would like to solve the Laplacian equation in the following system in order to find out the potential and the Electric field everywhere. I have solved a couple of exercises by solving numerically the Laplacain Equation, but I do not know how to proceed in this one:

Represenation of the system and the boundary conditions

I would like to find out $V_1$ and $V_2$ keeping in mind the boundary condition I wrote in the picture.

Could someone give me hint how to proceed in Mathematica. I have no idea how to solve the Laplacian equation for both regions in simultaneous. Furthermore, I have a neumann boundary condition with dependent variables, which in a couple of tries I did without sucess, I have received an alert saying that "NDSolve: Derivatives of dependent variables in boundary conditions are not supported with Finite Element Method in this version of NDSolve"

Thanks in advance

$\endgroup$

1 Answer 1

4
$\begingroup$

Try this:

Clear[eps, epsilon];
Manipulate[
 domain = ImplicitRegion[0 <= x <= 1 && 0 <= y <= 1, {x, y}];
 epsilon[x_, y_] := If[y <= 1 - x, 1, eps];
 eq = Inactive[Div][
    epsilon[x, y]*Inactive[Grad][u[x, y], {x, y}], {x, y}] == 0;
 sol = NDSolveValue[{eq, DirichletCondition[u[x, y] == 0, y == 0], 
    DirichletCondition[u[x, y] == 5, y == 1]}, 
   u[x, y], {x, y} \[Element] domain];
 Plot3D[sol, {x, y} \[Element] domain, 
  AxesLabel -> {Style["x", 16, Italic], Style["y", 16, Italic], 
    Style["u", 16, Italic]}, ColorFunction -> "TemperatureMap", 
  ImageSize -> 300], {eps, 1, 30, 10, Appearance -> "Labeled"}]

with the following effect:

enter image description here

Have fun!

$\endgroup$
1
  • $\begingroup$ Thank you so much!! Your solution is very smart and subtle!! $\endgroup$
    – JoseAf
    Commented Sep 18, 2021 at 11:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.