MODFLOW 6  version 6.7.0.dev1
USGS Modular Hydrologic Model
mf6coremodule Module Reference

Core MODFLOW 6 module. More...

Functions/Subroutines

subroutine mf6run
 Main controller. More...
 
subroutine mf6initialize ()
 Initialize a simulation. More...
 
logical(lgp) function mf6update ()
 Run a time step. More...
 
subroutine mf6finalize ()
 Finalize the simulation. More...
 
subroutine print_info ()
 print initial message More...
 
subroutine create_lstfile ()
 Set up mfsim list file output logging. More...
 
subroutine static_input_load ()
 Create simulation input context. More...
 
subroutine simulation_df ()
 Define the simulation. More...
 
subroutine simulation_ar ()
 Simulation allocate and read. More...
 
subroutine connections_cr ()
 Create the model connections from the exchanges. More...
 
subroutine mf6preparetimestep ()
 Read and prepare time step. More...
 
subroutine mf6dotimestep ()
 Run time step. More...
 
subroutine sim_step_retry (finishedTrying)
 Rerun time step. More...
 
logical(lgp) function mf6finalizetimestep ()
 Finalize time step. More...
 

Variables

class(runcontroltype), pointer run_ctrl => null()
 the run controller for this simulation More...
 

Detailed Description

This module contains the core components for MODFLOW 6. This module is used by the stand-alone executable and the share object versions of MODFLOW 6.

Function/Subroutine Documentation

◆ connections_cr()

subroutine mf6coremodule::connections_cr

This will upgrade the numerical exchanges in the solution, whenever the configuration requires this, to Connection objects. Currently we anticipate:

GWF-GWF => GwfGwfConnection GWT-GWT => GwtGwtConecction

Definition at line 450 of file mf6core.f90.

452  use simvariablesmodule, only: iout
453  use versionmodule, only: idevelopmode
454  integer(I4B) :: isol
455  type(ConnectionBuilderType) :: connectionBuilder
456  class(BaseSolutionType), pointer :: sol => null()
457  integer(I4B) :: status
458  character(len=16) :: envvar
459 
460  write (iout, '(/a)') 'PROCESSING MODEL CONNECTIONS'
461 
462  if (baseexchangelist%Count() == 0) then
463  ! if this is not a coupled simulation in any way,
464  ! then we will not need model connections
465  return
466  end if
467 
468  if (idevelopmode == 1) then
469  call get_environment_variable('DEV_ALWAYS_USE_IFMOD', &
470  value=envvar, status=status)
471  if (status == 0 .and. envvar == '1') then
472  connectionbuilder%dev_always_ifmod = .true.
473  write (iout, '(/a)') "Development option: forcing interface model"
474  end if
475  end if
476 
477  do isol = 1, basesolutionlist%Count()
478  sol => getbasesolutionfromlist(basesolutionlist, isol)
479  call connectionbuilder%processSolution(sol)
480  end do
481 
482  write (iout, '(a)') 'END OF MODEL CONNECTIONS'
This module contains simulation variables.
Definition: SimVariables.f90:9
integer(i4b) iout
file unit number for simulation output
This module contains version information.
Definition: version.f90:7
integer(i4b), parameter idevelopmode
Definition: version.f90:19
Here is the call graph for this function:
Here is the caller graph for this function:

◆ create_lstfile()

subroutine mf6coremodule::create_lstfile

This subroutine creates the mfsim list file and writes the header.

Definition at line 266 of file mf6core.f90.

