do_write_jext Subroutine

private subroutine do_write_jext(time, istep)

Calculate and write the time-averaged antenna current to jext_unit

Arguments

Type IntentOptional Attributes Name
real, intent(in) :: time

Current simulation time

integer, intent(in) :: istep

Current timestep


Contents

Source Code


Source Code

  subroutine do_write_jext(time, istep)
    use kt_grids, only: ntheta0, naky
    use mp, only: proc0
    use warning_helpers, only: is_not_zero
    implicit none
    !> Current simulation time
    real, intent(in) :: time
    !> Current timestep
    integer, intent(in) :: istep
    integer :: ik, it
    real, dimension(:,:), allocatable ::  j_ext

    if (.not.proc0) return
    if (.not. write_ascii) return
    allocate (j_ext(ntheta0, naky)); j_ext=0.
    call calc_jext(istep, j_ext)
    do ik=1,naky
       do it = 1, ntheta0
          if (is_not_zero(j_ext(it, ik))) then
             write (unit=jext_unit, fmt="(es12.4,i4,i4,es12.4)")  &
                  time,it,ik,j_ext(it,ik)
          endif
       enddo
    enddo
    deallocate(j_ext)
  end subroutine do_write_jext