The rapidly falling cost of solar energy is going to make it difficult for President Trump to deliver on his promise to put coal miners back to work.

Trump has taken steps to ease the burden on coal country by ripping up environmental rules and pledging to withdraw the United States from the Paris climate accord.

But those deregulatory steps do little to offset the mounting long-term challenge that coal faces from cleaner forms of energy, especially solar.

By 2040, U.S. power generation from renewable energy is likely to skyrocket by 169%, according to a recent forecast from the research firm Bloomberg New Energy Finance. Coal-fired power is projected to plunge by 51% in the United States over the same period.

"The greening of the world's electricity system is unstoppable," wrote Seb Henbest, the lead author.

Despite Trump's promises, more and more electric utilities are expected to dump coal as businesses and individuals adopt solar panels. That's because of a simple economic reality: Renewable energy costs are poised to continue dropping thanks to a gush of investment.

The Bloomberg researchers measured energy costs by calculating the lifetime expenses of generating power from a new plant, including permitting and expenses.

On that basis, the cost of electricity from solar has already cratered by nearly 75% since 2009, and it's expected to plummet 66% further by 2040, according to the forecast.

Solar is already "at least as cheap as coal" in some countries, including the United States, Germany, Australia, Spain and Italy, the report said. The cost of wind power could also be cut in half.

Related: Big Oil needs to spend $350 billion on wind and solar

"With or without federal support, clean energy will continue to fall in price," said Bryan Birsic, CEO of Wunder Capital, a company that develops and manages solar investment funds.

"The only person who can't seem to see that is Donald Trump," Bisic said.

Of course, solar energy isn't the only force creating headaches for coal and its beleaguered workforce. Many power plants have switched to natural gas in recent years as the shale boom has sent gas prices plunging.

The key is that solar technology has become more efficient thanks to a flood of money investing in renewable energy. That trend is likely to accelerate as more governments crack down on carbon and awareness of climate change risks increases.

By 2040, $7.4 trillion (yes, trillion with a "T") will have been invested in renewable energy plants, including nearly $3 trillion for solar alone, the report predicted.

It also helps that Elon Musk is betting heavily on solar. Last year, Musk merged his electric car company, Tesla (TSLA), with his SolarCity business, create a one-stop shop for clean energy. SolarCity recently began taking orders on a solar roof made of shingles that look like traditional roof tiling.

Related: Coal king: It's 'wonderful' Trump ditched Paris deal

Musk's optimism about clean energy is gaining popularity.

Globally, wind and solar electricity generation is set to surge from just 5% today to 34% in 2040, the Bloomberg report predicted. By 2040, the U.S. is projected to get 38% of its electricity from renewable energy. Germany, Canada and Mexico will get at least three-quarters of their power that way.

Robert Murray, the CEO of the largest private coal miner in the United States, believes coal is the victim of a government picking winners and losers.

"We've got to stop the subsidies on windmills and solar. Get the government out of it and get back to private enterprise," the Murray Energy chief executive told CNNMoney after applauding Trump's decision to withdraw from the Paris climate accord.

But it's important to note that the Bloomberg's dreary outlook for coal does not hinge on generous support for clean energy. In fact, the projections assume renewable energy subsidies will go away eventually and the Paris agreement won't be achieved.

All this spells further trouble for coal, despite a small increase in jobs in recent months.

"The U.S. coal industry will continue to decline, and it will continue to shed jobs," Seth Feaster, a data analyst at the Institute for Energy Economics and Financial Analysis, wrote in a recent report. "U.S. energy markets are changing, regardless of who controls the White House and which party is in power in Congress," Feaster wrote.