267  use constantsmodule, only: linelength
270  use messagemodule, only: write_message
272  character(len=LINELENGTH) :: line
273  !
274  ! -- Open simulation list file
275  iout = getunit()
276  !
277  if (nr_procs > 1) then
279  end if
280  !
281  call openfile(iout, 0, simlstfile, 'LIST', filstat_opt='REPLACE')
282  !
283  ! -- write simlstfile to stdout
284  write (line, '(2(1x,A))') 'Writing simulation list file:', &
285  trim(adjustl(simlstfile))
286  !
287  call write_message(line)
This module contains simulation constants.
Definition: Constants.f90:9
integer(i4b), parameter linelength
maximum length of a standard line
Definition: Constants.f90:45
integer(i4b) function, public getunit()
Get a free unit number.
subroutine, public append_processor_id(name, proc_id)
Append processor id to a string.
subroutine, public openfile(iu, iout, fname, ftype, fmtarg_opt, accarg_opt, filstat_opt, mode_opt)
Open a file.
Definition: InputOutput.f90:30
Store and issue logging messages to output units.
Definition: Message.f90:2
subroutine, public write_message(text, iunit, fmt, skipbefore, skipafter, advance)
Write a message to an output unit.
Definition: Message.f90:210
integer(i4b) nr_procs
character(len=linelength) simlstfile
simulation listing file name
integer(i4b) proc_id
subroutine write_listfile_header(iout, cmodel_type, write_sys_command, write_kind_info)
@ brief Write program header
Definition: version.f90:98
Here is the call graph for this function:
Here is the caller graph for this function:

◆ mf6dotimestep()

subroutine mf6coremodule::mf6dotimestep

This subroutine runs a single time step for the simulation. Steps include:

  • formulate the system of equations for each model and exchange
  • solve each solution

Definition at line 620 of file mf6core.f90.

621  ! -- modules
622  use kindmodule, only: i4b
623  use listsmodule, only: solutiongrouplist
626  use idmloadmodule, only: idm_ad
627  ! -- local variables
628  class(SolutionGroupType), pointer :: sgp => null()
629  integer(I4B) :: isg
630  logical :: finishedTrying
631 
632  ! start timer
633  call g_prof%start("Do time step", g_prof%tmr_do_tstp)
634 
635  ! -- By default, the solution groups will be solved once, and
636  ! may fail. But if adaptive stepping is active, then
637  ! the solution groups may be solved over and over with
638  ! progressively smaller time steps to see if convergence
639  ! can be obtained.
640  ifailedstepretry = 0
641  retryloop: do
642 
643  ! -- idm advance
644  call idm_ad()
645 
646  do isg = 1, solutiongrouplist%Count()
648  call sgp%sgp_ca()
649  end do
650 
651  call sim_step_retry(finishedtrying)
652  if (finishedtrying) exit retryloop
654 
655  end do retryloop
656 
657  ! stop timer
658  call g_prof%stop(g_prof%tmr_do_tstp)
659 
This module contains the IdmLoadModule.
Definition: IdmLoad.f90:7
subroutine, public idm_ad()
advance package dynamic data for period steps
Definition: IdmLoad.f90:62
This module defines variable data types.
Definition: kind.f90:8
type(listtype), public solutiongrouplist
Definition: mf6lists.f90:22
integer(i4b) ifailedstepretry
current retry for this time step
class(solutiongrouptype) function, pointer, public getsolutiongroupfromlist(list, idx)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ mf6finalize()

subroutine mf6coremodule::mf6finalize

This subroutine finalizes a simulation. Steps include:

  • final processing
  • deallocate memory

Definition at line 144 of file mf6core.f90.

