# Forced Constant Potential

Hello everyone,
in an eigenvalue/vector problem I need a uniform potential on a particular surface (there are also other dofs). If it weren’t for the eigenvalue setting, I would define a dirichlet bc.
Can I implement this via periodicity; that I would define a master vertex with all other surface vertices as slaves?
Best to everyone

Hi,
with periodic it is not possible as periodic vertex pairs are not allowed to be in the same element.
I think it should be possible by defining the boundary dirichlet and introducing one more variable with a number fespace and using a Gridfunction that is one on the boundary.
Best
Christopher

Thank you very much for the reply;
is there an example out there how the FESpace is then put together for this degree of freedom. There is ample examples of how to define the GridFunction.
Best

One more question; can the resulting matrix obtained by taking the sum of the rows/cols of the corresponding dofs?

Hi,
a quick solution is to add a term

``````10**8 * grad(u.Trace()) * grad(v.Trace()) * ds("bnd")
``````

to the stiffness matrix. It penalizes the variation of the eigenfunction on the conducting boundary.

Joachim

And also thank you; no luck so far however; my guess is that in my case it is an interior boundary. Additionally I have to use .Deriv() since the potential is not the only degree of freedom

``````(*u, phi*) = fes.TrialFunction()
...
stiff += 1E8*(phiV.Trace().Deriv() * phiU.Trace().Deriv())*ds('elec')
``````

I also tried to penalize the gradient within the domain of the electrode without success

``````el_cf = CoefficientFunction([1 if bnd == 'elec' else 0
for bnd in mesh.GetBoundaries()])
U_el = GridFunction(fePhi)
U_el.Set(el_cf, BND)
...
10E8*(phiV.Deriv() * phiU.Deriv())*U_el*dx
``````

Unsuccessful insofar as it appears to be ignored (same result without the line).
Any help is appreciated;
Best to all

``````u.Set(1, BND)
``````

only sets on Dirichlet boundaries (legacy reasons) use

``````u.Set(1, definedon=mesh.Boundaries(bndname))
``````