Garfield 0.3
Toolkit for the detailed simulation of particle detectors based on ionization measurement in gases and semiconductors
Loading...
Searching...
No Matches
Garfield::ComponentChargedRing Class Reference

Component for calculating the field of a system of charged r,z rings. More...

#include <ComponentChargedRing.hh>

Inheritance diagram for Garfield::ComponentChargedRing:
Garfield::Component

Classes

struct  Ring

Public Member Functions

 ComponentChargedRing ()
 Constructor.
 ~ComponentChargedRing ()
 Destructor.
void SetArea (const double xmin, const double ymin, const double zmin, const double xmax, const double ymax, const double zmax)
 Set the limits of the active area explicitly (instead of using a Geometry object).
void UnsetArea ()
 Remove the explicit limits of the active area.
void SetMedium (Medium *medium)
 Set the medium in the active area.
MediumGetMedium (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 AddChargedRing (const double x, const double y, const double z, const double N)
 Add a ring of charge N*e at x,y,z.
void SetSpacingTolerance (const double spacing_tolerance)
 function to set the tolerance below which two rings are considered the same.
void SetSelfFieldTolerance (const double self_field_tolerance)
 function to set the tolerance below which divergences are caught
void UpdateCentre (double x, double y)
 Set the axis of symmetry.
void EnableDebugging ()
void ClearActiveRings ()
std::size_t GetNumberOfRings () const
const std::vector< Ring > & GetRings () const
std::array< double, 3 > ElectricField (const double x, const double y, const double z)
 Calculate the drift field [V/cm] at (x, y, z).
Public Member Functions inherited from Garfield::Component
 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)?
virtual bool GetElementaryCell (double &xmin, double &ymin, double &zmin, double &xmax, double &ymax, double &zmax)
 Get the coordinates of the elementary cell.
double CellSizeX ()
double CellSizeY ()
double CellSizeZ ()
virtual size_t GetNumberOfElements () const
 Return the number of mesh elements.
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 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)
 Determine whether the line between two points crosses a wire.
virtual bool InTrapRadius (const double q0, const double x0, const double y0, const double z0, double &xw, double &yw, double &rw)
 Determine whether a particle is inside the trap radius of a wire.
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 $x$ direction.
void EnablePeriodicityY (const bool on=true)
 Enable simple periodicity in the $y$ direction.
void EnablePeriodicityZ (const bool on=true)
 Enable simple periodicity in the $z$ direction.
void IsPeriodic (bool &perx, bool &pery, bool &perz)
 Return periodicity flags.
void EnableMirrorPeriodicityX (const bool on=true)
 Enable mirror periodicity in the $x$ direction.
void EnableMirrorPeriodicityY (const bool on=true)
 Enable mirror periodicity in the $y$ direction.
void EnableMirrorPeriodicityZ (const bool on=true)
 Enable mirror periodicity in the $y$ direction.
void IsMirrorPeriodic (bool &perx, bool &pery, bool &perz)
 Return mirror periodicity flags.
void EnableAxialPeriodicityX (const bool on=true)
 Enable axial periodicity in the $x$ direction.
void EnableAxialPeriodicityY (const bool on=true)
 Enable axial periodicity in the $y$ direction.
void EnableAxialPeriodicityZ (const bool on=true)
 Enable axial periodicity in the $z$ direction.
void IsAxiallyPeriodic (bool &perx, bool &pery, bool &perz)
 Return axial periodicity flags.
void EnableRotationSymmetryX (const bool on=true)
 Enable rotation symmetry around the $x$ axis.
void EnableRotationSymmetryY (const bool on=true)
 Enable rotation symmetry around the $y$ axis.
void EnableRotationSymmetryZ (const bool on=true)
 Enable rotation symmetry around the $z$ 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 $xy$ plane.
void EnableTriangleSymmetricXZ (const bool on=true, const bool oct=2)
 Enable triangular periodicity in the $xz$ plane.
void EnableTriangleSymmetricYZ (const bool on=true, const bool oct=2)
 Enable triangular periodicity in the $yz$ 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.

Private Types

enum class  Elliptic : std::size_t { X , K , E }

Private Member Functions

void Reset () override
 Reset the component.
void UpdatePeriodicity () override
 Verify periodicities.
void GetEllipticIntegrals (double x, double &K, double &E) const
 Gets elliptic integrals via list.
bool InArea (const double x, const double y, const double z)
void GetChargedRingField (const Ring &ring, double r, double z, double &eFieldZ, double &eFieldR) const

Static Private Member Functions

static void GetCoulombBallField (const Ring &ring, const double r, const double z, double &eFieldZ, double &eFieldR)

Private Attributes

std::array< double, 3 > m_xmin = {{0., 0., 0.}}
 Active area.
std::array< double, 3 > m_xmax = {{0., 0., 0.}}
bool m_hasArea = false
 Did we specify the active area explicitly?
Mediumm_medium = nullptr
 Medium in the active area.
bool m_bDebug = false
std::array< double, 2 > m_centre = {0., 0.}
 centre of cylindrical symmetry (x,y)
