MODFLOW 6 version 6.9.0.dev0
USGS Modular Hydrologic Model
Loading...
Searching...
No Matches
exg-chfgwf.f90 File Reference

Go to the source code of this file.

Data Types

type  chfgwfexchangetype

Functions/Subroutines

program __exg-chfgwf_f90__
 This module contains the ChfGwfExchangeModule Module.
subroutine chfgwf_cr (filename, name, id, m1_id, m2_id, input_mempath)
 Create CHF GWF exchange.
subroutine chf_gwf_df (this)
 Define CHF GWF exchange.
subroutine source_options (this, iout)
 Source options.
subroutine source_dimensions (this, iout)
 Source dimension from input context.
subroutine source_data (this, iout)
 Source exchange data from input context.

Function/Subroutine Documentation

◆ __exg-chfgwf_f90__()

program __exg-chfgwf_f90__

This module contains a lightweight CHF-GWF exchange class which is primarily based on the underlying and generic SWF-GWF code for connecting

Definition at line 5 of file exg-chfgwf.f90.

Here is the call graph for this function:

◆ chf_gwf_df()

subroutine __exg-chfgwf_f90__::chf_gwf_df ( class(chfgwfexchangetype) this)
private
Parameters
thisSwfGwfExchangeType

Definition at line 65 of file exg-chfgwf.f90.

66 ! modules
67 ! dummy
68 class(ChfGwfExchangeType) :: this !< SwfGwfExchangeType
69 ! local
70
71 ! log the exchange
72 write (iout, '(/a,a)') ' Creating exchange: ', this%name
73 !
74 ! Ensure models are in same solution
75 if (associated(this%swfmodel) .and. associated(this%gwfmodel)) then
76 if (this%swfmodel%idsoln /= this%gwfmodel%idsoln) then
77 call store_error('Two models are connected in a SWF-GWF '// &
78 'exchange but they are in different solutions. '// &
79 'Models must be in same solution: '// &
80 trim(this%swfmodel%name)//' '// &
81 trim(this%gwfmodel%name))
82 call store_error_filename(this%filename)
83 end if
84 end if
85
86 ! source options
87 call this%source_options(iout)
88
89 ! source dimensions
90 call this%source_dimensions(iout)
91
92 ! allocate arrays
93 call this%allocate_arrays()
94
95 ! source exchange data
96 call this%source_data(iout)
97
98 ! Store obs
99 ! call this%swf_gwf_df_obs()
100 ! if (associated(this%swfmodel1)) then
101 ! call this%obs%obs_df(iout, this%name, 'SWF-GWF', this%swfmodel1%dis)
102 ! end if
103
104 ! ! validate
105 ! call this%validate_exchange()
106
Here is the call graph for this function:

◆ chfgwf_cr()

subroutine __exg-chfgwf_f90__::chfgwf_cr ( character(len=*), intent(in) filename,
character(len=*) name,
integer(i4b), intent(in) id,
integer(i4b), intent(in) m1_id,
integer(i4b), intent(in) m2_id,
character(len=*), intent(in) input_mempath )

High level wrapper over the SWF-GWF exchange, which is generic in that it can be used to couple either a CHF or OLF surface water model to a GWF model.

Parameters
[in]filenamefilename for reading
nameexchange name
[in]idid for the exchange
[in]m1_idid for model 1
[in]m2_idid for model 2

Definition at line 40 of file exg-chfgwf.f90.

41 ! modules
42 ! dummy
43 character(len=*), intent(in) :: filename !< filename for reading
44 character(len=*) :: name !< exchange name
45 integer(I4B), intent(in) :: id !< id for the exchange
46 integer(I4B), intent(in) :: m1_id !< id for model 1
47 integer(I4B), intent(in) :: m2_id !< id for model 2
48 character(len=*), intent(in) :: input_mempath
49 ! local
50 type(ChfGwfExchangeType), pointer :: exchange
51 class(BaseExchangeType), pointer :: baseexchange
52
53 ! Create a new exchange and add it to the baseexchangelist container
54 allocate (exchange)
55 baseexchange => exchange
56 call addbaseexchangetolist(baseexchangelist, baseexchange)
57
58 call exchange%initialize(filename, name, 'CHF', id, m1_id, m2_id, &
59 input_mempath)
60
Here is the call graph for this function:
Here is the caller graph for this function:

