I need to solve the following equation in FEniCS:$$\boldsymbol{\nabla} \cdot \begin{pmatrix}  (1+\alpha^2y^2)\frac{\partial u}{\partial x} - xy\alpha^2\frac{\partial u}{\partial y} \\  - xy\alpha^2\frac{\partial u}{\partial x}+(1+\alpha^2x^2)\frac{\partial u}{\partial y} \end{pmatrix}=0.$$For $\alpha=0$ this will be a Laplace equation. As far as I understand, the weak form will look like:$$\int_{\Omega} \begin{pmatrix}  (1+\alpha^2y^2)\frac{\partial u}{\partial x} - xy\alpha^2\frac{\partial u}{\partial y} \\  - xy\alpha^2\frac{\partial u}{\partial x}+(1+\alpha^2x^2)\frac{\partial u}{\partial y} \end{pmatrix} \cdot \nabla v \, \mathrm{d}x =       0 \quad \forall v \in V.$$I have problems expressing this equation in FEniCS. I figured I need something like this (for $\alpha=0$):u = TrialFunction(V)v = TestFunction(V)g = as_vector((u.dx(0), u.dx(1))) # <-- modify here?a = dot(g, grad(v))*dxu = Function(V)solve(a == Constant(0) * v * dx, u, bc)Is it correct? What should I do for $\alpha\neq0$? How to add something that depends on coordinates $x$, $y$ to the variable g above?Also do I have to write Constant(0) * v * dx as the right part? Can it be just 0?
FEniCS: how to access coordinates when writing an equation for a trial function
finite element;python;fenics
x = V.cell().xthen use x[0] and x[1] as $x$ and $y$ respectively.Right-hand side of LinearVariationalProblem needs to be rank 1 form - this is expressed by dependendnce on TestFunction and independence on TrialFunction.