CCPP SciDoc v7.0.0  v7.0.0
Common Community Physics Package Developed at DTC
 
Loading...
Searching...
No Matches
GFS_GWD_generic_pre.F90
1
4
6
7contains
8
12 subroutine gfs_gwd_generic_pre_run( &
13 & im, levs, nmtvr, mntvar, &
14 & oc, oa4, clx, theta, &
15 & varss, ocss, oa4ss, clxss, &
16 & sigma, gamma, elvmax, lssav, ldiag3d, &
17 & dtend, dtidx, index_of_temperature, index_of_x_wind, &
18 & index_of_y_wind, index_of_process_orographic_gwd, &
19 & dudt, dvdt, dtdt, dtf, &
20 & flag_for_gwd_generic_tend, errmsg, errflg)
21
22 use machine, only : kind_phys
23 implicit none
24
25 integer, intent(in) :: im, levs, nmtvr
26 real(kind=kind_phys), intent(in) :: mntvar(:,:)
27
28 real(kind=kind_phys), intent(out) :: &
29 & oc(:), oa4(:,:), clx(:,:), &
30 & theta(:), sigma(:), gamma(:), elvmax(:)
31 real(kind=kind_phys), intent(out), optional :: &
32 & varss(:), ocss(:), oa4ss(:,:), clxss(:,:)
33 logical, intent(in) :: lssav, ldiag3d, flag_for_gwd_generic_tend
34 real(kind=kind_phys), intent(in) :: dtdt(:,:), dudt(:,:), dvdt(:,:)
35 ! dtend only allocated only if ldiag3d is .true.
36 real(kind=kind_phys), intent(inout), optional :: dtend(:,:,:)
37 integer, intent(in) :: dtidx(:,:), index_of_temperature, &
38 & index_of_x_wind, index_of_y_wind, index_of_process_orographic_gwd
39 real(kind=kind_phys), intent(in) :: dtf
40
41 character(len=*), intent(out) :: errmsg
42 integer, intent(out) :: errflg
43
44 integer :: i, k, idtend
45
46 ! Initialize CCPP error handling variables
47 errmsg = ''
48 errflg = 0
49
50 if (nmtvr == 14) then ! current operational - as of 2014
51 oc(:) = mntvar(:,2)
52 oa4(:,1) = mntvar(:,3)
53 oa4(:,2) = mntvar(:,4)
54 oa4(:,3) = mntvar(:,5)
55 oa4(:,4) = mntvar(:,6)
56 clx(:,1) = mntvar(:,7)
57 clx(:,2) = mntvar(:,8)
58 clx(:,3) = mntvar(:,9)
59 clx(:,4) = mntvar(:,10)
60 theta(:) = mntvar(:,11)
61 gamma(:) = mntvar(:,12)
62 sigma(:) = mntvar(:,13)
63 elvmax(:) = mntvar(:,14)
64 elseif (nmtvr == 10) then
65 oc(:) = mntvar(:,2)
66 oa4(:,1) = mntvar(:,3)
67 oa4(:,2) = mntvar(:,4)
68 oa4(:,3) = mntvar(:,5)
69 oa4(:,4) = mntvar(:,6)
70 clx(:,1) = mntvar(:,7)
71 clx(:,2) = mntvar(:,8)
72 clx(:,3) = mntvar(:,9)
73 clx(:,4) = mntvar(:,10)
74 elseif (nmtvr == 6) then
75 oc(:) = mntvar(:,2)
76 oa4(:,1) = mntvar(:,3)
77 oa4(:,2) = mntvar(:,4)
78 oa4(:,3) = mntvar(:,5)
79 oa4(:,4) = mntvar(:,6)
80 clx(:,1) = 0.0
81 clx(:,2) = 0.0
82 clx(:,3) = 0.0
83 clx(:,4) = 0.0
84 elseif (nmtvr == 24) then ! GSD_drag_suite and unified_ugwp
85 oc(:) = mntvar(:,2)
86 oa4(:,1) = mntvar(:,3)
87 oa4(:,2) = mntvar(:,4)
88 oa4(:,3) = mntvar(:,5)
89 oa4(:,4) = mntvar(:,6)
90 clx(:,1) = mntvar(:,7)
91 clx(:,2) = mntvar(:,8)
92 clx(:,3) = mntvar(:,9)
93 clx(:,4) = mntvar(:,10)
94 theta(:) = mntvar(:,11)
95 gamma(:) = mntvar(:,12)
96 sigma(:) = mntvar(:,13)
97 elvmax(:) = mntvar(:,14)
98 varss(:) = mntvar(:,15)
99 ocss(:) = mntvar(:,16)
100 oa4ss(:,1) = mntvar(:,17)
101 oa4ss(:,2) = mntvar(:,18)
102 oa4ss(:,3) = mntvar(:,19)
103 oa4ss(:,4) = mntvar(:,20)
104 clxss(:,1) = mntvar(:,21)
105 clxss(:,2) = mntvar(:,22)
106 clxss(:,3) = mntvar(:,23)
107 clxss(:,4) = mntvar(:,24)
108 else
109 oc = 0
110 oa4 = 0
111 clx = 0
112 theta = 0
113 gamma = 0
114 sigma = 0
115 elvmax = 0
116 endif ! end if_nmtvr
117
118 if (lssav .and. ldiag3d .and. flag_for_gwd_generic_tend) then
119 idtend = dtidx(index_of_temperature, index_of_process_orographic_gwd)
120 if(idtend>=1) then
121 dtend(:,:,idtend) = dtend(:,:,idtend) - dtdt*dtf
122 endif
123
124 idtend = dtidx(index_of_x_wind, index_of_process_orographic_gwd)
125 if(idtend>=1) then
126 dtend(:,:,idtend) = dtend(:,:,idtend) - dudt*dtf
127 endif
128
129 idtend = dtidx(index_of_y_wind, index_of_process_orographic_gwd)
130 if(idtend>=1) then
131 dtend(:,:,idtend) = dtend(:,:,idtend) - dvdt*dtf
132 endif
133 endif
134
135 end subroutine gfs_gwd_generic_pre_run
136
137end module gfs_gwd_generic_pre