ViennaSHE 1.3.0
Free open-source semiconductor device simulator using spherical harmonics expansions techniques.
setup_energies.hpp
Go to the documentation of this file.
1#ifndef VIENNASHE_SHE_SETUP_ENERGIES_HPP
2#define VIENNASHE_SHE_SETUP_ENERGIES_HPP
3
4/* ============================================================================
5 Copyright (c) 2011-2022, Institute for Microelectronics,
6 Institute for Analysis and Scientific Computing,
7 TU Wien.
8
9 -----------------
10 ViennaSHE - The Vienna Spherical Harmonics Expansion Boltzmann Solver
11 -----------------
12
13 http://viennashe.sourceforge.net/
14
15 License: MIT (X11), see file LICENSE in the base directory
16=============================================================================== */
17
18
19#include <iostream>
20#include <limits>
21
22#include "viennagrid/mesh/mesh.hpp"
23#include "viennagrid/config/default_configs.hpp"
24
26#include "viennashe/forwards.h"
30#include "viennashe/config.hpp"
31
35
36#include "viennashe/log/log.hpp"
37
39
45namespace viennashe
46{
47 namespace she
48 {
49
50
59 template <typename DeviceT,
60 typename VertexT, typename EdgeT>
61 void setup_energies(DeviceT const & device,
63 viennashe::config const & conf,
65 viennashe::unknown_quantity<VertexT> const & quantum_correction)
66 {
67 typedef typename DeviceT::mesh_type MeshType;
68
69 typedef typename viennagrid::result_of::facet<MeshType>::type FacetType;
70 typedef typename viennagrid::result_of::cell<MeshType>::type CellType;
71
72 typedef typename viennagrid::result_of::const_facet_range<MeshType>::type FacetContainer;
73 typedef typename viennagrid::result_of::iterator<FacetContainer>::type FacetIterator;
74
75 typedef typename viennagrid::result_of::const_cell_range<MeshType>::type CellContainer;
76 typedef typename viennagrid::result_of::iterator<CellContainer>::type CellIterator;
77
78 typedef typename viennagrid::result_of::const_coboundary_range<MeshType, FacetType, CellType>::type CellOnFacetContainer;
79
80 MeshType const & mesh = device.mesh();
81
82 double max_potential = -1.0 * std::numeric_limits<double>::max();
83 double min_potential = std::numeric_limits<double>::max();
84
85 //
86 // Step 1: Find minimum of band edge center and write band edge center to device.
87 // Only consider vertices which are attached to semiconductor cells.
88 //
89
90 CellContainer cells(mesh);
91 for (CellIterator cit = cells.begin();
92 cit != cells.end();
93 ++cit)
94 {
96 continue;
97
98 const double cell_potential = potential.get_value(*cit) + quantum_correction.get_value(*cit);
99
100 if (cell_potential < min_potential) min_potential = cell_potential;
101 if (cell_potential > max_potential) max_potential = cell_potential;
102 }
103
104 //
105 // Step 2: Set total energy
106 //
107
108 double total_energy_range = viennashe::physics::constants::q * (max_potential - min_potential) + 2.0 * conf.energy_spacing() + conf.min_kinetic_energy_range(quan.get_carrier_type_id());
109 double total_energy_bandedge = (quan.get_carrier_type_id() == ELECTRON_TYPE_ID) ? -viennashe::physics::constants::q * max_potential - conf.energy_spacing() + viennashe::materials::si::band_gap() / 2.0
111 double total_energy_increment = ((quan.get_carrier_type_id() == ELECTRON_TYPE_ID) ? 1.0 : -1.0) * conf.energy_spacing();
112
113 if (!conf.use_h_transformation())
114 {
115 total_energy_range = conf.min_kinetic_energy_range(quan.get_carrier_type_id());
116 total_energy_bandedge = -total_energy_increment; // align band edge with index_H=1
117 }
118
119 // Set total energy
120 std::size_t num_energies = static_cast<std::size_t>(total_energy_range / conf.energy_spacing()) + 1;
121 quan.resize(viennagrid::cells(mesh).size(), viennagrid::facets(mesh).size(), num_energies);
122 for (std::size_t index_H = 0; index_H < quan.get_value_H_size(); ++index_H)
123 {
124 quan.set_value_H(index_H, total_energy_bandedge + index_H * total_energy_increment);
125 }
126
127 // Set bandedge shift on vertices and edges (only when using H-transform):
128 if (conf.use_h_transformation())
129 {
130 for (CellIterator cit = cells.begin();
131 cit != cells.end();
132 ++cit)
133 {
136 else
138 }
139
140 FacetContainer facets(mesh);
141 for (FacetIterator fit = facets.begin();
142 fit != facets.end();
143 ++fit)
144 {
145 CellOnFacetContainer cells_on_facet(mesh, fit.handle());
146 if (cells_on_facet.size() == 2)
147 quan.set_bandedge_shift(*fit, (quan.get_bandedge_shift(cells_on_facet[0]) + quan.get_bandedge_shift(cells_on_facet[1])) / 2.0);
148 else
149 quan.set_bandedge_shift(*fit, quan.get_bandedge_shift(cells_on_facet[0]));
150 }
151 }
152
153 }
154
161 template <typename DeviceType>
162 void setup_energies(DeviceType const & device,
164 viennashe::config const & conf)
165 {
168
169 SpatialUnknownType const & potential = quantities.get_unknown_quantity(viennashe::quantity::potential());
170 SpatialUnknownType const & quantum_corr_n = quantities.get_unknown_quantity(viennashe::quantity::density_gradient_electron_correction());
171 SpatialUnknownType const & quantum_corr_p = quantities.get_unknown_quantity(viennashe::quantity::density_gradient_hole_correction());
172 SHEUnknownType & f_n = quantities.electron_distribution_function();
173 SHEUnknownType & f_p = quantities.hole_distribution_function();
174
175 // Setup energies for electrons:
176 if (conf.with_electrons() && conf.get_electron_equation() == EQUATION_SHE)
177 setup_energies(device, f_n, conf, potential, quantum_corr_n);
178
179 // Setup energies for holes:
180 if (conf.with_holes() && conf.get_hole_equation() == EQUATION_SHE)
181 setup_energies(device, f_p, conf, potential, quantum_corr_p);
182 }
183
184 }
185}
186
187#endif
Contains the definition of per-device accessors (read-only!) for various quantities.
The main SHE configuration class. To be adjusted by the user for his/her needs.
Definition: config.hpp:124
double min_kinetic_energy_range(viennashe::carrier_type_id ctype) const
Returns the minimum kinetic energy range for the selected carrier.
Definition: config.hpp:388
equation_id get_electron_equation() const
Definition: config.hpp:230
bool with_holes() const
Returns true if holes are considered in the simulation.
Definition: config.hpp:234
equation_id get_hole_equation() const
Definition: config.hpp:238
double energy_spacing() const
Returns the uniform energy spacing of discrete energies.
Definition: config.hpp:460
bool use_h_transformation() const
Returns whether the H-transformation is used.
Definition: config.hpp:465
bool with_electrons() const
Returns true if electrons are considered in the simulation.
Definition: config.hpp:226
long get_material(cell_type const &elem) const
Returns the material id of the provided cell.
Definition: device.hpp:502
MeshT const & mesh() const
Returns the underlying mesh.
Definition: device.hpp:145
Defines the physical properties of a device, e.g. doping. This is the implementation for 2d and highe...
Definition: device.hpp:818
The main SHE simulator controller class. Acts as an accessor for all SHE quantities needed for the si...
UnknownSHEQuantityType const & electron_distribution_function() const
UnknownQuantityType & get_unknown_quantity(std::string quantity_name)
Returns a reference to the unkown quantity identified by its name.
UnknownSHEQuantityType const & hole_distribution_function() const
General representation of any solver quantity defined on two different element types (e....
void set_bandedge_shift(AssociatedT1 const &elem, ValueT value)
ValueT get_bandedge_shift(AssociatedT1 const &elem) const
carrier_type_id get_carrier_type_id() const
void resize(std::size_t num_values_1, std::size_t num_values_2)
void set_value_H(std::size_t index_H, ValueT value)
ValueT get_value(associated_type const &elem) const
The SHE configuration class is defined here.
Contains the dispersion relations for different materials and different polarities.
Contains forward declarations and definition of small classes that must be defined at an early stage.
A logging facility providing fine-grained control over logging in ViennaSHE.
Miscellaneous utilities.
bool is_semiconductor(long material_id)
Convenience function for checking whether the supplied material ID refers to a semiconductor.
Definition: all.hpp:156
std::string density_gradient_hole_correction()
std::string density_gradient_electron_correction()
void setup_energies(DeviceT const &device, viennashe::she::unknown_she_quantity< VertexT, EdgeT > &quan, viennashe::config const &conf, viennashe::unknown_quantity< VertexT > const &potential, viennashe::unknown_quantity< VertexT > const &quantum_correction)
Computes the kinetic energy over the device as obtained from the provided potential.
The main ViennaSHE namespace. All functionality resides inside this namespace.
Definition: accessors.hpp:40
@ ELECTRON_TYPE_ID
Definition: forwards.h:187
@ EQUATION_SHE
Definition: forwards.h:118
Provides a number of fundamental constants. All constants in SI units.
Provides the exceptions used inside the viennashe::she namespace.
Defines a SHE quantity in (x, H)-space for use within the solvers of ViennaSHE.
Defines a generic simulator quantity for use within the solvers of ViennaSHE.
static double band_gap()
Definition: all.hpp:99
static const double q
Elementary charge.
Definition: constants.hpp:44
A container of all quantities defined for a certain timestep t.