Hi Justin,

The integration method you describe is implemented as part of NESTML’s new compartmental feature, which can be used to construct multi-compartment models in NEST (if you only want to simulate single-compartment models, you can do so by only adding one compartment when initialising the model)

Note that we are currently still in the process of creating tutorials / examples for this feature, so the user documentation is a bit sparse. However, you may have a look at the tests, where e.g. compiling the file https://github.com/nest/nestml/blob/master/tests/nest_compartmental_tests/resources/cm_default.nestml, using the function `generate_nest_compartmental_target` will result in forward integration code for the ion channels as you describe (note that this uses  the forward exponential method for e.g. ion channel state-variables, but implicit Euler for the voltage. You can check the python code to compile and build models here  https://github.com/nest/nestml/blob/master/tests/nest_compartmental_tests/resources/cm_default.nestml

For examples on how to create and run compartmental models once the nestml code is compiled, please see https://nest-simulator.readthedocs.io/en/stable/auto_examples/compartmental_model/receptors_and_current.html and https://nest-simulator.readthedocs.io/en/stable/auto_examples/compartmental_model/two_comps.html

Fyi, currently, the compartmental model does not support plasticity and integrate-and-fire mechanisms as standard nestml models. Support for this will be added in the next version.

Best regards,
Willem

----------------------
Dr. Willem Wybo, group leader
Peter Grünberg Institute 15 - Neuromorphic Software Ecosystems
Forschungszentrum Jülich
www.fz-juelich.de/pgi/PGI-15
----------------------

On 24. Feb 2025, at 17:08, Justin R. Davis <justin.r.davis@essie.ufl.edu> wrote:

Yes, it's the former I'm looking to implement.  Specifically, I'm trying to replicate some Brian2 results which implement the exponential integrator via:
https://brian2.readthedocs.io/en/stable/_modules/brian2/stateupdaters/exponential_euler.html#ExponentialEulerStateUpdater

Which I believe is just a 1st order integrator (as opposed to the higher order ERE methods) such as shown in Eqn 8 (I assume the existing forward euler looks something like Eqn 4):
https://en.wikipedia.org/wiki/Numerical_methods_for_ordinary_differential_equations#First-order_exponential_integrator_method

Assuming the processor is already splitting the equations into linear/non-linear parts (ie eqn 7), I don't think a separate solver library would be needed for the 1st order integrator.

jrd

-----Original Message-----
From: Charl Linssen <nest-users@turingbirds.com>
Sent: Monday, February 24, 2025 9:59 AM
To: users@nest-simulator.org
Subject: [NEST Users] Re: Exponential Euler Support in NESTML

[External Email]

Hi,

Thanks for writing in. Just to be clear about terminology: for numerically stiff systems of ODEs, there exists a class of (numerical) solvers called "exponential Euler", such as Exponential Rosenbrock-Euler.

There are also linear sets of ODEs, the solution of which can be calculated algebraically (with pen and paper) and will typically end up containing terms like exp(-dt/tau).

Which of these two did you wish to use? In case of the latter, the good news is that that's already implemented and should be working out-of-the-box. For the former, I would be happy to add support for an ERE (or a similar) solver if it makes sense for your model, or you need it to reproduce results. Please let me know what you would deem a suitable ERE solver, preferably one with a C++ interface and an open-source license.

Cheers!
Charl


On Mon, Feb 24, 2025, at 15:45, justin.r.davis@essie.ufl.edu wrote:
I've got a version of the HH model (via a NESTML file) which seems to
be requiring an exponential Euler solver (ie the one commonly used for
e^x dependent biologic systems) to most efficiently solve the
equations*.  From my reading of the NESTML code generator tools source,
only rk45 and forward-Euler are supported.   The difference between
Euler and Exponential Euler doesn't seem that significant, so I wanted
to see if I could get the exponential version implemented....however,
what's become unclear to me is whether or not this is a limitation of
NEST, NESTML or the underlying solvers and how I'd go about getting a
different solver implemented.  Are there any guides around on how one
would implement a new solver and/or information which would help me
figure this out.

thx.

jrd

*=forward Euler does work for some (might work with even smaller
timestep) cases, but it requires a time step of 0.01ms.  I'm comparing
with  a Brian2 version of the model running with a 0.1ms time step
with it's natively supported exponential Euler solver which is what is
making me look into other solvers for my NESTML-based code.
_______________________________________________
NEST Users mailing list -- users@nest-simulator.org To unsubscribe
send an email to users-leave@nest-simulator.org
_______________________________________________
NEST Users mailing list -- users@nest-simulator.org To unsubscribe send an email to users-leave@nest-simulator.org
_______________________________________________
NEST Users mailing list -- users@nest-simulator.org
To unsubscribe send an email to users-leave@nest-simulator.org



------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------
Forschungszentrum Jülich GmbH
52425 Jülich
Sitz der Gesellschaft: Jülich
Eingetragen im Handelsregister des Amtsgerichts Düren Nr. HR B 3498
Vorsitzender des Aufsichtsrats: MinDir Stefan Müller
Geschäftsführung: Prof. Dr. Astrid Lambrecht (Vorsitzende),
Dr. Stephanie Bauer (stellv. Vorsitzende), Prof. Dr. Ir. Pieter Jansens
------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------