145  ! -- modules
146  use, intrinsic :: iso_fortran_env, only: output_unit
147  use listsmodule, only: lists_da
149  use tdismodule, only: tdis_da
150  use idmloadmodule, only: idm_da
151  use sourceloadmodule, only: export_da
152  use simvariablesmodule, only: iout
153  ! -- local variables
154  integer(I4B) :: im
155  integer(I4B) :: ic
156  integer(I4B) :: is
157  integer(I4B) :: isg
158  class(SolutionGroupType), pointer :: sgp => null()
159  class(BaseSolutionType), pointer :: sp => null()
160  class(BaseModelType), pointer :: mp => null()
161  class(BaseExchangeType), pointer :: ep => null()
162  class(SpatialModelConnectionType), pointer :: mc => null()
163  integer(I4B) :: tmr_dealloc
164 
165  ! start timer
166  call g_prof%start("Finalize", g_prof%tmr_finalize)
167 
168  !
169  ! -- FINAL PROCESSING (FP)
170  ! -- Final processing for each model
171  do im = 1, basemodellist%Count()
172  mp => getbasemodelfromlist(basemodellist, im)
173  call mp%model_fp()
174  end do
175  !
176  ! -- Final processing for each exchange
177  do ic = 1, baseexchangelist%Count()
178  ep => getbaseexchangefromlist(baseexchangelist, ic)
179  call ep%exg_fp()
180  end do
181  !
182  ! -- Final processing for each solution
183  do is = 1, basesolutionlist%Count()
184  sp => getbasesolutionfromlist(basesolutionlist, is)
185  call sp%sln_fp()
186  end do
187 
188  ! start timer for deallocation
189  tmr_dealloc = -1
190  call g_prof%start("Deallocate", tmr_dealloc)
191 
192  !
193  ! -- DEALLOCATE (DA)
194  ! -- Deallocate tdis
195  call tdis_da()
196  !
197  ! -- Deallocate for each model
198  do im = 1, basemodellist%Count()
199  mp => getbasemodelfromlist(basemodellist, im)
200  call mp%model_da()
201  deallocate (mp)
202  end do
203  !
204  ! -- Deallocate for each exchange
205  do ic = 1, baseexchangelist%Count()
206  ep => getbaseexchangefromlist(baseexchangelist, ic)
207  call ep%exg_da()
208  deallocate (ep)
209  end do
210  !
211  ! -- Deallocate for each connection
212  do ic = 1, baseconnectionlist%Count()
213  mc => get_smc_from_list(baseconnectionlist, ic)
214  call mc%exg_da()
215  deallocate (mc)
216  end do
217  !
218  ! -- Deallocate for each solution
219  do is = 1, basesolutionlist%Count()
220  sp => getbasesolutionfromlist(basesolutionlist, is)
221  call sp%sln_da()
222  deallocate (sp)
223  end do
224  !
225  ! -- Deallocate solution group and simulation variables
226  do isg = 1, solutiongrouplist%Count()
227  sgp => getsolutiongroupfromlist(solutiongrouplist, isg)
228  call sgp%sgp_da()
229  deallocate (sgp)
230  end do
231  !
232  call idm_da(iout)
233  call export_da()
234  call simulation_da()
235  call lists_da()
236 
237  ! stop timer
238  call g_prof%stop(tmr_dealloc)
239 
240  ! finish gently (No calls after this)
241  ! timer is stopped inside because this call does not return
242  call run_ctrl%finish()
243 
subroutine, public idm_da(iout)
idm deallocate routine
Definition: IdmLoad.f90:74
subroutine, public lists_da()
Definition: mf6lists.f90:34
subroutine, public simulation_da()
Deallocate simulation variables.
This module contains the SourceLoadModule.
Definition: SourceLoad.F90:8
subroutine, public export_da()
deallocate model export objects and list
Definition: SourceLoad.F90:336
subroutine, public tdis_da()
Deallocate memory.
Definition: tdis.f90:345
Here is the call graph for this function:
Here is the caller graph for this function:

◆ mf6finalizetimestep()

logical(lgp) function mf6coremodule::mf6finalizetimestep

This function finalizes a single time step for the simulation and writes output for the time step. Steps include:

  • write output for each model
  • write output for each exchange
  • write output for each solutions
  • perform a final convergence check and whether the simulation can continue if convergence was not achieved
Returns
hasConverged boolean indicating if convergence was achieved for the time step

Definition at line 708 of file mf6core.f90.

