1#ifndef VIENNASHE_UTIL_TERMINAL_CURRENT_HPP
2#define VIENNASHE_UTIL_TERMINAL_CURRENT_HPP
18#include "viennagrid/mesh/mesh.hpp"
19#include "viennagrid/algorithm/boundary.hpp"
20#include "viennagrid/algorithm/interface.hpp"
22#include "viennagrid/algorithm/volume.hpp"
47 template<
typename DeviceT,
typename CurrentAccessorT,
typename SegmentT>
49 CurrentAccessorT
const & current_accessor,
50 SegmentT
const & semiconductor,
51 SegmentT
const & terminal)
53 typedef typename DeviceT::mesh_type MeshType;
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;
59 typedef typename viennagrid::result_of::const_cell_range<SegmentT>::type CellContainer;
60 typedef typename viennagrid::result_of::iterator<CellContainer>::type CellIterator;
62 typedef typename viennagrid::result_of::const_facet_range<CellType>::type FacetOnCellContainer;
63 typedef typename viennagrid::result_of::iterator<FacetOnCellContainer>::type FacetOnCellIterator;
65 typedef typename viennagrid::result_of::const_coboundary_range<SegmentT, FacetType, CellType>::type CellOnFacetContainer;
69 CellContainer cells(terminal);
70 for (CellIterator cit = cells.begin(); cit != cells.end(); ++cit)
72 PointType centroid_cell = viennagrid::centroid(*cit);
74 FacetOnCellContainer facets_on_cell(*cit);
75 for (FacetOnCellIterator focit = facets_on_cell.begin();
76 focit != facets_on_cell.end();
79 if ( viennagrid::is_interface(terminal, semiconductor, *focit) )
81 CellOnFacetContainer cells_on_facet(
device.
mesh(), focit.handle());
85 if (!other_cell_ptr)
continue;
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);
91 const double weighted_interface_area = viennagrid::volume(*focit) * viennagrid::inner_prod(facet_unit_normal, cell_connection_normalized);
93 if ( &(*cit) == &(cells_on_facet[0]) )
94 current += current_accessor(*focit) * weighted_interface_area;
96 current -= current_accessor(*focit) * weighted_interface_area;
116 template<
typename DeviceT,
typename T1,
typename T2,
typename SegmentT>
120 SegmentT
const & semiconductor,
121 SegmentT
const & terminal
142 template <
typename DeviceType,
143 typename PotentialAccessor,
144 typename AccessorTypeCarrier,
145 typename MobilityModel,
146 typename SegmentType >
150 AccessorTypeCarrier
const & carrier,
151 MobilityModel
const & mobility_model,
152 SegmentType
const & semi,
153 SegmentType
const & conductor)
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.
An accessor to the current density on vertices and edges (drift diffusion only!)
MeshT const & mesh() const
Returns the underlying mesh.
Defines the physical properties of a device, e.g. doping. This is the implementation for 2d and highe...
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...
The main ViennaSHE namespace. All functionality resides inside this namespace.
double get_terminal_current(DeviceT const &device, CurrentAccessorT const ¤t_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.
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.