ViennaSHE 1.3.0
Free open-source semiconductor device simulator using spherical harmonics expansions techniques.
terminal_current.hpp
Go to the documentation of this file.
1#ifndef VIENNASHE_UTIL_TERMINAL_CURRENT_HPP
2#define VIENNASHE_UTIL_TERMINAL_CURRENT_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#include "viennagrid/mesh/mesh.hpp"
19#include "viennagrid/algorithm/boundary.hpp"
20#include "viennagrid/algorithm/interface.hpp"
21
22#include "viennagrid/algorithm/volume.hpp"
27#include "viennashe/config.hpp"
30
36namespace viennashe
37{
38
47 template<typename DeviceT, typename CurrentAccessorT, typename SegmentT>
48 double get_terminal_current(DeviceT const & device,
49 CurrentAccessorT const & current_accessor,
50 SegmentT const & semiconductor,
51 SegmentT const & terminal)
52 {
53 typedef typename DeviceT::mesh_type MeshType;
54
55 typedef typename viennagrid::result_of::point<MeshType> ::type PointType;
56 typedef typename viennagrid::result_of::facet<MeshType> ::type FacetType;
57 typedef typename viennagrid::result_of::cell<MeshType> ::type CellType;
58
59 typedef typename viennagrid::result_of::const_cell_range<SegmentT>::type CellContainer;
60 typedef typename viennagrid::result_of::iterator<CellContainer>::type CellIterator;
61
62 typedef typename viennagrid::result_of::const_facet_range<CellType>::type FacetOnCellContainer;
63 typedef typename viennagrid::result_of::iterator<FacetOnCellContainer>::type FacetOnCellIterator;
64
65 typedef typename viennagrid::result_of::const_coboundary_range<SegmentT, FacetType, CellType>::type CellOnFacetContainer;
66
67 double current = 0;
68
69 CellContainer cells(terminal);
70 for (CellIterator cit = cells.begin(); cit != cells.end(); ++cit)
71 {
72 PointType centroid_cell = viennagrid::centroid(*cit);
73
74 FacetOnCellContainer facets_on_cell(*cit);
75 for (FacetOnCellIterator focit = facets_on_cell.begin();
76 focit != facets_on_cell.end();
77 ++focit)
78 {
79 if ( viennagrid::is_interface(terminal, semiconductor, *focit) )
80 {
81 CellOnFacetContainer cells_on_facet(device.mesh(), focit.handle());
82
83 CellType const *other_cell_ptr = util::get_other_cell_of_facet(device.mesh(), *focit, *cit);
84
85 if (!other_cell_ptr) continue; //Facet is on the boundary of the simulation domain -> homogeneous Neumann conditions
86
87 PointType centroid_other_cell = viennagrid::centroid(*other_cell_ptr);
88 PointType cell_connection = centroid_other_cell - centroid_cell;
89 PointType cell_connection_normalized = cell_connection / viennagrid::norm(cell_connection);
90 PointType facet_unit_normal = viennashe::util::outer_cell_normal_at_facet(*cit, *focit);
91 const double weighted_interface_area = viennagrid::volume(*focit) * viennagrid::inner_prod(facet_unit_normal, cell_connection_normalized);
92
93 if ( &(*cit) == &(cells_on_facet[0]) )
94 current += current_accessor(*focit) * weighted_interface_area;
95 else //reference direction is opposite of what we need
96 current -= current_accessor(*focit) * weighted_interface_area;
97
98 //log::info() << *eovit << std::endl;
99 //log::info() << current_density_accessor( *eovit ) << " * " << effective_interface << " = " << current << std::endl;
100 }// for edges
101 }
102 } // for vertices
103
104 return current;
105 } // get_terminal_current
106
116 template<typename DeviceT, typename T1, typename T2, typename SegmentT>
117 double get_terminal_current(DeviceT const & device,
118 viennashe::config const & conf,
120 SegmentT const & semiconductor,
121 SegmentT const & terminal
122 )
123 {
124 typedef viennashe::she::unknown_she_quantity<T1, T2> SHEQuantityType;
125
127 return get_terminal_current(device, current_wrapper, semiconductor, terminal);
128 }
129
130
142 template < typename DeviceType,
143 typename PotentialAccessor,
144 typename AccessorTypeCarrier,
145 typename MobilityModel,
146 typename SegmentType >
147 double get_terminal_current(DeviceType const & device,
149 PotentialAccessor const & potential,
150 AccessorTypeCarrier const & carrier,
151 MobilityModel const & mobility_model,
152 SegmentType const & semi,
153 SegmentType const & conductor)
154 {
156 return viennashe::get_terminal_current(device, Jfield, semi, conductor);
157 }
158
159} // viennashe
160
161
162#endif
163
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
An accessor to the current density on vertices and edges (drift diffusion only!)
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
Accessor class providing the carrier velocity inside the device.
General representation of any solver quantity defined on two different element types (e....
The SHE configuration class is defined here.
Defines several filter functors for the device. A filter functor returns true if the supplied argumen...
viennagrid::result_of::point< viennagrid::element< CellTagT, WrappedConfigT > >::type outer_cell_normal_at_facet(viennagrid::element< CellTagT, WrappedConfigT > const &cell, viennagrid::element< FacetTagT, WrappedConfigT > const &facet)
Returns the unit outer normal of a facet with respect to the provided cell.
CellT const * get_other_cell_of_facet(MeshT const &mesh, FacetT const &facet, CellT const &cell)
Helper function returning a const-pointer to the 'second cell' of a facet, or NULL if there is no sec...
Definition: misc.hpp:196
The main ViennaSHE namespace. All functionality resides inside this namespace.
Definition: accessors.hpp:40
double get_terminal_current(DeviceT const &device, CurrentAccessorT const &current_accessor, SegmentT const &semiconductor, SegmentT const &terminal)
Returns the terminal current for a number of given vertices. Considers carrier flux and displacement ...
carrier_type_id
Enumeration type for selecting the carrier type.
Definition: forwards.h:185
Computes the current density (both Jn and Jp) after using a drift diffusion solution.
Provides an accessor for the current density.
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.