12     subroutine ugwpv1_gsldrag_post_run ( im, levs, ldiag_ugwp,       &
 
   13         dtf, dudt_gw, dvdt_gw, dtdt_gw,                              &
 
   14         tau_ogw, tau_ngw, zobl, zlwb, zogw, dudt_obl, dvdt_obl,      &
 
   15         dudt_ofd, dvdt_ofd, dudt_ogw, dvdt_ogw,                      &
 
   16         dudt_oss, dvdt_oss, tot_zmtb, tot_zlwb, tot_zogw,            &
 
   17         tot_tofd, tot_mtb, tot_ogw, tot_ngw,                         &
 
   18         du3dt_mtb,du3dt_ogw, du3dt_tms, du3dt_ngw, dv3dt_ngw,        &
 
   19         dudt_ngw, dvdt_ngw, dtdt_ngw,                                &
 
   20         ldu3dt_ngw, ldv3dt_ngw, ldt3dt_ngw,                          &
 
   21         dws3dt_ogw, dws3dt_obl, dws3dt_oss, dws3dt_ofd,              &
 
   22         ldu3dt_ogw, ldu3dt_obl, ldu3dt_oss, ldu3dt_ofd,              &
 
   23         du_ogwcol, dv_ogwcol, du_oblcol, dv_oblcol, du_osscol,       &
 
   24         dv_osscol, du_ofdcol, dv_ofdcol, du3_ogwcol, dv3_ogwcol,     &
 
   25         du3_oblcol, dv3_oblcol, du3_osscol, dv3_osscol, du3_ofdcol,  &
 
   26         dv3_ofdcol, dtdt, dudt, dvdt, errmsg, errflg)
 
   28        use machine,                
only: kind_phys
 
   33        integer,              
intent(in) :: im, levs
 
   34        real(kind=kind_phys), 
intent(in) :: dtf
 
   35        logical,              
intent(in) :: ldiag_ugwp
 
   37        real(kind=kind_phys), 
intent(in),    
dimension(:)   :: zobl, zlwb, zogw
 
   38        real(kind=kind_phys), 
intent(in),    
dimension(:)   :: tau_ogw, tau_ngw
 
   39        real(kind=kind_phys), 
intent(in),    
dimension(:),
optional   :: du_ofdcol, du_oblcol
 
   40        real(kind=kind_phys), 
intent(inout), 
dimension(:)   :: tot_mtb, tot_ogw, tot_tofd, tot_ngw
 
   41        real(kind=kind_phys), 
intent(inout), 
dimension(:)   :: tot_zmtb, tot_zlwb, tot_zogw
 
   43        real(kind=kind_phys), 
intent(in),    
dimension(:,:) :: dtdt_gw, dudt_gw, dvdt_gw
 
   44        real(kind=kind_phys), 
intent(in),    
dimension(:,:), 
optional :: dudt_obl, dvdt_obl, dudt_ogw
 
   45        real(kind=kind_phys), 
intent(in),    
dimension(:,:), 
optional :: dvdt_ogw, dudt_ofd, dvdt_ofd
 
   46        real(kind=kind_phys), 
intent(in),    
dimension(:,:), 
optional :: dudt_oss, dvdt_oss
 
   47        real(kind=kind_phys), 
intent(inout), 
dimension(:,:), 
optional :: du3dt_mtb, du3dt_ogw, du3dt_tms
 
   48        real(kind=kind_phys), 
intent(inout), 
dimension(:,:), 
optional :: du3dt_ngw, dv3dt_ngw
 
   49        real(kind=kind_phys), 
intent(in),    
dimension(:,:), 
optional :: dudt_ngw, dvdt_ngw, dtdt_ngw
 
   50        real(kind=kind_phys), 
intent(inout), 
dimension(:,:), 
optional :: ldu3dt_ngw, ldv3dt_ngw, ldt3dt_ngw
 
   51        real(kind=kind_phys), 
intent(inout), 
dimension(:,:), 
optional :: dws3dt_ogw, dws3dt_obl
 
   52        real(kind=kind_phys), 
intent(inout), 
dimension(:,:), 
optional :: dws3dt_oss, dws3dt_ofd
 
   53        real(kind=kind_phys), 
intent(inout), 
dimension(:,:), 
optional :: ldu3dt_ogw, ldu3dt_obl
 
   54        real(kind=kind_phys), 
intent(inout), 
dimension(:,:), 
optional :: ldu3dt_oss, ldu3dt_ofd
 
   55        real(kind=kind_phys), 
intent(in),    
dimension(:), 
optional   :: du_ogwcol, dv_ogwcol
 
   56        real(kind=kind_phys), 
intent(in),    
dimension(:), 
optional   :: dv_oblcol
 
   57        real(kind=kind_phys), 
intent(in),    
dimension(:), 
optional   :: du_osscol, dv_osscol
 
   58        real(kind=kind_phys), 
intent(in),    
dimension(:), 
optional   :: dv_ofdcol
 
   59        real(kind=kind_phys), 
intent(inout), 
dimension(:), 
optional   :: du3_ogwcol, dv3_ogwcol
 
   60        real(kind=kind_phys), 
intent(inout), 
dimension(:), 
optional   :: du3_oblcol, dv3_oblcol
 
   61        real(kind=kind_phys), 
intent(inout), 
dimension(:), 
optional   :: du3_osscol, dv3_osscol
 
   62        real(kind=kind_phys), 
intent(inout), 
dimension(:), 
optional   :: du3_ofdcol, dv3_ofdcol
 
   64        real(kind=kind_phys), 
intent(inout), 
dimension(:,:) :: dtdt, dudt, dvdt
 
   66        character(len=*),        
intent(out) :: errmsg
 
   67        integer,                 
intent(out) :: errflg
 
   77          tot_zmtb =  tot_zmtb + dtf *zobl
 
   78          tot_zlwb =  tot_zlwb + dtf *zlwb
 
   79          tot_zogw =  tot_zogw + dtf *zogw
 
   81          tot_tofd  = tot_tofd + dtf *du_ofdcol
 
   82          tot_mtb   = tot_mtb +  dtf *du_oblcol
 
   83          tot_ogw   = tot_ogw +  dtf *tau_ogw
 
   84          tot_ngw   = tot_ngw +  dtf *tau_ngw
 
   86          du3dt_mtb = du3dt_mtb + dtf *dudt_obl
 
   87          du3dt_tms = du3dt_tms + dtf *dudt_ofd
 
   88          du3dt_ogw = du3dt_ogw + dtf *dudt_ogw
 
   89          du3dt_ngw = du3dt_ngw + dtf *dudt_gw
 
   90          dv3dt_ngw = dv3dt_ngw + dtf *dvdt_gw
 
   92          dws3dt_ogw = dws3dt_ogw + dtf *sqrt(dudt_ogw**2+dvdt_ogw**2)
 
   93          dws3dt_obl = dws3dt_obl + dtf *sqrt(dudt_obl**2+dvdt_obl**2)
 
   95          du3_ogwcol = du3_ogwcol + dtf *du_ogwcol
 
   96          dv3_ogwcol = dv3_ogwcol + dtf *dv_ogwcol
 
   97          du3_oblcol = du3_oblcol + dtf *du_oblcol
 
   98          dv3_oblcol = dv3_oblcol + dtf *dv_oblcol
 
  100          dws3dt_oss = dws3dt_oss + dtf *sqrt(dudt_oss**2+dvdt_oss**2)
 
  101          dws3dt_ofd = dws3dt_ofd + dtf *sqrt(dudt_ofd**2+dvdt_ofd**2)
 
  103          ldu3dt_ogw = ldu3dt_ogw + dtf *dudt_ogw
 
  104          ldu3dt_obl = ldu3dt_obl + dtf *dudt_obl
 
  105          ldu3dt_oss = ldu3dt_oss + dtf *dudt_oss
 
  106          ldu3dt_ofd = ldu3dt_ofd + dtf *dudt_ofd
 
  108          du3_osscol = du3_osscol + dtf*du_osscol
 
  109          dv3_osscol = dv3_osscol + dtf*dv_osscol
 
  110          du3_ofdcol = du3_ofdcol + dtf*du_ofdcol
 
  111          dv3_ofdcol = dv3_ofdcol + dtf*dv_ofdcol
 
  114          ldu3dt_ngw = ldu3dt_ngw + dtf *dudt_ngw
 
  115          ldv3dt_ngw = ldv3dt_ngw + dtf *dvdt_ngw
 
  116          ldt3dt_ngw = ldt3dt_ngw + dtf *dtdt_ngw