Write out to text file
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real, | intent(in) | :: | t |
subroutine do_dump_fields_periodically(t)
use file_utils, only: open_output_file, close_output_file
use kt_grids, only: naky, ntheta0, aky, theta0, akx
use theta_grid, only: theta, ntgrid
use fields_arrays, only: phinew, aparnew, bparnew
use constants, only: run_name_size
use mp, only: proc0
implicit none
real, intent(in) :: t
character(run_name_size) :: filename
integer :: ik, it, ig, unit
if (.not. proc0) return
write (filename, "('dump.fields.t=',e13.6)") t
call open_output_file(unit, '.'//filename)
do ik = 1, naky
do it = 1, ntheta0
do ig = -ntgrid, ntgrid
write (unit=unit, fmt="(20(1x,e12.5))") &
theta(ig), aky(ik), theta0(it,ik), &
phinew(ig,it,ik), aparnew(ig,it,ik), &
bparnew(ig,it,ik), t, akx(it)
end do
write (unit, "()")
end do
end do
call close_output_file (unit)
end subroutine do_dump_fields_periodically