A rule of thumb is that max power occurs when (in this case) your variable resistor matches the solenoid coil resistance.
Beware that the "12VDC" is actually likely to be a vehicle voltage that might be more like 14 volts. That is enough of a difference that it's worth using 14 instead of 12.
So 7 volts (one half of 14) over the resistor set to 3.1 Ohms is about 16 watts. 20 watts is the nearest common power rating, but a bit too close for my liking. So you might need to use a 50 watt variable resistor, if you can't find a 30 watt.
I'm not sure how easy it would be to find a variable power resistor with these sorts of values for resistance and power.
Also, you might find the taper of the resistance curve to be unfeasible. In other words, all the action might end up happening within a very small range crammed into one end of the total range of motion.
Also, one must consider that the power dissipation in the worst case might also be confined to a small section of the total variable resistor. In other words, 16 watts of heat crammed into one small end of the resistor.
One wouldn't want to simply install a variable resistor without carefully analyzing it at all the critical settings along the adjustment range.
You can probably start to see why PWM might actually be easier.