MODFLOW 6  version 6.7.0.dev3
USGS Modular Hydrologic Model
LinearIsotherm.f90
Go to the documentation of this file.
2 
3  use kindmodule, only: dp, i4b
5 
6  implicit none
7  private
8  public :: linearisothermtype
9 
10  !> @brief Linear (Kd) isotherm implementation of `IsothermType`.
11  !>
12  !> Sorbed concentration is computed as cs = Kd*c.
13  !<
14  type, extends(isothermtype) :: linearisothermtype
15  real(dp), pointer, dimension(:) :: kd => null() !< distribution coefficient
16  contains
17  procedure :: value
18  procedure :: derivative
19  end type linearisothermtype
20 
21  interface linearisothermtype
22  module procedure constructor
23  end interface linearisothermtype
24 
25 contains
26  !> @brief Constructor for Linear isotherm
27  !<
28  function constructor(Kd) Result(isotherm)
29  ! -- return
30  type(linearisothermtype) :: isotherm
31  ! -- dummy
32  real(dp), pointer, dimension(:), intent(in) :: kd !< distribution coefficient
33  ! -- local
34 
35  isotherm%Kd => kd
36 
37  end function constructor
38 
39  !> @brief Evaluate the isotherm at a given node
40  !<
41  function value(this, c, n) result(val)
42  ! -- return
43  real(dp) :: val !< isotherm value
44  ! -- dummy
45  class(linearisothermtype), intent(in) :: this
46  real(dp), dimension(:), intent(in) :: c !< concentration array
47  integer(I4B), intent(in) :: n !< node index
48 
49  val = this%Kd(n) * c(n)
50  end function value
51 
52  !> @brief Evaluate derivative of the isotherm at a given node
53  !<
54  function derivative(this, c, n) result(derv)
55  ! -- return
56  real(dp) :: derv !< derivative d(value)/dc evaluated at c
57  ! -- dummy
58  class(linearisothermtype), intent(in) :: this
59  real(dp), dimension(:), intent(in) :: c !< concentration array
60  integer(I4B), intent(in) :: n !< node index
61  ! -- local
62 
63  derv = this%Kd(n)
64  end function derivative
65 
66 end module linearisothermsmodule
This module defines variable data types.
Definition: kind.f90:8
real(dp) function derivative(this, c, n)
Evaluate derivative of the isotherm at a given node.
type(linearisothermtype) function constructor(Kd)
Constructor for Linear isotherm.
real(dp) function value(this, c, n)
Evaluate the isotherm at a given node.
Linear (Kd) isotherm implementation of IsothermType.