Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: Pass model to Iterative Model solver #2355

Open
mbakker7 opened this issue Nov 5, 2024 · 1 comment
Open

feature: Pass model to Iterative Model solver #2355

mbakker7 opened this issue Nov 5, 2024 · 1 comment
Milestone

Comments

@mbakker7
Copy link
Contributor

mbakker7 commented Nov 5, 2024

Problem description
In simulations with multiple models (e.g, a flow model and a transport model), separate iterative model solvers need to be created and then registered. This registration step is confusing, as it is not what has to be done with just one model (e.g., only a flow model). For more discussion see #2354

Describe the solution you'd like
Add a model keyword argument to ModflowIms to pass one model. Registration is done automatically. For example, the current code would be (sim is simulation instance and gwf is groundwater flow model instance)

# iterative model solver
gwf_ims  = fp.mf6.ModflowIms(simulation=sim, # add to simulation called sim
                             filename=gwf.name + '.ims', # file name to store ims
                             complexity='SIMPLE',
                            )                                                                                                
# register solver
sim.register_ims_package(solution_file=gwf_ims, # name of iterative model solver instance
                         model_list=[gwf.name], # list with name of groundwater flow model
                        )  

In the new implementation, this would be something like this (the filename and registration is taken care of by flopy in the ModflowIms code):

# iterative model solver
gwf_ims  = fp.mf6.ModflowIms(simulation=sim, # add to simulation called sim
                             model=gwf, # iterative solver for gwf model
                             complexity='SIMPLE',
                            )                                                                                                 

Alternatives
It may even be considered whether both the simulation and the groundwater flow model need to be passed. To stay in line with all the other classes, simply adding it to the gwf should be enough, so that the code becomes even simpler. This is actually my preferred solution:

# iterative model solver
gwf_ims  = fp.mf6.ModflowIms(model=gwf, # iterative solver for gwf model
                             complexity='SIMPLE',
                            )                                                                                                 

Backwards compatibility should not be a problem, as the model keyword would be new.

@wpbonelli wpbonelli added this to the 4.0 milestone Nov 5, 2024
@langevin-usgs
Copy link
Contributor

Thanks, @mbakker7. We will keep this in mind for ongoing work to refactor the mf6 support in flopy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants