NormalDepth Function

private function NormalDepth(Q, B0, alpha, slope, n) result(nd)

returns the normal depth (m) using Newton-Raphson.

References:

Todini, E. (2007) A mass conservative and water storage consistent variable parameter Muskingum-Cunge approach, Hydrol. Earth Syst. Sci.,1645-1659.

Arguments

Type IntentOptional Attributes Name
real(kind=float), intent(in) :: Q

discharge (m3/s)

real(kind=float), intent(in) :: B0

bottom width, = 0 for triangular section (m)

real(kind=float), intent(in) :: alpha

angle formed by dykes over a horizontal plane (deg)

real(kind=float), intent(in) :: slope

bed slope (m/m)

real(kind=float), intent(in) :: n

manning riughness coefficient (s m^(-1/3))

Return Value real(kind=float)


Variables

Type Visibility Attributes Name Initial
real(kind=float), public :: Q0
real(kind=float), public :: dQdy
integer, public :: i
integer, public :: maxiter = 100
real(kind=float), public :: nd1
real(kind=float), public :: tol = 0.001

Source Code

FUNCTION NormalDepth &
( Q, B0, alpha, slope, n ) &
RESULT (nd)


IMPLICIT NONE

! Function arguments
! Arguments with intent(in):
REAL (KIND = float), INTENT (IN) :: Q !!discharge (m3/s)
REAL (KIND = float), INTENT (IN) :: B0 !!bottom width, = 0 for  triangular  section (m)
REAL (KIND = float), INTENT (IN) :: alpha !!angle formed by dykes over a horizontal plane (deg)
REAL (KIND = float), INTENT (IN) :: slope !!bed slope (m/m)
REAL (KIND = float), INTENT (IN) :: n !!manning riughness coefficient (s m^(-1/3))

! Arguments with intent(OUT):
REAL (KIND = float) :: nd

!local declarations
INTEGER :: i
INTEGER :: maxiter = 100
REAL (KIND = float) :: nd1
REAL (KIND = float) :: Q0
REAL (KIND = float) :: dQdy !first derivative
REAL (KIND = float) :: tol = 0.001

!------------end of declaration------------------------------------------------

IF (Q == 0.) THEN
   nd = 0.
END IF

!first guess, nd = 1 m
nd = 1.

DO i = 1, maxiter
  Q0 = Discharge ( nd, B0, alpha, slope, n )
  dQdy = TopWidth ( nd, B0, alpha ) * Celerity ( nd, B0, alpha, slope, n )

  nd1 = nd -   (Q0 - Q) / dQdy
  
  !test conf
  IF ( ABS(nd1 - nd) / nd <= tol) THEN !root found
    nd = nd1
    RETURN
  END IF 

  nd = nd1
END DO

RETURN

RETURN
END FUNCTION NormalDepth