Skip to content

Callback function when there is more than one model in a simulation (eg. GWF+GWT) #88

@ifariasg

Description

@ifariasg

This is not really a bug but more a usage question.
I'm trying to run a "simple" MF6 simulation composed of a GWF + GWT model. I'm trying to get access to the concentration in the GWT model to then update a well concentration. Thing is, I cant seem to find the way to retrieve the GWT model.

In the initialize step I do the usual:

if callback_step == Callbacks.initialize:
 print(f"\nInitializing simulation...")
 print(f"Models: {sim.model_names}")

Which prints:

Initializing simulation...
Models: ['gwf', 'gwt']

But then I use the Callback stress_period_start to retrieve the transport model like

elif callback_step == Callbacks.stress_period_start:
    gwt_model = sim.get_model("gwt")

And I get an error:

KeyError: 'Model name gwt is invalid'

I realized that sim.model_names in the Callbacks.stress_period_start now only yields ['gwf'] as a possible option.
So at this stage I'm pretty convinced the api gets access to the models in the order they are run, so at stress_period_start only the flow model is meant to be modified (?), but this begs the question, how, or with what callback function can I access the stress_period_start state of the transport model?
There is no examples that I could find that uses the API with more than one model in a simulation so I'm pretty lost.

I tried both with modflowapi 0.3.0.dev0 and the official 0.2 release.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions