PLaSK library

Loading...
Searching...
No Matches
ddm2d_python.cpp
Go to the documentation of this file.
1/*
2 * This file is part of PLaSK (https://plask.app) by Photonics Group at TUL
3 * Copyright (c) 2022 Lodz University of Technology
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, version 3.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 */
14#include <cmath>
15#include <plask/python.hpp>
16#include <plask/common/fem/python.hpp>
17 using namespace plask;
18 using namespace plask::python;
19
20#include "../ddm2d.hpp"
21 using namespace plask::electrical::drift_diffusion;
22
23 template <typename GeometryT>
24 inline static void register_drift_diffusion_solver(const char* name, const char* geoname)
25{
26 typedef DriftDiffusionModel2DSolver<GeometryT> __Class__;
27 ExportSolver<DriftDiffusionModel2DSolver<GeometryT>> solver(name, format(
28
29 u8"{0}(name=\"\")\n\n"
30
31 u8"Finite element drift-diffusion electrical solver for 2D {1} geometry."
32
33 , name, geoname).c_str(), py::init<std::string>(py::arg("name")=""));
34 METHOD(compute, compute, u8"Run drift-diffusion calculations", py::arg("loops")=0);
35 METHOD(get_total_current, getTotalCurrent, u8"Get total current flowing through active region (mA)", py::arg("nact")=0);
36 METHOD(find_energy_levels, findEnergyLevels, u8"Run energy levels calculations - TEST");
37 //METHOD(integrate_current, integrateCurrent, u8"Integrate vertical total current at certain level (mA)", py::arg("vindex"), py::arg("onlyactive")=false);
38 /*RO_PROPERTY(err, getErr, u8"Maximum estimated error");*/
39 RECEIVER(inTemperature, u8"");
40 PROVIDER(outPotential, u8"");
41 PROVIDER(outFermiLevels, u8"");
42 PROVIDER(outBandEdges, u8"");
43 PROVIDER(outCurrentDensityForElectrons, u8"");
44 PROVIDER(outCurrentDensityForHoles, u8"");
45 PROVIDER(outCarriersConcentration, u8"");
46 PROVIDER(outHeat, u8"");
47 /*PROVIDER(outConductivity, u8"");*/
48 BOUNDARY_CONDITIONS(voltage_boundary, u8"Boundary conditions of the first kind (constant potential)");
49 solver.def_readwrite("maxerrVi", &__Class__::maxerrPsiI, u8"Limit for the initial potential estimate updates");
50 solver.def_readwrite("maxerrV0", &__Class__::maxerrPsi0, u8"Limit for the built-in potential updates");
51 solver.def_readwrite("maxerrV", &__Class__::maxerrPsi, u8"Limit for the potential updates");
52 solver.def_readwrite("maxerrFn", &__Class__::maxerrFn, u8"Limit for the electrons quasi-Fermi level updates");
53 solver.def_readwrite("maxerrFp", &__Class__::maxerrFp, u8"Limit for the holes quasi-Fermi level updates");
54 solver.def_readwrite("loopsVi", &__Class__::loopsPsiI, u8"Loops limit for the initial potential estimate");
55 solver.def_readwrite("loopsV0", &__Class__::loopsPsi0, u8"Loops limit for the built-in potential");
56 solver.def_readwrite("loopsV", &__Class__::loopsPsi, u8"Loops limit for the potential");
57 solver.def_readwrite("loopsFn", &__Class__::loopsFn, u8"Loops limit for the electrons quasi-Fermi level");
58 solver.def_readwrite("loopsFp", &__Class__::loopsFp, u8"Loops limit for the holes quasi-Fermi level");
59 solver.def_readwrite("Rsrh", &__Class__::mRsrh, u8"True if SRH recombination is taken into account");
60 solver.def_readwrite("Rrad", &__Class__::mRrad, u8"True if radiative recombination is taken into account");
61 solver.def_readwrite("Raug", &__Class__::mRaug, u8"True if Auger recombination is taken into account");
62 solver.def_readwrite("Pol", &__Class__::mPol, u8"True if polarization effects are taken into account");
63 solver.def_readwrite("FullIon", &__Class__::mFullIon, u8"True if dopants are completely ionized");
64 solver.def_readwrite("SchottkyP", &__Class__::mSchottkyP, u8"Schottky barrier for p-type contact");
65 solver.def_readwrite("SchottkyN", &__Class__::mSchottkyN, u8"Schottky barrier for n-type contact");
66 /*METHOD(get_electrostatic_energy, getTotalEnergy,
67 u8"Get the energy stored in the electrostatic field in the analyzed structure.\n\n"
68 u8"Return:\n"
69 u8" Total electrostatic energy [J].\n"
70 );
71 METHOD(get_capacitance, getCapacitance,
72 u8"Get the structure capacitance.\n\n"
73 u8"Return:\n"
74 u8" Total capacitance [pF].\n\n"
75 u8"Note:\n"
76 u8" This method can only be used it there are exactly two boundary conditions\n"
77 u8" specifying the voltage. Otherwise use :meth:`get_electrostatic_energy` to\n"
78 u8" obtain the stored energy $W$ and compute the capacitance as:\n"
79 u8" $C = 2, W / U^2$, where $U$ is the applied voltage.\n"
80 );
81 METHOD(get_total_heat, getTotalHeat,
82 u8"Get the total heat produced by the current flowing in the structure.\n\n"
83 u8"Return:\n"
84 u8" Total produced heat (mW).\n"
85 );*/
86 registerFemSolver(solver);
87}
88
95 BOOST_PYTHON_MODULE(ddm2d)
96{
97 py_enum<Stat>()
98 .value("MAXWELL_BOLTZMANN", STAT_MB)
99 .value("FERMI_DIRAC", STAT_FD)
100 ;
101
102 py_enum<ContType>()
103 .value("OHMIC", OHMIC)
104 .value("SCHOTTKY", SCHOTTKY)
105 ;
106
107 register_drift_diffusion_solver<Geometry2DCartesian>("DriftDiffusion2D", "Cartesian");
108
109 register_drift_diffusion_solver<Geometry2DCylindrical>("DriftDiffusionCyl", "cylindrical");
110}