Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/lint_fms.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ jobs:
- name: Checkout code
uses: actions/checkout@v2
- name: Run Lint
uses: NOAA-GFDL/simple_lint@v2
uses: NOAA-GFDL/simple_lint@v3
9 changes: 6 additions & 3 deletions amip_interp/amip_interp.F90
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
!!
!! 1. AMIP @link http://www-pcmdi.llnl.gov/amip @endlink from Jan 1979 to Jan 1989 (2 deg x 2 deg)
!! 2. Reynolds OI @link amip_interp.rey_oi.txt @endlink from Nov 1981 to Jan 1999 (1 deg x 1 deg)
!! 3. Reynolds EOF @link ftp://podaac.jpl.nasa.gov/pub/sea_surface_temperature/reynolds/rsst/doc/rsst.html @endlink from Jan 1950 to Dec 1998 (2 deg x 2 deg)
!! 3. Reynolds EOF @link ftp://podaac.jpl.nasa.gov/pub/sea_surface_temperature/reynolds/rsst/doc/rsst.html
!! @endlink from Jan 1950 to Dec 1998 (2 deg x 2 deg)
!!
!! All original data are observed monthly means. This module
!! interpolates linearly in time between pairs of monthly means.
Expand Down Expand Up @@ -501,7 +502,8 @@ subroutine get_amip_sst (Time, Interp, sst, err_msg, lon_model, lat_model)
if (DEBUG) then
call get_date(Amip_Time,jhctod(1),jhctod(2),jhctod(3),jhctod(4),jhctod(5),jhctod(6))
if (mpp_pe() == 0) then
write (*,200) 'JHC: use_daily = F, AMIP_Time: ',jhctod(1),jhctod(2),jhctod(3),jhctod(4),jhctod(5),jhctod(6)
write (*,200) 'JHC: use_daily = F, AMIP_Time: ',jhctod(1),jhctod(2),jhctod(3),jhctod(4),jhctod(5), &
& jhctod(6)
write (*,300) 'JHC: use_daily = F, interped SST: ', sst(1,1),sst(5,5),sst(10,10)
endif
endif
Expand All @@ -512,7 +514,8 @@ subroutine get_amip_sst (Time, Interp, sst, err_msg, lon_model, lat_model)
! add by JHC
else
call get_date(Amip_Time,jhctod(1),jhctod(2),jhctod(3),jhctod(4),jhctod(5),jhctod(6))
if (mpp_pe() == mpp_root_pe()) write(*,200) 'amip_interp_mod: use_daily = T, Amip_Time = ',jhctod(1),jhctod(2),jhctod(3),jhctod(4),jhctod(5),jhctod(6)
if (mpp_pe() == mpp_root_pe()) write(*,200) 'amip_interp_mod: use_daily = T, Amip_Time = ',jhctod(1), &
& jhctod(2),jhctod(3),jhctod(4),jhctod(5),jhctod(6)

yr = jhctod(1); mo = jhctod(2); dy = jhctod(3)

