Skip to content

Better errors when things don't work because a model has not been solved/initialized #164

Description

@dbrakenhoff

I already added a model.initialized attribute that should track whether a model was initialized or not. That attribute can be used to check model status. Maybe we need something similar for the solve?

This issue is meant to improve error messages when certain things do not work because a model is not solved/initialized.

  • I ran into some plotting difficulties with cross section models that were not initialized. It would be good to check what plotting actions work without initialization, and especially for the overview plots it would be nice to allow direct plotting, without initialization first.
  • heads, velocities, disvecs etc. should all give an informative error when a model was not solved. I think we should be strict about this even for models that have no unknowns. Users that accidentally forget to solve should not be confronted with some error about ngbvc, but something informative to them :)
  • ...

Perhaps we can implement it as a decorator to save code:

@model_solved()
def head(self, x, y, t, layers=None):
    ...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    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