A model of electrodiffusion and osmotic water flow and its energetic structure