Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect ODE replacement when if-else block exists with derivimplicit method #84

Closed
pramodk opened this issue Mar 20, 2019 · 0 comments
Assignees
Labels
bug Something isn't working solver Solver and numerical methods
Milestone

Comments

@pramodk
Copy link
Contributor

pramodk commented Mar 20, 2019

If we have derivative block with derivimplicit method like :

DERIVATIVE states {
    IF (tau_m<taumin) {
        tau_m = taumin
    }
    m' = (m_inf-m)/tau_m
}

The SympySolver generates :

DERIVATIVE states {
    IF (tau_m<taumin) {
        LOCAL tmp_m_old
        tau_m = taumin
        {
            X[0] = m
        }{
            tmp_m_old = m
            m = (dt*m_inf+tau_m*tmp_m_old)/(dt+tau_m)
        }{
            m = X[0]
        }
    }
    m' = (m_inf-m)/tau_m
}

This is because I thought it's good idea to track last statement block and then inset statement there. But as we can see, it fails in above case as if's statement block gets used.

@pramodk pramodk added bug Something isn't working solver Solver and numerical methods labels Mar 20, 2019
@pramodk pramodk added this to the v0.2 milestone Mar 20, 2019
@pramodk pramodk self-assigned this Mar 20, 2019
pramodk added a commit that referenced this issue Mar 20, 2019
  - instead of last statementblock, keep track of block
    where ODEs are found
  - Todo : support for ODEs from different blocks, see #85

Resolves #84

Change-Id: I877ce3f1f8662b5071dee00354c29f96227d6012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working solver Solver and numerical methods
Projects
None yet
Development

No branches or pull requests

1 participant