From 3642f7b9285400fc23c03fa8bc01673e4222b0a5 Mon Sep 17 00:00:00 2001 From: Kyle <kyle.c.klenk@gmail.com> Date: Mon, 3 Oct 2022 20:11:24 +0000 Subject: [PATCH] added indexing changes Ashley made from Summa-Sundials --- build/source/engine/ssdNrgFlux.f90 | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/build/source/engine/ssdNrgFlux.f90 b/build/source/engine/ssdNrgFlux.f90 index 04985bd..5b4ae15 100644 --- a/build/source/engine/ssdNrgFlux.f90 +++ b/build/source/engine/ssdNrgFlux.f90 @@ -358,9 +358,13 @@ subroutine ssdNrgFlux(& ! start with the un-perturbed case vectorVolFracLiqTrial(1:2) = mLayerVolFracLiqTrial(mLayer_ind) ! need to protect against negative indexes - if ( mLayer_ind(1) .ge. nSnow .and. mLayer_ind(2) .ge. nSnow)then - if (iLayer==nSnow ) mLayer_ind(1) = nsnow+1 - vectorMatricHeadTrial(1:2) = mLayerMatricHeadTrial(mLayer_ind-nSnow) + if ( mLayer_ind(1) > nSnow .and. mLayer_ind(2) > nSnow)then + vectorMatricHeadTrial(1:2) = mLayerMatricHeadTrial(mLayer_ind-nSnow) + else if (mLayer_ind(2) > nSnow)then !mLayer_ind(1) == nSnow + vectorMatricHeadTrial(1) = realMissing + vectorMatricHeadTrial(2) = mLayerMatricHeadTrial(mLayer_ind(2)-nSnow) + else !snow layer + vectorMatricHeadTrial(1:2) = realMissing end if vectorTempTrial(1:2) = mLayerTempTrial(mLayer_ind) vectorVolFracIceTrial(1:2) = mLayerVolFracIceTrial(mLayer_ind) -- GitLab