MODFLOW 6  version 6.5.0.dev2
MODFLOW 6 Code Documentation
prt-mip.f90
Go to the documentation of this file.
2 
3  use kindmodule, only: dp, i4b, lgp
7  use basedismodule, only: disbasetype
11  use simmodule, only: store_error
13 
14  implicit none
15  private
16  public :: prtmiptype
17  public :: mip_cr
18 
19  type, extends(numericalpackagetype) :: prtmiptype
20  real(dp), dimension(:), pointer, contiguous :: porosity => null() !< aquifer porosity
21  real(dp), dimension(:), pointer, contiguous :: retfactor => null() !< retardation factor
22  integer(I4B), dimension(:), pointer, contiguous :: izone => null() !< zone number
23  integer(I4B), pointer :: zeromethod
24  contains
25  procedure :: mip_ar
26  procedure :: mip_da
27  procedure :: allocate_scalars
28  procedure, private :: allocate_arrays
29  end type prtmiptype
30 
31 contains
32 
33  !> @brief Create a model input object
34  subroutine mip_cr(mip, name_model, input_mempath, inunit, iout, dis)
35  ! -- dummy
36  type(prtmiptype), pointer :: mip
37  character(len=*), intent(in) :: name_model
38  character(len=*), intent(in) :: input_mempath
39  integer(I4B), intent(in) :: inunit
40  integer(I4B), intent(in) :: iout
41  class(disbasetype), pointer, intent(in) :: dis
42  ! -- formats
43  character(len=*), parameter :: fmtheader = &
44  "(1x, /1x, 'MIP -- MODEL INPUT PACKAGE', &
45  &' INPUT READ FROM MEMPATH: ', A, /)"
46  !
47  ! -- Create the object
48  allocate (mip)
49  !
50  ! -- Create name and memory path
51  call mip%set_names(1, name_model, 'MIP', 'MIP', input_mempath)
52  !
53  ! -- Allocate scalars
54  call mip%allocate_scalars()
55  !
56  ! -- Set variables
57  mip%inunit = inunit
58  mip%iout = iout
59  !
60  ! -- Set pointers
61  mip%dis => dis
62  !
63  ! -- Print a message identifying the package if enabled
64  if (inunit > 0) &
65  write (iout, fmtheader) input_mempath
66 
67  end subroutine mip_cr
68 
69  !> @brief Deallocate memory
70  subroutine mip_da(this)
71  class(prtmiptype) :: this
72  !
73  ! -- Deallocate input memory
74  call memorylist_remove(this%name_model, 'MIP', idm_context)
75  !
76  ! -- Deallocate parent package
77  call this%NumericalPackageType%da()
78  !
79  ! -- Deallocate arrays
80  call mem_deallocate(this%porosity)
81  call mem_deallocate(this%retfactor)
82  call mem_deallocate(this%izone)
83  !
84  ! -- Deallocate scalars
85  call mem_deallocate(this%zeromethod)
86  end subroutine mip_da
87 
88  subroutine allocate_scalars(this)
89  class(prtmiptype) :: this
90  call this%NumericalPackageType%allocate_scalars()
91  call mem_allocate(this%zeromethod, 'IZEROMETHOD', this%memoryPath)
92  end subroutine allocate_scalars
93 
94  !> @brief Allocate arrays
95  subroutine allocate_arrays(this, nodes)
96  class(prtmiptype) :: this
97  integer(I4B), intent(in) :: nodes
98  ! -- local
99  integer(I4B) :: i
100  !
101  ! -- Allocate
102  call mem_allocate(this%porosity, nodes, 'POROSITY', this%memoryPath)
103  call mem_allocate(this%retfactor, nodes, 'RETFACTOR', this%memoryPath)
104  call mem_allocate(this%izone, nodes, 'IZONE', this%memoryPath)
105  !
106  do i = 1, nodes
107  this%porosity(i) = dzero
108  this%retfactor(i) = done
109  this%izone(i) = 0
110  end do
111 
112  end subroutine allocate_arrays
113 
114  !> @ brief Initialize package inputs
115  subroutine mip_ar(this)
116  ! -- dummy variables
117  class(prtmiptype), intent(inout) :: this !< PrtMipType object
118  ! -- local variables
119  character(len=LINELENGTH) :: errmsg
120  type(prtmipparamfoundtype) :: found
121  integer(I4B), dimension(:), pointer, contiguous :: map => null()
122  !
123  ! -- set map to convert user input data into reduced data
124  if (this%dis%nodes < this%dis%nodesuser) map => this%dis%nodeuser
125  !
126  ! -- Allocate arrays
127  call this%allocate_arrays(this%dis%nodes)
128  !
129  ! -- Source array inputs from IDM
130  call mem_set_value(this%porosity, 'POROSITY', this%input_mempath, &
131  map, found%porosity)
132  call mem_set_value(this%retfactor, 'RETFACTOR', this%input_mempath, &
133  map, found%retfactor)
134  call mem_set_value(this%izone, 'IZONE', this%input_mempath, map, &
135  found%izone)
136  !
137  ! -- Source scalars
138  call mem_set_value(this%zeromethod, 'ZERO_METHOD', this%input_mempath, &
139  found%zero_method)
140  if (.not. found%zero_method) this%zeromethod = 1
141  !
142  ! -- Ensure POROSITY was found
143  if (.not. found%porosity) then
144  write (errmsg, '(a)') 'Error in GRIDDATA block: POROSITY not found'
145  call store_error(errmsg)
146  end if
147 
148  end subroutine mip_ar
149 
150 end module prtmipmodule
This module contains block parser methods.
Definition: BlockParser.f90:7
This module contains simulation constants.
Definition: Constants.f90:9
integer(i4b), parameter linelength
maximum length of a standard line
Definition: Constants.f90:44
real(dp), parameter dzero
real constant zero
Definition: Constants.f90:64
real(dp), parameter done
real constant 1
Definition: Constants.f90:75
This module defines variable data types.
Definition: kind.f90:8
subroutine, public memorylist_remove(component, subcomponent, context)
This module contains the base numerical package type.
subroutine allocate_scalars(this)
Definition: prt-mip.f90:89
subroutine allocate_arrays(this, nodes)
Allocate arrays.
Definition: prt-mip.f90:96
subroutine mip_da(this)
Deallocate memory.
Definition: prt-mip.f90:71
subroutine, public mip_cr(mip, name_model, input_mempath, inunit, iout, dis)
Create a model input object.
Definition: prt-mip.f90:35
subroutine mip_ar(this)
@ brief Initialize package inputs
Definition: prt-mip.f90:116
This module contains simulation methods.
Definition: Sim.f90:10
subroutine, public store_error(msg, terminate)
Store an error message.
Definition: Sim.f90:92
This module contains simulation variables.
Definition: SimVariables.f90:9
character(len=linelength) idm_context