init_constants.inc

References to this file elsewhere.
1 subroutine init_constants(regional)
2 !$$$  subprogram documentation block
3 !                .      .    .                                       .
4 ! subprogram: init_constants       set regional or global constants
5 !     prgmmr:    treadon          org: np23           date: 2004-03-02
6 !
7 ! abstract:  This routine sets constants specific to regional or global
8 !            applications of the gsi
9 !
10 ! program history log:
11 !   2004-03-02  treadon
12 !   2004-06-16  treadon, documentation
13 !   2004-10-28  treadon - use intrinsic TINY function to set value
14 !                         for smallest machine representable positive
15 !                         number
16 !   2004-12-03  treadon - move derived constants to init_constants_derived
17 !   2005-03-03  treadon - add implicit none
18 !
19 !   input argument list:
20 !     regional - if .true., set regional gsi constants;
21 !                otherwise (.false.), use global constants
22 !
23 !   output argument list:
24 !
25 ! attributes:
26 !   language: f90
27 !   machine:  ibm rs/6000 sp
28 !
29 !$$$
30     implicit none
31     logical regional
32     real(r_kind) reradius,g,r_d,r_v,cliq_wrf
33 
34 !   Define regional constants here
35     if (regional) then
36 
37 !      Name given to WRF constants
38        reradius = one/6370.e03_r_kind
39        g        = 9.81_r_kind
40        r_d      = 287.04_r_kind
41        r_v      = 461.6_r_kind
42        cliq_wrf = 4190.0_r_kind
43        cp_mass  = 1004.67_r_kind
44 
45 !      Transfer WRF constants into unified GSI constants
46        rearth = one/reradius
47        grav   = g
48        rd     = r_d
49        rv     = r_v
50        cv     = cp-r_d
51        cliq   = cliq_wrf
52 
53 !   Define global constants here
54     else
55        rearth = 6.3712e+6_r_kind
56        grav   = 9.80665e+0_r_kind
57        rd     = 2.8705e+2_r_kind
58        rv     = 4.6150e+2_r_kind
59        cv     = 7.1760e+2_r_kind
60        cliq   = 4.1855e+3_r_kind
61        cp_mass= zero
62     endif
63 
64 
65 !   Now define derived constants which depend on constants
66 !   which differ between global and regional applications.
67 
68 !   Constants related to ozone assimilation
69     ozcon = grav*21.4e-9_r_kind
70     rozcon= one/ozcon
71 
72 !   Constant used in vertical integral for precipitable water
73     tpwcon = 100.0_r_kind/grav
74 
75 !   Derived atmospheric constants
76     fv         = rv/rd-one    ! used in virtual temperature equation 
77     dldt       = cvap-cliq
78     xa         = -(dldt/rv)
79     xai        = -(dldti/rv)
80     xb         = xa+hvap/(rv*ttp)
81     xbi        = xai+hsub/(rv*ttp)
82     eps        = rd/rv
83     epsm1      = rd/rv-one
84     omeps      = one-eps
85     factor1    = (cvap-cliq)/rv
86     factor2    = hvap/rv-factor1*t0c
87     cpr        = cp*rd
88     el2orc     = hvap*hvap/(rv*cp)
89     rd_over_g  = rd/grav
90     rd_over_cp = rd/cp
91     g_over_rd  = grav/rd
92 
93     return
94 end subroutine init_constants