Consistent nomenclature: Phi_X, Phi_Y or Phi_1, Phi_2?
The code uses variables Phi_X and Phi_Y for the twist on the boundaries, but those directions (x and y) have otherwise been defined by the indices 1 and 2. We might want to make this consistent at some point.