Skip to content

Commit

Permalink
Merge branch 'develop' into feature-add-kernel-api
Browse files Browse the repository at this point in the history
  • Loading branch information
RobertPincus committed Mar 23, 2024
2 parents 81a645a + 1b75505 commit 5c0559a
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions rrtmgp-frontend/mo_gas_optics_rrtmgp.F90
Original file line number Diff line number Diff line change
Expand Up @@ -801,6 +801,7 @@ function set_tsi(this, tsi) result(error_msg)
character(len=128) :: error_msg !! Empty if successful

real(wp) :: norm
integer :: igpt, length
! ----------------------------------------------------------
error_msg = ""
if(tsi < 0._wp) then
Expand All @@ -809,12 +810,21 @@ function set_tsi(this, tsi) result(error_msg)
!
! Scale the solar source function to the input tsi
!
!$acc kernels
!$omp target
norm = 1._wp/sum(this%solar_source(:))
this%solar_source(:) = this%solar_source(:) * tsi * norm
!$acc end kernels
!$omp end target
norm = 0._wp
length = size(this%solar_source)
!$acc parallel loop gang vector reduction(+:norm)
!$omp target teams distribute parallel do simd reduction(+:norm)
do igpt = 1, length
norm = norm + this%solar_source(igpt)
end do

norm = 1._wp/norm

!$acc parallel loop gang vector
!$omp target teams distribute parallel do simd
do igpt = 1, length
this%solar_source(igpt) = this%solar_source(igpt) * tsi * norm
end do
end if

end function set_tsi
Expand Down

0 comments on commit 5c0559a

Please sign in to comment.