5 #ifndef _TRAPBANDTUNNELINGDISCRETIZATION_H_
6 #define _TRAPBANDTUNNELINGDISCRETIZATION_H_
20 template <
class X,
class Diag,
class OffDiag>
34 const Field& varField,
35 const Field& electricField,
36 const Field& conductionbandField,
65 XArray& rCell =
dynamic_cast<XArray&
>(rField[cVarIndex]);
76 TArray& transmission = *ts;
80 const int normal =
_constants[
"normal_direction"];
87 T_Scalar transmissionHigh(0), transmissionLow(0);
89 int idHigh, idLow, high, low, me, count;
91 bool foundHigh, foundLow, flag;
95 foundHigh = foundLow =
false;
97 for(
int c=0; c<cells.
getCount(); c++){
98 transmission[c] = 0.0;
101 for(
int c=0; c<nCells; c++){
103 for(
int i=0; i<nTrap; i++){
105 T_Scalar en = conduction_band[c] - electron_trapdepth[i];
107 transmission[c] = 1.0;
117 while(flag ==
false && count < nMax ){
119 const int nbc = cellCells.
getCount(me);
125 for(
int nc = 0; nc < nbc; nc++){
127 const int neighbor = cellCells(me, nc);
128 const T_Scalar dr = cellCentroid[me][normal] - cellCentroid[neighbor][normal];
131 neighborUp = neighbor;
134 if (neighborUp < nCells) {
141 T_Scalar dX = cellCentroid[me][normal] - cellCentroid[low][normal];
145 T_Scalar avg = (valueMe + valueLow) / 2.0;
148 transmission[me] = transmission[low] * exp(exponent);
150 if (en - conduction_band[me] >0 ){
154 transmissionHigh = transmission[me];
171 while(flag ==
false && count < nMax){
173 const int nbc = cellCells.
getCount(me);
179 for(
int nc = 0; nc < nbc; nc++){
180 const int neighbor = cellCells(me, nc);
181 const T_Scalar dr = cellCentroid[me][normal] - cellCentroid[neighbor][normal];
184 neighborUp = neighbor;
188 if (neighborUp < nCells) {
195 T_Scalar dX = cellCentroid[me][normal] - cellCentroid[low][normal];
199 T_Scalar avg = (valueMe + valueLow) / 2.0;
202 transmission[me] = transmission[low] * exp(exponent);
204 if (en - conduction_band[me] >0 ){
208 transmissionLow = transmission[me];
221 const T_Scalar alpha = cellVolume[c] *
QE * ef * ef * electron_capture_cross /
222 (16 *
PI*
PI *
HBAR_SI * electron_effmass * electron_trapdepth[i]);
224 if (foundLow ==
true){
225 rCell[c][i] -= alpha * transmissionLow * xCell[c][i];
226 diag[c](i,i) -= alpha * transmissionLow;
228 rCell[idLow][nTrap] += alpha * transmissionLow * xCell[c][i];
231 if (foundHigh ==
true){
232 rCell[c][i] -= alpha * transmissionHigh * xCell[c][i];
233 diag[c](i,i) -= alpha * transmissionHigh;
235 rCell[idHigh][nTrap] += alpha * transmissionHigh * xCell[c][i];
int getCount(const int i) const
Matrix & getMatrix(const Index &rowIndex, const Index &colIndex)
NumTypeTraits< X >::T_Scalar T_Scalar
CCMatrix::DiagArray DiagArray
CRMatrix< Diag, OffDiag, X > CCMatrix
T mag(const Vector< T, 3 > &a)
Array< Vector< T_Scalar, 3 > > VectorT3Array
Array< Diag > & getDiag()
Tangent sqrt(const Tangent &a)
const Field & _electricField
pair< const Field *, const StorageSite * > ArrayIndex
const CRConnectivity & getCellCells() const
const StorageSite & getCells() const
const GeomFields & _geomFields
const T PositiveValueOf(T input)
Tangent fabs(const Tangent &a)
TrapBandTunnelingDiscretization(const MeshList &meshes, const GeomFields &geomFields, const Field &varField, const Field &electricField, const Field &conductionbandField, const ElectricModelConstants< T_Scalar > &constants)
void discretize(const Mesh &mesh, MultiFieldMatrix &mfmatrix, MultiField &xField, MultiField &rField)
CCMatrix::OffDiagArray OffDiagArray
vector< T > electron_trapdepth
const Field & _conductionbandField
const ElectricModelConstants< T_Scalar > & _constants
vector< Mesh * > MeshList