Skip to content

add the liouville transformation #717

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

Merged
merged 3 commits into from
Jan 7, 2021
Merged

add the liouville transformation #717

merged 3 commits into from
Jan 7, 2021

Conversation

ChrisRackauckas
Copy link
Member

@YingboMa this would be a nice case for a transformation to be able to set an initial condition, another indicator that we need some form of default values

@ChrisRackauckas
Copy link
Member Author

@agerlach

@agerlach
Copy link

agerlach commented Jan 7, 2021

I’m not at my computer to look closer but I don’t think the implementation is correct. It should be dpdt = -p * tr(jac).

Also, why do you state the IC should be zero?

@ChrisRackauckas
Copy link
Member Author

Oh yes, I found a good source:

https://abhishekhalder.bitbucket.io/F16ACC2013Final.pdf

Indeed I was missing a term, and that IC would come from the characteristic.

@ChrisRackauckas
Copy link
Member Author

@YingboMa I think I'll go with this for now, though I don't quite like exposing a hardcoded symbol. I can't think of another good way to do it though.

@ChrisRackauckas ChrisRackauckas merged commit 0c5e6a3 into master Jan 7, 2021
@ChrisRackauckas ChrisRackauckas deleted the louiville branch January 7, 2021 04:14
@ChrisRackauckas ChrisRackauckas restored the louiville branch January 7, 2021 04:14
@ChrisRackauckas ChrisRackauckas deleted the louiville branch January 7, 2021 04:14
@agerlach
Copy link

agerlach commented Jan 7, 2021

I don't quite like exposing a hardcoded symbol

Why not just have the user create and pass the symbol

function liouville_transform(sys, var)
    t = independent_variable(sys)
    D = ModelingToolkit.Differential(t)
    neweq = D(var) ~ var*-tr(calculate_jacobian(sys))
    neweqs = [equations(sys);neweq]
    vars = [states(sys);var]
    ODESystem(neweqs,t,vars,parameters(sys))
end

@variables q
liouville_transform(sys, q)

or wrap it in a type?

struct Liouville
    var
end

function transform(sys, alg::Liouville)
    var = alg.var
    t = independent_variable(sys)
    D = ModelingToolkit.Differential(t)
    neweq = D(var) ~ var*-tr(calculate_jacobian(sys))
    neweqs = [equations(sys);neweq]
    vars = [states(sys);var]
    ODESystem(neweqs,t,vars,parameters(sys))
end

@variables q
transform(sys,q)

@ChrisRackauckas
Copy link
Member Author

Having the user pass a symbol might be a better option than having one hardcoded. @YingboMa what do you think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants