|
||||
File indexing completed on 2018-03-02 18:37:41 UTC
view on githubraw file Latest commit add29e06 on 2018-01-31 20:35:05 UTCb2ea1d2979 Jean*0001 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 0002 !! !! 0003 !! GNU General Public License !! 0004 !! !! 0005 !! This file is part of the Flexible Modeling System (FMS). !! 0006 !! !! 0007 !! FMS is free software; you can redistribute it and/or modify !! 0008 !! it and are expected to follow the terms of the GNU General Public !! 0009 !! License as published by the Free Software Foundation. !! 0010 !! !! 0011 !! FMS is distributed in the hope that it will be useful, !! 0012 !! but WITHOUT ANY WARRANTY; without even the implied warranty of !! 0013 !! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the !! 0014 !! GNU General Public License for more details. !! 0015 !! !! 0016 !! You should have received a copy of the GNU General Public License !! 0017 !! along with FMS; if not, write to: !! 0018 !! Free Software Foundation, Inc. !! 0019 !! 59 Temple Place, Suite 330 !! 0020 !! Boston, MA 02111-1307 USA !! 0021 !! or see: !! 0022 !! http://www.gnu.org/licenses/gpl.txt !! 0023 !! !! 0024 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 0025 0026 module constants_mod 0027 0028 ! <CONTACT EMAIL="Bruce.Wyman@noaa.gov"> 0029 ! Bruce Wyman 0030 ! </CONTACT> 0031 0032 ! <HISTORY SRC="http://www.gfdl.noaa.gov/fms-cgi-bin/cvsweb.cgi/FMS/"/> 0033 0034 ! <OVERVIEW> 0035 ! Defines useful constants for Earth. 0036 ! </OVERVIEW> 0037 0038 ! <DESCRIPTION> 0039 ! Constants are defined as real parameters, 0040 ! except for PI and RADIAN, which are calculated in constants_init to promote 0041 ! consistency and accuracy among various compilers. 0042 ! 0043 ! Constants are accessed through the "use" statement. 0044 ! </DESCRIPTION> 0045 0046 !use fms_mod, only: write_version_number 0047 0048 implicit none 0049 private 0050 0051 character(len=128) :: version='$Id: constants_mod.F90,v 1.1 2013/05/08 22:14:14 jmc Exp $' 0052 character(len=128) :: tagname='$Name: $' 0053 logical :: do_log = .true. 0054 logical :: module_is_initialized = .FALSE. 0055 !dummy variable to use in HUGE initializations 0056 real :: realnumber 0057 0058 !------------ physical constants --------------- 0059 ! <DATA NAME="RADIUS" UNITS="m" TYPE="real" DEFAULT="6371.e3"> 0060 ! radius of the earth 0061 ! </DATA> 0062 ! <DATA NAME="OMEGA" UNITS="1/s" TYPE="real" DEFAULT="7.292e-5"> 0063 ! rotation rate of the planet (earth) 0064 ! </DATA> 0065 ! <DATA NAME="GRAV" UNITS="m/s^2" TYPE="real" DEFAULT="9.80"> 0066 ! acceleration due to gravity 0067 ! </DATA> 0068 ! <DATA NAME="RDGAS" UNITS="J/kg/deg" TYPE="real" DEFAULT="287.04"> 0069 ! gas constant for dry air 0070 ! </DATA> 0071 ! <DATA NAME="KAPPA" TYPE="real" DEFAULT="2./7."> 0072 ! RDGAS / CP_AIR 0073 ! </DATA> 0074 ! <DATA NAME="CP_AIR" UNITS="J/kg/deg" TYPE="real" DEFAULT="RDGAS/KAPPA"> 0075 ! specific heat capacity of dry air at constant pressure 0076 ! </DATA> 0077 ! <DATA NAME="CP_OCEAN" UNITS="J/kg/deg" TYPE="real" DEFAULT="3989.24495292815"> 0078 ! specific heat capacity taken from McDougall (2002) "Potential Enthalpy ..." 0079 ! </DATA> 0080 ! <DATA NAME="RHO0" UNITS="kg/m^3" TYPE="real" DEFAULT="1.035e3"> 0081 ! average density of sea water 0082 ! </DATA> 0083 ! <DATA NAME="RHO0R" UNITS="m^3/kg" TYPE="real" DEFAULT="1.0/RHO0"> 0084 ! reciprocal of average density of sea water 0085 ! </DATA> 0086 ! <DATA NAME="RHO_CP" UNITS="J/m^3/deg" TYPE="real" DEFAULT="RHO0*CP_OCEAN"> 0087 ! (kg/m^3)*(cal/kg/deg C)(joules/cal) = (joules/m^3/deg C) 0088 ! </DATA> 0089 0090 real, public, parameter :: RADIUS = 6371.0e3 0091 real, public, parameter :: OMEGA = 7.292e-5 0092 real, public, parameter :: GRAV = 9.80 0093 real, public, parameter :: RDGAS = 287.04 0094 real, public, parameter :: KAPPA = 2./7. 0095 real, public, parameter :: CP_AIR = RDGAS/KAPPA 0096 real, public, parameter :: CP_OCEAN = 3989.24495292815 0097 real, public, parameter :: RHO0 = 1.035e3 0098 real, public, parameter :: RHO0R = 1.0/RHO0 0099 real, public, parameter :: RHO_CP = RHO0*CP_OCEAN 0100 0101 !------------ water vapor constants --------------- 0102 ! <DATA NAME="RVGAS" UNITS="J/kg/deg" TYPE="real" DEFAULT="461.50"> 0103 ! gas constant for water vapor 0104 ! </DATA> 0105 ! <DATA NAME="DENS_H2O" UNITS="kg/m^3" TYPE="real" DEFAULT="1000."> 0106 ! density of liquid water 0107 ! </DATA> 0108 ! <DATA NAME="HLV" UNITS="J/kg" TYPE="real" DEFAULT="2.500e6"> 0109 ! latent heat of evaporation 0110 ! </DATA> 0111 ! <DATA NAME="HLF" UNITS="J/kg" TYPE="real" DEFAULT="3.34e5"> 0112 ! latent heat of fusion 0113 ! </DATA> 0114 ! <DATA NAME="HLS" UNITS="J/kg" TYPE="real" DEFAULT="2.834e6"> 0115 ! latent heat of sublimation 0116 ! </DATA> 0117 ! <DATA NAME="TFREEZE" UNITS="degK" TYPE="real" DEFAULT="273.16"> 0118 ! temp where fresh water freezes 0119 ! </DATA> 0120 0121 real, public, parameter :: RVGAS = 461.50 0122 real, public, parameter :: DENS_H2O = 1000. 0123 real, public, parameter :: HLV = 2.500e6 0124 real, public, parameter :: HLF = 3.34e5 0125 real, public, parameter :: HLS = 2.834e6 0126 real, public, parameter :: TFREEZE = 273.16 0127 0128 !-------------- radiation constants ----------------- 0129 0130 ! <DATA NAME="WTMAIR" UNITS="AMU" TYPE="real" DEFAULT="2.896440E+01"> 0131 ! molecular weight of air 0132 ! </DATA> 0133 ! <DATA NAME="WTMH2O" UNITS="AMU" TYPE="real" DEFAULT="1.801534E+01"> 0134 ! molecular weight of water 0135 ! </DATA> 0136 ! <DATA NAME="WTMO3" UNITS="AMU" TYPE="real" DEFAULT="47.99820E+01"> 0137 ! molecular weight of ozone 0138 ! </DATA> 0139 ! <DATA NAME="DIFFAC" TYPE="real" DEFAULT="1.660000E+00"> 0140 ! diffusivity factor 0141 ! </DATA> 0142 ! <DATA NAME="SECONDS_PER_DAY" UNITS="seconds" TYPE="real" DEFAULT="8.640000E+04"> 0143 ! seconds in a day 0144 ! </DATA> 0145 ! <DATA NAME="AVOGNO" UNITS="atoms/mole" TYPE="real" DEFAULT="6.023000E+23"> 0146 ! Avogadro's number 0147 ! </DATA> 0148 ! <DATA NAME="PSTD" UNITS="dynes/cm^2" TYPE="real" DEFAULT="1.013250E+06"> 0149 ! mean sea level pressure 0150 ! </DATA> 0151 ! <DATA NAME="PSTD_MKS" UNITS="Newtons/m^2" TYPE="real" DEFAULT="101325.0"> 0152 ! mean sea level pressure 0153 ! </DATA> 0154 ! <DATA NAME="REARTH" UNITS="cm" TYPE="real" DEFAULT="6.356766E+08"> 0155 ! radius of the earth 0156 ! </DATA> 0157 0158 real, public, parameter :: WTMAIR = 2.896440E+01 0159 real, public, parameter :: WTMH2O = 1.801534E+01 0160 real, public, parameter :: WTMO3 = 47.99820E+01 0161 real, public, parameter :: DIFFAC = 1.660000E+00 0162 real, public, parameter :: SECONDS_PER_DAY = 8.640000E+04 0163 real, public, parameter :: AVOGNO = 6.023000E+23 0164 real, public, parameter :: PSTD = 1.013250E+06 0165 real, public, parameter :: PSTD_MKS = 101325.0 0166 real, public, parameter :: REARTH = 6.356766E+08 0167 0168 ! <DATA NAME="RADCON" UNITS="deg sec/(cm day)" TYPE="real" DEFAULT="((1.0E+02*GRAV)/(1.0E+04*CP_AIR))*SECONDS_PER_DAY"> 0169 ! factor used to convert flux divergence to heating rate in degrees per day 0170 ! </DATA> 0171 ! <DATA NAME="RADCON_MKS" UNITS="deg sec/(m day)" TYPE="real" DEFAULT="(GRAV/CP_AIR)*SECONDS_PER_DAY"> 0172 ! factor used to convert flux divergence to heating rate in degrees per day 0173 ! </DATA> 0174 ! <DATA NAME="O2MIXRAT" TYPE="real" DEFAULT="2.0953E-01"> 0175 ! mixing ratio of molecular oxygen in air 0176 ! </DATA> 0177 ! <DATA NAME="RHOAIR" UNITS="kg/m^3" TYPE="real" DEFAULT="1.292269"> 0178 ! reference atmospheric density 0179 ! </DATA> 0180 ! <DATA NAME="ALOGMIN" TYPE="real" DEFAULT="-50.0"> 0181 ! minimum value allowed as argument to log function 0182 ! </DATA> 0183 ! <DATA NAME="FREZDK" UNITS="deg K" TYPE="real" DEFAULT="273.16"> 0184 ! melting point of water 0185 ! </DATA> 0186 0187 real, public, parameter :: RADCON = ((1.0E+02*GRAV)/(1.0E+04*CP_AIR))*SECONDS_PER_DAY 0188 real, public, parameter :: RADCON_MKS = (GRAV/CP_AIR)*SECONDS_PER_DAY 0189 real, public, parameter :: O2MIXRAT = 2.0953E-01 0190 real, public, parameter :: RHOAIR = 1.292269 0191 real, public, parameter :: ALOGMIN = -50.0 0192 real, public, parameter :: FREZDK = 273.16 0193 0194 !------------ miscellaneous constants --------------- 0195 ! <DATA NAME="STEFAN" UNITS="W/m^2/deg^4" TYPE="real" DEFAULT="5.6734e-8"> 0196 ! Stefan-Boltzmann constant 0197 ! </DATA> 0198 ! <DATA NAME="VONKARM" TYPE="real" DEFAULT="0.40"> 0199 ! Von Karman constant 0200 ! </DATA> 0201 ! <DATA NAME="PI" TYPE="real" DEFAULT="4.0*ATAN(1.0)"> 0202 ! ratio of circle circumference to diameter 0203 ! </DATA> 0204 ! <DATA NAME="RADIAN" TYPE="real" DEFAULT="180.0/PI"> 0205 ! degrees per radian 0206 ! </DATA> 0207 ! <DATA NAME="C2DBARS" UNITS="dbars" TYPE="real" DEFAULT="1.e-4"> 0208 ! converts rho*g*z (in mks) to dbars: 1dbar = 10^4 (kg/m^3)(m/s^2)m 0209 ! </DATA> 0210 ! <DATA NAME="KELVIN" TYPE="real" DEFAULT="273.15"> 0211 ! degrees Kelvin at zero Celsius 0212 ! </DATA> 0213 ! <DATA NAME="EPSLN" TYPE="real" DEFAULT="1.0e-40"> 0214 ! a small number to prevent divide by zero exceptions 0215 ! </DATA> 0216 0217 real, public, parameter :: STEFAN = 5.6734e-8 0218 real, public, parameter :: VONKARM = 0.40 0219 real, public :: PI = HUGE(realnumber) 0220 real, public :: RADIAN = HUGE(realnumber) 0221 real, public, parameter :: C2DBARS = 1.e-4 0222 real, public, parameter :: KELVIN = 273.15 0223 real, public, parameter :: EPSLN = 1.0e-40 0224 !----------------------------------------------------------------------- 0225 0226 public constants_init 0227 0228 contains 0229 0230 ! <SUBROUTINE NAME="constants_init"> 0231 0232 ! <OVERVIEW> 0233 ! Initialization routine. The purpose of this routine 0234 ! is initialize the value of PI and RADIAN, and to write the 0235 ! version and tag name information to the log file. 0236 ! </OVERVIEW> 0237 ! <DESCRIPTION> 0238 ! If this routine is called more than once or called 0239 ! from other than the root PE it will return silently. 0240 ! There are no arguments. 0241 ! </DESCRIPTION> 0242 ! <TEMPLATE> 0243 ! call constants_init 0244 ! </TEMPLATE> 0245 0246 subroutine constants_init 0247 0248 if (module_is_initialized) return 0249 module_is_initialized = .TRUE. 0250 0251 if (.not.do_log) return 0252 ! call write_version_number (version,tagname) 0253 do_log = .false. 0254 0255 PI = 4.0*ATAN(1.0) 0256 RADIAN = 180.0/PI 0257 0258 end subroutine constants_init 0259 ! </SUBROUTINE> 0260 0261 !----------------------------------------------------------------------- 0262 0263 end module constants_mod 0264 0265 ! <INFO> 0266 0267 ! <FUTURE> 0268 ! 1. Renaming of constants. 0269 ! </FUTURE> 0270 ! <FUTURE> 0271 ! 2. Additional constants. 0272 ! </FUTURE> 0273 ! <NOTE> 0274 ! Constants have been declared as type REAL, PARAMETER. 0275 ! 0276 ! The value a constant can not be changed in a users program. 0277 ! New constants can be defined in terms of values from the 0278 ! constants module using a parameter statement.<br><br> 0279 ! 0280 ! The name given to a particular constant may be changed.<br><br> 0281 ! 0282 ! Constants can be used on the right side on an assignment statement 0283 ! (their value can not be reassigned). 0284 ! 0285 ! As PI is calculated, it cannot be a parameter variable. 0286 ! Do not assign a new value to PI. 0287 ! 0288 !<TESTPROGRAM NAME="EXAMPLE"> 0289 !<PRE> 0290 ! use constants_mod, only: TFREEZE, grav_new => GRAV 0291 ! real, parameter :: grav_inv = 1.0 / grav_new 0292 ! tempc(:,:,:) = tempk(:,:,:) - TFREEZE 0293 ! geopotential(:,:) = height(:,:) * grav_new 0294 !</PRE> 0295 !</TESTPROGRAM> 0296 ! </NOTE> 0297 0298 ! </INFO> 0299
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated from https://github.com/MITgcm/MITgcm by the 2.2.1-MITgcm-0.1 LXR engine. The LXR team |