On Mars we don't have that, so we need to move some other conducting mass to create a protective magnetic field.
My plan is that we will build a ring made of asteroids that will encircle Mars and rotate in the plane of the ring around it (like a giant wheel).
If my understaing about the shape of the magnetic field is correct, this will protect at least all the volume right below the ring, and possibly half the planet.
For the shape of a magnetic field of a ring electromagnet, see the following video "Magnetic Field of a Coil" by Michael Melloch:
If the idea of surrounding a planet with a ring seems far fetched to you, I found - after thinking about this independently -
I was beaten to it by no other than Nikola Tesla the greatest engineer of all time!
The following excerpt is from Orbital Ring in Wikipedia :
In the 1870s Nikola Tesla, while recovering from malaria, conceived a number of inventions including a ring around the equator, although he did not include detailed calculations. As recounted in his autobiography My Inventions (1919):
Another one of my projects was to construct a ring around the equator which would, of course, float freely and could be arrested in its spinning motion by reactionary forces, thus enabling travel at a rate of about one thousand miles an hour, impracticable by rail. The reader will smile. The plan was difficult of execution, I will admit, but not nearly so bad as that of a well-known New York professor, who wanted to pump the air from the torrid to the temperate zones, entirely forgetful of the fact that the Lord had provided a gigantic machine for this very purpose.
Also others cosidered it seriously afterwards, including a few possible uses, not including mine (see Wikipedia).
Also notice that Mars is about HALF THE SIZE of Earth, and these orbital rings all talked about Earth!
About 8% (8 out of every 100) of the asteroids are M-type. M means Metal, and they are made of Iron and Nickel which are both ferromagnetic.
These asteroids can be found in the asteroid belt between Mars and Jupiter, in the middle region of the belt.
so together they will be the conducting mass that is moving.
How do we build the ring?
Option I: easy to build, hard to rotate
At first we drag the first asteroid to the Lagrangian point between Mars and the Sun.
What are Lagrange Points? They're "Parking Places in Space" - Thank you Elizabeth Howell from Space.com for this great explanation!
Then we add another asteroid and another, and each time they stick together like magnetic building blocks for toddlers, because of their gravity when they are very close to each other.
After each addition we drag the whole ring so that its center of mass is in the lagrangian point, and the ring plain is on the plain that is orthogonal to the line between Mars and the Sun.
In simpler words, if an astronaut on Mars is looking towards the Sun, from her angle she will see a circle of asteroids.
After the ring of asteroids forms a circle that can enclose around Mars and it's future atmosphere, we need to rotate the whole thing, and gradually lower it towards Mars AFTER it's rotating.
If we lower the ring towards Mars BEFORE it's rotating, the asteroids will just fall onto Mars which renders them useless plus they might kill our astronauts on the ground.
Option II: hard to build, easy to rotate
At first we drag the first asteroid close to Mars and then give it a push in the right direction so it enters a satellite orbit around Mars and a closed cycle.
Then we add another asteroid and another and each time we make sure they are rotating with as similar speed as possible and in the same direction and altitude.
Over time with enough asteroids they will stick to each other while still rotating, and form a closed loop that is rotating.
Of course the exact "push" that needs to be given is easy to say but very hard to do. Also as the ring becomes more populated how do you squeeze in the new asteroid, without the existing ones hitting it?
Option III: moderately-difficult to build, moderately-difficult to rotate
This is a combination of the two previous method
We start like option 1 with a static asteroid into the Lagrangian Point, then when we bring the next asteroid we rotate slowly the developing "ring" and bring it a little closer to Mars.
With each added asteroid we add a little more speed to the developing ring, and bring the ring a little bit closer still to Mars.
Since everything is gradual it should pose less challenge compared to rotating a complete static ring, and compared to pushing an asteroid to an exact empty "slot" in a fast rotating ring.
How do we keep the ring rotating?
Suppose that we succeeded in building and rotating the ring (I recommend option III).
When the ring is generating a magnetic field, the magnetic field itself will exert force in the opposite direction to the ring's rotation.
In other words the field will try to slow down and stop the ring, because otherwise we have just built a perpetual motion machine which is impossible.
So we need to supply energy for the ring to keep rotating, of course this should be solar powered.
We need to make an engine to pushes or pulls an asteroid in space and uses the Sun's light. I suggest we build it using electromagnets.
asteroid propulsion with electromagnetic coilgun using solar energy
Here you see clay pigeon shooting with a shotgun. This slow motion video is by the gun makers Holland & Holland.
My first idea was to make coilgun where the electricity will come from solar energy.
Each time we curve a small piece like a pebble from the asteroid using lasers. remember the material of the asteroid is feromagnetic. we magnetise that little piece with a strong electromagnet, and shoot it into space with an electromagnetic coilgun.
But then I got worried that the electromagnets (although instantaneous and "random") will interfere with the magnetic field of the whole ring and possibly collapse the ring.
So instead I think we should do something mechanical (that works on electricity) like the same "trap" machine that projects the clay target in the video.
For every action there is an opposite reaction (Newton's third law) which sends the asteroid a little in the opposite direction.
Of course this method of shooting in stones in random directions is not very safe, and also if it hits the neighbor asteroid it will move him in the opposite direction, and also might hit and ruin the engines on that neighbor.
The neighbor effect can be mitigated by shooting in two oblique directions that cancel each other.
The danger in shooting can be mitigated by creating the ring before we colonize Mars, making sure the ring is not shooting in the direction of Earth or the ISS, and shielding the few things we do have on Mars.
Since the solar engine unit is effectively digging slowly into the asteroid, it should be mobile between launches (stones throwing) and to relocate itself on the asteroid to another location each time.
If we see the ideal asteroid as totally round like a ball, then this digging should be on the largest bump (protrusion , bulge) of the asteroid.
After travelling on the asteroid, and before each throw, the unit needs to anchor itself to the asteroid.
This can be achieved with electromagnets (if the throw is mechanical, like clay pigeons "trap" machine) that momentarily "glue" the unit to the asteroid.
Or the unit can dig itself into the ground with some mechanical clutches.
The ideal solution is to seperate the digging location (the largest bump) from the shooting location (the exact place we want to push the asteroid from).
This requires more trips from the unit, but doesn't require any anchoring, because the recoil from the shooting will "glue" the unit to the asteroid.
As for the way of moving upon the asteroid, I think robotic legs are best, because wheels rely on the ground being flat and even which is not given here.
Another disadvantage of this system of propulsion is that it requires minimum size of asteroid because we are wearing the asteroid out and "wasting" it little by little.
After we wasted an asteroid in the ring over a certain limit, we need to replace it by bringing another asteroid, which forces us to Option II (because the ring is already spinning).
A possible solution to the stray shooting of rocks is to incinerate each rock right after we shoot it with another automatic laser from the asteroid (like clay pigeon shooting).
The system of the excavator-shooter-evaporator needs to work from a battery because sometimes the system will be in the shade of the asteroid or mars or both. The battery will be charged by solar power when there's Sun light.
Another concern is that the power of the magnetic field will disassemble the ring (EM force is much stronger than gravity).
To prevent this I suggest that after the ring is built we attach the asteroids to each other to form a rigid structure. This should be like a huge chain, because we need to make bypasses (when we replace un asteroid/link on the chain).
The material for the chain links between the asteroids can be excevated from smaller or otherwise unfit asteroids. Commercial mining on asteroids was seriously discussed for profit in the past.
Another problem is the precession of the ring when it rotates.
Here you see ESA astronaut Tim Peake showing a toy gyroscope in the Inernational Space Station. (The ISS itself also works with real smaller gyroscopes to know its own angle).
I think the precession will stabilize the ring, like a gyroscope or a toy top. But I don't know enough physics to be sure of that. So let's assume the ring does precess.
This causes a problem because of the uneven gravity of Mars (as compared to Earth). Mars is not "round" enough.
This means that the ring needs to be of larger diameter so as to be further from the planet, and to take into account a magnetic field that is shifting very often.
I don't know how to calculate how fast the procession movement can get, but if it's fast it can be a problem for spaceships to and from Mars.
Of course we can compensate with the above mentioned solar engines and avoid the procession altogether, but this will wear out one side of the asteroids constantly.
One option to fix this is give the asteroids freedom of movement (the links between the asteroids need to have a free axis) and the solar engines units need to be mobile on the asteroids.
As you can see every solution brings with it another problem, but I think the general idea is solid enough for professionals to consider.
Especially given the enormous benefit of allowing us to terraform Mars, and in essence give humanity a plan B in case there is an extinction on Earth!