Skip to content

Commit eb70561

Browse files
committed
Fixing bug; missing index convertion.
1 parent 5663de2 commit eb70561

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

components/eamxx/src/physics/mam/impl/helper_micro.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -203,22 +203,22 @@ void vert_interp(int ncol, int levsiz, int pver, const view_2d &pin,
203203
const view_2d &dataout,
204204
// work array
205205
const view_int_1d &kupper) {
206-
const int one = 1;
206+
const int zero = 0;
207207
// Initialize index array
208208
for(int i = 0; i < ncol; ++i) {
209-
kupper(i) = one;
209+
kupper(i) = zero;
210210
} // ncol
211211

212212
for(int k = 0; k < pver; ++k) {
213213
// Top level we need to start looking is the top level for the previous k
214214
// for all column points
215-
int kkstart = levsiz;
215+
int kkstart = levsiz-1;
216216
for(int i = 0; i < ncol; ++i) {
217217
kkstart = haero::min(kkstart, kupper(i));
218218
}
219219

220220
// Store level indices for interpolation
221-
for(int kk = kkstart - 1; kk < levsiz - 1; ++kk) {
221+
for(int kk = kkstart ; kk < levsiz - 1; ++kk) {
222222
for(int i = 0; i < ncol; ++i) {
223223
if(pin(i, kk) < pmid(i, k) && pmid(i, k) <= pin(i, kk + 1)) {
224224
kupper(i) = kk;

0 commit comments

Comments
 (0)