Manufacturing a solution for non-smooth coefficients in elliptic problems

This question is a continuation of this answer (I can't comment) If we were going to manufacture a solution for a problem with discontinuous coefficients, I understand that the solution should have discontinuous gradient in the interface normal between the coefficients discontinuity, but this would not be arbitrary for problems where the interface is strangely defined. How could we go about this? Is there an automated process to manufacture a solution with discontinuous gradient in the interface?

Also, when going from the strong form to the weak form, shouldn't we have a boundary term in the interface? $$\int_{\Omega_1} k_1\nabla u_1 \cdot \nabla v_1 \; d\Omega + \int_{\Omega_2} k_2\nabla u_2 \cdot \nabla v_2 \; d\Omega = \\ \int_\Omega f v \;d\Omega + \int_{\partial \Omega_1}k_1 \nabla u_1 \cdot n_1\cdot v_1\; d\partial \Omega +\int_{\partial\Omega_2}k_2 \nabla u_2 \cdot n_2 \cdot v_2 \;d\partial \Omega \;\;\forall v$$ This term is not going to vanish unless our solution has a gradient such that the flux will be zero. Say that we have two materials $k_1$ and $k_2$ separated by $\Gamma = \partial \Omega_1 \cap \partial \Omega_2$

• In the original question, the method in mind is FEM, thus the gradients are already non-continuous. Regarding your second question, the boundary term is zero because of the selection of your $v$ functions. – nicoguaro May 30 '16 at 16:26
• the $v$ functions will vanish at $\partial \Omega$, but not at $\Gamma$, i.e., the interface. It will be continuous though ($v_1$ = $v_2$ I edited the equation) The FEM gradients are discontinuous, but the solution doesn't have to be discontinuous at the interface. – balborian Jun 3 '16 at 17:54