2
$\begingroup$

Based on this excellent answer FEM: Electric Field between two arbitrary defined shapes I can compute the electric field ef between two conducting objects.

enter image description here

$$ F = qE$$ Now, I tried to compute the total resultant electric force on each object (acting at it´s geometric center), by simply integrating the electric field around the boundary of the object :

So according to the Mathematica Documentation, the correct way to specify a domain, is for example:

NIntegrate[1, {x, y, z} \[Element] 

ImplicitRegion[x^2 + y^2 == 1 [And] z == 0, {x, y, z}]]

Since

Region`RegionProperty[RegionBoundary[object1], {x, y}, 
         "FastDescription"][[1]][[2]]

gives me the implicit region of the contour of object1, I can find the force as follows:

NIntegrate[
 Evaluate[ef], {x, y} \[Element] 
  ImplicitRegion[
   Region`RegionProperty[RegionBoundary[object1], {x, y}, 
      "FastDescription"][[1]][[2]], {x, y}]]

Here is the full code to compute the electric field:

Needs["NDSolve`FEM`"];
(*Define Boundaries*)
air = Rectangle[{-5, -5}, {5, 5}];
object1 = Rectangle[{-2.5, 2.5}, {2.5, 2}];
object2 = Rectangle[{-2.5, -2.5}, {2.5, -2}];
reg12 = RegionUnion[object1, object2];
reg = RegionDifference[air, reg12]

mesh = ToElementMesh[reg, MaxCellMeasure -> 0.1];
mesh["Wireframe"]

eq = Laplacian[u[x, y], {x, y}]; V1 = 1; V2 = -2;
bc = {DirichletCondition[u[x, y] == V1, 
    Region`RegionProperty[RegionBoundary[object1], {x, y}, 
       "FastDescription"][[1]][[2]]], 
   DirichletCondition[u[x, y] == V2, 
    Region`RegionProperty[RegionBoundary[object2], {x, y}, 
       "FastDescription"][[1]][[2]]]};
U = NDSolveValue[{eq == 0, bc}, u, {x, y} \[Element] mesh];

ef = -Grad[U[x, y], {x, y}];



