def contact_phin(cell: PVCell, bound: Boundary, pot: Potentials) -> Tuple[f64, f64]: n = physics.n(cell, pot) Jn = current.Jn(cell, pot) return Jn[0] - cell.Snl * (n[0] - bound.neq0), Jn[-1] + cell.Snr * ( n[-1] - bound.neqL)
def comp_shr(cell: PVCell, pot: Potentials) -> Array: ni = physics.ni(cell) n = physics.n(cell, pot) p = physics.p(cell, pot) nR = ni * jnp.exp(cell.Et) + n pR = ni * jnp.exp(-cell.Et) + p return (n * p - ni**2) / (cell.tp * nR + cell.tn * pR)
def contact_phin_deriv(cell: PVCell, pot: Potentials) -> Tuple[f64, f64, f64, f64]: n = physics.n(cell, pot) dJn_phin_maindiag, dJn_phin_upperdiag, dJn_phi_maindiag, dJn_phi_upperdiag = current.Jn_deriv( cell, pot) return dJn_phin_maindiag[0] - cell.Snl * n[0] , dJn_phin_upperdiag[0] , \ dJn_phi_maindiag[0] - cell.Snl * n[0] , dJn_phi_upperdiag[0] , \ dJn_phin_maindiag[-1] , dJn_phin_upperdiag[-1] + cell.Snr * n[-1] , \ dJn_phi_maindiag[-1] , dJn_phi_upperdiag[-1] + cell.Snr * n[-1]
def comp_rad_deriv(cell: PVCell, pot: Potentials) -> Tuple[Array, Array, Array]: n = physics.n(cell, pot) p = physics.p(cell, pot) DR_phin = cell.Br * (n * p) DR_phip = cell.Br * (-n * p) DR_phi = jnp.zeros_like(pot.phi) return DR_phin, DR_phip, DR_phi
def comp_auger_deriv(cell: PVCell, pot: Potentials) -> Tuple[Array, Array, Array]: ni = physics.ni(cell) n = physics.n(cell, pot) p = physics.p(cell, pot) DR_phin = (cell.Cn * n) * (n * p - ni**2) + (cell.Cn * n + cell.Cp * p) * (n * p) DR_phip = (-cell.Cp * p) * (n * p - ni**2) + (cell.Cn * n + cell.Cp * p) * (-n * p) DR_phi = (cell.Cn * n - cell.Cp * p) * (n * p - ni**2) return DR_phin, DR_phip, DR_phi
def pois_deriv_eq(cell: PVCell, pot: Potentials) -> Tuple[Array, Array, Array]: ave_dgrid = (cell.dgrid[:-1] + cell.dgrid[1:]) / 2. ave_eps = (cell.eps[1:] + cell.eps[:-1]) / 2. n = physics.n(cell, pot) p = physics.p(cell, pot) dchg_phi = -n - p dpois_phi_ = -ave_eps[:-1] / cell.dgrid[:-1] / ave_dgrid dpois_phi__ = (ave_eps[:-1] / cell.dgrid[:-1] + ave_eps[1:] / cell.dgrid[1:]) / ave_dgrid - dchg_phi[1:-1] dpois_phi___ = -ave_eps[1:] / cell.dgrid[1:] / ave_dgrid return dpois_phi_, dpois_phi__, dpois_phi___
def comp_shr_deriv(cell: PVCell, pot: Potentials) -> Tuple[Array, Array, Array]: ni = physics.ni(cell) n = physics.n(cell, pot) p = physics.p(cell, pot) nR = ni * jnp.exp(cell.Et) + n pR = ni * jnp.exp(-cell.Et) + p num = n * p - ni**2 denom = cell.tp * nR + cell.tn * pR DR_phin = ((n * p) * denom - num * (cell.tp * n)) * denom**(-2) DR_phip = ((-n * p) * denom - num * (-cell.tn * p)) * denom**(-2) DR_phi = (-num * (cell.tp * n - cell.tn * p)) * denom**(-2) return DR_phin, DR_phip, DR_phi
def plot_charge(design: PVDesign, pot: Potentials, filename=None): n = scales.density * physics.n(design, pot) p = scales.density * physics.p(design, pot) x = scales.length * design.grid * 1e4 plt.plot(x, n, label="electron", color="lightcoral") plt.plot(x, p, label="hole", color="cornflowerblue") plt.yscale("log") plt.xlabel("position / μm") plt.ylabel("density / cm$^{-3}$") plt.legend() plt.xlim(0, x[-1]) plt.tight_layout() if filename is not None: plt.savefig(filename) plt.show()
def pois_deriv(cell: PVCell, pot: Potentials) -> Tuple[Array, Array, Array, Array, Array]: ave_dgrid = (cell.dgrid[:-1] + cell.dgrid[1:]) / 2.0 ave_eps = 0.5 * (cell.eps[1:] + cell.eps[:-1]) n = physics.n(cell, pot) p = physics.p(cell, pot) dchg_phi_n = -n dchg_phi_p = -p dchg_phi = -n - p dpois_phi_ = -ave_eps[:-1] / cell.dgrid[:-1] / ave_dgrid dpois_phi__ = (ave_eps[:-1] / cell.dgrid[:-1] + ave_eps[1:] / cell.dgrid[1:]) / ave_dgrid - dchg_phi[1:-1] dpois_phi___ = -ave_eps[1:] / cell.dgrid[1:] / ave_dgrid dpois_dphin__ = -dchg_phi_n[1:-1] dpois_dphip__ = -dchg_phi_p[1:-1] return dpois_phi_, dpois_phi__, dpois_phi___, dpois_dphin__, dpois_dphip__
def comp_rad(cell: PVCell, pot: Potentials) -> Array: ni = physics.ni(cell) n = physics.n(cell, pot) p = physics.p(cell, pot) return cell.Br * (n * p - ni**2)
def comp_auger(cell: PVCell, pot: Potentials) -> Array: ni = physics.ni(cell) n = physics.n(cell, pot) p = physics.p(cell, pot) return (cell.Cn * n + cell.Cp * p) * (n * p - ni**2)