ginit_restart_file Subroutine

private subroutine ginit_restart_file()

FIXME: This is identical to ginit_restart_many? Remove?

Arguments

None

Contents

Source Code


Source Code

  subroutine ginit_restart_file
    use dist_fn_arrays, only: g, gnew
    use fields_arrays, only: phi, apar, bpar, phinew, aparnew, bparnew
    use gs2_save, only: gs2_restore
    use mp, only: proc0
    use file_utils, only: error_unit
    use run_parameters, only: has_phi, has_apar, has_bpar
    use array_utils, only: copy, zero_array
    implicit none
    integer :: istatus, ierr

    call gs2_restore (g, scale, istatus, has_phi, has_apar, has_bpar)
    if (istatus /= 0) then
       ierr = error_unit()
       if (proc0) write(ierr,*) "Error reading file: ", trim(restart_file)
       call zero_array(g)
    end if
    call copy(g, gnew)
    call copy(phinew, phi) ; call copy(aparnew, apar) ; call copy(bparnew, bpar)
  end subroutine ginit_restart_file