![]() |
Garfield 0.3
Toolkit for the detailed simulation of particle detectors based on ionization measurement in gases and semiconductors
|
Propagates avalanches with the 2d (axi-symmetric) space-charge routine from Lippmann, Riegler (2004) in uniform background fields. More...
#include <AvalancheGridSpaceCharge.hh>
Classes | |
struct | GridNode |
struct | Point |
Public Member Functions | |
AvalancheGridSpaceCharge () | |
Default constructor. | |
AvalancheGridSpaceCharge (Sensor *sensor) | |
Constructor. | |
~AvalancheGridSpaceCharge ()=default | |
Destructor. | |
void | Reset () |
Reset the charges. | |
void | EnableDebugging (const bool option=true) |
Enable/disable debugging (log messages) (default off) | |
void | EnableStickyAnode (const bool option=true) |
Enable sticky anode (default on) | |
void | EnableTOF (const bool option=true) |
Enable to use TOF swarm parameters (default on) | |
void | EnableDiffusion (const bool option=true) |
Enable diffusion (default off) | |
void | EnableSpaceChargeEffect (const bool option=true) |
Enable space charge calculations (default on) | |
void | EnableAdaptiveTimeStepping (const bool option=true) |
Enable adaptive time stepping (default on) | |
void | EnableMC (const bool option=true) |
Enable Monte Carlo (gain/diffusion) up to a certain total number of electrons e.g. | |
void | SetNCrit (const long NCrit=1e8) |
Set electron saturation value applied for each gas gap if space charge effect is turned off (default 1e8) | |
void | SetFieldCalculation (const std::string &option="coulomb", const int nof_approx=1.) |
Sets the different options to calculate the space charge field coulomb: free field approximation (relaxation: fdm-relaxation methode (with a condition to stop)) mirror: symmetric 3 layer single gap rpc with metal - resistive layer - gas gap - r. | |
void | SetK (float option=0.95) |
Set the streamer-inception criterion constant K in the interval (0, ∞) s.t. | |
void | SetStopAtK (bool option=true) |
Stop the avalanche if K % field is reached. | |
void | SetSensor (Sensor *sensor) |
Set the sensor (and determine if it includes a parallel-plate component). | |
void | Set2dGrid (double zmin, double zmax, int zsteps, double rmax, int rsteps) |
void | AddElectrons (AvalancheMicroscopic *avmc) |
Import electron (no ions) data from AvalancheMicroscopic class to axi-symmetric grid. | |
void | AddElectron (double x, double y, double z, double t=0, int n=1) |
Set n electrons onto the grid. | |
void | AddExtraElectron (double y, int n=1) |
After calling AddElectron, add more electrons on the same transversal line (y-freedom). | |
void | StartGridAvalanche (double dtime=-1) |
Starts the simulation with the imported electrons for a time step dt (dt = -1 until there are no electrons left in the gap). | |
long | GetAvalancheSize () const |
Returns the total positive charge in the gap's. | |
double | GetMeanDistance () |
Return current mean distance of the electrons on the grid. | |
long | ReachedKPercent () const |
Returns if 100 * K % background charge has been reached. | |
const std::vector< std::pair< double, long > > | GetElectronEvolution () const |
Returns the total electron number evolution. | |
void | ExportGrid (const std::string &filename) |
Export the current grid to a txt file (electron, ions numbers and field magnitude) Take care: only where electrons are located is the space-charge field evaluated! |
Private Member Functions | |
void | PrepareElectronsFromMicroscopicAvalanche () |
bool | SnapTo2dGrid (double x, double y, double z, long n=1, int gasLayer=0) |
void | Prepare2dMesh () |
bool | TransportTimeStep () |
void | DiffuseTimeStep (double dx, long nElectron, double nPosIon, double nNegIon, int iz, int ir, int gasGap) |
void | DistributeCharges (long nElectron, double nPosIon, double nNegIon, int iz, int ir, double stepZ, double stepR, int gasGap) |
void | GetLocalField (int iz, int ir, double &eFieldZ, double &eFieldR, const std::string &fieldOption, int gasGap) |
void | GetFreeChargedRing (int iz, int ir, int fz, int fr, double &eFieldZ, double &eFieldR) |
void | GetFreeChargedRing (double zi, double ri, double zf, double rf, double &eFieldZ, double &eFieldR) |
bool | AddFieldFromChargeAt (int iz, int ir, int fz, int fr, double N, double &eFieldZ, double &eFieldR) |
bool | AddFieldFromChargeAt (int iz, int ir, double zf, double rf, double N, double &eFieldZ, double &eFieldR) |
void | GetSwarmParameters (double MagEField, double &alpha, double &eta, double &drift, double &dSigmaL, double &dSigmaT, double &wv, double &wr, double &alphaPT, double &etaPT, int gasGap) |
void | GetGlobalCoordinates (double r, double z, double phi, double &xg, double &yg, double &zg, int gasGap) |
void | ImportEllipticIntegralValues (const std::string &filename) |
void | GetEllipticIntegrals (double x, double &K, double &E) |
int | GetGasGapNumber (int layerIndex) |
Private Attributes | |
std::string | m_className = "AvalancheGridSpaceCharge" |
bool | m_bDebug = false |
bool | m_bDiffusion = false |
bool | m_bStick = true |
bool | m_bDriftAvalanche = false |
bool | m_bImportAvalanche = false |
bool | m_bPreparedImportAvalanche = false |
long | m_lNCrit = 1e8 |
bool | m_bSpaceCharge = true |
float | m_fStreamerK = 0.95 |
bool | m_bStopAtK = false |
bool | m_bFieldK = false |
long | m_lElectronsK |
bool | m_bAdaptiveTime = true |
bool | m_bImportElliptic = false |
bool | m_bUseTOF = true |
Flag if TOF parameters should be used, else Magboltz drift and SST spatial coefficients. | |
bool | m_bWrAvailable = true |
Flag if bulk drift velocity is available to the simulation. | |
bool | m_bRatesAvailable = true |
Flag if temporal rates are available to the simulation. | |
bool | m_bMC = true |
int | m_iFieldApprox = 1 |
double | m_dMinGroups = 50 |
ComponentParallelPlate * | m_pp = nullptr |
Sensor * | m_sensor = nullptr |
std::vector< double > | m_zGrid |
Grid points of z-coordinate. | |
int | m_zSteps = 0 |
Number of grid points. | |
double | m_zStepSize = 0. |
std::vector< double > | m_rGrid |
Distance between the grid points. | |
int | m_rSteps = 0. |
Number of grid points. | |
double | m_rStepSize = 0. |
bool | m_isgridset = false |
Distance between the grid points. | |
long | m_nTotElectron = 0 |
Total amount of electrons at time step. | |
long | m_nTotPosIons = 0 |
total amount of charge created | |
double | m_time = 0. |
Clock. | |
double | m_time0 = 0. |
Initial time. | |
double | m_dt = 0. |
Time step. | |
bool | m_run = true |
Tracking if the charges are still in the drift gap. | |
std::vector< std::vector< int > > | m_zGasGapBoundaries |
[k] -> {izLeft, ..., izRight} | |
std::vector< std::vector< GridNode > > | m_grid |
grid with nodes on it | |
std::vector< std::vector< Point > > | m_vElectrons |
Electrons to transfer onto grid. | |
std::vector< std::pair< double, long > > | m_vNElectronEvolution |
std::vector< long > | m_vGroupSizes |
same values as Lippmann & Riegler | |
std::vector< int > | m_vIndexGasGaps = {0} |
Which layer indices are gas layers. | |
std::vector< std::vector< double > > | m_vCoNGasLayer {} |
Coordinates of center of electron number. | |
std::vector< double > | m_vYPointInGasGap {} |
Example point (y-coord) in each gas gap. | |
std::vector< double > | m_ezBkg = {0} |
Uniform background field in z direction, can be negative. | |
std::vector< int > | m_vSaturatedGaps {} |
Which gas gaps are saturated if saturation is on. | |
std::string | m_sFieldOption = "coulomb" |
std::vector< double > | m_vXElliptic |
std::vector< double > | m_vKElliptic |
std::vector< double > | m_vEElliptic |
Propagates avalanches with the 2d (axi-symmetric) space-charge routine from Lippmann, Riegler (2004) in uniform background fields.
Different options to calculate space-charge-fields can be chosen.
Definition at line 17 of file AvalancheGridSpaceCharge.hh.
|
inline |
Default constructor.
Definition at line 20 of file AvalancheGridSpaceCharge.hh.
Garfield::AvalancheGridSpaceCharge::AvalancheGridSpaceCharge | ( | Sensor * | sensor | ) |
Constructor.
|
default |
Destructor.
void Garfield::AvalancheGridSpaceCharge::AddElectron | ( | double | x, |
double | y, | ||
double | z, | ||
double | t = 0, | ||
int | n = 1 ) |
Set n electrons onto the grid.
void Garfield::AvalancheGridSpaceCharge::AddElectrons | ( | AvalancheMicroscopic * | avmc | ) |
Import electron (no ions) data from AvalancheMicroscopic class to axi-symmetric grid.
void Garfield::AvalancheGridSpaceCharge::AddExtraElectron | ( | double | y, |
int | n = 1 ) |
After calling AddElectron, add more electrons on the same transversal line (y-freedom).
|
private |
|
private |
|
private |
|
private |
|
inline |
Enable adaptive time stepping (default on)
Definition at line 47 of file AvalancheGridSpaceCharge.hh.
|
inline |
Enable/disable debugging (log messages) (default off)
Definition at line 30 of file AvalancheGridSpaceCharge.hh.
|
inline |
Enable diffusion (default off)
Definition at line 39 of file AvalancheGridSpaceCharge.hh.
|
inline |
Enable Monte Carlo (gain/diffusion) up to a certain total number of electrons e.g.
(1e5) (default on) if disabled: Mean values are considered instead of the statistical processes
Definition at line 55 of file AvalancheGridSpaceCharge.hh.
|
inline |
Enable space charge calculations (default on)
Definition at line 42 of file AvalancheGridSpaceCharge.hh.
|
inline |
Enable sticky anode (default on)
Definition at line 33 of file AvalancheGridSpaceCharge.hh.
|
inline |
Enable to use TOF swarm parameters (default on)
Definition at line 36 of file AvalancheGridSpaceCharge.hh.
void Garfield::AvalancheGridSpaceCharge::ExportGrid | ( | const std::string & | filename | ) |
Export the current grid to a txt file (electron, ions numbers and field magnitude) Take care: only where electrons are located is the space-charge field evaluated!
|
inline |
Returns the total positive charge in the gap's.
Definition at line 108 of file AvalancheGridSpaceCharge.hh.
|
inlinenodiscard |
Returns the total electron number evolution.
Definition at line 123 of file AvalancheGridSpaceCharge.hh.
|
private |
|
private |
|
private |
|
inlineprivate |
Definition at line 244 of file AvalancheGridSpaceCharge.hh.
|
private |
|
private |
double Garfield::AvalancheGridSpaceCharge::GetMeanDistance | ( | ) |
Return current mean distance of the electrons on the grid.
|
private |
|
private |
|
private |
|
private |
|
inlinenodiscard |
Returns if 100 * K % background charge has been reached.
Definition at line 114 of file AvalancheGridSpaceCharge.hh.
void Garfield::AvalancheGridSpaceCharge::Reset | ( | ) |
Reset the charges.
void Garfield::AvalancheGridSpaceCharge::Set2dGrid | ( | double | zmin, |
double | zmax, | ||
int | zsteps, | ||
double | rmax, | ||
int | rsteps ) |
zmin | coordinate along direction of background field |
zmax | should more or less be at the end of the gap |
zsteps | number of steps |
rmax | coordinate perpendicular to background field |
rsteps | number of steps |
|
inline |
Sets the different options to calculate the space charge field coulomb: free field approximation (relaxation: fdm-relaxation methode (with a condition to stop)) mirror: symmetric 3 layer single gap rpc with metal - resistive layer - gas gap - r.
l. - m.
Definition at line 66 of file AvalancheGridSpaceCharge.hh.
|
inline |
Set the streamer-inception criterion constant K in the interval (0, ∞) s.t.
1 = 100%
Definition at line 74 of file AvalancheGridSpaceCharge.hh.
|
inline |
Set electron saturation value applied for each gas gap if space charge effect is turned off (default 1e8)
Definition at line 59 of file AvalancheGridSpaceCharge.hh.
void Garfield::AvalancheGridSpaceCharge::SetSensor | ( | Sensor * | sensor | ) |
Set the sensor (and determine if it includes a parallel-plate component).
|
inline |
Stop the avalanche if K % field is reached.
Definition at line 77 of file AvalancheGridSpaceCharge.hh.
|
private |
void Garfield::AvalancheGridSpaceCharge::StartGridAvalanche | ( | double | dtime = -1 | ) |
Starts the simulation with the imported electrons for a time step dt (dt = -1 until there are no electrons left in the gap).
|
private |
|
private |
Definition at line 271 of file AvalancheGridSpaceCharge.hh.
|
private |
Definition at line 255 of file AvalancheGridSpaceCharge.hh.
|
private |
Definition at line 256 of file AvalancheGridSpaceCharge.hh.
|
private |
Definition at line 259 of file AvalancheGridSpaceCharge.hh.
|
private |
Definition at line 268 of file AvalancheGridSpaceCharge.hh.
|
private |
Definition at line 261 of file AvalancheGridSpaceCharge.hh.
|
private |
Definition at line 272 of file AvalancheGridSpaceCharge.hh.
|
private |
Definition at line 281 of file AvalancheGridSpaceCharge.hh.
|
private |
Definition at line 262 of file AvalancheGridSpaceCharge.hh.
|
private |
Flag if temporal rates are available to the simulation.
Definition at line 279 of file AvalancheGridSpaceCharge.hh.
|
private |
Definition at line 264 of file AvalancheGridSpaceCharge.hh.
|
private |
Definition at line 257 of file AvalancheGridSpaceCharge.hh.
|
private |
Definition at line 267 of file AvalancheGridSpaceCharge.hh.
|
private |
Flag if TOF parameters should be used, else Magboltz drift and SST spatial coefficients.
Definition at line 275 of file AvalancheGridSpaceCharge.hh.
|
private |
Flag if bulk drift velocity is available to the simulation.
Definition at line 277 of file AvalancheGridSpaceCharge.hh.
|
private |
Definition at line 253 of file AvalancheGridSpaceCharge.hh.
|
private |
Definition at line 284 of file AvalancheGridSpaceCharge.hh.
|
private |
Time step.
Definition at line 303 of file AvalancheGridSpaceCharge.hh.
|
private |
Uniform background field in z direction, can be negative.
Definition at line 328 of file AvalancheGridSpaceCharge.hh.
|
private |
Definition at line 266 of file AvalancheGridSpaceCharge.hh.
|
private |
grid with nodes on it
Definition at line 310 of file AvalancheGridSpaceCharge.hh.
|
private |
Definition at line 283 of file AvalancheGridSpaceCharge.hh.
|
private |
Distance between the grid points.
Keeps track if the grid has been defined.
Definition at line 297 of file AvalancheGridSpaceCharge.hh.
|
private |
Definition at line 269 of file AvalancheGridSpaceCharge.hh.
|
private |
Definition at line 263 of file AvalancheGridSpaceCharge.hh.
|
private |
Total amount of electrons at time step.
Definition at line 298 of file AvalancheGridSpaceCharge.hh.
|
private |
total amount of charge created
Definition at line 299 of file AvalancheGridSpaceCharge.hh.
|
private |
Definition at line 286 of file AvalancheGridSpaceCharge.hh.
|
private |
Distance between the grid points.
Grid points of r-coordinate.
Definition at line 293 of file AvalancheGridSpaceCharge.hh.
|
private |
Number of grid points.
Definition at line 294 of file AvalancheGridSpaceCharge.hh.
|
private |
Definition at line 295 of file AvalancheGridSpaceCharge.hh.
|
private |
Tracking if the charges are still in the drift gap.
Definition at line 305 of file AvalancheGridSpaceCharge.hh.
|
private |
Definition at line 287 of file AvalancheGridSpaceCharge.hh.
|
private |
Definition at line 332 of file AvalancheGridSpaceCharge.hh.
|
private |
Clock.
Definition at line 301 of file AvalancheGridSpaceCharge.hh.
|
private |
Initial time.
Definition at line 302 of file AvalancheGridSpaceCharge.hh.
|
private |
Coordinates of center of electron number.
Required: y in [zmin, zmax]
Definition at line 323 of file AvalancheGridSpaceCharge.hh.
|
private |
Definition at line 335 of file AvalancheGridSpaceCharge.hh.
|
private |
Electrons to transfer onto grid.
Definition at line 312 of file AvalancheGridSpaceCharge.hh.
|
private |
same values as Lippmann & Riegler
Definition at line 315 of file AvalancheGridSpaceCharge.hh.
|
private |
Which layer indices are gas layers.
Definition at line 319 of file AvalancheGridSpaceCharge.hh.
|
private |
Definition at line 334 of file AvalancheGridSpaceCharge.hh.
|
private |
Definition at line 314 of file AvalancheGridSpaceCharge.hh.
|
private |
Which gas gaps are saturated if saturation is on.
Definition at line 330 of file AvalancheGridSpaceCharge.hh.
|
private |
Definition at line 333 of file AvalancheGridSpaceCharge.hh.
|
private |
Example point (y-coord) in each gas gap.
Definition at line 325 of file AvalancheGridSpaceCharge.hh.
|
private |
[k] -> {izLeft, ..., izRight}
Definition at line 308 of file AvalancheGridSpaceCharge.hh.
|
private |
Grid points of z-coordinate.
Definition at line 289 of file AvalancheGridSpaceCharge.hh.
|
private |
Number of grid points.
Definition at line 290 of file AvalancheGridSpaceCharge.hh.
|
private |
Definition at line 291 of file AvalancheGridSpaceCharge.hh.