PLaSK library
Loading...
Searching...
No Matches
beta.hpp
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#ifndef PLASK__MODULE_ELECTRICAL_BETA2D_H
15#define PLASK__MODULE_ELECTRICAL_BETA2D_H
16
17#include "electr2d.hpp"
18#include "electr3d.hpp"
19
20namespace plask { namespace electrical { namespace shockley {
21
25template <typename GeometryT>
26struct PLASK_SOLVER_API BetaSolver : public std::conditional<std::is_same<GeometryT, Geometry3D>::value,
27 ElectricalFem3DSolver,
28 ElectricalFem2DSolver<GeometryT>>::type {
29 typedef typename std::conditional<std::is_same<GeometryT, Geometry3D>::value,
32
33 protected:
34 std::vector<double> js;
35 std::vector<double> beta;
36
43 Tensor2<double> activeCond(size_t n, double PLASK_UNUSED(U), double jy, double PLASK_UNUSED(T)) override {
44 jy = abs(jy);
45 return Tensor2<double>(0., 10. * jy * this->active[n].height * getBeta(n) / log(1e7 * jy / getJs(n) + 1.));
46 }
47
48 public:
50 double getBeta(size_t n) const {
51 if (beta.size() <= n) throw Exception("{0}: no beta given for junction {1}", this->getId(), n);
52 return beta[n];
53 }
55 void setBeta(size_t n, double beta) {
56 if (this->beta.size() <= n) {
57 this->beta.reserve(n + 1);
58 for (size_t s = this->beta.size(); s <= n; ++s) this->beta.push_back(NAN);
59 }
60 this->beta[n] = beta;
61 this->invalidate();
62 }
63
65 double getJs(size_t n) const {
66 if (js.size() <= n) throw Exception("{0}: no js given for junction {1}", this->getId(), n);
67 return js[n];
68 }
70 void setJs(size_t n, double js) {
71 if (this->js.size() <= n) {
72 this->js.reserve(n + 1);
73 for (size_t s = this->js.size(); s <= n; ++s) this->js.push_back(1.);
74 }
75 this->js[n] = js;
76 this->invalidate();
77 }
78
79 void loadConfiguration(XMLReader& source, Manager& manager) override;
80
81 BetaSolver(const std::string& name = "");
82
83 std::string getClassName() const override;
84
86};
87
88}}} // namespace plask::electrical::shockley
89
90#endif