Skip to content

Commit 8d7b3b9

Browse files
committed
Fix bounds on DivHU computation to avoid inactive layers
1 parent cd5c479 commit 8d7b3b9

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

components/omega/src/ocn/VertAdv.cpp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,7 @@ void VertAdv::computeVerticalPseudoVelocity(
379379
OMEGA_SCOPE(LocEOnC, Mesh->EdgesOnCell);
380380
OMEGA_SCOPE(LocDvE, Mesh->DvEdge);
381381
OMEGA_SCOPE(LocESOnC, Mesh->EdgeSignOnCell);
382+
OMEGA_SCOPE(LocMaxLayerEdgeTop, VCoord->MaxLayerEdgeTop);
382383

383384
// Loop over all cells owned by the task
384385
parallelForOuter(
@@ -402,12 +403,16 @@ void VertAdv::computeVerticalPseudoVelocity(
402403
const I4 KLen = chunkLength(KChunk, KStart, KMax);
403404

404405
for (int J = 0; J < LocNEOnC(ICell); ++J) {
405-
const I4 JEdge = LocEOnC(ICell, J);
406+
const I4 JEdge = LocEOnC(ICell, J);
407+
const I4 MaxKEdge = LocMaxLayerEdgeTop(JEdge);
406408
for (int KVec = 0; KVec < KLen; ++KVec) {
407409
const I4 K = KStart + KVec;
408-
DivHUTmp[KVec] -= LocDvE(JEdge) * LocESOnC(ICell, J) *
409-
FluxPseudoThickEdge(JEdge, K) *
410-
NormalVelocity(JEdge, K) * InvAreaCell;
410+
if (K <= MaxKEdge) {
411+
DivHUTmp[KVec] -= LocDvE(JEdge) * LocESOnC(ICell, J) *
412+
FluxPseudoThickEdge(JEdge, K) *
413+
NormalVelocity(JEdge, K) *
414+
InvAreaCell;
415+
}
411416
}
412417
}
413418
for (int KVec = 0; KVec < KLen; ++KVec) {

0 commit comments

Comments
 (0)