Write various moments to netCDF
subroutine do_write_moments
use gs2_io, only: nc_write_moments
use theta_grid, only: ntgrid
use kt_grids, only: naky, ntheta0
use species, only: nspec
use diagnostics_moments, only: getmoms
use mp, only: proc0
use fields_arrays, only: phinew, bparnew
implicit none
complex, dimension (-ntgrid:ntgrid,ntheta0,naky,nspec) :: ntot, density, &
upar, tpar, tperp, qparflux, pperpj1, qpperpj1
call getmoms (phinew, bparnew, ntot, density, upar, tpar, tperp, qparflux, pperpj1, qpperpj1)
if(proc0) call nc_write_moments(get_netcdf_file_id(), nout, ntot, density, upar, tpar, tperp,qparflux, &
pperpj1, qpperpj1, ob_midplane=ob_midplane)
end subroutine do_write_moments