From c6d3e009baf7b237c4ed9aa062aaa057b851ecf7 Mon Sep 17 00:00:00 2001 From: daminton Date: Fri, 3 Feb 2017 16:27:11 +0000 Subject: [PATCH] Fixed error that causes ejecta to be interpolated past the array --- src/ejecta/ejecta_emplace.f90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ejecta/ejecta_emplace.f90 b/src/ejecta/ejecta_emplace.f90 index a619e5a0..bf7ec1f6 100644 --- a/src/ejecta/ejecta_emplace.f90 +++ b/src/ejecta/ejecta_emplace.f90 @@ -318,7 +318,7 @@ subroutine ejecta_emplace(user,surf,crater,domain,ejb,ejtble,deltaMtot) ! Find out where in the table this new velocity corresponds to ind = 1 call util_search(ejb%vesq,ind,ejtble,vsq,klo) - klo = min(max(klo,1),ejtble) + klo = min(max(klo,1),ejtble-1) ! Interpolate on the table to find the flat plane equivalent landing distance for this velocity frac = (vsq - ejb(klo)%vesq) / (ejb(klo+1)%vesq - ejb(klo)%vesq) distance = exp(ejb(klo)%lrad) + frac * (exp(ejb(klo+1)%lrad) - exp(ejb(klo)%lrad))