1#ifndef VIENNASHE_SHE_CARRIER_KINETIC_ENERGY_HPP
2#define VIENNASHE_SHE_CARRIER_KINETIC_ENERGY_HPP
24#include "viennagrid/mesh/mesh.hpp"
48 double f_00_value) : dispersion_(dispersion), f_00_(f_00_value) {}
58 dispersion_relation_type dispersion_;
65 template <
typename SHEQuantity>
75 SHEQuantity
const & quan)
76 : conf_(conf), quan_(quan) {}
78 template <
typename CellType>
82 carrier_density_type carrier_density_(conf_, quan_);
84 double avg_energy = 0;
85 const double density = carrier_density_(cell);
92 if (quan_.get_unknown_mask(cell))
94 for (std::size_t index_H=1; index_H < quan_.get_value_H_size() - 1; ++index_H)
96 if ( quan_.get_unknown_index(cell, index_H) < 0 )
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,
102 const double energy_upper = (quan_.get_kinetic_energy(cell, index_H + 1) + quan_.get_kinetic_energy(cell, index_H)) / 2.0;
104 if (energy_upper >= 0 && energy_lower < energy_upper)
106 double height =
box_height(quan_, cell, index_H);
110 avg_energy += quan_.get_values(cell, index_H)[0] * energy_mid *
averaged_density_of_states(quan_, dispersion, cell, index_H) * height;
113 avg_energy += quan_.get_values(cell, index_H)[0] * energy_mid * height;
115 default:
throw std::runtime_error(
"carrier_energy_wrapper::operator(): Unknown SHE discretization type!");
122 for (std::size_t index_H=1; index_H < quan_.get_value_H_size() - 1; ++index_H)
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;
128 if (energy_upper >= 0 && energy_lower < energy_upper)
130 double height =
box_height(quan_, cell, index_H);
134 avg_energy += quan_.get_boundary_value(cell, index_H) * energy_mid *
averaged_density_of_states(quan_, dispersion, cell, index_H) * height;
137 avg_energy += quan_.get_boundary_value(cell, index_H) * energy_mid * height;
139 default:
throw std::runtime_error(
"carrier_energy_wrapper::operator(): Unknown SHE discretization type!");
145 return avg_energy / density;
161 template <
typename DeviceType,
162 typename SHEQuantity,
163 typename ContainerType>
166 SHEQuantity
const & quan,
167 ContainerType & container)
Provides an accessor for the carrier density.
The main SHE configuration class. To be adjusted by the user for his/her needs.
viennashe::physics::dispersion_proxy dispersion_relation(viennashe::carrier_type_id ctype) const
Returns the dispersion relation for electrons.
she_discretization_type_id she_discretization_type() const
Defines the physical properties of a device, e.g. doping. This is the implementation for 2d and highe...
A proxy object for a dispersion relation. Does NOT take ownership of the provided pointer!
double symmetry_factor() const
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.
@ SHE_DISCRETIZATION_EVEN_ODD_ORDER_GENERALIZED_DF
@ SHE_DISCRETIZATION_EVEN_ODD_ORDER_DF
void write_macroscopic_quantity_to_container(DeviceType const &device, MacroscopicQuantityAccessor const &quantity, ContainerType &quantity_container)
Writes the provided macroscopic quantity to the container provided.
Provides a number of fundamental constants. All constants in SI units.