CCPP SciDoc v7.0.x  v7.0.0
Common Community Physics Package Developed at DTC
 
Loading...
Searching...
No Matches
progomega_calc.f90
1 module progomega
2
3 implicit none
4
5 public progomega_calc
6
7 contains
8
13
21
22 subroutine progomega_calc(first_time_step,flag_restart,im,km,kbcon1,ktcon,omegain,delt,del, &
23 zi,cnvflg,omegaout,grav,buo,drag,wush,tentr,bb1,bb2)
24
25 use machine, only : kind_phys
26 use funcphys, only : fpvs
27 implicit none
28
29 integer, intent(in) :: im, km
30 integer, intent(in) :: kbcon1(im),ktcon(im)
31 real(kind=kind_phys), intent(in) :: delt,grav,bb1,bb2
32 real(kind=kind_phys), intent(in) :: omegain(im,km), del(im,km),zi(im,km)
33 real(kind=kind_phys), intent(in) :: drag(im,km),buo(im,km),wush(im,km),tentr(im,km)
34 real(kind=kind_phys), intent(inout) :: omegaout(im,km)
35 logical, intent(in) :: cnvflg(im),first_time_step,flag_restart
36 real(kind=kind_phys) :: terma(im,km),termb(im,km),termc(im,km),omega(im,km)
37 real(kind=kind_phys) :: rhs(im,km),kd(im,km)
38 real(kind=kind_phys) :: dp,dz,entrn,kdn,discr,wush_pa,lbb1,lbb2,lbb3
39 integer :: i,k
40
41 entrn = 0.8e-4 !0.5E-4 !m^-1
42 kdn = 0.5e-4 !2.9E-4 !m^-1
43 lbb1 = 0.5 !1.0
44 lbb2 = 3.2 !3.0
45 lbb3 = 0.5 !0.5
46
47
48 !Initialization 2D
49 do k = 1,km
50 do i = 1,im
51 terma(i,k)=0.
52 termb(i,k)=0.
53 termc(i,k)=0.
54 rhs(i,k)=0.
55 omega(i,k)=omegain(i,k)
56 enddo
57 enddo
58
59 if(first_time_step .and. .not. flag_restart)then
60 do k = 1,km
61 do i = 1,im
62 if(cnvflg(i))then
63 omega(i,k)=-1.2 !Pa/s
64 endif
65 enddo
66 enddo
67 endif
68
69 ! Compute RHS terms
70 !Lisa Bengtsson: ! compute updraft velocity omega (Pa/s)
75
76 do k = 2, km
77 do i = 1, im
78 if (cnvflg(i)) then
79 if (k > kbcon1(i) .and. k < ktcon(i)) then
80
81 ! Aerodynamic drag parameter
82 kd(i,k) = (tentr(i,k)/entrn)*kdn
83
84 ! Scale by dp/dz to have equation in Pa/s
85 !(dp/dz > 0)
86 dp = 1000. * del(i,k)
87 dz = zi(i,k+1) - zi(i,k)
88
89 !termA - Ensures quadratic damping (drag).
90 !termB - Ensures linear damping from wind shear.
91 !termC - Adds buoyancy forcing
92
93 !Coefficients for the quadratic equation
94 terma(i,k) = delt * ((lbb1 * drag(i,k) * (dp/dz)) + (kd(i,k) * (dp/dz)))
95 termb(i,k) = -1.0 - delt * lbb3 * wush(i,k) * dp/dz
96 termc(i,k) = omega(i,k) - delt * lbb2 * buo(i,k) * (dp/dz) &
97 - delt * omega(i,k) * (omega(i,k-1) - omega(i,k)) / dp
98 !Compute the discriminant
99 discr = termb(i,k)**2 - 4.0 * terma(i,k) * termc(i,k)
100
101 ! Check if discriminant is non-negative
102 if (discr >= 0.0) then
103 ! Solve quadratic equation, take the negative root
104 omegaout(i,k) = (-termb(i,k) - sqrt(discr)) / (2.0 * terma(i,k))
105 else
106 omegaout(i,k) = omega(i,k)
107 endif
108
109 omegaout(i,k) = max(min(omegaout(i,k), -1.2), -80.0)
110
111 endif
112 endif
113 enddo
114 enddo
115
116 end subroutine progomega_calc
117end module progomega
subroutine, public progomega_calc(first_time_step, flag_restart, im, km, kbcon1, ktcon, omegain, delt, del, zi, cnvflg, omegaout, grav, buo, drag, wush, tentr, bb1, bb2)
This subroutine computes a prognostic updraft vertical velocity used in the closure computations in t...