Skip to content

New model GSoC2026 - #24

Open
salva24 wants to merge 57 commits into
compiler-research:masterfrom
salva24:new_model
Open

salva24 wants to merge 57 commits into
compiler-research:masterfrom
salva24:new_model

Conversation

@salva24

@salva24 salva24 commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

This PR extends and calibrates CARTopiaX to reproduce the experimental results reported in Ando et al., Evaluating CAR-T Cell Therapy in a Hypoxic 3D Tumor Model (Advanced Healthcare Materials, 2019).

The implemented changes improve the biological realism of the simulation by reproducing the experimental setup and the observed CAR T-cell behavior under hypoxic conditions. This demonstrates CARTopiaX as a flexible and robust in silico hypothesis-testing framework capable of replicating published studies, accelerating CAR T-cell research, and reducing reliance on costly and time-consuming wet-lab experiments.

salva24 added 27 commits June 29, 2026 22:38
…oth the basal necrosis probability and the factor
… cup both with and without aging factor. fitting oxygen_saturation_for_proliferation
…ndaries z and generalization of CART cell spwan
… parameters. Add new parameters to initialize substances in restricted areas. New tumoral and cart cell volumes

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

There were too many comments to post at once. Showing the first 10 out of 22. Check the log or trigger a new build to see more.

Comment thread src/cart_tumor.cc Outdated
Comment thread src/diffusion/cylinder_wall_boundary_condition.cc
Comment thread src/diffusion/cylinder_wall_boundary_condition.h
Comment thread src/diffusion/cylinder_wall_boundary_condition.h Outdated
Comment thread src/diffusion/cylinder_wall_boundary_condition.h
Comment thread src/diffusion/cylinder_wall_boundary_condition.h
Comment thread src/params/hyperparams.cc Outdated
Comment thread src/params/hyperparams.cc Outdated
Comment thread src/params/hyperparams.cc Outdated
Comment thread src/utils/utils_aux.cc Outdated

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

There were too many comments to post at once. Showing the first 10 out of 18. Check the log or trigger a new build to see more.

Comment thread src/params/hyperparams.cc Outdated
Comment thread src/params/hyperparams.cc Outdated
Comment thread src/params/hyperparams.cc Outdated
Comment thread src/params/hyperparams.cc Outdated
Comment thread src/params/hyperparams.h
Comment thread src/utils/utils_aux.cc Outdated
Comment thread src/utils/utils_aux.cc Outdated
Comment thread src/utils/utils_aux.cc Outdated
Comment thread src/utils/utils_aux.cc Outdated
Comment thread src/utils/utils_aux.cc

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

Comment thread src/utils/utils_aux.cc Outdated
Comment thread src/utils/utils_aux.cc Outdated
Comment thread src/utils/utils_aux.cc Outdated
Comment thread src/utils/utils_aux.cc
Comment thread src/utils/utils_aux.h Outdated
Comment thread src/utils/utils_aux.h Outdated
Comment thread src/utils/utils_aux.h Outdated
Comment thread src/utils/utils_aux.h Outdated
@salva24
salva24 marked this pull request as ready for review September 30, 2026 10:22

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

Comment thread src/utils/utils_aux.cc
@salva24
salva24 marked this pull request as draft October 1, 2026 15:25

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

Comment thread src/utils/utils_aux.cc
@salva24
salva24 marked this pull request as ready for review October 3, 2026 18:52
Comment thread src/agents/cart_cell.h Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we ask claude to draw this with mermaid for github?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just tried a few attempts but honestly I do not like the results as much as the diagram I've done myself. Let's discuss it tomorrow
image

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it is ugly but I believe it can replay 1:1 yours…

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

Comment thread src/diffusion/diffusion_thomas_algorithm.h Outdated
Comment thread src/forces/forces_tumor_cart.h Outdated
@vgvassilev

Copy link
Copy Markdown
Contributor

Please find all other classes marked as "final" and consider dropping it.

