This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

How to apply sum over boundary as boundary condition

0 votes

Hi all!

I would like to apply a robin boundary condition,

− ∂ u / ∂ n = p ( u − q ) on Γ R,

where q is the sum of u over the robin boundary scaled by a factor g.
You obviously can't just put there assemble(u*ds(robinboundarymarker)). Is it possible to do this and if so, how can I implement this?

asked Dec 6, 2016 by meron FEniCS User (2,340 points)
edited Dec 6, 2016 by meron

I can't really comment on whether or not there is a direct approach, but you could try an iterative approach, that is start with a guess for g, solve the problem, calculate g from the solution, then repeat until convergence.

Thank you for answering.
However, this does not solve my problem, I think.
What I want to apply as a boundary condition would be the average along the boundary. The scaling factor g is known. so what we get on the right hand would be something like p ( u − g*avg(u) ) where u is averaged along the robin boundary.

Sorry, in my comment by g I meant q. To be clear, I'm suggesting you use an iterative approach where you guess a constant value of avg(u), compute the solution with this boundary condition and then repeat with an updated avg(u) based on what was obtained from the result of the previous iteration, and hoping it converges. Without knowing more about your problem I can't really guarantee it will work but it should be relatively straightforward to try it out.

...