# Implicit ODE¶

class assimulo.implicit_ode.Implicit_ODE

Baseclass for our implicit ODE integrators.

Initiates the solver.

Parameters:

problem
- The problem to be solved. Should be an instance
of the 'Implicit_Problem' class.

event_locator()

Checks if an event occurs in [t_low, t_high], if that is the case event localization is started. Event localization finds the earliest small interval that contains a change in domain. The right endpoint of this interval is then returned as the time to restart the integration at.

plot()

Plot the computed solution.

Parameters:

mask
- Default 'None'. Used to determine which variables that is to be plotted.
Used as a list of integers, ones represents the variable that is to be
plotted and zeros that is not.

- Should be a list of integers.

Example:
mask = [1,0] , plots the first variable.

der
- Default 'False'. When 'True' plots the derivative variables also.

- Should be a Boolean.

Example:
der = True
**kwargs
- See http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.plot
for information about the available options for **kwargs.

re_init()

Reinitiates the solver.

Parameters:

t0  - The initial time.
y0  - The initial values for the states
yd0 - The initial values for the state derivatives.


See information in the __init__ method.

report_solution()

Is called after each successful step in case the report continuously option is active. Here possible interpolation is done and the result handeled. Furthermore possible step events are checked.

reset()

Resets the problem. If the problem is defined with a reset method, its called and then the method re_init. The re_init method is called with the initial values provided to the solver (solver.t0, solver.y0, solver.yd0).

## IDA¶

class assimulo.solvers.sundials.IDA

