Boundary Integral with Sources on Boundary

I have a question with regards to a simple surface integral on, for example, a boxmesh geometry. If I solve a Poisson equation and the calculate the flow through the surface the standard technique is as:

flow_side_surface = dot(-K*grad(up), n)*ds(1)

where up is the solution of the Poisson equation, K a coefficient and ds(1) is the surface on the boundary I wish to integrate over.

Now, when I have a source on that boundary, how does the integral deal with it? I am asking this question because, on a simple test boxmesh I test for mass conservation by dividing the flow provided from the source by the sum of flow through the surfaces of the mesh. The ratio should be approximately 1. However, if the source is on a surface the ratio becomes 1.333. If the source is at the intersection of 2 surfaces the ratio is 2. And if the source is at the intersection of 3 surfaces (corner node) the ratio is 4. There’s a clear pattern but I can’t quite figure out why this is. Does anyone have any experience with this?

UPDATE: Clarification on what source means here. I have a numerical value for a source and I know where the source is in geometric space, so I create a function space for f and change the vector value at the boundary point to some numerical value. When this is done on the boundaries I get the problems given above, but not when I change an interior node value.

I’m not sure what exactly is meant by a source on the boundary here, although I’ll point out that direct evaluation of the flux on boundaries is, generally, not very accurate, and there is a fairly old post-processing technique to get boundary flux estimates that converge faster than direct evaluation and satisfy the conservation law exactly. See my old posts here, and, for conservative flux estimates on subsets of the boundary, here.


Hi kamensky, I hadn’t realised that direct evaluation of flux was not very accurate! Thanks for pointing this out to me. I’ll try implement this flux estimate to see if it changes the result. I’ve updated my question to clarify what I meant by source. Effectively, a numerical source on a given node on the boundary.

Hello kamensky. Thanks for the tip on the improved flux calculation, it’s actually quite useful going forward. It didn’t solve the specific issue I have, and I’ve written up a new post describing the problem more thoroughly here (I couldn’t edit this post anymore) Gradient with a boundary point source