In electrostatics, the Poisson equation describes the relationship between the electrostatic potential $V$ and the charge density $\rho$.
\( \large \nabla^2V=-\frac{\rho}{\epsilon}. \)
In a semiconductor the charge density is,
\( \large \rho= p + N_D - n - N_A, \)
where $p$ is the density of holes, $n$ is the density of electrons, $N_D$ is the density of donors, and $N_A$ is the density of acceptors.
\( \large p= N_v\exp\left(\frac{E_v-E_F}{k_BT}\right) \) and \( \large n= N_c\exp\left(\frac{E_F-E_c}{k_BT}\right) \)
Here $N_v$ is the effective density of states in the valence band, $N_c$ is the effective density of states in the conduction band, $E_c$ is the energy at the bottom of the conduction band, $E_v$ is the energy at the top of the valence band, $E_F$ is the Fermi energy, $k_B$ is Boltzmann's constant, and $T$ is the absolute temperature.
If no bias voltage is applied across the semiconductor, the Fermi energy will be constant everywhere but the bands may bend due to a redistribution of charge at $pn$-junctions. As a function of position, the valence band energy and conduction band energies are,
\( \large E_v\left(x\right)= E_v\left(0\right)-V\left(x\right) \) and \( \large E_c\left(x\right)= E_c\left(0\right)-V\left(x\right). \)
Where the zero of the potential is defined by $V(x=0)=0$.
The above equations can be solved itteratively by solving for the potential given the charge density and then solving for the charge density given the potential. After repeating this process a number of times, the charge density and potential converge to their final values.
The form below allows you to input analytic expressions for the doping density and then it solves for the carrier densities, the electric field, and the potential. It is necessary to specify the width of the region that the program should consider.