Hi!
I am trying to model transport of particles inside a cylindrical pore using a nernst planck like equation. I already have this working for a 3D cylinder mesh. Now I am trying to model this in 2D using a rectangle mesh with symmetry around y=0, mesh looks like this:
This is how I implemented the subdomains and boundaries:
# defining subdomains
class boundary_outlet(SubDomain):
def inside(self, x, on_boundary):
tol = 1.0e-12
return near(x[0], 1, tol)
class boundary_inlet(SubDomain):
def inside(self, x, on_boundary):
tol = 1.0e-12
return near(x[0], 0, tol)
class boundary_top(SubDomain): #wall of the cylinder
def inside(self, x, on_boundary):
if (R == 5.0e-9 or R == 50.0e-9) and L == 10.0e-9:
tol = 1.0e-12
return near(x[1], (0.5), tol)
class boundary_bottom(SubDomain): #axisymmetrical boundary
def inside(self, x, on_boundary):
tol = 1.0e-12
return near((x[1]), 0, tol)
# Markng boundaries
boundary_markers = MeshFunction('size_t', mesh, 1)
boundary_markers.set_all(9999)
b_inlet = boundary_inlet()
b_outlet = boundary_outlet()
b_top = boundary_top()
b_bottom = boundary_bottom()
b_inlet.mark(boundary_markers, 1)
b_outlet.mark(boundary_markers, 3)
b_top.mark(boundary_markers, 2)
b_bottom.mark(boundary_markers, 4)
ds = Measure('ds', domain=mesh, subdomain_data=boundary_markers) # boundary integral
I impose drichilet condition on inlet and outlet, where as on the bottom subdomain I assume no flux condition (implemented naturally in FEniCS). On the top subdomain, particles are being produced at constant flux hence a Neumann bc:
g= Constant(-5.0)
#Neumann condition for flux of sample particle 1
flux_1= g*v_1*ds(2)
I add this flux term in the overall transport balance. A simplified version of the overall equation for particle 1 looks like this:
particle_1 = ((u_1 - u_n1) / (del_t)) * v_1 * dx + dot(grad(u_1), grad(v_1)) * dx + flux_1
The model does converge but the problem is that this Neumann bc of flux_1 doesn’t seem to be working, even when I change the g value to extremely high magnitudes, I don’t see any particle_1 formation on the top boundary (or any change at all).
Thinking about the problem made me confused about what the ds integral for a Neumann type bc even means in context of a 2d rectangle mesh. As I understand for a 3D cylinder, the Neumann bc will be the flux integral over a surface area. But what is it integrating over in a 2d rectangle mesh? a length, with no depth?.
Is this because I need to convert the equation to cylindrical coordinates? even though I assume no variation along theeta.
I am pretty sure I have some basic flaws in my understanding here, I’d appreciate any sort of help.
Thanks in advance,