Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use separate representation of electromagnetic field to push particles #52

Open
alecjohnson opened this issue Oct 8, 2013 · 0 comments

Comments

@alecjohnson
Copy link
Contributor

I am changing EMfield3D to use separate arrays to solve the electromagnetic field and to represent the electromagnetic field used to push particles. I am declaring the new fields representation as a four-dimensional array of type pfloat (float or double according to user configuration):

  array4_pfloat EMfields3D:fieldforPcls(nxn,nyn,nzn,6)

The following benefits are anticipated:

  • One can add a background field, as was attempted under the commit discussed in issue Use of B_ext is incorrect. #38.
  • This is precisely the data that needs to be transferred from the field solver to the particle pusher (e.g. from the cluster to the booster in the DEEP architecture). When singe-precision is used for particles (i.e. pfloat=float), then only half as much data needs to be transferred from the cluster to the booster.
  • When pushing particles, array access is accelerated (by roughly 30% on Xeon), due to the fact that a single call of the form
          arr1_pfloat_get field000 = fieldForPcls[ix][iy][iz];
        
    can be made followed by six one-dimensional array accesses of the form
          Bxl += weight000 * field000[0];
          Byl += weight000 * field000[1];
          Bzl += weight000 * field000[2];
          Exl += weight000 * field000[3];
          Eyl += weight000 * field000[4];
          Ezl += weight000 * field000[5];
        
    rather than having to recalculate a 3-dimensional subscript six times:
          Bxl += weight000 * Bx[ix][iy][iz];
          Byl += weight000 * By[ix][iy][iz];
          Bzl += weight000 * Bz[ix][iy][iz];
          Exl += weight000 * Ex[ix][iy][iz];
          Eyl += weight000 * Ey[ix][iy][iz];
          Ezl += weight000 * Ez[ix][iy][iz];
        
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant