specified_get_grids Subroutine

public subroutine specified_get_grids(aky, theta0, akx, ikx, kt_grids_specified_element_config_in)

Uses

FIXME : Add documentation

Arguments

Type IntentOptional Attributes Name
real, intent(out), dimension (:) :: aky
real, intent(out), dimension (:,:) :: theta0
real, intent(out), dimension (:) :: akx
integer, intent(out), dimension (:) :: ikx

Discrete kx wavenumber grid indices

type(kt_grids_specified_element_config_type), intent(in), optional, dimension(:) :: kt_grids_specified_element_config_in

Contents

Source Code


Source Code

 subroutine specified_get_grids (aky, theta0, akx, ikx, kt_grids_specified_element_config_in)
   use mp, only: proc0
   implicit none
   real, dimension (:), intent (out) :: akx, aky
   real, dimension (:,:), intent (out) :: theta0
   !> Discrete kx wavenumber grid indices
   integer, dimension (:), intent (out) :: ikx
   type(kt_grids_specified_element_config_type), intent(in), dimension(:), optional :: kt_grids_specified_element_config_in    
   real :: aky_dummy, theta0_dummy, akx_dummy
   integer :: i, naky, ntheta0, nmodes

   ! Note we shadow the module naky/ntheta variables here
   naky = size(aky)  ;  ntheta0 = size(akx)
   nmodes = max(naky,ntheta0)
   
   if(.not.allocated(kt_grids_specified_element_config)) allocate(kt_grids_specified_element_config(nmodes))
   
   if (size(kt_grids_specified_element_config) .ne. nmodes) then
      if(proc0) print*,"Warning: inconsistent number of config elements."
   end if
   
   do i = 1, nmodes
      call read_element (i, aky_dummy, theta0_dummy, akx_dummy, kt_grids_specified_element_config_in)
      if (i <= naky) aky(i) = aky_dummy
      if (i <= ntheta0) theta0(i,:) = theta0_dummy
      if (i <= ntheta0) akx(i) = akx_dummy
      if (i <= ntheta0) ikx(i) = i - 1
    end do
    
  end subroutine specified_get_grids