force1 = NIntegrate[
   Evaluate[ef], {x, y} \[Element] 
    ImplicitRegion[
     Region`RegionProperty[RegionBoundary[object1], {x, y}, 
        "FastDescription"][[1]][[2]], {x, y}]];



centroid1 = RegionCentroid[object1];



StreamDensityPlot[Evaluate[ef], {x, y} \[Element] reg, 
 ColorFunction -> "Rainbow", PlotLegends -> Automatic, 
 FrameLabel -> {x, y}, StreamStyle -> LightGray, VectorPoints -> Fine,
  PlotRange -> Automatic, 
 Epilog -> {{Arrow[{centroid1, centroid1 + force1}], 
    Text["Force", centroid1 + force1/2, Background -> LightRed]}}]

I get:

enter image description here

My question is: Is this approach correct ? And if not: How would you do it ?

$\endgroup$
9
  • $\begingroup$ Please describe what did not work and what you are expecting. $\endgroup$
    – user21
    Commented Apr 6, 2020 at 11:16
  • $\begingroup$ Read through the (NIntegrate, etc) references pages to see how regions are specified. Don't willy-nilly copy things that you do not know how to use and expect them to work. Please spend some time reading the documentation - it's good. $\endgroup$
    – user21
    Commented Apr 6, 2020 at 11:23
  • $\begingroup$ @user21 Thank you for that little "push". I checked the Documentation more carefully, and I have possibly found a solution. I would be pleased if you could have a look at my updated question. Many thanks ! $\endgroup$
    – james
    Commented Apr 6, 2020 at 12:04
  • 1
    $\begingroup$ @james Electrostatic force acting on a conductor is $\int {E^2/(8\pi)\vec {n}dS}$. $\endgroup$ Commented Apr 6, 2020 at 12:25
  • 1
    $\begingroup$ @james This expression is in all textbooks on electromagnetic theory in the section Electrostatics. For instance, Jackson, Classical Electrodynamics. $\endgroup$ Commented Apr 6, 2020 at 13:47

1 Answer 1

3
$\begingroup$

Electrostatic force acting on a conductor in electric field is given by $\vec {F}=\int{\frac {E^2}{8\pi}\vec {n}dS}$. In this case we have a plate with normal vector $\vec {n}=(0,\pm 1)$ for upper and lower surfaces respectively. To calculate electric field we take air more wide and compute sufficient mesh:

 Needs["NDSolve`FEM`"];
(*Define Boundaries*)
air = Rectangle[{-10, -10}, {10, 10}];
object1 = Rectangle[{-2.5, 2.}, {2.5, 2.5}];
object2 = Rectangle[{-2.5, -2.5}, {2.5, -2}];
reg12 = RegionUnion[object1, object2];
reg = RegionDifference[air, reg12];

mesh = ToElementMesh[reg, 
  MeshRefinementFunction -> 
   Function[{vertices, area}, 
    area > 0.003 (0.1 + 10 Norm[Mean[vertices]])]]
mesh["Wireframe"]
eq = Laplacian[u[x, y], {x, y}]; V1 = 1; V2 = -2;
bc = {DirichletCondition[u[x, y] == V1, 
    Region`RegionProperty[RegionBoundary[object1], {x, y}, 
       "FastDescription"][[1]][[2]]], 
   DirichletCondition[u[x, y] == V2, 
    Region`RegionProperty[RegionBoundary[object2], {x, y}, 
       "FastDescription"][[1]][[2]]]};
U = NDSolveValue[{eq == 0, bc}, u, {x, y} \[Element] mesh];

ef = -Grad[U[x, y], {x, y}];

force1 = -NIntegrate[Evaluate[ef.ef] /. y -> 2, {x, -2.5, 2.5}];
force1 = force1 + 
  NIntegrate[Evaluate[ef.ef] /. y -> 2.5, {x, -2.5, 2.5}];force=force1/(8 Pi);
centroid1 = RegionCentroid[object1];

StreamDensityPlot[Evaluate[ef], {x, y} \[Element] reg, 
 ColorFunction -> "Rainbow", PlotLegends -> Automatic, 
 FrameLabel -> {x, y}, StreamStyle -> LightGray, VectorPoints -> Fine,
  PlotRange -> Automatic, 
 Epilog -> {{Arrow[{centroid1, centroid1 + {0, force1}}], 
    Text["Force", centroid1 + {0, force1/2}, 
     Background -> LightRed]}}]

Figure 1

$\endgroup$
5
  • $\begingroup$ I am impressed, as usually ! .. So, to me it seems that you are omitting the sides of the squares (because in this configuration the force are equal and opposite = cancel each other). Is my assumption correct ? $\endgroup$
    – james
    Commented Apr 6, 2020 at 15:15
  • $\begingroup$ If I slightly misplace the top rectangle: object1 = Rectangle[{-4.5, 2.}, {0.5, 2.5}] Then it does not seem to be working. $\endgroup$
    – james
    Commented Apr 6, 2020 at 15:16
  • $\begingroup$ Also, could it be that your formula for the electrostatic force is valid for 3D, but not 2D ? See here: physics.stackexchange.com/questions/541935/… $\endgroup$
    – james
    Commented Apr 6, 2020 at 15:22
  • $\begingroup$ @james Formula for force is same in 2D and 3D. There are several system of physical units including SI and CGS.Electrostatic force acting on conductor in electric field is $\vec {F}=k/2 \int_S E^2 \vec {n}dS $, where $k$ depends on units, for example, $k=1/(4\pi)$ in CGS and $k=\epsilon_0$ in SI. $\endgroup$ Commented Apr 6, 2020 at 17:33
  • $\begingroup$ For asymmetric case use also $F_x$ not only $F_y$ as in my solution. $\endgroup$ Commented Apr 6, 2020 at 17:46

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.