Running GCM physics and dynamics on different grids: algorithm and tests