Write the right-hand sides of the field equations, overwriting existing values
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
logical, | intent(in) | :: | write_text |
Write to text file |
||
logical, | intent(in) | :: | write_netcdf |
Write to netcdf file |
||
integer, | intent(in) | :: | file_id |
NetCDF ID of the file to write to |
subroutine do_write_final_antot(write_text, write_netcdf, file_id)
use file_utils, only: open_output_file, close_output_file
use mp, only: proc0
use kt_grids, only: ntheta0, naky, theta0, aky
use theta_grid, only: theta, ntgrid
use gs2_io, only: nc_final_an
use dist_fn, only: getan
use dist_fn_arrays, only: antot, antota, antotp
implicit none
!> Write to text file
logical, intent(in) :: write_text
!> Write to netcdf file
logical, intent(in) :: write_netcdf
!> NetCDF ID of the file to write to
integer, intent(in) :: file_id
integer :: ik, it, ig, unit
if (.not. (write_text .or. write_netcdf)) return
call getan (antot, antota, antotp)
if (.not. proc0) return
if (write_text) then
call open_output_file (unit, ".antot")
do ik = 1, naky
do it = 1, ntheta0
do ig = -ntgrid, ntgrid
write (unit, "(10(1x,e12.5))") &
theta(ig), theta0(it,ik), aky(ik), &
antot(ig,it,ik), &
antota(ig,it,ik), &
antotp(ig,it,ik), &
theta(ig) - theta0(it,ik)
end do
write (unit, "()")
end do
end do
call close_output_file (unit)
end if
if (write_netcdf) call nc_final_an (file_id, antot, antota, antotp)
end subroutine do_write_final_antot