da_sfc_pre_lin.inc

References to this file elsewhere.
1 subroutine da_sfc_pre_lin (psfcm_prime, psm_prime, tsm_prime, qsm_prime, psm, tsm, qsm, hsm, ho, to, qvo)
2 
3    !---------------------------------------------------------------------------
4    ! Purpose: Correct pressure between two levels. 
5    !
6    ! Reference: make use of the hydrosatic equation:
7    !
8    !  P2 = P1 * exp [-G/R * (z2-z1) / (tv1 + tv2)/2)
9    !
10    ! Where:
11    !  z1  = height at level 1
12    !  z1  = height at level 2
13    !  tv1 = temperature at level 1
14    !  tv2 = temperature at level 2
15    !  P1  = Pressure at level 1
16    !  P2  = Pressure at level 2
17    !---------------------------------------------------------------------------
18 
19    implicit none
20 
21    ! Perturbation:
22    real, intent (out)   :: psfcm_prime          ! model pressure at ho
23    real, intent (in)    :: psm_prime, tsm_prime, qsm_prime            ! model surface p, t, q 
24    ! Basic state:
25    real, intent (in)    :: psm, tsm, qsm ! model pressure at ho and
26                                                 ! model surface p, t, q 
27    real, intent (in)           :: hsm, ho
28    real, intent (in), optional :: to, qvo
29 
30    ! working array:
31    real                 :: tvo, tvsm, tv, dz, arg0
32    real                 :: tvsm_prime, tvo_prime, tv_prime, arg, arg_prime
33 
34    real, parameter      :: GASR =  gas_constant
35    real, parameter      :: G = gravity
36 
37    if (trace_use) call da_trace_entry("da_sfc_pre_lin")
38 
39    ! 1.  MODEL AND OBSERVATION VIRTUAL TEMPERATURE
40    ! ---------------------------------------------
41 
42    tvsm_prime = tsm_prime * (1.0 + 0.608 * qsm) &
43               + qsm_prime * tsm * 0.608
44    tvsm = tsm  * (1.0 + 0.608 * qsm)
45 
46    if (present(to) .and. present(qvo)) then
47       tvo_prime = 0.0
48       tvo = to  * (1.0 + 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    if (trace_use) call da_trace_exit("da_sfc_pre_lin")
75 
76 end subroutine da_sfc_pre_lin
77 
78