ViennaSHE 1.3.0
Free open-source semiconductor device simulator using spherical harmonics expansions techniques.
carrier_energy.hpp
Go to the documentation of this file.
1#ifndef VIENNASHE_SHE_CARRIER_KINETIC_ENERGY_HPP
2#define VIENNASHE_SHE_CARRIER_KINETIC_ENERGY_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
20#include <math.h>
21#include <fstream>
22#include <iostream>
23
24#include "viennagrid/mesh/mesh.hpp"
25
26#include "viennashe/forwards.h"
27#include "viennashe/config.hpp"
29
32
37namespace viennashe
38{
39 namespace she
40 {
41 namespace detail
42 {
44 {
46 public:
48 double f_00_value) : dispersion_(dispersion), f_00_(f_00_value) {}
49
50 double operator()(double kinetic_energy) const
51 {
52 return kinetic_energy
53 * dispersion_.symmetry_factor() //in order to get consistent results when dividing by the carrier density
54 * f_00_;
55 }
56
57 private:
58 dispersion_relation_type dispersion_;
59 double f_00_;
60 };
61 } // namespace detail
62
63
65 template <typename SHEQuantity>
67 {
69
70 public:
71
72 typedef double value_type;
73
75 SHEQuantity const & quan)
76 : conf_(conf), quan_(quan) {}
77
78 template <typename CellType>
79 value_type operator()(CellType const & cell) const
80 {
81 typedef typename detail::carrier_density_wrapper_by_reference<SHEQuantity> carrier_density_type;
82 carrier_density_type carrier_density_(conf_, quan_);
83
84 double avg_energy = 0;
85 const double density = carrier_density_(cell);
86
87 typename viennashe::config::dispersion_relation_type dispersion = conf_.dispersion_relation(quan_.get_carrier_type_id());
88
89 if (density <= 0)
90 return 0;
91
92 if (quan_.get_unknown_mask(cell))
93 {
94 for (std::size_t index_H=1; index_H < quan_.get_value_H_size() - 1; ++index_H)
95 {
96 if ( quan_.get_unknown_index(cell, index_H) < 0 )
97 continue;
98
99 const double energy_mid = std::max(quan_.get_kinetic_energy(cell, index_H), 0.0);
100 const double energy_lower = std::max( (quan_.get_kinetic_energy(cell, index_H - 1) + quan_.get_kinetic_energy(cell, index_H)) / 2.0,
101 0.0);
102 const double energy_upper = (quan_.get_kinetic_energy(cell, index_H + 1) + quan_.get_kinetic_energy(cell, index_H)) / 2.0;
103
104 if (energy_upper >= 0 && energy_lower < energy_upper)
105 {
106 double height = box_height(quan_, cell, index_H);
107 switch (conf_.she_discretization_type())
108 {
110 avg_energy += quan_.get_values(cell, index_H)[0] * energy_mid * averaged_density_of_states(quan_, dispersion, cell, index_H) * height;
111 break;
113 avg_energy += quan_.get_values(cell, index_H)[0] * energy_mid * height;
114 break;
115 default: throw std::runtime_error("carrier_energy_wrapper::operator(): Unknown SHE discretization type!");
116 }
117 }
118 } // index_H
119 }
120 else // Get the average carrier energy at the boundary (we've a boundary condition here)
121 {
122 for (std::size_t index_H=1; index_H < quan_.get_value_H_size() - 1; ++index_H)
123 {
124 const double energy_mid = std::max(quan_.get_kinetic_energy(cell, index_H), 0.0);
125 const double energy_lower = std::max( (quan_.get_kinetic_energy(cell, index_H - 1) + quan_.get_kinetic_energy(cell, index_H)) / 2.0, 0.0);
126 const double energy_upper =(quan_.get_kinetic_energy(cell, index_H + 1) + quan_.get_kinetic_energy(cell, index_H)) / 2.0;
127
128 if (energy_upper >= 0 && energy_lower < energy_upper)
129 {
130 double height = box_height(quan_, cell, index_H);
131 switch (conf_.she_discretization_type())
132 {
134 avg_energy += quan_.get_boundary_value(cell, index_H) * energy_mid * averaged_density_of_states(quan_, dispersion, cell, index_H) * height;
135 break;
137 avg_energy += quan_.get_boundary_value(cell, index_H) * energy_mid * height;
138 break;
139 default: throw std::runtime_error("carrier_energy_wrapper::operator(): Unknown SHE discretization type!");
140 }
141 }
142 } // index_H
143 }
144
145 return avg_energy / density;
146 }
147
148 private:
149 viennashe::config conf_;
150 SHEQuantity quan_;
151 };
152
153
161 template <typename DeviceType,
162 typename SHEQuantity,
163 typename ContainerType>
165 viennashe::config const & conf,
166 SHEQuantity const & quan,
167 ContainerType & container)
168 {
170
172 }
173
174
175 } //namespace she
176} //namespace viennashe
177
178#endif
Provides an accessor for the carrier density.
The main SHE configuration class. To be adjusted by the user for his/her needs.
Definition: config.hpp:124
viennashe::physics::dispersion_proxy dispersion_relation(viennashe::carrier_type_id ctype) const
Returns the dispersion relation for electrons.
Definition: config.hpp:266
she_discretization_type_id she_discretization_type() const
Definition: config.hpp:360
Defines the physical properties of a device, e.g. doping. This is the implementation for 2d and highe...
Definition: device.hpp:818
A proxy object for a dispersion relation. Does NOT take ownership of the provided pointer!
Definition: dispersion.hpp:69
An accessor for the average carrier energy at each point inside the device.
value_type operator()(CellType const &cell) const
carrier_energy_wrapper(viennashe::config const &conf, SHEQuantity const &quan)
An accessor for the carrier density in the device by reference
energy_integrator_for_box(dispersion_relation_type const &dispersion, double f_00_value)
double operator()(double kinetic_energy) const
The SHE configuration class is defined here.
Contains forward declarations and definition of small classes that must be defined at an early stage.
Writer for arbitrary macroscopic quantities.
double averaged_density_of_states(SHEQuantity const &quan, viennashe::config::dispersion_relation_type const &dispersion, CellFacetType const &cell_facet, std::size_t index_H)
Returns the density of states around a vertex or an edge at total energy specified by index_H....
void write_kinetic_carrier_energy_to_container(DeviceType const &device, viennashe::config const &conf, SHEQuantity const &quan, ContainerType &container)
Convenience function for writing the average kinetic carrier energy to the container provided.
double box_height(SHEQuantity const &quan, ElementType const &elem, std::size_t index_H)
Returns the height of the control box with respect to energy at the provided element (vertex or edge)...
The main ViennaSHE namespace. All functionality resides inside this namespace.
Definition: accessors.hpp:40
@ SHE_DISCRETIZATION_EVEN_ODD_ORDER_GENERALIZED_DF
Definition: forwards.h:146
@ SHE_DISCRETIZATION_EVEN_ODD_ORDER_DF
Definition: forwards.h:145
void write_macroscopic_quantity_to_container(DeviceType const &device, MacroscopicQuantityAccessor const &quantity, ContainerType &quantity_container)
Writes the provided macroscopic quantity to the container provided.
Definition: macroscopic.hpp:46
Provides a number of fundamental constants. All constants in SI units.