# Gauss law for positive charge densities

I am trying to write a PIC (Particle In Cell) code to simulate plasma physics. I am starting with the simplest case, which is a 1D system with a longitudinal field $$E = E(x)$$. I am using this article as reference (it has some typos, though)

In it, finite differences are applied to Gauss Law, which gives:

$$E(x + dx, t) =dx \rho(x,t)/\epsilon_0 + E(x,t)$$

(The article uses another normalisation) I would expect the electric field to vanish as x increases. However, this equation seems to say that if $$\rho > 0$$, then $$E(x + dx) > E(x), \forall x$$. This would be the result even for the simplest case, i.e., a single point-charge. Where is the mistake? Thank you!

• This question is equal to another, or am I wrong? Anyway what you say is valid in 3D, not in 1D – Mark_Bell Apr 11 at 23:57
• @Mark_Bell It’s a delete-and-repost. – G. Smith Apr 12 at 0:00
• @G.Smith yes, since the other one wasn’t clear enough. Should I put in the question that it is a delete-and-repost? Thank you – Ali Esquembre Kucukalic Apr 12 at 4:58
• @Mark_Bell I think it is valid for longitudinal fields. In fact, take a look to equation (15) in the quoted link. – Ali Esquembre Kucukalic Apr 12 at 5:00
• You can always edit a question to make it clearer. This is preferable to deleting and reposting. – G. Smith Apr 12 at 5:16

The charge density in a PIC code has a finite extension, i.e., $$\rho(x) \neq 0$$ if $$x$$ belongs to some interval $$[x_p - \Delta x, x_p + \Delta x]$$. Thus, the solution comes by imposing the initial conditions far away from the charge equal to zero, i.e.,
$$E(x,t) = 0$$ for $$x << x_p$$,
and then keep on updating $$E(x)$$ until we reach $$x_p - \Delta x$$ so that $$\rho(x_p - \Delta x)\neq 0$$. After we cover the interval in which the charge is not zero, the immediate next point will give $$E(x_p + \Delta x + 2dx) = \rho(x_p + \Delta x + dx) + E(x_p + \Delta x) = E(x_p + \Delta x)$$, i.e., a uniform field which is the correct behavior in a 1D system, where $$E(x)$$ goes with $$1/r^0$$.