1 /**********
2 Copyright 1991 Regents of the University of California.  All rights reserved.
3 Author:	1990 David A. Gates, U. C. Berkeley CAD Group
4 **********/
5 
6 #include "ngspice/ngspice.h"
7 #include "ngspice/numglobs.h"
8 #include "ngspice/twomesh.h"
9 #include "twoddefs.h"
10 #include "twodext.h"
11 
12 /*
13  * Compute the 2-D field-dependent mobility at the center of an element.
14  * It is known a priori that the element belongs to a semiconductor domain.
15  */
16 
17 void
TWO_mobility(TWOelem * pElem,double eSurf)18 TWO_mobility(TWOelem *pElem, double eSurf)
19 {
20 
21     TWOedge *pTEdge, *pBEdge, *pLEdge, *pREdge;
22     double dx, dy, rDx, rDy;
23     double enx, eny, wnx, wny, concav;
24     double epx, epy, wpx, wpy;
25 
26     /* Initialize various quantities */
27     dx = pElem->dx;
28     dy = pElem->dy;
29     rDx = 0.5 / dx;		/* Includes averaging factor of 0.5 */
30     rDy = 0.5 / dy;		/* Includes averaging factor of 0.5 */
31 
32     /* Get pointers to element's edges */
33     pTEdge = pElem->pTopEdge;
34     pBEdge = pElem->pBotEdge;
35     pLEdge = pElem->pLeftEdge;
36     pREdge = pElem->pRightEdge;
37 
38     /* Calculate electric field at element center */
39     enx = -rDx *(pTEdge->dPsi + pTEdge->dCBand + pBEdge->dPsi + pBEdge->dCBand);
40     epx = -rDx *(pTEdge->dPsi - pTEdge->dVBand + pBEdge->dPsi - pBEdge->dVBand);
41     eny = -rDy *(pLEdge->dPsi + pLEdge->dCBand + pREdge->dPsi + pREdge->dCBand);
42     epy = -rDy *(pLEdge->dPsi - pLEdge->dVBand + pREdge->dPsi - pREdge->dVBand);
43 
44     /* Calculate weighted carrier driving force at element center */
45     wnx = rDx * (pTEdge->wdfn + pBEdge->wdfn);
46     wpx = rDx * (pTEdge->wdfp + pBEdge->wdfp);
47     wny = rDy * (pLEdge->wdfn + pREdge->wdfn);
48     wpy = rDy * (pLEdge->wdfp + pREdge->wdfp);
49 
50     /* compute the mobility for the element */
51     /* Average concentrations at the four corners */
52     concav = 0.25 * ( pElem->pTLNode->totalConc + pElem->pTRNode->totalConc +
53         pElem->pBLNode->totalConc + pElem->pBRNode->totalConc );
54     MOBsurfElec(pElem->matlInfo, pElem, enx, eny, eSurf, wnx, wny, concav);
55     MOBsurfHole(pElem->matlInfo, pElem, epx, epy, eSurf, wpx, wpy, concav);
56     return;
57 }
58 
59 void
TWONmobility(TWOelem * pElem,double eSurf)60 TWONmobility(TWOelem *pElem, double eSurf)
61 {
62 
63     TWOedge *pTEdge, *pBEdge, *pLEdge, *pREdge;
64     double dx, dy, rDx, rDy;
65     double enx, eny, wnx, wny, concav;
66 
67     /* Initialize various quantities */
68     dx = pElem->dx;
69     dy = pElem->dy;
70     rDx = 0.5 / dx;		/* Includes averaging factor of 0.5 */
71     rDy = 0.5 / dy;		/* Includes averaging factor of 0.5 */
72 
73     /* Get pointers to element's edges */
74     pTEdge = pElem->pTopEdge;
75     pBEdge = pElem->pBotEdge;
76     pLEdge = pElem->pLeftEdge;
77     pREdge = pElem->pRightEdge;
78 
79     /* Calculate electric field at element center */
80     enx = -rDx *(pTEdge->dPsi + pTEdge->dCBand + pBEdge->dPsi + pBEdge->dCBand);
81     eny = -rDy *(pLEdge->dPsi + pLEdge->dCBand + pREdge->dPsi + pREdge->dCBand);
82 
83     /* Calculate weighted carrier driving force at element center */
84     wnx = rDx * (pTEdge->wdfn + pBEdge->wdfn);
85     wny = rDy * (pLEdge->wdfn + pREdge->wdfn);
86 
87     /* compute the mobility for the element */
88     /* Average concentrations at the four corners */
89     concav = 0.25 * ( pElem->pTLNode->totalConc + pElem->pTRNode->totalConc +
90         pElem->pBLNode->totalConc + pElem->pBRNode->totalConc );
91     MOBsurfElec(pElem->matlInfo, pElem, enx, eny, eSurf, wnx, wny, concav);
92 
93     return;
94 }
95 
96 void
TWOPmobility(TWOelem * pElem,double eSurf)97 TWOPmobility(TWOelem *pElem, double eSurf)
98 {
99 
100     TWOedge *pTEdge, *pBEdge, *pLEdge, *pREdge;
101     double dx, dy, rDx, rDy;
102     double epx, epy, wpx, wpy, concav;
103 
104     /* Initialize various quantities */
105     dx = pElem->dx;
106     dy = pElem->dy;
107     rDx = 0.5 / dx;		/* Includes averaging factor of 0.5 */
108     rDy = 0.5 / dy;		/* Includes averaging factor of 0.5 */
109 
110     /* Get pointers to element's edges */
111     pTEdge = pElem->pTopEdge;
112     pBEdge = pElem->pBotEdge;
113     pLEdge = pElem->pLeftEdge;
114     pREdge = pElem->pRightEdge;
115 
116     /* Calculate electric field at element center */
117     epx = -rDx *(pTEdge->dPsi - pTEdge->dVBand + pBEdge->dPsi - pBEdge->dVBand);
118     epy = -rDy *(pLEdge->dPsi - pLEdge->dVBand + pREdge->dPsi - pREdge->dVBand);
119 
120     /* Calculate weighted carrier driving force at element center */
121     wpx = rDx * (pTEdge->wdfp + pBEdge->wdfp);
122     wpy = rDy * (pLEdge->wdfp + pREdge->wdfp);
123 
124     /* compute the mobility for the element */
125     /* Average concentrations at the four corners */
126     concav = 0.25 * ( pElem->pTLNode->totalConc + pElem->pTRNode->totalConc +
127         pElem->pBLNode->totalConc + pElem->pBRNode->totalConc );
128     MOBsurfHole(pElem->matlInfo, pElem, epx, epy, eSurf, wpx, wpy, concav);
129 
130     return;
131 }
132