Thermohaline circulation and interaction between ice shelf cavities and the adjacent open ocean