bmad-sim / bmad-ecosystem

Bmad simulation ecosystem for simulating high energy storage rings.
https://www.classe.cornell.edu/bmad/
7 stars 13 forks source link

set ele beginning:end space_charge_method = fft_3d skips super_slaves #1023

Closed ChristopherMayes closed 2 weeks ago

ChristopherMayes commented 2 weeks ago

The following modifies the lattice from bmad-doc/tao_examples/space_charge to have a zero-strength quad superimposing the pipe.

bmad-doc/tao_examples/space_charge % tao -lat lat2.bmad with

lat2.bmad

parameter[lattice] = "Space Charge example"

beginning[beta_a] = 1000
beginning[beta_B] = 1000
parameter[e_tot] = 10e6
parameter[particle] = electron
parameter[geometry] = open

p1: pipe, L = 1

q1: quad, superimpose, ref=p1, L = 0.99

lat: line = (p1)

use, lat

This works:

Tao> set ele * space_charge_method = fft_3d
[INFO] tao_set_elements_cmd:
    Note: 4 elements (out of 7) set.
sho lat -at 
Tao> sho lat -at space_charge_method
# Values shown are for the Downstream End of each Element:
# Index  name      key                      s       l  space_charge_method
      0  BEGINNING Beginning_Ele        0.000     ---
      1  P1#1      Pipe                 0.005   0.005  FFT_3D
      2  P1\Q1     Quadrupole           0.995   0.990  FFT_3D
      3  P1#2      Pipe                 1.000   0.005  FFT_3D
      4  END       Marker               1.000   0.000
Lord Elements:
      5  P1        Pipe                 1.000   1.000  FFT_3D
      6  Q1        Quadrupole           0.995   0.990  FFT_3D
# Index  name      key                      s       l  space_charge_method
# Values shown are for the Downstream End of each Element:

But this doesn't:

Tao> set ele * space_charge_method = off
[INFO] tao_set_elements_cmd:
    Note: 4 elements (out of 7) set.
^[[A
Tao> set ele beginning:end space_charge_method = fft_3d
[INFO] tao_set_elements_cmd:
    Note: 2 elements (out of 5) set.

Tao> sho lat -at space_charge_method
# Values shown are for the Downstream End of each Element:
# Index  name      key                      s       l  space_charge_method
      0  BEGINNING Beginning_Ele        0.000     ---
      1  P1#1      Pipe                 0.005   0.005  FFT_3D
      2  P1\Q1     Quadrupole           0.995   0.990  Off
      3  P1#2      Pipe                 1.000   0.005  FFT_3D
      4  END       Marker               1.000   0.000
Lord Elements:
      5  P1        Pipe                 1.000   1.000  FFT_3D
      6  Q1        Quadrupole           0.995   0.990  Off
# Index  name      key                      s       l  space_charge_method

The tracking plot shows that indeed space charge is not on in the last case.

DavidSagan commented 2 weeks ago

I ran Tao with ifort and gcc compiled and did not see the bug:

Tao> sho lat -at space_charge_method
# Values shown are for the Downstream End of each Element:
# Index  name      key                      s       l  space_charge_method
      0  BEGINNING Beginning_Ele        0.000     ---
      1  P1#1      Pipe                 0.005   0.005  FFT_3D
      2  P1\Q1     Quadrupole           0.995   0.990  FFT_3D
      3  P1#2      Pipe                 1.000   0.005  FFT_3D
      4  END       Marker               1.000   0.000
Lord Elements:
      5  P1        Pipe                 1.000   1.000  FFT_3D
      6  Q1        Quadrupole           0.995   0.990  FFT_3D
# Index  name      key                      s       l  space_charge_method
# Values shown are for the Downstream End of each Element:

Tao> set ele * space_charge_method = off
[INFO] tao_set_elements_cmd:
    Note: 4 elements (out of 7) set.

Tao> sho lat -at space_charge_method
# Values shown are for the Downstream End of each Element:
# Index  name      key                      s       l  space_charge_method
      0  BEGINNING Beginning_Ele        0.000     ---
      1  P1#1      Pipe                 0.005   0.005  Off
      2  P1\Q1     Quadrupole           0.995   0.990  Off
      3  P1#2      Pipe                 1.000   0.005  Off
      4  END       Marker               1.000   0.000
Lord Elements:
      5  P1        Pipe                 1.000   1.000  Off
      6  Q1        Quadrupole           0.995   0.990  Off
# Index  name      key                      s       l  space_charge_method
# Values shown are for the Downstream End of each Element:

Can you reproduce on a CLASSE computer?

DavidSagan commented 2 weeks ago

Since this problem cannot be reproduced, will close this issue.