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
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
Calculate the drift field at given point.
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 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
Determine whether the line between two points crosses a wire.
bool InTrapRadius (const double q0, const double x0, const double y0, const double z0, double &xw, double &yx, double &rw) override
Determine whether a particle is inside the trap radius of a wire.
std::array< double, 3 > ElectricField (const double x, const double y, const double z)
Calculate the drift field [V/cm] at (x, y, z).
Component ()=delete
Default constructor.
Component (const std::string &name)
Constructor.
virtual ~Component ()=default
Destructor.
virtual void SetGeometry (Geometry *geo)
Define the geometry.
virtual void Clear ()
Reset.
std::array< double, 3 > ElectricField (const double x, const double y, const double z)
Calculate the drift field [V/cm] at (x, y, z).
virtual double ElectricPotential (const double x, const double y, const double z)
Calculate the (drift) electrostatic potential [V] at (x, y, z).
virtual void WeightingField (const double x, const double y, const double z, double &wx, double &wy, double &wz, const std::string &label)
Calculate the weighting field at a given point and for a given electrode.
virtual double WeightingPotential (const double x, const double y, const double z, const std::string &label)
Calculate the weighting potential at a given point.
virtual const std::vector< double > & DelayedSignalTimes (const std::string &)
Return the time steps at which the delayed weighting potential/field are stored/evaluated.
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)
Calculate the delayed weighting field at a given point and time and for a given electrode.
virtual double DelayedWeightingPotential (const double x, const double y, const double z, const double t, const std::string &label)
Calculate the delayed weighting potential at a given point and time and for a given electrode.
virtual void DelayedWeightingPotentials (const double x, const double y, const double z, const std::string &label, std::vector< double > &dwp)
Calculate the delayed weighting potentials at a given point and for a given electrode, for a set of pre-defined times.
virtual void MagneticField (const double x, const double y, const double z, double &bx, double &by, double &bz, int &status)
Calculate the magnetic field at a given point.
void SetMagneticField (const double bx, const double by, const double bz)
Set a constant magnetic field.
virtual bool IsReady ()
Ready for use?
virtual bool Is3d ()
Does the component have a 3D field (map)?
double CellSizeX ()
double CellSizeY ()
double CellSizeZ ()
virtual bool GetElementNodes (const size_t, std::vector< size_t > &) const
Get the indices of the nodes constituting a given element.
virtual bool GetElementRegion (const size_t, size_t &, bool &) const
Get the region/material of a mesh element and a flag whether it is associated to an active medium.
virtual size_t GetNumberOfNodes () const
Return the number of mesh nodes.
virtual bool GetNode (const size_t i, double &x, double &y, double &z) const
Get the coordinates of a mesh node.
double IntegrateFluxCircle (const double xc, const double yc, const double r, const unsigned int nI=50)
Integrate the normal component of the electric field over a circle.
double IntegrateFluxSphere (const double xc, const double yc, const double zc, const double r, const unsigned int nI=20)
Integrate the normal component of the electric field over a sphere.
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)
Integrate the normal component of the electric field over a parallelogram.
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)
Integrate the normal component of the weighting field over a parallelogram.
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)
Integrate the electric field flux through a line from (x0,y0,z0) to (x1,y1,z1) along a direction (xp,yp,zp).
virtual bool CrossedPlane (const double x0, const double y0, const double z0, const double x1, const double y1, const double z1, double &xc, double &yc, double &zc)
Determine whether the line between two points crosses a plane.
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 EnableTriangleSymmetricXY (const bool on=true, const bool oct=2)
Enable triangular periodicity in the plane.
void EnableTriangleSymmetricXZ (const bool on=true, const bool oct=2)
Enable triangular periodicity in the plane.
void EnableTriangleSymmetricYZ (const bool on=true, const bool oct=2)
Enable triangular periodicity in the plane.
void EnableDebugging (const bool on=true)
Switch on debugging messages.
void DisableDebugging ()
Switch off debugging messages.
virtual bool HasMagneticField () const
Does the component have a non-zero magnetic field?
virtual bool HasTownsendMap () const
Does the component have maps of the Townsend coefficient?
virtual bool HasAttachmentMap () const
Does the component have maps of the attachment coefficient?
virtual bool HasMobilityMap () const
Does the component have maps of the low-field mobility?
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 ElectronMobility (const double, const double, const double, double &mu)
virtual bool HoleMobility (const double, const double, const double, double &mu)
Get the hole Mobility coefficient.
virtual bool ElectronTownsend (const double, const double, const double, double &alpha)
Get the electron Townsend coefficient.
virtual bool HoleTownsend (const double, const double, const double, double &alpha)
Get the hole Townsend 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 double StepSizeHint ()
virtual double CreateGPUTransferObject (ComponentGPU *&comp_gpu)
Create and initialise GPU Transfer class.
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
Reset the component.
void UpdatePeriodicity () override
Verify periodicities.
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).