📄 twoncont.c
字号:
pBEdge = pElem->pBotEdge; pLEdge = pElem->pLeftEdge; pREdge = pElem->pRightEdge; /* load for all i,j */ for ( index = 0; index <= 3; index++ ) { pNode = pElem->pNodes[ index ]; if ( pNode->nodeType ISNOT CONTACT ) { *(pNode->fPsiPsi) += dyOverDx + dxOverDy; if ( pElem->elemType IS SEMICON ) { if ( index <= 1 ) { pHEdge = pTEdge; } else { pHEdge = pBEdge; } if ( index IS 0 OR index IS 3 ) { pVEdge = pLEdge; } else { pVEdge = pREdge; } pConc = *(pDevice->devState0 + pNode->nodeP); *(pNode->fPsiN) += dxdy; *(pNode->fPsiPsi) += dxdy * pConc; *(pNode->fNPsi) -= dy * pHEdge->dJnDpsiP1 + dx * pVEdge->dJnDpsiP1; /* Handle generation terms */ *(pNode->fNN) -= dxdy * pNode->dUdN; *(pNode->fNPsi) += dxdy * pNode->dUdP * pConc; } } } /* Handle neighbor and edge dependent terms */ pNode = pElem->pTLNode; if ( pNode->nodeType ISNOT CONTACT ) { *(pNode->fPsiPsiiP1) -= dyOverDx; *(pNode->fPsiPsijP1) -= dxOverDy; if ( pElem->elemType IS SEMICON ) { *(pNode->fNN) += dy * pTEdge->dJnDn + dx * pLEdge->dJnDn; *(pNode->fNPsiiP1) += dy * pTEdge->dJnDpsiP1; *(pNode->fNNiP1) += dy * pTEdge->dJnDnP1; *(pNode->fNPsijP1) += dx * pLEdge->dJnDpsiP1; *(pNode->fNNjP1) += dx * pLEdge->dJnDnP1; } } pNode = pElem->pTRNode; if ( pNode->nodeType ISNOT CONTACT ) { *(pNode->fPsiPsiiM1) -= dyOverDx; *(pNode->fPsiPsijP1) -= dxOverDy; if ( pElem->elemType IS SEMICON ) { *(pNode->fNN) += -dy * pTEdge->dJnDnP1 + dx * pREdge->dJnDn; *(pNode->fNPsiiM1) += dy * pTEdge->dJnDpsiP1; *(pNode->fNNiM1) -= dy * pTEdge->dJnDn; *(pNode->fNPsijP1) += dx * pREdge->dJnDpsiP1; *(pNode->fNNjP1) += dx * pREdge->dJnDnP1; } } pNode = pElem->pBRNode; if ( pNode->nodeType ISNOT CONTACT ) { *(pNode->fPsiPsiiM1) -= dyOverDx; *(pNode->fPsiPsijM1) -= dxOverDy; if ( pElem->elemType IS SEMICON ) { *(pNode->fNN) += -dy * pBEdge->dJnDnP1 - dx * pREdge->dJnDnP1; *(pNode->fNPsiiM1) += dy * pBEdge->dJnDpsiP1; *(pNode->fNNiM1) -= dy * pBEdge->dJnDn; *(pNode->fNPsijM1) += dx * pREdge->dJnDpsiP1; *(pNode->fNNjM1) -= dx * pREdge->dJnDn; } } pNode = pElem->pBLNode; if ( pNode->nodeType ISNOT CONTACT ) { *(pNode->fPsiPsiiP1) -= dyOverDx; *(pNode->fPsiPsijM1) -= dxOverDy; if ( pElem->elemType IS SEMICON ) { *(pNode->fNN) += dy * pBEdge->dJnDn - dx * pLEdge->dJnDnP1; *(pNode->fNPsiiP1) += dy * pBEdge->dJnDpsiP1; *(pNode->fNNiP1) += dy * pBEdge->dJnDnP1; *(pNode->fNPsijM1) += dx * pLEdge->dJnDpsiP1; *(pNode->fNNjM1) -= dx * pLEdge->dJnDn; } } } /* Calculate the Inversion-Layer Mobility Dependent Terms in Jac. */ if ( MobDeriv AND SurfaceMobility ) { for ( pCh = pDevice->pChannel; pCh ISNOT NIL(TWOchannel); pCh = pCh->next ) { /* Find effective height of oxide element at interface. */ if ( pCh->type%2 == 0 ) { /* Vertical slice */ ds = pCh->pNElem->dy / pCh->pNElem->epsRel; } else { /* Horizontal slice */ ds = pCh->pNElem->dx / pCh->pNElem->epsRel; } pElem = pCh->pSeed; nextIndex = (pCh->type + 2)%4; while (pElem && pElem->channel == pCh->id) { TWONmobDeriv( pElem, pCh->type, ds ); pElem = pElem->pElems[ nextIndex ]; } } /* endfor pCh ISNOT NIL */ } /* endif MobDeriv and SurfaceMobility */}/* load only the Rhs vector */void TWONrhsLoad( pDevice, tranAnalysis, info ) TWOdevice *pDevice;BOOLEAN tranAnalysis;TWOtranInfo *info;{ TWOelem *pElem; TWOnode *pNode; TWOedge *pHEdge, *pVEdge; TWOedge *pTEdge, *pBEdge, *pLEdge, *pREdge; TWOchannel *pCh; int index, eIndex; double *pRhs = pDevice->rhs; double dx, dy, dxdy, dyOverDx, dxOverDy; double dPsiT, dPsiB, dPsiL, dPsiR; double rhsN; double nConc, pConc; double perTime; void TWONcommonTerms(); /* first compute the currents */ TWONcommonTerms( pDevice, TRUE, tranAnalysis, info ); /* find reciprocal timestep */ if ( tranAnalysis ) { perTime = info->intCoeff[0]; } /* zero the rhs vector */ for ( index = 1 ; index <= pDevice->numEqns ; index++ ) { pRhs[ index ] = 0.0; } for ( eIndex = 1; eIndex <= pDevice->numElems; eIndex++ ) { pElem = pDevice->elements[ eIndex ]; dx = 0.5 * pElem->dx; dy = 0.5 * pElem->dy; dxdy = dx * dy; dxOverDy = 0.5 * pElem->epsRel * pElem->dxOverDy; dyOverDx = 0.5 * pElem->epsRel * pElem->dyOverDx; pTEdge = pElem->pTopEdge; pBEdge = pElem->pBotEdge; pLEdge = pElem->pLeftEdge; pREdge = pElem->pRightEdge; dPsiT = pTEdge->dPsi; dPsiB = pBEdge->dPsi; dPsiL = pLEdge->dPsi; dPsiR = pREdge->dPsi; /* load for all i,j */ for ( index = 0; index <= 3; index++ ) { pNode = pElem->pNodes[ index ]; if ( pNode->nodeType ISNOT CONTACT ) { if ( index <= 1 ) { pHEdge = pTEdge; } else { pHEdge = pBEdge; } if ( index IS 0 OR index IS 3 ) { pVEdge = pLEdge; } else { pVEdge = pREdge; } /* Add surface state charges. */ pRhs[ pNode->psiEqn ] += dx * pHEdge->qf; pRhs[ pNode->psiEqn ] += dy * pVEdge->qf; if ( pElem->elemType IS SEMICON ) { nConc = *(pDevice->devState0 + pNode->nodeN); pConc = *(pDevice->devState0 + pNode->nodeP); pRhs[ pNode->psiEqn ] += dxdy * (pNode->netConc + pConc - nConc); /* Handle generation terms */ rhsN = - dxdy * pNode->uNet; pRhs[ pNode->nEqn ] -= rhsN; /* Handle dXdT continuity terms */ if ( tranAnalysis ) { pRhs[ pNode->nEqn ] += dxdy * pNode->dNdT; } } } } /* Handle neighbor and edge dependent terms */ pNode = pElem->pTLNode; if ( pNode->nodeType ISNOT CONTACT ) { pRhs[ pNode->psiEqn ] -= -dyOverDx * dPsiT - dxOverDy * dPsiL; if ( pElem->elemType IS SEMICON ) { pRhs[ pNode->nEqn ] -= dy * pTEdge->jn + dx * pLEdge->jn; } } pNode = pElem->pTRNode; if ( pNode->nodeType ISNOT CONTACT ) { pRhs[ pNode->psiEqn ] -= dyOverDx * dPsiT - dxOverDy * dPsiR; if ( pElem->elemType IS SEMICON ) { pRhs[ pNode->nEqn ] -= -dy * pTEdge->jn + dx * pREdge->jn; } } pNode = pElem->pBRNode; if ( pNode->nodeType ISNOT CONTACT ) { pRhs[ pNode->psiEqn ] -= dyOverDx * dPsiB + dxOverDy * dPsiR; if ( pElem->elemType IS SEMICON ) { pRhs[ pNode->nEqn ] -= -dy * pBEdge->jn - dx * pREdge->jn; } } pNode = pElem->pBLNode; if ( pNode->nodeType ISNOT CONTACT ) { pRhs[ pNode->psiEqn ] -= -dyOverDx * dPsiB + dxOverDy * dPsiL; if ( pElem->elemType IS SEMICON ) { pRhs[ pNode->nEqn ] -= dy * pBEdge->jn - dx * pLEdge->jn; } } }}/* * computation of current densities, recombination rates, * mobilities and their derivatives */void TWONcommonTerms( pDevice, currentOnly, tranAnalysis, info )TWOdevice *pDevice;BOOLEAN currentOnly, tranAnalysis;TWOtranInfo *info;{ TWOelem *pElem, *pElem1; TWOedge *pEdge; TWOnode *pNode; int index, eIndex; int nextIndex; /* index of node to find next element */ double psi1, psi2, refPsi, nC, nP1; double dPsiN; double bPsiN, dbPsiN, bMPsiN, dbMPsiN; double muN, dMuN, rDx, rDy; double psi, nConc, pConc; double cnAug, cpAug; double eSurf; /* For channel mobilities */ double qInt; TWOchannel *pCh; /* evaluate all node (including recombination) and edge quantities */ for ( eIndex = 1; eIndex <= pDevice->numElems; eIndex++ ) { pElem = pDevice->elements[ eIndex ]; refPsi = pElem->matlInfo->refPsi; cnAug = pElem->matlInfo->cAug[ELEC]; cpAug = pElem->matlInfo->cAug[HOLE]; for ( index = 0; index <= 3; index++ ) { if ( pElem->evalNodes[ index ] ) { pNode = pElem->pNodes[ index ]; if ( pNode->nodeType ISNOT CONTACT ) { psi = pDevice->dcSolution[ pNode->psiEqn ]; if ( pElem->elemType IS SEMICON ) { nConc = pDevice->dcSolution[ pNode->nEqn ]; pConc = pNode->nie * exp( - psi + refPsi ); if ( Srh ) { recomb(nConc, pConc, pNode->tn, pNode->tp, cnAug, cpAug, pNode->nie, &pNode->uNet, &pNode->dUdN, &pNode->dUdP); } else { pNode->uNet = 0.0; pNode->dUdN = 0.0; pNode->dUdP = 0.0; } } } else { /* a contact node */ psi = pNode->psi; if ( pElem->elemType IS SEMICON ) { nConc = pNode->nConc; pConc = pNode->pConc; } } /* store info in the state tables */ *(pDevice->devState0 + pNode->nodePsi) = psi; if ( pElem->elemType IS SEMICON ) { *(pDevice->devState0 + pNode->nodeN) = nConc; *(pDevice->devState0 + pNode->nodeP) = pConc; if ( tranAnalysis AND pNode->nodeType ISNOT CONTACT ) { pNode->dNdT = integrate( pDevice->devStates, info, pNode->nodeN ); } } } } for ( index = 0; index <= 3; index++ ) { if ( pElem->evalEdges[ index ] ) { pEdge = pElem->pEdges[ index ]; pNode = pElem->pNodes[ index ]; if ( pNode->nodeType ISNOT CONTACT ) { psi1 = pDevice->dcSolution[pNode->psiEqn]; } else { psi1 = pNode->psi; } pNode = pElem->pNodes[ (index + 1) % 4 ]; if ( pNode->nodeType ISNOT CONTACT ) { psi2 = pDevice->dcSolution[pNode->psiEqn]; } else { psi2 = pNode->psi; } if ( index <= 1 ) { pEdge->dPsi = psi2 - psi1; } else { pEdge->dPsi = psi1 - psi2; } *(pDevice->devState0 + pEdge->edgeDpsi) = pEdge->dPsi; if ( pElem->elemType IS SEMICON ) { /* Calculate weighted driving forces - wdfn & wdfp for the edge */ dPsiN = pEdge->dPsi + pEdge->dCBand; bernoulli( dPsiN, &bPsiN, &dbPsiN, &bMPsiN, &dbMPsiN, NOT currentOnly ); if ( index <= 1 ) { nC = *(pDevice->devState0 + pElem->pNodes[ index ]->nodeN); nP1 = *(pDevice->devState0 + pElem->pNodes[ index+1 ]->nodeN); } else { nC = *(pDevice->devState0 + pElem->pNodes[(index+1)%4]->nodeN); nP1 = *(pDevice->devState0 + pElem->pNodes[ index ]->nodeN); } pEdge->wdfn = bPsiN * nP1 - bMPsiN * nC; pEdge->jn = 0.0; if ( NOT currentOnly ) { pEdge->dWnDpsiP1 = dbPsiN * nP1 - dbMPsiN * nC; pEdge->dWnDn = - bMPsiN; pEdge->dWnDnP1 = bPsiN; pEdge->dJnDpsiP1 = 0.0; pEdge->dJnDn = 0.0; pEdge->dJnDnP1 = 0.0; } } } } } /* DAG: calculate mobilities for channel elems */ if ( SurfaceMobility ) { for ( pCh = pDevice->pChannel; pCh ISNOT NIL(TWOchannel); pCh = pCh->next ) { pElem = pCh->pNElem; switch (pCh->type) { case 0: eSurf = - 0.5 * (pElem->pLeftEdge->dPsi + pElem->pRightEdge->dPsi ) * pElem->epsRel / pElem->dy; qInt = 0.5 * pElem->pBotEdge->qf; break; case 1: eSurf = - 0.5 * (pElem->pTopEdge->dPsi + pElem->pBotEdge->dPsi ) * pElem->epsRel / pElem->dx; qInt = 0.5 * pElem->pLeftEdge->qf; break; case 2: eSurf = - 0.5 * (pElem->pLeftEdge->dPsi + pElem->pRightEdge->dPsi ) * pElem->epsRel / pElem->dy; qInt = 0.5 * pElem->pTopEdge->qf; break; case 3: eSurf = - 0.5 * (pElem->pTopEdge->dPsi + pElem->pBotEdge->dPsi ) * pElem->epsRel / pElem->dx; qInt = 0.5 * pElem->pRightEdge->qf; break; } eSurf += qInt; pElem = pCh->pSeed; nextIndex = (pCh->type + 2)%4; while (pElem && pElem->channel == pCh->id) { TWONmobility( pElem, eSurf ); pElem = pElem->pElems[ nextIndex ]; } } /* endfor pCH ISNOT NIL */ } /* endif SurfaceMobility */ /* calculate the current densities assuming mobility value depend on Ex,Ey*/ for ( eIndex = 1; eIndex <= pDevice->numElems; eIndex++ ) { pElem = pDevice->elements[ eIndex ]; rDx = 1.0 / pElem->dx; rDy = 1.0 / pElem->dy; for ( index = 0; index <= 3; index++ ) { pEdge = pElem->pEdges[ index ]; /* calculate conductive currents */ if ( pElem->elemType IS SEMICON ) { /* get mobility for this edge */ if ( NOT pElem->channel ) { /* Calculate mobility for non-channel elements */ muN = pElem->mun0; dMuN = 0.0; dPsiN = pEdge->dPsi + pEdge->dCBand; if ( index%2 IS 0 ) { MOBfieldDep( pElem->matlInfo, ELEC, - dPsiN * rDx, &muN, &dMuN ); } else { MOBfieldDep( pElem->matlInfo, ELEC, - dPsiN * rDy, &muN, &dMuN ); } } else { /* Retrieve previously calculated value. */ muN = pElem->mun; dMuN = 0.0; } switch ( index ) { case 0: muN *= pEdge->kPos * rDx; dMuN *= pEdge->kPos * rDx * rDx; break; case 1: muN *= pEdge->kNeg * rDy; dMuN *= pEdge->kNeg * rDy * rDy; break; case 2: muN *= pEdge->kNeg * rDx; dMuN *= pEdge->kNeg * rDx * rDx; break; case 3: muN *= pEdge->kPos * rDy; dMuN *= pEdge->kPos * rDy * rDy; break; } /* Now that the mobility for this edge is known, do current */ pEdge->jn += muN * pEdge->wdfn; if ( NOT currentOnly ) { pEdge->dJnDpsiP1 += muN * pEdge->dWnDpsiP1; pEdge->dJnDn += muN * pEdge->dWnDn; pEdge->dJnDnP1 += muN * pEdge->dWnDnP1; if ( MobDeriv AND (NOT pElem->channel) ) { pEdge->dJnDpsiP1 -= dMuN * pEdge->wdfn; } } } /* calculate displacement current only once */ if ( pElem->evalEdges[ index ] ) { if ( tranAnalysis ) { if ( index IS 0 OR index IS 2 ) { /* horizontal edges */ pEdge->jd = -integrate(pDevice->devStates, info, pEdge->edgeDpsi) * rDx; } else { /* vertical edges */ pEdge->jd = -integrate(pDevice->devStates, info, pEdge->edgeDpsi) * rDy; } } } } }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -