SolidStateDetectors.jl
repository·main·Indexed 41 days ago
https://github.com/juliaphysics/solidstatedetectors.jlA high-performance Julia package for the fast 2D and 3D simulation of solid-state detectors. Part of the JuliaPhysics ecosystem, it provides tools for calculating Maxwell capacitance matrices, simulating charge drift using models like ADL2016 and InactiveLayer, and implementing charge trapping models such as Boggs and ConstantLifetime. Requires Julia >= v1.11.
What's inside SolidStateDetectors.jl
- SolidStateDetectors.jl is a Julia package designed for the fast 2D and 3D simulation of Solid State Detectors. It is part of the JuliaPhysics ecosystem.
Temperature validation in charge trapping models
mainTemperature handling for charge trapping models follows these rules:
- Preference: It is best to define
temperatureinsemiconductor.temperature. This value is automatically passed to the trapping model. - Redundancy: You can also specify
temperatureinside theparametersblock or at the top level of thecharge_trapping_modelconfig. If bothsemiconductor.temperatureand a model-specific temperature are provided, they must match, or an error is raised. - Defaults: If
semiconductor.temperatureis not defined, a material-specific default is used (77 K for High Purity Germanium, 293 K otherwise) and a warning is issued. Even if a temperature is specified inparameters, the semiconductor temperature is resolved first.
- Preference: It is best to define
Construct geometries using Constructive Solid Geometry (CSG)
mainComplex geometries in
SolidStateDetectors.jlare built using Constructive Solid Geometry (CSG). This involves combining simple Volume Primitives (likeBox,Tube, orSphere) using Boolean Operators (union,difference,intersection) and applying Transformations (rotation and translation).Geometries can be defined via YAML configuration files and loaded into the Julia environment using
CSG.Geometry.using SolidStateDetectors import SolidStateDetectors.ConstructiveSolidGeometry as CSG T = Float64 cfn = "path/to/your/geometry.yaml" geometry = CSG.Geometry(T, cfn) plot(geometry)Understanding Charge Drift in Solid State Detectors
mainIn solid state detectors, charged particles do not undergo ballistic transport (continuous acceleration) as they would in a vacuum. Instead, scattering with the material matter limits their acceleration, resulting in a constant drift velocity $v_{d}$ determined by the mobility $\mu$ and the electric field strength $E$:
$$v_{d} = \mu E$$
Because scattering can cause trajectories to deviate from electric field lines (for example, due to crystal axis orientation), the relationship between the electric field and drift velocity is expressed using a 3x3 mobility tensor $\mu_{ij}$:
$$v_{i} = \mu_{ij} \cdot E_{j}$$
Mobility is not a constant; it varies based on the material, temperature, impurity density, and the strength of the electric field.
Understand the concept of Weighting Potentials
mainA weighting potential $\Phi_i^w$ is a theoretical potential that describes the fraction of a charge at position $\vec{r}$ that is 'seen' by a specific contact $C_i$.
- A value of 0 means the charge is not seen by the electrode.
- A value of 1 means the charge is collected by the electrode.
According to the Shockley-Ramo theorem, the net charge $Q_i$ induced on an electrode $C_i$ by electrons and holes (with absolute charge $Q$) is calculated as:
$$Q_i = Q \left( \sum_{\text{holes}} \Phi_i^w(\vec{r}h) - \sum{\text{electrons}} \Phi_i^w(\vec{r}_e) \right)$$
Mathematically, the weighting potential is defined by the following Poisson equation (where $\epsilon_r$ is the dielectric distribution):
$$\nabla \left( \epsilon_r(\vec{r}) \nabla \Phi_i^w(\vec{r})\right) = 0$$
With boundary conditions at the contacts $C_j$: $$\Phi_i^w(\vec{r})\vert_{C_j} = \begin{cases} 1, & \text{if } i = j \ 0, & \text{if } i \neq j \end{cases}$$
Configure DiscreteAxis and boundary conditions
mainA
SolidStateDetectors.DiscreteAxisdefines a single dimension of a grid. It stores:ax.interval: The range of the axis (can be:closedor:open).ax.ticks: The discrete points along the axis (can be non-uniformly spaced for adaptive refinement).- Boundary conditions: Determines how potential is handled at the edges of the world.
Available boundary conditions for an axis:
periodic: Assumes potential is periodic (ϕ(x0) = ϕ(xN)andϕ(xN+1) = ϕ(x1)).reflecting: Assumes mirror-symmetry (ϕ(x0) = ϕ(x2)andϕ(xN+1) = ϕ(xN-1)).fixed(orfix): Sets potential beyond the boundary to the boundary value (ϕ(x0) = ϕ(x1)andϕ(xN+1) = ϕ(xN)).infinite(orinf): Assumes a constant ratio between neighboring ticks (ϕ(x0)/ϕ(x1) = ϕ(x1)/ϕ(x2)).
Define the simulation grid and coordinate systems
mainThe
gridsection defines the finite world where calculations occur. You must specify thecoordinatestype and the dimensions of theaxes.Supported Coordinate Systems:
cartesian: Requires axesx,y, andz.cylindrical: Requires axesr,phi, andz.
Axis Dimensions: Each axis is defined by a
fromandtovalue.grid: coordinates: cylindrical axes: r: 45 z: from: -40 to: 40Configure grid boundary handling and symmetries
mainYou can use
boundarieswithin theaxesfield to implement symmetries and reduce calculation volume.Linear Axes (
x,y,z):infinite,periodic,reflecting, orfixed.
Radial Axes (
r):- Left boundary: Defaults to
r0. - Right boundary: Can be
infinite,reflecting, orfixed.
Angular Axes (
phi):reflectingorperiodic(defaults toperiodicfor both edges).
Symmetry Examples:
- 2D $\varphi$-symmetric: Set
phirange from0to0withperiodicboundaries. - $\varphi$-periodic fraction: Set
phito a specific interval (e.g.,0°to120°) withperiodicboundaries. - Mirror symmetry: Use
left: periodicandright: reflectingon an angular axis.
grid: coordinates: cylindrical axes: r: # ... phi: from: 0° to: 30° boundaries: left: periodic right: reflecting z: # ...Understand Grid types and structures
mainSolidStateDetectors.jl uses a 3-dimensional grid to calculate electric potential via successive over-relaxation (SOR). The 'world' (the simulation volume) is divided into discrete points called a
grid::Grid.You can choose between two primary grid geometries:
CartesianGrid: Uses three axes:x,y, andz.CylindricalGrid: Uses three axes:r,φ, andz.
A
Gridis defined by itsgrid.axes, where each axis is aSolidStateDetectors.DiscreteAxiscontaining a specific number of discrete points (ticks) within a defined interval.Configure 3D detector plot styles
mainThe
seriestype(orst) keyword controls the 3D rendering style of the detector geometry::csg(default): Plots a wireframe on top of a mesh. Best for geometries consisting of unions of primitives.:wireframe: Fast plotting of the wireframe only.:mesh3d: Fast plotting of the mesh only.:samplesurface: A marker-based style. Recommended for geometries involving differences or intersections. Usen_samples(e.g.,> 100) andmarkersizeto increase fidelity.
Note: For
:csg,:wireframe, and:mesh3d, if the geometry contains differences, the resulting negative geometries may appear with thinner lines or semi-transparent white faces.# Comparing different 3D styles plot( plot(det, seriestype = :csg, title = ":csg"), plot(det, seriestype = :wireframe, title = ":wireframe"), plot(det, seriestype = :mesh3d, title = ":mesh3d"), plot(det, seriestype = :samplesurface, title = ":samplesurface", markersize = 1, n_samples = 50), layout = (1,4), size = (800,200) )Use Boolean operators to combine geometries
mainBoolean operators allow you to combine multiple geometries into a single complex object via YAML configuration:
union(A || B): The set of points in at least one of the objects.union: - tube: { r: 2, h: 1 } - tube: { r: 1, h: 1.5, origin: { z: 0.5 } }difference(A && !B): The set of points inAbut not inB. The first entry is the base geometry; subsequent entries are subtracted from it. Note: To ensure clean surfaces, make the subtracted objectBslightly larger thanA.difference: - tube: { r: 2, h: 1 } - tube: { r: 1, h: 1.1 }intersection(A && B): The set of points present in all provided geometries.intersection: - tube: { r: 2, h: 1 } - tube: { r: 1, h: 1.5, origin: { z: 0.5 } }
Install and setup plotting with Plots.jl
mainTo plot geometries or simulation results in
SolidStateDetectors.jl, you must load thePlots.jlpackage. The plotting system integrates withUnitful.jlto handle physical dimensions on axes.using Plots using SolidStateDetectors using Unitful # Example setup T = Float32 sim = Simulation{T}(SSD_examples[:InvertedCoax]); simulate!(sim, convergence_limit = 1e-6, refinement_limits = [0.2, 0.1, 0.05, 0.01]);