Expand Down
23 changes: 15 additions & 8 deletions astronomy/astronomy.F90
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ module astronomy_mod
!! @param [in] <time> Time at which astronomical values are desired (time_type variable) [seconds, days]
!! @param [out] <cosz> Cosine of solar zenith angle, set to zero when entire period is in darkness [dimensionless]
!! @param [out] <fracday> Daylight fraction of time interval [dimensionless]
!! @param [out] <rrsun> Earth-Sun distance (r) relative to semi-major axis of orbital ellipse (a):(a/r)**2 [dimensionless]
!! @param [out] <rrsun> Earth-Sun distance (r) relative to semi-major axis of orbital ellipse
!! (a):(a/r)**2 [dimensionless]
!! @param [in] <dt> OPTIONAL: Time interval after gmt over which the astronomical variables are to be
!! averaged. this produces averaged output rather than instantaneous. [radians], (1 day = 2 * pi)
!! @param [in] <dt_time> OPTIONAL: Time interval after gmt over which the astronomical variables are to be
Expand Down Expand Up @@ -190,8 +191,10 @@ module astronomy_mod
!! @param [in] <time> Time at which astronomical values are desired (time_type variable) [seconds, days]
!! @param [out] <cosz> Cosine of solar zenith angle, set to zero when entire period is in darkness [dimensionless]
!! @param [out] <fracday> Daylight fraction of time interval [dimensionless]
!! @param [out] <rrsun> Earth-Sun distance (r) relative to semi-major axis of orbital ellipse (a):(a/r)**2 [dimensionless]
!! @param [out] <solar> shortwave flux factor: cosine of zenith angle * daylight fraction / (earth-sun distance squared) [dimensionless]
!! @param [out] <rrsun> Earth-Sun distance (r) relative to semi-major axis of orbital ellipse
!! (a):(a/r)**2 [dimensionless]
!! @param [out] <solar> shortwave flux factor: cosine of zenith angle * daylight fraction /
!! (earth-sun distance squared) [dimensionless]
!> @ingroup astronomy_mod
interface daily_mean_solar
module procedure daily_mean_solar_2d
Expand Down Expand Up @@ -1480,7 +1483,8 @@ end subroutine daily_mean_solar_1d
!! @param [in] <lat> Latitudes of model grid points
!! @param [in] <time_since_ae> Time of year; autumnal equinox = 0.0, one year = 2 * pi
!! @param [out] <cosz> Cosine of solar zenith angle
!! @param [out] <solar> Shortwave flux factor: cosine of zenith angle * daylight fraction / (earth-sun distance squared)
!! @param [out] <solar> Shortwave flux factor: cosine of zenith angle * daylight fraction /
!! (earth-sun distance squared)
subroutine daily_mean_solar_2level (lat, time_since_ae, cosz, solar)

!----------------------------------------------------------------------
Expand Down Expand Up @@ -1649,7 +1653,8 @@ end subroutine daily_mean_solar_cal_1d
!! @param [in] <lat> Latitudes of model grid points
!! @param [in] <time> Time of year (time_type)
!! @param [out] <cosz> Cosine of solar zenith angle
!! @param [out] <solar> Shortwave flux factor: cosine of zenith angle * daylight fraction / (earth-sun distance squared)
!! @param [out] <solar> Shortwave flux factor: cosine of zenith angle * daylight fraction /
!! (earth-sun distance squared)
subroutine daily_mean_solar_cal_2level (lat, time, cosz, solar)

