getfield_local Subroutine

private subroutine getfield_local(phi, apar, bpar, do_gather_in, do_update_in)

Calculate the update to the fields

Type Bound

fields_local_testing

Arguments

Type IntentOptional Attributes Name
complex, intent(out), dimension(:,:,:) :: phi
complex, intent(out), dimension(:,:,:) :: apar
complex, intent(out), dimension(:,:,:) :: bpar
logical, intent(in), optional :: do_gather_in
logical, intent(in), optional :: do_update_in

Contents

Source Code


Source Code

  subroutine getfield_local(phi,apar,bpar,do_gather_in,do_update_in)
    use unit_tests, only: debug_message
    use optionals, only: get_option_with_default
    implicit none
    complex, dimension(:,:,:), intent(out) :: phi,apar,bpar !Note, these are actually phinew,... in typical usage
    logical, optional, intent(in) :: do_gather_in, do_update_in
    logical :: do_gather, do_update
    integer, parameter :: verb = 4

    !Set gather flag, this currently always needs to be true for
    !correct operation.
    do_gather = get_option_with_default(do_gather_in, .false.)
    do_update = get_option_with_default(do_update_in, .false.)

    call debug_message(verb, &
        'fields_local::getfield_local calling get_field_update')
    !Use fieldmat routine to calculate the field update
    call fieldmat%get_field_update(phi,apar,bpar,pc)

    call debug_message(verb, &
        'fields_local::getfield_local calling gather_fields')
    !Gather to proc0 if requested
    !NOTE: We currently calculate omega at every time step so we
    !actually need to gather everytime, which is a pain!
    !We also fill in the empties here.
    do_gather = .true.
    if(do_gather) call fieldmat%gather_fields(phi,apar,bpar,&
         to_all_in=.false.,do_allreduce_in=field_local_allreduce)

    call debug_message(verb, &
        'fields_local::getfield_local calling update_fields')
    !This routine updates *new fields using gathered update
    if(do_update) call fieldmat%update_fields(phi,apar,bpar)

    call debug_message(verb, &
        'fields_local::getfield_local finished')
  end subroutine getfield_local