Cross derivatives implementation in FEniCS

Dear all,

I would like to know how I can include the two first terms in the RHS of the following expression in FEniCS

\frac{{du}}{{dt}} = - \frac{d}{{dx}}\left( {a*\frac{{du}}{{dy}}} \right) + \frac{d}{{dy}}\left( {a*\frac{{du}}{{dx}}} \right) + \nabla .(b\nabla u) + f(u)

I know what to do with all other terms in the eq. but not with those two ones.
Thank you in advance.

Integrate them by parts and use the Function.dx operator as shown in Expressions depending on spatially varying coefficients and their derivatives in advection-diffusion-PDE

1 Like

I’m assuming you’ve made a typographical error and you intended to write:

- \frac{\partial}{\partial x} \left( a \frac{\partial u}{\partial y}\right) + \frac{\partial}{\partial y} \left( a \frac{\partial u}{\partial x}\right)

which it’s clear can be written

- \frac{\partial}{\partial x} \left( a \frac{\partial u}{\partial y}\right) + \frac{\partial}{\partial y} \left( a \frac{\partial u}{\partial x}\right) = - \nabla \cdot \left( \begin{pmatrix} 0 & a \\ -a & 0 \end{pmatrix} \nabla u \right) = -\nabla \cdot \left( A \nabla u \right)

Assuming a \in \mathbb{R}, evidently A is not positive definite and has eigenvalues \{aj, -aj\} where j=\sqrt{-1}. Are you sure this is the system you want to solve?

Otherwise you would proceed as normal in standard FEMs integrating that term by parts to include in the weak formulation:

\left( A \nabla u, \nabla v \right) - \left( A \nabla u \cdot \vec{n}, v\right)_{\partial\Omega}
1 Like