Controlling an electromagnet strengh with arduino
PWM is a good choice and remember that the coil needs a reverse connected diode across it to prevent back-emf's from the open-circuited inductor damaging stuff. You will also need to use a power transistor of some type to interface between the arduino and the coil - the arduino doesn't provide enough "drive" to get anywhere near 2A. Here's a diagram that shows a transistor from an MCU but it has a motor instead of a coil. This doesn't matter - the important thing is that it shows the diode and a method of driving the coil: -



It also shows +5V but this can be +12V. Things to watch out for: -

1) The diode needs to be rated at a current that exceeds the maximum current through the coil.

2) The coil still needs the resistor in series in case of short circuits but, it maybe reduced to something like 1 ohm when you are happier with operations.

3) The transistor has to be rated to switch the current so probably choose one that can easily handle at least 3A. 

4) Voltage rating on the transistor need only be 20V or higher

5) Resistor in series with base may need to be 100 ohm - try this to begin with. From a 3V3 IO line 100 ohm will mean a base current of about 30mA and if the HFE of the transistor is good when switching power loads (100+) it should be OK however, it may be better to use a FET for this and there are plenty to choose from.

Next try putting out a 50:50 mark-space pulse (a square wave) and changing the frequency and see what the core losses are like with progressively higher frequencies. I would have thought 1kHz is a good starting point and you may be satisfied with 10kHz hopefully.