This class provides a connection to the Sundials (https://computation.llnl.gov/casc/sundials/main.html) solver IDA.

IDA is a variable-order, variable-step multi-step algorithm for solving differential algebraic equations of the form,

$F(t,y,\dot{y})=0, \quad y(t_0) = y_0, \quad \dot{y}(t_0) = \dot{y}_0.$

IDA includes the Backward Differentiation Formulas (BDFs).

algvar

A list for defining which variables are differential and which are algebraic. This list is used when excluding algebraic variables from the error test by setting suppress_alg=True and it is used, when computing consistent initial values using the method make_consistency

Parameters:

algvar
- The value True(1.0) indicates a differential
variable and the value False(0.0) indicates an
algebraic variable.

- Should be a list or a numpy vector (ndarray)

Example:
algvar = [1.0, 0.0, 1.0]
algvar = [True, False, True]
algvar = [1,0,1]

atol

Defines the absolute tolerance(s) that is to be used by the solver. Can be set differently for each variable.

Parameters:

atol
- Default '1.0e-6'.

- Should be a positive float or a numpy vector
of floats.

Example:
atol = [1.0e-4, 1.0e-6]


See SUNDIALS IDA documentation 4.5.2 for more details.

backward

Specifies if the simulation is done in reverse time. (NOTE: experimental!)

Parameters:

backward

- Default False
- Boolean

clear_logs()

Clears the currently stored log messages.

clock_step

Specifies if the elapsed time of an integrator step should be timed or not. Not that this is only possible if running in report continuously mode.

display_progress

This option actives output during the integration in terms of that the current integration is periodically printed to the stdout. Note though that report_continuously needs to be activated.

Parameters:

display_progress
- Default True

dqrhomax

Specifies the selection parameters used in deciding switching between a simultaneous or separate approximation of the two terms in the sensitivity residual.

Parameters:

DQrhomax
- A postive float.
- Default 0.0


Returns:

The current value of DQrhomax (float)


See SUNDIALS documentation ‘(IDA/CVode)SetSensDQMethod’

dqtype

Specifies the difference quotient type in the sensitivity calculations. Can be either, ‘CENTERED’ or ‘FORWARD’.

Parameters:

DQtype
- A string of either 'CENTERED' or 'FORWARD'
- Default 'CENTERED'


Returns:

The current value of DQtype.


See SUNDIALS documentation ‘(IDA/CVode)SetSensDQMethod’

event_locator()

Checks if an event occurs in [t_low, t_high], if that is the case event localization is started. Event localization finds the earliest small interval that contains a change in domain. The right endpoint of this interval is then returned as the time to restart the integration at.

external_event_detection

A Boolean flag which indicates if Assimulos event finding algorithm or CVode’s is used to localize events. If false CVode’s rootfinding algorithm is used, if true Assimulos event_locator is used.

Parameters:

external_event_detection
- Default 'False'.

- Should be a boolean.

Example:
external_event_detection = True


See SUNDIALS IDA documentation 2.3 ‘Rootfinding’ for more details.

get_elapsed_step_time()

Returns the elapsed time of a step. I.e. how long a step took. Note that this is only possible if running in report_continuously mode and should only be used to get a general idea of how long a step really took.

Returns:

Elapsed time (note -1.0 indicates that it was not used)

get_event_data()

Returns the event information (if any). If there exists information about events, it will be returned as a list of tuples where the first value is the time of the occured event and the second is the event information.

get_last_order()

Returns the order used on the last successful step.

get_options()

Returns the current solver options.

get_statistics()

Returns the run-time statistics (if any).

get_supports()

Returns the functionality which the solver supports.

inith

This determines the initial step-size to be used in the integration.

Parameters:

initstep
- Default '0.0', which result in that the
the initial step is approximated.

- Should be float.

Example:
initstep = 0.01

interpolate()

Calls the internal IDAGetDky for the interpolated values at time t. t must be within the last internal step. k is the derivative of y which can be from zero to the current order.

interpolate_sensitivity()

This method calls the internal method IDAGetSensDky which computes the k-th derivatives of the interpolating polynomials for the sensitivity variables at time t.

Parameters:

t
- Specifies the time at which sensitivity information is requested. The time
t must fall within the interval defined by the last successful step taken
by IDAS.

k
- The order of derivatives.

i
- Specifies the sensitivity derivative vector to be returned (0<=i<=Ns)


Return:

A matrix containing the Ns vectors or a vector if i is specified.

linear_solver

Specifies the linear solver to be used.

Parameters:

linearsolver
- Default 'DENSE'. Can also be 'SPGMR'.

lsoff

Boolean value to turn OFF Sundials LineSearch when calculating initial conditions.

Parameters:

lsoff
- Default 'False'. False indicates the use of
linesearch.

- Should be a boolean.

Example:
lsoff = True

make_consistent()

Directs IDA to try to calculate consistent initial conditions.

Parameters:

method
- 'IDA_YA_YDP_INIT'
- This tries to calculate the
algebraic components of y and the differential
components of yd given the differential components
of y. The algebraic components of y must have been
specified with the property 'algvar'. The property
'IDA.tout1' is  used in the calculations. It
represents the the next output point.

- 'IDA_Y_INIT'
- This tries to calculate all components
of y given yd.


See SUNDIALS IDA documentation 4.5.4 for more details.

maxcorS

This detmines the maximum number of nonlinear iterations for the sensitivity variables.

Parameters:

maxcorS
- Default 3

- Should be an integer


For more information see SUNDIALS IDAS documentation 5.2.6.

maxh

Defines the maximal step-size that is to be used by the solver.

Parameters:

maxh
- Default '0', which indicates that the maximal
step-size is infinity.

- Should be a float.

Example:
maxh = 0.01

maxord

This determines the maximal order that is be used by the solver.

Parameters:

maxord
- For the BDF method the maximum order is 5.
'maxord' can be set in an interval from 1 to
the maximum order allowed.

- Should be an integer.

Example:
maxord = 3


An input value greater than the maximal order will result in the maximum value.

maxsteps

Determines the maximum number of steps the solver is allowed to take to finish the simulation.

Parameters:

maxsteps
- Default '10000'.

- Should be an integer.

Example:
maxsteps = 1000.

num_threads

This options specifies the number of threads to be used for those solvers that supports it.

Parameters:

num_threads

- Default is the number of cores

- Should be a integer.

pbar

Specifies the order of magnitude for the parameters. This is useful if IDAS is to estimate tolerances for the sensitivity solution vectors.

Parameters:

pbar
- An array of positive floats equal to the number of parameters.
- Default absolute values of the parameters.


Returns:

The current value of pbar.


See SUNDIALS documentation ‘(IDA/CVode)SetSensParams’

plot()

Plot the computed solution.

Parameters:

mask
- Default 'None'. Used to determine which variables that is to be plotted.
Used as a list of integers, ones represents the variable that is to be
plotted and zeros that is not.

- Should be a list of integers.

Example:
mask = [1,0] , plots the first variable.

der
- Default 'False'. When 'True' plots the derivative variables also.

- Should be a Boolean.

Example:
der = True
**kwargs
- See http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.plot
for information about the available options for **kwargs.

print_event_data()

Prints the event information (if any).

print_statistics()

Prints the run-time statistics for the problem.

re_init()

Reinitiates the solver.

Parameters:

t0  - The initial time.
y0  - The initial values for the states
yd0 - The initial values for the state derivatives.


See information in the __init__ method.

report_continuously

This options specifies if the solver should report the solution continuously after steps.

Parameters:

report_continuously

- Default False

- Should be a boolean.

report_solution()

Is called after each successful step in case the report continuously option is active. Here possible interpolation is done and the result handeled. Furthermore possible step events are checked.

reset()

Resets the problem. If the problem is defined with a reset method, its called and then the method re_init. The re_init method is called with the initial values provided to the solver (solver.t0, solver.y0, solver.yd0).

rtol

Defines the relative tolerance that is to be used by the solver.

Parameters:

rtol
- Default '1.0e-6'.

- Should be a positive float.

Example:
rtol = 1.0e-4

sensmethod

Specifies the sensitivity solution method. Can be either, ‘SIMULTANEOUS’ or ‘STAGGERED’.

Parameters:

ism
- A string of either 'SIMULTANEOUS' or 'STAGGERED'
- Default 'STAGGERED'


Returns:

The current value of sensmethod (string)


See SUNDIALS documentation ‘(IDA/CVode)SensInit’

simulate()

Calls the integrator to perform the simulation over the given time-interval. If a second call to simulate is performed, the simulation starts from the last given final time.

Parameters:

tfinal
- Final time for the simulation

- Should be a float or integer greater than the initial time.

ncp
- Default '0'. Number of communication points where the
solution is returned. If '0', the integrator will return
at its internal steps.

- Should be an integer.

ncp_list
- Default None. A list of time points where the solution
should be returned. Note, requires that ncp == 0.

Example:

simulate(10.0, 100), 10.0 is the final time and 100 is the number
communication points.

state_event_info()

Returns the event info.

store_event_points

This options specifies if the solver should save additional points at the events, $$t_e^-, t_e^+$$.

Parameters:

store_event_points

- Default True

- Should be a Boolean.

suppress_alg

A Boolean flag which indicates that the error-tests are suppressed on algebraic variables. The algebraic variables are defined by setting the property ‘algvar’.

Parameters:

suppress_alg
- Default 'False'.

- Should be a boolean.

Example:
suppress_alg = True


See SUNDIALS IDA documentation 4.5.7 ‘IDASetSuppressAlg’ for more details.

suppress_sens

A Boolean flag which indicates that the error-tests are suppressed on the sensitivity variables.

Parameters:

suppress_sens
- Default 'False'.

- Should be a boolean.

Example:
suppress_alg = True


See SUNDIALS IDA documentation 5.2.6 ‘IDASetSensErrCon’ for more details.

time_limit

This option can be used to limit the time of an integration. I.e to set an upper bound on the time allowed for the integration to be completed. The time limit is specified in seconds. For the limit to be checked, the option report_continuously must be True.

Parameters:

time_limit
- Default 0, i.e. NO limit.

tout1

Sets the value used in the internal Sundials function for determine initial conditions. This value is needed in order to manipulate the existing machinery to be used in determining the initial conditions.

Parameters:

tout1
- Default '0.001'.

- Should be a float.

Example:
tout1 = 0.01

usejac

This sets the option to use the user defined jacobian. If a user provided jacobian is implemented into the problem the default setting is to use that jacobian. If not, an approximation is used.

Parameters:

usejac
- True - use user defined jacobian
False - use an approximation

- Should be a boolean.

Example:
usejac = False

usesens

This options activates or deactivates the sensitivity calculations.

Parameters:

usejac
- True -  Activate sensitivity calculations
False - Deactivate sensitivity calculations

- Should be a boolean.

Example:
usesens = False

verbosity

This determines the level of the output. A smaller value means more output. The following values can be set:

QUIET = 50 WHISPER = 40 NORMAL = 30 LOUD = 20 SCREAM = 10

Parameters:

verb
- Default 30 (NORMAL)

- Should be a integer.


## Radau5DAE¶

class assimulo.solvers.radau5.Radau5DAE(problem)[source]

Bases: assimulo.lib.radau_core.Radau_Common, assimulo.implicit_ode.Implicit_ODE

Radau IIA fifth-order three-stages with step-size control and continuous output. Based on the FORTRAN code RADAU5 by E.Hairer and G.Wanner, which can be found here: http://www.unige.ch/~hairer/software.html

Details about the implementation (FORTRAN) can be found in the book,:

Solving Ordinary Differential Equations II,
Stiff and Differential-Algebraic Problems

Authors: E. Hairer and G. Wanner
Springer-Verlag, ISBN: 3-540-60452-9


Initiates the solver.

Parameters:

problem
- The problem to be solved. Should be an instance
of the 'Explicit_Problem' class.

atol

Defines the absolute tolerance(s) that is to be used by the solver. Can be set differently for each variable.

Parameters:

atol
- Default '1.0e-6'.

- Should be a positive float or a numpy vector
of floats.

Example:
atol = [1.0e-4, 1.0e-6]

backward

Specifies if the simulation is done in reverse time. (NOTE: experimental!)

Parameters:

backward

- Default False
- Boolean

clear_logs()

Clears the currently stored log messages.

clock_step

Specifies if the elapsed time of an integrator step should be timed or not. Not that this is only possible if running in report continuously mode.

display_progress

This option actives output during the integration in terms of that the current integration is periodically printed to the stdout. Note though that report_continuously needs to be activated.

Parameters:

display_progress
- Default True

event_locator()

Checks if an event occurs in [t_low, t_high], if that is the case event localization is started. Event localization finds the earliest small interval that contains a change in domain. The right endpoint of this interval is then returned as the time to restart the integration at.

fac1

Parameters for step-size selection. The new step-size is chosen subject to the restriction fac1 <= current step-size / old step-size <= fac2.

Parameters:

fac1
- Default 0.2

- Should be a float.

Example:
fac1 = 0.1

fac2

Parameters for step-size selection. The new step-size is chosen subject to the restriction fac1 <= current step-size / old step-size <= fac2.

Parameters:

fac2
- Default 8.0

- Should be a float.

Example:
fac2 = 10.0

fnewt

Stopping criterion for Newton’s method, usually chosen <1. Smaller values of fnewt make the code slower, but safer.

Parameters:

fnewt
- Default min(0.03,rtol**0.5)

- Should be a float.

Example:
fnewt = 0.05

get_elapsed_step_time()

Returns the elapsed time of a step. I.e. how long a step took. Note that this is only possible if running in report_continuously mode and should only be used to get a general idea of how long a step really took.

Returns:

Elapsed time (note -1.0 indicates that it was not used)

get_event_data()

Returns the event information (if any). If there exists information about events, it will be returned as a list of tuples where the first value is the time of the occured event and the second is the event information.

get_options()

Returns the current solver options.

get_statistics()

Returns the run-time statistics (if any).

get_supports()

Returns the functionality which the solver supports.

h

Sets the stepsize.

inith

This determines the initial step-size to be used in the integration.

Parameters:

inith
- Default '0.01'.

- Should be float.

Example:
inith = 0.01

maxh

Defines the maximal step-size that is to be used by the solver.

Parameters:

maxh
- Default final time - current time.

- Should be a float.

Example:
maxh = 0.01

maxsteps

The maximum number of steps allowed to be taken to reach the final time.

Parameters:

maxsteps
- Default 10000

- Should be a positive integer

newt

Maximal number of Newton iterations.

Parameters:

newt
- Default '7'.

- Should be an integer.

Example:
newt = 10

num_threads

This options specifies the number of threads to be used for those solvers that supports it.

Parameters:

num_threads

- Default is the number of cores

- Should be a integer.

plot()

Plot the computed solution.

Parameters:

mask
- Default 'None'. Used to determine which variables that is to be plotted.
Used as a list of integers, ones represents the variable that is to be
plotted and zeros that is not.

- Should be a list of integers.

Example:
mask = [1,0] , plots the first variable.

der
- Default 'False'. When 'True' plots the derivative variables also.

- Should be a Boolean.

Example:
der = True
**kwargs
- See http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.plot
for information about the available options for **kwargs.

plot_stepsize()

Plots the step-size.

print_event_data()

Prints the event information (if any).

print_statistics(verbose=30)[source]

Prints the run-time statistics for the problem.

quot1

If quot1 < current step-size / old step-size < quot2 the the step-size is not changed. This saves LU-decompositions and computing time for large systems.

Parameters:

quot1
- Default 1.0

- Should be a float.

Example:
quot1 = 0.9

quot2

If quot1 < current step-size / old step-size < quot2 the the step-size is not changed. This saves LU-decompositions and computing time for large systems.

Parameters:

quot2
- Default 1.2

- Should be a float.

Example:
quot2 = 1.2

re_init()

Reinitiates the solver.

Parameters:

t0  - The initial time.
y0  - The initial values for the states
yd0 - The initial values for the state derivatives.


See information in the __init__ method.

report_continuously

This options specifies if the solver should report the solution continuously after steps.

Parameters:

report_continuously

- Default False

- Should be a boolean.

report_solution()

Is called after each successful step in case the report continuously option is active. Here possible interpolation is done and the result handeled. Furthermore possible step events are checked.

reset()

Resets the problem. If the problem is defined with a reset method, its called and then the method re_init. The re_init method is called with the initial values provided to the solver (solver.t0, solver.y0, solver.yd0).

rtol

Defines the relative tolerance that is to be used by the solver.

Parameters:

rtol
- Default '1.0e-6'.

- Should be a positive float.

Example:
rtol = 1.0e-4

safe

The safety factor in the step-size prediction.

Parameters:

safe
- Default '0.9'

- Should be float.

Example:
safe = 0.8

simulate()

Calls the integrator to perform the simulation over the given time-interval. If a second call to simulate is performed, the simulation starts from the last given final time.

Parameters:

tfinal
- Final time for the simulation

- Should be a float or integer greater than the initial time.

ncp
- Default '0'. Number of communication points where the
solution is returned. If '0', the integrator will return
at its internal steps.

- Should be an integer.

ncp_list
- Default None. A list of time points where the solution
should be returned. Note, requires that ncp == 0.

Example:

simulate(10.0, 100), 10.0 is the final time and 100 is the number
communication points.

store_event_points

This options specifies if the solver should save additional points at the events, $$t_e^-, t_e^+$$.

Parameters:

store_event_points

- Default True

- Should be a Boolean.

thet

Value for determine if the Jacobian is to be recomputed or not. Increasing thet makes the code compute new Jacobians more seldom. Negative thet forces the code to compute the Jacobian after every accepted step.

Parameters:

thet
- Default '0.003'

- Should be float.

Example:
thet = 0.01

time_limit

This option can be used to limit the time of an integration. I.e to set an upper bound on the time allowed for the integration to be completed. The time limit is specified in seconds. For the limit to be checked, the option report_continuously must be True.

Parameters:

time_limit
- Default 0, i.e. NO limit.

usejac

This sets the option to use the user defined jacobian. If a user provided jacobian is implemented into the problem the default setting is to use that jacobian. If not, an approximation is used.

Parameters:

usejac
- True - use user defined jacobian
False - use an approximation

- Should be a boolean.

Example:
usejac = False

verbosity

This determines the level of the output. A smaller value means more output. The following values can be set:

QUIET = 50 WHISPER = 40 NORMAL = 30 LOUD = 20 SCREAM = 10

Parameters:

verb
- Default 30 (NORMAL)

- Should be a integer.


## GLIMDA¶

class assimulo.solvers.glimda.GLIMDA(problem)[source]

GLIMDA is a solver for nonlinear index-2 DAEs f(q’(t,x),x,t)=0.

Details about the implementation (FORTRAN) can be found in the PhD dissertation:

General Linear Methods for Integrated Circuit Design

Author: Steffen Voigtmann


Initiates the solver.

Parameters:

problem
- The problem to be solved. Should be an instance
of the 'Implicit_Problem' class.

atol

Defines the absolute tolerance(s) that is to be used by the solver. Can be set differently for each variable.

Parameters:

atol
- Default '1.0e-6'.

- Should be a positive float or a numpy vector
of floats.

Example:
atol = [1.0e-4, 1.0e-6]

backward

Specifies if the simulation is done in reverse time. (NOTE: experimental!)

Parameters:

backward

- Default False
- Boolean

clear_logs()

Clears the currently stored log messages.

clock_step

Specifies if the elapsed time of an integrator step should be timed or not. Not that this is only possible if running in report continuously mode.

display_progress

This option actives output during the integration in terms of that the current integration is periodically printed to the stdout. Note though that report_continuously needs to be activated.

Parameters:

display_progress
- Default True

event_locator()

Checks if an event occurs in [t_low, t_high], if that is the case event localization is started. Event localization finds the earliest small interval that contains a change in domain. The right endpoint of this interval is then returned as the time to restart the integration at.

get_elapsed_step_time()

Returns the elapsed time of a step. I.e. how long a step took. Note that this is only possible if running in report_continuously mode and should only be used to get a general idea of how long a step really took.

Returns:

Elapsed time (note -1.0 indicates that it was not used)

get_event_data()

Returns the event information (if any). If there exists information about events, it will be returned as a list of tuples where the first value is the time of the occured event and the second is the event information.

get_options()

Returns the current solver options.

get_statistics()

Returns the run-time statistics (if any).

get_supports()

Returns the functionality which the solver supports.

inith

This determines the initial step-size to be used in the integration.

Parameters:

inith
- Default '0.01'.

- Should be float.

Example:
inith = 0.01

maxh

Defines the maximal step-size that is to be used by the solver.

Parameters:

maxh
- Default final time - current time.

- Should be a float.

Example:
maxh = 0.01

maxord

Maximum order to be used (1-3).

Parameters:

maxord
- Default '3'.

- Should be an integer.

Example:
maxord = 2

maxretry

Defines the maximum number of consecutive number of retries after a convergence failure.

Parameters:

maxretry
- Default '15'

- Should be a Integer.

Example:
maxretry = 5

maxsteps

The maximum number of steps allowed to be taken to reach the final time.

Parameters:

maxsteps
- Default 100000

- Should be a positive integer

minh

Defines the minimum step-size that is to be used by the solver.

Parameters:

maxh
- Default machine precision.

- Should be a float.

Example:
minh = 0.01

minord

Minimum order to be used (1-3).

Parameters:

minord
- Default '1'.

- Should be an integer.

Example:
maxord = 2

newt

Maximum number of Newton iterations.

Parameters:

newt
- Default '7'.

- Should be an integer.

Example:
newt = 10

num_threads

This options specifies the number of threads to be used for those solvers that supports it.

Parameters:

num_threads

- Default is the number of cores

- Should be a integer.

order

Determines if GLIMDA should use a variable order method (0) or a fixed order method (1-3).

Parameters:

order
- Default '0'.

- Should be an integer.

Example:
order = 2

plot()

Plot the computed solution.

Parameters:

mask
- Default 'None'. Used to determine which variables that is to be plotted.
Used as a list of integers, ones represents the variable that is to be
plotted and zeros that is not.

- Should be a list of integers.

Example:
mask = [1,0] , plots the first variable.

der
- Default 'False'. When 'True' plots the derivative variables also.

- Should be a Boolean.

Example:
der = True
**kwargs
- See http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.plot
for information about the available options for **kwargs.

print_event_data()

Prints the event information (if any).

print_statistics(verbose=30)[source]

Prints the run-time statistics for the problem.

re_init()

Reinitiates the solver.

Parameters:

t0  - The initial time.
y0  - The initial values for the states
yd0 - The initial values for the state derivatives.


See information in the __init__ method.

report_continuously

This options specifies if the solver should report the solution continuously after steps.

Parameters:

report_continuously

- Default False

- Should be a boolean.

report_solution()

Is called after each successful step in case the report continuously option is active. Here possible interpolation is done and the result handeled. Furthermore possible step events are checked.

reset()

Resets the problem. If the problem is defined with a reset method, its called and then the method re_init. The re_init method is called with the initial values provided to the solver (solver.t0, solver.y0, solver.yd0).

rtol

Defines the relative tolerance that is to be used by the solver.

Parameters:

rtol
- Default '1.0e-6'.

- Should be a positive float.

Example:
rtol = 1.0e-4

simulate()

Calls the integrator to perform the simulation over the given time-interval. If a second call to simulate is performed, the simulation starts from the last given final time.

Parameters:

tfinal
- Final time for the simulation

- Should be a float or integer greater than the initial time.

ncp
- Default '0'. Number of communication points where the
solution is returned. If '0', the integrator will return
at its internal steps.

- Should be an integer.

ncp_list
- Default None. A list of time points where the solution
should be returned. Note, requires that ncp == 0.

Example:

simulate(10.0, 100), 10.0 is the final time and 100 is the number
communication points.

store_event_points

This options specifies if the solver should save additional points at the events, $$t_e^-, t_e^+$$.

Parameters:

store_event_points

- Default True

- Should be a Boolean.

time_limit

This option can be used to limit the time of an integration. I.e to set an upper bound on the time allowed for the integration to be completed. The time limit is specified in seconds. For the limit to be checked, the option report_continuously must be True.

Parameters:

time_limit
- Default 0, i.e. NO limit.

verbosity

This determines the level of the output. A smaller value means more output. The following values can be set:

QUIET = 50 WHISPER = 40 NORMAL = 30 LOUD = 20 SCREAM = 10

Parameters:

verb
- Default 30 (NORMAL)

- Should be a integer.


## ODASSL¶

class assimulo.solvers.odassl.ODASSL(problem)[source]

Bases: assimulo.solvers.odassl.ODASSL_Common, assimulo.implicit_ode.OverdeterminedDAE

Modified version of DASSL for solving overdetermined systems of (singularily) implicit ODEs. The main difference to DASSL is in the corrector iteration part.

ODASSL ad-ons : FUEHRER, CLAUS
DEUTSCHE FORSCHUNGSANSTALT
FUER LUFT- UND RAUMFAHRT (DLR)
INST. DYNAMIC DER FLUGSYSTEME
D-8031 WESSLING  (F.R.G)


Based on DASSL version dated to 900103 by:

DASSL-Author:  PETZOLD, LINDA
APPLIED MATHEMATICS DIVISION 8331
SANDIA NATIONAL LABORATORIES
LIVERMORE, CA.    94550


Initiates the solver.

Parameters:

problem
- The problem to be solved. Should be an instance
of the 'Explicit_Problem' class.

atol

Defines the absolute tolerance(s) that is to be used by the solver. Can be set differently for each variable.

Parameters:

atol
- Default '1.0e-6'.

- Should be a positive float or a numpy vector
of floats.

Example:
atol = [1.0e-4, 1.0e-6]

backward

Specifies if the simulation is done in reverse time. (NOTE: experimental!)

Parameters:

backward

- Default False
- Boolean

clear_logs()

Clears the currently stored log messages.

clock_step

Specifies if the elapsed time of an integrator step should be timed or not. Not that this is only possible if running in report continuously mode.

display_progress

This option actives output during the integration in terms of that the current integration is periodically printed to the stdout. Note though that report_continuously needs to be activated.

Parameters:

display_progress
- Default True

event_locator()

Checks if an event occurs in [t_low, t_high], if that is the case event localization is started. Event localization finds the earliest small interval that contains a change in domain. The right endpoint of this interval is then returned as the time to restart the integration at.

get_elapsed_step_time()

Returns the elapsed time of a step. I.e. how long a step took. Note that this is only possible if running in report_continuously mode and should only be used to get a general idea of how long a step really took.

Returns:

Elapsed time (note -1.0 indicates that it was not used)

get_event_data()

Returns the event information (if any). If there exists information about events, it will be returned as a list of tuples where the first value is the time of the occured event and the second is the event information.

get_options()

Returns the current solver options.

get_statistics()

Returns the run-time statistics (if any).

get_supports()

Returns the functionality which the solver supports.

inith

This determines the initial step-size to be used in the integration.

Parameters:

inith
- Default '0.01'.

- Should be float.

Example:
inith = 0.001


The quantity should be always positive. It will internally be multiplied by the sign(tout-t0) to account for the direction of integration.

maxh

Defines the maximal step-size that is to be used by the solver.

Parameters:

maxh
- Default: maxh=0.0 or None  ignores this option

- Should be a float.

Example:
maxh = 0.01

maxord

Defines the maximal order that is to be used by the solver.

Parameters:

maxord
- Default: maxord=0 or None  ignores this option

- Should be a float.

Example:
maxord = 4

num_threads

This options specifies the number of threads to be used for those solvers that supports it.

Parameters:

num_threads

- Default is the number of cores

- Should be a integer.

plot()

Plot the computed solution.

Parameters:

mask
- Default 'None'. Used to determine which variables that is to be plotted.
Used as a list of integers, ones represents the variable that is to be
plotted and zeros that is not.

- Should be a list of integers.

Example:
mask = [1,0] , plots the first variable.

der
- Default 'False'. When 'True' plots the derivative variables also.

- Should be a Boolean.

Example:
der = True
**kwargs
- See http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.plot
for information about the available options for **kwargs.

print_event_data()

Prints the event information (if any).

print_statistics(verbose=30)[source]

Prints the run-time statistics for the problem.

re_init()

Reinitiates the solver.

Parameters:

t0  - The initial time.
y0  - The initial values for the states
yd0 - The initial values for the state derivatives.


See information in the __init__ method.

report_continuously

This options specifies if the solver should report the solution continuously after steps.

Parameters:

report_continuously

- Default False

- Should be a boolean.

report_solution()

Is called after each successful step in case the report continuously option is active. Here possible interpolation is done and the result handeled. Furthermore possible step events are checked.

reset()

Resets the problem. If the problem is defined with a reset method, its called and then the method re_init. The re_init method is called with the initial values provided to the solver (solver.t0, solver.y0, solver.yd0).

rtol

Defines the relative tolerance that is to be used by the solver.

Parameters:

rtol
- Default '1.0e-6'.

- Should be a positive float.

Example:
rtol = 1.0e-4

simulate()

Calls the integrator to perform the simulation over the given time-interval. If a second call to simulate is performed, the simulation starts from the last given final time.

Parameters:

tfinal
- Final time for the simulation

- Should be a float or integer greater than the initial time.

ncp
- Default '0'. Number of communication points where the
solution is returned. If '0', the integrator will return
at its internal steps.

- Should be an integer.

ncp_list
- Default None. A list of time points where the solution
should be returned. Note, requires that ncp == 0.

Example:

simulate(10.0, 100), 10.0 is the final time and 100 is the number
communication points.

store_event_points

This options specifies if the solver should save additional points at the events, $$t_e^-, t_e^+$$.

Parameters:

store_event_points

- Default True

- Should be a Boolean.

time_limit

This option can be used to limit the time of an integration. I.e to set an upper bound on the time allowed for the integration to be completed. The time limit is specified in seconds. For the limit to be checked, the option report_continuously must be True.

Parameters:

time_limit
- Default 0, i.e. NO limit.

usejac

This sets the option to use the user defined Jacobian. If a user provided jacobian is implemented into the problem the default setting is to use that Jacobian. If not, an approximation is used.

Parameters:

usejac
- True - use user defined Jacobian
False - use an approximation

Default:  False

- Should be a Boolean.

Example:
usejac = False

verbosity

This determines the level of the output. A smaller value means more output. The following values can be set:

QUIET = 50 WHISPER = 40 NORMAL = 30 LOUD = 20 SCREAM = 10

Parameters:

verb
- Default 30 (NORMAL)

- Should be a integer.