![]() |
Garfield 0.3
Toolkit for the detailed simulation of particle detectors based on ionization measurement in gases and semiconductors
|
Component for interpolating field maps on a regular mesh. More...
#include <ComponentGrid.hh>
Classes | |
struct | Node |
Public Member Functions | |
ComponentGrid () | |
Constructor. | |
~ComponentGrid () | |
Destructor. | |
bool | SetMesh (const unsigned int nx, const unsigned int ny, const unsigned int nz, const double xmin, const double xmax, const double ymin, const double ymax, const double zmin, const double zmax) |
Define the grid. | |
bool | GetMesh (unsigned int &nx, unsigned int &ny, unsigned int &nz, double &xmin, double &xmax, double &ymin, double &ymax, double &zmin, double &zmax) const |
Retrieve the parameters of the grid. | |
void | SetCartesianCoordinates () |
Use Cartesian coordinates (default). | |
void | SetCylindricalCoordinates () |
Use cylindrical coordinates. | |
bool | LoadElectricField (const std::string &filename, const std::string &format, const bool withPotential, const bool withFlag, const double scaleX=1., const double scaleE=1., const double scaleP=1.) |
Import electric field and potential values from a file. | |
bool | LoadWeightingField (const std::string &filename, const std::string &format, const bool withPotential, const double scaleX=1., const double scaleE=1., const double scaleP=1.) |
Import (prompt) weighting field from file. | |
bool | LoadWeightingField (const std::string &filename, const std::string &format, const double time, const bool withPotential, const double scaleX=1., const double scaleE=1., const double scaleP=1.) |
Import delayed weighting field from file. | |
void | SetWeightingFieldOffset (const double x, const double y, const double z) |
Offset coordinates in the weighting field, such that the same numerical weighting field map can be used for electrodes at different positions. | |
bool | LoadMagneticField (const std::string &filename, const std::string &format, const double scaleX=1., const double scaleB=1.) |
Import magnetic field values from a file. | |
bool | SaveElectricField (Component *cmp, const std::string &filename, const std::string &fmt) |
Export the electric field and potential of a component to a text file. | |
bool | SaveWeightingField (Component *cmp, const std::string &id, const std::string &filename, const std::string &fmt) |
Export the weighting field and potential of a component to a text file. | |
bool | GetElectricField (const unsigned int i, const unsigned int j, const unsigned int k, double &v, double &ex, double &ey, double &ez) const |
Return the field at a given node. | |
void | SetMedium (Medium *m) |
Set the medium. | |
Medium * | GetMedium () const |
Get the medium. | |
void | Print () |
Print information about the mesh and the available data. | |
bool | LoadElectronAttachment (const std::string &fname, const std::string &fmt, const unsigned int col, const double scaleX=1.) |
Import electron attachment coefficients from a file. | |
bool | LoadHoleAttachment (const std::string &fname, const std::string &fmt, const unsigned int col, const double scaleX=1.) |
Import hole attachment coefficients from a file. | |
bool | LoadElectronVelocity (const std::string &fname, const std::string &fmt, const double scaleX=1., const double scaleV=1.e-9) |
Import a map of electron drift velocities from a file. | |
bool | LoadHoleVelocity (const std::string &fname, const std::string &fmt, const double scaleX=1., const double scaleV=1.e-9) |
Import a map of hole drift velocities from a file. | |
void | Clear () 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 |
void | ElectricField (const double x, const double y, const double z, double &ex, double &ey, double &ez, Medium *&m, int &status) override |
void | WeightingField (const double x, const double y, const double z, double &wx, double &wy, double &wz, const std::string &label) override |
double | WeightingPotential (const double x, const double y, const double z, const std::string &label) override |
void | DelayedWeightingField (const double x, const double y, const double z, const double t, double &wx, double &wy, double &wz, const std::string &label) override |
double | DelayedWeightingPotential (const double x, const double y, const double z, const double t, const std::string &label) override |
void | MagneticField (const double x, const double y, const double z, double &bx, double &by, double &bz, int &status) override |
Medium * | GetMedium (const double x, const double y, const double z) override |
bool | GetVoltageRange (double &vmin, double &vmax) override |
bool | GetElectricFieldRange (double &exmin, double &exmax, double &eymin, double &eymax, double &ezmin, double &ezmax) |
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 | HasMagneticField () const override |
bool | HasAttachmentMap () const override |
bool | ElectronAttachment (const double x, const double y, const double z, double &att) override |
bool | HoleAttachment (const double x, const double y, const double z, double &att) override |
bool | HasMobilityMap () const override |
bool | ElectronMobility (const double x, const double y, const double z, double &mu) override |
bool | HoleMobility (const double x, const double y, const double z, double &mu) override |
bool | HasVelocityMap () const override |
bool | ElectronVelocity (const double x, const double y, const double z, double &vx, double &vy, double &vz) override |
bool | HoleVelocity (const double x, const double y, const double z, double &vx, double &vy, double &vz) override |
Private Types | |
enum class | Format { Unknown , XY , XZ , XYZ , IJ , IK , IJK , YXZ } |
enum class | Coordinates { Cartesian , Cylindrical } |
Private Member Functions | |
bool | LoadMesh (const std::string &filename, std::string format, const double scaleX) |
Read/determine mesh parameters from file. | |
bool | LoadData (const std::string &filename, std::string format, const bool withPotential, const bool withFlag, const double scaleX, const double scaleF, const double scaleP, std::vector< std::vector< std::vector< Node > > > &field) |
Read electric field and potential from file. | |
bool | LoadData (const std::string &filename, std::string format, const double scaleX, std::vector< std::vector< std::vector< double > > > &tab, const unsigned int col) |
Load scalar data (e. g. attachment coefficients) from file. | |
void | Reset () override |
void | UpdatePeriodicity () override |
bool | GetField (const double x, const double y, const double z, const std::vector< std::vector< std::vector< Node > > > &field, double &fx, double &fy, double &fz, double &p, bool &active) |
Interpolation of the field and potential at a given point. | |
bool | GetData (const double x, const double y, const double z, const std::vector< std::vector< std::vector< double > > > &table, double &value) |
Interpolation in a table of scalars. | |
double | Reduce (const double xin, const double xmin, const double xmax, const bool simplePeriodic, const bool mirrorPeriodic, bool &isMirrored) const |
Reduce a coordinate to the basic cell (in case of periodicity). | |
void | Initialise (std::vector< std::vector< std::vector< Node > > > &fields) |
Set the dimensions of a table according to the mesh. | |
Format | GetFormat (std::string fmt) |
Decode a format string. |
Private Attributes | |
Coordinates | m_coordinates = Coordinates::Cartesian |
Medium * | m_medium = nullptr |
std::vector< std::vector< std::vector< Node > > > | m_efields |
Electric field values and potentials. | |
std::vector< std::vector< std::vector< Node > > > | m_bfields |
Magnetic field values. | |
std::vector< std::vector< std::vector< Node > > > | m_wfields |
Prompt weighting field values and potentials. | |
std::vector< std::vector< std::vector< std::vector< Node > > > > | m_wdfields |
Delayed weighting field values and potentials. | |
std::vector< std::vector< std::vector< double > > > | m_eAttachment |
Attachment maps for electrons and holes. | |
std::vector< std::vector< std::vector< double > > > | m_hAttachment |
std::vector< std::vector< std::vector< double > > > | m_eMobility |
Mobility maps for electrons and holes. | |
std::vector< std::vector< std::vector< double > > > | m_hMobility |
std::vector< std::vector< std::vector< Node > > > | m_eVelocity |
Velocity maps for electrons and holes. | |
std::vector< std::vector< std::vector< Node > > > | m_hVelocity |
std::vector< std::vector< std::vector< bool > > > | m_active |
Active medium flag. | |
std::array< unsigned int, 3 > | m_nX = {{1, 1, 1}} |
std::array< double, 3 > | m_xMin = {{0., 0., 0.}} |
std::array< double, 3 > | m_xMax = {{0., 0., 0.}} |
std::array< double, 3 > | m_sX = {{0., 0., 0.}} |
bool | m_hasMesh = false |
bool | m_hasPotential = false |
std::array< double, 3 > | m_wFieldOffset = {{0., 0., 0.}} |
double | m_pMin = 0. |
double | m_pMax = 0. |
Component for interpolating field maps on a regular mesh.
Definition at line 14 of file ComponentGrid.hh.
|
strongprivate |
Enumerator | |
---|---|
Cartesian | |
Cylindrical |
Definition at line 197 of file ComponentGrid.hh.
|
strongprivate |
Enumerator | |
---|---|
Unknown | |
XY | |
XZ | |
XYZ | |
IJ | |
IK | |
IJK | |
YXZ |
Definition at line 196 of file ComponentGrid.hh.
Garfield::ComponentGrid::ComponentGrid | ( | ) |
Constructor.
|
inline |
|
inlineoverride |
Definition at line 139 of file ComponentGrid.hh.
|
override |
|
override |
|
override |
|
override |
|
override |
|
override |
|
override |
|
override |
|
private |
Interpolation in a table of scalars.
bool Garfield::ComponentGrid::GetElectricField | ( | const unsigned int | i, |
const unsigned int | j, | ||
const unsigned int | k, | ||
double & | v, | ||
double & | ex, | ||
double & | ey, | ||
double & | ez ) const |
Return the field at a given node.
bool Garfield::ComponentGrid::GetElectricFieldRange | ( | double & | exmin, |
double & | exmax, | ||
double & | eymin, | ||
double & | eymax, | ||
double & | ezmin, | ||
double & | ezmax ) |
|
override |
|
private |
Interpolation of the field and potential at a given point.
|
private |
Decode a format string.
|
inline |
|
override |
bool Garfield::ComponentGrid::GetMesh | ( | unsigned int & | nx, |
unsigned int & | ny, | ||
unsigned int & | nz, | ||
double & | xmin, | ||
double & | xmax, | ||
double & | ymin, | ||
double & | ymax, | ||
double & | zmin, | ||
double & | zmax ) const |
Retrieve the parameters of the grid.
|
override |
|
inlineoverride |
Definition at line 172 of file ComponentGrid.hh.
|
override |
|
inlineoverride |
Definition at line 179 of file ComponentGrid.hh.
|
inlineoverride |
Definition at line 187 of file ComponentGrid.hh.
|
override |
|
override |
|
override |
|
private |
Set the dimensions of a table according to the mesh.
|
private |
Read electric field and potential from file.
|
private |
Load scalar data (e. g. attachment coefficients) from file.
bool Garfield::ComponentGrid::LoadElectricField | ( | const std::string & | filename, |
const std::string & | format, | ||
const bool | withPotential, | ||
const bool | withFlag, | ||
const double | scaleX = 1., | ||
const double | scaleE = 1., | ||
const double | scaleP = 1. ) |
Import electric field and potential values from a file.
The file is supposed to contain one line for each grid point starting with
followed by
Format types are:
If cylindrical coordinates are used, the first coordinate (x) corresponds to the radial distance and the second coordinate (y) corresponds to the azimuth (in radian).
bool Garfield::ComponentGrid::LoadElectronAttachment | ( | const std::string & | fname, |
const std::string & | fmt, | ||
const unsigned int | col, | ||
const double | scaleX = 1. ) |
Import electron attachment coefficients from a file.
fname | name of the text file. |
fmt | format string, see LoadElectricField. |
col | column in the file which has the attachment coefficient. |
scaleX | scaling factor to be applied to the coordinates. |
bool Garfield::ComponentGrid::LoadElectronVelocity | ( | const std::string & | fname, |
const std::string & | fmt, | ||
const double | scaleX = 1., | ||
const double | scaleV = 1.e-9 ) |
Import a map of electron drift velocities from a file.
fname | name of the text file. |
fmt | format string, see LoadElectricField |
scaleX | scaling factor to be applied to the coordinates. |
scaleV | scaling factor to be applied to the velocity components. |
bool Garfield::ComponentGrid::LoadHoleAttachment | ( | const std::string & | fname, |
const std::string & | fmt, | ||
const unsigned int | col, | ||
const double | scaleX = 1. ) |
Import hole attachment coefficients from a file.
bool Garfield::ComponentGrid::LoadHoleVelocity | ( | const std::string & | fname, |
const std::string & | fmt, | ||
const double | scaleX = 1., | ||
const double | scaleV = 1.e-9 ) |
Import a map of hole drift velocities from a file.
bool Garfield::ComponentGrid::LoadMagneticField | ( | const std::string & | filename, |
const std::string & | format, | ||
const double | scaleX = 1., | ||
const double | scaleB = 1. ) |
Import magnetic field values from a file.
|
private |
Read/determine mesh parameters from file.
bool Garfield::ComponentGrid::LoadWeightingField | ( | const std::string & | filename, |
const std::string & | format, | ||
const bool | withPotential, | ||
const double | scaleX = 1., | ||
const double | scaleE = 1., | ||
const double | scaleP = 1. ) |
Import (prompt) weighting field from file.
bool Garfield::ComponentGrid::LoadWeightingField | ( | const std::string & | filename, |
const std::string & | format, | ||
const double | time, | ||
const bool | withPotential, | ||
const double | scaleX = 1., | ||
const double | scaleE = 1., | ||
const double | scaleP = 1. ) |
Import delayed weighting field from file.
|
override |
void Garfield::ComponentGrid::Print | ( | ) |
Print information about the mesh and the available data.
|
private |
Reduce a coordinate to the basic cell (in case of periodicity).
|
overrideprivate |
bool Garfield::ComponentGrid::SaveElectricField | ( | Component * | cmp, |
const std::string & | filename, | ||
const std::string & | fmt ) |
Export the electric field and potential of a component to a text file.
cmp | Component object for which to export the field/potential |
filename | name of the text file |
fmt | format string, see LoadElectricField |
bool Garfield::ComponentGrid::SaveWeightingField | ( | Component * | cmp, |
const std::string & | id, | ||
const std::string & | filename, | ||
const std::string & | fmt ) |
Export the weighting field and potential of a component to a text file.
cmp | Component object for which to export the field/potential |
id | identifier of the weighting field |
filename | name of the text file |
fmt | format string, see LoadElectricField |
|
inline |
void Garfield::ComponentGrid::SetCylindricalCoordinates | ( | ) |
Use cylindrical coordinates.
void Garfield::ComponentGrid::SetMedium | ( | Medium * | m | ) |
Set the medium.
bool Garfield::ComponentGrid::SetMesh | ( | const unsigned int | nx, |
const unsigned int | ny, | ||
const unsigned int | nz, | ||
const double | xmin, | ||
const double | xmax, | ||
const double | ymin, | ||
const double | ymax, | ||
const double | zmin, | ||
const double | zmax ) |
Define the grid.
nx,ny,nz | number of nodes along ![]() |
xmin,xmax | range along ![]() |
ymin,ymax | range along ![]() |
zmin,zmax | range along ![]() |
void Garfield::ComponentGrid::SetWeightingFieldOffset | ( | const double | x, |
const double | y, | ||
const double | z ) |
Offset coordinates in the weighting field, such that the same numerical weighting field map can be used for electrodes at different positions.
|
overrideprivate |
|
override |
|
override |
|
private |
Active medium flag.
Definition at line 224 of file ComponentGrid.hh.
|
private |
Magnetic field values.
Definition at line 209 of file ComponentGrid.hh.
|
private |
Definition at line 198 of file ComponentGrid.hh.
|
private |
Attachment maps for electrons and holes.
Definition at line 215 of file ComponentGrid.hh.
|
private |
Electric field values and potentials.
Definition at line 207 of file ComponentGrid.hh.
|
private |
Mobility maps for electrons and holes.
Definition at line 218 of file ComponentGrid.hh.
|
private |
Velocity maps for electrons and holes.
Definition at line 221 of file ComponentGrid.hh.
|
private |
Definition at line 232 of file ComponentGrid.hh.
|
private |
Definition at line 233 of file ComponentGrid.hh.
|
private |
Definition at line 216 of file ComponentGrid.hh.
|
private |
Definition at line 219 of file ComponentGrid.hh.
|
private |
Definition at line 222 of file ComponentGrid.hh.
|
private |
Definition at line 200 of file ComponentGrid.hh.
|
private |
Definition at line 227 of file ComponentGrid.hh.
|
private |
Definition at line 239 of file ComponentGrid.hh.
|
private |
Definition at line 239 of file ComponentGrid.hh.
|
private |
Definition at line 230 of file ComponentGrid.hh.
|
private |
Delayed weighting field values and potentials.
Definition at line 213 of file ComponentGrid.hh.
|
private |
Definition at line 236 of file ComponentGrid.hh.
|
private |
Prompt weighting field values and potentials.
Definition at line 211 of file ComponentGrid.hh.
|
private |
Definition at line 229 of file ComponentGrid.hh.
|
private |
Definition at line 228 of file ComponentGrid.hh.