std::vector< Ringm_vRings
double m_dSelfFieldTolerance = 0.00001
double m_dSpacingTolerance = 2.1 * m_dSelfFieldTolerance
bool m_bCentreSet = false

Static Private Attributes

static const constexpr std::size_t elliptic_size {29981}
static const std::array< std::array< double, 3 >, elliptic_sizem_elliptic

Additional Inherited Members

Protected Attributes inherited from Garfield::Component
std::string m_className {"Component"}
 Class name.
Geometrym_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.
std::array< bool, 3 > m_triangleSymmetric = {{false, false, false}}
 Triangle symmetric in the xy, xz, and yz plane.
int m_triangleSymmetricOct = 0
 Triangle symmetric octant of imported map (0 < phi < Pi/4 --> octant 1).
const std::array< int, 4 > m_triangleOctRules = {1, 4, 5, 8}
 Octants where |x| >= |y|.
bool m_outsideCone = false
std::vector< double > m_wdtimes
 Time steps at which the delayed weighting potentials/fields are stored.

Detailed Description

Component for calculating the field of a system of charged r,z rings.

Definition at line 14 of file ComponentChargedRing.hh.

Member Enumeration Documentation

◆ Elliptic

enum class Garfield::ComponentChargedRing::Elliptic : std::size_t
strongprivate
Enumerator

Definition at line 106 of file ComponentChargedRing.hh.

106: std::size_t { X, K, E };

Constructor & Destructor Documentation

◆ ComponentChargedRing()

Garfield::ComponentChargedRing::ComponentChargedRing ( )

Constructor.

◆ ~ComponentChargedRing()

Garfield::ComponentChargedRing::~ComponentChargedRing ( )
inline

Destructor.

Definition at line 19 of file ComponentChargedRing.hh.

19{}

Member Function Documentation

◆ AddChargedRing()

bool Garfield::ComponentChargedRing::AddChargedRing ( const double x,
const double y,
const double z,
const double N )

Add a ring of charge N*e at x,y,z.

◆ ClearActiveRings()

void Garfield::ComponentChargedRing::ClearActiveRings ( )
inline

Definition at line 77 of file ComponentChargedRing.hh.

77{ m_vRings.clear(); }

◆ ElectricField() [1/3]

std::array< double, 3 > Garfield::Component::ElectricField ( const double x,
const double y,
const double z )

Calculate the drift field [V/cm] at (x, y, z).

◆ ElectricField() [2/3]

void Garfield::ComponentChargedRing::ElectricField ( const double x,
const double y,
const double z,
double & ex,
double & ey,
double & ez,
double & v,
Medium *& m,
int & status )
overridevirtual

Calculate the drift field [V/cm] and potential [V] at (x, y, z).

Implements Garfield::Component.

◆ ElectricField() [3/3]

void Garfield::ComponentChargedRing::ElectricField ( const double x,
const double y,
const double z,
double & ex,
double & ey,
double & ez,
Medium *& m,
int & status )
overridevirtual

Calculate the drift field at given point.

Parameters
x,y,zcoordinates [cm].
ex,ey,ezcomponents of the electric field [V/cm].
mpointer to the medium at this location.
statusstatus 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.

◆ EnableDebugging()

void Garfield::ComponentChargedRing::EnableDebugging ( )
inline

Definition at line 75 of file ComponentChargedRing.hh.

◆ GetBoundingBox()

bool Garfield::ComponentChargedRing::GetBoundingBox ( double & xmin,
double & ymin,
double & zmin,
double & xmax,
double & ymax,
double & zmax )
overridevirtual

Get the bounding box coordinates.

Reimplemented from Garfield::Component.

◆ GetChargedRingField()

void Garfield::ComponentChargedRing::GetChargedRingField ( const Ring & ring,
double r,
double z,
double & eFieldZ,
double & eFieldR ) const
private

◆ GetCoulombBallField()

void Garfield::ComponentChargedRing::GetCoulombBallField ( const Ring & ring,
const double r,
const double z,
double & eFieldZ,
double & eFieldR )
staticprivate

◆ GetEllipticIntegrals()

void Garfield::ComponentChargedRing::GetEllipticIntegrals ( double x,
double & K,
double & E ) const
private

Gets elliptic integrals via list.

◆ GetMedium()

Medium * Garfield::ComponentChargedRing::GetMedium ( const double x,
const double y,
const double z )
overridevirtual

Get the medium at a given location (x, y, z).

Reimplemented from Garfield::Component.

◆ GetNumberOfRings()

std::size_t Garfield::ComponentChargedRing::GetNumberOfRings ( ) const
inline

Definition at line 79 of file ComponentChargedRing.hh.

79{ return m_vRings.size(); }

◆ GetRings()

const std::vector< Ring > & Garfield::ComponentChargedRing::GetRings ( ) const
inline

Definition at line 81 of file ComponentChargedRing.hh.

81{ return m_vRings; }

◆ GetVoltageRange()

bool Garfield::ComponentChargedRing::GetVoltageRange ( double & vmin,
double & vmax )
overridevirtual

Calculate the voltage range [V].

Implements Garfield::Component.

