Calculate (d Chi /dx).(d g_wesson/dy) and store in bracket if is_first_term = .true. else calculate (d Chi /dy).(d g_wesson/dx) and subtract from bracket
The final bracket value must be scaled by kxfac to produce the correct value to be used.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
logical, | intent(in) | :: | is_first_term |
subroutine calculate_bracket(is_first_term)
use gs2_layouts, only: accelx_lo, yxf_lo
implicit none
logical, intent(in) :: is_first_term
integer :: iyxf
if (is_first_term) then
if (accelerated) then
!$OMP PARALLEL DO DEFAULT(none) &
!$OMP PRIVATE(iyxf) &
!$OMP SHARED(accelx_lo, agb, aba, abracket) &
!$OMP SCHEDULE(static)
do iyxf = accelx_lo%llim_proc, accelx_lo%ulim_proc
abracket(:, :, iyxf) = aba(:, :, iyxf)*agb(:, :, iyxf)
end do
!$OMP END PARALLEL DO
else
!$OMP PARALLEL DO DEFAULT(none) &
!$OMP PRIVATE(iyxf) &
!$OMP SHARED(yxf_lo, bracket, ba, gb) &
!$OMP SCHEDULE(static)
do iyxf = yxf_lo%llim_proc, yxf_lo%ulim_proc
bracket(:, iyxf) = ba(:, iyxf)*gb(:, iyxf)
end do
!$OMP END PARALLEL DO
endif
else
if (accelerated) then
!$OMP PARALLEL DO DEFAULT(none) &
!$OMP PRIVATE(iyxf) &
!$OMP SHARED(accelx_lo, agb, aba, abracket) &
!$OMP SCHEDULE(static)
do iyxf = accelx_lo%llim_proc, accelx_lo%ulim_proc
abracket(:, :, iyxf) = abracket(:, :, iyxf) - aba(:, :, iyxf)*agb(:, :, iyxf)
end do
!$OMP END PARALLEL DO
else
!$OMP PARALLEL DO DEFAULT(none) &
!$OMP PRIVATE(iyxf) &
!$OMP SHARED(yxf_lo, bracket, ba, gb) &
!$OMP SCHEDULE(static)
do iyxf = yxf_lo%llim_proc, yxf_lo%ulim_proc
bracket(:, iyxf) = bracket(:, iyxf) - ba(:, iyxf)*gb(:, iyxf)
end do
!$OMP END PARALLEL DO
endif
endif
end subroutine calculate_bracket