# Help with Variational Formulation

Am solving a system of pdes in Fenics and need to write the variational form. Everything looks good expect a term like the following $$\nabla \xi\nabla \cdot U$$ $\mathbf{U} = (U,V)$ is a vector function and $\xi$ is a scalar function in 2d. So I tried the following. Multiply by a vector function $p$ and integrate by part I arrived at the following, assuming that $p$ vanishes on the boundary. $$-\int (\xi \nabla \cdot \mathbf{U})\cdot\nabla p\space dx .$$ But this doesn't look right. Can anybody please help with this. Any help is much appreciated. Thanks.

• Sorry but I could not understand how did you apply the divergence theorem for the first term in 2, can you explain this more? Thanks – Rock Apr 16 '16 at 22:37

Multiplying term by a vector test function $\mathbf{p}$ and integrating over the domain $\Omega$ gives:

$$\int_\Omega \nabla\cdot \mathbf{U}\nabla\xi\cdot\mathbf{p}d\Omega\qquad (1)$$

$$\nabla\cdot(\mathbf{p}\xi) = \xi\nabla\cdot\mathbf{p} + \mathbf{p}\cdot\nabla\xi$$

Which gives:

$$\mathbf{p}\cdot\nabla\xi = \nabla\cdot(\mathbf{p}\xi) - \xi\nabla\cdot\mathbf{p}$$

Plugging this into (1):

$$\int_\Omega \nabla\cdot \mathbf{U}\left(\nabla\cdot(\mathbf{p}\xi) - \xi\nabla\cdot\mathbf{p}\right) d\Omega\qquad (2)$$

Recall the Divergence theorem:

$$\int_\Omega \nabla\cdot \mathbf{F} d\Omega = \int_\Gamma \mathbf{F}\cdot\mathbf{n}d\Gamma$$ where $\Gamma$ is the boundary of $\Omega$.

Applying this to the first term in (2) gives the final form:

$$\int_\Gamma \nabla\cdot \mathbf{U} \xi(\mathbf{p}\cdot\mathbf{n})d\Gamma - \int_\Omega \nabla\cdot \mathbf{U} \xi\nabla\cdot\mathbf{p}d\Omega$$

The first term is 0 if $\mathbf{p}$ vanishes on the boundary.

• No problem. Hope all the steps are clear. I think this way is slightly longer but also a little bit more clear than just using integration by parts. – Lukas Bystricky Nov 10 '15 at 9:48