Simulating the lunar geomagnetic variations