Power and magnetism If we have a solenoid and a magnetic field passes through it, a DC voltage will be produced in the wire. If we want to calculate the power, we find out the current using Ohm's law.
I know there is power loss due to the resistance (joule effect). But what about the magnetic field due to current (lenz's law), does it contribute in the power loss?
 A: Rephrased: If you are using an ideal, superconducting solenoid, and you hook it up to a battery, and it creates a magnetic field, where does the energy in the battery go? The magnetic field that is created has an associated energy density $\frac{1}{2\mu} B^2$. If the field is set up slowly (adiabatically), then most of the energy will go into this term. However, initially, when $B$ is changing rapidly, it induces an electric field $E$ also, and the solenoid will radiate some energy away. If you are using a superconductor, then once $B$ is established, the current in the loop will continue flowing and $B$ will be maintained. For a resistive loop, you need to continue supplying energy to overcome Ohm's law as you said.
As Alexander pointed out, if you try to switch off the current, $B$ will start to decrease, and this decrease will induce an EMF, and thus a current in the solenoid, resisting this change (Lenz' law). This is the origin of induction, and the way in which the magnetic fields of solenoids can store energy (e.g., in RLC circuits)
