Skip to content

Commit

Permalink
fix Kb_sing calculation
Browse files Browse the repository at this point in the history
Using a do loop in place of broadcasting is necessary here
per the fortran standard since the pointers and arrays are
not contiguous in memory.
  • Loading branch information
glemieux committed Nov 20, 2024
1 parent 589f263 commit e7b332f
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions radiation/TwoStreamMLPEMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -979,10 +979,12 @@ subroutine ZenithPrep(this,cosz_in)
iter_sing = 0

! Compute the singularity for all bands
Kb_sing(:) = this%band(:)%scelb(ican,icol)%a
if (scelg%lai>nearzero) then
Kb_sing(:) = (Kb_sing(:) * (scelg%lai+scelg%sai) - scelg%sai*Kb_stem)/scelg%lai
end if
do ib = 1,this%n_bands
Kb_sing(ib) = this%band(ib)%scelb(ican,icol)%a
if (scelg%lai>nearzero) then
Kb_sing(ib) = (Kb_sing(ib) * (scelg%lai+scelg%sai) - scelg%sai*Kb_stem)/scelg%lai
end if
end do

do_test_sing: do while(is_sing)
! Now that we have commited to testing it, assume the solution works
Expand Down

0 comments on commit e7b332f

Please sign in to comment.