Skip to content

Commit

Permalink
New test for propagation in the foborodobo lattice showing the problem
Browse files Browse the repository at this point in the history
with spectator particles occurs for plain sbends.

Refinement of the Booster propagation test showing no issues with spectator
particles occur at least over 100 turns. The Booster uses parallel-faced
sbends.

Cleanup of the iota_propagation test

Demonstration that sbend propagation has a problem with spectator particles
for both the particle at 0 and the one at the particular value taken from
an IOTA simulation.
  • Loading branch information
Eric G. Stern committed Oct 16, 2024
1 parent 05cb86e commit 4d2b12c
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 17 deletions.
4 changes: 4 additions & 0 deletions src/synergia/simulation/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ add_executable(test_booster_propagation_spectator_particles test_booster_propaga
target_link_libraries(test_booster_propagation_spectator_particles PRIVATE synergia_simulation ${testing_libs})
add_mpi_test(test_booster_propagation_spectator_particles 1)

add_executable(test_foborodobo_propagation test_foborodobo_propagation.cc ${test_main})
target_link_libraries(test_foborodobo_propagation PRIVATE synergia_simulation ${testing_libs})
add_mpi_test(test_foborodobo_propagation 1)

add_executable(test_iota_sbend_propagation test_iota_sbend_propagation.cc ${test_main})
target_link_libraries(test_iota_sbend_propagation PRIVATE synergia_simulation ${testing_libs})
add_mpi_test(test_iota_sbend_propagation 1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
#include "synergia/utils/logger.h"

int macroparticles = 16;
int spectparticles = 16;
int spectparticles = 4;
double realparticles = 285452129459.3449; // 0.1 mA in IOTA
int nturns = 10;
int nturns = 100;

Lattice
get_lattice()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,26 +43,14 @@ mseqare: marker;
mphm1ri: marker;
sqa2r: quadrupole,l:= 0.1,k1s:= 0;
qa4r: quadrupole,l:= 0.21,k1:=kqa4r ;
dedge30: sextupole, l=0.0, k2=0.0;
m1r: sbend,l:= 0.3911403725,angle:= 0.5235987756;
!iota: sequence, l = 39.95567226;
iota: sequence, l = 3.508540575;
!mseqari, at = 0;
!ibpma1, at = 0.02;
!qa1r, at = 1.0175;
!qa2r, at = 1.3625;
!sqa1r, at = 1.99;
!ibpma2r, at = 2.095;
!qa3r, at = 2.2975;
qa4r, at = 2.6525; ! this one has to be there for the error to occur
ibpma3r, at = 2.865;
sqa2r, at = 2.97;
mseqare, at = 3.0405;
mphm1ri, at = 3.0405;
!dedge30, at = 3.117400202;
m1r, at = 3.312970389;
endsequence;
beam, particle=proton, energy = 0.00250 + pmass;
Expand Down Expand Up @@ -131,6 +119,14 @@ test_particles(Bunch_simulator& sim, Lattice const& lattice, int turn, int step)
auto bp = bunch.get_local_particles(ParticleGroup::regular);
auto sp = bunch.get_local_particles(ParticleGroup::spectator);

auto const& lems = lattice.get_elements();
// steps start at 1 for some reason

auto it = lems.begin();
std::advance(it, step-1);

std::cout << "step: " << step << std::endl;
std::cout << it->get_name() << ": " << it->get_type_name() << std::endl;
std::cout << "0: " << std::scientific << std::setprecision(16) << bp(0, 0) << " <-> " << sp(0, 0) << std::endl;
std::cout << "1: " << std::scientific << std::setprecision(16) << bp(0, 1) << " <-> " << sp(0, 1) << std::endl;
std::cout << "2: " << std::scientific << std::setprecision(16) << bp(0, 2) << " <-> " << sp(0, 2) << std::endl;
Expand Down
23 changes: 20 additions & 3 deletions src/synergia/simulation/tests/test_iota_sbend_propagation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ TEST_CASE("create_propagator")

// create and initialize the bunch simulator for propagation
Bunch_simulator
create_simulator(Lattice const& lattice)
create_simulator(Lattice const& lattice, double cdt0 = 0.0)
{

// create the simulator
Expand All @@ -77,14 +77,16 @@ create_simulator(Lattice const& lattice)
for (int j=0; j<6; ++j) {
bp(i, j) = 0.0;
}
bp(0, 4) = -8.8817841970012523e-16;
// bp(0, 4) = -8.8817841970012523e-16;
bp(0, 4) = cdt0;
}
auto sbp = bunch.get_local_particles(ParticleGroup::spectator);
for (int i=0; i<spectparticles; ++i) {
for (int j=0; j<6; ++j) {
sbp(i, j) = 0.0;
}
sbp(0, 4) = -8.8817841970012523e-16;
// sbp(0, 4) = -8.8817841970012523e-16;
sbp(0, 4) = cdt0;
}

bunch.checkin_particles();
Expand Down Expand Up @@ -141,3 +143,18 @@ TEST_CASE("propagate_particles")
p.propagate(sim, simlog, nturns);
}

TEST_CASE("propagate_particles1")
{
Lattice lattice(get_lattice());

auto sim = create_simulator(lattice, -8.8817841970012523e-16);

sim.reg_prop_action_step_end(test_particles);

Propagator p(create_propagator(lattice));

Logger simlog(0, LoggerV::INFO_STEP);

p.propagate(sim, simlog, nturns);
}

0 comments on commit 4d2b12c

Please sign in to comment.