I have a system of coupled non-linear ODEs.
$$J = \mu e \left( n(x) E(x) + \frac{K T}{e} \frac{dn(x)}{dx}\right)$$ $$\frac{dE(x)}{dx} = \frac{4 \pi e}{\epsilon}[N_D(x) -n(x)]$$
The first equation is drift-diffusion, the second is Gauss' Law. I am interested in solving this system self-consistently for the carrier profile, $n(x)$, and the electric field, $E(x)$, using finite differences. The current, $J$, the mobility, $\mu$, elementary charge, $e$, are known constants. The doping profile $N_D(x)$ is known, and I have boundary conditions for the carrier concentration $n(0) = N_D(0)$ and $n(L) = N_D(L)$. I am unsure how to proceed with solving these equations.
I am following the analysis of Baranger and Wilkins in the attached review. Appendix B, specifically the section dealing with guessing an initial density.
"Equation (Bl) is solved self-consistently with the Poisson equation [Eq. (2)] for n (x) and E(x) using a finite difference method. As boundary conditions we fix the current JDD at the desired value and set the density equal to N+ at the edges of the structure."
EDIT: I have taken the advise of @hypernova and implemented his discretization scheme. In order to implement, I have non-dimensionalized the equations to prevent problems with numerical implementation.
Non-dimensionalizing the parameters: $$N_D^* = \frac{N_D(x)}{N_c}$$ $$n^* = \frac{n(x)}{N_c}$$ $$x^* = \frac{x}{L}$$ $$E^* = \frac{E(x) e L}{K T}$$
Applying the scaling: $$\theta = \frac{J L}{\mu N_c K T}$$ $$\gamma = \frac{K T \epsilon}{4 \pi e^2 L^2 N_c}$$
We obtain the non-dimensional equations: $$\frac{dn^*}{dx^*} = \theta - n^* E^*$$ $$\frac{dE^*}{dx^*} = \frac{1}{\gamma} [N_D^* - n^*]$$
We make the initial guess $n^{*,(0)} = N_D^*(0)$.
Dicretize the problem as per the answer below:
$$\frac{E^{*,(k,*)}_{j+1} - E^{*,(k,*)}_{j}}{h^*} = \frac{1}{2 \gamma} [N_{D,j+1}^* + N_{D,j}^* - n_{j+1}^{*,(k)} -n_{j}^{*,(k)}]$$ for $j = 0,1,...,N-1$.
We make the correction:
$$C^{(k)} = \frac{N_D^*{(1)} - N_D^*{(0)} - A^{(k)}}{B^{(k)}}$$ $$A^{(k)} = h^* \{\frac{1}{2} [ 2 \theta - n_0^*{(k)} E_0^{*,(k,*)} - n_N^*{(k)} E_N^{*,(k,*)}] + \sum_{j=1}^{N-1} (\theta - n_j^{*,(k)} E_j^{*,(k,*)}) \}$$ $$B^{(k)} = h^* \{ \frac{1}{2} [-n_0^{*,(k)}-n_N^{*,(k)}] + \sum_{j=1}^{N-1} (-n_j^{*,(k)}) \}$$
$$E_j^{*,(k)} = E_j^{*,(k,*)} + C^{(k)}$$
And finally update the density: $$\frac{n^{*,(k+1)}_{j+1} - n^{*,(k+1)}_{j}}{h^*} = \frac{1}{2} [2 \theta - n^{*,(k)}_{j+1} E^{*,(k)}_{j+1} - n^{*,(k)}_{j} E^{*,(k)}_{j}]$$ for $j = 0,1,...,N-1$. With condition $n^{*,(k+1)}_{0} = N_D^*(0)$.
I believe that this discretized scheme is correct. However, I have had trouble implementing. Namely, after only two iterations, the density, correction factors, and E-field quantities explode. Furthermore, another curious aspect is that the densities become strongly negative in the center of the domain, and the right boundary does not exactly match the imposed condition.
Some parameter values for implementation: $$J = 10^3 [A/cm^2]$$ $$K = 1.380*10^-23 [J/K]$$ $$T = 300 [K]$$ $$\mu = 7500 [cm^2 V^-1 s^-1]$$ $$L = 4.4*10^-6 [m]$$ $$e = 1.602*10^-19 [C]$$ $$\epsilon = 8.85*10^-12 [F/m]$$ $$N_C = 10^{15} [cm^-3]$$ $$N_{0,L} = 10^{18} [cm^-3]$$
The doping profile, $N_D$ is a step function:
$ N_D(x) \left\{ \begin{array}{ll} N_{0,L} & 0 \leq x\leq 2 \mu m \\ N_C & 2 < x < 2.4 \mu m \\ N_{0,L} & 2.4 \mu m\leq x \leq L \\ \end{array} \right. $