Skip to content

Commit

Permalink
Updated regolith_streamtube_lineseg.90: changed to some general varia…
Browse files Browse the repository at this point in the history
…ble's name for multiple component model.
  • Loading branch information
huang474 committed Jan 24, 2017
1 parent c318d76 commit 34ae9b3
Showing 1 changed file with 13 additions and 27 deletions.
40 changes: 13 additions & 27 deletions src/regolith/regolith_streamtube_lineseg.f90
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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<zmin',z,vmare/user%pix**2,vsgly/user%pix**2,ri,rip1,zmin,zmax,zstart,zend
newlayer%thickness = vseg
newlayer%comp = vseg * current%next%regodata%comp
exit
else
current => current%next
Expand All @@ -73,32 +67,24 @@ 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
rstart = rend
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
Expand Down

0 comments on commit 34ae9b3

Please sign in to comment.