nc_final_fields Subroutine

public subroutine nc_final_fields(file_id)

Write the fields to netCDF, overwriting existing values

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: file_id

NetCDF ID of the file to write to


Contents

Source Code


Source Code

  subroutine nc_final_fields(file_id)
#ifdef NETCDF
    use fields_arrays, only: phinew, aparnew, bparnew
    use run_parameters, only: has_phi, has_apar, has_bpar
#endif
    implicit none
    !> NetCDF ID of the file to write to
    integer, intent(in) :: file_id
#ifdef NETCDF
    if (has_phi) then
       call netcdf_write_complex(file_id, "phi", phinew, final_field_dims, &
            long_name="Electrostatic Potential", units="T_ref/q_ref rho_ref/a_ref")
    end if

    if (has_apar) then
       call netcdf_write_complex(file_id, "apar", aparnew, final_field_dims, &
            long_name="Parallel Magnetic Potential")
    end if

    if (has_bpar) then
       call netcdf_write_complex(file_id, "bpar", bparnew, final_field_dims, &
            long_name="delta B Parallel")
    end if
# endif
  end subroutine nc_final_fields