Skip to content

Handling timescale #15

Description

@kwabenantim

Summary

The generated code currently tries to adjust for timescale differences. It does this with the understanding that Chaste assumes time is in hours and SBML assumes time is in seconds by default.

For example, in the code generated for the Goldbeter 1991 SRN model we have:

void Goldbeter1991OdeSystem::EvaluateYDerivatives(...)
{
  // Define state variables and reactions
  ...

  // Account for the differences in timescales
  rDY[0] *= 3600.0;
  rDY[1] *= 3600.0;
  rDY[2] *= 3600.0;
}

Running a simulation for 100s requires settings similar to:

double start_time = 0.0;
double end_time = 100.0 / 3600.0;   // 100s
double dt = 1.0 / 3600.0 / 100.0;  // 0.01s

By contrast, the Goldbeter1991OdeSystem in Chaste trunk doesn't perform the additional timescale adjustments and simply assumes time is in hours.

Which approach is better? Is there another way that is better than both?


EDIT:

The TysonNovak2001OdeSystem in Chaste trunk also does the timescale adjustments

    // Multiply by 60 beacuase the Tyson and Novak 2001 paper has time in minutes, not hours
    rDY[0] = dx1*60.0;
    rDY[1] = dx2*60.0;
    rDY[2] = dx3*60.0;
    rDY[3] = dx4*60.0;
    rDY[4] = dx5*60.0;
    rDY[5] = dx6*60.0;

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Fields

No fields configured for Feature.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions