CADET-Core
CADET-Core copied to clipboard
Reduce calls to solve() function in ModelSystemImpl.cpp
When solving a single column, the column’s solve() function is called at least twice. This is unnecessary for simple setups that don’t recycle. We could detect that, break the DAG (which otherwise is only a directed graph) up into parallel chunks and solve them from inlets to outlets.
A preliminary version is implemented in 28c6f5c78a306566ceea882c53b27784cab26c40.
The behavior is controlled by /input/model/solver/LINEAR_SOLUTION_MODE
.
A value of 1
requests parallel solution of the unit operation models in the ModelSystem. If 2
is specified, sequential solution mode is used if the network is acyclic.
By default (/input/model/solver/LINEAR_SOLUTION_MODE = 0
), sequential mode is used if the system has less than 6 unit operations and no cycles. Otherwise, parallel mode is chosen.
The solution mode is applied per switch_XYZ
. That is, if sequential mode is selected by the user (/input/model/solver/LINEAR_SOLUTION_MODE = 0
) but some switch_XYZ
configurations contain cycles, these configurations are solved in parallel.
The acyclic graph is not divided into parallelizable chunks that are solved in parallel. This still needs to be done.