MODFLOW 6  version 6.5.0.dev2
MODFLOW 6 Code Documentation
explicitsolutionmodule Module Reference

Explicit Solution Module. More...

Data Types

type  explicitsolutiontype
 Manages and solves explicit models. More...
 

Functions/Subroutines

subroutine, public create_explicit_solution (exp_sol, filename, id)
 @ brief Create a new solution More...
 
subroutine allocate_scalars (this)
 @ brief Allocate scalars More...
 
subroutine sln_df (this)
 @ brief Define the solution More...
 
subroutine sln_ar (this)
 @ brief Allocate and read More...
 
subroutine sln_calculate_delt (this)
 @ brief Calculate time step length More...
 
subroutine sln_ad (this)
 @ brief Advance the solution More...
 
subroutine sln_ot (this)
 @ brief Solution output More...
 
subroutine sln_fp (this)
 
subroutine sln_da (this)
 @ brief Deallocate More...
 
subroutine sln_ca (this, isgcnvg, isuppress_output)
 @ brief Calculate More...
 
subroutine preparesolve (this)
 @ brief Prepare to solve More...
 
subroutine solve (this)
 @ brief Solve each model More...
 
subroutine finalizesolve (this, isgcnvg, isuppress_output)
 @ brief Finalize solve More...
 
subroutine save (this, filename)
 @ brief Save output More...
 
subroutine add_model (this, mp)
 @ brief Add explicit model to list More...
 
type(listtype) function, pointer get_models (this)
 Get a pointer to a list of models in the solution. More...
 
subroutine add_exchange (this, exchange)
 @ brief Add exchange to list of exchanges More...
 
type(listtype) function, pointer get_exchanges (this)
 @ brief Get list of exchanges More...
 

Detailed Description

This module contains the Explicit Solution, which is a class for solving explicit models. The explicit solution scrolls through a list of explicit models and calls methods in a prescribed sequence.

Function/Subroutine Documentation

◆ add_exchange()

subroutine explicitsolutionmodule::add_exchange ( class(explicitsolutiontype this,
class(baseexchangetype), intent(in), pointer  exchange 
)
private

Definition at line 328 of file ExplicitSolution.f90.

329  class(ExplicitSolutionType) :: this
330  class(BaseExchangeType), pointer, intent(in) :: exchange

◆ add_model()

subroutine explicitsolutionmodule::add_model ( class(explicitsolutiontype this,
class(basemodeltype), intent(in), pointer  mp 
)
private
Parameters
thisExplicitSolutionType instance
[in]mpmodel instance

Definition at line 302 of file ExplicitSolution.f90.

303  ! -- dummy variables
304  class(ExplicitSolutionType) :: this !< ExplicitSolutionType instance
305  class(BaseModelType), pointer, intent(in) :: mp !< model instance
306  ! -- local variables
307  class(NumericalModelType), pointer :: m => null()
308 
309  ! -- add a model
310  select type (mp)
311  class is (numericalmodeltype)
312  m => mp
313  call addnumericalmodeltolist(this%modellist, m)
314  end select
Here is the call graph for this function:

◆ allocate_scalars()

subroutine explicitsolutionmodule::allocate_scalars ( class(explicitsolutiontype this)
Parameters
thisExplicitSolutionType instance

Definition at line 117 of file ExplicitSolution.f90.

118  class(ExplicitSolutionType) :: this !< ExplicitSolutionType instance
119 
120  ! -- allocate scalars
121  call mem_allocate(this%id, 'ID', this%memoryPath)
122  call mem_allocate(this%iu, 'IU', this%memoryPath)
123  call mem_allocate(this%ttsoln, 'TTSOLN', this%memoryPath)
124  call mem_allocate(this%icnvg, 'ICNVG', this%memoryPath)
125 
126  ! -- initialize
127  this%id = 0
128  this%iu = 0
129  this%ttsoln = dzero
130  this%icnvg = 0

◆ create_explicit_solution()

subroutine, public explicitsolutionmodule::create_explicit_solution ( class(explicitsolutiontype), pointer  exp_sol,
character(len=*), intent(in)  filename,
integer(i4b), intent(in)  id 
)

Create a new solution using the data in filename, assign this new solution an id number and store the solution in the basesolutionlist. Also open the filename for later reading.

Parameters
exp_solthe create solution
[in]filenamesolution input file name
[in]idsolution id

Definition at line 79 of file ExplicitSolution.f90.

80  ! -- modules
82  ! -- dummy variables
83  class(ExplicitSolutionType), pointer :: exp_sol !< the create solution
84  character(len=*), intent(in) :: filename !< solution input file name
85  integer(I4B), intent(in) :: id !< solution id
86  ! -- local variables
87  integer(I4B) :: inunit
88  class(BaseSolutionType), pointer :: solbase => null()
89  character(len=LENSOLUTIONNAME) :: solutionname
90 
91  ! -- Create a new solution and add it to the basesolutionlist container
92  solbase => exp_sol
93  write (solutionname, '(a, i0)') 'SLN_', id
94  exp_sol%name = solutionname
95  exp_sol%memoryPath = create_mem_path(solutionname)
96  allocate (exp_sol%modellist)
97  !todo: do we need this? allocate (exp_sol%exchangelist)
98  call exp_sol%allocate_scalars()
99  call addbasesolutiontolist(basesolutionlist, solbase)
100  exp_sol%id = id
101 
102  ! -- Open solution input file for reading later after problem size is known
103  ! Check to see if the file is already opened, which can happen when
104  ! running in single model mode
105  inquire (file=filename, number=inunit)
106  if (inunit < 0) inunit = getunit()
107  exp_sol%iu = inunit
108  write (iout, '(/a,a/)') ' Creating explicit solution (EMS): ', exp_sol%name
109  call openfile(exp_sol%iu, iout, filename, 'IMS')
110 
111  ! -- Initialize block parser
112  call exp_sol%parser%Initialize(exp_sol%iu, iout)
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.
Definition: InputOutput.f90:30
Here is the call graph for this function:
Here is the caller graph for this function:

◆ finalizesolve()

subroutine explicitsolutionmodule::finalizesolve ( class(explicitsolutiontype this,
integer(i4b), intent(inout)  isgcnvg,
integer(i4b), intent(in)  isuppress_output 
)
private
Parameters
thisExplicitSolutionType instance
[in,out]isgcnvgsolution group convergence flag
[in]isuppress_outputflag for suppressing output

Definition at line 263 of file ExplicitSolution.f90.

264  ! -- dummy variables
265  class(ExplicitSolutionType) :: this !< ExplicitSolutionType instance
266  integer(I4B), intent(inout) :: isgcnvg !< solution group convergence flag
267  integer(I4B), intent(in) :: isuppress_output !< flag for suppressing output
268  ! -- local variables
269  integer(I4B) :: im
270  class(NumericalModelType), pointer :: mp => null()
271 
272  ! -- Calculate flow for each model
273  do im = 1, this%modellist%Count()
274  mp => getnumericalmodelfromlist(this%modellist, im)
275  call mp%model_cq(this%icnvg, isuppress_output)
276  end do
277 
278  ! -- Budget terms for each model
279  do im = 1, this%modellist%Count()
280  mp => getnumericalmodelfromlist(this%modellist, im)
281  call mp%model_bd(this%icnvg, isuppress_output)
282  end do
Here is the call graph for this function:

◆ get_exchanges()

type(listtype) function, pointer explicitsolutionmodule::get_exchanges ( class(explicitsolutiontype this)
private

Definition at line 335 of file ExplicitSolution.f90.

336  class(ExplicitSolutionType) :: this
337  type(ListType), pointer :: exchanges

◆ get_models()

type(listtype) function, pointer explicitsolutionmodule::get_models ( class(explicitsolutiontype this)
private
Returns
pointer to the model list
Parameters
thisExplicitSolutionType instance

Definition at line 319 of file ExplicitSolution.f90.

320  type(ListType), pointer :: models !< pointer to the model list
321  class(ExplicitSolutionType) :: this !< ExplicitSolutionType instance
322 
323  models => this%modellist

◆ preparesolve()

subroutine explicitsolutionmodule::preparesolve ( class(explicitsolutiontype this)
private
Parameters
thisExplicitSolutionType instance

Definition at line 225 of file ExplicitSolution.f90.

226  ! -- dummy variables
227  class(ExplicitSolutionType) :: this !< ExplicitSolutionType instance
228  ! -- local variables
229  integer(I4B) :: im
230  class(NumericalModelType), pointer :: mp => null()
231 
232  ! -- Model advance
233  do im = 1, this%modellist%Count()
234  mp => getnumericalmodelfromlist(this%modellist, im)
235  call mp%model_ad()
236  end do
237 
238  ! advance solution
239  call this%sln_ad()
Here is the call graph for this function:

◆ save()

subroutine explicitsolutionmodule::save ( class(explicitsolutiontype this,
character(len=*), intent(in)  filename 
)
private
Parameters
thisExplicitSolutionType instance
[in]filenamefilename to save solution data

Definition at line 287 of file ExplicitSolution.f90.

288  ! -- dummy variables
289  class(ExplicitSolutionType) :: this !< ExplicitSolutionType instance
290  character(len=*), intent(in) :: filename !< filename to save solution data
291  ! -- local variables
292  integer(I4B) :: inunit
293 
294  inunit = getunit()
295  open (unit=inunit, file=filename, status='unknown')
296  write (inunit, *) 'The save routine currently writes nothing'
297  close (inunit)
Here is the call graph for this function:

◆ sln_ad()

subroutine explicitsolutionmodule::sln_ad ( class(explicitsolutiontype this)
private
Parameters
thisExplicitSolutionType instance

Definition at line 156 of file ExplicitSolution.f90.

157  class(ExplicitSolutionType) :: this !< ExplicitSolutionType instance
158 
159  ! -- reset convergence flag
160  this%icnvg = 0

◆ sln_ar()

subroutine explicitsolutionmodule::sln_ar ( class(explicitsolutiontype this)
private
Parameters
thisExplicitSolutionType instance

Definition at line 141 of file ExplicitSolution.f90.

142  class(ExplicitSolutionType) :: this !< ExplicitSolutionType instance
143 
144  ! -- close ems input file
145  call this%parser%Clear()

◆ sln_ca()

subroutine explicitsolutionmodule::sln_ca ( class(explicitsolutiontype this,
integer(i4b), intent(inout)  isgcnvg,
integer(i4b), intent(in)  isuppress_output 
)
private
Parameters
thisExplicitSolutionType instance
[in,out]isgcnvgsolution group convergence flag
[in]isuppress_outputflag for suppressing output

Definition at line 191 of file ExplicitSolution.f90.

192  ! -- dummy variables
193  class(ExplicitSolutionType) :: this !< ExplicitSolutionType instance
194  integer(I4B), intent(inout) :: isgcnvg !< solution group convergence flag
195  integer(I4B), intent(in) :: isuppress_output !< flag for suppressing output
196  ! -- local variables
197  class(NumericalModelType), pointer :: mp => null()
198  character(len=LINELENGTH) :: line
199  character(len=LINELENGTH) :: fmt
200  integer(I4B) :: im
201 
202  ! advance the models and solution
203  call this%prepareSolve()
204 
205  select case (isim_mode)
206  case (mvalidate)
207  line = 'mode="validation" -- Skipping assembly and solution.'
208  fmt = "(/,1x,a,/)"
209  do im = 1, this%modellist%Count()
210  mp => getnumericalmodelfromlist(this%modellist, im)
211  call mp%model_message(line, fmt=fmt)
212  end do
213  case (mnormal)
214 
215  ! solve the models
216  call this%solve()
217 
218  ! finish up
219  call this%finalizeSolve(isgcnvg, isuppress_output)
220  end select
Here is the call graph for this function:

◆ sln_calculate_delt()

subroutine explicitsolutionmodule::sln_calculate_delt ( class(explicitsolutiontype this)
private
Parameters
thisExplicitSolutionType instance

Definition at line 150 of file ExplicitSolution.f90.

151  class(ExplicitSolutionType) :: this !< ExplicitSolutionType instance

◆ sln_da()

subroutine explicitsolutionmodule::sln_da ( class(explicitsolutiontype this)
private
Parameters
thisExplicitSolutionType instance

Definition at line 175 of file ExplicitSolution.f90.

176  class(ExplicitSolutionType) :: this !< ExplicitSolutionType instance
177 
178  ! -- lists
179  call this%modellist%Clear()
180  deallocate (this%modellist)
181 
182  ! -- Scalars
183  call mem_deallocate(this%id)
184  call mem_deallocate(this%iu)
185  call mem_deallocate(this%ttsoln)
186  call mem_deallocate(this%icnvg)

◆ sln_df()

subroutine explicitsolutionmodule::sln_df ( class(explicitsolutiontype this)
private

Definition at line 135 of file ExplicitSolution.f90.

136  class(ExplicitSolutionType) :: this

◆ sln_fp()

subroutine explicitsolutionmodule::sln_fp ( class(explicitsolutiontype this)
private
Parameters
thisExplicitSolutionType instance

Definition at line 169 of file ExplicitSolution.f90.

170  class(ExplicitSolutionType) :: this !< ExplicitSolutionType instance

◆ sln_ot()

subroutine explicitsolutionmodule::sln_ot ( class(explicitsolutiontype this)
private
Parameters
thisExplicitSolutionType instance

Definition at line 165 of file ExplicitSolution.f90.

166  class(ExplicitSolutionType) :: this !< ExplicitSolutionType instance

◆ solve()

subroutine explicitsolutionmodule::solve ( class(explicitsolutiontype this)
private
Parameters
thisExplicitSolutionType instance

Definition at line 244 of file ExplicitSolution.f90.

245  ! -- dummy variables
246  class(ExplicitSolutionType) :: this !< ExplicitSolutionType instance
247  ! -- local variables
248  class(NumericalModelType), pointer :: mp => null()
249  integer(I4B) :: im
250  real(DP) :: ttsoln
251 
252  call code_timer(0, ttsoln, this%ttsoln)
253  do im = 1, this%modellist%Count()
254  mp => getnumericalmodelfromlist(this%modellist, im)
255  call mp%model_solve()
256  end do
257  call code_timer(1, ttsoln, this%ttsoln)
258  this%icnvg = 1
Here is the call graph for this function: