How much space would a city need within a ringwall to survive for an indefinite period of time?

I'm writing a D&D campaign and the premise is that a big bad thing happened and sent waves of energy pulsing over the landscape. A High Mage type character throws up an enormous wall, surmounted by an energy barrier which holds the bad stuff at bay but seals up the city for a (insert long-ass period of time here). I've been using a thousand years but I'm not sold on the timeframe yet. The city is on or straddling a river so water is no problem BUT. How much space would a city of around 500,000 people (half of pre-industrial up to industrial London) need in farming land to grow enough food to survive? This will allow me to determine the diameter of my walls, currently set as...big?

• "Early" London did not have 1,000,000 people. You are overestimating the population of "early" London by two orders of magntitude. London reached 1,000,000 people in the 19th century, which is not "early" by any imagination. Commented Apr 6, 2020 at 8:08
• Apologies, my imagination is picturing something like a pre-industrial up to industrial London. Early was the wrong word, you would think I'd know that doing reenactment myself.
– Gwig
Commented Apr 6, 2020 at 8:14
• There are few questions (with science based answers) on how much space is needed for X amount of food sufficent for Y amount of people. Commented Apr 6, 2020 at 8:21
• Does this answer your question? How large would a space ship need to be to feed 10,000 people? Commented Apr 6, 2020 at 8:25
• Since this is for D&D, you may wish to consider how that magic system can impact this calculation. Are you familiar with our sister site for RPGs? Commented Apr 7, 2020 at 16:05

According to Medieval Manors, a UK group dedicated to historical preservation of historical manors, one square mile of land could support about 180 persons.

So, if your town has 500 000 people, it would need minimum 500 000 / 180 ~ 2777 square miles of land. Just for food. It would also need some land to actually house the people live there. So, being you, I would not go under 5000 square miles, which gives the wall average radius of about 40 miles from the center and total length about 250 miles.

Please note that the calculation were done hastily, so take them as of average villager would talk about their confinment

• Just as a quirk against that figure, the area within and immediately surrounding the M25, i.e. the area covered by the Greater London A-Z, is about 1000 square miles. Commented Apr 6, 2020 at 8:28

I quote part of my answer to a different question:

And that is important because one way to avoid having your castle or city starved out is to grow sufficient food within the castle or city to feed the defenders.

Suppose that each person in the city or castle needs an average of one acre to grow food for himself and one tenth acre for other purposes. Suppose that a million people live in a city. They will need 1,100,000 acres of land to grow food and for other purposes.

Therefore, with 43,560 square feet in an acre, a total of 47,916,000,000 square feet would be needed, or a square 218,897.23 feet, or 41.4578 miles, on each side. It would have a total of 875,588.92 feet on all four sides. If there were 1,000,000 people in the city, and 0.25 of them were adult males, there would be a total of 250,000 defenders, so each side would have 62,500 defenders spread over 218,897.23 feet, or about one defender every 3.5023 feet, which seems adequate to defend a wall ten feet high, let alone one hundreds of feet high.

A circle with an area of 47,916,000,000 square feet would have a radius of 123,498.98 feet or 23.3899 miles, and a circumference of about 776,000 feet, with about 3.104 feet per defender. If the walls are hundreds of feet high and thick one defender should be enough to defend hundreds or thousands of feet of wall, so each fighting man could spend a few weeks a year training and stationed at the walls, and the rest of the year tending his farm which could be miles deep within the vast fortress.

Of course medieval methods of farming might require several acres to feed one person. But if the time travelers or aliens introduce more modern methods of agriculture, or hydroponics, or aeroponics, or food synthesizers, they may be able to feed many tens or hundreds of people per acre, and a fortress with a population of a million and 250,000 fighting men might be very tiny compared to one 46.7798 miles in diameter.

I write about various scientific and technological methods for fantasy Dwarves to produce food in their underground cities and kingdoms, methods that might work in a fantasy setting depending on how different that setting is compared to the real world. If the laws of nature or magic in a fantasy story are not too different from those in the real world, the real world methods would work for fantsy Dwarves in a fantasy story and maybe also work for an city of humans cut off from the outside world by a magical barrier in a fantasy story.