init_arrays Subroutine

private subroutine init_arrays()

FIXME : Add documentation

Arguments

None

Contents

Source Code


Source Code

  subroutine init_arrays
    use species, only: nspec
    use le_grids, only: init_map
    use kt_grids, only: naky, ntheta0
    use theta_grid, only: ntgrid
    use dist_fn_arrays, only: c_rate
    use array_utils, only: zero_array
    implicit none
    logical :: use_lz_layout, use_e_layout
! lowflow terms include higher-order corrections to GK equation
! such as parallel nonlinearity that require derivatives in v-space.
! most efficient way to take these derivatives is to go from g_lo to le_lo,
! i.e., bring all energies and lambdas onto each processor
!<DD>Note the user can still disable use_le_layout in the input file
!    this just changes the default.
!>@note, not clear the above is true -- init_map will always be called with
!le layout when lowflow active here. Given use_le_layout = T is default we
!might be able to get rid of this conditional compilation now?
# ifdef LOWFLOW
    use_le_layout = .true.
# endif
    use_lz_layout = .false. ; use_e_layout = .false.

    if (collision_model_switch == collision_model_none) then
       colls = .false.
       return
    end if

    call init_vnew
    if (all(abs(vnew(:,1,:)) <= 2.0*epsilon(0.0)) .and. .not. force_collisions) then
       collision_model_switch = collision_model_none
       colls = .false.
       return
    end if

    if (heating .and. .not. allocated(c_rate)) then
       allocate (c_rate(-ntgrid:ntgrid, ntheta0, naky, nspec, 3))
       call zero_array(c_rate)
    end if

    use_lz_layout = has_lorentz .and. .not. use_le_layout
    use_e_layout = has_diffuse .and. .not. use_le_layout
    call init_map (use_lz_layout, use_e_layout, use_le_layout, test)

    if (has_lorentz) then
       call init_lorentz
       if (conserve_moments) call init_lorentz_conserve
    end if

    if (has_diffuse) then
       call init_ediffuse
       if (conserve_moments) call init_diffuse_conserve
    end if

    if (use_le_layout .and. (conserve_moments .or. drag)) call init_le_bessel
  end subroutine init_arrays