Excess water is produced and the water spills out onto dry land as per the spells description
First we should note that Control Water is a Transmutation spell. Transmutation spells:
change the properties of a creature, object, or environment.
One of the properties of water is it's volume!
Next we need to look at the relevant sections of the spell description (emphasis mine):
Until the spell ends, you control any freestanding water inside an area you choose that is a cube up to 100 feet on a side. You can choose any of the following effects when you cast this spell. As an action on your turn you can repeat the same effect or choose a different one.
Flood. You cause the water level of all standing water in the area to rise by as much as 20 feet. If the area includes a shore, the flooding water spills over onto dry land.
If you choose an area in a large body of water, you instead create a 20-foot tall wave that travels from one side of the area to the other and then crashes down.
I've highlighted what I believe to be the key portions required to interpret this for the purposes of your question. I'll address each of them separately:
The name of this section of the spell is flood. This is evocative of excess water covering an area of normally dry land. As a result we should be leaning towards excess water doing something in our interpretations.
Until the spell ends, you control any freestanding water
The key part of this is the phrase "freestanding water". Freestanding1 2 3 4, means the water isn't supported by any external structures.
This immediately rules out the circumstances where you would "flood" a barrel or other similarly enclosed container, as the water in those containers is not "freestanding". Where the line is between "freestanding" and supported by external structures is a DM call, but water in barrels, baths or water towers are clearly not freestanding. Whether the water in a dam is freestanding however is debatable.
To further clarify this in our minds we can ask the question: If we remove a piece of whatever the water is located on/in (be it land or a container) from underneath a body of water, does it stop the body of water from remaining that body of water (eg would Lake Michigan stop being Lake Michigan if you removed a portion of land from it's shores)? The answer for freestanding bodies of water (like lakes) is categorically no. The answer for a body of water in a water tower is yes, if you removed a portion of the metal/concrete from under the water tower water it would become a series of puddles on the ground.
a cube up to 100 feet on a side
This means you can affect 1,000,000 cubic feet, or 28,316,847 litres, of water. That's a lot of water!
You cause the water level of all standing water in the area to rise by as much as 20 feet
There are two phrases we need to interpret here, "water level" and "standing water".
Standing water is water which experiences little activity or change5 6 (#2) 7 (adjective #3).
As part of your question, you asked about a river. Rivers, by definition, are not standing water as they are constantly in flux. If you think of a river, you think of a changing and moving body of water. This movement might be slow, but it is still a changing body of water. As a result, rivers aren't affected by this, unless your DM otherwise allows it.
Water level is, at is suggests, the height reached by the surface of a body of water8 9 10.
So, if the body of water you are affecting with the spell is standing water, then you raise the level of the surface of the water by as much as 20 feet (suggesting choice on behalf of the caster on the precise level it is raised by). The spell doesn't say how this happens, just that it happens. So we have a couple of options:
- The water is physically raised up to 20ft (meaning there is an equivalent gap underneath the water now)
- New water is created because magic
We'll get back to which of those two options the rules suggest it is later, but given the name of the spell section we are looking at we should be leaning towards #1.
a shore, the flooding water spills over onto dry land
A shore is the land bordering a large body of water11 12 13 14. Flooding water strongly suggests that excess water is being created in the area (at least temporarily).
Lets take the example of a puddle of water. It is freestanding, it is also standing water, as a result it can be affected by the spell. If we raise the level of this puddle by 20 ft, we either get:
- A puddle, 20 ft in the air
- The puddle growing in size and volume flooding an area
Given the fact that the spell says "the flooding water spills over onto dry land", option #1 cannot be the interpretation. If we insist on option #1, we would end up with the singular puddle being transformed into an expanding, ever thinner ring of water, until the water that used to be in the puddle disappears. This is not flooding water, this is puddle evaporation.
As a result we are inexorably drawn to option #2 in both of our choices. New water is created by the spell and that new water continuously spills out and floods the area until it's level can be raised to the level desired by the spellcaster, or the body of water becomes a "large body of water" of the purposes of the spell.
an area in a large body of water
What is a large body of water for the purposes of this spell?
Obviously, any body of water than can fit within the area of the spell cannot be considered large, for the purposes of this spell. On the flip side of that, an ocean is clearly a large body of water. Where the line is drawn is up the the DM, but this DM would use the area of the spell as a guide. If the spells volume can be entirely fit within a body of water (100ft x 100ft x 100ft), then it's a large body of water, otherwise it's not.
Answering your specific sub-questions
- If you do raise the water level above the apex of its container (say a river above its river bed or a barrel of water beyond its capacity), what happens to the excess water? The spell states:
- It floods out onto dry land, so long as the water is both freestanding and standing water
- Does the edge of an artificial container count as a "shore"?
- Not unless that edge also counts as "land". The edge of a barrel is clearly not land, but the side of a dam might be considered such (see Hoover Dam). Ask the DM.
- If not, what happens to a filled container when the water level rises 20 feet?
- If it's in an artificial container whose sides do not count as a shore its not freestanding and thus not affected by the spell unless the DM makes an exception to the ruling.
- If it does count as a shore, does the water fill the external space 20 feet above the apex, or is the expected volume of water conserved (as if the apex had been 20 feet higher)?
- The volume of water is not conserved, new water is created, and water will fill the external space so long as it is supported on its sides by land (or structures large enough to be considered land). For example a well containing water, you can raise the water level up to the lip of the well, before it starts spilling out and over the sides of the well.