MOM6
mom_array_transform::rotate_vector Interface Reference

Detailed Description

Rotate an array pair representing the components of a vector. Rotation is applied across the first and second axes of the array. This rotation should be applied when the fields satisfy vector transformation rules. For example, the u and v components of a velocity will map from one to the other for quarter turns, with a sign change in one component. A half turn will map elements onto themselves with sign changes in both components.

Definition at line 55 of file MOM_array_transform.F90.

Private functions

subroutine rotate_vector_real_2d (A_in, B_in, turns, A, B)
 Rotate the elements of a 2d real vector along first and second axes. More...
 
subroutine rotate_vector_real_3d (A_in, B_in, turns, A, B)
 Rotate the elements of a 3d real vector along first and second axes. More...
 
subroutine rotate_vector_real_4d (A_in, B_in, turns, A, B)
 Rotate the elements of a 4d real vector along first and second axes. More...
 

Detailed Description

Rotate an array pair representing the components of a vector. Rotation is applied across the first and second axes of the array. This rotation should be applied when the fields satisfy vector transformation rules. For example, the u and v components of a velocity will map from one to the other for quarter turns, with a sign change in one component. A half turn will map elements onto themselves with sign changes in both components.

Definition at line 55 of file MOM_array_transform.F90.

Functions and subroutines

◆ rotate_vector_real_2d()

subroutine mom_array_transform::rotate_vector::rotate_vector_real_2d ( real, dimension(:,:), intent(in)  A_in,
real, dimension(:,:), intent(in)  B_in,
integer, intent(in)  turns,
real, dimension(:,:), intent(out)  A,
real, dimension(:,:), intent(out)  B 
)
private

Rotate the elements of a 2d real vector along first and second axes.

Parameters
[in]a_inFirst component of unrotated vector
[in]b_inSecond component of unrotated vector
[in]turnsNumber of quarter turns
[out]aFirst component of rotated vector
[out]bSecond component of unrotated vector

Definition at line 231 of file MOM_array_transform.F90.

231  real, intent(in) :: A_in(:,:) !< First component of unrotated vector
232  real, intent(in) :: B_in(:,:) !< Second component of unrotated vector
233  integer, intent(in) :: turns !< Number of quarter turns
234  real, intent(out) :: A(:,:) !< First component of rotated vector
235  real, intent(out) :: B(:,:) !< Second component of unrotated vector
236 
237  call rotate_array_pair(a_in, b_in, turns, a, b)
238 
239  if (modulo(turns, 4) == 1 .or. modulo(turns, 4) == 2) &
240  a(:,:) = -a(:,:)
241 
242  if (modulo(turns, 4) == 2 .or. modulo(turns, 4) == 3) &
243  b(:,:) = -b(:,:)

◆ rotate_vector_real_3d()

subroutine mom_array_transform::rotate_vector::rotate_vector_real_3d ( real, dimension(:,:,:), intent(in)  A_in,
real, dimension(:,:,:), intent(in)  B_in,
integer, intent(in)  turns,
real, dimension(:,:,:), intent(out)  A,
real, dimension(:,:,:), intent(out)  B 
)
private

Rotate the elements of a 3d real vector along first and second axes.

Parameters
[in]a_inFirst component of unrotated vector
[in]b_inSecond component of unrotated vector
[in]turnsNumber of quarter turns
[out]aFirst component of rotated vector
[out]bSecond component of unrotated vector

Definition at line 249 of file MOM_array_transform.F90.

249  real, intent(in) :: A_in(:,:,:) !< First component of unrotated vector
250  real, intent(in) :: B_in(:,:,:) !< Second component of unrotated vector
251  integer, intent(in) :: turns !< Number of quarter turns
252  real, intent(out) :: A(:,:,:) !< First component of rotated vector
253  real, intent(out) :: B(:,:,:) !< Second component of unrotated vector
254 
255  integer :: k
256 
257  do k = 1, size(a_in, 3)
258  call rotate_vector(a_in(:,:,k), b_in(:,:,k), turns, a(:,:,k), b(:,:,k))
259  enddo

◆ rotate_vector_real_4d()

subroutine mom_array_transform::rotate_vector::rotate_vector_real_4d ( real, dimension(:,:,:,:), intent(in)  A_in,
real, dimension(:,:,:,:), intent(in)  B_in,
integer, intent(in)  turns,
real, dimension(:,:,:,:), intent(out)  A,
real, dimension(:,:,:,:), intent(out)  B 
)
private

Rotate the elements of a 4d real vector along first and second axes.

Parameters
[in]a_inFirst component of unrotated vector
[in]b_inSecond component of unrotated vector
[in]turnsNumber of quarter turns
[out]aFirst component of rotated vector
[out]bSecond component of unrotated vector

Definition at line 265 of file MOM_array_transform.F90.

265  real, intent(in) :: A_in(:,:,:,:) !< First component of unrotated vector
266  real, intent(in) :: B_in(:,:,:,:) !< Second component of unrotated vector
267  integer, intent(in) :: turns !< Number of quarter turns
268  real, intent(out) :: A(:,:,:,:) !< First component of rotated vector
269  real, intent(out) :: B(:,:,:,:) !< Second component of unrotated vector
270 
271  integer :: n
272 
273  do n = 1, size(a_in, 4)
274  call rotate_vector(a_in(:,:,:,n), b_in(:,:,:,n), turns, &
275  a(:,:,:,n), b(:,:,:,n))
276  enddo

The documentation for this interface was generated from the following file: