Namespace mf6xmi¶
This module contains the eXtended Model Interface.
Contents
Detailed Description¶
In this module we expose functionality in the MODFLOW 6 shared library, that is beyond the basic model interface: https://bmi-spec.readthedocs.io/en/latest/. The main extensions are
Controlling the kernel at a finer granularity, isolating the call to the linear solve of the system. This way, the interface can be used to set up a non-linear coupling with, for example, an external unsaturated zone model.
Expose the concept of subcomponents, which in case of MODFLOW 6 are ‘Numerical Solution’ objects, each of which represents a separate linear system to solve. An example here would be a transport model (GWT) coupled to a groundwater model (GWF).
The common BMI control flow is initialize()
whilet<t_end: update()
finalize()
With the XMI you can now also use it as: initialize()
while(t<t_end):
prepare_time_step()
#modifysomevalueshere
do_time_step()
#andmaybesomethinghereaswell
finalize_time_step()
finalize()
Or, when you want to isolate the call to the linear solve, a typical application could look like this: initialize()
whilet<t_end:
prepare_time_step()
fori_solinsolutions:
prepare_solve(i_sol)
whilek_iter<max_iter:
#exchangecoupledvariables exchange_data()
#theMODFLOWlinearsolve: solve()
#maybesolvesomeother,externalmodelhere: solveExternalModel()
#andexchangeback exchange_data()
#checkforconvergence convergence_check()
finalize_solve(i_sol)
finalize_time_step()
finalize()
Note that the last example can only work when there is a single Solution Group defined. This will typically not be a problem, though, as applications with multiple Solution Groups should be quite rare.