MODFLOW 6 version 6.9.0.dev0
USGS Modular Hydrologic Model
Loading...
Searching...
No Matches
mf6core.f90
Go to the documentation of this file.
1!> @brief Core MODFLOW 6 module
2!!
3!! This module contains the core components for MODFLOW 6. This module
4!! is used by the stand-alone executable and the share object versions
5!! of MODFLOW 6.
6!!
7!<
9 use kindmodule, only: i4b, lgp
22 implicit none
23
24 class(runcontroltype), pointer :: run_ctrl => null() !< the run controller for this simulation
25
26contains
27
28 !> @brief Main controller
29 !!
30 !! This subroutine is the main controller for MODFLOW 6.
31 !!
32 !<
33 subroutine mf6run
34 ! -- modules
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
60 end subroutine mf6run
61
62 !> @brief Initialize a simulation
63 !!
64 !! This subroutine initializes a MODFLOW 6 simulation. The subroutine:
65 !! - creates the simulation
66 !! - defines
67 !! - allocates and reads static data
68 !!
69 !<
70 subroutine mf6initialize()
71 ! -- modules
75
76 call g_prof%pre_init()
77
78 ! -- get the run controller for sequential or parallel builds
80 call run_ctrl%start()
81
82 ! -- print info and start timer
83 call print_info()
84
85 ! -- create mfsim.lst
86 call create_lstfile()
87
88 ! -- load input context
90
91 ! init timer and start
92 call g_prof%initialize()
93 call g_prof%start("Initialize", g_prof%tmr_init)
94
95 ! -- create
96 call simulation_cr()
97
98 ! -- define
99 call simulation_df()
100
101 ! -- allocate and read
102 call simulation_ar()
103
104 ! -- create model exports
105 call export_cr()
106
107 ! -- stop the timer
108 call g_prof%stop(g_prof%tmr_init)
109
110 end subroutine mf6initialize
111
112 !> @brief Run a time step
113 !!
114 !! This function runs a single time step to completion.
115 !!
116 !! @return hasConverged boolean indicating if convergence was achieved for the time step
117 !!
118 !<
119 function mf6update() result(hasConverged)
120 logical(LGP) :: hasconverged
121 ! start timer
122 call g_prof%start("Update", g_prof%tmr_update)
123 !
124 ! -- prepare timestep
125 call mf6preparetimestep()
126 !
127 ! -- do timestep
128 call mf6dotimestep()
129 !
130 ! -- after timestep
131 hasconverged = mf6finalizetimestep()
132
133 ! stop timer
134 call g_prof%stop(g_prof%tmr_update)
135
136 end function mf6update
137
138 !> @brief Finalize the simulation
139 !!
140 !! This subroutine finalizes a simulation. Steps include:
141 !! - final processing
142 !! - deallocate memory
143 !!
144 !<
145 subroutine mf6finalize()
146 ! -- modules
147 use, intrinsic :: iso_fortran_env, only: output_unit
148 use listsmodule, only: lists_da
150 use tdismodule, only: tdis_da
151 use idmloadmodule, only: idm_da
152 use sourceloadmodule, only: export_da
153 use simvariablesmodule, only: iout
154 ! -- local variables
155 integer(I4B) :: im
156 integer(I4B) :: ic
157 integer(I4B) :: is
158 integer(I4B) :: isg
159 class(solutiongrouptype), pointer :: sgp => null()
160 class(basesolutiontype), pointer :: sp => null()
161 class(basemodeltype), pointer :: mp => null()
162 class(baseexchangetype), pointer :: ep => null()
163 class(spatialmodelconnectiontype), pointer :: mc => null()
164 integer(I4B) :: tmr_dealloc
165
166 ! start timer
167 call g_prof%start("Finalize", g_prof%tmr_finalize)
168
169 !
170 ! -- FINAL PROCESSING (FP)
171 ! -- Final processing for each model
172 do im = 1, basemodellist%Count()
174 call mp%model_fp()
175 end do
176 !
177 ! -- Final processing for each exchange
178 do ic = 1, baseexchangelist%Count()
180 call ep%exg_fp()
181 end do
182 !
183 ! -- Final processing for each solution
184 do is = 1, basesolutionlist%Count()
186 call sp%sln_fp()
187 end do
188
189 ! start timer for deallocation
190 tmr_dealloc = -1
191 call g_prof%start("Deallocate", tmr_dealloc)
192
193 !
194 ! -- DEALLOCATE (DA)
195 ! -- Deallocate tdis
196 call tdis_da()
197 !
198 ! -- Deallocate for each model
199 do im = 1, basemodellist%Count()
201 call mp%model_da()
202 deallocate (mp)
203 end do
204 !
205 ! -- Deallocate for each exchange
206 do ic = 1, baseexchangelist%Count()
208 call ep%exg_da()
209 deallocate (ep)
210 end do
211 !
212 ! -- Deallocate for each connection
213 do ic = 1, baseconnectionlist%Count()
215 call mc%exg_da()
216 deallocate (mc)
217 end do
218 !
219 ! -- Deallocate for each solution
220 do is = 1, basesolutionlist%Count()
222 call sp%sln_da()
223 deallocate (sp)
224 end do
225 !
226 ! -- Deallocate solution group and simulation variables
227 do isg = 1, solutiongrouplist%Count()
229 call sgp%sgp_da()
230 deallocate (sgp)
231 end do
232 !
233 call idm_da(iout)
234 call export_da()
235 call simulation_da()
236 call lists_da()
237
238 ! stop timer
239 call g_prof%stop(tmr_dealloc)
240
241 ! finish gently (No calls after this)
242 ! timer is stopped inside because this call does not return
243 call run_ctrl%finish()
244
245 end subroutine mf6finalize
246
247 !> @brief print initial message
248 !<
249 subroutine print_info()
250 use simmodule, only: initial_message
252
253 ! print initial message
254 call initial_message()
255
256 ! get start time
257 call print_start_time()
258
259 end subroutine print_info
260
261 !> @brief Set up mfsim list file output logging
262 !!
263 !! This subroutine creates the mfsim list file
264 !! and writes the header.
265 !!
266 !<
267 subroutine create_lstfile()
268 use constantsmodule, only: linelength
273 character(len=LINELENGTH) :: line
274 !
275 ! -- Open simulation list file
276 iout = getunit()
277 !
278 if (nr_procs > 1) then
280 end if
281 !
282 call openfile(iout, 0, simlstfile, 'LIST', filstat_opt='REPLACE')
283 !
284 ! -- write simlstfile to stdout
285 write (line, '(2(1x,A))') 'Writing simulation list file:', &
286 trim(adjustl(simlstfile))
287 !
288 call write_message(line)
290 end subroutine create_lstfile
291
292 !> @brief Create simulation input context
293 !!
294 !! This subroutine creates the simulation input context
295 !!
296 !<
297 subroutine static_input_load()
298 ! -- modules
299 use constantsmodule, only: lenmempath
300 use simvariablesmodule, only: iout
306 !
307 ! -- load simnam input context
309 !
310 ! -- load tdis to input context
311 call simtdis_load()
312 !
313 ! -- load in scope models
314 call load_models(iout)
315 !
316 ! -- load in scope exchanges
317 call load_exchanges(iout)
318 end subroutine static_input_load
319
320 !> @brief Define the simulation
321 !!
322 !! This subroutine defined the simulation. Steps include:
323 !! - define each model
324 !! - define each solution
325 !!
326 !<
327 subroutine simulation_df()
328 ! -- modules
329 use idmloadmodule, only: idm_df
330 ! -- local variables
331 integer(I4B) :: im
332 integer(I4B) :: ic
333 integer(I4B) :: is
334 class(basesolutiontype), pointer :: sp => null()
335 class(basemodeltype), pointer :: mp => null()
336 class(baseexchangetype), pointer :: ep => null()
337 class(spatialmodelconnectiontype), pointer :: mc => null()
338
339 ! -- define input
340 call idm_df()
341
342 ! -- init virtual data environment
343 call run_ctrl%at_stage(stg_bfr_mdl_df)
344
345 ! -- Define each model
346 do im = 1, basemodellist%Count()
347 mp => getbasemodelfromlist(basemodellist, im)
348 call mp%model_df()
349 end do
350 !
351 ! -- synchronize
352 call run_ctrl%at_stage(stg_aft_mdl_df)
353 !
354 ! -- Define each exchange
355 do ic = 1, baseexchangelist%Count()
356 ep => getbaseexchangefromlist(baseexchangelist, ic)
357 call ep%exg_df()
358 end do
359 !
360 ! -- synchronize
361 call run_ctrl%at_stage(stg_aft_exg_df)
362 !
363 ! -- when needed, this is where the interface models are
364 ! created and added to the numerical solutions
365 call connections_cr()
366 !
367 ! -- synchronize
368 call run_ctrl%at_stage(stg_aft_con_cr)
369 !
370 ! -- synchronize
371 call run_ctrl%at_stage(stg_bfr_con_df)
372 !
373 ! -- Define each connection
374 do ic = 1, baseconnectionlist%Count()
375 mc => get_smc_from_list(baseconnectionlist, ic)
376 call mc%exg_df()
377 end do
378 !
379 ! -- synchronize
380 call run_ctrl%at_stage(stg_aft_con_df)
381 !
382 ! -- Define each solution
383 do is = 1, basesolutionlist%Count()
384 sp => getbasesolutionfromlist(basesolutionlist, is)
385 call sp%sln_df()
386 end do
387
388 end subroutine simulation_df
389
390 !> @brief Simulation allocate and read
391 !!
392 !! This subroutine allocates and reads static data for the simulation.
393 !! Steps include:
394 !! - allocate and read for each model
395 !! - allocate and read for each exchange
396 !! - allocate and read for each solution
397 !!
398 !<
399 subroutine simulation_ar()
401 ! -- local variables
402 integer(I4B) :: im
403 integer(I4B) :: ic
404 integer(I4B) :: is
405 class(basesolutiontype), pointer :: sp => null()
406 class(basemodeltype), pointer :: mp => null()
407 class(baseexchangetype), pointer :: ep => null()
408 class(spatialmodelconnectiontype), pointer :: mc => null()
409
410 ! -- Allocate and read each model
411 do im = 1, basemodellist%Count()
412 mp => getbasemodelfromlist(basemodellist, im)
413 call mp%model_ar()
414 end do
415 !
416 ! -- Allocate and read each exchange
417 do ic = 1, baseexchangelist%Count()
418 ep => getbaseexchangefromlist(baseexchangelist, ic)
419 call ep%exg_ar()
420 end do
421 !
422 ! -- Synchronize
423 call run_ctrl%at_stage(stg_bfr_con_ar)
424 !
425 ! -- Allocate and read all model connections
426 do ic = 1, baseconnectionlist%Count()
427 mc => get_smc_from_list(baseconnectionlist, ic)
428 call mc%exg_ar()
429 end do
430 !
431 ! -- Synchronize
432 call run_ctrl%at_stage(stg_aft_con_ar)
433 !
434 ! -- Allocate and read each solution
435 do is = 1, basesolutionlist%Count()
436 sp => getbasesolutionfromlist(basesolutionlist, is)
437 call sp%sln_ar()
438 end do
439 !
440 end subroutine simulation_ar
441
442 !> @brief Create the model connections from the exchanges
443 !!
444 !! This will upgrade the numerical exchanges in the solution,
445 !! whenever the configuration requires this, to Connection
446 !! objects. Currently we anticipate:
447 !!
448 !! GWF-GWF => GwfGwfConnection
449 !! GWT-GWT => GwtGwtConecction
450 !<
451 subroutine connections_cr()
453 use simvariablesmodule, only: iout
454 use versionmodule, only: idevelopmode
455 integer(I4B) :: isol
456 type(connectionbuildertype) :: connectionBuilder
457 class(basesolutiontype), pointer :: sol => null()
458 integer(I4B) :: status
459 character(len=16) :: envvar
460
461 write (iout, '(/a)') 'PROCESSING MODEL CONNECTIONS'
462
463 if (baseexchangelist%Count() == 0) then
464 ! if this is not a coupled simulation in any way,
465 ! then we will not need model connections
466 return
467 end if
468
469 if (idevelopmode == 1) then
470 call get_environment_variable('DEV_ALWAYS_USE_IFMOD', &
471 value=envvar, status=status)
472 if (status == 0 .and. envvar == '1') then
473 connectionbuilder%dev_always_ifmod = .true.
474 write (iout, '(/a)') "Development option: forcing interface model"
475 end if
476 end if
477
478 do isol = 1, basesolutionlist%Count()
479 sol => getbasesolutionfromlist(basesolutionlist, isol)
480 call connectionbuilder%processSolution(sol)
481 end do
482
483 write (iout, '(a)') 'END OF MODEL CONNECTIONS'
484 end subroutine connections_cr
485
486 !> @brief Read and prepare time step
487 !!
488 !! This subroutine reads and prepares period data for the simulation.
489 !! Steps include:
490 !! - read and prepare for each model
491 !! - read and prepare for each exchange
492 !! - reset convergence flag
493 !! - calculate maximum time step for each model
494 !! - calculate maximum time step for each exchange
495 !! - calculate maximum time step for each solution
496 !! - set time discretization timestep using smallest maximum timestep
497 !!
498 !<
500 ! -- modules
501 use kindmodule, only: i4b
504 kstp, kper
509 use simmodule, only: converge_reset
513 ! -- local variables
514 class(basemodeltype), pointer :: mp => null()
515 class(baseexchangetype), pointer :: ep => null()
516 class(spatialmodelconnectiontype), pointer :: mc => null()
517 class(basesolutiontype), pointer :: sp => null()
518 character(len=LINELENGTH) :: line
519 character(len=LINELENGTH) :: fmt
520 integer(I4B) :: im
521 integer(I4B) :: ie
522 integer(I4B) :: ic
523 integer(I4B) :: is
524
525 ! start timer
526 call g_prof%start("Prepare time step", g_prof%tmr_prep_tstp)
527
528 !
529 ! -- initialize fmt
530 fmt = "(/,a,/)"
531 !
532 ! -- period update
533 call tdis_set_counters()
534 !
535 ! -- set base line
536 write (line, '(a,i0,a,i0,a)') &
537 'start timestep kper="', kper, '" kstp="', kstp, '" mode="'
538 !
539 ! -- evaluate simulation mode
540 select case (isim_mode)
541 case (mvalidate)
542 line = trim(line)//'validate"'
543 case (mnormal)
544 line = trim(line)//'normal"'
545 end select
546
547 ! -- load dynamic input
548 call idm_rp()
549
550 ! -- Read and prepare each model
551 do im = 1, basemodellist%Count()
553 call mp%model_message(line, fmt=fmt)
554 call mp%model_rp()
555 end do
556 !
557 ! -- Synchronize
558 call run_ctrl%at_stage(stg_bfr_exg_rp)
559 !
560 ! -- Read and prepare each exchange
561 do ie = 1, baseexchangelist%Count()
563 call ep%exg_rp()
564 end do
565 !
566 ! -- Read and prepare each connection
567 do ic = 1, baseconnectionlist%Count()
569 call mc%exg_rp()
570 end do
571 !
572 ! -- Synchronize
573 call run_ctrl%at_stage(stg_aft_con_rp)
574 !
575 ! -- reset simulation convergence flag
576 call converge_reset()
577 !
578 ! -- time update for each model
579 do im = 1, basemodellist%Count()
581 call mp%model_dt()
582 end do
583 !
584 ! -- time update for each exchange
585 do ie = 1, baseexchangelist%Count()
587 call ep%exg_dt()
588 end do
589 !
590 ! -- time update for each connection
591 do ic = 1, baseconnectionlist%Count()
593 call mc%exg_dt()
594 end do
595 !
596 ! -- time update for each solution
597 do is = 1, basesolutionlist%Count()
599 call sp%sln_dt()
600 end do
601 !
602 ! -- update exports
604 !
605 ! -- set time step
606 call tdis_set_timestep()
607
608 ! timeseries advance
609 call idm_ts_advance()
610
611 ! stop timer
612 call g_prof%stop(g_prof%tmr_prep_tstp)
613
614 end subroutine mf6preparetimestep
615
616 !> @brief Run time step
617 !!
618 !! This subroutine runs a single time step for the simulation.
619 !! Steps include:
620 !! - formulate the system of equations for each model and exchange
621 !! - solve each solution
622 !!
623 !<
624 subroutine mf6dotimestep()
625 ! -- modules
626 use kindmodule, only: i4b
631 ! -- local variables
632 class(solutiongrouptype), pointer :: sgp => null()
633 integer(I4B) :: isg
634 logical :: finishedTrying
635
636 ! start timer
637 call g_prof%start("Do time step", g_prof%tmr_do_tstp)
638
639 ! -- By default, the solution groups will be solved once, and
640 ! may fail. But if adaptive stepping is active, then
641 ! the solution groups may be solved over and over with
642 ! progressively smaller time steps to see if convergence
643 ! can be obtained.
645 retryloop: do
646
647 if (ifailedstepretry > 0) then
648 ! timeseries advance
649 call idm_ts_advance()
650 end if
651
652 do isg = 1, solutiongrouplist%Count()
654 call sgp%sgp_ca()
655 end do
656
657 call sim_step_retry(finishedtrying)
658 if (finishedtrying) exit retryloop
660
661 end do retryloop
662
663 ! stop timer
664 call g_prof%stop(g_prof%tmr_do_tstp)
665
666 end subroutine mf6dotimestep
667
668 !> @brief Rerun time step
669 !!
670 !! This subroutine reruns a single time step for the simulation when
671 !! the adaptive time step option is used.
672 !!
673 !<
674 subroutine sim_step_retry(finishedTrying)
675 ! -- modules
676 use kindmodule, only: dp
678 use simmodule, only: converge_reset
680 ! -- dummy variables
681 logical, intent(out) :: finishedTrying !< boolean that indicates if no
682 ! additional reruns of the time step are required
683 !
684 ! -- Check with ats to reset delt and keep trying
685 finishedtrying = .true.
686 call ats%ats_reset_delt(kstp, kper, laststepfailed, delt, finishedtrying)
687 !
688 if (.not. finishedtrying) then
689 !
690 ! -- Reset delt, which requires updating pertim, totim
691 ! and end of period and simulation indicators
693 !
694 ! -- Reset state of the simulation convergence flag
695 call converge_reset()
696
697 end if
698 end subroutine sim_step_retry
699
700 !> @brief Finalize time step
701 !!
702 !! This function finalizes a single time step for the simulation
703 !! and writes output for the time step. Steps include:
704 !! - write output for each model
705 !! - write output for each exchange
706 !! - write output for each solutions
707 !! - perform a final convergence check and whether the simulation
708 !! can continue if convergence was not achieved
709 !!
710 !! @return hasConverged boolean indicating if convergence was achieved for the time step
711 !!
712 !<
713 function mf6finalizetimestep() result(hasConverged)
714 ! -- modules
715 use kindmodule, only: i4b
721 use simmodule, only: converge_check
724 ! -- return variable
725 logical(LGP) :: hasconverged
726 ! -- local variables
727 class(basesolutiontype), pointer :: sp => null()
728 class(basemodeltype), pointer :: mp => null()
729 class(baseexchangetype), pointer :: ep => null()
730 class(spatialmodelconnectiontype), pointer :: mc => null()
731 character(len=LINELENGTH) :: line
732 character(len=LINELENGTH) :: fmt
733 integer(I4B) :: im
734 integer(I4B) :: ix
735 integer(I4B) :: ic
736 integer(I4B) :: is
737 !
738 ! -- initialize format and line
739 fmt = "(/,a,/)"
740 line = 'end timestep'
741
742 ! start timer
743 call g_prof%start("Finalize time step", g_prof%tmr_final_tstp)
744
745 !
746 ! -- evaluate simulation mode
747 select case (isim_mode)
748 case (mvalidate)
749 !
750 ! -- Write final message for timestep for each model
751 do im = 1, basemodellist%Count()
753 call mp%model_message(line, fmt=fmt)
754 end do
755 case (mnormal)
756
757 call g_prof%start("Write output", g_prof%tmr_output)
758 !
759 ! -- Write output and final message for timestep for each model
760 do im = 1, basemodellist%Count()
762 call mp%model_ot()
763 call mp%model_message(line, fmt=fmt)
764 end do
765 !
766 ! -- Write output for each exchange
767 do ix = 1, baseexchangelist%Count()
769 call ep%exg_ot()
770 end do
771 !
772 ! -- Write output for each connection
773 do ic = 1, baseconnectionlist%Count()
775 call mc%exg_ot()
776 end do
777 !
778 ! -- Write output for each solution
779 do is = 1, basesolutionlist%Count()
781 call sp%sln_ot()
782 end do
783 !
784 ! -- update exports
785 call g_prof%start("NetCDF export", g_prof%tmr_nc_export)
786 call export_post_step()
787 call g_prof%stop(g_prof%tmr_nc_export)
788
789 call g_prof%stop(g_prof%tmr_output)
790 end select
791 !
792 ! -- Check if we're done
793 call converge_check(hasconverged)
794
795 ! stop timer
796 call g_prof%stop(g_prof%tmr_final_tstp)
797
798 end function mf6finalizetimestep
799
800end module mf6coremodule
class(baseexchangetype) function, pointer, public getbaseexchangefromlist(list, idx)
Retrieve a specific BaseExchangeType object from a list.
class(basemodeltype) function, pointer, public getbasemodelfromlist(list, idx)
class(basesolutiontype) function, pointer, public getbasesolutionfromlist(list, idx)
subroutine, public getcommandlinearguments()
Get command line arguments.
Definition comarg.f90:29
This module contains simulation constants.
Definition Constants.f90:9
integer(i4b), parameter linelength
maximum length of a standard line
Definition Constants.f90:45
@ mvalidate
validation mode - do not run time steps
@ mnormal
normal output mode
integer(i4b), parameter lenmempath
maximum length of the memory path
Definition Constants.f90:27
This module contains the IdmLoadModule.
Definition IdmLoad.f90:7
subroutine, public simnam_load(paramlog)
MODFLOW 6 mfsim.nam input load routine.
Definition IdmLoad.f90:442
subroutine, public idm_da(iout)
idm deallocate routine
Definition IdmLoad.f90:74
subroutine, public idm_df()
advance package dynamic data for period steps
Definition IdmLoad.f90:38
subroutine, public simtdis_load()
MODFLOW 6 tdis input load routine.
Definition IdmLoad.f90:457
subroutine, public idm_rp()
load package dynamic data for period
Definition IdmLoad.f90:50
subroutine, public idm_ts_advance()
advance package dynamic data for period steps
Definition IdmLoad.f90:62
subroutine, public load_models(iout)
load model namfiles and model package files
Definition IdmLoad.f90:218
subroutine, public load_exchanges(iout)
load exchange files
Definition IdmLoad.f90:285
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.
This module defines variable data types.
Definition kind.f90:8
type(listtype), public basemodellist
Definition mf6lists.f90:16
type(listtype), public baseexchangelist
Definition mf6lists.f90:25
type(listtype), public solutiongrouplist
Definition mf6lists.f90:22
type(listtype), public baseconnectionlist
Definition mf6lists.f90:28
type(listtype), public basesolutionlist
Definition mf6lists.f90:19
subroutine, public lists_da()
Definition mf6lists.f90:34
character(len=lenmempath) function create_mem_path(component, subcomponent, context)
returns the path to the memory object
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:212
Core MODFLOW 6 module.
Definition mf6core.f90:8
subroutine mf6dotimestep()
Run time step.
Definition mf6core.f90:625
subroutine mf6run
Main controller.
Definition mf6core.f90:34
subroutine static_input_load()
Create simulation input context.
Definition mf6core.f90:298
subroutine mf6preparetimestep()
Read and prepare time step.
Definition mf6core.f90:500
subroutine simulation_df()
Define the simulation.
Definition mf6core.f90:328
subroutine simulation_ar()
Simulation allocate and read.
Definition mf6core.f90:400
class(runcontroltype), pointer run_ctrl
the run controller for this simulation
Definition mf6core.f90:24
logical(lgp) function mf6update()
Run a time step.
Definition mf6core.f90:120
subroutine sim_step_retry(finishedtrying)
Rerun time step.
Definition mf6core.f90:675
subroutine mf6initialize()
Initialize a simulation.
Definition mf6core.f90:71
logical(lgp) function mf6finalizetimestep()
Finalize time step.
Definition mf6core.f90:714
subroutine create_lstfile()
Set up mfsim list file output logging.
Definition mf6core.f90:268
subroutine connections_cr()
Create the model connections from the exchanges.
Definition mf6core.f90:452
subroutine mf6finalize()
Finalize the simulation.
Definition mf6core.f90:146
subroutine print_info()
print initial message
Definition mf6core.f90:250
type(profilertype), public g_prof
the global timer object (to reduce trivial lines of code)
Definition Profiler.f90:70
class(runcontroltype) function, pointer, public create_run_control()
This module contains simulation methods.
Definition Sim.f90:10
subroutine, public converge_check(hasconverged)
Simulation convergence check.
Definition Sim.f90:407
subroutine, public converge_reset()
Reset the simulation convergence flag.
Definition Sim.f90:394
subroutine, public initial_message()
Print the header and initializes messaging.
Definition Sim.f90:447
integer(i4b), parameter, public stg_aft_con_ar
afterr connection allocate read
Definition SimStages.f90:18
integer(i4b), parameter, public stg_aft_con_df
after connection define
Definition SimStages.f90:15
integer(i4b), parameter, public stg_aft_mdl_df
after model define
Definition SimStages.f90:11
integer(i4b), parameter, public stg_bfr_mdl_df
before model define
Definition SimStages.f90:10
integer(i4b), parameter, public stg_aft_exg_df
after exchange define
Definition SimStages.f90:12
integer(i4b), parameter, public stg_aft_con_cr
after connection create
Definition SimStages.f90:13
integer(i4b), parameter, public stg_bfr_exg_rp
before exchange read prepare
Definition SimStages.f90:19
integer(i4b), parameter, public stg_bfr_con_ar
before connection allocate read
Definition SimStages.f90:17
integer(i4b), parameter, public stg_aft_con_rp
after connection read prepare
Definition SimStages.f90:20
integer(i4b), parameter, public stg_bfr_con_df
before connection define
Definition SimStages.f90:14
subroutine, public simulation_da()
Deallocate simulation variables.
subroutine, public simulation_cr()
Read the simulation name file and initialize the models, exchanges.
This module contains simulation variables.
integer(i4b) ifailedstepretry
current retry for this time step
integer(i4b) nr_procs
integer(i4b) laststepfailed
flag indicating if the last step failed (1) if last step failed; (0) otherwise (set in converge_check...
integer(i4b) iout
file unit number for simulation output
integer(i4b) iparamlog
input (idm) parameter logging to simulation listing file
character(len=linelength) simlstfile
simulation listing file name
integer(i4b) proc_id
integer(i4b) isim_mode
simulation mode
class(solutiongrouptype) function, pointer, public getsolutiongroupfromlist(list, idx)
This module contains the SourceLoadModule.
Definition SourceLoad.F90:8
subroutine, public export_da()
deallocate model export objects and list
subroutine, public export_cr()
create model exports list
subroutine, public export_post_prepare()
model exports post prepare step actions
subroutine, public export_post_step()
model exports post step actions
class(spatialmodelconnectiontype) function, pointer, public get_smc_from_list(list, idx)
Get the connection from a list.
logical(lgp), pointer, public endofsimulation
flag indicating end of simulation
Definition tdis.f90:31
class(atstype), pointer, public ats
Definition tdis.f90:48
subroutine, public tdis_set_timestep()
Set time step length.
Definition tdis.f90:156
subroutine, public tdis_set_counters()
Set kstp and kper.
Definition tdis.f90:96
integer(i4b), pointer, public kstp
current time step number
Definition tdis.f90:27
subroutine, public tdis_da()
Deallocate memory.
Definition tdis.f90:345
subroutine, public tdis_delt_reset(deltnew)
Reset delt and update timing variables and indicators.
Definition tdis.f90:201
integer(i4b), pointer, public kper
current stress period number
Definition tdis.f90:26
real(dp), pointer, public delt
length of the current time step
Definition tdis.f90:32
subroutine, public print_start_time()
Start simulation timer.
Definition Timer.f90:19
This module contains version information.
Definition version.f90:7
subroutine write_listfile_header(iout, cmodel_type, write_sys_command, write_kind_info)
Write program header.
Definition version.f90:103
integer(i4b), parameter idevelopmode
Definition version.f90:19
Highest level model type. All models extend this parent type.
Definition BaseModel.f90:16
Class to manage spatial connection of a model to one or more models of the same type....