ViennaSHE 1.3.0
Free open-source semiconductor device simulator using spherical harmonics expansions techniques.
hde_1d.cpp
Go to the documentation of this file.
1/* ============================================================================
2 Copyright (c) 2011-2022, Institute for Microelectronics,
3 Institute for Analysis and Scientific Computing,
4 TU Wien.
5
6 -----------------
7 ViennaSHE - The Vienna Spherical Harmonics Expansion Boltzmann Solver
8 -----------------
9
10 http://viennashe.sourceforge.net/
11
12 License: MIT (X11), see file LICENSE in the base directory
13=============================================================================== */
14
15#if defined(_MSC_VER)
16 // Disable name truncation warning obtained in Visual Studio
17 #pragma warning(disable:4503)
18#endif
19
20#include <iostream>
21#include <cstdlib>
22#include <cmath>
23#include <vector>
24
25#include "tests/src/common.hpp"
26#include "mos1d_dg.hpp"
27
28// ViennaSHE includes:
29#include "viennashe/core.hpp"
30
31// ViennaGrid default configurations:
32#include "viennagrid/config/default_configs.hpp"
33
34
43struct hde_test_mesh_generator
44{
45
46 hde_test_mesh_generator(double len_gate, double cs_gate, double len_oxide, double cs_ox, double len_bulk, double cs_bulk)
47 : len_gate_(len_gate), cs_gate_(cs_gate), len_oxide_(len_oxide), cs_ox_(cs_ox), len_bulk_(len_bulk), cs_bulk_(cs_bulk)
48 { }
49
50 template < typename MeshT, typename SegmentationT >
51 void operator()(MeshT & mesh, SegmentationT & seg) const
52 {
54
55 gconf.add_segment(0, len_gate_, static_cast<unsigned long>(std::ceil(len_gate_/cs_gate_)+1) );
56 gconf.add_segment(len_gate_, len_oxide_, static_cast<unsigned long>(std::ceil(len_oxide_/cs_ox_)) );
57 gconf.add_segment(len_gate_+len_oxide_, len_bulk_, static_cast<unsigned long>(std::ceil(len_bulk_/cs_bulk_)) );
58 gconf.add_segment(len_gate_+len_oxide_+len_bulk_, len_bulk_ + 2e-9, static_cast<unsigned long>(std::ceil(2e-9/cs_bulk_)+1) );
59
60 viennashe::util::generate_device(mesh, seg, gconf);
61 }
62
63private:
64 double len_gate_;
65 double cs_gate_;
66 double len_oxide_;
67 double cs_ox_;
68 double len_bulk_;
69 double cs_bulk_;
70
71};
72
80template <typename DeviceType>
81void init_device(DeviceType & device, double TL_left, double TL_right)
82{
83 typedef typename DeviceType::mesh_type MeshType;
84 typedef typename DeviceType::segment_type SegmentType;
85
86 SegmentType const & gate = device.segment(0);
87 SegmentType const & oxide = device.segment(1);
88 SegmentType const & silicon = device.segment(2);
89 SegmentType const & bulk = device.segment(3);
90
91 std::cout << "* init_device(): Setting material ..." << std::endl;
92
93 device.set_material(viennashe::materials::metal(), gate);
94 device.set_material(viennashe::materials::metal(), bulk);
95 device.set_material(viennashe::materials::sio2(), oxide);
96 device.set_material(viennashe::materials::si(), silicon);
97
98 std::cout << "* init_device(): Setting doping (per cell) ..." << std::endl;
99
100 device.set_doping_n(1e8, silicon);
101 device.set_doping_p(1e23, silicon);
102
103 std::cout << "* init_device(): Setting contact potentials (per cell) ..." << std::endl;
104
105 device.set_contact_potential(0.0, bulk);
106 device.set_contact_potential(0.0, gate);
107
108 std::cout << "* init_device(): Setting temperature boundary conditions (per cell) ..." << std::endl;
109
110 typedef typename viennagrid::result_of::const_cell_range<MeshType>::type CellContainer;
111 typedef typename viennagrid::result_of::iterator<CellContainer>::type CellIterator;
112
113 CellContainer cells(device.mesh());
114 for (CellIterator cit = cells.begin();
115 cit != cells.end();
116 ++cit)
117 {
118 device.set_lattice_temperature(300.0, *cit);
119 }
120
121 device.set_lattice_temperature(TL_left, gate);
122 device.set_lattice_temperature(TL_right, bulk);
123
124 std::cout << "* init_device(): DONE!" << std::endl;
125
126} // init_device()
127
128int main()
129{
130 typedef viennagrid::line_1d_mesh MeshType;
131 typedef viennashe::device<MeshType> DeviceType;
132
133 std::cout << viennashe::preamble() << std::endl;
134
135 std::cout << "* main(): Creating mesh ..." << std::endl;
136
137 DeviceType device;
138
139 const double len_gate = 1e-9;
140 const double cs_gate = 0.01e-9;
141 const double len_oxide = 1e-9;
142 const double cs_ox = 0.01e-9;
143 const double len_bulk = 100e-9;
144 const double cs_bulk = 2e-9;
145
146 hde_test_mesh_generator mosgen(len_gate, cs_gate, len_oxide, cs_ox, len_bulk, cs_bulk);
147 device.generate_mesh(mosgen);
148
149 std::cout << "* main(): Initializing device ..." << std::endl;
150
151 init_device(device, 350.0, 300.0);
152
153 std::cout << "* main(): Simulation setup ..." << std::endl;
154
155 viennashe::config dd_cfg;
156 dd_cfg.with_holes(true);
157 dd_cfg.with_electrons(true);
160
161 dd_cfg.with_hde(true); // USE THE HDE !
162
163 // We need the dense solver here ...
165 dd_cfg.nonlinear_solver().max_iters(30);
166 dd_cfg.nonlinear_solver().damping(0.8);
167
168 viennashe::simulator<DeviceType> simulator(device, dd_cfg);
169
170 std::cout << "* main(): Running simulation ..." << std::endl;
171
172 simulator.run();
173
174 viennashe::io::write_quantities_to_VTK_file(simulator, "hde_1d_test_quan");
175 viennashe::io::write_cell_quantity_for_gnuplot(simulator.quantities().lattice_temperature(), device, "hde_1d_temperature.dat" );
176
177 std::cout << "* main(): Testing ..." << std::endl;
178
179 bool ok = test_result(simulator.quantities().lattice_temperature(), device, "../../tests/data/hde/simple_mos.dat" );
180 if(!ok) return EXIT_FAILURE;
181
182 std::cout << "* main(): Tests OK!" << std::endl;
183
184
185 std::cout << std::endl;
186 std::cout << "*********************************************************" << std::endl;
187 std::cout << "* ViennaSHE finished successfully *" << std::endl;
188 std::cout << "*********************************************************" << std::endl;
189
190 return EXIT_SUCCESS;
191}
192
The main SHE configuration class. To be adjusted by the user for his/her needs.
Definition: config.hpp:124
bool with_holes() const
Returns true if holes are considered in the simulation.
Definition: config.hpp:234
bool with_hde() const
Definition: config.hpp:502
nonlinear_solver_config_type & nonlinear_solver()
Returns the configuration object for the nonlinear solver.
Definition: config.hpp:495
void set_electron_equation(equation_id equ_id)
Definition: config.hpp:231
linear_solver_config_type & linear_solver()
Returns the configuration object for the linear solver.
Definition: config.hpp:485
void set_hole_equation(equation_id equ_id)
Definition: config.hpp:239
bool with_electrons() const
Returns true if electrons are considered in the simulation.
Definition: config.hpp:226
Defines the physical properties of a device, e.g. doping. This is the implementation for 2d and highe...
Definition: device.hpp:818
Class for self-consistent SHE simulations.
Definition: simulator.hpp:675
void set(long solver_id)
Sets a new linear solver. Provide IDs defined in.
Definition: config.hpp:84
std::size_t max_iters() const
Returns the maximum number of nonlinear solver iterations.
Definition: config.hpp:317
double damping() const
Returns the damping for the nonlinear solver.
Definition: config.hpp:328
Configuration class for the simple mesh generator.
void add_segment(double start_x, double start_y, double len_x, double len_y, unsigned long points_x, unsigned long points_y)
Convenience header, which includes all core functionality available in ViennaSHE.
Contains common code for the 1D MOS DG tests.
bool test_result(AccessorType const &quan, DeviceType const &device, std::string filename)
Tests the given quantity against reference data in a file. Uses reference_values.
Definition: mos1d_dg.hpp:182
void init_device(DeviceType &device, double Vg_init, double Nd, double Na)
Initalizes the MOS 1D device for testing.
Definition: mos1d_dg.hpp:94
void write_cell_quantity_for_gnuplot(AccessorType const &quan, DeviceType const &device, std::string filename)
Writes a quantity (on vertices) per point to a text file suitable for gnuplot.
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.
void generate_device(MeshT &mesh, SegmentationT &seg, device_generation_config const &conf)
Public interface for mesh generation of simple one- or two-dimensional meshes. Device must be rectang...
@ EQUATION_CONTINUITY
Definition: forwards.h:117
std::string preamble()
Prints the ViennaSHE preamble (header). Used in all the examples as well as the standalone-applicatio...
Definition: version.hpp:63
int main()
Definition: resistor1d-c.c:108
A class referring to any metal contact.
Definition: all.hpp:44
A class referring to silicon and providing certain material parameters Note that this is the default ...
Definition: all.hpp:50
A class referring to silicon dioxide.
Definition: all.hpp:111
Contains common functions, functors and other classes often needed by the tests.