principal_cshift_m.f90 Source File


This file depends on

sourcefile~~principal_cshift_m.f90~~EfferentGraph sourcefile~principal_cshift_m.f90 principal_cshift_m.f90 sourcefile~nrtype.f90 nrtype.f90 sourcefile~principal_cshift_m.f90->sourcefile~nrtype.f90 sourcefile~serre_mod.f90 serre_mod.f90 sourcefile~principal_cshift_m.f90->sourcefile~serre_mod.f90

Files dependent on this one

sourcefile~~principal_cshift_m.f90~~AfferentGraph sourcefile~principal_cshift_m.f90 principal_cshift_m.f90 sourcefile~fxhyp_m.f90 fxhyp_m.f90 sourcefile~fxhyp_m.f90->sourcefile~principal_cshift_m.f90 sourcefile~inigeom.f90 inigeom.f90 sourcefile~inigeom.f90->sourcefile~fxhyp_m.f90

Contents


Source Code

module principal_cshift_m

  USE dimensions_mod, ONLY: iim, jjm, llm, ndm
implicit none

contains

  subroutine principal_cshift(is2, xlon, xprimm)

    ! Add or subtract 2 pi so that xlon is near [-pi, pi], then cshift
    ! so that xlon is in ascending order. Make the same cshift on
    ! xprimm.

    use nrtype, only: twopi
    use serre_mod, only: clon


    ! for iim

    integer, intent(in):: is2
    real, intent(inout):: xlon(:), xprimm(:) ! (iim + 1)

    !-----------------------------------------------------

    if (is2 /= 0) then
       IF (clon <= 0.) THEN
          IF (is2 /= 1) THEN
             xlon(:is2 - 1) = xlon(:is2 - 1) + twopi
             xlon(:iim) = cshift(xlon(:iim), shift = is2 - 1)
             xprimm(:iim) = cshift(xprimm(:iim), shift = is2 - 1)
          END IF
       else
          xlon(is2 + 1:iim) = xlon(is2 + 1:iim) - twopi
          xlon(:iim) = cshift(xlon(:iim), shift = is2)
          xprimm(:iim) = cshift(xprimm(:iim), shift = is2)
       end IF
    end if

    xlon(iim + 1) = xlon(1) + twopi
    xprimm(iim + 1) = xprimm(1)

  end subroutine principal_cshift

end module principal_cshift_m