709  ! -- modules
710  use kindmodule, only: i4b
716  use simmodule, only: converge_check
717  use simvariablesmodule, only: isim_mode
719  ! -- return variable
720  logical(LGP) :: hasConverged
721  ! -- local variables
722  class(BaseSolutionType), pointer :: sp => null()
723  class(BaseModelType), pointer :: mp => null()
724  class(BaseExchangeType), pointer :: ep => null()
725  class(SpatialModelConnectionType), pointer :: mc => null()
726  character(len=LINELENGTH) :: line
727  character(len=LINELENGTH) :: fmt
728  integer(I4B) :: im
729  integer(I4B) :: ix
730  integer(I4B) :: ic
731  integer(I4B) :: is
732  !
733  ! -- initialize format and line
734  fmt = "(/,a,/)"
735  line = 'end timestep'
736 
737  ! start timer
738  call g_prof%start("Finalize time step", g_prof%tmr_final_tstp)
739 
740  !
741  ! -- evaluate simulation mode
742  select case (isim_mode)
743  case (mvalidate)
744  !
745  ! -- Write final message for timestep for each model
746  do im = 1, basemodellist%Count()
748  call mp%model_message(line, fmt=fmt)
749  end do
750  case (mnormal)
751 
752  call g_prof%start("Write output", g_prof%tmr_output)
753  !
754  ! -- Write output and final message for timestep for each model
755  do im = 1, basemodellist%Count()
757  call mp%model_ot()
758  call mp%model_message(line, fmt=fmt)
759  end do
760  !
761  ! -- Write output for each exchange
762  do ix = 1, baseexchangelist%Count()
764  call ep%exg_ot()
765  end do
766  !
767  ! -- Write output for each connection
768  do ic = 1, baseconnectionlist%Count()
769  mc => get_smc_from_list(baseconnectionlist, ic)
770  call mc%exg_ot()
771  end do
772  !
773  ! -- Write output for each solution
774  do is = 1, basesolutionlist%Count()
776  call sp%sln_ot()
777  end do
778  !
779  ! -- update exports
780  call g_prof%start("NetCDF export", g_prof%tmr_nc_export)
781  call export_post_step()
782  call g_prof%stop(g_prof%tmr_nc_export)
783 
784  call g_prof%stop(g_prof%tmr_output)
785  end select
786  !
787  ! -- Check if we're done
788  call converge_check(hasconverged)
789 
790  ! stop timer
791  call g_prof%stop(g_prof%tmr_final_tstp)
792 
class(baseexchangetype) function, pointer, public getbaseexchangefromlist(list, idx)
Retrieve a specific BaseExchangeType object from a list.
class(basemodeltype) function, pointer, public getbasemodelfromlist(list, idx)
Definition: BaseModel.f90:172
class(basesolutiontype) function, pointer, public getbasesolutionfromlist(list, idx)
@ mvalidate
validation mode - do not run time steps
Definition: Constants.f90:205
@ mnormal
normal output mode
Definition: Constants.f90:206
type(listtype), public basemodellist
Definition: mf6lists.f90:16
type(listtype), public baseexchangelist
Definition: mf6lists.f90:25
type(listtype), public basesolutionlist
Definition: mf6lists.f90:19
This module contains simulation methods.
Definition: Sim.f90:10
subroutine, public converge_check(hasConverged)
Simulation convergence check.
Definition: Sim.f90:402
integer(i4b) isim_mode
simulation mode
subroutine, public export_post_step()
model exports post step actions
Definition: SourceLoad.F90:329
Highest level model type. All models extend this parent type.
Definition: BaseModel.f90:13
Here is the call graph for this function:
Here is the caller graph for this function:

◆ mf6initialize()

subroutine mf6coremodule::mf6initialize

This subroutine initializes a MODFLOW 6 simulation. The subroutine:

  • creates the simulation
  • defines
  • allocates and reads static data

Definition at line 70 of file mf6core.f90.

71  ! -- modules
74  use sourceloadmodule, only: export_cr
75 
76  ! init timer and start
77  call g_prof%initialize()
78  call g_prof%start("Run", g_prof%tmr_run)
79  call g_prof%start("Initialize", g_prof%tmr_init)
80 
81  ! -- get the run controller for sequential or parallel builds
82  run_ctrl => create_run_control()
83  call run_ctrl%start()
84 
85  ! -- print info and start timer
86  call print_info()
87 
88  ! -- create mfsim.lst
89  call create_lstfile()
90 
91  ! -- load input context
92  call static_input_load()
93 
94  ! -- create
95  call simulation_cr()
96 
97  ! -- define
98  call simulation_df()
99 
100  ! -- allocate and read
101  call simulation_ar()
102 
103  ! -- create model exports
104  call export_cr()
105 
106  ! -- stop the timer
107  call g_prof%stop(g_prof%tmr_init)
108 
class(runcontroltype) function, pointer, public create_run_control()
subroutine, public simulation_cr()
Read the simulation name file and initialize the models, exchanges.
subroutine, public export_cr()
create model exports list
Definition: SourceLoad.F90:301
Here is the call graph for this function:
Here is the caller graph for this function:

◆ mf6preparetimestep()

subroutine mf6coremodule::mf6preparetimestep

This subroutine reads and prepares period data for the simulation. Steps include:

  • read and prepare for each model
  • read and prepare for each exchange
  • reset convergence flag
  • calculate maximum time step for each model
  • calculate maximum time step for each exchange
  • calculate maximum time step for each solution
  • set time discretization timestep using smallest maximum timestep

Definition at line 498 of file mf6core.f90.

499  ! -- modules
500  use kindmodule, only: i4b
503  kstp, kper
508  use simmodule, only: converge_reset
509  use simvariablesmodule, only: isim_mode
510  use idmloadmodule, only: idm_rp
512  ! -- local variables
513  class(BaseModelType), pointer :: mp => null()
514  class(BaseExchangeType), pointer :: ep => null()
515  class(SpatialModelConnectionType), pointer :: mc => null()
516  class(BaseSolutionType), pointer :: sp => null()
517  character(len=LINELENGTH) :: line
518  character(len=LINELENGTH) :: fmt
519  integer(I4B) :: im
520  integer(I4B) :: ie
521  integer(I4B) :: ic
522  integer(I4B) :: is
523 
524  ! start timer
525  call g_prof%start("Prepare time step", g_prof%tmr_prep_tstp)
526 
527  !
528  ! -- initialize fmt
529  fmt = "(/,a,/)"
530  !
531  ! -- period update
532  call tdis_set_counters()
533  !
534  ! -- set base line
535  write (line, '(a,i0,a,i0,a)') &
536  'start timestep kper="', kper, '" kstp="', kstp, '" mode="'
537  !
538  ! -- evaluate simulation mode
539  select case (isim_mode)
540  case (mvalidate)
541  line = trim(line)//'validate"'
542  case (mnormal)
543  line = trim(line)//'normal"'
544  end select
545 
546  ! -- load dynamic input
547  call idm_rp()
548 
549  ! -- Read and prepare each model
550  do im = 1, basemodellist%Count()
552  call mp%model_message(line, fmt=fmt)
553  call mp%model_rp()
554  end do
555  !
556  ! -- Synchronize
557  call run_ctrl%at_stage(stg_bfr_exg_rp)
558  !
559  ! -- Read and prepare each exchange
560  do ie = 1, baseexchangelist%Count()
562  call ep%exg_rp()
563  end do
564  !
565  ! -- Read and prepare each connection
566  do ic = 1, baseconnectionlist%Count()
567  mc => get_smc_from_list(baseconnectionlist, ic)
568  call mc%exg_rp()
569  end do
570  !
571  ! -- Synchronize
572  call run_ctrl%at_stage(stg_aft_con_rp)
573  !
574  ! -- reset simulation convergence flag
575  call converge_reset()
576  !
577  ! -- time update for each model
578  do im = 1, basemodellist%Count()
580  call mp%model_dt()
581  end do
582  !
583  ! -- time update for each exchange
584  do ie = 1, baseexchangelist%Count()
586  call ep%exg_dt()
587  end do
588  !
589  ! -- time update for each connection
590  do ic = 1, baseconnectionlist%Count()
591  mc => get_smc_from_list(baseconnectionlist, ic)
592  call mc%exg_dt()
593  end do
594  !
595  ! -- time update for each solution
596  do is = 1, basesolutionlist%Count()
597  sp => getbasesolutionfromlist(basesolutionlist, is)
598  call sp%sln_dt()
599  end do
600  !
601  ! -- update exports
602  call export_post_prepare()
603  !
604  ! -- set time step
605  call tdis_set_timestep()
606 
607  ! stop timer
608  call g_prof%stop(g_prof%tmr_prep_tstp)
609 
subroutine, public idm_rp()
load package dynamic data for period
Definition: IdmLoad.f90:50
subroutine, public converge_reset()
Reset the simulation convergence flag.
Definition: Sim.f90:389
subroutine, public export_post_prepare()
model exports post prepare step actions
Definition: SourceLoad.F90:322
subroutine, public tdis_set_timestep()
Set time step length.
Definition: tdis.f90:153
subroutine, public tdis_set_counters()
Set kstp and kper.
Definition: tdis.f90:91
integer(i4b), pointer, public kstp
current time step number
Definition: tdis.f90:24
integer(i4b), pointer, public kper
current stress period number
Definition: tdis.f90:23
Here is the call graph for this function:
Here is the caller graph for this function:

