earth-system-radiation/rte-rrtmgp

combine_and_reorder_nstr permutes dimensions on “p”

Closed this issue · 0 comments

The combine_and_reorder_nstr routine appears to incorrectly index the input p array, which is assumed to have dimensions p(ncol,nlay,ngpt,nmom) but is accessed within combine_and_reorder_nstr as p(imom,icol,ilay,igpt).

It also appears that p(1:2,...) are written to, then p(1:nmom,...) are overwritten in a loop. In the event that nmom < 2 explicitly writing to p(2,...) will cause a segfault. This also causes some complications/dangers with the openACC port I think.