Skip to content

Commit

Permalink
chore: change fortran header file extenstions from .h to .fh (#1087)
Browse files Browse the repository at this point in the history
  • Loading branch information
mcallic2 authored Dec 23, 2022
1 parent c3c56c9 commit 203c8bf
Show file tree
Hide file tree
Showing 86 changed files with 787 additions and 671 deletions.
8 changes: 4 additions & 4 deletions constants/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ noinst_LTLIBRARIES = libconstants.la
# The convenience library depends on its source.
libconstants_la_SOURCES = \
fmsconstants.F90 \
gfdl_constants.h \
gfs_constants.h \
geos_constants.h \
gfdl_constants.fh \
gfs_constants.fh \
geos_constants.fh \
constants.F90

FMSconstants.$(FC_MODEXT): gfdl_constants.h gfs_constants.h geos_constants.h
FMSconstants.$(FC_MODEXT): gfdl_constants.fh gfs_constants.fh geos_constants.fh
constants_mod.$(FC_MODEXT): fmsconstants.$(FC_MODEXT)

# Mod files are built and then installed as headers
Expand Down
12 changes: 6 additions & 6 deletions constants/fmsconstants.F90
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
!! statement.<br><br>
!!
!! The currently support contant systems are:
!! GFDL constants (gfdl_constants.h)
!! GEOS constants (geos_constants.h)
!! GFS constants (gfs_constants.h)
!! GFDL constants (gfdl_constants.fh)
!! GEOS constants (geos_constants.fh)
!! GFS constants (gfs_constants.fh)
!! <br><br>
!!
!! The name given to a particular constant may be changed.<br><br>
Expand Down Expand Up @@ -71,13 +71,13 @@ module FMSconstants
!--- perform error checking and include the correct system of constants
#if defined(GFDL_CONSTANTS) && !defined(GFS_CONSTANTS) && !defined(GEOS_CONSTANTS)
#warning "Using GFDL constants"
#include <gfdl_constants.h>
#include <gfdl_constants.fh>
#elif !defined(GFDL_CONSTANTS) && defined(GFS_CONSTANTS) && !defined(GEOS_CONSTANTS)
#warning "Using GFS constants"
#include <gfs_constants.h>
#include <gfs_constants.fh>
#elif !defined(GFDL_CONSTANTS) && !defined(GFS_CONSTANTS) && defined(GEOS_CONSTANTS)
#warning "Using GEOS constants"
#include <geos_constants.h>
#include <geos_constants.fh>
#else
#error FATAL FMSConstants error - multiple constants macros are defined for FMS
#endif
Expand Down
60 changes: 38 additions & 22 deletions constants/geos_constants.h → constants/geos_constants.fh
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,14 @@ character(len=18), public, parameter :: constants_version = 'FMSConstants: GEOS'
real(kind=RKIND), public, parameter :: small_fac = 1._r8_kind

!--- Spherical coordinate conversion constants
real(kind=r8_kind), public, parameter :: PI_8 = 3.14159265358979323846_r8_kind !< Ratio of circle circumference to diameter [N/A]
real(kind=RKIND), public, parameter :: PI = PI_8 !< Ratio of circle circumference to diameter [N/A]
real(kind=r8_kind), public, parameter :: PI_8 = 3.14159265358979323846_r8_kind !< Ratio of circle circumference
!! to diameter [N/A]
real(kind=RKIND), public, parameter :: PI = PI_8 !< Ratio of circle circumference
!! to diameter [N/A]
real(kind=RKIND), public, parameter :: RAD_TO_DEG = 180._r8_kind/PI_8 !< Degrees per radian [deg/rad]
real(kind=RKIND), public, parameter :: DEG_TO_RAD = PI_8/180._r8_kind !< Radians per degree [rad/deg]
real(kind=RKIND), public, parameter :: RADIAN = RAD_TO_DEG !< Equal to RAD_TO_DEG for backward compatability. [rad/deg]
real(kind=RKIND), public, parameter :: RADIAN = RAD_TO_DEG !< Equal to RAD_TO_DEG for backward
!!compatability. [rad/deg]

!--- Earth physical constants
real(kind=RKIND), public, parameter :: RADIUS = 6371.0E3_r8_kind !< Radius of the Earth [m]
Expand All @@ -39,7 +42,8 @@ real(kind=RKIND), public, parameter :: SECONDS_PER_MINUTE = 60._r8_kind !

!--- Various gas constants
real(kind=RKIND), public, parameter :: RDGAS = 8314.47 /28.965 !< Gas constant for dry air [J/kg/deg]
real(kind=RKIND), public, parameter :: RVGAS = 8314.47 /18.015 !< Gas constant for water vapor [J/kg/deg]
real(kind=RKIND), public, parameter :: RVGAS = 8314.47 /18.015 !< Gas constant for water vapor
!! [J/kg/deg]
real(kind=RKIND), public, parameter :: HLV = 2.4665E6_r8_kind !< Latent heat of evaporation [J/kg]
real(kind=RKIND), public, parameter :: HLF = 3.3370E5_r8_kind !< Latent heat of fusion [J/kg]
real(kind=RKIND), public, parameter :: HLS = HLV + HLF !< Latent heat of sublimation [J/kg]
Expand All @@ -48,30 +52,38 @@ real(kind=RKIND), public, parameter :: CP_AIR = RDGAS/KAPPA !< S
!! at constant pressure [J/kg/deg]
real(kind=RKIND), public, parameter :: CP_VAPOR = 4.0_r8_kind*RVGAS !< Specific heat capacity of water vapor
!! at constant pressure [J/kg/deg]
real(kind=RKIND), public, parameter :: CP_OCEAN = 3989.24495292815_r8_kind !< Specific heat capacity taken from McDougall (2002)
real(kind=RKIND), public, parameter :: CP_OCEAN = 3989.24495292815_r8_kind !< Specific heat capacity taken
!! from McDougall (2002)
!! "Potential Enthalpy ..." [J/kg/deg]
real(kind=RKIND), public, parameter :: DENS_H2O = 1000._r8_kind !< Density of liquid water [kg/m^3]
real(kind=RKIND), public, parameter :: RHOAIR = 1.292269_r8_kind !< Reference atmospheric density [kg/m^3]
real(kind=RKIND), public, parameter :: RHO0 = 1.035E3_r8_kind !< Average density of sea water [kg/m^3]
real(kind=RKIND), public, parameter :: RHO0R = 1.0_r8_kind/RHO0 !< Reciprocal of average density of sea water [m^3/kg]
real(kind=RKIND), public, parameter :: RHO0R = 1.0_r8_kind/RHO0 !< Reciprocal of average density
!! of sea water [m^3/kg]
real(kind=RKIND), public, parameter :: RHO_CP = RHO0*CP_OCEAN !< (kg/m^3)*(cal/kg/deg C)(joules/cal) =
!! (joules/m^3/deg C) [J/m^3/deg]
real(kind=RKIND), public, parameter :: O2MIXRAT = 2.0953E-01_r8_kind !< Mixing ratio of molecular oxygen in air [dimensionless]
real(kind=RKIND), public, parameter :: O2MIXRAT = 2.0953E-01_r8_kind !< Mixing ratio of molecular oxygen
!! in air [dimensionless]
real(kind=RKIND), public, parameter :: WTMAIR = 2.896440E+01_r8_kind !< Molecular weight of air [AMU]
real(kind=RKIND), public, parameter :: WTMH2O = WTMAIR*(RDGAS/RVGAS) !< Molecular weight of water [AMU]
real(kind=RKIND), public, parameter :: WTMOZONE = 47.99820_r8_kind !< Molecular weight of ozone [AMU]
real(kind=RKIND), public, parameter :: WTMC = 12.00000_r8_kind !< Molecular weight of carbon [AMU]
real(kind=RKIND), public, parameter :: WTMCO2 = 44.00995_r8_kind !< Molecular weight of carbon dioxide [AMU]
real(kind=RKIND), public, parameter :: WTMCO2 = 44.00995_r8_kind !< Molecular weight of carbon dioxide
!! [AMU]
real(kind=RKIND), public, parameter :: WTMCH4 = 16.0425_r8_kind !< Molecular weight of methane [AMU]
real(kind=RKIND), public, parameter :: WTMO2 = 31.9988_r8_kind !< Molecular weight of molecular oxygen [AMU]
real(kind=RKIND), public, parameter :: WTMCFC11 = 137.3681_r8_kind !< Molecular weight of CFC-11 (CCl3F) [AMU]
real(kind=RKIND), public, parameter :: WTMCFC12 = 120.9135_r8_kind !< Molecular weight of CFC-21 (CCl2F2) [AMU]
real(kind=RKIND), public, parameter :: WTMO2 = 31.9988_r8_kind !< Molecular weight of molecular oxygen
!! [AMU]
real(kind=RKIND), public, parameter :: WTMCFC11 = 137.3681_r8_kind !< Molecular weight of CFC-11
!! (CCl3F) [AMU]
real(kind=RKIND), public, parameter :: WTMCFC12 = 120.9135_r8_kind !< Molecular weight of CFC-21
!! (CCl2F2) [AMU]
real(kind=RKIND), public, parameter :: WTMN = 14.0067_r8_kind !< Molecular weight of Nitrogen [AMU]
real(kind=RKIND), public, parameter :: DIFFAC = 1.660_r8_kind !< Diffusivity factor [dimensionless]
real(kind=RKIND), public, parameter :: ES0 = 1.0_r8_kind !< Humidity factor [dimensionless]
!! Controls the humidity content of the atmosphere through
!! the Saturation Vapour Pressure expression
!! when using DO_SIMPLE
!! Controls the humidity content of
!! the atmosphere through
!! the Saturation Vapour Pressure
!! expression when using DO_SIMPLE

!--- Pressure and Temperature constants
real(kind=RKIND), public, parameter :: PSTD = 1.013250E+06_r8_kind !< Mean sea level pressure [dynes/cm^2]
Expand All @@ -87,11 +99,15 @@ real(kind=RKIND), public, parameter :: AVOGNO = 6.023000E+23_r8_kind !< A
real(kind=RKIND), public, parameter :: VONKARM = 0.40_r8_kind !< Von Karman constant [dimensionless]

!--- Miscellaneous constants
real(kind=RKIND), public, parameter :: ALOGMIN = -50.0_r8_kind !< Minimum value allowed as argument to log function [N/A]
real(kind=RKIND), public, parameter :: EPSLN = 1.0E-40_r8_kind !< A small number to prevent divide by zero exceptions [N/A]
real(kind=RKIND), public, parameter :: RADCON = ((1.0E+02*GRAV)/(1.0D+04*CP_AIR))*SECONDS_PER_DAY !< Factor to convert flux divergence
!! to heating rate in degrees per day
!! [deg sec/(cm day)]
real(kind=RKIND), public, parameter :: RADCON_MKS = (GRAV/CP_AIR)*SECONDS_PER_DAY !< Factor to convert flux divergence
!! to heating rate in degrees per day
!! [deg sec/(m day)]
real(kind=RKIND), public, parameter :: ALOGMIN = -50.0_r8_kind !< Minimum value allowed as argument
!! to log function [N/A]
real(kind=RKIND), public, parameter :: EPSLN = 1.0E-40_r8_kind !< A small number to prevent divide
!! by zero exceptions [N/A]
real(kind=RKIND), public, parameter :: RADCON = ((1.0E+02*GRAV)/(1.0D+04*CP_AIR))*SECONDS_PER_DAY !< Factor to
!! convert flux divergence
!! to heating rate in degrees per day
!! [deg sec/(cm day)]
real(kind=RKIND), public, parameter :: RADCON_MKS = (GRAV/CP_AIR)*SECONDS_PER_DAY !< Factor to
!! convert flux divergence
!! to heating rate in degrees per day
!! [deg sec/(m day)]
Loading

0 comments on commit 203c8bf

Please sign in to comment.