17 #pragma warning(disable:4503)
32#include "viennagrid/config/default_configs.hpp"
43struct hde_test_mesh_generator
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)
50 template <
typename MeshT,
typename SegmentationT >
51 void operator()(MeshT & mesh, SegmentationT & seg)
const
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) );
80template <
typename DeviceType>
81void init_device(DeviceType & device,
double TL_left,
double TL_right)
83 typedef typename DeviceType::mesh_type MeshType;
84 typedef typename DeviceType::segment_type SegmentType;
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);
91 std::cout <<
"* init_device(): Setting material ..." << std::endl;
98 std::cout <<
"* init_device(): Setting doping (per cell) ..." << std::endl;
100 device.set_doping_n(1e8, silicon);
101 device.set_doping_p(1e23, silicon);
103 std::cout <<
"* init_device(): Setting contact potentials (per cell) ..." << std::endl;
105 device.set_contact_potential(0.0, bulk);
106 device.set_contact_potential(0.0, gate);
108 std::cout <<
"* init_device(): Setting temperature boundary conditions (per cell) ..." << std::endl;
110 typedef typename viennagrid::result_of::const_cell_range<MeshType>::type CellContainer;
111 typedef typename viennagrid::result_of::iterator<CellContainer>::type CellIterator;
113 CellContainer cells(device.mesh());
114 for (CellIterator cit = cells.begin();
118 device.set_lattice_temperature(300.0, *cit);
121 device.set_lattice_temperature(TL_left, gate);
122 device.set_lattice_temperature(TL_right, bulk);
124 std::cout <<
"* init_device(): DONE!" << std::endl;
130 typedef viennagrid::line_1d_mesh MeshType;
135 std::cout <<
"* main(): Creating mesh ..." << std::endl;
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;
146 hde_test_mesh_generator mosgen(len_gate, cs_gate, len_oxide, cs_ox, len_bulk, cs_bulk);
147 device.generate_mesh(mosgen);
149 std::cout <<
"* main(): Initializing device ..." << std::endl;
153 std::cout <<
"* main(): Simulation setup ..." << std::endl;
170 std::cout <<
"* main(): Running simulation ..." << std::endl;
177 std::cout <<
"* main(): Testing ..." << std::endl;
179 bool ok =
test_result(simulator.quantities().lattice_temperature(), device,
"../../tests/data/hde/simple_mos.dat" );
180 if(!ok)
return EXIT_FAILURE;
182 std::cout <<
"* main(): Tests OK!" << std::endl;
185 std::cout << std::endl;
186 std::cout <<
"*********************************************************" << std::endl;
187 std::cout <<
"* ViennaSHE finished successfully *" << std::endl;
188 std::cout <<
"*********************************************************" << std::endl;
The main SHE configuration class. To be adjusted by the user for his/her needs.
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.
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.
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.
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.
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...
std::string preamble()
Prints the ViennaSHE preamble (header). Used in all the examples as well as the standalone-applicatio...
A class referring to silicon and providing certain material parameters Note that this is the default ...
A class referring to silicon dioxide.
Contains common functions, functors and other classes often needed by the tests.