floating potential in electrostatic - poisson

3 months ago by

I have built a minimal 2D model basically simulating the electrostatic field in the the air between outer plates and an inner ideal conductor which is electrically floating. Now I need the possiblity set the surface of the conductor to a single floating potential.

An examples is e.g. a metal object in a capacitor filled with air similar to the demo'demo_subdomains-poisson.py' *) when the changing the dimensions of the obstacle from (0.2, 1) to (0.2,0.8), and set g_L = 0 see:
class Obstacle(SubDomain):
def inside(self, x, on_boundary):
return (between(x[1], (0.5, 0.7)) and between(x[0], (0.2, 0.8)))

Now I want to set all outer boundaries of 'Obstacle' to a voltage which is determined from the outer field and 'set' within the simulation run. This is than equivalent to an ideal conductor

Thank you in advance,

from __future__ import print_function
from dolfin import *

# Create classes for defining parts of the boundaries and the interior
# of the domain
class Left(SubDomain):
    def inside(self, x, on_boundary):
        return near(x[0], 0.0)

class Right(SubDomain):
    def inside(self, x, on_boundary):
        return near(x[0], 1.0)

class Bottom(SubDomain):
    def inside(self, x, on_boundary):
        return near(x[1], 0.0)

class Top(SubDomain):
    def inside(self, x, on_boundary):
        return near(x[1], 1.0)

class Obstacle(SubDomain):
    def inside(self, x, on_boundary):
        return (between(x[1], (0.5, 0.7)) and between(x[0], (0.2, 0.8)))

# Initialize sub-domain instances
left = Left()
top = Top()
right = Right()
bottom = Bottom()
obstacle = Obstacle()

# Define mesh
mesh = UnitSquareMesh(64, 64)

# Initialize mesh function for interior domains
domains = CellFunction("size_t", mesh)
obstacle.mark(domains, 1)

# Initialize mesh function for boundary domains
boundaries = FacetFunction("size_t", mesh)
left.mark(boundaries, 1)
top.mark(boundaries, 2)
right.mark(boundaries, 3)
bottom.mark(boundaries, 4)

# Define input data
a0 = Constant(1.0)
a1 = Constant(0.01)
g_L = 0#Expression("- 10*exp(- pow(x[1] - 0.5, 2))", degree=2)
g_R = Constant("1.0")
f = Constant(1.0)

# Define function space and basis functions
V = FunctionSpace(mesh, "CG", 2)
u = TrialFunction(V)
v = TestFunction(V)

# Define Dirichlet boundary conditions at top and bottom boundaries
bcs = [DirichletBC(V, 5.0, boundaries, 2),
       DirichletBC(V, 0.0, boundaries, 4)]

# Define new measures associated with the interior domains and
# exterior boundaries
dx = Measure('dx', domain=mesh, subdomain_data=domains)
ds = Measure('ds', domain=mesh, subdomain_data=boundaries)

# Define variational form
F = (inner(a0*grad(u), grad(v))*dx(0) + inner(a1*grad(u), grad(v))*dx(1)
     - g_L*v*ds(1) - g_R*v*ds(3)
     - f*v*dx(0) - f*v*dx(1))

# Separate left and right hand sides of equation
a, L = lhs(F), rhs(F)

# Solve problem
u = Function(V)
solve(a == L, u, bcs)

# Evaluate integral of normal gradient over top boundary
n = FacetNormal(mesh)
m1 = dot(grad(u), n)*ds(2)
v1 = assemble(m1)
print("\int grad(u) * n ds(2) = ", v1)

# Evaluate integral of u over the obstacle
m2 = u*dx(1)
v2 = assemble(m2)
print("\int u dx(1) = ", v2)

# Plot solution and gradient
plot(u, title="u")
plot(grad(u), title="Projected grad(u)")

Community: FEniCS Project
The floating potential on the boundary of e.g. metal surfaces is determined by :
$\int_{\partial\Omega}\mathrm{\mathrm{\mathbf{D}}\cdot\mathbf{n}}dS$∂ΩD·ndS=0 where D is the electric displacement field which is  $\mathbf{D}=\varepsilon\mathbf{E}$D=εE where E is the electric field.
The corresponding Poisson's equation is than  $\nabla\cdot\mathbf{E}=\nabla\cdot\left(-\nabla\phi\right)=-\nabla^2\phi=\frac{\rho}{\varepsilon}$·E=·(ϕ)=2ϕ=ρε (see https://en.wikipedia.org/wiki/Poisson's_equation).
But how can I implement this on a boundary like the boundary of the obstacle (domain=1, boundary=0) in the example above.
Many thanks in advance,
written 3 months ago by HoWil  
Please login to add an answer/comment or follow this question.

Similar posts:
Search »