FIXME : Add documentation
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(diagnostics_type), | intent(inout) | :: | gnostics |
subroutine write_fields(gnostics)
use fields_arrays, only: phinew, aparnew, bparnew
use run_parameters, only: has_phi, has_apar, has_bpar
use diagnostics_config, only: diagnostics_type
use gs2_io, only: nc_write_field
implicit none
type(diagnostics_type), intent(inout) :: gnostics
if (.not. gnostics%writing) return
if (has_phi) then
call nc_write_field(gnostics%file_id, gnostics%nout, phinew, &
"phi", "Electrostatic potential", gnostics%igomega, gnostics%write_phi_over_time,&
gnostics%current_results%phi2)
end if
if (has_apar) then
call nc_write_field(gnostics%file_id, gnostics%nout, aparnew, &
"apar", "Parallel magnetic potential", gnostics%igomega, gnostics%write_apar_over_time,&
gnostics%current_results%apar2)
end if
if (has_bpar) then
call nc_write_field(gnostics%file_id, gnostics%nout, bparnew, &
"bpar", "Parallel magnetic field", gnostics%igomega, gnostics%write_bpar_over_time,&
gnostics%current_results%bpar2)
end if
end subroutine write_fields