Nonlinear time-invariant frequency doubler
As already suggested by Robert and Olli, a system that maps $x(t)=k\cos(2\pi f_0t)$ to $y(t)=k\cos(4\pi f_0 t)$ can be formalized as

$$y(t)=|x(t)|_{max}\left(2\left(\frac{x(t)}{|x(t)|_{max}}\right)^2-1\right)\tag{1}$$

which is a time-invariant non-linear system.

However, I doubt that this system works well (i.e., sounds good as a distortion effect) when applied to real-world (non-sinusoidal) input signals.

To get some ideas of digital implementations of distortion effects, take a look at this thesis and the references therein.