17 #pragma warning(disable:4503)
31#include "viennagrid/config/default_configs.hpp"
45template <
typename DeviceType>
46void init_device(DeviceType & device,
double voltage)
48 typedef typename DeviceType::mesh_type MeshType;
51 std::cout <<
"* init_device(): Setting doping..." << std::endl;
53 device.set_doping_n(1e28);
54 device.set_doping_p(1e4);
57 typedef typename viennagrid::result_of::const_cell_range<MeshType>::type CellContainer;
63 CellContainer cells(device.mesh());
65 if (cells.size() < 3)
throw std::runtime_error(
"The Mesh is too small. It contains less than 3 cells!");
67 device.set_contact_potential(gnd, cells[0]);
69 device.set_contact_potential(vcc, cells[cells.size()-1]);
76 typedef viennagrid::line_1d_mesh MeshType;
78 typedef viennagrid::result_of::const_cell_range<MeshType>::type CellContainer;
82 std::cout <<
"* main(): Initializing device..." << std::endl;
91 device.generate_mesh(generator_params);
100 CellContainer cells(device.mesh());
105 std::cout <<
"* main(): Creating DD simulator..." << std::endl;
114 std::cout <<
"* main(): Launching simulator..." << std::endl;
120 std::cout <<
"* main(): Setting up SHE..." << std::endl;
146 std::cout <<
"* main(): Computing SHE (electrons only) without ionized impurity and Modena model ..." << std::endl;
155 std::cout <<
"* main(): Writing SHE result..." << std::endl;
158 double n_mid_without = 0;
159 double Jn_mid_without = 0;
163 she_simulator.config(),
164 she_simulator.quantities().electron_distribution_function(),
165 "simple_impurity_scattering_edf1");
171 she_simulator.config(),
172 she_simulator.quantities().electron_distribution_function());
175 she_simulator.config(),
176 she_simulator.quantities().electron_distribution_function());
180 n_mid_without = n(cells[25]);
181 Jn_mid_without = Jn(cells[25])[0];
187 std::cout <<
"* main(): Computing SHE (electrons only) WITH ionized impurity and Modena model ..." << std::endl;
194 she_simulator_with.run();
196 std::cout <<
"* main(): Writing SHE result..." << std::endl;
199 she_simulator_with.config(),
200 she_simulator_with.quantities().electron_distribution_function(),
201 "simple_impurity_scattering_edf2");
209 she_simulator_with.quantities().electron_distribution_function());
213 she_simulator_with.quantities().electron_distribution_function());
217 double n_mid_with = n(cells[25]);
218 double Jn_mid_with = Jn(cells[25])[0];
222 std::cerr <<
"ERROR: Ionized impurity scattering should NOT change the electron density in a resistor!" << std::endl;
223 std::cerr <<
" The densities are not equal." << std::endl;
224 std::cerr << n_mid_without <<
" != " << n_mid_with << std::endl;
230 std::cerr <<
"ERROR: Ionized impurity scattering should change the electron CURRENT density in a resistor!" << std::endl;
231 std::cerr <<
" It failed to do so." << std::endl;
232 std::cerr << Jn_mid_without <<
" == " << Jn_mid_with << std::endl;
237 std::cerr <<
"BUT: This is ok!" << std::endl;
240 if(Jn_mid_without < Jn_mid_with)
242 std::cerr <<
"ERROR: Ionized impurity scattering should DECREASE the electron CURRENT density in a resistor!" << std::endl;
243 std::cerr <<
" It failed to do so." << std::endl;
248 std::cout << std::endl;
249 std::cout <<
"*********************************************************" << std::endl;
250 std::cout <<
"* ViennaSHE finished successfully *" << std::endl;
251 std::cout <<
"*********************************************************" << std::endl;
The main SHE configuration class. To be adjusted by the user for his/her needs.
double min_kinetic_energy_range(viennashe::carrier_type_id ctype) const
Returns the minimum kinetic energy range for the selected carrier.
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.
viennashe::she::scatter_config & scattering()
Returns the configuration object for scattering.
Defines the physical properties of a device, e.g. doping. This is the implementation for 2d and highe...
An accessor for the carrier density in the device.
Accessor class providing the carrier velocity inside the device.
ionized_impurity_scattering_parameters const & ionized_impurity() const
Returns the parameters for ionized impurity scattering. Const-version.
impact_ionization_scattering_parameters const & impact_ionization() const
Returns the parameters for impact ionization scattering. Const-version.
acoustic_phonon_scattering_parameters const & acoustic_phonon() const
Returns the parameters for acoustic phonon scattering. Const-version.
optical_phonon_scattering_parameters const & optical_phonon() const
Returns the parameters for optical phonon scattering. Const-version.
bool electron_electron() const
Returns true if electron-electron scattering is activated.
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.
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.
void init_device(DeviceType &device, double Vg_init, double Nd, double Na)
Initalizes the MOS 1D device for testing.
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.
std::string hole_density()
std::string electron_density()
bool fuzzy_equal(double is, double should, double tol=1e-1)
Performs a fuzzy (up to a tolerance) equal. Returns true if is and should are equal within the tolera...
std::string preamble()
Prints the ViennaSHE preamble (header). Used in all the examples as well as the standalone-applicatio...
Writes the energy distribution function to a file which can be processed by Gnuplot....
A class referring to silicon and providing certain material parameters Note that this is the default ...
static const double q
Elementary charge.
A trivial filter, all objects are accepted.
Contains common functions, functors and other classes often needed by the tests.