Skip to content

Varied external variable doesn't always work for adaptive solvers #1324

@WeiweiAi

Description

@WeiweiAi

I attempted to provide a recorded action potential (voltage, V) array to a CellML model as an input using an external variable in libCellML. I printed both the input voltage (V) and the model’s response (I). While V matched the values I supplied, it appeared that V had no effect on the model’s output I.

To debug the issue, I created a simple CellML model (attached). The external variable was defined as an array of

report_task_external_var1.zip

[1]*100 + [2]*101 in Python (i.e., 100 elements of 1 followed by 101 elements of 2). For each simulation step, the code read the corresponding element from the array and returned it as the value of the external variable.

I observed that when using the CVODE solver (sksundae.cvode), the model's rate update function was skipped. I then switched to the Euler solver to verify whether the external variable was being correctly read and passed to the model. With Euler, I obtained the expected results.

This suggests that when using an adaptive solver like CVODE, if the external variable changes over time (e.g., a time series), the model may not receive updated values at each timestep because the solver can skip the rate update function. As a result, the external variable does not influence the model output as intended.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions