It’s a pleasantly warm summer’s day in the mountains of Shanxi Province in China, with temperatures in the high teens. And yet just a few metres below the surface lies a spectacular cathedral of ice.

The walls and floor of Ningwu cave are coated with slicks of frozen water. Ice stalactites stretch down from the ceiling, towards ice stalagmites reaching up from the floor.

The sight is dazzling, but it’s not unique. Such naturally occurring ice caves are scattered across continental Europe, through Russia, Central Asia, and North America. Many are major tourist attractions. But only in recent decades have people come up with simulations to model and understand what keeps these natural freezers so cold.

An early ice cave enthusiast, George Forrest Browne, helped to popularise them in the UK after his travels in Europe. He recorded his first encounter in Switzerland in 1861: “At the bottom, after penetrating a few yards into a chasm in the rock, we discovered a small low cave, perfectly dark, with a flooring of ice and a pillar of the same material.”

Aurel Persoiu, a researcher at the Emil Racovita Institute of Speleology in Romania, also won’t forget his first experience of an ice cave. “When you spend a lot of time caving, it really strikes you how unusual it is to see ice formations inside them. You start to ask why in this cave and not others? What makes it different?”

And what does make it different?

Although they’ve been an object of study for more than 150 years, exactly how ice caves stay so cold has been contentious.

Explanations have included a local reversal of geothermal heat – warmth from Earth’s hot mantle. This “cold source” theory suggests that the mantle’s warm currents might sometimes miss a particular patch of ground, leading to icy deposits if a cave of the right shape happens to be in that area.

But scientists studying the Ningwu cave at the Chinese Academy of Geological Sciences say that the cold source theory doesn’t stand up to much scrutiny.

Yaolin Shi points out that while geothermal heat does vary in places, these differences often influence surface temperatures too. If it’s colder underground because of a lack of geothermal heat, it will be colder at the surface.

If you measure the temperature you can see it drop every five or ten minutes or so

Yet at the Ningwu cave, summer temperatures at the surface can reach 17 °C even as the cave temperature hovers around zero – quite a discrepancy.

“You need to cool the cave, in the first place,” says Persoiu, who has gone on to study several ice caves in Romania.

This cooling probably begins with the air outside the cave and not with a lack of geothermal heat below it. In winter, cool and dense air tumbles down into the ice cave. “If you measure the temperature you can see it drop every five or ten minutes or so, as outside cooling triggers yet another avalanche of cold air.”

It turns out that it is a combination of the cave’s particular shape and position, the seasonal flows of air through the space, and the nature of the heat exchange with the rock walls that creates the unique micro-environment necessary to keep it ice cold even when the outside world warms up again.

Shi set out to make a mathematical model of Ningwu cave to map the movement of heat through it.

Ningwu is an 85m-deep, bowling-pin shaped cave set into the side of a mountain more than 2,000m above sea level. It acts as a cold-air trap; a little cool air sinks down the neck of the cave in spring, summer, and autumn. That air is warmed very slightly by geothermal heat from limestone walls of the cave, but this is such an inefficient process that any warming occurs very slowly.

It’s almost biological, the way the ice cave environment maintains itself

In winter, the temperature outside the cave plummets to -15 °C. The heavy cold air from outside cascades into the cave, and warmer air inside the cave rises up and escapes, lowering the cave temperature further.

There’s another property of the cave that makes it so hard to warm the space up. Once ice has formed in the cave, it acts as a buffer that stabilises the temperature. If warmer air passes into the cave, some of the ice starts to melt. But this takes a lot of energy, and so the formation of a little melt water effectively absorbs a lot of the incoming heat, preventing the rest of the cave from warming up too much.

The reverse is also true; when very cold air cascades in, any liquid water in the cave will freeze, releasing energy and stopping the cave’s temperature plummeting as low as that outside. This process can, to an extent, keep temperatures quite constant in the cave; the interplay between ice and water near the cave entrance helps to even out the cave’s temperature throughout the year.

Some ice caves have multiple entrances, which affects the seasonal flow of air and the extent that ice melts and regrows each year. The entrances to these ice caves – such as the largest cave in the world to permanently host ice, Eisriesenwelt in Austria – open at different heights, which encourages a seasonal flow of cold air through the cave.

Blocking the flow of air in winter could make the entire ice body melt in a few decades

When there is a delicate balance between all these factors – flows of air between the cave and the outside world, geothermal heat from the cave walls, the ice-water state change, and the cave’s shape – the result is an ice cave.

“It’s almost biological, the way the ice cave environment maintains itself,” Persoiu says.

Ice caves might appear to be in a relatively stable equilibrium, but they are actually vulnerable to melting if conditions around the cave are disrupted. Shi’s mathematical simulation of ice cave environments suggests that some caves may already be in danger.

In Wudalianchi ice cave in Heilongjiang Province in China, for instance, managers have installed a metal door at the cave entrance in an effort to protect it overnight and in the winter. This puts the ice body inside at risk, Shi says.

Without an influx of cold air avalanches – particularly in the coldest months – the cave won’t stay sufficiently cool for the rest of the year. By Shi’s calculations, this particular effort to conserve the cave will probably backfire. Blocking the flow of air in winter could make the entire ice body melt in a few decades, Shi says.

“Management of an ice cave has to be based on sound science,” says Penny Boston, a speleologist at the New Mexico Institute of Mining and Technology in Albuquerque in the US. “Sometimes in an attempt to preserve the ice, people have inadvertently harmed the ice masses.”

Good intentions to try to preserve the ice cave are understandable; huge numbers of tourists are drawn to them every day. Several are Unesco World Heritage Sites, including the Dobšinská and Silica caves in Slovakia.

Tourism could be used as a leverage point to help us conserve ice caves

The Ningwu cave alone sees up to 1,000 visitors a day when it’s open to the public between May and October. Each tourist might spend an hour in the cave, which is illuminated for them by 200 light bulbs. Both the tourists and the bulbs give out heat.

The good news is that, according to Shi, this extra warmth shouldn’t disrupt the cave’s environment, provided it still receives a seasonal flow of cold air.

Some scientists hope that visitors will even play a role in preserving ice caves in the long run. “Tourism could be used as a leverage point to help us conserve ice caves,” says Boston. “It could show the public how special and precious such places are.”

Unless the efforts are well informed by the science they are likely to be ineffective or even harmful

Such conservation efforts are becoming more pressing due to the threat to ice caves from climate change. One consequence of shorter winters is that there is less cold air to replenish ice caves, which could tip them out of balance. “I’ve seen catastrophic melting in ice caves,” says Persoiu. “It’s like the Larsen B Ice Shelf in West Antarctica that collapsed in 2002 – you get to a certain point and suddenly it all goes. That’s something that’s happened here in a Romanian cave.”

Many ice caves are already being lost to climate change, Boston agrees, citing historic photographs and measurements of the thickness and extent of ice in the caves. “Here in New Mexico where I live, there has been significant ice loss over the past decade at the Bandera ice cave, which is a volcanic lavatube cave with permanent ice,” she says.

This has led to international and local efforts to try to preserve the caves. The International Union of Speleology has a commission working on ice caves, and there are several local interest groups associated with individual caves. But Boston says that “unless the efforts are well informed by the science they are likely to be ineffective or even harmful”.

This is bad news, because ice caves are not simply stunning tourist attractions. They are also important archives of past atmospheric and environmental conditions.

The proportion of different radioactive markers in the ice can provide data to help establish when the ice bodies formed. Then, the proportion of gases trapped in bubbles in the ice can throw light on the ancient composition of the atmosphere at the time of freezing.

Shi thinks that ice caves might be able to give us a model for a new form of air conditioning for buildings

What’s more, pollen, fragments of leaves and other biomass, and microbial life preserved in the ice provides scientists with even more information about life thousands of years ago. “They are a trap for biological remains, and there’s a whole world of information to be extracted from them,” Persoiu says.

In the polar regions where there is still widespread permafrost, ice is used routinely to reveal this kind of information. But in temperate regions permafrost is rare or absent, with the only bodies of permanent ice confined to very high altitudes. Creating a map of past climates and recreating pictures of ancient life is difficult in temperate zones.

Ice caves are important data points in these temperate regions, Boston says. They help scientists making meaningful comparisons between, for instance, Eastern Europe and the Alps further to the west.

As well as providing biological and climate data, Shi thinks that ice caves might be able to give us a model for a new form of air conditioning for buildings.

If a basement of sufficient depth and the right shape was constructed at the base of a building, it might act as a cold air trap in the same way that an ice cave does, Shi says. Theoretically, ice could be created there in the winter and used to cool the building in the summer. Shi suggests that a 10m-deep basement might be enough to do the trick, offering a cheap and environmentally friendly way to cool buildings.

Persoiu, however, is less convinced by this idea. “The amount of cooling you get in a 10m pit would be grossly overwhelmed by the geothermal heat flux. But there is no data to prove this.”

But he points out that some organisms are already using cave-like systems to keep a flow of cool air through their homes. “A termite mound model for cooling tall buildings works better – this works like a two-entrance cave, with openings at different altitudes.”