sc_dump_to_file Subroutine

private subroutine sc_dump_to_file(self, suffix)

Routine to write the response matrix for this supercell to netcdf file.

Type Bound

supercell_type

Arguments

Type IntentOptional Attributes Name
class(supercell_type), intent(inout) :: self

The instance of the supercell class

character(len=*), intent(in), optional :: suffix

If passed then use as part of file suffix


Contents

Source Code


Source Code

  subroutine sc_dump_to_file(self, suffix)
    use gs2_save, only: gs2_save_response
    use fields_arrays, only: get_specific_response_file_name, time_dump_response
    use gs2_time, only: code_dt
    use job_manage, only: time_message
    implicit none
    !> The instance of the supercell class
    class(supercell_type), intent(in out) :: self
    !> If passed then use as part of file suffix
    character(len=*), optional, intent(in) :: suffix
    complex, dimension(:,:), allocatable :: tmp_arr

    ! Exit early if we're not involved in this supercell
    if(.not.self%is_local) return
    call time_message(.false.,time_dump_response,' Field Dump')

    !Allocate array -- for big problems this might be an issue
    allocate(tmp_arr(self%nrow,self%ncol))

    !First have to pull all row level data
    call self%pull_rows_to_arr(tmp_arr)

    !Now save if on head proc -- could probably only allocate tmp_arr and call
    !pull_rows_to_arr on this head proc as well, at least for now.
    if(self%is_head)then
       call gs2_save_response(tmp_arr, get_specific_response_file_name(self%ik_ind, self%is_ind, code_dt, suffix), code_dt, self%condition_number)
    endif

    deallocate(tmp_arr)
    call time_message(.false.,time_dump_response,' Field Dump')
  end subroutine sc_dump_to_file