The talk will describe how to simulate the long-term evolution of magnetic field and temperature in isolated neutron stars, and the magnetic field amplification in binary neutron star mergers. These two cases require sophisticated numerical techniques, which I will briefly review. I will also discuss the computational cost for such simulations.