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