You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Both ionic models and active stress models are based on solving the same system of ODEs at every point in the domain. These systems are usually relatively complex, due to having many equations and involved expressions, so that making typos in their implementation is not uncommon.
As of now, the correctness of their implementation is only tested through regression tests, which verify that the solution of a 3D test case is consistent with a reference solution that was computed with the same code at the time of first implementation. This, however, has a few problems, in my opinion:
the comparison against the reference solution does not exclude that the reference solution is itself wrong (see e.g. Sign of stimulus current with Aliev-Panfilov model #535, where a typo in the implementation of the Aliev-Panfilov had gone unnoticed due to it being present when the reference solution was generated);
the regression tests usually involve less-than-trivial setups (e.g. the electrophysiology tests couple the ODE system with the monodomain PDE), so that if the test fails it is not immediately obvious whether the issue is in the ODE or in the PDE or elsewhere;
regression tests are usually 3D, which makes them relatively costly and slows down the CI/CD pipelines.
One alternative way of verifying the correctness would be to solve the ODE model as a standalone, and then compare its solution to that obtained by a trusted third-party implementation (cellular model developers often provide a reference implementation themselves). However, svMultiPhysics currently doesn't have a standalone ODE solver, as far as I can tell.
Proposed solution
I propose adding tests to the unitTests folder that implement a standalone 0D solver for both IonicModel and ActiveStress (or ActiveStressODE). These tests would take care of providing meaningful input to the ODE models surrogating coupling with 3D models (e.g. by solving an additional ODE to compute the membrane potential). The result would be compared against a reference solution provided e.g. as a CSV file (or other format).
The base classes IonicModel and ActiveStress should already support this thanks to the local timestepping functions (which might need to be moved to the public scope, or made available through friendship).
Additional context
@samibismar already did something of this kind as part of Add Regazzoni active stress model #596, although lacking the infrastructure that part was not committed anywhere. This proposed change would support more systematic testing.
I suspect that some of this overlaps with what @zasexton presented a while ago on auxiliary models (for the same reasons that IonicModel and ActiveStress have some overlap with it). I still think it might be useful to do this before auxiliary models come to the main branch, to provide testing infrastructure to cellular models that are currently under development, with the understanding that some of this might be discarded in favor of the more principled and general implementation.
Problem description
Both ionic models and active stress models are based on solving the same system of ODEs at every point in the domain. These systems are usually relatively complex, due to having many equations and involved expressions, so that making typos in their implementation is not uncommon.
As of now, the correctness of their implementation is only tested through regression tests, which verify that the solution of a 3D test case is consistent with a reference solution that was computed with the same code at the time of first implementation. This, however, has a few problems, in my opinion:
One alternative way of verifying the correctness would be to solve the ODE model as a standalone, and then compare its solution to that obtained by a trusted third-party implementation (cellular model developers often provide a reference implementation themselves). However,
svMultiPhysicscurrently doesn't have a standalone ODE solver, as far as I can tell.Proposed solution
I propose adding tests to the
unitTestsfolder that implement a standalone 0D solver for bothIonicModelandActiveStress(orActiveStressODE). These tests would take care of providing meaningful input to the ODE models surrogating coupling with 3D models (e.g. by solving an additional ODE to compute the membrane potential). The result would be compared against a reference solution provided e.g. as a CSV file (or other format).The base classes
IonicModelandActiveStressshould already support this thanks to the local timestepping functions (which might need to be moved to the public scope, or made available through friendship).Additional context
IonicModelandActiveStresshave some overlap with it). I still think it might be useful to do this before auxiliary models come to the main branch, to provide testing infrastructure to cellular models that are currently under development, with the understanding that some of this might be discarded in favor of the more principled and general implementation.