diff --git a/src/regolith/regolith_streamtube_lineseg.f90 b/src/regolith/regolith_streamtube_lineseg.f90 index f2330065..f1070747 100644 --- a/src/regolith/regolith_streamtube_lineseg.f90 +++ b/src/regolith/regolith_streamtube_lineseg.f90 @@ -18,29 +18,25 @@ ! Notes : ! !********************************************************************************************************************************** -subroutine regolith_streamtube_lineseg(user,surfi,thetast,ri,rip1,zmin,zmax,erad,eradi,deltar,newlayer,vmare,totseb) +subroutine regolith_streamtube_lineseg(user,surfi,thetast,ri,rip1,zmin,zmax,erad,eradi,deltar,vseg,newlayer,rm) use module_globals use module_regolith, EXCEPT_THIS_ONE => regolith_streamtube_lineseg implicit none ! arguemnts type(usertype),intent(in) :: user type(surftype),intent(in) :: surfi - real(DP),intent(in) :: thetast,ri,rip1,zmin,zmax,erad,eradi,deltar + real(DP),intent(in) :: thetast,ri,rip1,zmin,zmax,erad,eradi,deltar,vseg,rm type(regodatatype),intent(inout) :: newlayer - real(DP),intent(inout) :: vmare,totseb + ! internal variables real(DP),parameter :: a = 0.936457 real(DP),parameter :: b = 1.12368 type(regolisttype),pointer :: current real(DP) :: z,zstart,zend,rstart,rend,r - real(DP) :: vsgly,x - - ! * Mixing - real(DP) :: zmix + real(DP) :: vsgly current => surfi%regolayer z = current%regodata%thickness - zmix = z zstart = 0.0_DP zend = z @@ -58,10 +54,8 @@ subroutine regolith_streamtube_lineseg(user,surfi,thetast,ri,rip1,zmin,zmax,erad if (zend <= zmin) then if (zmax <= zend + current%next%regodata%thickness) then - vsgly = newlayer%thickness * user%pix**2 - vmare = vsgly * current%next%regodata%comp - totseb = vsgly - !write(*,*) 'z current%next @@ -73,9 +67,9 @@ subroutine regolith_streamtube_lineseg(user,surfi,thetast,ri,rip1,zmin,zmax,erad rend = regolith_quadratic_func(zend,erad,ri,rip1,rstart) vsgly = 0.25_DP * PI * deltar**2 * a**2 * eradi / b * (abs(tan(b/eradi * rend) & - tan(b/eradi * rstart)) - abs(b/eradi * rend - b/eradi * rstart)) - vmare = vmare + vsgly * current%regodata%comp - totseb = totseb + vsgly - !write(*,*) 'lmid',z,current%comp,deltar,vsgly/user%pix**2,ri,rip1,rstart,rend,zmin,zmax,zstart,zend + newlayer%thickness = newlayer%thickness + vsgly + newlayer%comp = newlayer%comp + vsgly * current%regodata%comp + current => current%next z = z + current%regodata%thickness r = rstart @@ -83,22 +77,14 @@ subroutine regolith_streamtube_lineseg(user,surfi,thetast,ri,rip1,zmin,zmax,erad zstart = zend zend = z else if (zend >= zmax .and. zstart <= zmin) then - vsgly = newlayer%thickness * user%pix**2 - vmare = vsgly * current%regodata%comp - totseb = vsgly - !write(*,*) 'z>zmax',z,vmare/user%pix**2,vsgly/user%pix**2,ri,rip1,zmin,zmax,zstart,zend + newlayer%thickness = vseg + newlayer%comp = vseg * current%regodata%comp exit else if (zend >= zmax .and. zstart > zmin) then ! last part of a stream tube - vsgly = 0.25_DP * PI * deltar**2 * a**2 * eradi / b * (abs(tan(b/eradi * rip1) - tan(b/eradi * ri)) - & - abs(b/eradi * rip1 - b/eradi * ri)) - vmare = vmare + (vsgly - totseb) * current%regodata%comp - totseb = vsgly - !write(*,*) 'llast',z,current%comp,vmare/user%pix**2,vsgly/user%pix**2,ri,rip1,rstart,rend,zmin,zmax,zstart,zend + newlayer%comp = newlayer%comp + (vseg - newlayer%thickness) * current%regodata%comp + newlayer%thickness = vseg exit - !else - ! write(*,*) '??',ri,rip1,zmin,zmax,zstart,zend - ! exit end if end do