# How to use FEniCS to calculate the electric field of an isolated charged sphere

Initially I thought that this is the kind of question which ought to have already been answered in the form of an example online, but so far I haven't found one. I will admit that I am very new to both FEniCS and the use of FEM software for solving PDEs in general, so my goal here in solving this problem is to a gain a better understanding of the boundary conditions (B.Cs.) used in FEM software (specifically FEniCS). Based on that I suppose my question can be broken down into the following parts:

• For isolated electrostatic systems (basically an object/objects with a non-zero charge) do we need to somehow include the B.C. that $$v(r) \rightarrow 0$$ as $$r \rightarrow \infty$$ ? If not, what B.Cs. do we choose to make sure that the FEM solution approximates the analytical solution?
• If we do need to pass the information that the potential goes to zero as $$r$$ goes to infinity how do we do so on a finite domain? What type of B.Cs. are we supposed to use and how do we implement them?

As far as answering this question I would appreciate anything from useful links to books/websites to explanations with equations. Ideally, I would like it if someone could show me how to implement this particular problem in FEniCS but I don't know how practical that is. Thank you for your time.

Edit: Is it possible to use something like the Boundary Element Method (BEM) to solve this type of problem more exactly? I found a software package that is written in Python that connects to FEniCS called Bempp (Link to Bempp website). A basic description of the BEM comes Wikipedia (Link to BEM Wikipedia page).

• To solve the problem for finding electric potential distribution due to a given isolated charge distribution you'll need a boundary condition on a sufficiently far-away reference surface representing infinity, no way around it. What can help is to consider multipole expansion of the field, to see that higher terms decay faster at infinity. So if solving directly, in a sufficiently large domain, is not practical then one can subtract out the first multipole term[s] analytically and solve for the rest with finite elements. Oct 16 '20 at 6:10
• This question seems to be more appropriate for FEniCS Discourse. Oct 16 '20 at 17:54