real, dimension(:), intent(in) :: lat
Expand Down Expand Up @@ -1735,7 +1740,8 @@ end subroutine daily_mean_solar_cal_0d
!! @param [in] <jnd> Ending index of latitude window
!! @param [in] <lat> Latitudes of model grid points
!! @param [out] <cosz> Cosine of solar zenith angle
!! @param [out] <solar> Shortwave flux factor: cosine of zenith angle * daylight fraction / (earth-sun distance squared)
!! @param [out] <solar> Shortwave flux factor: cosine of zenith angle * daylight fraction /
!! (earth-sun distance squared)
!! @param [out] <fracday> Daylight fraction of time interval
!! @param [out] <rrsun> Earth-Sun distance (r) relative to semi-major axis of orbital ellipse (a):(a/r)**2
subroutine annual_mean_solar_2d (js, je, lat, cosz, solar, fracday, &
Expand Down Expand Up @@ -1842,7 +1848,8 @@ end subroutine annual_mean_solar_2d
!! @param [in] <jnd> Ending index of latitude window
!! @param [in] <lat> Latitudes of model grid points
!! @param [out] <cosz> Cosine of solar zenith angle
!! @param [out] <solar> Shortwave flux factor: cosine of zenith angle * daylight fraction / (earth-sun distance squared)
!! @param [out] <solar> Shortwave flux factor: cosine of zenith angle * daylight fraction /
!! (earth-sun distance squared)
!! @param [out] <fracday> Daylight fraction of time interval
!! @param [out] <rrsun_out> Earth-Sun distance (r) relative to semi-major axis of orbital ellipse (a):(a/r)**2
subroutine annual_mean_solar_1d (jst, jnd, lat, cosz, solar, &
Expand Down Expand Up @@ -2141,7 +2148,7 @@ function half_day_2d (latitude, dec) result(h)
!---------------------------------------------------------------------
real, dimension (size(latitude,1),size(latitude,2)):: &
cos_half_day, & !< Cosine of half-day length [dimensionless]
lat !< Model latitude, adjusted so that it is never 0.5*pi or -0.5*pi
lat !< Model latitude, adjusted so that it is never 0.5*pi or -0.5*pi
real :: tan_dec !< tangent of solar declination [dimensionless]
real :: eps = 1.0E-05 !< small increment

Expand Down
4 changes: 2 additions & 2 deletions axis_utils/axis_utils.F90
Original file line number Diff line number Diff line change
Expand Up @@ -415,8 +415,8 @@ function frac_index (value, array)
do i=2,ia
if (array(i) < array(i-1)) then
unit = stdout()
write (unit,*) '=> Error: "frac_index" array must be monotonically increasing when searching for nearest value to ',&
value
write (unit,*) &
'=> Error: "frac_index" array must be monotonically increasing when searching for nearest value to ', value
write (unit,*) ' array(i) < array(i-1) for i=',i
write (unit,*) ' array(i) for i=1..ia follows:'
do ii=1,ia
Expand Down
4 changes: 2 additions & 2 deletions axis_utils/axis_utils2.F90
Original file line number Diff line number Diff line change
Expand Up @@ -443,8 +443,8 @@ function frac_index (value, array)
do i=2,ia
if (array(i) < array(i-1)) then
unit = stdout()
write (unit,*) '=> Error: "frac_index" array must be monotonically increasing when searching for nearest value to ',&
value
write (unit,*) &
'=> Error: "frac_index" array must be monotonically increasing when searching for nearest value to ', value
write (unit,*) ' array(i) < array(i-1) for i=',i
write (unit,*) ' array(i) for i=1..ia follows:'
do ii=1,ia
Expand Down
56 changes: 37 additions & 19 deletions constants/constants.F90
Original file line number Diff line number Diff line change
Expand Up @@ -81,27 +81,33 @@ module constants_mod
#ifdef GFS_PHYS
! SJL: the following are from fv3_gfsphysics/gfs_physics/physics/physcons.f90
real, public, parameter :: RADIUS = 6.3712e+6_r8_kind * small_fac !< Radius of the Earth [m]
real(kind=r8_kind), public, parameter :: PI_8 = 3.1415926535897931_r8_kind !< Ratio of circle circumference to diameter [N/A]
real, public, parameter :: PI = 3.1415926535897931_r8_kind !< Ratio of circle circumference to diameter [N/A]
real(kind=r8_kind), public, parameter :: PI_8 = 3.1415926535897931_r8_kind !< Ratio of circle circumference
!! to diameter [N/A]
real, public, parameter :: PI = 3.1415926535897931_r8_kind !< Ratio of circle circumference
!! to diameter [N/A]
real, public, parameter :: OMEGA = 7.2921e-5_r8_kind / small_fac !< Rotation rate of the Earth [1/s]
real, public, parameter :: GRAV = 9.80665_r8_kind !< Acceleration due to gravity [m/s^2]
real(kind=r8_kind), public, parameter :: GRAV_8 = 9.80665_r8_kind !< Acceleration due to gravity [m/s^2] (REAL(KIND=8))
real(kind=r8_kind), public, parameter :: GRAV_8 = 9.80665_r8_kind !< Acceleration due to gravity
!! [m/s^2] (REAL(KIND=8))
real, public, parameter :: RDGAS = 287.05_r8_kind !< Gas constant for dry air [J/kg/deg]
real, public, parameter :: RVGAS = 461.50_r8_kind !< Gas constant for water vapor [J/kg/deg]
! Extra:
real, public, parameter :: HLV = 2.5e6_r8_kind !< Latent heat of evaporation [J/kg]
real, public, parameter :: HLF = 3.3358e5_r8_kind !< Latent heat of fusion [J/kg]
real, public, parameter :: con_cliq = 4.1855e+3_r8_kind !< spec heat H2O liq [J/kg/K]
real, public, parameter :: con_csol = 2.1060e+3_r8_kind !< spec heat H2O ice [J/kg/K]
real, public, parameter :: CP_AIR = 1004.6_r8_kind !< Specific heat capacity of dry air at constant pressure [J/kg/deg]
real, public, parameter :: CP_AIR = 1004.6_r8_kind !< Specific heat capacity of dry
!! air at constant pressure [J/kg/deg]
real, public, parameter :: KAPPA = RDGAS/CP_AIR !< RDGAS / CP_AIR [dimensionless]
real, public, parameter :: TFREEZE = 273.15_r8_kind !< Freezing temperature of fresh water [K]

#else

real, public, parameter :: RADIUS = 6371.0e+3_r8_kind * small_fac !< Radius of the Earth [m]
real(kind=8), public, parameter :: PI_8 = 3.14159265358979323846_r8_kind !< Ratio of circle circumference to diameter [N/A]
real, public, parameter :: PI = 3.14159265358979323846_r8_kind !< Ratio of circle circumference to diameter [N/A]
real(kind=8), public, parameter :: PI_8 = 3.14159265358979323846_r8_kind !< Ratio of circle circumference
!! to diameter [N/A]
real, public, parameter :: PI = 3.14159265358979323846_r8_kind !< Ratio of circle circumference
!! to diameter [N/A]
real, public, parameter :: OMEGA = 7.292e-5_r8_kind / small_fac !< Rotation rate of the Earth [1/s]
real, public, parameter :: GRAV = 9.80_r8_kind !< Acceleration due to gravity [m/s^2]
real, public, parameter :: RDGAS = 287.04_r8_kind !< Gas constant for dry air [J/kg/deg]
Expand All @@ -110,21 +116,26 @@ module constants_mod
real, public, parameter :: HLV = 2.500e6_r8_kind !< Latent heat of evaporation [J/kg]
real, public, parameter :: HLF = 3.34e5_r8_kind !< Latent heat of fusion [J/kg]
real, public, parameter :: KAPPA = 2.0_r8_kind/7.0_r8_kind !< RDGAS / CP_AIR [dimensionless]
real, public, parameter :: CP_AIR = RDGAS/KAPPA !< Specific heat capacity of dry air at constant pressure [J/kg/deg]
real, public, parameter :: CP_AIR = RDGAS/KAPPA !< Specific heat capacity of dry
!! air at constant pressure [J/kg/deg]
real, public, parameter :: TFREEZE = 273.16_r8_kind !< Freezing temperature of fresh water [K]
#endif

real, public, parameter :: STEFAN = 5.6734e-8_r8_kind !< Stefan-Boltzmann constant [W/m^2/deg^4]

real, public, parameter :: CP_VAPOR = 4.0_r8_kind*RVGAS !< Specific heat capacity of water vapor at constant pressure [J/kg/deg]
real, public, parameter :: CP_VAPOR = 4.0_r8_kind*RVGAS !< Specific heat capacity of water vapor
!! at constant pressure [J/kg/deg]
real, public, parameter :: CP_OCEAN = 3989.24495292815_r8_kind !< Specific heat capacity taken from McDougall (2002)
!! "Potential Enthalpy ..." [J/kg/deg]
real, public, parameter :: RHO0 = 1.035e3_r8_kind !< Average density of sea water [kg/m^3]
real, public, parameter :: RHO0R = 1.0_r8_kind/RHO0 !< Reciprocal of average density of sea water [m^3/kg]
real, 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, 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, public, parameter :: ES0 = 1.0_r8_kind !< Humidity factor. Controls the humidity content of the atmosphere through
!! the Saturation Vapour Pressure expression when using DO_SIMPLE. [dimensionless]
real, public, parameter :: ES0 = 1.0_r8_kind !< Humidity factor. Controls the humidity content
!! of the atmosphere through
!! the Saturation Vapour Pressure expression
!! when using DO_SIMPLE. [dimensionless]
real, public, parameter :: DENS_H2O = 1000._r8_kind !< Density of liquid water [kg/m^3]
real, public, parameter :: HLS = HLV + HLF !< Latent heat of sublimation [J/kg]

Expand All @@ -148,18 +159,25 @@ module constants_mod
real, public, parameter :: SECONDS_PER_MINUTE = 60._r8_kind !< Seconds in a minute [s]
real, public, parameter :: RAD_TO_DEG = 180._r8_kind/PI !< Degrees per radian [deg/rad]
real, public, parameter :: DEG_TO_RAD = PI/180._r8_kind !< Radians per degree [rad/deg]
real, public, parameter :: RADIAN = RAD_TO_DEG !< Equal to RAD_TO_DEG for backward compatability. [rad/deg]
real, public, parameter :: ALOGMIN = -50.0_r8_kind !< Minimum value allowed as argument to log function [N/A]
real, public, parameter :: EPSLN = 1.0e-40_r8_kind !< A small number to prevent divide by zero exceptions [N/A]

real, public, parameter :: RADCON = ((1.0E+02*GRAV)/(1.0E+04*CP_AIR))*SECONDS_PER_DAY !< Factor used to convert flux divergence to
!! heating rate in degrees per day [deg sec/(cm day)]
real, public, parameter :: RADIAN = RAD_TO_DEG !< Equal to RAD_TO_DEG for backward
!! compatability. [rad/deg]
real, public, parameter :: ALOGMIN = -50.0_r8_kind !< Minimum value allowed as argument
!! to log function [N/A]
real, public, parameter :: EPSLN = 1.0e-40_r8_kind !< A small number to prevent divide
!! by zero exceptions [N/A]

real, public, parameter :: RADCON = ((1.0E+02*GRAV)/(1.0E+04*CP_AIR))*SECONDS_PER_DAY !< Factor used
!! to convert flux divergence to
!! heating rate in degrees
!! per day [deg sec/(m day)]
real, public, parameter :: RADCON_MKS = (GRAV/CP_AIR)*SECONDS_PER_DAY !< Factor used to convert flux divergence to
!! heating rate in degrees per day [deg sec/(m day)]
!! heating rate in degrees
!! per day [deg sec/(m day)]
real, public, parameter :: O2MIXRAT = 2.0953E-01_r8_kind !< Mixing ratio of molecular oxygen in air [dimensionless]
real, public, parameter :: RHOAIR = 1.292269_r8_kind !< Reference atmospheric density [kg/m^3]
real, public, parameter :: VONKARM = 0.40_r8_kind !< Von Karman constant [dimensionless]
real, public, parameter :: C2DBARS = 1.e-4_r8_kind !< Converts rho*g*z (in mks) to dbars: 1dbar = 10^4 (kg/m^3)(m/s^2)m [dbars]
real, public, parameter :: C2DBARS = 1.e-4_r8_kind !< Converts rho*g*z (in mks) to dbars: 1dbar
!! = 10^4 (kg/m^3)(m/s^2)m [dbars]
real, public, parameter :: KELVIN = 273.15_r8_kind !< Degrees Kelvin at zero Celsius [K]

public :: constants_init
Expand Down
Loading