Skip to content

Commit

Permalink
Tracking Modes: Validate Collective Effects
Browse files Browse the repository at this point in the history
Throw errors if unsupported modes are selected.
  • Loading branch information
ax3l committed Feb 21, 2025
1 parent 26617f9 commit 716c149
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/tracking/envelope.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,18 @@ namespace impactx
{
amrex::Print() << " Space Charge effects: " << amrex::getEnumNameString(space_charge) << "\n";
}
if (space_charge == SpaceChargeAlgo::on_3D)
{
throw std::runtime_error("3D space charge effects are not yet implemented for envelope tracking.");
}

bool csr = false;
pp_algo.query("csr", csr);
AMREX_ALWAYS_ASSERT_WITH_MESSAGE(!csr, "CSR not yet implemented for envelope tracking.");
if (verbose > 0)
{
amrex::Print() << " CSR effects: " << csr << "\n";
}
AMREX_ALWAYS_ASSERT_WITH_MESSAGE(!csr, "CSR effects are not yet implemented for envelope tracking.");

// periods through the lattice
int num_periods = 1;
Expand Down
4 changes: 4 additions & 0 deletions src/tracking/particles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ namespace impactx
if (verbose > 0) {
amrex::Print() << " Space Charge effects: " << amrex::getEnumNameString(space_charge) << "\n";
}
if (space_charge == SpaceChargeAlgo::on_2D)
{
throw std::runtime_error("2D space charge effects are not yet implemented for particle tracking.");
}

amrex::ParmParse const pp_algo("algo");
bool csr = false;
Expand Down
16 changes: 16 additions & 0 deletions src/tracking/reference.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
* License: BSD-3-Clause-LBNL
*/
#include "ImpactX.H"
#include "initialization/Algorithms.H"
#include "initialization/InitAmrCore.H"
#include "particles/ImpactXParticleContainer.H"
#include "particles/Push.H"
Expand All @@ -20,6 +21,7 @@
#include <AMReX_Print.H>

#include <memory>
#include <stdexcept>


namespace impactx
Expand Down Expand Up @@ -60,6 +62,20 @@ namespace impactx

}

auto space_charge = get_space_charge_algo();
if (space_charge != SpaceChargeAlgo::off)
{
throw std::runtime_error("Space charge effects cannot be modeled for single particle tracking.");
}

amrex::ParmParse const pp_algo("algo");
bool csr = false;
pp_algo.query("csr", csr);
if (!csr)
{
throw std::runtime_error("CSR effects cannot be modeled for single particle tracking.");
}

// periods through the lattice
int num_periods = 1;
amrex::ParmParse("lattice").queryAddWithParser("periods", num_periods);
Expand Down

0 comments on commit 716c149

Please sign in to comment.