"lateral_oxygen_production_max_z": 300.0,
"min_initial_z_substances": -300.0,
"max_initial_z_substances": 300.0,
"diffuse_oxygen_on_z_axis": false,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please remind me why both oxygen and glucose diffusion along the z-axis are disabled? Are we using only one layer of cells?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is a very shallow cylindrical medium, very close to a dish containing a single layer of cells. When the lid of the device is removed, oxygen can diffuse freely along the z-axis, whereas glucose cannot, thus preventing it from escaping the dish. The lid stops the z-flow for both substances

"max_volume_new_cart_cell": 336.25,
"oncoprotein_mean": 1.0,
"oncoprotein_standard_deviation": 0.0,
"initial_oxygen_level": 0.0,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we actually starting the model with an oxygen-depleted tumour?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes but it makes no difference because the oxygen flows very fast and just after a few steps the cells have access to a time-constant oxygen concentration that only depends on their position.

Comment thread src/agents/tumor_cell.cc
Comment on lines +359 to +364
if (radi_sq > max_r_sq) {
// Scale down the movement to stay within the allowed radius
const double scale_factor = std::sqrt(max_r_sq / radi_sq);
movement_at_next_step[0] *= scale_factor;
movement_at_next_step[1] *= scale_factor;
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This scales the displacement, not the final position, have we checked whether the cells remain within the permitted boundary?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I checked! Anyway I just fixed it to project the final position, thanks! :)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The diffusion equation that we implement includes a decay term ( $\mu$ ):

$$ \frac{ \partial c} { \partial t } = D \nabla^2 c- \mu c $$

This line divides the decay term into three directional solving steps, so when solving in x, y and z, each directional step accounts for one-third of the decay term.

You've introduced the option to skip the z-direction, which makes sense when simulating 2D systems, however, from what I see here, the decay coefficient is still divided by three, even when only two directional steps are executed. Is that the case? If so, could we adjust the decay-term splitting according to the number of active diffusion directions?

@Harishankar14 Harishankar14 Oct 15, 2026 •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess temporal_decay_coeff_(mu * dt / (diffuse_on_z_axis ? 3.0 : 2.0)) should do @lmluque , @salva24

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, you are both super correct. Thank you so much for spotting that bug and for the accurate solution :)

Comment thread src/agents/tumor_cell.cc
@@ -303,6 +335,57 @@ Real3 TumorCell::CalculateDisplacement(const InteractionForce* force,

older_velocity_ = translation_velocity_on_point_mass;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

older_velocity_ is updated before the boundary correction is applied to the displacement.

Could retaining the unconstrained velocity affect cell movement across subsequent timesteps when cells are repeatedly pushed against the boundary?

This is not high priority but worth keeping in mind.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, older_velocity_ stores the velocity before the boundary correction. While a cell is pushed against the wall, this has no effect: its position is corrected back to the boundary every step. The only effect is a very small extra push inward for one step an therefore moving the cell further away from the wall. Nevertheless we'll keep an eye on it in case of artifacts

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

spatial_diffusion_coeff_(dc * dt / (d_space_ * d_space_)),
neg_diffusion_factor_(-spatial_diffusion_coeff_),
temporal_decay_coeff_(mu * dt / 3.0),
temporal_decay_coeff_(mu * dt / (diffuse_on_z_axis ? 3.0 : 2.0)),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: 2.0 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers]

      temporal_decay_coeff_(mu * dt / (diffuse_on_z_axis ? 3.0 : 2.0)),
                                                                 ^

spatial_diffusion_coeff_(dc * dt / (d_space_ * d_space_)),
neg_diffusion_factor_(-spatial_diffusion_coeff_),
temporal_decay_coeff_(mu * dt / 3.0),
temporal_decay_coeff_(mu * dt / (diffuse_on_z_axis ? 3.0 : 2.0)),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: 3.0 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers]

      temporal_decay_coeff_(mu * dt / (diffuse_on_z_axis ? 3.0 : 2.0)),
                                                           ^

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.

4 participants