MODFLOW 6 version 6.9.0.dev0
USGS Modular Hydrologic Model
Loading...
Searching...
No Matches
gwf-ic.f90
Go to the documentation of this file.
2
3 use kindmodule, only: dp, i4b, lgp
8
9 implicit none
10 private
11 public :: gwfictype
12 public :: ic_cr
13
15
16 real(dp), dimension(:), pointer, contiguous :: strt => null() ! starting head
17
18 contains
19
20 procedure :: ic_ar
21 procedure :: ic_da
22 procedure, private :: ic_load
23 procedure, private :: allocate_arrays
24 procedure, private :: source_griddata
25
26 end type gwfictype
27
28contains
29
30 !> @brief Create a new initial conditions object
31 !<
32 subroutine ic_cr(ic, name_model, input_mempath, inunit, iout, dis)
33 ! -- modules
35 ! -- dummy
36 type(gwfictype), pointer :: ic
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 :: fmtic = &
44 "(1x, /1x, 'IC -- Initial Conditions Package, Version 8, 3/28/2015', &
45 &' input read from mempath: ', A, //)"
46 !
47 ! -- create IC object
48 allocate (ic)
49 !
50 ! -- create name and memory path
51 call ic%set_names(1, name_model, 'IC', 'IC', input_mempath)
52 !
53 ! -- allocate scalars
54 call ic%allocate_scalars()
55 !
56 ! -- set variables
57 ic%inunit = inunit
58 ic%iout = iout
59 !
60 ! -- set pointers
61 ic%dis => dis
62 !
63 ! -- check if pkg is enabled,
64 if (inunit > 0) then
65 ! print message identifying pkg
66 write (ic%iout, fmtic) input_mempath
67 end if
68 end subroutine ic_cr
69
70 !> @brief Load data from IDM into package
71 !<
72 subroutine ic_load(this)
73 ! -- modules
74 use basedismodule, only: disbasetype
75 ! -- dummy
76 class(gwfictype) :: this
77 !
78 call this%source_griddata()
79 end subroutine ic_load
80
81 !> @brief Allocate arrays, load from IDM, and assign head
82 !<
83 subroutine ic_ar(this, x)
84 ! -- dummy
85 class(gwfictype) :: this
86 real(DP), dimension(:), intent(inout) :: x
87 ! -- local
88 integer(I4B) :: n
89 !
90 ! -- allocate arrays
91 call this%allocate_arrays(this%dis%nodes)
92 !
93 ! -- load from IDM
94 call this%ic_load()
95 !
96 ! -- assign starting head
97 do n = 1, this%dis%nodes
98 x(n) = this%strt(n)
99 end do
100 end subroutine ic_ar
101
102 !> @brief Deallocate
103 !<
104 subroutine ic_da(this)
105 ! -- modules
109 ! -- dummy
110 class(gwfictype) :: this
111 !
112 ! -- deallocate IDM memory
113 call memorystore_remove(this%name_model, 'IC', idm_context)
114 !
115 ! -- deallocate arrays
116 call mem_deallocate(this%strt)
117 !
118 ! -- deallocate parent
119 call this%NumericalPackageType%da()
120 end subroutine ic_da
121
122 !> @brief Allocate arrays
123 !<
124 subroutine allocate_arrays(this, nodes)
125 ! -- modules
127 ! -- dummy
128 class(gwfictype) :: this
129 integer(I4B), intent(in) :: nodes
130 !
131 ! -- Allocate
132 call mem_allocate(this%strt, nodes, 'STRT', this%memoryPath)
133 end subroutine allocate_arrays
134
135 !> @brief Copy grid data from IDM into package
136 !<
137 subroutine source_griddata(this)
138 ! -- modules
142 ! -- dummy
143 class(gwfictype) :: this
144 ! -- local
145 character(len=LINELENGTH) :: errmsg
146 type(gwficparamfoundtype) :: found
147 integer(I4B), dimension(:), pointer, contiguous :: map
148 !
149 ! -- set map to convert user to reduced node data
150 map => null()
151 if (this%dis%nodes < this%dis%nodesuser) map => this%dis%nodeuser
152 !
153 ! -- set values
154 call mem_set_value(this%strt, 'STRT', this%input_mempath, map, found%strt)
155 !
156 ! -- ensure STRT was found
157 if (.not. found%strt) then
158 write (errmsg, '(a)') 'Error in GRIDDATA block: STRT not found.'
159 call store_error(errmsg, terminate=.false.)
160 call store_error_filename(this%input_fname)
161 else if (this%iout > 0) then
162 write (this%iout, '(4x,a)') 'STRT set from input file'
163 end if
164 end subroutine source_griddata
165
166end module gwficmodule
This module contains block parser methods.
This module contains simulation constants.
Definition Constants.f90:9
integer(i4b), parameter linelength
maximum length of a standard line
Definition Constants.f90:45
@ dis
DIS6 discretization.
subroutine, public ic_cr(ic, name_model, input_mempath, inunit, iout, dis)
Create a new initial conditions object.
Definition gwf-ic.f90:33
subroutine ic_da(this)
Deallocate.
Definition gwf-ic.f90:105
subroutine allocate_arrays(this, nodes)
Allocate arrays.
Definition gwf-ic.f90:125
subroutine ic_load(this)
Load data from IDM into package.
Definition gwf-ic.f90:73
subroutine source_griddata(this)
Copy grid data from IDM into package.
Definition gwf-ic.f90:138
subroutine ic_ar(this, x)
Allocate arrays, load from IDM, and assign head.
Definition gwf-ic.f90:84
This module defines variable data types.
Definition kind.f90:8
subroutine, public memorystore_remove(component, subcomponent, context)
This module contains the base numerical package type.
This module contains simulation methods.
Definition Sim.f90:10
subroutine, public store_error(msg, terminate)
Store an error message.
Definition Sim.f90:94
subroutine, public store_error_filename(filename, terminate)
Store the erroring file name.
Definition Sim.f90:208
This module contains simulation variables.
character(len=linelength) idm_context