1 subroutine da_sfc_pre_adj (psfcm_prime, psm_prime, tsm_prime, qsm_prime, &
2 psm, tsm, qsm, hsm, ho, to, qvo)
4 !-----------------------------------------------------------------------
6 !-----------------------------------------------------------------------
8 !---------------------------------------------------------------------------
10 ! Correct pressure between two levels.
12 ! Reference: make use of the hydrosatic equation:
14 ! P2 = P1 * exp [-G/R * (z2-z1) / (tv1 + tv2)/2)
17 ! z1 = height at level 1
18 ! z1 = height at level 2
19 ! tv1 = temperature at level 1
20 ! tv2 = temperature at level 2
21 ! P1 = Pressure at level 1
22 ! P2 = Pressure at level 2
23 !---------------------------------------------------------------------------
28 real, intent (in) :: psfcm_prime ! model pressure at ho
29 real, intent (inout) :: psm_prime, tsm_prime, qsm_prime ! model surface p, t, q
31 real, intent (in) :: psm, tsm, qsm ! model pressure at ho and
32 ! model surface p, t, q
34 real, intent (in) :: hsm, ho
35 real, intent (in), optional :: to, qvo
37 real :: tvo, tvsm, tv, dz, arg0
38 real :: tvsm_prime, tvo_prime, tv_prime, arg, arg_prime
40 real, parameter :: GASR = gas_constant
41 real, parameter :: G = gravity
43 if (trace_use) call da_trace_entry("da_sfc_pre_adj")
45 !---------------------------------------------------------------------------
47 ! --------------------------------------------------------------------------
49 ! 1.1 MODEL AND OBSERVATION VIRTUAL TEMPERATURE
50 ! ---------------------------------------------
52 tvsm = tsm * (1.0 + 0.608 * qsm)
54 if (present(to) .and. present(qvo)) then
55 tvo = to * (1.0 + 0.608 * qvo)
56 else if (present(to) .and. .not.present(qvo)) then
62 ! 1.2 Mean virtual temperature
63 ! ----------------------------
65 tv = 0.5 * (tvsm + tvo)
67 ! 1.3 Compute (g/RTv) * dZ
68 ! --------------------------
74 ! ---------------------------------------------------------------------------|
76 ! ---------------------------------------------------------------------------|
78 ! 2.1 psfcm_prime ==> psm_prime, arg_prime
79 ! -----------------------------------------
81 arg_prime = exp(arg) * psm * psfcm_prime
82 psm_prime = exp(arg) * psfcm_prime + psm_prime
84 ! 2.2 arg_prim ==> tv_prime
85 ! -------------------------
87 tv_prime = - arg0 * arg_prime / (tv * tv)
89 ! 2.3 tv_prime ==> tvsm_prime, tvo_prime
90 ! --------------------------------------
92 tvsm_prime = 0.5 * tv_prime
93 tvo_prime = 0.5 * tv_prime
95 ! 2.4 tvo_prime ==> tsm_prime
96 ! ---------------------------
98 if (present(to) .and. present(qvo)) then
100 else if (present(to) .and. .not.present(qvo)) then
103 tvsm_prime = tvo_prime + tvsm_prime
106 ! 2.5 tvsm_prime ==> tsm_prime, qsm_prime
107 ! ----------------------------------------
109 tsm_prime = tvsm_prime * (1.0 + 0.608 * qsm) + tsm_prime
110 qsm_prime = tvsm_prime * tsm * 0.608 + qsm_prime
112 if (trace_use) call da_trace_exit("da_sfc_pre_adj")
114 end subroutine da_sfc_pre_adj