diff --git a/src/regolith/module_regolith.f90 b/src/regolith/module_regolith.f90 index 90e1e030..f3245e9e 100644 --- a/src/regolith/module_regolith.f90 +++ b/src/regolith/module_regolith.f90 @@ -117,7 +117,7 @@ subroutine regolith_subpixel_streamtube(user,surfi,deltar,ri,rip1,eradi,newlayer use module_globals implicit none type(usertype),intent(in) :: user - type(surftype),intent(in) :: surfi + type(surftype),intent(inout) :: surfi real(DP),intent(in) :: deltar,ri,rip1,eradi type(regodatatype),intent(inout) :: newlayer real(DP),intent(inout) :: meltinejecta,totvol diff --git a/src/regolith/regolith_streamtube_head.f90 b/src/regolith/regolith_streamtube_head.f90 index 42984663..21240ca0 100644 --- a/src/regolith/regolith_streamtube_head.f90 +++ b/src/regolith/regolith_streamtube_head.f90 @@ -40,12 +40,13 @@ subroutine regolith_streamtube_head(user,surfi,deltar,totmare,tots,age_collector ! head intersected with underlying layers, about 30% of volume difference. real(DP) :: z,zstart,zend,zmin,zmax real(DP) :: tothead,totmarehead,marehead,vhead,vsgly - integer(I4B) :: N,M + integer(I4B) :: N,M,i ! melt collector real(DP) :: recyratio real(DP) :: headmeltvol real(DP) :: ratio + real(SP) :: limit !current => surfi%regolayer !current = surfi%regolayer @@ -71,6 +72,14 @@ subroutine regolith_streamtube_head(user,surfi,deltar,totmare,tots,age_collector if (ratio > 1) then ratio = 1.0_DP end if + if (ratio > 0) then + limit = (TINY(1._SP) / ratio) * 2 + do i=1,size(age_collector) + if(current(M)%age(i) 1) then ratio = 1.0_DP end if + if (ratio > 0) then + limit = (TINY(1._SP) / ratio) * 2 + do i=1,size(age_collector) + if(current(N)%age(i) 1) then ratio = 1.0_DP end if + if (ratio > 0) then + limit = (TINY(1._SP) / ratio) * 2 + do i=1,size(age_collector) + if(current(N)%age(i) 1) then ratio = 1.0_DP end if + if (ratio > 0) then + limit = (TINY(1._SP) / ratio) * 2 + do i=1,size(age_collector) + if(current(N-1)%age(i) 0) then + limit = (TINY(1._SP) / ratio) * 2 + do i=1,size(age_collector) + if(current(N)%age(i) 1) then @@ -153,6 +170,14 @@ subroutine regolith_streamtube_lineseg(user,surfi,thetast,ri,rip1,zmin,zmax,erad if (ratio > 1) then ratio = 1.0_DP end if + if (ratio > 0) then + limit = (TINY(1._SP) / ratio) * 2 + do i=1,size(age_collector) + if(current(N)%age(i) 1) then ratio = 1.0_DP end if + if (ratio > 0) then + limit = (TINY(1._SP) / ratio) * 2 + do i=1,size(age_collector) + if(current(N)%age(i) 1) then ratio = 1.0_DP end if + if (ratio > 0) then + limit = (TINY(1._SP) / ratio) * 2 + do i=1,size(age_collector) + if(current(N)%age(i)=zmax) then @@ -124,6 +127,14 @@ subroutine regolith_subpixel_streamtube(user,surfi,deltar,ri,rip1,eradi,newlayer meltinejecta = surfi%regolayer(M)%meltvolume * ratio distvol(:) = distvol(:) + (surfi%regolayer(M)%distvol(:) * ratio) totvol = vseg + if (ratio > 0) then + limit = (TINY(1._SP) / ratio) * 2 + do i=1,size(age_collector) + if(surfi%regolayer(M)%age(i) 0) then + limit2 = (TINY(1._SP) / ratio2) * 2 + do i=1,size(age_collector) + if(current(N)%age(i) 0) then + limit = (TINY(1._SP) / ratio) * 2 + do i=1,size(age_collector) + if(current(N)%age(i) 1) then ratio = 1.0_DP end if + if (ratio > 0) then + limit = (TINY(1._SP) / ratio) * 2 + do i=1,size(age_collector) + if(surfi%regolayer(N)%age(i)