Garfield++ 4.0
A toolkit for the detailed simulation of particle detectors based on ionisation measurement in gases and semiconductors
|
Two-dimensional implementation of the nearly exact Boundary Element Method. More...
#include <ComponentNeBem2d.hh>
Public Member Functions | |
ComponentNeBem2d () | |
Constructor. | |
~ComponentNeBem2d () | |
Destructor. | |
Medium * | GetMedium (const double x, const double y, const double z) override |
Get the medium at a given location (x, y, z). | |
void | ElectricField (const double x, const double y, const double z, double &ex, double &ey, double &ez, Medium *&m, int &status) override |
void | ElectricField (const double x, const double y, const double z, double &ex, double &ey, double &ez, double &v, Medium *&m, int &status) override |
Calculate the drift field [V/cm] and potential [V] at (x, y, z). | |
bool | GetVoltageRange (double &vmin, double &vmax) override |
Calculate the voltage range [V]. | |
bool | GetBoundingBox (double &xmin, double &ymin, double &zmin, double &xmax, double &ymax, double &zmax) override |
Get the bounding box coordinates. | |
bool | GetElementaryCell (double &xmin, double &ymin, double &zmin, double &xmax, double &ymax, double &zmax) override |
Get the coordinates of the elementary cell. | |
bool | IsWireCrossed (const double x0, const double y0, const double z0, const double x1, const double y1, const double z1, double &xc, double &yc, double &zc, const bool centre, double &rc) override |
bool | IsInTrapRadius (const double q0, const double x0, const double y0, const double z0, double &xw, double &yx, double &rw) override |
void | SetMedium (Medium *medium) |
Set the "background" medium. | |
bool | AddSegment (const double x0, const double y0, const double x1, const double y1, const double v, const int ndiv=-1) |
bool | AddWire (const double x, const double y, const double d, const double v, const int ntrap=5) |
bool | AddRegion (const std::vector< double > &xp, const std::vector< double > &yp, Medium *medium, const unsigned int bctype=4, const double v=0., const int ndiv=-1) |
void | AddChargeDistribution (const double x, const double y, const double a, const double b, const double rho) |
void | SetRangeZ (const double zmin, const double zmax) |
Set the extent of the drift region along z. | |
bool | Initialise () |
Discretise the geometry and compute the solution. | |
void | SetNumberOfDivisions (const unsigned int ndiv) |
Set the default number of elements per segment. | |
void | SetNumberOfCollocationPoints (const unsigned int ncoll) |
void | EnableAutoResizing (const bool on=true) |
void | EnableRandomCollocation (const bool on=true) |
void | SetMaxNumberOfIterations (const unsigned int niter) |
unsigned int | GetNumberOfRegions () const |
Return the number of regions. | |
bool | GetRegion (const unsigned int i, std::vector< double > &xv, std::vector< double > &yv, Medium *&medium, unsigned int &bctype, double &v) |
Return the properties of a given region. | |
unsigned int | GetNumberOfSegments () const |
Return the number of conducting straight-line segments. | |
bool | GetSegment (const unsigned int i, double &x0, double &y0, double &x1, double &x2, double &v) const |
Return the coordinates and voltage of a given straight-line segment. | |
unsigned int | GetNumberOfWires () const |
Return the number of wires. | |
bool | GetWire (const unsigned int i, double &x, double &y, double &d, double &v, double &q) const |
Return the coordinates, diameter, potential and charge of a given wire. | |
unsigned int | GetNumberOfElements () const |
Return the number of boundary elements. | |
bool | GetElement (const unsigned int i, double &x0, double &y0, double &x1, double &y1, double &q) const |
Return the coordinates and charge of a given boundary element. | |
Public Member Functions inherited from Garfield::Component | |
Component ()=delete | |
Default constructor. | |
Component (const std::string &name) | |
Constructor. | |
virtual | ~Component () |
Destructor. | |
virtual void | SetGeometry (Geometry *geo) |
Define the geometry. | |
virtual void | Clear () |
Reset. | |
virtual Medium * | GetMedium (const double x, const double y, const double z) |
Get the medium at a given location (x, y, z). | |
virtual void | ElectricField (const double x, const double y, const double z, double &ex, double &ey, double &ez, Medium *&m, int &status)=0 |
virtual void | ElectricField (const double x, const double y, const double z, double &ex, double &ey, double &ez, double &v, Medium *&m, int &status)=0 |
Calculate the drift field [V/cm] and potential [V] at (x, y, z). | |
virtual bool | GetVoltageRange (double &vmin, double &vmax)=0 |
Calculate the voltage range [V]. | |
virtual void | WeightingField (const double x, const double y, const double z, double &wx, double &wy, double &wz, const std::string &label) |
virtual double | WeightingPotential (const double x, const double y, const double z, const std::string &label) |
virtual void | DelayedWeightingField (const double x, const double y, const double z, const double t, double &wx, double &wy, double &wz, const std::string &label) |
virtual double | DelayedWeightingPotential (const double x, const double y, const double z, const double t, const std::string &label) |
virtual void | MagneticField (const double x, const double y, const double z, double &bx, double &by, double &bz, int &status) |
void | SetMagneticField (const double bx, const double by, const double bz) |
Set a constant magnetic field. | |
virtual bool | IsReady () |
Ready for use? | |
virtual bool | GetBoundingBox (double &xmin, double &ymin, double &zmin, double &xmax, double &ymax, double &zmax) |
Get the bounding box coordinates. | |
virtual bool | GetElementaryCell (double &xmin, double &ymin, double &zmin, double &xmax, double &ymax, double &zmax) |
Get the coordinates of the elementary cell. | |
double | IntegrateFluxCircle (const double xc, const double yc, const double r, const unsigned int nI=50) |
double | IntegrateFluxSphere (const double xc, const double yc, const double zc, const double r, const unsigned int nI=20) |
double | IntegrateFluxParallelogram (const double x0, const double y0, const double z0, const double dx1, const double dy1, const double dz1, const double dx2, const double dy2, const double dz2, const unsigned int nU=20, const unsigned int nV=20) |
double | IntegrateWeightingFluxParallelogram (const std::string &label, const double x0, const double y0, const double z0, const double dx1, const double dy1, const double dz1, const double dx2, const double dy2, const double dz2, const unsigned int nU=20, const unsigned int nV=20) |
double | IntegrateFluxLine (const double x0, const double y0, const double z0, const double x1, const double y1, const double z1, const double xp, const double yp, const double zp, const unsigned int nI, const int isign=0) |
virtual bool | IsWireCrossed (const double x0, const double y0, const double z0, const double x1, const double y1, const double z1, double &xc, double &yc, double &zc, const bool centre, double &rc) |
virtual bool | IsInTrapRadius (const double q0, const double x0, const double y0, const double z0, double &xw, double &yw, double &rw) |
void | EnablePeriodicityX (const bool on=true) |
Enable simple periodicity in the direction. | |
void | EnablePeriodicityY (const bool on=true) |
Enable simple periodicity in the direction. | |
void | EnablePeriodicityZ (const bool on=true) |
Enable simple periodicity in the direction. | |
void | IsPeriodic (bool &perx, bool &pery, bool &perz) |
Return periodicity flags. | |
void | EnableMirrorPeriodicityX (const bool on=true) |
Enable mirror periodicity in the direction. | |
void | EnableMirrorPeriodicityY (const bool on=true) |
Enable mirror periodicity in the direction. | |
void | EnableMirrorPeriodicityZ (const bool on=true) |
Enable mirror periodicity in the direction. | |
void | IsMirrorPeriodic (bool &perx, bool &pery, bool &perz) |
Return mirror periodicity flags. | |
void | EnableAxialPeriodicityX (const bool on=true) |
Enable axial periodicity in the direction. | |
void | EnableAxialPeriodicityY (const bool on=true) |
Enable axial periodicity in the direction. | |
void | EnableAxialPeriodicityZ (const bool on=true) |
Enable axial periodicity in the direction. | |
void | IsAxiallyPeriodic (bool &perx, bool &pery, bool &perz) |
Return axial periodicity flags. | |
void | EnableRotationSymmetryX (const bool on=true) |
Enable rotation symmetry around the axis. | |
void | EnableRotationSymmetryY (const bool on=true) |
Enable rotation symmetry around the axis. | |
void | EnableRotationSymmetryZ (const bool on=true) |
Enable rotation symmetry around the axis. | |
void | IsRotationSymmetric (bool &rotx, bool &roty, bool &rotz) |
Return rotation symmetry flags. | |
void | EnableDebugging () |
Switch on debugging messages. | |
void | DisableDebugging () |
Switch off debugging messages. | |
virtual bool | HasAttachmentMap () const |
Does the component have attachment maps? | |
virtual bool | HasVelocityMap () const |
Does the component have velocity maps? | |
virtual bool | ElectronAttachment (const double, const double, const double, double &eta) |
Get the electron attachment coefficient. | |
virtual bool | HoleAttachment (const double, const double, const double, double &eta) |
Get the hole attachment coefficient. | |
virtual bool | ElectronVelocity (const double, const double, const double, double &vx, double &vy, double &vz) |
Get the electron drift velocity. | |
virtual bool | HoleVelocity (const double, const double, const double, double &vx, double &vy, double &vz) |
Get the hole drift velocity. | |
virtual bool | GetElectronLifetime (const double, const double, const double, double &etau) |
virtual bool | GetHoleLifetime (const double, const double, const double, double &htau) |
Additional Inherited Members | |
virtual void | Reset ()=0 |
Reset the component. | |
virtual void | UpdatePeriodicity ()=0 |
Verify periodicities. | |
Protected Attributes inherited from Garfield::Component | |
std::string | m_className = "Component" |
Class name. | |
Geometry * | m_geometry = nullptr |
Pointer to the geometry. | |
std::array< double, 3 > | m_b0 = {{0., 0., 0.}} |
Constant magnetic field. | |
bool | m_ready = false |
Ready for use? | |
bool | m_debug = false |
Switch on/off debugging messages. | |
std::array< bool, 3 > | m_periodic = {{false, false, false}} |
Simple periodicity in x, y, z. | |
std::array< bool, 3 > | m_mirrorPeriodic = {{false, false, false}} |
Mirror periodicity in x, y, z. | |
std::array< bool, 3 > | m_axiallyPeriodic = {{false, false, false}} |
Axial periodicity in x, y, z. | |
std::array< bool, 3 > | m_rotationSymmetric = {{false, false, false}} |
Rotation symmetry around x-axis, y-axis, z-axis. | |
Two-dimensional implementation of the nearly exact Boundary Element Method.
Definition at line 10 of file ComponentNeBem2d.hh.
Garfield::ComponentNeBem2d::ComponentNeBem2d | ( | ) |
|
inline |
void Garfield::ComponentNeBem2d::AddChargeDistribution | ( | const double | x, |
const double | y, | ||
const double | a, | ||
const double | b, | ||
const double | rho | ||
) |
Definition at line 664 of file ComponentNeBem2d.cc.
bool Garfield::ComponentNeBem2d::AddRegion | ( | const std::vector< double > & | xp, |
const std::vector< double > & | yp, | ||
Medium * | medium, | ||
const unsigned int | bctype = 4 , |
||
const double | v = 0. , |
||
const int | ndiv = -1 |
||
) |
Add a region bounded by a polygon.
xp,yp | x/y-coordinates of the vertices of the polygon. |
medium | pointer to the medium associated to the region. |
bctype | 1: fixed voltage, 4: dielectric-dielectric interface. |
v | applied potential. |
ndiv | number of elements on each edge segment. |
Definition at line 584 of file ComponentNeBem2d.cc.
bool Garfield::ComponentNeBem2d::AddSegment | ( | const double | x0, |
const double | y0, | ||
const double | x1, | ||
const double | y1, | ||
const double | v, | ||
const int | ndiv = -1 |
||
) |
Add a conducting straight-line segment.
x0,y0,x1,y1 | coordinates of start and end point. |
v | applied potential. |
ndiv | number of elements in which to split the segment. |
Definition at line 524 of file ComponentNeBem2d.cc.
bool Garfield::ComponentNeBem2d::AddWire | ( | const double | x, |
const double | y, | ||
const double | d, | ||
const double | v, | ||
const int | ntrap = 5 |
||
) |
Add a wire.
x,y | centre of the wire. |
d | wire diameter. |
v | applied potential. |
ntrap | multiple of the wire radius within which a particle is considered to be trapped by the wire. |
Definition at line 553 of file ComponentNeBem2d.cc.
|
overridevirtual |
Calculate the drift field [V/cm] and potential [V] at (x, y, z).
Implements Garfield::Component.
Definition at line 213 of file ComponentNeBem2d.cc.
|
overridevirtual |
Calculate the drift field at given point.
x,y,z | coordinates [cm]. |
ex,ey,ez | components of the electric field [V/cm]. |
m | pointer to the medium at this location. |
status | status flag |
Status flags:
0: Inside an active medium > 0: Inside a wire of type X -4 ... -1: On the side of a plane where no wires are -5: Inside the mesh but not in an active medium -6: Outside the mesh -10: Unknown potential type (should not occur) other: Other cases (should not occur)
Implements Garfield::Component.
Definition at line 220 of file ComponentNeBem2d.cc.
|
inline |
Definition at line 82 of file ComponentNeBem2d.hh.
|
inline |
Definition at line 83 of file ComponentNeBem2d.hh.
|
overridevirtual |
Get the bounding box coordinates.
Reimplemented from Garfield::Component.
Definition at line 364 of file ComponentNeBem2d.cc.
bool Garfield::ComponentNeBem2d::GetElement | ( | const unsigned int | i, |
double & | x0, | ||
double & | y0, | ||
double & | x1, | ||
double & | y1, | ||
double & | q | ||
) | const |
Return the coordinates and charge of a given boundary element.
Definition at line 760 of file ComponentNeBem2d.cc.
|
overridevirtual |
Get the coordinates of the elementary cell.
Reimplemented from Garfield::Component.
Definition at line 374 of file ComponentNeBem2d.cc.
Referenced by GetBoundingBox().
|
overridevirtual |
Get the medium at a given location (x, y, z).
Reimplemented from Garfield::Component.
Definition at line 352 of file ComponentNeBem2d.cc.
|
inline |
Return the number of boundary elements.
Definition at line 105 of file ComponentNeBem2d.hh.
|
inline |
Return the number of regions.
Definition at line 89 of file ComponentNeBem2d.hh.
|
inline |
Return the number of conducting straight-line segments.
Definition at line 95 of file ComponentNeBem2d.hh.
|
inline |
Return the number of wires.
Definition at line 100 of file ComponentNeBem2d.hh.
bool Garfield::ComponentNeBem2d::GetRegion | ( | const unsigned int | i, |
std::vector< double > & | xv, | ||
std::vector< double > & | yv, | ||
Medium *& | medium, | ||
unsigned int & | bctype, | ||
double & | v | ||
) |
Return the properties of a given region.
Definition at line 716 of file ComponentNeBem2d.cc.
bool Garfield::ComponentNeBem2d::GetSegment | ( | const unsigned int | i, |
double & | x0, | ||
double & | y0, | ||
double & | x1, | ||
double & | x2, | ||
double & | v | ||
) | const |
Return the coordinates and voltage of a given straight-line segment.
Definition at line 734 of file ComponentNeBem2d.cc.
|
overridevirtual |
Calculate the voltage range [V].
Implements Garfield::Component.
Definition at line 316 of file ComponentNeBem2d.cc.
Referenced by Initialise().
bool Garfield::ComponentNeBem2d::GetWire | ( | const unsigned int | i, |
double & | x, | ||
double & | y, | ||
double & | d, | ||
double & | v, | ||
double & | q | ||
) | const |
Return the coordinates, diameter, potential and charge of a given wire.
Definition at line 747 of file ComponentNeBem2d.cc.
bool Garfield::ComponentNeBem2d::Initialise | ( | ) |
Discretise the geometry and compute the solution.
Definition at line 775 of file ComponentNeBem2d.cc.
Referenced by GetRegion().
|
overridevirtual |
Determine whether a particle is inside the trap radius of a wire.
q0 | charge of the particle [in elementary charges]. |
x0,y0,z0 | position [cm] of the particle. |
xw,yw | coordinates of the wire (if applicable). |
rw | radius of the wire (if applicable). |
Reimplemented from Garfield::Component.
Definition at line 493 of file ComponentNeBem2d.cc.
|
overridevirtual |
Determine whether the line between two points crosses a wire.
x0,y0,z0 | first point [cm]. |
x1,y1,z1 | second point [cm] |
xc,yc,zc | point [cm] where the line crosses the wire or the coordinates of the wire centre. |
centre | flag whether to return the coordinates of the line-wire crossing point or of the wire centre. |
rc | radius [cm] of the wire. |
Reimplemented from Garfield::Component.
Definition at line 425 of file ComponentNeBem2d.cc.
void Garfield::ComponentNeBem2d::SetMaxNumberOfIterations | ( | const unsigned int | niter | ) |
Definition at line 707 of file ComponentNeBem2d.cc.
|
inline |
Set the "background" medium.
Definition at line 40 of file ComponentNeBem2d.hh.
void Garfield::ComponentNeBem2d::SetNumberOfCollocationPoints | ( | const unsigned int | ncoll | ) |
Definition at line 696 of file ComponentNeBem2d.cc.
void Garfield::ComponentNeBem2d::SetNumberOfDivisions | ( | const unsigned int | ndiv | ) |
Set the default number of elements per segment.
Definition at line 685 of file ComponentNeBem2d.cc.
void Garfield::ComponentNeBem2d::SetRangeZ | ( | const double | zmin, |
const double | zmax | ||
) |
Set the extent of the drift region along z.
Definition at line 513 of file ComponentNeBem2d.cc.