0
$\begingroup$

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.

$\endgroup$
4
  • 2
    $\begingroup$ 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? $\endgroup$ Feb 2 at 18:14
  • $\begingroup$ @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}$. $\endgroup$
    – rockonkl
    Feb 3 at 12:10
  • $\begingroup$ @rockonkl check out this description of the yee dual grid. which help you ammar-hakim.org/sj/je/je7/je7-dual-yee.html $\endgroup$
    – user7257
    Feb 3 at 15:49
  • $\begingroup$ @user7257 Thank you. I will check it. $\endgroup$
    – rockonkl
    Feb 6 at 12:06

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.