Skip to contents

Get names of variables that contain the absolute flow between compartments. The absolute flow is the magnitude of a flow per time step.

Usage

mp_flow_vars(spec, topological_sort = FALSE, loops = "^$")

Arguments

spec

Model specification (mp_tmb_model_spec).

topological_sort

Should the flows be topologically sorted to respect the main direction of flow? The default is no topological sorting, which differs from mp_flow_frame.

loops

Pattern for matching the names of flows that make the flow model not a DAG, which is a critical assumption when topologically sorting the order of states and flows in the output. This is only relevant if topological_sort is used.

Value

Character vector of names of all flow variables that have been explicitly represented in the model using functions like mp_per_capita_flow.

Examples


si = mp_tmb_library("starter_models", "si", package = "macpan2")
(si
  |> mp_simulator(time_steps = 5L, mp_flow_vars(si))
  |> mp_trajectory()
)
#>      matrix time row col     value
#> 1 infection    1   0   0 0.1980000
#> 2 infection    2   0   0 0.2367296
#> 3 infection    3   0   0 0.2828290
#> 4 infection    4   0   0 0.3376117
#> 5 infection    5   0   0 0.4025866