Nonlinear diffusiosion equation with a mix of Neumann and Dirichlet BC

Hi, I am relatively new to FEniCS and the Variational formulation so I was hoping for some help or pointers with a relatively complex problem that I’m having. I want to solve a nonlinear diffusion equation with a mix of Neumann and Dirichlet boundary conditions:

\frac{\partial u}{\partial t} = \frac{1}{g} \nabla \cdot \left ( g \hat D \nabla u \right ) \; \mathrm{in} \; \Omega,
u=0 \; \mathrm{on} \; \Gamma_D,
D_{xx} \frac{\partial u}{\partial x} + D_{xy}\frac{\partial u}{\partial y}=0 \; \mathrm{on} \; \Gamma_N

Here \hat D is a 2 \times 2 diffusion coefficients tensor with D_{xx}, D_{xy}, and D_{yy} are functions of (x, y) and time, meanwhile, and g is a scalar function of (x, y).
The way to represent this equation in the variational formulation is straightforward until I hit an integral
\int_\Omega \frac{v}{g}\nabla \cdot \left ( g \hat D \nabla u \right ) \mathrm{d}x

I am not sure how to rewrite it in terms of the first order derivatives for u and v. So any pointers or suggestions would be greatly appreciated.

I think I figured it out.

For the system above, the weak form would be something like:
L = \int_\Omega u^n v \mathrm{d}x
a = \int_\Omega v u + \Delta t g \left ( \hat D \nabla u \right ) \cdot \nabla \frac{v}{g} \mathrm{d}x

I discovered a relation between the diffusion matrix coefficients D_{22} = D_{12}^2/D_{11}. This and the boundary condition on \Gamma_N cause the integral \int_{\Gamma_N} v \left ( \hat D \nabla u \right ) \cdot \hat n \mathrm{d}\Gamma to be zero because the matrix product \hat D \nabla u = \hat 0 on the boundary.

I think this is a solution, but if someone can check my math, that would be super helpful…