![]() |
Garfield 0.3
Toolkit for the detailed simulation of particle detectors based on ionization measurement in gases and semiconductors
|
Base class for components based on finite-element field maps. More...
#include <ComponentFieldMap.hh>
Classes | |
struct | Element |
struct | Material |
struct | Node |
struct | WeightingFieldCopy |
Public Member Functions | |
ComponentFieldMap ()=delete | |
Default constructor. | |
ComponentFieldMap (const std::string &name) | |
Constructor. | |
virtual | ~ComponentFieldMap () |
Destructor. | |
bool | Check () |
Check element aspect ratio. | |
void | PrintRange () |
Show x, y, z, V and angular ranges. | |
void | PrintMaterials () |
List all currently defined materials. | |
void | DriftMedium (const size_t imat) |
Flag a field map material as a drift medium. | |
void | NotDriftMedium (const size_t imat) |
Flag a field map materials as a non-drift medium. | |
size_t | GetNumberOfMaterials () const |
Return the number of materials in the field map. | |
double | GetPermittivity (const size_t imat) const |
Return the relative permittivity of a field map material. | |
double | GetConductivity (const size_t imat) const |
Return the conductivity of a field map material. | |
void | SetMedium (const size_t imat, Medium *medium) |
Associate a field map material with a Medium object. | |
Medium * | GetMedium (const size_t imat) const |
Return the Medium associated to a field map material. | |
void | SetGas (Medium *medium) |
Associate all field map materials with a relative permittivity of unity to a given Medium class. | |
size_t | GetNumberOfElements () const override |
bool | GetElementNodes (const size_t i, std::vector< size_t > &nodes) const override |
bool | GetElementRegion (const size_t i, size_t &mat, bool &drift) const override |
bool | GetElement (const size_t i, double &vol, double &dmin, double &dmax) const |
Return the volume and aspect ratio of a mesh element. | |
size_t | GetNumberOfNodes () const override |
bool | GetNode (const size_t i, double &x, double &y, double &z) const override |
double | GetPotential (const size_t i) const |
Return the potential at a given node. | |
void | EnableCheckMapIndices (const bool on=true) |
void | EnableDeleteBackgroundElements (const bool on=true) |
Option to eliminate mesh elements in conductors (default: on). | |
void | EnableTetrahedralTreeForElementSearch (const bool on=true) |
Enable or disable the usage of the tetrahedral tree for searching the element in the mesh. | |
void | EnableConvergenceWarnings (const bool on=true) |
Enable or disable warnings that the calculation of the local coordinates did not achieve the requested precision. | |
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 |
__DEVICE__ 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 |
double | DelayedWeightingPotential (double x, double y, double z, const double t, const std::string &label) override |
void | DelayedWeightingPotentials (const double x, const double y, const double z, const std::string &label, std::vector< double > &dwp) override |
bool | IsInBoundingBox (const double x, const double y, const double z) const |
bool | Is3d () 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 |
std::map< std::string, std::vector< double > > | GetWeightingPotentials () |
bool | GetVoltageRange (double &vmin, double &vmax) override |
void | CopyWeightingPotential (const std::string &label, const std::string &labelSource, const double x, const double y, const double z, const double alpha, const double beta, const double gamma) |
Makes a weighting potential copy of a imported map which can be translated and rotated. | |
double | CreateGPUTransferObject (ComponentGPU *&comp_gpu) override |
Create and initialise GPU Transfer class. |
Protected Types | |
enum class | ElementType { Unknown = 0 , Serendipity = 5 , CurvedTetrahedron = 13 } |
Protected Member Functions | |
void | Reset () override |
void | Prepare () |
virtual void | SetRange () |
void | UpdatePeriodicity () override |
void | UpdatePeriodicity2d () |
void | UpdatePeriodicityCommon () |
bool | SetDefaultDriftMedium () |
Find lowest epsilon, check for eps = 0, set default drift media flags. | |
__DEVICE__ int | Field (const double x, const double y, const double z, double &fx, double &fy, double &fz, int &iel, const std::vector< double > &potentials) const |
Compute the electric/weighting field. | |
double | Potential (const double x, const double y, const double z, const std::vector< double > &potentials) const |
Compute the electrostatic/weighting potential. | |
int | FindElement5 (const double x, const double y, double &t1, double &t2, double &t3, double &t4, double jac[4][4], double &det) const |
Find the element for a point in curved quadratic quadrilaterals. | |
__DEVICE__ int | FindElement13 (const double x, const double y, const double z, double &t1, double &t2, double &t3, double &t4, double jac[4][4], double &det) const |
Find the element for a point in curved quadratic tetrahedra. | |
int | FindElementCube (const double x, const double y, const double z, double &t1, double &t2, double &t3, TMatrixD *&jac, std::vector< TMatrixD * > &dN) const |
Find the element for a point in a cube. | |
__DEVICE__ void | MapCoordinates (double &xpos, double &ypos, double &zpos, bool &xmirrored, bool &ymirrored, bool &zmirrored, double &rcoordinate, double &rotation) const |
Move (xpos, ypos, zpos) to field map coordinates. | |
__DEVICE__ void | UnmapFields (double &ex, double &ey, double &ez, const double xpos, const double ypos, const double zpos, const bool xmirrored, const bool ymirrored, const bool zmirrored, const double rcoordinate, const double rotation) const |
Move (ex, ey, ez) to global coordinates. | |
virtual double | GetElementVolume (const size_t i) const |
virtual void | GetAspectRatio (const size_t i, double &dmin, double &dmax) const |
void | PrintWarning (const std::string &header) |
void | PrintNotReady (const std::string &header) const |
void | PrintCouldNotOpen (const std::string &header, const std::string &filename) const |
void | PrintElement (const std::string &header, const double x, const double y, const double z, const double t1, const double t2, const double t3, const double t4, const size_t i, const std::vector< double > &potential) const |
void | TimeInterpolation (const double t, double &f0, double &f1, int &i0, int &i1) |
Interpolation of potential between two time slices. | |
int | Coordinates3 (const double x, const double y, double &t1, double &t2, double &t3, double &t4, double jac[4][4], double &det, const std::array< double, 8 > &xn, const std::array< double, 8 > &yn) const |
Calculate local coordinates for curved quadratic triangles. | |
int | Coordinates4 (const double x, const double y, double &t1, double &t2, double &t3, double &t4, double &det, const std::array< double, 8 > &xn, const std::array< double, 8 > &yn) const |
Calculate local coordinates for linear quadrilaterals. | |
int | Coordinates5 (const double x, const double y, double &t1, double &t2, double &t3, double &t4, double jac[4][4], double &det, const std::array< double, 8 > &xn, const std::array< double, 8 > &yn) const |
Calculate local coordinates for curved quadratic quadrilaterals. | |
__DEVICE__ void | Coordinates12 (const double x, const double y, const double z, double &t1, double &t2, double &t3, double &t4, const std::array< double, 10 > &xn, const std::array< double, 10 > &yn, const std::array< double, 10 > &zn, const std::array< std::array< double, 3 >, 4 > &w) const |
Calculate local coordinates in linear tetrahedra. | |
__DEVICE__ int | Coordinates13 (const double x, const double y, const double z, double &t1, double &t2, double &t3, double &t4, double jac[4][4], double &det, const std::array< double, 10 > &xn, const std::array< double, 10 > &yn, const std::array< double, 10 > &zn, const std::array< std::array< double, 3 >, 4 > &w) const |
Calculate local coordinates for curved quadratic tetrahedra. | |
int | CoordinatesCube (const double x, const double y, const double z, double &t1, double &t2, double &t3, TMatrixD *&jac, std::vector< TMatrixD * > &dN, const Element &element) const |
Calculate local coordinates for a cube. | |
void | JacobianCube (const Element &element, const double t1, const double t2, const double t3, TMatrixD *&jac, std::vector< TMatrixD * > &dN) const |
Calculate Jacobian for a cube. | |
void | CalculateElementBoundingBoxes () |
Calculate the bounding boxes of all elements after initialization. | |
bool | InitializeTetrahedralTree () |
Initialize the tetrahedral tree. |
Static Protected Member Functions | |
static double | ScalingFactor (std::string unit) |
static double | Potential3 (const std::array< double, 6 > &v, const std::array< double, 3 > &t) |
Interpolate the potential in a triangle. | |
static void | Field3 (const std::array< double, 6 > &v, const std::array< double, 3 > &t, double jac[4][4], const double det, double &ex, double &ey) |
Interpolate the field in a triangle. | |
static double | Potential5 (const std::array< double, 8 > &v, const std::array< double, 2 > &t) |
Interpolate the potential in a curved quadrilateral. | |
static void | Field5 (const std::array< double, 8 > &v, const std::array< double, 2 > &t, double jac[4][4], const double det, double &ex, double &ey) |
Interpolate the field in a curved quadrilateral. | |
static double | Potential13 (const std::array< double, 10 > &v, const std::array< double, 4 > &t) |
Interpolate the potential in a curved quadratic tetrahedron. | |
static __DEVICE__ void | Field13 (const std::array< double, 10 > &v, const std::array< double, 4 > &t, double jac[4][4], const double det, double &ex, double &ey, double &ez) |
Interpolate the field in a curved quadratic tetrahedron. | |
static int | ReadInteger (char *token, int def, bool &error) |
static double | ReadDouble (char *token, double def, bool &error) |
static void | Jacobian3 (const std::array< double, 8 > &xn, const std::array< double, 8 > &yn, const double u, const double v, const double w, double &det, double jac[4][4]) |
Calculate Jacobian for curved quadratic triangles. | |
static void | Jacobian5 (const std::array< double, 8 > &xn, const std::array< double, 8 > &yn, const double u, const double v, double &det, double jac[4][4]) |
Calculate Jacobian for curved quadratic quadrilaterals. | |
static __DEVICE__ void | Jacobian13 (const std::array< double, 10 > &xn, const std::array< double, 10 > &yn, const std::array< double, 10 > &zn, const double fourt0, const double fourt1, const double fourt2, const double fourt3, double &det, double jac[4][4]) |
Calculate Jacobian for curved quadratic tetrahedra. | |
static std::array< std::array< double, 3 >, 4 > | Weights12 (const std::array< double, 10 > &xn, const std::array< double, 10 > &yn, const std::array< double, 10 > &zn) |
Protected Attributes | |
bool | m_is3d = true |
ElementType | m_elementType = ElementType::CurvedTetrahedron |
std::vector< Element > | m_elements |
std::vector< int > | m_elementIndices |
std::vector< bool > | m_degenerate |
std::vector< std::array< double, 3 > > | m_bbMin |
std::vector< std::array< double, 3 > > | m_bbMax |
std::vector< std::array< std::array< double, 3 >, 4 > > | m_w12 |
std::vector< Node > | m_nodes |
std::vector< double > | m_pot |
std::map< std::string, std::vector< double > > | m_wpot |
std::map< std::string, std::vector< std::vector< double > > > | m_dwpot |
std::vector< Material > | m_materials |
std::map< std::string, WeightingFieldCopy > | m_wfieldCopies |
bool | m_hasBoundingBox = false |
std::array< double, 3 > | m_minBoundingBox = {{0., 0., 0.}} |
std::array< double, 3 > | m_maxBoundingBox = {{0., 0., 0.}} |
bool | m_cacheElemBoundingBoxes = false |
Flag to check if bounding boxes of elements are cached. | |
std::array< double, 3 > | m_mapmin = {{0., 0., 0.}} |
std::array< double, 3 > | m_mapmax = {{0., 0., 0.}} |
std::array< double, 3 > | m_mapamin = {{0., 0., 0.}} |
std::array< double, 3 > | m_mapamax = {{0., 0., 0.}} |
std::array< double, 3 > | m_mapna = {{0., 0., 0.}} |
std::array< double, 3 > | m_cells = {{0., 0., 0.}} |
double | m_mapvmin = 0. |
double | m_mapvmax = 0. |
std::array< bool, 3 > | m_setang |
bool | m_deleteBackground = true |
bool | m_warning = false |
unsigned int | m_nWarnings = 0 |
bool | m_printConvergenceWarnings = true |
bool | m_checkMultipleElement = false |
Scan for multiple elements that contain a point. | |
bool | m_useTetrahedralTree = true |
std::unique_ptr< GARFIELD_CLASS_NAME(TetrahedralTree)> | m_octree |
Base class for components based on finite-element field maps.
Definition at line 29 of file ComponentFieldMap.hh.
|
strongprotected |
Enumerator | |
---|---|
Unknown | |
Serendipity | |
CurvedTetrahedron |
Definition at line 163 of file ComponentFieldMap.hh.
|
delete |
Default constructor.
Garfield::ComponentFieldMap::ComponentFieldMap | ( | const std::string & | name | ) |
Constructor.
|
virtual |
Destructor.
|
protected |
Calculate the bounding boxes of all elements after initialization.
bool Garfield::ComponentFieldMap::Check | ( | ) |
Check element aspect ratio.
|
protected |
Calculate local coordinates in linear tetrahedra.
|
protected |
Calculate local coordinates for curved quadratic tetrahedra.
|
protected |
Calculate local coordinates for curved quadratic triangles.
|
protected |
Calculate local coordinates for linear quadrilaterals.
|
protected |
Calculate local coordinates for curved quadratic quadrilaterals.
|
protected |
Calculate local coordinates for a cube.
void Garfield::ComponentFieldMap::CopyWeightingPotential | ( | const std::string & | label, |
const std::string & | labelSource, | ||
const double | x, | ||
const double | y, | ||
const double | z, | ||
const double | alpha, | ||
const double | beta, | ||
const double | gamma ) |
Makes a weighting potential copy of a imported map which can be translated and rotated.
label | name of new electrode |
labelSource | name of the source electrode that will be copied |
x | translation in the x-direction. |
y | translation in the y-direction. |
z | translation in the z-direction. |
alpha | rotation around the x-axis. |
beta | rotation around the y-axis. |
gamma | rotation around the z-axis. |
|
override |
Create and initialise GPU Transfer class.
|
override |
|
override |
void Garfield::ComponentFieldMap::DriftMedium | ( | const size_t | imat | ) |
Flag a field map material as a drift medium.
|
override |
|
override |
|
inline |
Definition at line 79 of file ComponentFieldMap.hh.
|
inline |
Enable or disable warnings that the calculation of the local coordinates did not achieve the requested precision.
Definition at line 95 of file ComponentFieldMap.hh.
|
inline |
Option to eliminate mesh elements in conductors (default: on).
Definition at line 83 of file ComponentFieldMap.hh.
|
inline |
Enable or disable the usage of the tetrahedral tree for searching the element in the mesh.
Definition at line 89 of file ComponentFieldMap.hh.
|
protected |
Compute the electric/weighting field.
|
staticprotected |
Interpolate the field in a curved quadratic tetrahedron.
|
staticprotected |
Interpolate the field in a triangle.
|
staticprotected |
Interpolate the field in a curved quadrilateral.
|
protected |
Find the element for a point in curved quadratic tetrahedra.
|
protected |
Find the element for a point in curved quadratic quadrilaterals.
|
protected |
Find the element for a point in a cube.
|
protectedvirtual |
Reimplemented in Garfield::ComponentCST.
|
override |
double Garfield::ComponentFieldMap::GetConductivity | ( | const size_t | imat | ) | const |
Return the conductivity of a field map material.
bool Garfield::ComponentFieldMap::GetElement | ( | const size_t | i, |
double & | vol, | ||
double & | dmin, | ||
double & | dmax ) const |
Return the volume and aspect ratio of a mesh element.
|
override |
|
override |
|
override |
|
protectedvirtual |
Reimplemented in Garfield::ComponentCST.
|
override |
Medium * Garfield::ComponentFieldMap::GetMedium | ( | const size_t | imat | ) | const |
Return the Medium associated to a field map material.
|
override |
|
inlineoverride |
Definition at line 65 of file ComponentFieldMap.hh.
|
inline |
Return the number of materials in the field map.
Definition at line 51 of file ComponentFieldMap.hh.
|
inlineoverride |
Definition at line 73 of file ComponentFieldMap.hh.
double Garfield::ComponentFieldMap::GetPermittivity | ( | const size_t | imat | ) | const |
Return the relative permittivity of a field map material.
double Garfield::ComponentFieldMap::GetPotential | ( | const size_t | i | ) | const |
Return the potential at a given node.
|
inlineoverride |
Definition at line 139 of file ComponentFieldMap.hh.
|
inline |
Definition at line 135 of file ComponentFieldMap.hh.
|
protected |
Initialize the tetrahedral tree.
|
inlineoverride |
Definition at line 129 of file ComponentFieldMap.hh.
|
inline |
Definition at line 123 of file ComponentFieldMap.hh.
|
staticprotected |
Calculate Jacobian for curved quadratic tetrahedra.
|
staticprotected |
Calculate Jacobian for curved quadratic triangles.
|
staticprotected |
Calculate Jacobian for curved quadratic quadrilaterals.
|
protected |
Calculate Jacobian for a cube.
|
protected |
Move (xpos, ypos, zpos) to field map coordinates.
void Garfield::ComponentFieldMap::NotDriftMedium | ( | const size_t | imat | ) |
Flag a field map materials as a non-drift medium.
|
protected |
Compute the electrostatic/weighting potential.
|
staticprotected |
Interpolate the potential in a curved quadratic tetrahedron.
|
staticprotected |
Interpolate the potential in a triangle.
|
staticprotected |
Interpolate the potential in a curved quadrilateral.
|
protected |
|
protected |
|
protected |
void Garfield::ComponentFieldMap::PrintMaterials | ( | ) |
List all currently defined materials.
|
protected |
void Garfield::ComponentFieldMap::PrintRange | ( | ) |
Show x, y, z, V and angular ranges.
|
protected |
|
staticprotected |
|
staticprotected |
|
overrideprotected |
|
staticprotected |
|
protected |
Find lowest epsilon, check for eps = 0, set default drift media flags.
void Garfield::ComponentFieldMap::SetGas | ( | Medium * | medium | ) |
Associate all field map materials with a relative permittivity of unity to a given Medium class.
void Garfield::ComponentFieldMap::SetMedium | ( | const size_t | imat, |
Medium * | medium ) |
Associate a field map material with a Medium object.
|
protectedvirtual |
Reimplemented in Garfield::ComponentCST.
|
protected |
Interpolation of potential between two time slices.
|
protected |
Move (ex, ey, ez) to global coordinates.
|
inlineoverrideprotected |
Definition at line 327 of file ComponentFieldMap.hh.
|
protected |
|
protected |
|
override |
|
override |
|
staticprotected |
|
protected |
Definition at line 199 of file ComponentFieldMap.hh.
|
protected |
Definition at line 198 of file ComponentFieldMap.hh.
|
protected |
Flag to check if bounding boxes of elements are cached.
Definition at line 279 of file ComponentFieldMap.hh.
|
protected |
Definition at line 297 of file ComponentFieldMap.hh.
|
protected |
Scan for multiple elements that contain a point.
Definition at line 429 of file ComponentFieldMap.hh.
|
protected |
Definition at line 190 of file ComponentFieldMap.hh.
|
protected |
Definition at line 305 of file ComponentFieldMap.hh.
|
protected |
Definition at line 227 of file ComponentFieldMap.hh.
|
protected |
Definition at line 183 of file ComponentFieldMap.hh.
|
protected |
Definition at line 182 of file ComponentFieldMap.hh.
|
protected |
Definition at line 168 of file ComponentFieldMap.hh.
|
protected |
Definition at line 274 of file ComponentFieldMap.hh.
|
protected |
Definition at line 161 of file ComponentFieldMap.hh.
|
protected |
Definition at line 292 of file ComponentFieldMap.hh.
|
protected |
Definition at line 291 of file ComponentFieldMap.hh.
|
protected |
Definition at line 290 of file ComponentFieldMap.hh.
|
protected |
Definition at line 289 of file ComponentFieldMap.hh.
|
protected |
Definition at line 296 of file ComponentFieldMap.hh.
|
protected |
Definition at line 300 of file ComponentFieldMap.hh.
|
protected |
Definition at line 299 of file ComponentFieldMap.hh.
|
protected |
Definition at line 258 of file ComponentFieldMap.hh.
|
protected |
Definition at line 276 of file ComponentFieldMap.hh.
|
protected |
Definition at line 275 of file ComponentFieldMap.hh.
|
protected |
Definition at line 217 of file ComponentFieldMap.hh.
|
protected |
Definition at line 309 of file ComponentFieldMap.hh.
|
protected |
Definition at line 436 of file ComponentFieldMap.hh.
|
protected |
Definition at line 223 of file ComponentFieldMap.hh.
|
protected |
Definition at line 313 of file ComponentFieldMap.hh.
|
protected |
Definition at line 302 of file ComponentFieldMap.hh.
|
protected |
Definition at line 432 of file ComponentFieldMap.hh.
|
protected |
Definition at line 205 of file ComponentFieldMap.hh.
|
protected |
Definition at line 308 of file ComponentFieldMap.hh.
|
protected |
Definition at line 271 of file ComponentFieldMap.hh.
|
protected |
Definition at line 225 of file ComponentFieldMap.hh.