segrelab / cometspy

Python interface for running COMETS simulations and analyzing the results
GNU General Public License v3.0
11 stars 9 forks source link

NaN returned in total biomass log due to default biomass parameters #53

Open zoey-rw opened 4 months ago

zoey-rw commented 4 months ago
Screenshot 2024-05-25 at 10 37 23 PM

Total biomass log contains values of "NaN" for every model, partway through a simulation, and results/errors didn't return to sim.run_output. Happened after changing the biomassMotionStyle to "Convection 2D" (without changing default convection parameters).

zoey-rw commented 4 months ago

This is due to the default convective-diffusion parameters causing huge amounts of biomass. For setting convective-diffusion, there are the four sets of "example" parameters throughout the code/documentation, but I can't figure out how these 4 parameters map to the biomass propagation equations described in the Protocols paper supplement. I also wasn't sure about units - e.g. do the values need to be modified if I change my "spaceWidth" parameter?

Default function parameters

mod.add_convection_parameters(1., 0.5, 2., 10.e-5)

Round colony: https://segrelab.github.io/comets-manual/circular_colony/

mod.add_convection_parameters(packedDensity = 0.5,elasticModulus = 1.e-4,frictionConstant = 1.0,convDiffConstant = 0.0)

Branching colony: https://segrelab.github.io/comets-manual/branching_colony/

mod.add_convection_parameters(packedDensity = 1.2,elasticModulus = 5.e-3,frictionConstant = 1.0,convDiffConstant = 0.0)

Petri dish: https://segrelab.github.io/comets-manual/petri_dish/

mod.add_convection_parameters(packedDensity = 0.022,elasticModulus = 1.e-10,frictionConstant = 1.0,convDiffConstant = 0.0)

zoey-rw commented 4 months ago

Reducing the convDiffConstant parameter to "2.e-6" helped to prevent the expansion of growing biomass. The default non-growing biomass diffusion parameter of "flowDiffRate" of 1e7 also became activated when switching biomass styles - it seems this allowed microbes to increase in biomass even if their biomass had an upper bound of zero?

I couldn't figure out the effect of the packedDensity and elasticModulus parameters. Should a lower packedDensity result in more compact growth, and a higher value result in branching growth?

I think it would be useful to give a warning when the biomassMotionStyle is changed from the default, perhaps with a link to example parameters & explanations.

zoey-rw commented 1 month ago

Follow up question on these 2D convection parameters, and the flowDiffRate:

Should varying the biomass diffusion parameters have any effect for a 1x1 grid layout, or should they only affect biomass spreading between multiple grid cells?