One order PDE system

Dear all, I want to solve a linear order PDE system:

\begin{align} \left\{ \begin{array}{rcll} \mathrm{i} \beta \partial_x \psi + \mathrm{i} \alpha \partial_y \psi + k_a\left[n_a(x, y) - 1\right]I \psi &=& 0, & \text{in } \Omega, \\ \psi(x, y) &=& g(x, y), & \text{on } \partial \Omega. \end{array} \right. \end{align}

where

\begin{equation} \alpha = \begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix}, \quad \beta = \begin{pmatrix} 1 & 0 \\ 0 & -1 \end{pmatrix}, \end{equation}

and \psi=(\psi_1,\psi_2) is a linear system
During my derivation of the weak form, I find that I need to use the vector value test function v=(v_1,v_2). Besides, terms like \partial_xv_1, \partial_y v_2 will appear too. My questions are that how to write such weak form in dolfinx and how to describe terms like \partial_xv_1, \partial_y v_2?

See for instance: How to get the partial derivative of the numerical solution? - #2 by dokken

Thanks for your advice. I want to write it in Dolfinx. So how to interpolate this quantity into a suitable space? Also I want to use integration by parts, so my goal is to use the derivative of the test functions like v_{1,x}, since I will use a vector test functions.

You can use u.dx(i) in DOLFINx as well as legacy dolfin.

Interpolation of this quantity can be done with DOLFINx.fem.Expression: