MOM6
mom_checksums::is_nan Interface Reference

Detailed Description

Returns .true. if any element of x is a NaN, and .false. otherwise.

Definition at line 73 of file MOM_checksums.F90.

Private functions

logical function is_nan_0d (x)
 This function returns .true. if x is a NaN, and .false. otherwise. More...
 
logical function is_nan_1d (x, skip_mpp)
 Returns .true. if any element of x is a NaN, and .false. otherwise. More...
 
logical function is_nan_2d (x)
 Returns .true. if any element of x is a NaN, and .false. otherwise. More...
 
logical function is_nan_3d (x)
 Returns .true. if any element of x is a NaN, and .false. otherwise. More...
 

Functions and subroutines

◆ is_nan_0d()

logical function mom_checksums::is_nan::is_nan_0d ( real, intent(in)  x)
private

This function returns .true. if x is a NaN, and .false. otherwise.

Parameters
[in]xThe value to be checked for NaNs.

Definition at line 1666 of file MOM_checksums.F90.

1666  real, intent(in) :: x !< The value to be checked for NaNs.
1667  logical :: is_NaN_0d
1668 
1669  !is_NaN_0d = (((x < 0.0) .and. (x >= 0.0)) .or. &
1670  ! (.not.(x < 0.0) .and. .not.(x >= 0.0)))
1671  if (((x < 0.0) .and. (x >= 0.0)) .or. &
1672  (.not.(x < 0.0) .and. .not.(x >= 0.0))) then
1673  is_nan_0d = .true.
1674  else
1675  is_nan_0d = .false.
1676  endif
1677 

◆ is_nan_1d()

logical function mom_checksums::is_nan::is_nan_1d ( real, dimension(:), intent(in)  x,
logical, intent(in), optional  skip_mpp 
)
private

Returns .true. if any element of x is a NaN, and .false. otherwise.

Parameters
[in]xThe array to be checked for NaNs.
[in]skip_mppIf true, only check this array only on the local PE (default false).

Definition at line 1682 of file MOM_checksums.F90.

1682  real, dimension(:), intent(in) :: x !< The array to be checked for NaNs.
1683  logical, optional, intent(in) :: skip_mpp !< If true, only check this array only
1684  !! on the local PE (default false).
1685  logical :: is_NaN_1d
1686 
1687  integer :: i, n
1688  logical :: call_mpp
1689 
1690  n = 0
1691  do i = lbound(x,1), ubound(x,1)
1692  if (is_nan_0d(x(i))) n = n + 1
1693  enddo
1694  call_mpp = .true.
1695  if (present(skip_mpp)) call_mpp = .not.skip_mpp
1696 
1697  if (call_mpp) call sum_across_pes(n)
1698  is_nan_1d = .false.
1699  if (n>0) is_nan_1d = .true.
1700 

◆ is_nan_2d()

logical function mom_checksums::is_nan::is_nan_2d ( real, dimension(:,:), intent(in)  x)
private

Returns .true. if any element of x is a NaN, and .false. otherwise.

Parameters
[in]xThe array to be checked for NaNs.

Definition at line 1705 of file MOM_checksums.F90.

1705  real, dimension(:,:), intent(in) :: x !< The array to be checked for NaNs.
1706  logical :: is_NaN_2d
1707 
1708  integer :: i, j, n
1709 
1710  n = 0
1711  do j = lbound(x,2), ubound(x,2) ; do i = lbound(x,1), ubound(x,1)
1712  if (is_nan_0d(x(i,j))) n = n + 1
1713  enddo ; enddo
1714  call sum_across_pes(n)
1715  is_nan_2d = .false.
1716  if (n>0) is_nan_2d = .true.
1717 

◆ is_nan_3d()

logical function mom_checksums::is_nan::is_nan_3d ( real, dimension(:,:,:), intent(in)  x)
private

Returns .true. if any element of x is a NaN, and .false. otherwise.

Parameters
[in]xThe array to be checked for NaNs.

Definition at line 1722 of file MOM_checksums.F90.

1722  real, dimension(:,:,:), intent(in) :: x !< The array to be checked for NaNs.
1723  logical :: is_NaN_3d
1724 
1725  integer :: i, j, k, n
1726 
1727  n = 0
1728  do k = lbound(x,3), ubound(x,3)
1729  do j = lbound(x,2), ubound(x,2) ; do i = lbound(x,1), ubound(x,1)
1730  if (is_nan_0d(x(i,j,k))) n = n + 1
1731  enddo ; enddo
1732  enddo
1733  call sum_across_pes(n)
1734  is_nan_3d = .false.
1735  if (n>0) is_nan_3d = .true.
1736 

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