payu-org / payu

A workflow management tool for numerical models on the NCI computing systems
Apache License 2.0
19 stars 26 forks source link

Multiple top-level model instances #509

Open jo-basevi opened 6 days ago

jo-basevi commented 6 days ago

As pointed out by @blimlim, the Experiment in experiment.py stores two separate instances of the top-level model driver in Experiment.model and in the list Experiment.models. For model drivers such as access, setup and archive is not run for the access instance in Experiment.models list, only for the top-level instance Experiment.model.

There was already a TODO to rename models to submodels to make it more clear: https://github.com/payu-org/payu/blob/bdf0c66f143d64b2ecf06289d5cb93e994822f68/payu/experiment.py#L150-L151

Could still have self.models = [self.model] + self.submodels for when wanting to iterate over all model drivers, but have only one instance of the top-level model.

What might need to be checked is accessom2 driver archive method. For the Experiment.models instance which archives before other submodel model drivers run archive(), it copies directories from work directories restart path to the output restart path. Then when the top level Experiment.model instance run after other submodel archives, it copies a file from a mom work path to a cice5 restart path.

So maybe there just needs to be a top-level post_setup/post_archive method or similar, that runs after other submodel setup/archives methods have run? This might make it more clear what runs before submodel methods and what runs after submodel methods.

anton-seaice commented 6 days ago

I think payu needs a design document to explain this stuff 🥲

aidanheerdegen commented 6 days ago

A refactor of some of this would be good I think. Would need to spend time thinking about it to have any useful input.