MODFLOW 6 version 6.9.0.dev0
USGS Modular Hydrologic Model
Loading...
Searching...
No Matches
IsothermFactory.f90
Go to the documentation of this file.
2
3 use kindmodule, only: i4b, dp
4 use simmodule, only: store_error
5
11
12 implicit none
13 private
14 public :: create_isotherm
15
16contains
17
18 !> @brief Create an isotherm object based on type and parameters.
19 !>
20 !> Returns a pointer to a concrete `IsothermType` (or `null()` if sorption
21 !> is off). Uses `isotherm_type` to select Linear, Freundlich, or Langmuir,
22 !> passing `distcoef` and `sp2` as required by the chosen model.
23 !<
24 function create_isotherm(isotherm_type, distcoef, sp2) result(isotherm)
25 ! -- result
26 class(isothermtype), pointer :: isotherm !< allocated concrete isotherm or null()
27 ! -- dummy
28 integer(I4B), intent(in) :: isotherm_type !< enumerator from `IsothermEnumModule`
29 real(dp), dimension(:), pointer, contiguous :: distcoef !< primary coefficient (Kd, Kf, or Kl)
30 real(dp), dimension(:), pointer, contiguous :: sp2 !< secondary parameter (a for Freundlich, Sbar for Langmuir)
31
32 select case (isotherm_type)
33 case (sorption_off)
34 nullify (isotherm)
35 case (sorption_linear)
36 allocate (isotherm, source=linearisothermtype(distcoef))
37 case (sorption_freund)
38 allocate (isotherm, source=freundlichisothermtype(distcoef, sp2))
39 case (sorption_lang)
40 allocate (isotherm, source=langmuirisothermtype(distcoef, sp2))
41 case default
42 call store_error('Sorption type not implemented.')
43 end select
44
45 end function create_isotherm
46end module isothermfactorymodule
integer(i4b), parameter sorption_off
Sorption is inactive (default).
integer(i4b), parameter sorption_freund
Freundlich sorption between aqueous and solid phases.
integer(i4b), parameter sorption_lang
Langmuir sorption between aqueous and solid phases.
integer(i4b), parameter sorption_linear
Linear sorption between aqueous and solid phases.
class(isothermtype) function, pointer, public create_isotherm(isotherm_type, distcoef, sp2)
Create an isotherm object based on type and parameters.
This module defines variable data types.
Definition kind.f90:8
This module contains simulation methods.
Definition Sim.f90:10
subroutine, public store_error(msg, terminate)
Store an error message.
Definition Sim.f90:94
Freundlich isotherm implementation of IsothermType.
Langmuir isotherm implementation of IsothermType.
Linear (Kd) isotherm implementation of IsothermType.