# discrete definition of curl $\nabla \times \vec{A}$ on a 3D grid?

I have the data for 3D vector field $$\vec{A}$$ (with components $$\vec{A_1}$$, $$\vec{A_2}$$ and $$\vec{A_3}$$) sampled on a 3D grid with integer indices i, j and k.

Assuming that only the third component $$\vec{A_3}$$ is non-zero, I have the expression for the components of curl: $$\vec{B} = \nabla \times \vec{A}$$ as:

B1 = -(A3[i][j][k] - A3[i][j + 1][k] + A3[i + 1][j][k] - A3[i + 1][j + 1][k])/ (2 * dx[2])

B2 = (A3[i][j][k] + A3[i][j + 1][k] - A3[i + 1][j][k] - A3[i + 1][j +1][k]) / (2 * dx[1])

B3 = 0


How can the above definition be expanded for a vector $$\vec{A}$$ with all three components non-zero on a full 3D grid?

I have seen the answer (discrete definitions of curl $\nabla \times F$?) for a similar question on a 2D grid, but I am not sure how to expand it for a 3D grid.

• Hint: The curl is a differential operator, and these derivatives can be approximated by finite differences. This is of course exactly what has been done to derive the formulas you show above. Do you understand why they have the form you have, and if so can you derive what the corresponding operations in the full curl operator are? Feb 2, 2023 at 18:14
• @WolfgangBangerth Thank you very much for your reply. Yes, I understand that this is done with the finite differences method. My issue is in understanding this particular choice of cell corners in the formulae given above (this from a previous code written by someone and it works properly in 2D in computing the curl of the vector field - with only the third component nonzero - I describe above). Also the -ve sign in the beginning of expression for B1 confuses me as the the analytical form looks like: $B_1 = \frac{\partial A_3}{\partial x_2} - \frac{\partial A_2}{\partial x_3}$. Feb 3, 2023 at 12:10
• @rockonkl check out this description of the yee dual grid. which help you ammar-hakim.org/sj/je/je7/je7-dual-yee.html Feb 3, 2023 at 15:49
• @user7257 Thank you. I will check it. Feb 6, 2023 at 12:06