MODFLOW 6 version 6.9.0.dev0
USGS Modular Hydrologic Model
Loading...
Searching...
No Matches
LangmuirIsotherm.f90
Go to the documentation of this file.
2
3 use kindmodule, only: dp, i4b
5
6 implicit none
7 private
9
10 !> @brief Langmuir isotherm implementation of `IsothermType`.
11 !!
12 !! Sorbed concentration is cs = (Sbar*Kl*c)/(1 + Kl*c).
13 !<
15 real(dp), pointer, dimension(:) :: kl => null() !< Langmuir constant
16 real(dp), pointer, dimension(:) :: sbar => null() !< Total concentration of sorption sites
17 contains
18 procedure :: value
19 procedure :: derivative
21
22 interface langmuirisothermtype
23 module procedure constructor
24 end interface langmuirisothermtype
25
26contains
27 !> @brief Constructor for Langmuir isotherm
28 !<
29 function constructor(Kl, Sbar) Result(isotherm)
30 ! -- return
31 type(langmuirisothermtype) :: isotherm
32 ! -- dummy
33 real(dp), pointer, dimension(:), intent(in) :: kl !< Langmuir constant
34 real(dp), pointer, dimension(:), intent(in) :: sbar !< Total concentration of sorption sites
35 ! -- local
36
37 isotherm%Kl => kl
38 isotherm%Sbar => sbar
39
40 end function constructor
41
42 !> @brief Evaluate the isotherm at a given node
43 !<
44 function value(this, c, n) result(val)
45 ! -- return
46 real(dp) :: val !< isotherm value
47 ! -- dummy
48 class(langmuirisothermtype), intent(in) :: this
49 real(dp), dimension(:), intent(in) :: c !< concentration array
50 integer(I4B), intent(in) :: n !< node index
51 ! -- local
52 real(dp) :: denom
53
54 if (c(n) > 0.0_dp) then
55 denom = 1.0_dp + this%Kl(n) * c(n)
56 val = (this%Sbar(n) * this%Kl(n) * c(n)) / denom
57 else
58 val = 0.0_dp
59 end if
60 end function value
61
62 !> @brief Evaluate derivative of the isotherm at a given node
63 !<
64 function derivative(this, c, n) result(derv)
65 ! -- return
66 real(dp) :: derv !< derivative d(value)/dc evaluated at c
67 ! -- dummy
68 class(langmuirisothermtype), intent(in) :: this
69 real(dp), dimension(:), intent(in) :: c !< concentration array
70 integer(I4B), intent(in) :: n !< node index
71 ! -- local
72 real(dp) :: denom
73
74 if (c(n) > 0.0_dp) then
75 denom = (1.0_dp + this%Kl(n) * c(n))**2.0_dp
76 derv = (this%Sbar(n) * this%Kl(n)) / denom
77 else
78 derv = 0.0_dp
79 end if
80 end function derivative
81
This module defines variable data types.
Definition kind.f90:8
real(dp) function value(this, c, n)
Evaluate the isotherm at a given node.
type(langmuirisothermtype) function constructor(kl, sbar)
Constructor for Langmuir isotherm.
real(dp) function derivative(this, c, n)
Evaluate derivative of the isotherm at a given node.
Langmuir isotherm implementation of IsothermType.