@@ -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