SUBROUTINE med_feedback_domain ( parent_grid , nested_grid ) 1,7
   USE module_domain
   USE module_configure
   IMPLICIT NONE
   TYPE(domain), POINTER :: parent_grid , nested_grid
   TYPE(domain), POINTER :: grid
   INTEGER nlev, msize
   TYPE (grid_config_rec_type)            :: config_flags
#ifdef DEREF_KLUDGE
   INTEGER     :: sm31 , em31 , sm32 , em32 , sm33 , em33
   INTEGER     :: sm31x, em31x, sm32x, em32x, sm33x, em33x
   INTEGER     :: sm31y, em31y, sm32y, em32y, sm33y, em33y
#endif

   INTERFACE

      SUBROUTINE feedback_domain_em_part1 ( grid, nested_grid, config_flags ,  &
!
#include "em_dummy_args.inc"
!
                 )
         USE module_domain
         USE module_configure
         TYPE(domain), POINTER :: grid          ! name of the grid being dereferenced (must be "grid")
         TYPE(domain), POINTER :: nested_grid
         TYPE (grid_config_rec_type)            :: config_flags
#include <em_dummy_decl.inc>
      END SUBROUTINE feedback_domain_em_part1


      SUBROUTINE feedback_domain_em_part2 ( grid, nested_grid, config_flags ,  &
!
#include "em_dummy_args.inc"
!
                 )
         USE module_domain
         USE module_configure
         TYPE(domain), POINTER :: grid          ! name of the grid being dereferenced (must be "grid")
         TYPE(domain), POINTER :: nested_grid
         TYPE (grid_config_rec_type)            :: config_flags
#include <em_dummy_decl.inc>
      END SUBROUTINE feedback_domain_em_part2

   END INTERFACE

write(0,*)'entered med_feedback_domain '
write(0,*)' nested_grid%id  ',nested_grid%id

   CALL model_to_grid_config_rec ( nested_grid%id , model_config_rec , config_flags )

write(0,*)'back from model_to_grid_config_rec in med_feedback_domain '

   grid => nested_grid%intermediate_grid
#ifdef DEREF_KLUDGE
   sm31             = grid%sm31
   em31             = grid%em31
   sm32             = grid%sm32
   em32             = grid%em32
   sm33             = grid%sm33
   em33             = grid%em33
#endif


write(0,*)' med_feedback_domain 1'

#ifndef DM_PARALLEL

write(0,*)' W A R N I N G ----- mediation_feedback_domain.F not implemented yet for non-parallel '

#else

   IF      ( config_flags%dyn_opt == DYN_EH ) THEN

write(0,*)' W A R N I N G ----- mediation_feedback_domain.F not implemented yet for EH '

   ELSE IF ( config_flags%dyn_opt == DYN_EM ) THEN

     CALL feedback_domain_em_part1 ( grid, nested_grid, config_flags ,  &
!
#include "em_actual_args.inc"
!
                 )

   ENDIF

   grid => parent_grid
#ifdef DEREF_KLUDGE
   sm31             = grid%sm31
   em31             = grid%em31
   sm32             = grid%sm32
   em32             = grid%em32
   sm33             = grid%sm33
   em33             = grid%em33
   sm31x            = grid%sm31x
   em31x            = grid%em31x
   sm32x            = grid%sm32x
   em32x            = grid%em32x
   sm33x            = grid%sm33x
   em33x            = grid%em33x
   sm31y            = grid%sm31y
   em31y            = grid%em31y
   sm32y            = grid%sm32y
   em32y            = grid%em32y
   sm33y            = grid%sm33y
   em33y            = grid%em33y
#endif


   IF      ( config_flags%dyn_opt == DYN_EH ) THEN

write(0,*)' W A R N I N G ----- mediation_feedback_domain.F not implemented yet for non-parallel '

   ELSE IF ( config_flags%dyn_opt == DYN_EM ) THEN

     CALL feedback_domain_em_part2 ( grid , nested_grid%intermediate_grid, config_flags ,  &
!
#include "em_actual_args.inc"
!
                 )
   ENDIF
#endif

   RETURN
END SUBROUTINE med_feedback_domain