You may be thinking of Daniel F. Galouye's 1959 novella "The City of Force", which was followed by a 1963 novel (actually a prequel) called Lords of the Psychon.
The novella "The City of Force", first published in Galaxy Magazine, April 1959, was reprinted in the 1960 collection *Bodyguard and Four Other Short Novels from Galaxy, edited by H. L. Gold; you can read it for free at the Internet Archive. It was the answer to this old question.
The novel Lords of the Psychon has it own Wikipedia page, which is the source of the following stuff.
Galouye's second novel, Lords of the Psychon, is an expanded and rethought prequel to his earlier novelette, "The City of Force" (Galaxy: Apr 1959). "The City of Force" is a much shorter story in which enigmatic aliens consisting of spheres of force have conquered the Earth and set up cities in which humans live essentially like rats in the walls, a theme that was done later in novels by Ken Bulmer, Rob Chilson and William Tenn. The novelette concerns a young man who travels to one of the cities in an effort to communicate with the aliens and convince them humans are intelligent. He does so, but that only makes the invaders more determined than ever to exterminate them. Lords of the Psychon takes place much earlier and rethinks some of the background material.
The novel is set 15 years after the devastation of earth. A band of holdout soldiers remain steadfast to their military/defensive duty, and are based in a deserted junior college in the shadow of a strange, towering, alien City of Force. Wherever the aliens have established themselves, they have raised up great walled cities comprising huge buildings shaped like cylinders, pyramids, cubes, rhombohedrons, semi-transparent prisms, and balls. Electric equipment all over the earth has been shut down by the aliens, and all of human civilization has been driven back to a coal and steam-based technology. The Cities of Force are the home of the “Spheres”. They are large floating aliens that generally ignore humans except when they decide to “select” someone. Then they hover and float through the air, crackling with static electricity and hunting the selected person apparently for sport. Spheres can travel right through walls and hillsides in their pursuit of the selected people. When they finally run down the prey, they throw lightning bolts to kill the human. The Spheres also get active around the time of Horror Day, an annual event when a grid of energy forms over the earth and somehow inflicts incredible physical and mental torture on the earthlings, which takes months for the populace to recover from.
The novels starts on September 24, 1993 (at the time of writing, thirty years in the future) and Captain Geoffery Maddox, U.S. Army is leading a detail from the headquarters of the Third Army against a target. The detail consists of a retired U.S. Navy Chief Petty Officer, a Marine Corporal, a Marine Private, an Army Private, and a civilian scout. They are the members of the only known military force left on Earth, and they try to smuggle the last known atomic bomb into one of the mysterious alien structures that now dot the surface of the Earth. They desperately hope that setting off a fifty kiloton nuclear explosion can disrupt the operation of the structure and thereby lessen the effects of what is known as "Horror Day," or "H-Day".
Their plan backfires, and the city completely absorbs the fifty-kiloton explosion. The following H-Day is exceptionally bad. After a recovery period lasting a few months, the people in the nearby villages are angry at the Third Army. They believe that the alien city should be left alone, and then the aliens might leave the villagers alone. They start launching small scale attacks against the base and sniping at the soldiers. At about the same time, a stranger shows up at the military base. He has stolen something from a distant City of Force. There are many such Cities of Force scattered around the world, and together they create and support the grid that causes Horror Day. The stranger presents two glowing rings, one green and one yellow. They seem weightless and can be stretched to any size and broken to form more rings just like the original. When they are held with the green ring within the yellow one, they spew forth glowing plasma which is the basis of the alien cities. When the positions are reversed and the yellow is put inside the green, the rings re-absorb the plasma. The plasma can take any shape or color, can be accommodating or hostile, and is very hard for the soldiers to figure out. One old soldier, who used to be a scientist and is now the base's doctor, spends weeks trying to understand the rings. He makes some progress, but the scientific method can't shed to much light on how the plasma works because it takes on whatever properties the doctor wants. If he thinks it should be hard, it becomes hard. If he thinks it should be a liquid, it becomes a liquid.
Later, the doctor is found dead in his lab, hanging from a rope of plasma. Maddox thinks that while he was drunk, his subconscious mind took control of the plasma and gave him the peace he so desperately wanted for years. Apparently, the plasma can be controlled by the conscious and unconscious mind.
Maddox comes up with a solution; he takes the rings away from the base, and while completely alone, works with them trying to find out how to control the plasma. During his time away he meets a young lady named Edie, who for some time has been harboring a baby sphere. This is very surprising to Maddox, as the spheres are feared. However, this one has taken to Edie and continually follows her around. Maddox, helped by the girl's uncle, is able to observe and learn about the nature of spheres.
Maddox comes up with the theory that the plasma responds to both the conscious and the subconscious contents of the minds of those who are around it. Maddox decides that he is going to have to find a way to control his subconscious if he wants to learn to control the plasma. He works with the rings and the plasma while going through a kind of “house cleaning” of his subconscious mind and becomes better able to control the mysterious plasma. He feels that controlling the plasma is the key to destroying the Cities of Force. As he progresses in his work with the plasma, he becomes telepathic, and can telepathically communicate with Edie. They work out a plan to abandon the baby Sphere, as it has been getting bigger and more dangerous, by going to the nearby City of Force. When they get to the city they discover that they are able to affect the city with their newly concentrated minds. They can create walls, doors, and structures. Maddox isn't perfect in his control; he makes some mistakes, especially while unsuccessfully trying to protect a pregnant woman who is close to giving birth. The spheres do not allow new babies to live, and there haven't been a birth since the Spheres conquered the earth.
Maddox and Edie go back to the garrison and convince several of the soldiers to learn how to control the rings because Horror Day is soon to arrive. Maddox and Edie train the men, and soon there have a group who are telepathic, can share each other's visual impressions, and can control the plasma to some extent. Their control is imperfect, but they learn to control it enough to build an elaborate plasma structure inside their encampment.
Almost a year passes, with another H-Day is coming. During the last year, Maddox has come to the conclusion that H-day happens because the Spheres are trying to move Earth into a different dimension–reality, and the terrible effects felt on H-day are caused by being in this different place. So far the Spheres have failed to transfer the planet, but they are getting closer each year. That means that when the Spheres succeed, the effects of H-day will never end. Maddox also believes that the Spheres will succeed this year unless he and the other members of his band can do something to disrupt H-day.
The people in the surrounding villages are frightened, believing the soldiers experiments with the plasma will upset the Spheres and make H-day even worse than it was the year before. Therefore villagers organize an attack on the base, where at the same time, a band of religious fanatics also decide to attack. The soldiers can't hold their structure up against the mental hysteria of the mobs, and the Spheres join in the attack. As their plasma city of force starts to crumble, Maddox manages to use his new mental powers to transport 18 soldiers who have learned to control the plasma to 18 alien Cities of Force just as the villagers overrun their camp. H-Day commences at that very moment. Maddox can't do anymore and can only hope the men he sent out will be able to disrupt the Cities of Force and keep H-day from happening.
While experimenting with the rings Maddox found that anything put through a ring will travel in time. The distance traveled in time is controlled by how big the rings are made. Maddox and Edie decide to stretch a ring out to a large size, jump through the ring, and travel through time to the future. They end up at the same site years later where they see a statue depicting their feat and how it freed the earth from domination of the Spheres.