Growth of Sobolev norms for abstract linear Schrödinger equations