◆ source_data()

subroutine __exg-chfgwf_f90__::source_data ( class(chfgwfexchangetype) this,
integer(i4b), intent(in) iout )
private
Parameters
thisinstance of exchange object
[in]ioutthe output file unit

Definition at line 191 of file exg-chfgwf.f90.

192 ! modules
195 ! dummy
196 class(ChfGwfExchangeType) :: this !< instance of exchange object
197 integer(I4B), intent(in) :: iout !< the output file unit
198 ! local
199 integer(I4B), dimension(:, :), contiguous, pointer :: cellidm1
200 integer(I4B), dimension(:, :), contiguous, pointer :: cellidm2
201 real(DP), dimension(:), contiguous, pointer :: bedleak
202 real(DP), dimension(:), contiguous, pointer :: cfact
203 character(len=20) :: cellstr1, cellstr2
204 integer(I4B) :: nerr
205 integer(I4B) :: iexg, nodeswf, nodegwf
206 ! format
207 character(len=*), parameter :: fmtexglabel = "(1x, 3a10, 50(a16))"
208 character(len=*), parameter :: fmtexgdata = &
209 "(5x, a, 1x, a ,50(1pg16.6))"
210
211 call mem_setptr(cellidm1, 'CELLIDM1', this%input_mempath)
212 call mem_setptr(cellidm2, 'CELLIDM2', this%input_mempath)
213 call mem_setptr(bedleak, 'BEDLEAK', this%input_mempath)
214 call mem_setptr(cfact, 'CFACT', this%input_mempath)
215
216 write (iout, '(1x,a)') 'PROCESSING EXCHANGEDATA'
217
218 if (this%ipr_input /= 0) then
219 write (iout, fmtexglabel) 'NODEM1', 'NODEM2', 'BEDLEAK', 'CFACT'
220 end if
221
222 do iexg = 1, this%nexg
223
224 if (associated(this%model1)) then
225 ! Determine user node number
226 nodeswf = this%noder(this%model1, cellidm1(:, iexg), iout)
227 this%nodeswf(iexg) = nodeswf
228 else
229 this%nodeswf(iexg) = -1
230 end if
231
232 if (associated(this%model2)) then
233 ! Determine user node number
234 nodegwf = this%noder(this%model2, cellidm2(:, iexg), iout)
235 this%nodegwf(iexg) = nodegwf
236 else
237 this%nodegwf(iexg) = -1
238 end if
239
240 ! Read rest of input line
241 this%bedleak(iexg) = bedleak(iexg)
242 this%cfact(iexg) = cfact(iexg)
243
244 ! Write the data to listing file if requested
245 if (this%ipr_input /= 0) then
246 cellstr1 = this%cellstr(this%model1, cellidm1(:, iexg), iout)
247 cellstr2 = this%cellstr(this%model2, cellidm2(:, iexg), iout)
248 write (iout, fmtexgdata) trim(cellstr1), trim(cellstr2), &
249 this%bedleak(iexg), this%cfact(iexg)
250 end if
251
252 ! Check to see if nodeswf is outside of active domain
253 if (associated(this%model1)) then
254 if (nodeswf <= 0) then
255 cellstr1 = this%cellstr(this%model1, cellidm1(:, iexg), iout)
256 write (errmsg, *) &
257 trim(adjustl(this%model1%name))// &
258 ' Cell is outside active grid domain ('// &
259 trim(adjustl(cellstr1))//').'
260 call store_error(errmsg)
261 end if
262 end if
263
264 ! Check to see if nodegwf is outside of active domain
265 if (associated(this%model2)) then
266 if (nodegwf <= 0) then
267 cellstr2 = this%cellstr(this%model2, cellidm2(:, iexg), iout)
268 write (errmsg, *) &
269 trim(adjustl(this%model2%name))// &
270 ' Cell is outside active grid domain ('// &
271 trim(adjustl(cellstr2))//').'
272 call store_error(errmsg)
273 end if
274 end if
275 end do
276
277 write (iout, '(1x,a)') 'END OF EXCHANGEDATA'
278
279 ! Stop if errors
280 nerr = count_errors()
281 if (nerr > 0) then
282 call store_error('Errors encountered in exchange input file.')
283 call store_error_filename(this%filename)
284 end if
285
286 call memorystore_release('CELLIDM1', this%input_mempath)
287 call memorystore_release('CELLIDM2', this%input_mempath)
288 call memorystore_release('BEDLEAK', this%input_mempath)
289 call memorystore_release('CFACT', this%input_mempath)
290
subroutine, public memorystore_release(varname, memory_path)
Release a single variable from the memory store.
Here is the call graph for this function:

◆ source_dimensions()

subroutine __exg-chfgwf_f90__::source_dimensions ( class(chfgwfexchangetype) this,
integer(i4b), intent(in) iout )
private
Parameters
thisinstance of exchange object
[in]ioutfor logging

Definition at line 166 of file exg-chfgwf.f90.

167 ! modules
170 ! dummy
171 class(ChfGwfExchangeType) :: this !< instance of exchange object
172 integer(I4B), intent(in) :: iout !< for logging
173 ! local
174 type(ExgChfgwfParamFoundType) :: found
175
176 ! update defaults with idm sourced values
177 call mem_set_value(this%nexg, 'NEXG', this%input_mempath, found%nexg)
178
179 write (iout, '(1x,a)') 'PROCESSING EXCHANGE DIMENSIONS'
180
181 if (found%nexg) then
182 write (iout, '(4x,a,i0)') 'NEXG = ', this%nexg
183 end if
184
185 write (iout, '(1x,a)') 'END OF EXCHANGE DIMENSIONS'
186

◆ source_options()

subroutine __exg-chfgwf_f90__::source_options ( class(chfgwfexchangetype) this,
integer(i4b), intent(in) iout )
private
Parameters
thisGwfExchangeType

Definition at line 111 of file exg-chfgwf.f90.

112 ! modules
119 ! dummy
120 class(ChfGwfExchangeType) :: this !< GwfExchangeType
121 integer(I4B), intent(in) :: iout
122 ! local
123 type(ExgChfgwfParamFoundType) :: found
124
125 ! update defaults with idm sourced values
126 call mem_set_value(this%ipr_input, 'IPR_INPUT', &
127 this%input_mempath, found%ipr_input)
128 call mem_set_value(this%ipr_flow, 'IPR_FLOW', &
129 this%input_mempath, found%ipr_flow)
130 call mem_set_value(this%ifixedcond, 'IFIXEDCOND', &
131 this%input_mempath, found%ifixedcond)
132
133 write (iout, '(1x,a)') 'Processing CHF-GWF exchange options'
134
135 if (found%ipr_input) then
136 write (iout, '(4x,a)') &
137 'The list of exchanges will be printed.'
138 end if
139
140 if (found%ipr_flow) then
141 write (iout, '(4x,a)') &
142 'Exchange flows will be printed to list files.'
143 end if
144
145 if (found%ifixedcond) then
146 write (iout, '(4x,a)') &
147 'Conductance is fixed as product of BEDLEAK and CFACT.'
148 end if
149
150 ! enforce 0 or 1 OBS6_FILENAME entries in option block
151 ! if (.not. this%is_datacopy) then
152 ! if (filein_fname(this%obs%inputFilename, 'OBS6_FILENAME', &
153 ! this%input_mempath, this%filename)) then
154 ! this%obs%active = .true.
155 ! this%obs%inUnitObs = GetUnit()
156 ! call openfile(this%obs%inUnitObs, iout, this%obs%inputFilename, 'OBS')
157 ! end if
158 ! end if
159
160 write (iout, '(1x,a)') 'End of CHF-GWF exchange options'
161
This module contains simulation constants.
Definition Constants.f90:9
integer(i4b), parameter lenvarname
maximum length of a variable name
Definition Constants.f90:17
real(dp), parameter dem6
real constant 1e-6
integer(i4b) function, public getunit()
Get a free unit number.
subroutine, public openfile(iu, iout, fname, ftype, fmtarg_opt, accarg_opt, filstat_opt, mode_opt)
Open a file.
This module contains the SourceCommonModule.
logical(lgp) function, public filein_fname(filename, tagname, input_mempath, input_fname)
enforce and set a single input filename provided via FILEIN keyword
This class is used to store a single deferred-length character string. It was designed to work in an ...
Here is the call graph for this function:
Here is the caller graph for this function: