!**********************************************************************
module nbi_aep_com
!## mhd transport (mario podesta) profile array dimensions
  use iso_c_binding, only: fp => c_double
  implicit none
  private :: fp
  integer :: nkaep,ntaep,ndeaep,ndpaep,neaep,npaep,nmuaep
  real(fp),dimension(:), allocatable ::  aepsp  !code # of species with
!  which mode (nk) will have intercation
!  species code #
!  0                  ;ALL fast ion SPECIES in this run (in NUBEAM)
!  1                  ;deuterium
!  2                  ;tritium
!  3                  ;HE3
!  4                  ;HE4
!  5                  ;protons
!
  real(fp),dimension(:), allocatable ::  aept ! (mtaep),mhd transport profile time data
  real(fp),dimension(:), allocatable ::  aeptstep ! (mnkaep) mhd transport mode time step
  real(fp),dimension(:,:), allocatable :: aepde ! (mnkaep,3)   
                             ! 1: no of grid point for de (ndeaep)
                             ! 2/3 min/max de data for each nk term in series
  real(fp),dimension(:,:), allocatable :: aepe  !(mnkaep,3)
                             ! 1: no of grid point for e (neaep)
                             ! 2/3 min/max e data for each nk term in series
  real(fp),dimension(:,:), allocatable ::  aepdp  !(mnkaep,3)    
                             ! 1: no of grid point for dp (ndpaep)
                             ! 2/3 min/max dp data for each nk term in series
  real(fp),dimension(:,:), allocatable ::  aepp   !(mnkaep,3)
                             ! 1: no of grid point for p (npaep)
                             ! 2/3 min/max p data for each nk term in series
  real(fp),dimension(:,:), allocatable ::  aepmu   !(mnkaep,3) 
                             ! 1: no of grid point for mu (nmuaep)
                             ! 2/3 min/max mu data for each nk term in series
  real(fp),dimension(:,:), allocatable ::  aepa   !(mtaep,mnkaep) 
                             ! mhd transport amplitude profile data
  real(fp),dimension(:,:,:,:,:,:), allocatable ::  aepd   !(mdeaep,mdpaep,meaep,mpaep,mmuaep,mnkaep)
                             ! mhd transport probability profile data
  real(fp),dimension(:,:,:,:,:), allocatable :: pbaep_ms ! (neaep,npaep,nmuaep,mnkaep,mibs)
                             !power due to aep (mhd) activity
  real(fp),dimension(:,:,:,:,:), allocatable :: pph_ms ! (neaep,npaep,nmuaep,mnkaep,mibs)
                              ! canonical momentum variation due to aep (mhd) activity
   real(fp),dimension(:,:,:), allocatable :: pbaep_pol ! (n_norm_pol,mnkaep,mibs)
                              ! power  exchange vs norm psi poloidal flux, mode id due  to aep (mhd) activity
 real(fp),dimension(:,:,:,:,:), allocatable :: aep_count ! (neaep,npaep,nmuaep,mnkaep,mibs)
                              ! number of particles contributing to aep (mhd) activity
  integer :: np_e,np_p, np_m
!  integer, dimension(:),allocatable  :: imap_nkaep_use !mapping array
  integer :: nkaep_use              ! # of active modes
  integer,parameter :: n_norm_pol=101
  logical,dimension(:), allocatable :: ilaep_init
end module nbi_aep_com
!*********************************************************************
