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

protect pre_update_intracellular from changes made in post_update_intracellular #363

Open
wants to merge 1 commit into
base: development
Choose a base branch
from

Conversation

drbergman
Copy link
Collaborator

In models with both pre_update_intracellular and post_update_intracellular functions, it is currently possible for some cells to complete their post-update before other cells begin their pre-update. If the post-update modifies values in those cells that others use in the pre-update function (for example, surface-bound ligand expression), the pre-update function will use the incorrect values to update. This PR addresses this by performing the intracellular update as follows:

  1. Loop over all cells
    a. Determine which are ready for intracellular updates
    b. For these, do their pre_update_intracellular (if defined)
  2. If no updates found, return from update_all_cells_intracellular
  3. Loop over all cells ready for update and call their update function
  4. Loop over all cells ready for update and call their post_intracellular_update (if defined)

Commit comments

  • first do all pre updates, then all updates, then all post updates
  • this ensures that any changes manifested in updates/post-updates are not immediately visible to the pre-updates of other cells
  • with the more verbose logic controlling intracellular updates, make a separate function to handle it
    • in that function, encode directly dependence on diffusion_dt rather than the argument diffusion_dt_
    • initialzed used to determine when to call intracellular rather than passed in
    • if after first looping over all cells, none were found to require intracellular updates, then return early

@drbergman drbergman changed the title refactor how intracellular updates are handled protect pre_update_intracellular from post_update_intracellular changes Feb 18, 2025
@drbergman drbergman changed the title protect pre_update_intracellular from post_update_intracellular changes protect pre_update_intracellular from changes wrought in post_update_intracellular Feb 18, 2025
- first do all pre updates, then all updates, then all post updates
- this ensures that any changes manifested in updates/post-updates are not immediately
  visible to the pre-updates of other cells
- with the more verbose logic controlling intracellular updates, make a separate function to handle it
    - in that function, encode directly dependence on `diffusion_dt` rather than the argument `diffusion_dt_`
    - `initialzed` used to determine when to call `intracellular` rather than passed in
    - if after first looping over all cells, none were found to require intracellular updates, then return early
@drbergman drbergman force-pushed the protect-intracellular-updates branch from 9c276df to e7fdcaf Compare February 18, 2025 03:18
@drbergman drbergman changed the title protect pre_update_intracellular from changes wrought in post_update_intracellular protect pre_update_intracellular from changes made in post_update_intracellular Feb 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant