# Floating potentials - fixed unknown potential on boundary

I implemented a weak form to define a floating potential and would like to know if anyone knows a good preconditioner for such a kind of problem.

A floating potential is a fixed but unknown potential, for example on a perfect electric conductor in an external field.
I used the examples from the iFEM notebooks on saddle point problems (e.g., how to implement Dirichlet BCs in this way).
This formulation comprises Lagrange multipliers, that represent the normal current density and NumberSpaces for every unknown potential.
It is also possible to impose currents through this formulation (see attached example).

I read in the literature that there should be efficient iterative solvers for this kind of problem but I cannot wrap my head around how to implement them in NGSolve because the sparsity pattern does not look similar to the saddle point problems for which iterative solvers are described (Stokes, Dirichlet BC).

Thanks in advance for sharing ideas and hints!

Hi Julius,

have a look into the iFEM material:
(ngsolve.org documentation → interactive FEM course)
main file is iFEM.ipynb
go into
Section: Small number of constrains

It is a saddle point problem where the number of constraints is small. The constraint matrix is stored as a MultiVector, i.e. each row is a dense vector.

best, Joachim

Hi Joachim,

Thanks a lot for the hint.

I ran this tutorial and adapted it but I could not figure out how to implement the floating potential correctly.
What I understood: the constraint should be similar to a Neumann BC, so we impose the current instead of the average displacement.
But then the potentials were not constant on the surface of the circles (which they should be but I believe that this constraint is not yet in the formulation).
I haven’t understood how I could implement this constraint.
My code is attached (unfortunately, my laptop broke down and I could not get the Jupyter extension running on the replacement device).

I appreciate your help; also if you know any other resource on the topic!

fewconstraints-floating.py (1.7 KB)

Hi Julius,

yes, you are right, I did not read the question carefully.

In this notebook there are two solutions:

1. use a very high (electric/dielectric) conductivity in the conductor. Here I used a direct solver, however most nogsolve preconditioners can handle the ill-conditioning of the system matrix.
2. use a global basis function, constant in the conductor and decaying in the first layer of the air domain. Expensive if you have many floating potentials.
3. a third solution would be to connect all vertex dofs inside a conductor to one dof. This is the preferred solution, but it would require a little C++ coding.

best, Joachim

plateau.ipynb (3.2 KB)

in the coming nightly also version 3 is working:

``````plateau1 = mesh.Materials("conductor")
fes = H1(mesh, order=3, dirichlet="bot|top")
fes = PlateauFESpace(fes, [plateau1])
u,v = fes.TnT()

gfu = GridFunction(fes)
gfu.Set(1, definedon=mesh.Boundaries("top"))

gfu.vec.data -= bfa.mat.Inverse(freedofs=fes.FreeDofs()) @ bfa.mat * gfu.vec
Draw (gfu);
``````

which gives

plateau.ipynb (4.1 KB)

Joachim

1 Like

Perfect, thanks a lot!