MODFLOW 6  version 6.7.0.dev3
USGS Modular Hydrologic Model
FreundlichIsotherm.f90
Go to the documentation of this file.
2 
3  use kindmodule, only: dp, i4b
5 
6  Implicit None
7  Private
8  Public :: freundlichisothermtype
9 
10  !> @brief Freundlich isotherm implementation of `IsothermType`.
11  !>
12  !> Sorbed concentration is cs = Kf*c^a.
13  !<
15  real(dp), pointer, dimension(:) :: kf => null() !< Freundlich constant
16  real(dp), pointer, dimension(:) :: a => null() !< Freundlich exponent
17  contains
18  procedure :: value
19  procedure :: derivative
20  end type freundlichisothermtype
21 
22  interface freundlichisothermtype
23  module procedure constructor
24  end interface freundlichisothermtype
25 
26 contains
27 
28  !> @brief Constructor for Freundlich isotherm
29  !<
30  function constructor(Kf, a) Result(isotherm)
31  type(freundlichisothermtype) :: isotherm
32  ! -- dummy
33  real(dp), pointer, dimension(:), intent(in) :: kf
34  real(dp), pointer, dimension(:), intent(in) :: a
35  ! -- local
36  isotherm%Kf => kf
37  isotherm%a => a
38 
39  end function constructor
40 
41  !> @brief Evaluate the isotherm at a given node
42  !<
43  function value(this, c, n) result(val)
44  ! -- return
45  real(dp) :: val !< isotherm value
46  ! -- dummy
47  class(freundlichisothermtype), intent(in) :: this
48  real(dp), dimension(:), intent(in) :: c !< concentration array
49  integer(I4B), intent(in) :: n !< node index
50 
51  if (c(n) > 0.0_dp) then
52  val = this%Kf(n) * c(n)**this%a(n)
53  else
54  val = 0.0_dp
55  end if
56  end function value
57 
58  !> @brief Evaluate derivative of the isotherm at a given node
59  !<
60  function derivative(this, c, n) result(derv)
61  ! -- return
62  real(dp) :: derv !< derivative d(value)/dc evaluated at c
63  ! -- dummy
64  class(freundlichisothermtype), intent(in) :: this
65  real(dp), dimension(:), intent(in) :: c !< concentration array
66  integer(I4B), intent(in) :: n !< node index
67 
68  if (c(n) > 0.0_dp) then
69  derv = this%a(n) * this%Kf(n) * c(n)**(this%a(n) - 1.0_dp)
70  else
71  derv = 0.0_dp
72  end if
73  end function derivative
74 
75 end module freundlichisothermmodule
real(dp) function value(this, c, n)
Evaluate the isotherm at a given node.
real(dp) function derivative(this, c, n)
Evaluate derivative of the isotherm at a given node.
type(freundlichisothermtype) function constructor(Kf, a)
Constructor for Freundlich isotherm.
This module defines variable data types.
Definition: kind.f90:8
Freundlich isotherm implementation of IsothermType.