ViennaSHE 1.3.0
Free open-source semiconductor device simulator using spherical harmonics expansions techniques.
displacement_current.hpp
Go to the documentation of this file.
1#ifndef VIENNASHE_UTIL_POSTPROC_DISPLACEMENT_CURRENT_HPP
2#define VIENNASHE_UTIL_POSTPROC_DISPLACEMENT_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
19// std
20#include <iostream>
21#include <fstream>
22#include <vector>
23
24// viennagrid
25#include "viennagrid/mesh/mesh.hpp"
26#include "viennagrid/algorithm/volume.hpp"
27#include "viennagrid/algorithm/inner_prod.hpp"
28
29// viennashe
35
36#include "viennashe/log/log.hpp"
37
42
44
49namespace viennashe
50{
51 namespace detail
52 {
53 // TODO: Revive
54
56 /*
57 template < typename DeviceType, typename PotentialAccessorType, typename OldPotentialAccessorType >
58 struct displacement_current_on_edge
59 {
60
61 private:
62 typedef typename DeviceType::mesh_type MeshType;
63
64 typedef typename viennagrid::result_of::point<MeshType>::type PointType;
65
66 public:
67 typedef typename viennagrid::result_of::vertex<MeshType>::type VertexType;
68 typedef typename viennagrid::result_of::edge<MeshType>::type EdgeType;
69
70 displacement_current_on_edge(DeviceType const & device,
71 PotentialAccessorType const & potential,
72 OldPotentialAccessorType const & old_potential,
73 double rtime
74 )
75 : device_(device), potential_(potential), old_potential_(old_potential), rtime_(rtime)
76 { }
77
78 double operator()(EdgeType const & edge) const
79 {
80 typedef viennashe::util::no_contact_filter<DeviceType> PotentialFilterType;
81
82 if(rtime_ <= 0)
83 return 0;
84
85 PotentialFilterType potential_filter(device_);
86 viennashe::permittivity_accessor<DeviceType> permittivity(device_);
87
88 viennashe::detail::electric_field_on_facet<DeviceType, PotentialAccessorType> efield_new(device_, potential_);
89 viennashe::detail::electric_field_on_facet<DeviceType, PotentialAccessorType> efield_old(device_, old_potential_);
90
91 const double A = util::effective_voronoi_interface(edge, potential_filter);
92
93 if (A == 0) return 0; // safety check
94
95 const double eps = util::effective_weighted_voronoi_interface(edge, potential_filter, permittivity) / A; // (sum_i A_i * eps_i) / (sum_i A_i) ... to get the average eps
96
97 const double Dmag_new = efield_new(edge) * eps;
98 const double Dmag_old = efield_old(edge) * eps;
99
100 const double current_density = rtime_ * ( Dmag_new - Dmag_old );
101
102 return current_density;
103 } // operator()
104
105 private:
106 DeviceType const & device_;
107 PotentialAccessorType const & potential_;
108 OldPotentialAccessorType const & old_potential_;
109 double rtime_;
110
111
112 }; // displacement_current_on_edge
113 */
114
115
116 } // namespace detail
117
119 /*
120 template < typename DeviceType, typename PotentialAccessorType, typename OldPotentialAccessorType >
121 struct displacement_current_wrapper
122 {
123 private:
124 typedef typename DeviceType::mesh_type MeshType;
125
126 typedef typename viennagrid::result_of::point<MeshType>::type PointType;
127
128 public:
129 typedef typename viennagrid::result_of::vertex<MeshType> ::type VertexType;
130 typedef typename viennagrid::result_of::edge<MeshType> ::type EdgeType;
131
132 typedef std::vector<double> value_type;
133
134 displacement_current_wrapper(DeviceType const & device,
135 PotentialAccessorType const & potential,
136 OldPotentialAccessorType const & old_potential,
137 double rtime
138 )
139 : _device(device), _potential(potential), _old_potential(old_potential), _rtime(rtime)
140 { }
141
142 double operator()(EdgeType const & edge) const
143 {
144 viennashe::detail::displacement_current_on_edge<DeviceType, PotentialAccessorType, OldPotentialAccessorType> eval(_device, _potential, _old_potential, _rtime);
145 return eval(edge);
146 }
147
148 value_type operator()(VertexType const & vertex) const
149 {
150 typedef typename viennagrid::result_of::const_edge_range<VertexType>::type EdgeOnVertexContainer;
151
152 typedef viennashe::util::no_contact_filter<DeviceType> PotentialFilterType;
153
154 PotentialFilterType poisson_filter(_device);
155
156 viennashe::detail::displacement_current_on_edge<DeviceType, PotentialAccessorType, OldPotentialAccessorType> edge_eval(_device, _potential, _old_potential, _rtime);
157
158 std::vector<double> Jd(3);
159 Jd[0] = 0; Jd[1] = 0; Jd[2] = 0;
160
161 viennashe::util::value_holder_functor<PointType> result;
162 EdgeOnVertexContainer edges_on_vertex(vertex, _device.mesh());
163 viennashe::util::dual_box_flux_to_vertex(vertex, edges_on_vertex,
164 result, edge_eval,
165 poisson_filter, poisson_filter);
166
167 for (std::size_t i=0; i < (PointType::dim) ; ++i) Jd[i] = result()[i];
168
169 return Jd;
170
171 } // operator()
172
173 private:
174 DeviceType const & _device;
175 PotentialAccessorType const & _potential;
176 OldPotentialAccessorType const & _old_potential;
177 double _rtime;
178
179
180 }; // displacement_current_wrapper
181 */
182
191 /*
192 template <typename DeviceType,
193 typename PotentialAccessor,
194 typename OldPotentialAccessorType,
195 typename ContainerType>
196 void write_displacement_current_to_container(DeviceType const & device,
197 PotentialAccessor const & potential,
198 PotentialAccessor const & old_potential,
199 double rtime,
200 ContainerType & container)
201 {
202 displacement_current_wrapper<DeviceType, PotentialAccessor, OldPotentialAccessorType> Jd(device, potential, old_potential, rtime);
203
204 viennashe::she::write_macroscopic_quantity_to_container(device, Jd, container);
205 }*/
206
207
208} // viennashe
209
210#endif
211
Contains the definition of per-device accessors (read-only!) for various quantities.
Defines a set of checker functors for micro-tests within ViennaSHE.
Helper routines for projecting normal components of a vector-valued quantity defined on edges to vert...
Computes the electric field from a potential.
A logging facility providing fine-grained control over logging in ViennaSHE.
Writer for arbitrary macroscopic quantities.
A very simple material database. Needs to be replaced by something more versatile soon.
Miscellaneous utilities.
The main ViennaSHE namespace. All functionality resides inside this namespace.
Definition: accessors.hpp:40
Provides a number of fundamental constants. All constants in SI units.
Returns a few helper routines for computing physical quantities. To be replaced in the future.