# Applying weak form

I have two dimensional equation and I want to solve it using Finite Element Methods. $$\nabla . (\alpha(x,y)\nabla u(x,y)) + \dfrac{\partial u(x,y)}{\partial x}+\dfrac{\partial u(x,y)}{\partial y}+u(x,y)=f(x,y)$$ $$\alpha(x,y)\dfrac{\partial u(x,y)}{\partial n}=g(x,y), for (x,y)\in \partial\Omega$$ To obtain its weak form, I multiplied the equation with a residual function $$w$$. And applied the vector identity shown below. $$\nabla.(b\vec{A})=\nabla b.\vec{A}+b\nabla . \vec{A}$$ One of the terms is come out as shown below. $$\int_{\partial\Omega} w\nabla g(x,y).\vec{n} dl$$ This term corresponds to a boundary condition. How should I derive the rest of the equation?

Dont expand the divergence term, apply integration by parts without doing this $$\int_\Omega w \nabla\cdot(\alpha\nabla u) dx = - \int_\Omega \alpha \nabla u \cdot \nabla w dx + \int_{\partial\Omega} w \alpha \frac{\partial u}{\partial n}ds$$ In your notation, define a vector field $$\vec{A} = \alpha \nabla u$$ and then do the integration by parts on $$\int_\Omega w \nabla\cdot\vec{A} dx$$ Since $$w \nabla\cdot\vec{A} = \nabla\cdot(w\vec{A}) - \vec{A} \cdot \nabla w$$ You get $$\int_\Omega w \nabla\cdot\vec{A} dx = \int_{\partial\Omega} w \vec{A}\cdot\vec{n} ds - \int_\Omega \vec{A} \cdot \nabla w dx$$ which is the first equation above. Using your boundary condition, it becomes $$\int_\Omega w \nabla\cdot(\alpha\nabla u) dx = - \int_\Omega \alpha \nabla u \cdot \nabla w dx + \int_{\partial\Omega} w g ds$$
• Shouldn't the first equation be $\int_\Omega w \nabla\cdot(\alpha\nabla u) ds = - \int_\Omega \alpha \nabla u \cdot \nabla w ds + \int_{\partial\Omega} w \alpha \frac{\partial u}{\partial n}dl$ ? @cfdlab Apr 30 '20 at 19:16
• On the other hand, how did you find the $\int_{\partial\Omega} w \vec{A}\cdot\vec{n} ds$ term? @cfdlab Apr 30 '20 at 22:36
• It is divergence theorem en.wikipedia.org/wiki/Divergence_theorem. Replace $ds=dl$ to get your notation. I used $dx$ for domain integration and $ds$ for surface integration. May 1 '20 at 3:21