17 #pragma warning(disable:4503)
28#include "viennagrid/config/default_configs.hpp"
42template <
typename DeviceType>
45 typedef typename DeviceType::segment_type SegmentType;
47 SegmentType
const & contact_left = device.segment(1);
48 SegmentType
const & oxide = device.segment(2);
49 SegmentType
const & contact_right = device.segment(3);
50 SegmentType
const & body = device.segment(4);
59 device.set_doping_n(1e24, body);
60 device.set_doping_p(1e8, body);
64 device.set_contact_potential(0.0, contact_left);
65 device.set_contact_potential(0.5, contact_right);
71 typedef viennagrid::triangular_2d_mesh MeshType;
73 typedef DeviceType::segment_type SegmentType;
77 std::cout <<
"* main(): Creating device..." << std::endl;
79 device.load_mesh(
"../../tests/data/ushape2d/ushape125.mesh");
81 std::cout <<
"Vertices: " << viennagrid::vertices(device.mesh()).size() << std::endl;
82 std::cout <<
"Edges: " << viennagrid::edges(device.mesh()).size() << std::endl;
92 std::cout <<
"* main(): Creating DD simulator..." << std::endl;
100 std::cout <<
"* main(): Launching DD simulator..." << std::endl;
109 std::cout <<
"#" << std::endl;
110 std::cout <<
"# Checking electron current: " << std::endl;
111 std::cout <<
"#" << std::endl;
114 dd_simulator.potential(),
115 dd_simulator.electron_density(),
118 std::cout <<
"#" << std::endl;
119 std::cout <<
"# Checking hole current: " << std::endl;
120 std::cout <<
"#" << std::endl;
123 dd_simulator.potential(),
124 dd_simulator.hole_density(),
132 std::cout <<
"* main(): Setting up SHE..." << std::endl;
153 std::cout <<
"* main(): Computing SHE..." << std::endl;
163 std::cout <<
"* main(): Writing SHE result..." << std::endl;
167 she_simulator.config(),
168 she_simulator.quantities().electron_distribution_function(),
174 SegmentType
const & contact_left = device.segment(1);
175 SegmentType
const & contact_right = device.segment(3);
176 SegmentType
const & semiconductor = device.segment(4);
179 she_simulator.config(),
180 she_simulator.quantities().electron_distribution_function(),
184 she_simulator.config(),
185 she_simulator.quantities().electron_distribution_function(),
189 std::cout <<
"Current left: " << current_left << std::endl;
190 std::cout <<
"Current right: " << current_right << std::endl;
193 she_simulator.config(),
194 she_simulator.quantities().electron_distribution_function());
196 if ( std::fabs(current_left + current_right) / std::max(std::fabs(current_left), std::fabs(current_right)) > 1e-5)
198 std::cerr <<
"CURRENT MISMATCH DETECTED" << std::endl;
199 std::cerr <<
"Norm of error: " << std::fabs(current_left - current_right) / std::max(std::fabs(current_left), std::fabs(current_right)) << std::endl;
203 std::cout <<
"SUCCESS: CURRENT MATCHES!" << std::endl;
205 std::cout <<
"* main(): Results can now be viewed with your favorite VTK viewer (e.g. ParaView)." << std::endl;
206 std::cout <<
"* main(): Don't forget to scale the z-axis by about a factor of 1e11 when examining the distribution function." << std::endl;
207 std::cout << std::endl;
208 std::cout <<
"****************************************************" << std::endl;
209 std::cout <<
"* Test finished successfully *" << std::endl;
210 std::cout <<
"****************************************************" << std::endl;
The main SHE configuration class. To be adjusted by the user for his/her needs.
long max_expansion_order() const
Returns the current maximum expansion order.
bool with_holes() const
Returns true if holes are considered in the simulation.
nonlinear_solver_config_type & nonlinear_solver()
Returns the configuration object for the nonlinear solver.
void set_electron_equation(equation_id equ_id)
linear_solver_config_type & linear_solver()
Returns the configuration object for the linear solver.
double energy_spacing() const
Returns the uniform energy spacing of discrete energies.
void set_hole_equation(equation_id equ_id)
bool with_electrons() const
Returns true if electrons are considered in the simulation.
Defines the physical properties of a device, e.g. doping. This is the implementation for 2d and highe...
Class for self-consistent SHE simulations.
void set(long solver_id)
Sets a new linear solver. Provide IDs defined in.
std::size_t max_iters() const
Returns the maximum number of nonlinear solver iterations.
double damping() const
Returns the damping for the nonlinear solver.
Convenience header, which includes all core functionality available in ViennaSHE.
void init_device(DeviceType &device, double Vg_init, double Nd, double Na)
Initalizes the MOS 1D device for testing.
void write_quantities_to_VTK_file(viennashe::simulator< DeviceType > const &simulator_obj, std::string filename, bool include_debug_information=false)
Generic interface function for writing simulated quantities to a VTK file.
viennashe::models::dd::mobility< DeviceType > create_constant_mobility_model(DeviceType const &device, double mu)
Returns a mobility model, which always yields the same mobility.
std::string hole_density()
std::string electron_density()
void check_current_conservation(DeviceT const &device, viennashe::config const &conf, SHEQuantity const &quan)
Checks current conservation for SHE. Writes information using log::info().
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 ...
void check_current_conservation(DeviceT const &device, CurrentDensityT const ¤t_on_facet)
Checks current conservation for SHE. Writes information using log::info().
std::string preamble()
Prints the ViennaSHE preamble (header). Used in all the examples as well as the standalone-applicatio...
A class referring to hafnium dioxide.
A class referring to silicon and providing certain material parameters Note that this is the default ...
static const double q
Elementary charge.
@ serial_linear_solver
Gauss solver (use for systems up to ~1000-by-1000 only)