% arakawa.s % % Purpose: Arakawa grid conversion % Copyright: R.A. van Engelen, Leiden University, 1997 % % Use after importing fdm.sinclude fdm.%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Convertable operators (operator result can be converted) % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%- X isa convertable_op_for(grid).X + Y isa convertable_op_for(grid).X - Y isa convertable_op_for(grid).X * Y isa convertable_op_for(grid).X / Y isa convertable_op_for(grid).X ^ Y isa convertable_op_for(grid).X max Y isa convertable_op_for(grid).X min Y isa convertable_op_for(grid).log(X) isa convertable_op_for(grid).protect((X :: T)) :: T := X.protect(X) latex precedence(none); "\overbrace", X, "^{\rm protect}".%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Arakawa grid conversion % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%ave((_G2512:: real ~ Unit), (_G2515:: coordinate)) :: real ~ Unit.ave arity 2 is (stencil_op and

linear and

abstraction_of(grid, choices = ( ave_g

, ave_h

, ave_c

))

).ave(E, X) latex precedence(none); "\overline{", E, "}^", X.ave_g arity 2 is stencil_op and linear and self_commuting.ave_h arity 2 is stencil_op and linear and self_commuting.ave_c arity 2 is stencil_op and linear and self_commuting.ave_g(_G2509, x) is converter_of(grid).ave_g(_G2509, y) is converter_of(grid).ave_g(_G2509, z) is converter_of(grid).ave_h(_G2509, x) is converter_of(grid).ave_h(_G2509, y) is converter_of(grid).ave_h(_G2509, z) is converter_of(grid).ave_g((_G2513:: field x(grid)), x) :: field x(half).ave_h((_G2513:: field x(half)), x) :: field x(grid).ave_c((_G2513:: field x(grid)), x) :: field x(grid).ave_g((_G2513:: field y(grid)), y) :: field y(half).ave_h((_G2513:: field y(half)), y) :: field y(grid).ave_c((_G2513:: field y(grid)), y) :: field y(grid).ave_g((_G2513:: field z(grid)), z) :: field z(half).ave_h((_G2513:: field z(half)), z) :: field z(grid).ave_c((_G2513:: field z(grid)), z) :: field z(grid).(ave_g((E :: real ~ Unit), X) ::

real ~ Unit := 1 / 2 * (E + E @ (X = X + 1)))

.(ave_h((E :: real ~ Unit), X) ::

real ~ Unit := 1 / 2 * (E @ (X = X - 1) + E))

.(ave_c((E :: real ~ Unit), X) ::

real ~ Unit := 1 / 2 * (E @ (X = X - 1) + E @ (X = X + 1)))

.ave_g(E, X) latex precedence(none); "\overline{", E, "}^{", X, "_+}".ave_h(E, X) latex precedence(none); "\overline{", E, "}^{", X, "_-}".ave_c(E, X) latex precedence(none); "\overline{", E, "}^{2", X, "}".