Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make RRTMGP thread-safe #2990

Merged
merged 5 commits into from
Jun 21, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@
[submodule "components/cam/src/physics/rrtmgp/external"]
path = components/cam/src/physics/rrtmgp/external
url = git@github.com:RobertPincus/rte-rrtmgp.git
branch = master
branch = develop
2 changes: 1 addition & 1 deletion components/cam/src/physics/rrtmgp/external
13 changes: 9 additions & 4 deletions components/cam/src/physics/rrtmgp/radiation.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1126,13 +1126,13 @@ subroutine radiation_tend(state, ptend, pbuf, cam_out, cam_in, &
! ---------------------------------------------------------------------------

! Pointers to heating rates on physics buffer
real(r8), pointer :: qrs(:,:) => null() ! shortwave radiative heating rate
real(r8), pointer :: qrl(:,:) => null() ! longwave radiative heating rate
real(r8), pointer :: qrs(:,:) ! shortwave radiative heating rate
real(r8), pointer :: qrl(:,:) ! longwave radiative heating rate

! Clear-sky heating rates are not on the physics buffer, and we have no
! reason to put them there, so declare these are regular arrays here
real(r8) :: qrsc(pcols,pver) = 0._r8
real(r8) :: qrlc(pcols,pver) = 0._r8
real(r8) :: qrsc(pcols,pver)
real(r8) :: qrlc(pcols,pver)

! Flag to carry (QRS,QRL)*dp across time steps.
! TODO: what does this mean?
Expand All @@ -1157,6 +1157,11 @@ subroutine radiation_tend(state, ptend, pbuf, cam_out, cam_in, &
! modified in this routine.
call pbuf_get_field(pbuf, pbuf_get_index('QRS'), qrs)
call pbuf_get_field(pbuf, pbuf_get_index('QRL'), qrl)

! Initialize clearsky-heating rates to make sure we do not get garbage
! for columns beyond ncol or nday
qrsc(:,:) = 0
qrlc(:,:) = 0

! Do shortwave stuff...
if (radiation_do('sw')) then
Expand Down