mbakker7 / ttim

MIT License
33 stars 23 forks source link

Providing an unsolved timmlmodel raises error #51

Closed Huite closed 9 months ago

Huite commented 11 months ago

Providing an unsolved timmlmodel to ttim result in an error when asking ttim to compute heads.

File c:\src\timml\timml\model.py:77, in Model.potential(self, x, y, aq)
     75 if aq is None: aq = self.aq.find_aquifer_data(x, y)
     76 pot = np.zeros(aq.naq)
---> 77 for e in aq.elementlist:
     78     pot += e.potential(x, y, aq)
     79 rv = np.sum(pot * aq.eigvec, 1)

AttributeError: 'Aquifer' object has no attribute 'elementlist'

Since the timml model hasn't been solved yet, the elementlist attribute hasn't been instantiated yet. I think it would be nicest here to add a check on whether the timml model has been solved yet, and if not, to solve it automatically.

mbakker7 commented 11 months ago

Interesting question. Problem is that there is no way to check whether the model has been solved since the last addition or change in element. That is really up to the user. That being said, it would probably make sense to simply solve the timml model once it is provided. Then if the timml model is changed (and solved) later on that is up to the user. Would that be an idea?

Huite commented 11 months ago

That's a good point: I hadn't thought of someone changing the timml model in the mean time.

Always solving indeed seems like a good idea, then.

dbrakenhoff commented 9 months ago

Closed by #53.