dyn_mpas_procedure Module

This module provides standardized procedures (i.e., functions and subroutines) that serve as reusable building blocks for larger and more complex functionalities elsewhere.

Computational procedures implement formulas that are universal in atmospheric sciences. They should be designated as elemental where possible to aid compiler optimizations, such as vectorization. Utility procedures implement simple and well-defined operations that can be easily tested.


Used by


Interfaces

public interface almost_divisible

  • private pure elemental function almost_divisible_real32(a, b) result(almost_divisible)

    Test if a is divisible by b, where a and b are both reals. (KCW, 2024-05-25)

    Arguments

    Type IntentOptional Attributes Name
    real(kind=real32), intent(in) :: a
    real(kind=real32), intent(in) :: b

    Return Value logical

  • private pure elemental function almost_divisible_real64(a, b) result(almost_divisible)

    Test if a is divisible by b, where a and b are both reals. (KCW, 2024-05-25)

    Arguments

    Type IntentOptional Attributes Name
    real(kind=real64), intent(in) :: a
    real(kind=real64), intent(in) :: b

    Return Value logical

public interface almost_equal

  • private pure elemental function almost_equal_real32(a, b, absolute_tolerance, relative_tolerance) result(almost_equal)

    Test a and b for approximate equality, where a and b are both reals. (KCW, 2024-05-25)

    Arguments

    Type IntentOptional Attributes Name
    real(kind=real32), intent(in) :: a
    real(kind=real32), intent(in) :: b
    real(kind=real32), intent(in), optional :: absolute_tolerance
    real(kind=real32), intent(in), optional :: relative_tolerance

    Return Value logical

  • private pure elemental function almost_equal_real64(a, b, absolute_tolerance, relative_tolerance) result(almost_equal)

    Test a and b for approximate equality, where a and b are both reals. (KCW, 2024-05-25)

    Arguments

    Type IntentOptional Attributes Name
    real(kind=real64), intent(in) :: a
    real(kind=real64), intent(in) :: b
    real(kind=real64), intent(in), optional :: absolute_tolerance
    real(kind=real64), intent(in), optional :: relative_tolerance

    Return Value logical

public interface clamp

  • private pure elemental function clamp_int32(x, xmin, xmax) result(clamp)

    Clamp/Limit the value of x to the range of [xmin, xmax], where x, xmin, and xmax are all integers. No check is performed to ensure xmin < xmax. (KCW, 2025-07-16)

    Arguments

    Type IntentOptional Attributes Name
    integer(kind=int32), intent(in) :: x
    integer(kind=int32), intent(in) :: xmin
    integer(kind=int32), intent(in) :: xmax

    Return Value integer(kind=int32)

  • private pure elemental function clamp_int64(x, xmin, xmax) result(clamp)

    Clamp/Limit the value of x to the range of [xmin, xmax], where x, xmin, and xmax are all integers. No check is performed to ensure xmin < xmax. (KCW, 2025-07-16)

    Arguments

    Type IntentOptional Attributes Name
    integer(kind=int64), intent(in) :: x
    integer(kind=int64), intent(in) :: xmin
    integer(kind=int64), intent(in) :: xmax

    Return Value integer(kind=int64)

  • private pure elemental function clamp_real32(x, xmin, xmax) result(clamp)

    Clamp/Limit the value of x to the range of [xmin, xmax], where x, xmin, and xmax are all reals. No check is performed to ensure xmin < xmax. (KCW, 2025-07-16)

    Arguments

    Type IntentOptional Attributes Name
    real(kind=real32), intent(in) :: x
    real(kind=real32), intent(in) :: xmin
    real(kind=real32), intent(in) :: xmax

    Return Value real(kind=real32)

  • private pure elemental function clamp_real64(x, xmin, xmax) result(clamp)

    Clamp/Limit the value of x to the range of [xmin, xmax], where x, xmin, and xmax are all reals. No check is performed to ensure xmin < xmax. (KCW, 2025-07-16)

    Arguments

    Type IntentOptional Attributes Name
    real(kind=real64), intent(in) :: x
    real(kind=real64), intent(in) :: xmin
    real(kind=real64), intent(in) :: xmax

    Return Value real(kind=real64)


Functions

private pure elemental function almost_divisible_real32(a, b) result(almost_divisible)

Test if a is divisible by b, where a and b are both reals. (KCW, 2024-05-25)

Arguments

