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

JOSS: Software > Design #12

Closed
lamBOOO opened this issue Nov 8, 2024 · 2 comments
Closed

JOSS: Software > Design #12

lamBOOO opened this issue Nov 8, 2024 · 2 comments

Comments

@lamBOOO
Copy link
Contributor

lamBOOO commented Nov 8, 2024

Concerning the JOSS review thread.

  • Use of quote ... end in Problem Definition: The NLodeProblem utilizes the quote ... end construct, resulting in an Expr object. For example:
    odeprob = NLodeProblem(quote
        name=(sysb53,)
        u = [-1.0, -2.0]
        du[1] = -20.0*u[1]-80.0*u[2]+1600.0
        du[2] = 1.24*u[1]-0.01*u[2]+0.2
    end)
    This contrasts with a more conventional approach:
    ode_prob = NLodeProblem(
        name = sysb53,
        u0 = [-1.0, -2.0],  # Initial condition for u
        f = function (du, u)
            du[1] = -20.0 * u[1] - 80.0 * u[2] + 1600.0
            du[2] = 1.24 * u[1] - 0.01 * u[2] + 0.2
        end
    )
    • Concerns: This unconventional use of quote ... end may not be the most elegant or efficient method in terms of type inference, robustness, and API accessibility.
    • Recommendation: Please explain the rationale behind this design choice or consider adopting the more standard method of using function arguments in Julia. The current approach makes it unclear what the function does with the input provided within the quote ... end block.
@mongibellili
Copy link
Owner

mongibellili commented Dec 9, 2024

Thank you for the comment.
In the revised package, the problem definition is updated to match the differentialEquations.jl interface (except for events which are put inside the function instead of callback functions):

function func(du,u,p,t)
#parameters
#helper expressions
#differential equations
#if-statments for events
end

tspan=(initial_time,final_time)
u = [u1_0,u2_0...]
p = [p1_0,p2_0...]
odeprob=ODEProblem(func,u,tspan,p)

sol= solve(odeprob,algorithm,abstol=...,reltol=...)

@lamBOOO
Copy link
Contributor Author

lamBOOO commented Jan 17, 2025

@lamBOOO lamBOOO closed this as completed Jan 17, 2025
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

No branches or pull requests

2 participants