# Solving simple electrostatic problem

**URL:** <https://discourse.julialang.org/t/solving-simple-electrostatic-problem/68046>\
**Category:** Modelling & Simulations\
**Tags:** pde, physics, mesh, gmsh\
**Created:** [September 12, 2021, 10:20am UTC](https://discourse.julialang.org/t/solving-simple-electrostatic-problem/68046 "2021-09-12T10:20:50Z")\
**Posts on this page:** 5\
**Page:** 2

<div class="post-metadata">

**Author:** ![antoine-levitt](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/antoine-levitt/32/4008_2.png) [@antoine-levitt](https://discourse.julialang.org/u/antoine-levitt)\
**Post date:** [September 13, 2021, 4:46pm UTC](https://discourse.julialang.org/t/solving-simple-electrostatic-problem/68046/21 "2021-09-13T16:46:26Z")

</div>

> [@stevengj](#):
>
> I agree that BEM or related surface integral equation methods (e.g. Nystrom) could be the most computationally efficient methods for this problem, but they are finicky to implement well and have a steep learning curve.

Really? Can you expand on what parts are tricky to get right? I would have thought for simple 2D problems like this (with simple geometry and where O(N^3) methods are fine so that you don’t need iterative solvers or FMM) you can just mesh the domain yourself, setup the integral equation and discretize it brutally. At least that seems like a fun learning exercise (although less flexible for more complicated geometries, I agree).

(Also, since the Green function for the Poisson equation in the disk is known analytically, you can possibly even not have to mesh the circle?)

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [September 13, 2021, 7:37pm UTC](https://discourse.julialang.org/t/solving-simple-electrostatic-problem/68046/22 "2021-09-13T19:37:23Z")

</div>

> [@antoine-levitt](#):
>
> setup the integral equation and discretize it brutally

The Green’s function diverges at the origin, so you have to be careful with the discretization scheme (e.g. using specialized quadrature schemes), among other subtleties (e.g. choosing first- vs. second-kind formulations).

It’s all written out in great detail by many references for the Poisson case, of course, so if you follow the right textbook (I liked [Bonnet’s book](https://www.amazon.com/dp/0471971847/ref=cm_sw_r_cp_api_glt_fabc_C19YQYE62T3XDRA4W5QX) IIRC, though it is a bit old now) you should be fine. But even then there is a lot of material to digest.

---

<div class="post-metadata">

**Author:** ![isentropic](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/isentropic/32/11894_2.png) [@isentropic](https://discourse.julialang.org/u/isentropic)\
**Post date:** [September 14, 2021, 3:55am UTC](https://discourse.julialang.org/t/solving-simple-electrostatic-problem/68046/23 "2021-09-14T03:55:44Z")

</div>

Upon looking around I’ve encountered [Home · Meshes.jl](https://juliageometry.github.io/Meshes.jl/dev/) which seems like what I need for the geometry — Julia based, native julia plotting. I wonder if there is anyone who successfully used Meshes.jl with Gridap.jl.

Also, Ferrite.jl (JuAFEM.jl in the past) seems to be a good candidate for this sort of problem, though I can’t comprehend the docs as it clearly assumes some prior knowledge that I’m lacking

---

<div class="post-metadata">

**Author:** ![isentropic](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/isentropic/32/11894_2.png) [@isentropic](https://discourse.julialang.org/u/isentropic)\
**Post date:** [September 14, 2021, 4:07am UTC](https://discourse.julialang.org/t/solving-simple-electrostatic-problem/68046/24 "2021-09-14T04:07:32Z")

</div>

@kristoffer.carlsson might know better, here pinging for help.

---

<div class="post-metadata">

**Author:** ![antoine-levitt](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/antoine-levitt/32/4008_2.png) [@antoine-levitt](https://discourse.julialang.org/u/antoine-levitt)\
**Post date:** [September 14, 2021, 7:03am UTC](https://discourse.julialang.org/t/solving-simple-electrostatic-problem/68046/25 "2021-09-14T07:03:39Z")

</div>

> [@stevengj](#):
>
> The Green’s function diverges at the origin, so you have to be careful with the discretization scheme (e.g. using specialized quadrature schemes), among other subtleties (e.g. choosing first- vs. second-kind formulations).

I see, that makes sense, thanks!

[Previous page](https://discourse.julialang.org/t/solving-simple-electrostatic-problem/68046.md?page=1)