Type IntentOptional Attributes Name
real(kind=real32), intent(in) :: a
real(kind=real32), intent(in) :: b

Return Value logical

private pure elemental function almost_divisible_real64(a, b) result(almost_divisible)

Test if a is divisible by b, where a and b are both reals. (KCW, 2024-05-25)

Arguments

Type IntentOptional Attributes Name
real(kind=real64), intent(in) :: a
real(kind=real64), intent(in) :: b

Return Value logical

private pure elemental function almost_equal_real32(a, b, absolute_tolerance, relative_tolerance) result(almost_equal)

Test a and b for approximate equality, where a and b are both reals. (KCW, 2024-05-25)

Arguments

Type IntentOptional Attributes Name
real(kind=real32), intent(in) :: a
real(kind=real32), intent(in) :: b
real(kind=real32), intent(in), optional :: absolute_tolerance
real(kind=real32), intent(in), optional :: relative_tolerance

Return Value logical

private pure elemental function almost_equal_real64(a, b, absolute_tolerance, relative_tolerance) result(almost_equal)

Test a and b for approximate equality, where a and b are both reals. (KCW, 2024-05-25)

Arguments

Type IntentOptional Attributes Name
real(kind=real64), intent(in) :: a
real(kind=real64), intent(in) :: b
real(kind=real64), intent(in), optional :: absolute_tolerance
real(kind=real64), intent(in), optional :: relative_tolerance

Return Value logical

private pure elemental function clamp_int32(x, xmin, xmax) result(clamp)

Clamp/Limit the value of x to the range of [xmin, xmax], where x, xmin, and xmax are all integers. No check is performed to ensure xmin < xmax. (KCW, 2025-07-16)

Arguments

Type IntentOptional Attributes Name
integer(kind=int32), intent(in) :: x
integer(kind=int32), intent(in) :: xmin
integer(kind=int32), intent(in) :: xmax

Return Value integer(kind=int32)

private pure elemental function clamp_int64(x, xmin, xmax) result(clamp)

Clamp/Limit the value of x to the range of [xmin, xmax], where x, xmin, and xmax are all integers. No check is performed to ensure xmin < xmax. (KCW, 2025-07-16)

Arguments

Type IntentOptional Attributes Name
integer(kind=int64), intent(in) :: x
integer(kind=int64), intent(in) :: xmin
integer(kind=int64), intent(in) :: xmax

Return Value integer(kind=int64)

private pure elemental function clamp_real32(x, xmin, xmax) result(clamp)

Clamp/Limit the value of x to the range of [xmin, xmax], where x, xmin, and xmax are all reals. No check is performed to ensure xmin < xmax. (KCW, 2025-07-16)

Arguments

Type IntentOptional Attributes Name
real(kind=real32), intent(in) :: x
real(kind=real32), intent(in) :: xmin
real(kind=real32), intent(in) :: xmax

Return Value real(kind=real32)

private pure elemental function clamp_real64(x, xmin, xmax) result(clamp)

Clamp/Limit the value of x to the range of [xmin, xmax], where x, xmin, and xmax are all reals. No check is performed to ensure xmin < xmax. (KCW, 2025-07-16)

Arguments

Type IntentOptional Attributes Name
real(kind=real64), intent(in) :: x
real(kind=real64), intent(in) :: xmin
real(kind=real64), intent(in) :: xmax

Return Value real(kind=real64)

public pure function index_unique(array)

Return the index of unique elements in array, which can be any intrinsic data types, as an integer array. If array contains zero element or is of unsupported data types, an empty integer array is produced. For example, index_unique([1, 2, 3, 1, 2, 3, 4, 5]) returns [1, 2, 3, 7, 8]. (KCW, 2024-03-22)

Arguments

Type IntentOptional Attributes Name
class(*), intent(in) :: array(:)

Return Value integer, allocatable, (:)

public pure function stringify(value, separator)

Convert one or more values of any intrinsic data types to a character string for pretty printing. If value contains more than one element, the elements will be stringified, delimited by separator, then concatenated. If value contains exactly one element, the element will be stringified without using separator. If value contains zero element or is of unsupported data types, an empty character string is produced. If separator is not supplied, it defaults to ", " (i.e., a comma and a space). (KCW, 2024-02-04)

Arguments

Type IntentOptional Attributes Name
class(*), intent(in) :: value(:)
character(len=*), intent(in), optional :: separator

Return Value character(len=:), allocatable