Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a way to not use an input variable to build the dependency graph. #61

Closed
VEZY opened this issue Apr 4, 2024 · 2 comments · Fixed by #66
Closed

Add a way to not use an input variable to build the dependency graph. #61

VEZY opened this issue Apr 4, 2024 · 2 comments · Fixed by #66

Comments

@VEZY
Copy link
Member

VEZY commented Apr 4, 2024

We need a way to tell PlantSimEngine to not use an input variable to build the dependency graph.
This happens when e.g. we have a model that computes the light interception using the plant LAI at the beginning of step i, but the LAI is computed at the end of step i because it requires all kinds of computations first (e.g. leaf biomass increment). So because the interception model requires LAI as input, we naïvely put it as a child node of the LAI computation model, which makes a cyclic dependency graph (the last node is linked to the first node).

The solution is to be able to tell PSE to not use a particular variable for building the dependency tree, so the whole dependency graph does not become cyclic. We can do that by flagging the variable in the status using a structure, e.g.:

Status(LAI = PreviousTimeStep(1.0),)
@VEZY
Copy link
Member Author

VEZY commented Apr 4, 2024

We can't use the proposition above because the Status is given for all models of the same scale (or for the whole ModelList). What we want is to flag this variable for a particular model instead. So we have no choice but use another way that flags the variable with PreviousTimeStep for a model.

We could ask users to use the MultiScaleModel structure to flag the variable even though the variable is not multiscale per se, e.g.:

MultiScaleModel(
    model=ToyXModel(),
    mapping=[PreviousTimeStep(:soil_water_content)],
)

And it would work with real multiscale variables too:

MultiScaleModel(
    model=ToyXModel(),
    mapping=[PreviousTimeStep(:soil_water_content) => "Soil"],
)

@VEZY
Copy link
Member Author

VEZY commented Apr 5, 2024

Users can still provide a custom initialization value in the Status.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant