fix: missed changes for test_diag_yaml
[FMS.git] / constants / fmsconstants.F90
blob6734f8816684d59644db74ef108d47613ce8f79b
1 !***********************************************************************
2 !*                   GNU Lesser General Public License
3 !*
4 !* This file is part of the GFDL Flexible Modeling System (FMS).
5 !*
6 !* FMS is free software: you can redistribute it and/or modify it under
7 !* the terms of the GNU Lesser General Public License as published by
8 !* the Free Software Foundation, either version 3 of the License, or (at
9 !* your option) any later version.
11 !* FMS is distributed in the hope that it will be useful, but WITHOUT
12 !* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 !* FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14 !* for more details.
16 !* You should have received a copy of the GNU Lesser General Public
17 !* License along with FMS.  If not, see <http://www.gnu.org/licenses/>.
18 !***********************************************************************
19 !> @defgroup fmsconstants FMSConstants
20 !> @ingroup libfms
21 !> @brief Defines useful constants for Earth. Constants are defined as real
23 !>    FMSconstants have been declared as REAL(kind=sizeof(rvar)), PARAMETER.
25 !!    The value of a constant defined and used from here cannot be changed
26 !!    in a users program. New constants can be defined in terms of values
27 !!    from the FMSconstants module and their includes using a parameter
28 !!    statement.<br><br>
30 !!    The currently support contant systems are:
31 !!       GFDL constants (gfdl_constants.fh)
32 !!       GEOS constants (geos_constants.fh)
33 !!       GFS  constants (gfs_constants.fh)
34 !!       <br><br>
36 !!    The name given to a particular constant may be changed.<br><br>
38 !!    Constants can only be used on the right side on an assignment statement
39 !!    (their value can not be reassigned).
41 !!    Example:
43 !! @verbatim
44 !!    use FMSConstants, only:  TFREEZE, grav_new => GRAV
45 !!    real, parameter :: grav_inv = 1.0 / grav_new
46 !!    tempc(:,:,:) = tempk(:,:,:) - TFREEZE
47 !!    geopotential(:,:) = height(:,:) * grav_new
48 !! @endverbatim
49 !> @file
50 !> @brief File for @ref FMSconstants_mod
52 !> @addtogroup FMSconstants_mod
53 !> @{
54 module FMSconstants
56   use platform_mod, only: r4_kind, r8_kind
58   !--- default scoping
59   implicit none
61   !--- needed with implicit none
62   real :: dum  !< dummy real variable
64 #define RKIND sizeof(dum)
66 !--- set a default for the FMSConstants
67 #if !defined(GFDL_CONSTANTS) && !defined(GFS_CONSTANTS) && !defined(GEOS_CONSTANTS)
68 #define GFDL_CONSTANTS
69 #endif
71 !--- perform error checking and include the correct system of constants
72 #if defined(GFDL_CONSTANTS) && !defined(GFS_CONSTANTS) && !defined(GEOS_CONSTANTS)
73 #warning "Using GFDL constants"
74 #include <gfdl_constants.fh>
75 #elif !defined(GFDL_CONSTANTS) && defined(GFS_CONSTANTS) && !defined(GEOS_CONSTANTS)
76 #warning "Using GFS constants"
77 #include <gfs_constants.fh>
78 #elif !defined(GFDL_CONSTANTS) && !defined(GFS_CONSTANTS) && defined(GEOS_CONSTANTS)
79 #warning "Using GEOS constants"
80 #include <geos_constants.fh>
81 #else
82 #error FATAL FMSConstants error -  multiple constants macros are defined for FMS
83 #endif
85   !--- public interfaces
86   public :: FMSConstants_init
88   contains
90     !> @brief FMSconstants init routine
91     subroutine FMSconstants_init
92       use mpp_mod, only: stdlog
93       integer :: logunit
94       logunit = stdlog()
96       write (logunit,'(/,80("="),/(a))') trim(constants_version)
98     end subroutine FMSconstants_init
100 end module FMSconstants
101 !> @}
102 ! close documentation grouping