da_sfc_pre_lin.inc

References to this file elsewhere.
1 subroutine da_sfc_pre_lin (psfcm_prime, psm_prime, tsm_prime, qsm_prime, &
2                                         psm, tsm, qsm, hsm, ho, to, qvo)
3 
4    !---------------------------------------------------------------------------
5    ! Purpose: Correct pressure between two levels. 
6    !
7    ! Reference: make use of the hydrosatic equation:
8    !
9    !  P2 = P1 * exp [-G/R * (z2-z1) / (tv1 + tv2)/2)
10    !
11    ! Where:
12    !  z1  = height at level 1
13    !  z1  = height at level 2
14    !  tv1 = temperature at level 1
15    !  tv2 = temperature at level 2
16    !  P1  = Pressure at level 1
17    !  P2  = Pressure at level 2
18    !---------------------------------------------------------------------------
19 
20    implicit none
21 
22    ! Perturbation:
23    real, intent (out)   :: psfcm_prime          ! model pressure at ho
24    real, intent (in)    :: psm_prime, tsm_prime, &
25                            qsm_prime            ! model surface p, t, q 
26    ! Basic state:
27    real, intent (in)    :: psm, tsm, qsm ! model pressure at ho and
28                                                 ! model surface p, t, q 
29    ! Constant variables:
30    real, intent (in)           :: hsm, ho
31    real, intent (in), optional :: to, qvo
32    ! working array:
33    real                 :: tvo, tvsm, tv, dz, arg0
34    real                 :: tvsm_prime, tvo_prime, tv_prime, arg, arg_prime
35 
36    real, parameter      :: GASR =  gas_constant
37    real, parameter      :: G = gravity
38 
39    ! 1.  MODEL AND OBSERVATION VIRTUAL TEMPERATURE
40    ! ---------------------------------------------
41 
42    tvsm_prime = tsm_prime * (1. + 0.608 * qsm) &
43               + qsm_prime * tsm * 0.608
44    tvsm = tsm  * (1. + 0.608 * qsm)
45 
46    if (present(to) .and. present(qvo)) then
47       tvo_prime = 0.0
48       tvo = to  * (1. + 0.608 * qvo)
49    else if (present(to) .and. .not.present(qvo)) then
50       tvo_prime = 0.0
51       tvo = to
52    else
53       tvo_prime = tvsm_prime
54       tvo = tvsm
55    end if
56 
57    tv_prime = 0.5 * (tvsm_prime + tvo_prime)
58    tv  = 0.5 * (tvsm + tvo)
59 
60    ! 2. HEIGHT DifFERENCE BEWTEEN MODEL SURFACE AND OBSERVATIONS
61    ! ------------------------------------------------------------
62 
63    dz = hsm - ho
64    arg0 = dz * g / gasr
65 
66    ! 3.  EXTRAPOLATE PRESSURE OBS TO MODEL SURFACE
67    ! ---------------------------------------------
68 
69    arg_prime = - arg0 * tv_prime / (tv * tv)
70    arg = arg0    / tv 
71 
72    psfcm_prime = exp(arg) *(psm_prime + psm * arg_prime)
73 
74 end subroutine da_sfc_pre_lin
75 
76