How to Plug Numerical Solution Back into Strong Form to Verify Convergence

I am new to FEniCS and wanted help with planning how I can check the results of solving my coupled PDEs. My strong form is:

X + Y - curl(Y) = A
X + Y + curl(X) = B,

where I am solving for the vectors X and Y, and have A and B as source vectors that depend on space.

I managed to implement this in FEniCS using Nedelec elements of the 1st kind for X and Y. However, to check whether my solution is correct, I chose a sample problem in a unit 3D cube, chose two analytic expressions for X and Y and calculated the corresponding A and B.
I then plan on using these two vectors for A and B to implement my FEniCS code to solve for X and Y.

To verify my results, I want to plug the numerical solutions for X and Y into expressions defining the left hand side of my strong form and compute the difference between these values for A and B and their expected values that depend on space.

How can I achieve this given how A and B depend on space?
The article at /pub/tutorial/html/._ftut1019.html#ch:poisson0:verify1 (titled “Degrees of freedom and function evaluation”) discusses how I should extract the coordinates of the nodes for best results(?), and the demo at /pub/tutorial/html/._ftut1004.html has the following code for calculating the maximum error at all vertices.

vertex_values_u_D = u_D.compute_vertex_values(mesh)
vertex_values_u = u.compute_vertex_values(mesh)
import numpy as np
error_max = np.max(np.abs(vertex_values_u_D - vertex_values_u))

However, I do not know how to define an expression u_D that will take as input my numerical solutions for X and Y at the relevant nodes. How do I do this? Is there some built-in function in FEniCS that will allow me to do this?

The long-winded alternative I can think of looks like this:

  1. use analytical solution for A and B to solve for X and Y.
  2. extract locations of vertices** to come up with numerical list of values for the expected (i.e. ‘true’) values of A and B.
  3. separately, calculate ‘numerical’ values of A and B using expression for strong form, for relevant points in space.
  4. subtract results from 2 and 3 to calculate error.

** are vertices still the way to go for Nedelec edge elements?

I understand that my problem will be simpler if I kept A and B simpler, but even in that case, I wanted to find an easier way (if possible) to plug my solution back in to verify my results.

I apologize if this is a trivial question, but I would appreciate any resources/demos to similar work, or direct clarification. Alternatively I would appreciate better ways to verify my calculations. I want to test for convergence against mesh density. Thanks!