◆ mf6run()

subroutine mf6coremodule::mf6run

This subroutine is the main controller for MODFLOW 6.

Definition at line 33 of file mf6core.f90.

34  ! -- modules
36  use tdismodule, only: endofsimulation
37  ! -- local
38  logical(LGP) :: hasConverged
39  !
40  ! -- parse any command line arguments
42  !
43  ! initialize simulation
44  call mf6initialize()
45  !
46  ! -- time loop
47  do while (.not. endofsimulation)
48 
49  ! perform a time step
50  hasconverged = mf6update()
51 
52  ! if not converged, break
53  if (.not. hasconverged) exit
54 
55  end do
56  !
57  ! -- finalize simulation
58  call mf6finalize()
59 
subroutine, public getcommandlinearguments()
Get command line arguments.
Definition: comarg.f90:29
logical(lgp), pointer, public endofsimulation
flag indicating end of simulation
Definition: tdis.f90:28
Here is the call graph for this function:
Here is the caller graph for this function:

◆ mf6update()

logical(lgp) function mf6coremodule::mf6update

This function runs a single time step to completion.

Returns
hasConverged boolean indicating if convergence was achieved for the time step

Definition at line 118 of file mf6core.f90.

119  logical(LGP) :: hasConverged
120  ! start timer
121  call g_prof%start("Update", g_prof%tmr_update)
122  !
123  ! -- prepare timestep
124  call mf6preparetimestep()
125  !
126  ! -- do timestep
127  call mf6dotimestep()
128  !
129  ! -- after timestep
130  hasconverged = mf6finalizetimestep()
131 
132  ! stop timer
133  call g_prof%stop(g_prof%tmr_update)
134 
Here is the call graph for this function:
Here is the caller graph for this function:

◆ print_info()

subroutine mf6coremodule::print_info

Definition at line 248 of file mf6core.f90.

249  use simmodule, only: initial_message
250  use timermodule, only: print_start_time
251 
252  ! print initial message
253  call initial_message()
254 
255  ! get start time
256  call print_start_time()
257 
subroutine, public initial_message()
Print the header and initializes messaging.
Definition: Sim.f90:442
subroutine, public print_start_time()
Start simulation timer.
Definition: Timer.f90:19
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sim_step_retry()

