MathCancer / PhysiCell

PhysiCell: Scientist end users should use latest release! Developers please fork the development branch and submit PRs to the dev branch. Thanks!
http://PhysiCell.org
142 stars 95 forks source link

[BUG] Calcified fraction (possibly) not calculated correctly in `standard_volume_update_function` #133

Closed JulianoGianlupi closed 1 year ago

JulianoGianlupi commented 1 year ago

In PhysiCell_standard_models.cpp's standard_volume_update_function I believe the calcified fraction update is not correct. All dynamic volumes except it are updated following a forward Euler method, e.g.

phenotype.volume.fluid += dt * phenotype.volume.fluid_change_rate * ( phenotype.volume.target_fluid_fraction * phenotype.volume.total - phenotype.volume.fluid );

The calcified fraction update does not have the + in the +=. It reads

`phenotype.volume.calcified_fraction = dt * phenotype.volume.calcification_rate

This means the cell will never calcify completely, it's calcified fraction will fluctuate around dt * phenotype.volume.calcification_rate

JulianoGianlupi commented 1 year ago

Going by equation 37 in supplemental information 1 of PhysiCell's paper the intention was for the equation to read

phenotype.volume.calcified_fraction += dt * phenotype.volume.calcification_rate * (1- phenotype.volume.calcified_fraction);

JulianoGianlupi commented 1 year ago

Addressed in Pull Request #134

MathCancer commented 1 year ago

@JulianoGianlupi thank you so much!! This is a very good catch! (And we need to catch up, by the way!)

I'll make sure this gets folded into PhysiCell 1.11.0.

MathCancer commented 1 year ago

Actually, i want to take a closer look ...

This is the line (Line 548) that adds the extra calcification:


        * (1- phenotype.volume.calcified_fraction);```

You're right that it SHOULD be      

```phenotype.volume.calcified_fraction += dt * phenotype.volume.calcification_rate 
        * (1- phenotype.volume.calcified_fraction);```

From what I can see, the PR mistakenly changes a different line instead: 

from: ```phenotype.volume.fluid_fraction = phenotype.volume.fluid / ```

to: ```phenotype.volume.fluid_fraction += phenotype.volume.fluid / ```
MathCancer commented 1 year ago

Will now be fixed in 1.11.0, thanks to you!!