mom_intrinsic_functions module reference

A module with intrinsic functions that are used by MOM but are not supported by some compilers.

More…

Functions/Subroutines

invcosh()

Evaluate the inverse cosh, either using a math library or an equivalent expression.

cuberoot()

Returns the cube root of a real argument at roundoff accuracy, in a form that works properly with rescaling of the argument by integer powers of 8.

rescale_cbrt()

Rescale a to the range [0.125, 1) and compute its cube-root exponent.

descale()

Undo the rescaling of a real number back to its original base.

intrinsic_functions_unit_tests()

Returns true if any unit test of intrinsic_functions fails, or false if they all pass.

test_cuberoot()

True if the cube of cuberoot(val) does not closely match val.

Detailed Description

A module with intrinsic functions that are used by MOM but are not supported by some compilers.

Function/Subroutine Documentation

function mom_intrinsic_functions/invcosh(x) [real]

Evaluate the inverse cosh, either using a math library or an equivalent expression.

Parameters:

x :: [in] The argument of the inverse of cosh [nondim]. NaNs will occur if x<1, but there is no error checking

Called from:

mom_bkgnd_mixing::calculate_bkgnd_mixing

function mom_intrinsic_functions/cuberoot(x) [real]

Returns the cube root of a real argument at roundoff accuracy, in a form that works properly with rescaling of the argument by integer powers of 8. If the argument is a NaN, a NaN is returned.

Parameters:

x :: [in] The argument of cuberoot in arbitrary units cubed [A3]

Return:

undefined :: The real cube root of x in arbitrary units [A]

Call to:

descale rescale_cbrt

Called from:

mom_energetic_pbl::epbl_bbl_column mom_energetic_pbl::epbl_column mom_energetic_pbl::get_eqdisc_v0h mom_mixed_layer_restrat::mixedlayer_restrat_bodner test_cuberoot

subroutine mom_intrinsic_functions/rescale_cbrt(a, x, e_r, s_a)

Rescale a to the range [0.125, 1) and compute its cube-root exponent.

Parameters:
  • a :: [in] The real parameter to be rescaled for cube root in abitrary units cubed [A3]

  • x :: [out] The rescaled value of a in the range from 0.125 < asx <= 1.0, in ambiguous units cubed [B3]

  • e_r :: [out] Cube root of the exponent of the rescaling of a

  • s_a :: [out] The sign bit of a

Call to:

bias expbit explen fraclen signbit

Called from:

cuberoot

function mom_intrinsic_functions/descale(x, e_a, s_a) [real]

Undo the rescaling of a real number back to its original base.

Parameters:
  • x :: [in] The rescaled value which is to be restored in ambiguous units [B]

  • e_a :: [in] Exponent of the unscaled value

  • s_a :: [in] Sign bit of the unscaled value

Return:

undefined :: Restored value with the corrected exponent and sign in abitrary units [A]

Call to:

expbit explen signbit

Called from:

cuberoot

function mom_intrinsic_functions/intrinsic_functions_unit_tests(verbose) [logical]

Returns true if any unit test of intrinsic_functions fails, or false if they all pass.

Parameters:

verbose :: [in] If true, write results to stdout

Return:

undefined :: True if any of the unit tests fail

Call to:

test_cuberoot

Called from:

mom_unit_tests::unit_tests

function mom_intrinsic_functions/test_cuberoot(verbose, val) [logical]

True if the cube of cuberoot(val) does not closely match val. False otherwise.

Parameters:
  • verbose :: [in] If true, write results to stdout

  • val :: [in] The real value to test, in arbitrary units [A]

Call to:

cuberoot

Called from:

intrinsic_functions_unit_tests