CCPP SciDoc v7.0.0  v7.0.0
Common Community Physics Package Developed at DTC
 
Loading...
Searching...
No Matches
GFS_GWD_generic_post.F90
1
5
6contains
7
14 subroutine gfs_gwd_generic_post_run(lssav, ldiag3d, dtf, dusfcg, dvsfcg, dudt, dvdt, dtdt, &
15 & dugwd, dvgwd, flag_for_gwd_generic_tend, dtend, dtidx, index_of_temperature, index_of_x_wind, &
16 & index_of_y_wind, index_of_process_orographic_gwd, errmsg, errflg)
17
18 use machine, only : kind_phys
19 implicit none
20
21 logical, intent(in) :: lssav, ldiag3d, flag_for_gwd_generic_tend
22
23 real(kind=kind_phys), intent(in) :: dusfcg(:), dvsfcg(:)
24 real(kind=kind_phys), intent(in) :: dudt(:,:), dvdt(:,:), dtdt(:,:)
25 real(kind=kind_phys), intent(in) :: dtf
26
27 real(kind=kind_phys), intent(inout) :: dugwd(:), dvgwd(:)
28
29 ! dtend only allocated only if ldiag3d is .true.
30 real(kind=kind_phys), intent(inout), optional :: dtend(:,:,:)
31 integer, intent(in) :: dtidx(:,:), index_of_temperature, &
32 & index_of_x_wind, index_of_y_wind, index_of_process_orographic_gwd
33
34 character(len=*), intent(out) :: errmsg
35 integer, intent(out) :: errflg
36
37 integer :: idtend
38
39 ! Initialize CCPP error handling variables
40 errmsg = ''
41 errflg = 0
42
43 if (lssav) then
44 dugwd(:) = dugwd(:) + dusfcg(:)*dtf
45 dvgwd(:) = dvgwd(:) + dvsfcg(:)*dtf
46
47 if (ldiag3d .and. flag_for_gwd_generic_tend) then
48 idtend = dtidx(index_of_temperature, index_of_process_orographic_gwd)
49 if(idtend>=1) then
50 dtend(:,:,idtend) = dtend(:,:,idtend) + dtdt*dtf
51 endif
52
53 idtend = dtidx(index_of_x_wind, index_of_process_orographic_gwd)
54 if(idtend>=1) then
55 dtend(:,:,idtend) = dtend(:,:,idtend) + dudt*dtf
56 endif
57
58 idtend = dtidx(index_of_y_wind, index_of_process_orographic_gwd)
59 if(idtend>=1) then
60 dtend(:,:,idtend) = dtend(:,:,idtend) + dvdt*dtf
61 endif
62 endif
63 endif
64
65 end subroutine gfs_gwd_generic_post_run
67
68end module gfs_gwd_generic_post