I am trying to implement a flux BC on the Poisson’s equation for the top boundary and then measure the flux at the bottom boundary, I received a warning says that
Notation dx[meshfunction] is deprecated. Please use dx(subdomain_data=meshfunction) instead.
I didn’t use
dx[meshfunction] in my code but I still received this warning, so I am concerned if my implementation was incorrect; also, the out flux on the bottom edge I computed is the same as the applied flux on the top boundary, this seems odd. following is my code:
from dolfin import * mesh = UnitSquareMesh(32, 32) V = FunctionSpace(mesh, "Lagrange", 2) def bot(x): return x < DOLFIN_EPS u0 = Constant(20.0) bc_bot = DirichletBC(V, u0, bot) boundary_parts = MeshFunction("size_t", mesh, mesh.topology().dim()-1, 0) boundary_parts.set_all(0) #marks whole cube as domain 0 class Top(SubDomain): def inside(self, x, on_boundary): return on_boundary and x > 1.0 - DOLFIN_EPS top = Top() top.mark(boundary_parts, 1) #marks the top of the cube as 1 class Bot(SubDomain): def inside(self, x, on_boundary): return on_boundary and x < DOLFIN_EPS bottom = Bot() bottom.mark(boundary_parts, 2) #marks the bottom of the cube as 2 ds=Measure('ds')[boundary_parts] u = TrialFunction(V) v = TestFunction(V) f = Constant(0.0) g = Constant(-100.0) # in flux, negative alpha = 10. #thermal diffusivity a = Constant(alpha)*inner(grad(u), grad(v))*dx L = f*v*dx - g*v*ds(1) u = Function(V) solve(a == L, u, bc_bot) outflux = assemble(Constant(alpha)*grad(u)*ds(2)) print('outflux = ', outflux)
I appreciate any advice on this! Thank you!