subroutine mf6coremodule::sim_step_retry ( logical, intent(out)  finishedTrying)

This subroutine reruns a single time step for the simulation when the adaptive time step option is used.

Parameters
[out]finishedtryingboolean that indicates if no

Definition at line 668 of file mf6core.f90.

669  ! -- modules
670  use kindmodule, only: dp
672  use simmodule, only: converge_reset
673  use tdismodule, only: kstp, kper, delt, tdis_delt_reset
675  ! -- dummy variables
676  logical, intent(out) :: finishedTrying !< boolean that indicates if no
677  ! additional reruns of the time step are required
678  !
679  ! -- Check with ats to reset delt and keep trying
680  finishedtrying = .true.
681  call ats_reset_delt(kstp, kper, laststepfailed, delt, finishedtrying)
682  !
683  if (.not. finishedtrying) then
684  !
685  ! -- Reset delt, which requires updating pertim, totim
686  ! and end of period and simulation indicators
687  call tdis_delt_reset(delt)
688  !
689  ! -- Reset state of the simulation convergence flag
690  call converge_reset()
691 
692  end if
subroutine, public ats_reset_delt(kstp, kper, lastStepFailed, delt, finishedTrying)
@ brief Reset time step because failure has occurred
Definition: ats.f90:606
integer(i4b) laststepfailed
flag indicating if the last step failed (1) if last step failed; (0) otherwise (set in converge_check...
subroutine, public tdis_delt_reset(deltnew)
Reset delt and update timing variables and indicators.
Definition: tdis.f90:213
real(dp), pointer, public delt
length of the current time step
Definition: tdis.f90:29
Here is the call graph for this function:
Here is the caller graph for this function:

◆ simulation_ar()

subroutine mf6coremodule::simulation_ar

This subroutine allocates and reads static data for the simulation. Steps include:

  • allocate and read for each model
  • allocate and read for each exchange
  • allocate and read for each solution

Definition at line 398 of file mf6core.f90.

400  ! -- local variables
401  integer(I4B) :: im
402  integer(I4B) :: ic
403  integer(I4B) :: is
404  class(BaseSolutionType), pointer :: sp => null()
405  class(BaseModelType), pointer :: mp => null()
406  class(BaseExchangeType), pointer :: ep => null()
407  class(SpatialModelConnectionType), pointer :: mc => null()
408 
409  ! -- Allocate and read each model
410  do im = 1, basemodellist%Count()
411  mp => getbasemodelfromlist(basemodellist, im)
412  call mp%model_ar()
413  end do
414  !
415  ! -- Allocate and read each exchange
416  do ic = 1, baseexchangelist%Count()
417  ep => getbaseexchangefromlist(baseexchangelist, ic)
418  call ep%exg_ar()
419  end do
420  !
421  ! -- Synchronize
422  call run_ctrl%at_stage(stg_bfr_con_ar)
423  !
424  ! -- Allocate and read all model connections
425  do ic = 1, baseconnectionlist%Count()
426  mc => get_smc_from_list(baseconnectionlist, ic)
427  call mc%exg_ar()
428  end do
429  !
430  ! -- Synchronize
431  call run_ctrl%at_stage(stg_aft_con_ar)
432  !
433  ! -- Allocate and read each solution
434  do is = 1, basesolutionlist%Count()
435  sp => getbasesolutionfromlist(basesolutionlist, is)
436  call sp%sln_ar()
437  end do
438  !
Here is the call graph for this function:
Here is the caller graph for this function:

◆ simulation_df()

subroutine mf6coremodule::simulation_df

This subroutine defined the simulation. Steps include:

  • define each model
  • define each solution

Definition at line 326 of file mf6core.f90.

327  ! -- modules
328  use idmloadmodule, only: idm_df
329  ! -- local variables
330  integer(I4B) :: im
331  integer(I4B) :: ic
332  integer(I4B) :: is
333  class(BaseSolutionType), pointer :: sp => null()
334  class(BaseModelType), pointer :: mp => null()
335  class(BaseExchangeType), pointer :: ep => null()
336  class(SpatialModelConnectionType), pointer :: mc => null()
337 
338  ! -- init virtual data environment
339  call run_ctrl%at_stage(stg_bfr_mdl_df)
340 
341  ! -- Define each model
342  do im = 1, basemodellist%Count()
343  mp => getbasemodelfromlist(basemodellist, im)
344  call mp%model_df()
345  end do
346  !
347  ! -- synchronize
348  call run_ctrl%at_stage(stg_aft_mdl_df)
349  !
350  ! -- Define each exchange
351  do ic = 1, baseexchangelist%Count()
352  ep => getbaseexchangefromlist(baseexchangelist, ic)
353  call ep%exg_df()
354  end do
355  !
356  ! -- synchronize
357  call run_ctrl%at_stage(stg_aft_exg_df)
358  !
359  ! -- when needed, this is where the interface models are
360  ! created and added to the numerical solutions
361  call connections_cr()
362  !
363  ! -- synchronize
364  call run_ctrl%at_stage(stg_aft_con_cr)
365  !
366  ! -- synchronize
367  call run_ctrl%at_stage(stg_bfr_con_df)
368  !
369  ! -- Define each connection
370  do ic = 1, baseconnectionlist%Count()
371  mc => get_smc_from_list(baseconnectionlist, ic)
372  call mc%exg_df()
373  end do
374  !
375  ! -- synchronize
376  call run_ctrl%at_stage(stg_aft_con_df)
377  !
378  ! -- Define each solution
379  do is = 1, basesolutionlist%Count()
380  sp => getbasesolutionfromlist(basesolutionlist, is)
381  call sp%sln_df()
382  end do
383 
384  ! idm df
385  call idm_df()
386 
subroutine, public idm_df()
advance package dynamic data for period steps
Definition: IdmLoad.f90:38
Here is the call graph for this function:
Here is the caller graph for this function:

◆ static_input_load()

subroutine mf6coremodule::static_input_load

This subroutine creates the simulation input context

Definition at line 296 of file mf6core.f90.

297  ! -- modules
298  use constantsmodule, only: lenmempath
299  use simvariablesmodule, only: iout
300  use idmloadmodule, only: simnam_load, simtdis_load, &
304  use simvariablesmodule, only: iparamlog
305  !
306  ! -- load simnam input context
307  call simnam_load(iparamlog)
308  !
309  ! -- load tdis to input context
310  call simtdis_load()
311  !
312  ! -- load in scope models
313  call load_models(iout)
314  !
315  ! -- load in scope exchanges
316  call load_exchanges(iout)
integer(i4b), parameter lenmempath
maximum length of the memory path
Definition: Constants.f90:27
subroutine, public simnam_load(paramlog)
MODFLOW 6 mfsim.nam input load routine.
Definition: IdmLoad.f90:441
subroutine, public simtdis_load()
MODFLOW 6 tdis input load routine.
Definition: IdmLoad.f90:456
subroutine, public load_models(iout)
load model namfiles and model package files
Definition: IdmLoad.f90:217
subroutine, public load_exchanges(iout)
load exchange files
Definition: IdmLoad.f90:284
character(len=lenmempath) function create_mem_path(component, subcomponent, context)
returns the path to the memory object
integer(i4b) iparamlog
input (idm) parameter logging to simulation listing file
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ run_ctrl

class(runcontroltype), pointer mf6coremodule::run_ctrl => null()

Definition at line 24 of file mf6core.f90.

24  class(RunControlType), pointer :: run_ctrl => null() !< the run controller for this simulation