![]() |
Garfield 0.3
Toolkit for the detailed simulation of particle detectors based on ionization measurement in gases and semiconductors
|
Two-dimensional implementation of the nearly exact Boundary Element Method. More...
#include <ComponentNeBem2d.hh>
Classes | |
struct | Element |
struct | Region |
struct | Segment |
struct | SpaceCharge |
struct | Wire |
Public Member Functions | |
ComponentNeBem2d () | |
Constructor. | |
~ComponentNeBem2d () | |
Destructor. | |
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) |
Add a conducting straight-line segment. | |
bool | AddWire (const double x, const double y, const double d, const double v, const int ntrap=5) |
Add a wire. | |
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) |
Add a region bounded by a polygon. | |
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. | |
size_t | GetNumberOfElements () const override |
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. | |
Medium * | GetMedium (const double x, const double y, const double z) override |
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 |
bool | GetVoltageRange (double &vmin, double &vmax) override |
bool | GetBoundingBox (double &xmin, double &ymin, double &zmin, double &xmax, double &ymax, double &zmax) override |
bool | GetElementaryCell (double &xmin, double &ymin, double &zmin, double &xmax, double &ymax, double &zmax) override |
bool | CrossedWire (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 | InTrapRadius (const double q0, const double x0, const double y0, const double z0, double &xw, double &yx, double &rw) override |
Private Types | |
enum | BC { Voltage = 1 , Charge , Floating , Dielectric } |
Boundary condition type. More... |
Private Member Functions | |
void | EliminateOverlaps (std::vector< Segment > &segments) |
Split/merge overlapping segments. | |
bool | Discretise (const Segment &segment, std::vector< Element > &elements, const double lambda, const unsigned int ndiv) |
Create elements from a straight-line segment. | |
bool | ComputeInfluenceMatrix (std::vector< std::vector< double > > &infmat) const |
bool | InvertMatrix (std::vector< std::vector< double > > &influenceMatrix, std::vector< std::vector< double > > &inverseMatrix) const |
bool | LUDecomposition (std::vector< std::vector< double > > &mat, std::vector< int > &index) const |
void | LUSubstitution (const std::vector< std::vector< double > > &mat, const std::vector< int > &index, std::vector< double > &col) const |
bool | Solve (const std::vector< std::vector< double > > &inverseMatrix, const std::vector< double > &bc) |
bool | CheckConvergence (const double tol, std::vector< bool > &ok) |
void | SplitElement (Element &oldElement, std::vector< Element > &elements) |
double | LinePotential (const double a, const double x, const double y) const |
Potential of a line segment (half-width a) in local coordinates. | |
double | WirePotential (const double r0, const double x, const double y) const |
Potential of a thin wire with radius r0. | |
void | LineField (const double a, const double x, const double y, double &ex, double &ey) const |
Field of a line segment (half-width a) in local coordinates. | |
void | WireField (const double r0, const double x, const double y, double &ex, double &ey) const |
Field of a thin wire with radius r0. | |
double | BoxPotential (const double a, const double b, const double x, const double y, const double v0) const |
Potential of a uniformly charged rectangle. | |
void | BoxField (const double a, const double b, const double x, const double y, double &ex, double &ey) const |
Field of a uniformly charged rectangle. | |
void | Reset () override |
void | UpdatePeriodicity () override |
void | ToLocal (const double xIn, const double yIn, const double cphi, const double sphi, double &xOut, double &yOut) const |
Rotation from global to local coordinates. | |
void | ToGlobal (const double xIn, const double yIn, const double cphi, const double sphi, double &xOut, double &yOut) const |
Rotation from local to global coordinates. | |
int | Field (const double x, const double y, const double z, double &ex, double &ey, double &ez, double &v, Medium *&m, const bool opt) |
Evaluation of the electric field (and optionally potential). |
Private Attributes | |
unsigned int | m_nDivisions = 5 |
Default number elements per segment. | |
unsigned int | m_nCollocationPoints = 1 |
bool | m_autoSize = false |
bool | m_randomCollocation = false |
unsigned int | m_nMaxIterations = 3 |
Medium * | m_medium = nullptr |
Background medium. | |
bool | m_useRangeZ = false |
Flag whether a z-range has been defined by the user. | |
double | m_zmin = -1. |
Lower z limit. | |
double | m_zmax = 1. |
Upper z limit. | |
std::vector< Region > | m_regions |
Regions. | |
std::vector< Segment > | m_segments |
User-specified conducting straight-line segments. | |
std::vector< Wire > | m_wires |
Wires. | |
std::vector< Element > | m_elements |
Straight-line boundary elements. | |
std::vector< SpaceCharge > | m_spaceCharge |
Static Private Attributes | |
static const double | InvEpsilon0 |
static const double | InvTwoPiEpsilon0 |
Two-dimensional implementation of the nearly exact Boundary Element Method.
Definition at line 12 of file ComponentNeBem2d.hh.
|
private |
Boundary condition type.
Enumerator | |
---|---|
Voltage | Fixed potential. |
Charge | Fixed charge density (not implemented). |
Floating | Floating conductor (not implemented). |
Dielectric | Dielectric-dielectric interface. |
Definition at line 131 of file ComponentNeBem2d.hh.
Garfield::ComponentNeBem2d::ComponentNeBem2d | ( | ) |
Constructor.
|
inline |
void Garfield::ComponentNeBem2d::AddChargeDistribution | ( | const double | x, |
const double | y, | ||
const double | a, | ||
const double | b, | ||
const double | rho ) |
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. |
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. |
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. |
|
private |
Field of a uniformly charged rectangle.
|
private |
Potential of a uniformly charged rectangle.
|
private |
|
private |
|
override |
|
private |
Create elements from a straight-line segment.
|
override |
|
override |
|
private |
Split/merge overlapping segments.
|
inline |
Definition at line 60 of file ComponentNeBem2d.hh.
|
inline |
Definition at line 61 of file ComponentNeBem2d.hh.
|
private |
Evaluation of the electric field (and optionally potential).
|
override |
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.
|
override |
|
override |
|
inlineoverride |
Return the number of boundary elements.
Definition at line 83 of file ComponentNeBem2d.hh.
|
inline |
Return the number of regions.
Definition at line 67 of file ComponentNeBem2d.hh.
|
inline |
Return the number of conducting straight-line segments.
Definition at line 73 of file ComponentNeBem2d.hh.
|
inline |
Return the number of wires.
Definition at line 78 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.
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.
|
override |
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.
bool Garfield::ComponentNeBem2d::Initialise | ( | ) |
Discretise the geometry and compute the solution.
|
override |
|
private |
|
private |
Field of a line segment (half-width a) in local coordinates.
|
private |
Potential of a line segment (half-width a) in local coordinates.
|
private |
|
private |
|
overrideprivate |
void Garfield::ComponentNeBem2d::SetMaxNumberOfIterations | ( | const unsigned int | niter | ) |
|
inline |
Set the "background" medium.
Definition at line 20 of file ComponentNeBem2d.hh.
void Garfield::ComponentNeBem2d::SetNumberOfCollocationPoints | ( | const unsigned int | ncoll | ) |
void Garfield::ComponentNeBem2d::SetNumberOfDivisions | ( | const unsigned int | ndiv | ) |
Set the default number of elements per segment.
void Garfield::ComponentNeBem2d::SetRangeZ | ( | const double | zmin, |
const double | zmax ) |
Set the extent of the drift region along z.
|
private |
|
private |
|
private |
Rotation from local to global coordinates.
|
private |
Rotation from global to local coordinates.
|
overrideprivate |
|
private |
Field of a thin wire with radius r0.
|
private |
Potential of a thin wire with radius r0.
|
staticprivate |
Definition at line 112 of file ComponentNeBem2d.hh.
|
staticprivate |
Definition at line 113 of file ComponentNeBem2d.hh.
|
private |
Definition at line 118 of file ComponentNeBem2d.hh.
|
private |
Straight-line boundary elements.
Definition at line 179 of file ComponentNeBem2d.hh.
|
private |
Background medium.
Definition at line 123 of file ComponentNeBem2d.hh.
|
private |
Definition at line 117 of file ComponentNeBem2d.hh.
|
private |
Default number elements per segment.
Definition at line 116 of file ComponentNeBem2d.hh.
|
private |
Definition at line 120 of file ComponentNeBem2d.hh.
|
private |
Definition at line 119 of file ComponentNeBem2d.hh.
|
private |
Regions.
Definition at line 146 of file ComponentNeBem2d.hh.
|
private |
User-specified conducting straight-line segments.
Definition at line 157 of file ComponentNeBem2d.hh.
|
private |
Definition at line 187 of file ComponentNeBem2d.hh.
|
private |
Flag whether a z-range has been defined by the user.
Definition at line 125 of file ComponentNeBem2d.hh.
|
private |
Wires.
Definition at line 167 of file ComponentNeBem2d.hh.
|
private |
Upper z limit.
Definition at line 129 of file ComponentNeBem2d.hh.
|
private |
Lower z limit.
Definition at line 127 of file ComponentNeBem2d.hh.