pmgbergen / porepy

Python Simulation Tool for Fractured and Deformable Porous Media

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unclear operator evaluation from iteration and time step index

vlipovac opened this issue · comments

According to the docs of Operator.evaluate, it will pull values from the previous iterate, alternatively from the previous time step.

But when I instantiate my variable like this
image

and evaluate an algebraic combination of variables using simply .evaluate(ad_system), I get the following error.
image

This error happens during a call to .get_variable_values (in line 710 of operators.py)
The iterate_index argument is None and the time_step_index is 1, as per call from evaluate

Assuming I did everything right, there seems to be either an inconsistency in the documentation or a missing implementation?
According to the docs the implementation should be able to find the values stored at iterate index 0.

If I instantiate a variable with values at both iterate and time, the error does not happen.

Your final statement is the key: You need to initialize the relevant arrays before they can be fetched. So this is not a bug, but arguably a tacit assumption in the EquationManager.

Your final statement is the key: You need to initialize the relevant arrays before they can be fetched. So this is not a bug, but arguably a tacit assumption in the EquationManager.

Or EquationSystem, rather. But yes, I think it's fair that you need to set the value for the previous time step before being able to get that value.

Alright.

Then maybe the documentation should be updated, because to my understanding it says that it is optional ("alternatively").

And does that mean that time-independent problems also need a first time-index set for their variables?
It seemed intuitive to me that the iterative index is prioritized (like the previous approach took ITERATE first, than STATE)

image

From the point of view of the set_variable_values method, the parameter is indeed optional.