Skip to content

Commit

Permalink
Now builds and runs.
Browse files Browse the repository at this point in the history
  • Loading branch information
ejpaul committed Aug 29, 2024
1 parent 55e5bbd commit 371a467
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 19 deletions.
6 changes: 3 additions & 3 deletions examples/tracing_boozer.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@

gc_tys, gc_zeta_hits = trace_particles_boozer(
field, stz_inits, vpar_inits, tmax=1e-2, mass=mass, charge=ELEMENTARY_CHARGE,
Ekin=Ekin, tol=1e-8, mode='gc_vac', stopping_criteria=[MaxToroidalFluxStoppingCriterion(0.99), MinToroidalFluxStoppingCriterion(0.01), ToroidalTransitStoppingCriterion(100, True)],
Ekin=Ekin, tol=1e-8, mode='gc_vac', stopping_criteria=[MaxToroidalFluxStoppingCriterion(0.99), MinToroidalFluxStoppingCriterion(0.01), ToroidalTransitStoppingCriterion(100)],
forget_exact_path=False)

Nparticles = len(gc_tys)
Expand Down Expand Up @@ -107,7 +107,7 @@

gc_tys, gc_zeta_hits = trace_particles_boozer(
field, stz_inits, vpar_inits, tmax=1e-2, mass=mass, charge=ELEMENTARY_CHARGE,
Ekin=Ekin, zetas=[0], tol=1e-8, stopping_criteria=[MinToroidalFluxStoppingCriterion(0.01), MaxToroidalFluxStoppingCriterion(0.99), ToroidalTransitStoppingCriterion(30, True)],
Ekin=Ekin, zetas=[0], tol=1e-8, stopping_criteria=[MinToroidalFluxStoppingCriterion(0.01), MaxToroidalFluxStoppingCriterion(0.99), ToroidalTransitStoppingCriterion(30)],
forget_exact_path=False)

resonances = compute_resonances(gc_tys, gc_zeta_hits, ma=None, delta=0.01)
Expand All @@ -129,7 +129,7 @@

gc_tys, gc_zeta_hits = trace_particles_boozer(
field, stz_res, vpar_res, tmax=1e-2, mass=mass, charge=ELEMENTARY_CHARGE,
Ekin=Ekin, zetas=[0], tol=1e-8, stopping_criteria=[MinToroidalFluxStoppingCriterion(0.01), MaxToroidalFluxStoppingCriterion(0.99), ToroidalTransitStoppingCriterion(30, True)],
Ekin=Ekin, zetas=[0], tol=1e-8, stopping_criteria=[MinToroidalFluxStoppingCriterion(0.01), MaxToroidalFluxStoppingCriterion(0.99), ToroidalTransitStoppingCriterion(30)],
forget_exact_path=False)

plt.figure()
Expand Down
5 changes: 2 additions & 3 deletions src/simsoptpp/python_tracing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,14 @@ void init_tracing(py::module_ &m){
py::arg("vacuum"),
py::arg("noK"),
py::arg("solveSympl")=false,
py::arg("GPU")=false,
py::arg("zetas")=vector<double>{},
py::arg("omegas")=vector<double>{},
py::arg("stopping_criteria")=vector<shared_ptr<StoppingCriterion>>{},
py::arg("zetas_stop")=false,
py::arg("vpars_stop")=false,
py::arg("forget_exact_path")=false,
py::arg("axis")=0,
py::arg("predictor_step")=true,
py::arg("zetas_stop")=false,
py::arg("vpars_stop")=false,
py::arg("vpars")=vector<double>{}
);

