Skip to content

cyclic foreign vars #177

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

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
some docs on avoiding cycles
  • Loading branch information
Joeperdefloep committed Mar 19, 2021
commit ae181e0cb81b2261eb9dfb65f110f6749eb39c33
10 changes: 10 additions & 0 deletions doc/create_model.rst
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,16 @@ In terms of computation and inputs, ``advect_model`` is equivalent to the
``advect_model_raw`` instance created above ; it is just organized
differently.

Avoiding cycles in the model
----------------------------
Often, a process involves updating a variable, that is used by other processes in the model.
This may result in a cycle being detected, and the model not able to run. The
process order is created based on variables with ``intent='out'``. Therefore, any variable
that is created with ``intent='inout'`` will be set last in the calculation order.
Any process that uses this variable as an input, will use the veriable from the previous timestep.
For example, the ``u`` variable in ``ProfileU`` has ``intent='inout'``, and is therefore last in the calculation order.


Update existing models
----------------------

Expand Down
4 changes: 3 additions & 1 deletion doc/framework.rst
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,9 @@ in their computation.
In a model, the processes and their dependencies together form the
nodes and the edges of a Directed Acyclic Graph (DAG). The graph
topology is fully determined by the ``intent`` set for each variable
or foreign variable declared in each process. An ordering that is
or foreign variable declared in each process. That is, a process depends on
another process if and only if the 'parent' process has an ``intent='out'``
variable, that is used by the 'child' process. An ordering that is
computationally consistent can then be obtained using topological
sorting. This is done at Model object creation. The same ordering is
used at every stage of a model run.
Expand Down