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 virtual LazyData<Tensor2<double>> getDifferentialConductivityImpl(shared_ptr<const MeshD<GeometryT::DIM>> dest_mesh,
49 InterpolationMethod method);
50
52 InterpolationMethod method) {
53 return getDifferentialConductivityImpl(dest_mesh, method);
54 }
55
56 public:
58
60 double getBeta(size_t n) const {
61 if (beta.size() <= n) throw Exception("{0}: no beta given for junction {1}", this->getId(), n);
62 return beta[n];
63 }
65 void setBeta(size_t n, double beta) {
66 if (this->beta.size() <= n) {
67 this->beta.reserve(n + 1);
68 for (size_t s = this->beta.size(); s <= n; ++s) this->beta.push_back(NAN);
69 }
70 this->beta[n] = beta;
71 this->invalidate();
72 }
73
75 double getJs(size_t n) const {
76 if (js.size() <= n) throw Exception("{0}: no js given for junction {1}", this->getId(), n);
77 return js[n];
78 }
80 void setJs(size_t n, double js) {
81 if (this->js.size() <= n) {
82 this->js.reserve(n + 1);
83 for (size_t s = this->js.size(); s <= n; ++s) this->js.push_back(1.);
84 }
85 this->js[n] = js;
86 this->invalidate();
87 }
88
89 void loadConfiguration(XMLReader& source, Manager& manager) override;
90
91 BetaSolver(const std::string& name = "");
92
93 std::string getClassName() const override;
94
96};
97
98}}} // namespace plask::electrical::shockley
99
100#endif