Race condition on updateExternal() method call in PatchProcessMetabolism #92
Labels
category: agent
Related to the agent subpackages
migration: v2 to v3
Aligning v2 and v3
package: patch
Related to the patch implementation
priority: high
Urgent problem that blocks the system until the issue is resolved
type: bug
Something isn't working as expected
Description
the updateExternal() function is a method in PatchProcessMetabolism that basically allows metabolism to grab the amts of environmental glucose and oxygen from the lattices at each time step. In 2.4, updateExternal() is called at initialization of the object in the constructor, whereas in 3.0, this method is called as part of the step() function in PatchProcessMetabolism, before stepProcess() is called.
I think this change is causing a race condition for cells that are added after time point 0. In my case, T cells are added in the simulation after 10 minutes, and they are using their own version of metabolism called MetabolismCART. As part of the constructor of MetabolismCART, the internal amounts of glucose is set to the external amount.
However, because updateExternal() is not called until the process is stepped, the extAmts array initializes as 0 and does not reflect the actual environmental glucose concentration. This will also set the internal amount of glucose to 0. There is no update for internal glucose between the initialization of the object, and the stepping of the process. As a result, because the glucose gradient is calculated based on the internal glucose amounts, this causes a huge glucose gradient and influx for the t cell at the beginning of the simulation.
Some questions and points for discussion:
The text was updated successfully, but these errors were encountered: