MODFLOW 6  version 6.6.0.dev0
USGS Modular Hydrologic Model
kind.f90
Go to the documentation of this file.
1 !> @brief This module defines variable data types
2 !!
3 !! This module defines the precision of logical, integer, long integer,
4 !! and real data types used in MODFLOW 6 and are available to all other
5 !! modules.
6 !!
7 !<
8 module kindmodule
9  use, intrinsic :: iso_fortran_env, only: i4b => int32, &
10  &i8b => int64, &
11  &lgp => int32, &
12  &dp => real64
13 
14  implicit none
15 
16  public :: i4b, i8b, lgp, dp, write_kindinfo
17 
18 contains
19 
20  !> @brief Write variable data types
21  !!
22  !! This subroutine writes the precision of logical, integer, long integer,
23  !! and real data types used in MODFLOW 6.
24  !!
25  !<
26  subroutine write_kindinfo(iout)
27  ! -- dummy variables
28  integer(I4B), intent(in) :: iout !< file unit to output kind variables
29  ! -- local variables
30  integer(LGP) :: ldum = 0
31  integer(I4B) :: idum = 0
32  integer(I8B) :: long_idum = 0
33  integer(DP) :: irdum = 0 ! for bit size of real variables
34  real(dp) :: rdum = 0._dp
35  !
36  ! -- write kind information
37  write (iout, '(/a)') 'Real Variables'
38  write (iout, '(2x,a,i0)') 'KIND: ', dp
39  write (iout, '(2x,a,1pg15.6)') 'TINY (smallest non-zero value): ', &
40  tiny(rdum)
41  write (iout, '(2x,a,1pg15.6)') 'HUGE (largest value): ', huge(rdum)
42  write (iout, '(2x,a,i0)') 'PRECISION: ', precision(rdum)
43  write (iout, '(2x,a,i0)') 'SIZE IN BITS: ', bit_size(irdum)
44 
45  write (iout, '(/a)') 'Integer Variables'
46  write (iout, '(2x,a,i0)') 'KIND: ', i4b
47  write (iout, '(2x,a,i0)') 'HUGE (largest value): ', huge(idum)
48  write (iout, '(2x,a,i0)') 'SIZE IN BITS: ', bit_size(idum)
49 
50  write (iout, '(/a)') 'Long Integer Variables'
51  write (iout, '(2x,a,i0)') 'KIND: ', i8b
52  write (iout, '(2x,a,i0)') 'HUGE (largest value): ', huge(long_idum)
53  write (iout, '(2x,a,i0)') 'SIZE IN BITS: ', bit_size(long_idum)
54 
55  write (iout, '(/a)') 'Logical Variables'
56  write (iout, '(2x,a,i0)') 'KIND: ', lgp
57  write (iout, '(2x,a,i0)') 'SIZE IN BITS: ', bit_size(ldum)
58  end subroutine write_kindinfo
59 
60 end module kindmodule
This module defines variable data types.
Definition: kind.f90:8
subroutine, public write_kindinfo(iout)
Write variable data types.
Definition: kind.f90:27