Skip to content

Support / roadmap for parallel MODFLOW 6 via MODFLOW API (initialize_mpi)? #93

@ifariasg

Description

@ifariasg

Question
Is running a simulation through modflowapi (using callbacks + run_simulation + BMI/XMI loop) supported when using a parallel (MPI-enabled) build of MODFLOW 6? If not, is this on the roadmap, and is there a recommended pattern (e.g. optional initialize_mpi in the runner)?

I did some digging and found the following:

  1. MODFLOW 6 exposes an XMI entry point initialize_mpi (C name initialize_mpi) when built with __WITH_MPI__. It sets the Fortran MPI communicator and simulation_mode = 'PARALLEL', then calls the normal BMI initialize (bmi_initialize). See MODFLOW 6 mf6xmi.F90 – xmi_initialize_mpi / bind(C, name="initialize_mpi").

  2. xmipy XmiWrapper wraps that symbol as initialize_mpi(self, value: int) (passing the Fortran communicator handle, e.g. from mpi4py). See Deltares xmipy xmiwrapper.py – initialize_mpi.

  3. run_simulation currently always calls mf6.initialize() and never initialize_mpi. modflowapi extensions/runner.py (initialization right after ModflowApi(...) is constructed).

All in all, it all comes down to whether run_simulation is expected to support MPI, and if a small extension such as run_simulation(..., mpi_comm_fortran=None, number_mpi_ranks = int) that calls initialize_mpi would be enough.

I'm not sure if this is more of an API question or an extendend MF6 question but maybe @mjr-deltares could also shed some light?

Thanks in advance!

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions