MODFLOW 6  version 6.7.0.dev0
USGS Modular Hydrologic Model
GwfSfrCommon.f90
Go to the documentation of this file.
1  !> @brief Kinematic routing equation residual
2  !!
3  !! Method to calculate the kinematic-wave routing
4  !! residual.
5  !!
6  !<
7  function kinematic_residual(qa, qb, qc, qd, &
8  aa, ab, ac, ad, &
9  qsrc, length, weight, delt, &
10  courant)
11  use kindmodule, only: dp
12  use constantsmodule, only: dzero, dhalf, done
13  ! -- return variable
14  real(dp) :: kinematic_residual !< kinematic-wave residual
15  ! -- dummy variables
16  real(dp), intent(in) :: qa !< upstream flow at previous time
17  real(dp), intent(in) :: qb !< downstream flow at previous time
18  real(dp), intent(in) :: qc !< upstream flow
19  real(dp), intent(in) :: qd !< downstream flow
20  real(dp), intent(in) :: aa !< upstream area at previous time
21  real(dp), intent(in) :: ab !< downstream area at previous time
22  real(dp), intent(in) :: ac !< upstream area
23  real(dp), intent(in) :: ad !< downstream area
24  real(dp), intent(in) :: qsrc !< lateral flow term (L3T-1L-1)
25  real(dp), intent(in) :: length !< reach length
26  real(dp), intent(in) :: weight !< temporal weight
27  real(dp), intent(in) :: delt !< time step length
28  real(dp), intent(in) :: courant !< courant number
29  ! --local variables
30  real(dp) :: f11
31  real(dp) :: f12
32 
33  if (courant > done) then
34  f11 = (qd - qc) / length
35  f12 = (ac - aa) / delt
36  else
37  f11 = (weight * (qd - qc) + (done - weight) * (qb - qa)) / length
38  f12 = dhalf * ((ad - ab) + (ac - aa)) / delt
39  end if
40  kinematic_residual = f11 + f12 - qsrc
41 
42  end function kinematic_residual
43 
44  !> @brief Kinematic routing equation storage term
45  !!
46  !! Method to calculate the kinematic-wave routing
47  !! storage term.
48  !!
49  !<
50  function kinematic_storage(aa, ab, ac, ad, length, delt, courant)
51  use kindmodule, only: dp
52  use constantsmodule, only: dhalf
53 
54  real(dp) :: kinematic_storage !< kinematic-wave storage change
55 
56  real(dp), intent(in) :: aa !< upstream area at previous time
57  real(dp), intent(in) :: ab !< downstream area at previous time
58  real(dp), intent(in) :: ac !< upstream area
59  real(dp), intent(in) :: ad !< downstream area
60  real(dp), intent(in) :: length !< reach length
61  real(dp), intent(in) :: delt !< time step length
62  real(dp), intent(in) :: courant !< courant number
63 
64  if (courant > done) then
65  kinematic_storage = (aa - ac) * length / delt
66  else
67  kinematic_storage = dhalf * ((ac + ad) - (aa + ab)) * length / delt
68  end if
69 
70  end function kinematic_storage
real(dp) function kinematic_storage(aa, ab, ac, ad, length, delt, courant)
Kinematic routing equation storage term.
real(dp) function kinematic_residual(qa, qb, qc, qd, aa, ab, ac, ad, qsrc, length, weight, delt, courant)
Kinematic routing equation residual.
This module contains simulation constants.
Definition: Constants.f90:9
real(dp), parameter dhalf
real constant 1/2
Definition: Constants.f90:68
real(dp), parameter dzero
real constant zero
Definition: Constants.f90:65
real(dp), parameter done
real constant 1
Definition: Constants.f90:76
This module defines variable data types.
Definition: kind.f90:8