◆ InArea()

bool Garfield::ComponentChargedRing::InArea ( const double x,
const double y,
const double z )
inlineprivate

Definition at line 98 of file ComponentChargedRing.hh.

98 {
99 if (x < m_xmin[0] || x > m_xmax[0] || y < m_xmin[1] || y > m_xmax[1] ||
100 z < m_xmin[2] || z > m_xmax[2]) {
101 return false;
102 }
103 return true;
104 }
std::array< double, 3 > m_xmin
Active area.

◆ Reset()

void Garfield::ComponentChargedRing::Reset ( )
overrideprivatevirtual

Reset the component.

Implements Garfield::Component.

◆ SetArea()

void Garfield::ComponentChargedRing::SetArea ( const double xmin,
const double ymin,
const double zmin,
const double xmax,
const double ymax,
const double zmax )

Set the limits of the active area explicitly (instead of using a Geometry object).

◆ SetMedium()

void Garfield::ComponentChargedRing::SetMedium ( Medium * medium)
inline

Set the medium in the active area.

Definition at line 28 of file ComponentChargedRing.hh.

28{ m_medium = medium; }
Medium * m_medium
Medium in the active area.

◆ SetSelfFieldTolerance()

void Garfield::ComponentChargedRing::SetSelfFieldTolerance ( const double self_field_tolerance)
inline

function to set the tolerance below which divergences are caught

Definition at line 54 of file ComponentChargedRing.hh.

54 {
55 m_dSelfFieldTolerance = self_field_tolerance;
56 }

◆ SetSpacingTolerance()

void Garfield::ComponentChargedRing::SetSpacingTolerance ( const double spacing_tolerance)
inline

function to set the tolerance below which two rings are considered the same.

Definition at line 49 of file ComponentChargedRing.hh.

49 {
50 m_dSpacingTolerance = spacing_tolerance;
51 }

◆ UnsetArea()

void Garfield::ComponentChargedRing::UnsetArea ( )

Remove the explicit limits of the active area.

◆ UpdateCentre()

void Garfield::ComponentChargedRing::UpdateCentre ( double x,
double y )
inline

Set the axis of symmetry.

Definition at line 70 of file ComponentChargedRing.hh.

70 {
71 m_centre = {x, y};
72 m_bCentreSet = true;
73 }
std::array< double, 2 > m_centre
centre of cylindrical symmetry (x,y)

◆ UpdatePeriodicity()

void Garfield::ComponentChargedRing::UpdatePeriodicity ( )
overrideprivatevirtual

Verify periodicities.

Implements Garfield::Component.

Member Data Documentation

◆ elliptic_size

const constexpr std::size_t Garfield::ComponentChargedRing::elliptic_size {29981}
staticconstexprprivate

Definition at line 107 of file ComponentChargedRing.hh.

107{29981};

◆ m_bCentreSet

bool Garfield::ComponentChargedRing::m_bCentreSet = false
private

Definition at line 121 of file ComponentChargedRing.hh.

◆ m_bDebug

bool Garfield::ComponentChargedRing::m_bDebug = false
private

Definition at line 110 of file ComponentChargedRing.hh.

◆ m_centre

std::array<double, 2> Garfield::ComponentChargedRing::m_centre = {0., 0.}
private

centre of cylindrical symmetry (x,y)

Definition at line 113 of file ComponentChargedRing.hh.

113{0., 0.};

◆ m_dSelfFieldTolerance

double Garfield::ComponentChargedRing::m_dSelfFieldTolerance = 0.00001
private

Definition at line 117 of file ComponentChargedRing.hh.

◆ m_dSpacingTolerance

double Garfield::ComponentChargedRing::m_dSpacingTolerance = 2.1 * m_dSelfFieldTolerance
private

Definition at line 119 of file ComponentChargedRing.hh.

◆ m_elliptic

const std::array< std::array< double, 3 >, ComponentChargedRing::elliptic_size > Garfield::ComponentChargedRing::m_elliptic
staticprivate

Definition at line 108 of file ComponentChargedRing.hh.

◆ m_hasArea

bool Garfield::ComponentChargedRing::m_hasArea = false
private

Did we specify the active area explicitly?

Definition at line 88 of file ComponentChargedRing.hh.

◆ m_medium

Medium* Garfield::ComponentChargedRing::m_medium = nullptr
private

Medium in the active area.

Definition at line 90 of file ComponentChargedRing.hh.

◆ m_vRings

std::vector<Ring> Garfield::ComponentChargedRing::m_vRings
private

Definition at line 115 of file ComponentChargedRing.hh.

◆ m_xmax

std::array<double, 3> Garfield::ComponentChargedRing::m_xmax = {{0., 0., 0.}}
private

Definition at line 86 of file ComponentChargedRing.hh.

86{{0., 0., 0.}};

◆ m_xmin

std::array<double, 3> Garfield::ComponentChargedRing::m_xmin = {{0., 0., 0.}}
private

Active area.

Definition at line 85 of file ComponentChargedRing.hh.

85{{0., 0., 0.}};

The documentation for this class was generated from the following files: