104 character(len=LENMEMPATH) :: input_mempath
105 integer(I4B),
pointer :: simcontinue, nocheck, maxerror
106 character(len=:),
pointer :: prmem
107 character(len=LINELENGTH) :: errmsg
113 call mem_setptr(simcontinue,
'CONTINUE', input_mempath)
114 call mem_setptr(nocheck,
'NOCHECK', input_mempath)
115 call mem_setptr(prmem,
'PRMEM', input_mempath)
116 call mem_setptr(maxerror,
'MAXERRORS', input_mempath)
120 if (nocheck == 1)
then
128 if (prmem /=
'')
then
131 if (errmsg /=
'')
then
139 write (iout,
'(/1x,a)')
'READING SIMULATION OPTIONS'
142 write (iout,
'(4x, a)') &
143 'SIMULATION WILL CONTINUE EVEN IF THERE IS NONCONVERGENCE.'
147 write (iout,
'(4x, a)') &
148 'MODEL DATA WILL NOT BE CHECKED FOR ERRORS.'
151 write (iout,
'(4x, a, i0)') &
152 'MAXIMUM NUMBER OF ERRORS THAT WILL BE STORED IS ', maxerror
154 if (prmem /=
'')
then
155 write (iout,
'(4x, a, a, a)') &
156 'MEMORY_PRINT_OPTION SET TO "', trim(prmem),
'".'
159 write (iout,
'(1x,a)')
'END OF SIMULATION OPTIONS'
173 character(len=LENMEMPATH) :: input_mempath
174 character(len=LENMEMPATH) :: tdis_input_mempath
175 character(len=:),
pointer :: tdis6
176 logical :: terminate = .true.
182 write (iout,
'(/1x,a)')
'READING SIMULATION TIMING'
185 call mem_setptr(tdis6,
'TDIS6', input_mempath)
188 if (tdis6 /=
'')
then
189 call tdis_cr(tdis6, tdis_input_mempath)
191 call store_error(
'TIMING block variable TDIS6 is unset'// &
192 ' in simulation control input.', terminate)
195 write (iout,
'(1x,a)')
'END OF SIMULATION TIMING'
222 character(len=LENMEMPATH) :: input_mempath
232 character(len=LINELENGTH) :: model_type
233 character(len=LINELENGTH) :: fname, model_name
234 integer(I4B) :: n, nr_models_glob
235 integer(I4B),
dimension(:),
pointer :: model_ranks => null()
236 logical :: terminate = .true.
242 call mem_setptr(mtypes,
'MTYPE', input_mempath)
243 call mem_setptr(mfnames,
'MFNAME', input_mempath)
244 call mem_setptr(mnames,
'MNAME', input_mempath)
247 nr_models_glob =
size(mnames)
248 allocate (model_names(nr_models_glob))
249 allocate (model_loc_idx(nr_models_glob))
253 model_ranks => ds%get_load_balance()
256 write (iout,
'(/1x,a)')
'READING SIMULATION MODELS'
260 do n = 1,
size(mtypes)
263 model_type = mtypes(n)
265 model_name = mnames(n)
271 model_loc_idx(n) = -1
276 select case (model_type)
278 if (model_ranks(n) == proc_id)
then
280 write (iout,
'(4x,2a,i0,a)') trim(model_type),
' model ', &
281 n,
' will be created'
282 call gwf_cr(fname, n, model_names(n))
284 model_loc_idx(n) = im
288 if (model_ranks(n) == proc_id)
then
290 write (iout,
'(4x,2a,i0,a)') trim(model_type),
' model ', &
291 n,
' will be created'
292 call gwt_cr(fname, n, model_names(n))
294 model_loc_idx(n) = im
298 if (model_ranks(n) == proc_id)
then
300 write (iout,
'(4x,2a,i0,a)') trim(model_type),
' model ', &
301 n,
' will be created'
302 call gwe_cr(fname, n, model_names(n))
304 model_loc_idx(n) = im
308 if (model_ranks(n) == proc_id)
then
310 write (iout,
'(4x,2a,i0,a)') trim(model_type),
" model ", &
311 n,
" will be created"
312 call chf_cr(fname, n, model_names(n))
313 call developmode(
'CHF is still under development, install the &
314 &nightly build or compile from source with IDEVELOPMODE = 1.')
316 model_loc_idx(n) = im
319 if (model_ranks(n) == proc_id)
then
321 write (iout,
'(4x,2a,i0,a)') trim(model_type),
" model ", &
322 n,
" will be created"
323 call olf_cr(fname, n, model_names(n))
324 call developmode(
'OLF is still under development, install the &
325 &nightly build or compile from source with IDEVELOPMODE = 1.')
327 model_loc_idx(n) = im
330 if (model_ranks(n) == proc_id)
then
332 write (iout,
'(4x,2a,i0,a)') trim(model_type),
' model ', &
333 n,
' will be created'
334 call prt_cr(fname, n, model_names(n))
336 model_loc_idx(n) = im
342 'Unknown simulation model type: ', trim(model_type)
348 write (iout,
'(1x,a)')
'END OF SIMULATION MODELS'
351 if (simulation_mode ==
'PARALLEL' .and. im == 0)
then
352 write (
errmsg,
'(a, i0)') &
353 'No MODELS assigned to process ', proc_id
379 character(len=LENMEMPATH) :: input_mempath
390 character(len=LINELENGTH) :: exgtype
391 integer(I4B) :: exg_id
392 integer(I4B) :: m1_id, m2_id
393 character(len=LINELENGTH) :: fname, name1, name2
394 character(len=LENEXCHANGENAME) :: exg_name
395 character(len=LENMEMPATH) :: exg_mempath
397 character(len=LINELENGTH) :: errmsg
398 logical(LGP) :: terminate = .true.
399 logical(LGP) :: both_remote, both_local
401 character(len=*),
parameter :: fmtmerr =
"('Error in simulation control ', &
402 &'file. Could not find model: ', a)"
408 call mem_setptr(etypes,
'EXGTYPE', input_mempath)
409 call mem_setptr(efiles,
'EXGFILE', input_mempath)
410 call mem_setptr(emnames_a,
'EXGMNAMEA', input_mempath)
411 call mem_setptr(emnames_b,
'EXGMNAMEB', input_mempath)
412 call mem_setptr(emempaths,
'EXGMEMPATHS', input_mempath)
415 write (iout,
'(/1x,a)')
'READING SIMULATION EXCHANGES'
421 do n = 1,
size(etypes)
428 exg_mempath = emempaths(n)
433 m1_id =
ifind(model_names, name1)
435 write (errmsg, fmtmerr) trim(name1)
438 m2_id =
ifind(model_names, name2)
440 write (errmsg, fmtmerr) trim(name2)
445 both_remote = (model_loc_idx(m1_id) == -1 .and. &
446 model_loc_idx(m2_id) == -1)
447 both_local = (model_loc_idx(m1_id) > 0 .and. &
448 model_loc_idx(m2_id) > 0)
449 if (.not. both_remote)
then
450 write (iout,
'(4x,a,a,i0,a,i0,a,i0)') trim(exgtype),
' exchange ', &
451 exg_id,
' will be created to connect model ', m1_id, &
452 ' with model ', m2_id
455 select case (exgtype)
457 write (exg_name,
'(a,i0)')
'CHF-GWF_', exg_id
459 call chfgwf_cr(fname, exg_name, exg_id, m1_id, m2_id, exg_mempath)
462 write (exg_name,
'(a,i0)')
'GWF-GWF_', exg_id
463 if (.not. both_remote)
then
470 call gwfgwt_cr(fname, exg_id, m1_id, m2_id)
474 call gwfgwe_cr(fname, exg_id, m1_id, m2_id)
477 call gwfprt_cr(fname, exg_id, m1_id, m2_id)
479 write (exg_name,
'(a,i0)')
'GWT-GWT_', exg_id
480 if (.not. both_remote)
then
486 write (exg_name,
'(a,i0)')
'GWE-GWE_', exg_id
487 if (.not. both_remote)
then
493 write (exg_name,
'(a,i0)')
'OLF-GWF_', exg_id
495 call olfgwf_cr(fname, exg_name, exg_id, m1_id, m2_id, exg_mempath)
498 write (errmsg,
'(a,a)') &
499 'Unknown simulation exchange type: ', trim(exgtype)
505 write (iout,
'(1x,a)')
'END OF SIMULATION EXCHANGES'
514 integer(I4B),
intent(in) :: sgid
515 integer(I4B),
intent(in) :: isgpsoln
517 character(len=LINELENGTH) :: errmsg
518 logical :: terminate = .true.
520 character(len=*),
parameter :: fmterrmxiter = &
521 "('MXITER is set to ', i0, ' but there is only one solution', &
522 &' in SOLUTION GROUP ', i0, '. Set MXITER to 1 in simulation control', &
529 if (isgpsoln == 0)
then
530 write (errmsg,
'(a,i0)') &
531 'There are no solutions for solution group ', sgid
536 if (isgpsoln == 1 .and. sgp%mxiter > 1)
then
537 write (errmsg, fmterrmxiter) sgp%mxiter, isgpsoln
561 character(len=LENMEMPATH) :: input_mempath
568 integer(I4B),
dimension(:),
contiguous,
pointer :: blocknum
569 character(len=LINELENGTH) :: stype, fname
570 character(len=:),
allocatable :: mnames
574 integer(I4B) :: isoln
575 integer(I4B) :: isgpsoln
577 integer(I4B) :: glo_mid
578 integer(I4B) :: loc_idx
579 integer(I4B) :: i, j, istat, mxiter
580 integer(I4B) :: nwords
581 character(len=LENMODELNAME),
dimension(:),
allocatable :: words
582 character(len=:),
allocatable :: parse_str
583 character(len=LINELENGTH) :: errmsg
584 logical :: terminate = .true.
590 call mem_setptr(slntype,
'SLNTYPE', input_mempath)
591 call mem_setptr(slnfname,
'SLNFNAME', input_mempath)
592 call mem_setptr(slnmnames,
'SLNMNAMES', input_mempath)
593 call mem_setptr(blocknum,
'SOLUTIONGROUPNUM', input_mempath)
596 write (iout,
'(/1x,a)')
'READING SOLUTIONGROUP'
603 do i = 1,
size(blocknum)
606 allocate (
character(slnmnames(i)%strlen()) :: mnames)
611 mnames = slnmnames(i)
613 if (blocknum(i) /= sgid)
then
616 if (blocknum(i) == sgid + 1)
then
632 write (errmsg,
'(a,i0,a,i0,a)') &
633 'Solution group blocks are not listed consecutively. Found ', &
634 blocknum(i),
' when looking for ', sgid + 1,
'.'
643 read (fname, *, iostat=istat) mxiter
651 isgpsoln = isgpsoln + 1
655 call sgp%add_solution(isoln, sp)
658 parse_str = trim(mnames)//
' '
664 glo_mid =
ifind(model_names, words(j))
665 if (glo_mid == -1)
then
666 write (errmsg,
'(a,a)')
'Invalid model name: ', trim(words(j))
670 loc_idx = model_loc_idx(glo_mid)
671 if (loc_idx == -1)
then
683 write (errmsg,
'(4a)') &
684 'Model "', trim(words(j)), &
685 '" is an explicit model and cannot be added to an IMS6 ', &
686 'solution. Explicit models require EMS6.'
691 call sp%add_model(mp)
703 isgpsoln = isgpsoln + 1
707 call sgp%add_solution(isoln, sp)
710 parse_str = trim(mnames)//
' '
716 glo_mid =
ifind(model_names, words(j))
717 if (glo_mid == -1)
then
718 write (errmsg,
'(a,a)')
'Invalid model name: ', trim(words(j))
722 loc_idx = model_loc_idx(glo_mid)
723 if (loc_idx == -1)
then
735 write (errmsg,
'(4a)') &
736 'Model "', trim(words(j)), &
737 '" is a numerical model and cannot be added to an EMS6 ', &
738 'solution. Numerical models require IMS6.'
743 call sp%add_model(mp)
762 write (iout,
'(1x,a)')
'END OF SOLUTIONGROUP'
766 call store_error(
'There are no solution groups.', terminate)
774 character(len=LINELENGTH) :: errmsg
780 if (mp%idsoln == 0)
then
781 write (errmsg,
'(a,a)') &
782 'Model was not assigned to a solution: ', mp%name
804 type(
listtype),
pointer :: models_in_solution
805 integer(I4B) :: is, ie, im
815 models_in_solution => sp%get_models()
816 do im = 1, models_in_solution%Count()
818 if (ep%connects_model(mp))
then
821 call sp%add_exchange(ep)
833 character(len=*),
intent(in) :: mtype
834 character(len=*),
intent(inout) :: mname
838 character(len=LINELENGTH) :: errmsg
839 logical :: terminate = .true.
841 ilen = len_trim(mname)
843 write (errmsg,
'(a,a)')
'Invalid model name: ', trim(mname)
845 write (errmsg,
'(a,i0,a,i0)') &
846 'Name length of ', ilen,
' exceeds maximum length of ', &
851 if (mname(i:i) ==
' ')
then
852 write (errmsg,
'(a,a)')
'Invalid model name: ', trim(mname)
854 write (errmsg,
'(a)') &
855 'Model name cannot have spaces within it.'
class(baseexchangetype) function, pointer, public getbaseexchangefromlist(list, idx)
Retrieve a specific BaseExchangeType object from a list.
class(basemodeltype) function, pointer, public getbasemodelfromlist(list, idx)
subroutine, public addbasesolutiontolist(list, solution)
class(basesolutiontype) function, pointer, public getbasesolutionfromlist(list, idx)
This module contains the ChfGwfExchangeModule Module.
subroutine, public chfgwf_cr(filename, name, id, m1_id, m2_id, input_mempath)
@ brief Create CHF GWF exchange
Channel Flow (CHF) Module.
subroutine, public chf_cr(filename, id, modelname)
Create a new surface water flow model object.
This module contains simulation constants.
integer(i4b), parameter linelength
maximum length of a standard line
integer(i4b), parameter lenmodelname
maximum length of the model name
integer(i4b), parameter lenexchangename
maximum length of the exchange name
integer(i4b), parameter lenpackagetype
maximum length of a package type (DIS6, SFR6, CSUB6, etc.)
integer(i4b), parameter lenbigline
maximum length of a big line
real(dp), parameter dzero
real constant zero
integer(i4b), parameter lenmempath
maximum length of the memory path
class(distributedsimtype) function, pointer, public get_dsim()
Get pointer to the distributed simulation object.
Models that solve themselves.
class(explicitmodeltype) function, pointer, public getexplicitmodelfromlist(list, idx)
@ brief Get generic object from list and return as explicit model
Disable development features in release mode.
subroutine, public developmode(errmsg, iunit)
Terminate if in release mode (guard development features)
This module contains the GweGweExchangeModule Module.
subroutine, public gweexchange_create(filename, name, id, m1_id, m2_id, input_mempath)
@ brief Create GWT GWT exchange
subroutine, public gwe_cr(filename, id, modelname)
Create a new groundwater energy transport model object.
subroutine, public gwfgwe_cr(filename, id, m1_id, m2_id)
Create a new GWF to GWE exchange object.
This module contains the GwfGwfExchangeModule Module.
subroutine, public gwfexchange_create(filename, name, id, m1_id, m2_id, input_mempath)
@ brief Create GWF GWF exchange
subroutine, public gwfgwt_cr(filename, id, m1_id, m2_id)
Create a new GWF to GWT exchange object.
subroutine, public gwf_cr(filename, id, modelname)
Create a new groundwater flow model object.
subroutine, public gwfprt_cr(filename, id, m1id, m2id)
Create a new GWF to PRT exchange object.
This module contains the GwtGwtExchangeModule Module.
subroutine, public gwtexchange_create(filename, name, id, m1_id, m2_id, input_mempath)
@ brief Create GWT GWT exchange
subroutine, public gwt_cr(filename, id, modelname)
Create a new groundwater transport model object.
This module defines variable data types.
subroutine, public write_kindinfo(iout)
Write variable data types.
type(listtype), public basemodellist
type(listtype), public baseexchangelist
type(listtype), public solutiongrouplist
type(listtype), public basesolutionlist
character(len=lenmempath) function create_mem_path(component, subcomponent, context)
returns the path to the memory object
subroutine, public mem_set_print_option(iout, keyword, error_msg)
Set the memory print option.
class(numericalmodeltype) function, pointer, public getnumericalmodelfromlist(list, idx)
This module contains the OlfGwfExchangeModule Module.
subroutine, public olfgwf_cr(filename, name, id, m1_id, m2_id, input_mempath)
@ brief Create OLF GWF exchange
Channel Flow (OLF) Module.
subroutine, public olf_cr(filename, id, modelname)
Create a new overland flow model object.
subroutine, public prt_cr(filename, id, modelname)
Create a new particle tracking model object.
This module contains simulation methods.
subroutine, public store_warning(msg, substring)
Store warning message.
subroutine, public store_error(msg, terminate)
Store an error message.
subroutine, public maxerrors(imax)
Set the maximum number of errors to be stored.
integer(i4b) function, public count_errors()
Return number of errors.
subroutine, public store_error_filename(filename, terminate)
Store the erroring file name.
subroutine models_create()
Set the models to be used for the simulation.
subroutine check_model_assignment()
Check for dangling models, and break with error when found.
subroutine, public simulation_da()
Deallocate simulation variables.
subroutine options_create()
Set the simulation options.
subroutine check_model_name(mtype, mname)
Check that the model name is valid.
subroutine source_simulation_nam()
Source the simulation name file.
subroutine solution_groups_create()
Set the solution_groups to be used for the simulation.
subroutine timing_create()
Set the timing module to be used for the simulation.
subroutine exchanges_create()
Set the exchanges to be used for the simulation.
subroutine assign_exchanges()
Assign exchanges to solutions.
subroutine solution_group_check(sgp, sgid, isgpsoln)
Check a solution_group to be used for the simulation.
subroutine, public simulation_cr()
Read the simulation name file and initialize the models, exchanges.
This module contains simulation variables.
character(len=maxcharlen) errmsg
error message string
character(len=linelength) idm_context
integer(i4b) isimcheck
simulation input check flag (1) to check input, (0) to ignore checks
integer(i4b) isimcontinue
simulation continue flag (1) to continue if isimcnvg = 0, (0) to terminate
character(len=linelength) simulation_mode
integer(i4b), dimension(:), allocatable model_loc_idx
equals the local index into the basemodel list (-1 when not available)
integer(i4b) iout
file unit number for simulation output
character(len=lenmodelname), dimension(:), allocatable model_names
all model names in the (global) simulation
class(basesolutiontype) function, pointer, public create_ims_solution(sim_mode, filename, sol_id)
Create an IMS solution of type NumericalSolution for serial runs or its sub-type ParallelSolution for...
class(basesolutiontype) function, pointer, public create_ems_solution(sim_mode, filename, sol_id)
Create an EMS solution of type ExplicitSolution for serial runs or its sub-type ParallelSolution for.
subroutine, public solutiongroup_create(sgp, id)
Create a new solution group.
subroutine, public addsolutiongrouptolist(list, solutiongroup)
subroutine, public tdis_cr(fname, inmempath)
Create temporal discretization.
This module contains version information.
subroutine write_listfile_header(iout, cmodel_type, write_sys_command, write_kind_info)
@ brief Write program header
subroutine, public add_virtual_gwe_exchange(name, exchange_id, model1_id, model2_id)
Add a virtual GWE-GWE exchange to the simulation.
subroutine, public add_virtual_gwe_model(model_id, model_name, model)
subroutine, public add_virtual_gwf_exchange(name, exchange_id, model1_id, model2_id)
Add a virtual GWF-GWF exchange to the simulation.
subroutine, public add_virtual_gwf_model(model_id, model_name, model)
Add virtual GWF model.
subroutine, public add_virtual_gwt_exchange(name, exchange_id, model1_id, model2_id)
Add a virtual GWT-GWT exchange to the simulation.
subroutine, public add_virtual_gwt_model(model_id, model_name, model)
Highest level model type. All models extend this parent type.
This class is used to store a single deferred-length character string. It was designed to work in an ...
Base type for models that solve themselves.
A generic heterogeneous doubly-linked list.