Particle database base class. More...
#include <particledatabase.hpp>

Public Member Functions | |
virtual | ~ParticleDataBase () |
Virtual destructor. More... | |
void | set_thread_count (uint32_t threadcount) |
Set the number of threads used for calculation. More... | |
void | set_accuracy (double epsabs, double epsrel) |
Set the accuracy requirement for calculation. More... | |
void | set_bfield_suppression (const CallbackFunctorD_V *functor) |
Set magnetic field suppression location depedent callback functor. More... | |
void | set_trajectory_handler_callback (TrajectoryHandlerCallback *thand_cb) |
Set trajectory handler callback. More... | |
void | set_trajectory_end_callback (TrajectoryEndCallback *tend_cb) |
Set trajectory end callback. More... | |
void | set_trajectory_surface_collision_callback (TrajectorySurfaceCollisionCallback *tsur_cb) |
Set trajectory surface collision callback. More... | |
void | set_relativistic (bool enable) |
Set relativistic particle iteration. More... | |
void | set_surface_collision (bool surface_collision) |
Set surface collision model to be used. More... | |
void | set_polyint (bool polyint) |
Set the interpolation type to polynomial(true) or linear(false). More... | |
bool | get_polyint (void) const |
Get current interpolation type. More... | |
void | set_trajectory_interpolation (trajectory_interpolation_e intrp) |
Set trajectory interpolation type. More... | |
trajectory_interpolation_e | get_trajectory_interpolation (void) const |
Get trajectory interpolation type. More... | |
void | set_scharge_deposition (scharge_deposition_e type) |
Set space charge deposition type. More... | |
scharge_deposition_e | get_scharge_deposition (void) const |
Get space charge deposition type. More... | |
void | set_max_steps (uint32_t maxsteps) |
Set maximum number of steps to iterate. More... | |
void | set_max_time (double maxt) |
Set maximum lifetime of particle in simulation. More... | |
void | set_save_all_points (bool save_points) |
Set trajectory saving. More... | |
void | set_save_trajectories (uint32_t div) |
Set trajectory saving. More... | |
uint32_t | get_save_trajectories (void) const |
Get trajectory saving. More... | |
void | set_mirror (const bool mirror[6]) |
Set particle mirroring on boundaries. More... | |
void | get_mirror (bool mirror[6]) const |
Get particle mirroring on boundaries. More... | |
int | get_iteration_number (void) const |
Get the number of iteration rounds done. More... | |
double | get_rhosum (void) const |
Return sum of defined beam space charge density. More... | |
void | set_rhosum (double rhosum) |
Set sum of defined beam space charge density. More... | |
const ParticleStatistics & | get_statistics (void) const |
Get particle iterator statistics. More... | |
geom_mode_e | geom_mode () const |
Return geometry mode. More... | |
size_t | size (void) const |
Returns particle count. More... | |
virtual ParticleBase & | particle (uint32_t i)=0 |
Returns a reference to particle i. More... | |
virtual const ParticleBase & | particle (uint32_t i) const =0 |
Returns a const reference to particle i. More... | |
double | traj_length (uint32_t i) const |
Returns the length of trajectory i. More... | |
size_t | traj_size (uint32_t i) const |
Returns number of trajectory points for particle i. More... | |
virtual const ParticlePBase & | trajectory_point (uint32_t i, uint32_t j) const =0 |
Gets the particle i trajectory point j as particle point. More... | |
void | trajectory_point (double &t, Vec3D &loc, Vec3D &vel, uint32_t i, uint32_t j) const |
Gets the particle i trajectory point j into vel, loc and t. More... | |
void | trajectories_at_plane (TrajectoryDiagnosticData &tdata, coordinate_axis_e axis, double val, const std::vector< trajectory_diagnostic_e > &diagnostics) const |
Gets trajectory diagnostic diagnostics at plane axis = val in trajectory diagnostic data object tdata. More... | |
void | build_trajectory_density_field (MeshScalarField &tdens) const |
Build trajectory density field. More... | |
void | clear (void) |
Clears the particle database of all particles. More... | |
void | clear_trajectories (void) |
Clears the particle trajectory database. More... | |
void | clear_trajectory (size_t a) |
Clears particle a in the particle trajectory database. More... | |
void | reset_trajectories (void) |
Clears the particle trajectory database and set particles to initial coordinates. More... | |
void | reset_trajectory (size_t a) |
Clears the particle trajectory and set the particle to initial coordinates. More... | |
void | reserve (size_t size) |
Reserve memory for size particles. More... | |
void | iterate_trajectories (MeshScalarField &scharge, const VectorField &efield, const VectorField &bfield) |
Iterate particles through the geometry. More... | |
void | step_particles (MeshScalarField &scharge, const VectorField &efield, const VectorField &bfield, double dt) |
Step particles forward by time step dt. More... | |
virtual void | save (const std::string &filename) const =0 |
Saves data to a new file filename. More... | |
virtual void | save (std::ostream &os) const =0 |
Saves data to stream. More... | |
virtual void | debug_print (std::ostream &os) const =0 |
Print debugging information to os. More... | |
Protected Member Functions | |
ParticleDataBase () | |
Constructor. More... | |
ParticleDataBase (const ParticleDataBase &pdb) | |
Copy constructor. More... | |
const ParticleDataBase & | operator= (const ParticleDataBase &pdb) |
Assignment. More... | |
void | set_implementation_pointer (class ParticleDataBaseImp *imp) |
Set particle database implementation pointer. More... | |
Detailed Description
Particle database base class.
Particle database base class holds the definitions of particle iteration parameters. Base class also provides a possibility for general pointer to particle database and virtual functions for accessing particles.
Constructor & Destructor Documentation
◆ ParticleDataBase() [1/2]
|
protected |
Constructor.
◆ ParticleDataBase() [2/2]
|
protected |
Copy constructor.
◆ ~ParticleDataBase()
|
virtual |
Virtual destructor.
Member Function Documentation
◆ build_trajectory_density_field()
void ParticleDataBase::build_trajectory_density_field | ( | MeshScalarField & | tdens | ) | const |
Build trajectory density field.
This method builds a current density map (A/m2) from the particles. It is similar to space charge map, but the particle velocities do not affect the value, only the trajectory density and the current carried by the trajectories.
For historical reasons this function is called build_trajectory_density_field() even though it produces a current density map. The scalar field tdens mesh can differ from geometry mesh.
◆ clear()
void ParticleDataBase::clear | ( | void | ) |
Clears the particle database of all particles.
Clears the database of particles. Also clears beam space charge sum.
◆ clear_trajectories()
void ParticleDataBase::clear_trajectories | ( | void | ) |
Clears the particle trajectory database.
The particle properties are otherwise conserved, but existing trajectories are cleared.
◆ clear_trajectory()
void ParticleDataBase::clear_trajectory | ( | size_t | a | ) |
Clears particle a in the particle trajectory database.
The particle properties are otherwise conserved, but existing trajectory are cleared.
◆ debug_print()
|
pure virtual |
Print debugging information to os.
Implemented in ParticleDataBase3D, ParticleDataBaseCyl, and ParticleDataBase2D.
◆ geom_mode()
geom_mode_e ParticleDataBase::geom_mode | ( | void | ) | const |
Return geometry mode.
◆ get_iteration_number()
int ParticleDataBase::get_iteration_number | ( | void | ) | const |
Get the number of iteration rounds done.
◆ get_mirror()
void ParticleDataBase::get_mirror | ( | bool | mirror[6] | ) | const |
Get particle mirroring on boundaries.
Mirroring is read for (xmin,xmax,ymin,ymax,zmin,zmax) borders. Mirroring is always false for directions that do not exist.
◆ get_polyint()
bool ParticleDataBase::get_polyint | ( | void | ) | const |
Get current interpolation type.
- Deprecated:
- This function is deprecated. It can still be used to get the interpolation type for polynomial(true) or linear(false) interpolation. If interpolation type is something else, the function will return false. Please use get_trajectory_interpolation().
◆ get_rhosum()
double ParticleDataBase::get_rhosum | ( | void | ) | const |
Return sum of defined beam space charge density.
Returns the summed beam space charge density for all beams defined with "add_beam" functions. Does not work with individually added particle trajectories. rhosum is cleared with particle database clearing function clear().
Can be used to program plasma electron density with EpotProblem::set_pexp_plasma() for example. Please note that it gives to accumulated charge density which might be incorrect for multi-beam extraction simulation defined with several calls to "add_beam" functions.
◆ get_save_trajectories()
uint32_t ParticleDataBase::get_save_trajectories | ( | void | ) | const |
Get trajectory saving.
If div is zero, no trajectories are saved. If div is one, every trajectory is saved. If div N>1, every Nth trajectory is saved.
◆ get_scharge_deposition()
scharge_deposition_e ParticleDataBase::get_scharge_deposition | ( | void | ) | const |
Get space charge deposition type.
◆ get_statistics()
const ParticleStatistics & ParticleDataBase::get_statistics | ( | void | ) | const |
Get particle iterator statistics.
◆ get_trajectory_interpolation()
trajectory_interpolation_e ParticleDataBase::get_trajectory_interpolation | ( | void | ) | const |
Get trajectory interpolation type.
◆ iterate_trajectories()
void ParticleDataBase::iterate_trajectories | ( | MeshScalarField & | scharge, |
const VectorField & | efield, | ||
const VectorField & | bfield | ||
) |
Iterate particles through the geometry.
The particles defined in particle database pdb are iterated through electric field efield and magnetic field bfield in geometry geom. Space charge density field scharge is set from the particle trajectories.
The meshes of the geometry, the space charge field and the electric field have to be equal. The magnetic field mesh can be selected independently. This allows minimization of the memory use in the case where electric field needs high resolution, but magnetic field is relatively smooth.
◆ operator=()
|
protected |
Assignment.
◆ particle() [1/2]
|
pure virtual |
Returns a const reference to particle i.
Implemented in ParticleDataBase3D, ParticleDataBaseCyl, and ParticleDataBase2D.
◆ particle() [2/2]
|
pure virtual |
Returns a reference to particle i.
Implemented in ParticleDataBase3D, ParticleDataBaseCyl, and ParticleDataBase2D.
◆ reserve()
void ParticleDataBase::reserve | ( | size_t | size | ) |
Reserve memory for size particles.
◆ reset_trajectories()
void ParticleDataBase::reset_trajectories | ( | void | ) |
Clears the particle trajectory database and set particles to initial coordinates.
The particles are reset with initial coordinates and trajectories are cleared. Sets particle status for all particles as PARTICLE_OK.
◆ reset_trajectory()
void ParticleDataBase::reset_trajectory | ( | size_t | a | ) |
Clears the particle trajectory and set the particle to initial coordinates.
The particle a is resetted with initial coordinates and trajectory is cleared. Sets particle status as PARTICLE_OK.
◆ save() [1/2]
|
pure virtual |
Saves data to a new file filename.
Implemented in ParticleDataBase3D, ParticleDataBaseCyl, and ParticleDataBase2D.
◆ save() [2/2]
|
pure virtual |
Saves data to stream.
Implemented in ParticleDataBase3D, ParticleDataBaseCyl, and ParticleDataBase2D.
◆ set_accuracy()
void ParticleDataBase::set_accuracy | ( | double | epsabs, |
double | epsrel | ||
) |
Set the accuracy requirement for calculation.
Accuracy requirements default to epsabs = 1.0e-6 and epsrel = 1.0e-6.
◆ set_bfield_suppression()
void ParticleDataBase::set_bfield_suppression | ( | const CallbackFunctorD_V * | functor | ) |
Set magnetic field suppression location depedent callback functor.
Can be used to suppress the magnetic field effect on particles inside the plasma by making an object with a pointer to electric potential. Comparing to local potential value the magnetic field suppression can be localized to a volume with selected potential range.
◆ set_implementation_pointer()
|
protected |
Set particle database implementation pointer.
Used by child constructors.
◆ set_max_steps()
void ParticleDataBase::set_max_steps | ( | uint32_t | maxsteps | ) |
Set maximum number of steps to iterate.
One thousand (1000) steps is the default
◆ set_max_time()
void ParticleDataBase::set_max_time | ( | double | maxt | ) |
Set maximum lifetime of particle in simulation.
One millisecond (1e-3 sec) is the default
◆ set_mirror()
void ParticleDataBase::set_mirror | ( | const bool | mirror[6] | ) |
Set particle mirroring on boundaries.
Mirroring is set for (xmin,xmax,ymin,ymax,zmin,zmax) borders. Mirroring is always false for directions that do not exist.
By default, mirroring is disabled for all boundaries.
◆ set_polyint()
void ParticleDataBase::set_polyint | ( | bool | polyint | ) |
Set the interpolation type to polynomial(true) or linear(false).
- Deprecated:
- This function is deprecated. It can still be used to set polynomial or linear interpolation. Please use set_trajectory_interpolation().
◆ set_relativistic()
void ParticleDataBase::set_relativistic | ( | bool | enable | ) |
Set relativistic particle iteration.
◆ set_rhosum()
void ParticleDataBase::set_rhosum | ( | double | rhosum | ) |
Set sum of defined beam space charge density.
◆ set_save_all_points()
void ParticleDataBase::set_save_all_points | ( | bool | save_points | ) |
Set trajectory saving.
If save_points is true, all trajectory intersection with mesh boundaries are saved. If save_points is false (default), only the calculation points are saved.
◆ set_save_trajectories()
void ParticleDataBase::set_save_trajectories | ( | uint32_t | div | ) |
Set trajectory saving.
If div is zero, no trajectories are saved. If div is one, every trajectory is saved. If div N>1, every Nth trajectory is saved.
By default, all trajectories are saved.
◆ set_scharge_deposition()
void ParticleDataBase::set_scharge_deposition | ( | scharge_deposition_e | type | ) |
Set space charge deposition type.
Defaults to SCHARGE_DEPOSITION_PIC.
◆ set_surface_collision()
void ParticleDataBase::set_surface_collision | ( | bool | surface_collision | ) |
Set surface collision model to be used.
Defaults to false, which enables the inside-test for collisions.
◆ set_thread_count()
|
inline |
Set the number of threads used for calculation.
- Deprecated:
- This function is deprecated (it does nothing) and is replaced by global IBSimu::set_thread_count().
◆ set_trajectory_end_callback()
void ParticleDataBase::set_trajectory_end_callback | ( | TrajectoryEndCallback * | tend_cb | ) |
Set trajectory end callback.
◆ set_trajectory_handler_callback()
void ParticleDataBase::set_trajectory_handler_callback | ( | TrajectoryHandlerCallback * | thand_cb | ) |
Set trajectory handler callback.
◆ set_trajectory_interpolation()
void ParticleDataBase::set_trajectory_interpolation | ( | trajectory_interpolation_e | intrp | ) |
Set trajectory interpolation type.
Defaults to polynomial interpolation.
◆ set_trajectory_surface_collision_callback()
void ParticleDataBase::set_trajectory_surface_collision_callback | ( | TrajectorySurfaceCollisionCallback * | tsur_cb | ) |
Set trajectory surface collision callback.
◆ size()
size_t ParticleDataBase::size | ( | void | ) | const |
Returns particle count.
◆ step_particles()
void ParticleDataBase::step_particles | ( | MeshScalarField & | scharge, |
const VectorField & | efield, | ||
const VectorField & | bfield, | ||
double | dt | ||
) |
Step particles forward by time step dt.
The particles defined in particle database pdb are stepped forward one time step dt through electric field efield and magnetic field bfield in geometry geom.
◆ traj_length()
double ParticleDataBase::traj_length | ( | uint32_t | i | ) | const |
Returns the length of trajectory i.
◆ traj_size()
size_t ParticleDataBase::traj_size | ( | uint32_t | i | ) | const |
Returns number of trajectory points for particle i.
◆ trajectories_at_plane()
void ParticleDataBase::trajectories_at_plane | ( | TrajectoryDiagnosticData & | tdata, |
coordinate_axis_e | axis, | ||
double | val, | ||
const std::vector< trajectory_diagnostic_e > & | diagnostics | ||
) | const |
Gets trajectory diagnostic diagnostics at plane axis = val in trajectory diagnostic data object tdata.
◆ trajectory_point() [1/2]
void ParticleDataBase::trajectory_point | ( | double & | t, |
Vec3D & | loc, | ||
Vec3D & | vel, | ||
uint32_t | i, | ||
uint32_t | j | ||
) | const |
Gets the particle i trajectory point j into vel, loc and t.
◆ trajectory_point() [2/2]
|
pure virtual |
Gets the particle i trajectory point j as particle point.
Implemented in ParticleDataBase3D, ParticleDataBaseCyl, and ParticleDataBase2D.
The documentation for this class was generated from the following files: