The thing that makes default:water_source behave that way is the property "liquid_renewable = true", if you override that to be false water will no longer "self-replicate" (lava already behaves this way if you want to see an example). I had to do this in my dynamic_liquid mod [here](https://github.com/minetest-mods/dynami ... t.lua#L173
). You might potentially not need to mess with this, though, if you are removing all of the water on a particular y-coordinate fast enough. I'd set it to false for now while you're getting the rest of the mod to work and then see if you still need it once you're done.
Taking a quick look at the rest of the mod, I take it the idea here is that depending on the particular time of day you want to destroy the uppermost layers of water in the ocean at certain times of the day and then recreate them again on the other times? There's going to be some tricky edge cases to overcome here no matter how you approach this, but that's part of the fun of making mods. :)
Using minetest.register_globalstep is the correct approach to modifying the mapblocks that a player is currently in to account for time changing "before his eyes", IMO. To update blocks that a player enters into that were last left in a state other than the way it should be now (for example, it's low tide and the player has just entered a mapblock that was left in a high-tide state) I recommend using an LBM instead - look up LoadingBlockModifier in the api documentation, you'll want one with run_at_every_load = true and set to execute on water nodes.
That works well for making the water level go down when tide goes out, but making the water come back *up* again is more challenging. You'll need some way to figure out where water is supposed to be - if you just indiscriminately fill the entire y-coordinate's air layer with water you'll inundate the caves and any holes the player might have dug.
Unfortunately, I don't think the heightmap for most mapgens is not available after the map block has been generated. And you probably wouldn't want to rely on that anyway in case a player has built a dike and cleared water out of the area. I think what you'll need to do is look for existing water on the level below the one you're trying to fill, check if the water has a clear path through existing water to the edge of the mapblock (to avoid having isolated ponds rising and falling), place new water above it, and then do a flood-fill operation from the edge of that water to make it spread outward. There's still ways this can cause non-ocean water to rise and fall but I expect it'll be fairly rare and maybe not worth worrying about.
If you like the sound of that idea and nobody has better suggestions I could whip up some example code to show it in more detail.