Expand Down
16 changes: 6 additions & 10 deletions src/simsoptpp/tracing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1180,8 +1180,8 @@ particle_guiding_center_boozer_tracing(
shared_ptr<BoozerMagneticField<T>> field, array<double, 3> stz_init,
double m, double q, double vtotal, double vtang, double tmax, double dt, double abstol, double reltol, double roottol,
bool vacuum, bool noK, bool solveSympl, vector<double> zetas, vector<double> omegas,
vector<shared_ptr<StoppingCriterion>> stopping_criteria,
bool zetas_stop, bool vpars_stop, bool forget_exact_path, int axis, bool predictor_step, vector<double> vpars)
vector<shared_ptr<StoppingCriterion>> stopping_criteria, bool forget_exact_path, int axis, bool predictor_step,
bool zetas_stop, bool vpars_stop, vector<double> vpars)
{
typename BoozerMagneticField<T>::Tensor2 stz({{stz_init[0], stz_init[1], stz_init[2]}});
field->set_points(stz);
Expand Down Expand Up @@ -1241,21 +1241,17 @@ particle_guiding_center_boozer_tracing(
}
}

template<template<class, std::size_t, xt::layout_type> class T>
template
tuple<vector<array<double, 6>>, vector<array<double, 7>>>
particle_guiding_center_boozer_perturbed_tracing<xt::pytensor>(
shared_ptr<BoozerMagneticField<xt::pytensor>> field, array<double, 3> stz_init,
double m, double q, double vtotal, double vtang, double mu, double tmax, double abstol, double reltol,
bool vacuum, bool noK, vector<double> zetas, vector<double> omegas,
vector<shared_ptr<StoppingCriterion>> stopping_criteria,
bool zetas_stop, bool vpars_stop, double Phihat,
double omega, int Phim, int Phin, double phase, bool forget_exact_path, int axis, vector<double> vpars={});
double omega, int Phim, int Phin, double phase, bool forget_exact_path, int axis, vector<double> vpars);

template<template<class, std::size_t, xt::layout_type> class T>
template
tuple<vector<array<double, 5>>, vector<array<double, 6>>>
particle_guiding_center_boozer_tracing<xt::pytensor>(
shared_ptr<BoozerMagneticField<xt::pytensor>> field, array<double, 3> stz_init,
double m, double q, double vtotal, double vtang, double tmax, double dt, double abstol, double reltol, double roottol,
bool vacuum, bool noK, bool GPU, bool solveSympl, vector<double> zetas, vector<double> omegas,
vector<shared_ptr<StoppingCriterion>> stopping_criteria,
bool zetas_stop, bool vpars_stop, bool forget_exact_path, int axis, bool predictor_step, vector<double> vpars={});
shared_ptr<BoozerMagneticField<xt::pytensor>> field, array<double, 3> stz_init, double m, double q, double vtotal, double vtang, double tmax, double dt, double abstol, double reltol, double roottol, bool vacuum, bool noK, bool solveSympl, vector<double> zetas, vector<double> omegas, vector<shared_ptr<StoppingCriterion>> stopping_criteria, bool forget_exact_path, int axis, bool predictor_step, bool zetas_stop, bool vpars_stop, vector<double> vpars);
5 changes: 2 additions & 3 deletions src/simsoptpp/tracing.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,15 +112,14 @@ particle_guiding_center_boozer_perturbed_tracing(
vector<shared_ptr<StoppingCriterion>> stopping_criteria,
bool zetas_stop=false, bool vpars_stop=false,
double alphahat=0, double omega=0, int alpham=0, int alphan=0, double phase=0,
bool forget_exact_path=false, int axis=0, vector<double> vpars);
bool forget_exact_path=false, int axis=0, vector<double> vpars={});

template<template<class, std::size_t, xt::layout_type> class T>
tuple<vector<array<double, 5>>, vector<array<double, 6>>>
particle_guiding_center_boozer_tracing(
shared_ptr<BoozerMagneticField<T>> field, array<double, 3> stz_init,
double m, double q, double vtotal, double vtang, double tmax, double dt, double abstol, double reltol, double roottol,
bool vacuum, bool noK, bool solveSympl, vector<double> zetas, vector<double> omegas,
vector<shared_ptr<StoppingCriterion>> stopping_criteria,
bool vacuum, bool noK, bool solveSympl, vector<double> zetas, vector<double> omegas, vector<shared_ptr<StoppingCriterion>> stopping_criteria,
bool forget_exact_path=false, int axis=0, bool predictor_step=true,
bool zetas_stop=false, bool vpars_stop=false, vector<double> vpars={});

0 comments on commit 371a467

Please sign in to comment.