![]() |
MODFLOW 6
version 6.7.0.dev3
USGS Modular Hydrologic Model
|
Data Types | |
| interface | mod_offset |
| interface | f1d |
Functions/Subroutines | |
| pure logical function, public | is_close (a, b, rtol, atol, symmetric) |
| Check if a real value is approximately equal to another. More... | |
| pure integer(i4b) function | mod_offset_int (a, n, d) |
| Modulo with offset for integer values. More... | |
| pure real(dp) function | mod_offset_dbl (a, n, d) |
| Modulo with offset for double precision values. More... | |
| real(dp) function, public | zero_ch (x0, x1, f, epsa) |
| Compute zeros on an interval using Chadrupatla's method. More... | |
| real(dp) function, public | zero_br (ax, bx, f, tol) |
| Compute a zero of the function f(x) in the interval (x0, x1). More... | |
| real(dp) function, public | get_perturbation (x) |
| Calculate a numerical perturbation given the value of x. More... | |
| pure real(dp) function, dimension(:), allocatable, public | arange (start, stop, step) |
| Return reals separated by the given step over the given interval. More... | |
| pure real(dp) function, dimension(:), allocatable, public | linspace (start, stop, num) |
| Return evenly spaced reals over the given interval. More... | |
| pure real(dp) function, dimension(:), allocatable, public mathutilmodule::arange | ( | real(dp), intent(in) | start, |
| real(dp), intent(in) | stop, | ||
| real(dp), intent(in), optional | step | ||
| ) |
This function is designed to behave like NumPy's arange. Adapted from https://stackoverflow.com/a/65839162/6514033.
Definition at line 383 of file MathUtil.f90.

| real(dp) function, public mathutilmodule::get_perturbation | ( | real(dp), intent(in) | x | ) |
Calculate a perturbation value to use for a numerical derivative calculation. Taken from the book "Solving Nonlinear Equations with Newton's Method" 2003, by C.T. Kelley. Method also used in the SWR Process for MODFLOW-2005.
| [in] | x | value that will be perturbed by the result |
Definition at line 371 of file MathUtil.f90.

| pure logical function, public mathutilmodule::is_close | ( | real(dp), intent(in) | a, |
| real(dp), intent(in) | b, | ||
| real(dp), intent(in), optional | rtol, | ||
| real(dp), intent(in), optional | atol, | ||
| logical(lgp), intent(in), optional | symmetric | ||
| ) |
By default the determination is symmetric in a and b, as in Python's math.isclose, with relative difference scaled by a factor of the larger absolute value of a and b. The formula is: abs(a - b) <= max(rtol * max(abs(a), abs(b)), atol).
If symmetric is set to false the test is asymmetric in a and b, with b taken to be the reference value, and the alternate formula (abs(a - b) <= (atol + rtol * abs(b))) is used. This is the approach taken by numpy.allclose.
Defaults for rtol and atol are DSAME and DZERO, respectively. If a or b are near 0 (especially if either is 0), an absolute tolerance suitable for the particular case should be provided. For a justification of a zero absolute tolerance default see: https://peps.python.org/pep-0485/#absolute-tolerance-default
| [in] | a | first real |
| [in] | b | second real (reference value if asymmetric) |
| [in] | rtol | relative tolerance (default=DSAME) |
| [in] | atol | absolute tolerance (default=DZERO) |
| [in] | symmetric | toggle (a)symmetric comparison |
Definition at line 45 of file MathUtil.f90.

| pure real(dp) function, dimension(:), allocatable, public mathutilmodule::linspace | ( | real(dp), intent(in) | start, |
| real(dp), intent(in) | stop, | ||
| integer(i4b), intent(in) | num | ||
| ) |
This function is designed to behave like NumPy's linspace. Adapted from https://stackoverflow.com/a/57211848/6514033.
Definition at line 414 of file MathUtil.f90.
|
private |
|
private |
| real(dp) function, public mathutilmodule::zero_br | ( | real(dp) | ax, |
| real(dp) | bx, | ||
| procedure(f1d), intent(in), pointer | f, | ||
| real(dp) | tol | ||
| ) |
A zero of the function f(x) is computed in the interval ax,bx.
Input:
ax left endpoint of initial interval bx right endpoint of initial interval f function subprogram which evaluates f(x) for any x in the interval ax,bx tol desired length of the interval of uncertainty of the final result (.ge.0.)
Output:
zero_br abscissa approximating a zero of f in the interval ax,bx
it is assumed that f(ax) and f(bx) have opposite signs
this is checked, and an error message is printed if this is not satisfied. zero_br returns a zero x in the given interval ax,bx to within a tolerance 4*macheps*abs(x)+tol, where macheps is the relative machine precision defined as the smallest representable number such that 1.+macheps .gt. 1. this function subprogram is a slightly modified translation of the algol 60 procedure zero given in richard brent, algorithms for minimization without derivatives, prentice-hall, inc. (1973).
This subroutine was obtained by the authors of MODFLOW 6 from netlib.org with the understanding that it is freely available. It has subsequently undergone minor modification to suit the current application.
Definition at line 254 of file MathUtil.f90.


| real(dp) function, public mathutilmodule::zero_ch | ( | real(dp) | x0, |
| real(dp) | x1, | ||
| procedure(f1d), intent(in), pointer | f, | ||
| real(dp) | epsa | ||
| ) |
A zero of the function f{x} is computed in the interval (x0, x1) given tolerance epsa using Chandrupatla's method. FORTRAN code based generally on pseudocode in Scherer, POJ (2013) "Computational Physics: Simulation of Classical and Quantum Systems," 2nd ed., Springer, New York.
Definition at line 131 of file MathUtil.f90.
