User Manual 4.0 Numerical ordinary differential equations : Différence entre versions

De Wiki
Aller à : navigation, rechercher
 
(Contents)
 
(5 révisions intermédiaires par le même utilisateur non affichées)
Ligne 1 : Ligne 1 :
 
+
__NOTOC__
 
+
 
== Introduction ==
 
== Introduction ==
 
=== Scope ===
 
=== Scope ===
Ligne 14 : Ligne 13 :
 
The ODE integrators are provided in the following packages :
 
The ODE integrators are provided in the following packages :
  
|=Library|=Javadoc
+
{| class="wikitable"
|Patrius|[{{PathCurrentJavaDoc}}/fr/cnes/sirius/patrius/math/ode/package-summary.html Package fr.cnes.sirius.patrius.math.ode]
+
|-
|Patrius|[{{PathCurrentJavaDoc}}/fr/cnes/sirius/patrius/math/ode/nonstiff/package-summary.html Package fr.cnes.sirius.patrius.math.ode.nonstiff]
+
! scope="col"| Library
|Patrius|[{{PathCurrentJavaDoc}}/fr/cnes/sirius/patrius/math/ode/sampling/package-summary.html Package fr.cnes.sirius.patrius.math.ode.sampling]
+
! scope="col"| Javadoc
 +
|-
 +
|Patrius
 +
|[{{JavaDoc4.0}}/fr/cnes/sirius/patrius/math/ode/package-summary.html Package fr.cnes.sirius.patrius.math.ode]
 +
|-
 +
|Patrius
 +
|[{{JavaDoc4.0}}/fr/cnes/sirius/patrius/math/ode/nonstiff/package-summary.html Package fr.cnes.sirius.patrius.math.ode.nonstiff]
 +
|-
 +
|Patrius
 +
|[{{JavaDoc4.0}}/fr/cnes/sirius/patrius/math/ode/sampling/package-summary.html Package fr.cnes.sirius.patrius.math.ode.sampling]
 +
|}
  
 
==== Event handling ====
 
==== Event handling ====
Ligne 23 : Ligne 32 :
 
The events are managed in the following package :
 
The events are managed in the following package :
  
|=Library|=Javadoc
+
{| class="wikitable"
|Patrius|[{{PathCurrentJavaDoc}}/fr/cnes/sirius/patrius/math/ode/events/package-summary.html Package fr.cnes.sirius.patrius.math.ode.events]
+
|-
 +
! scope="col"| Library
 +
! scope="col"| Javadoc
 +
|-
 +
|Patrius
 +
|[{{JavaDoc4.0}}/fr/cnes/sirius/patrius/math/ode/events/package-summary.html Package fr.cnes.sirius.patrius.math.ode.events]
 +
|}
  
 
=== Links ===
 
=== Links ===
Ligne 32 : Ligne 47 :
 
A general purpose explanation of this section can be found here :
 
A general purpose explanation of this section can be found here :
  
[http://en.wikipedia.org/wiki/Numerical_ordinary_differential_equations http:~~/~~/en.wikipedia.org/wiki/Numerical_ordinary_differential_equations]
+
[http://en.wikipedia.org/wiki/Numerical_ordinary_differential_equations http://en.wikipedia.org/wiki/Numerical_ordinary_differential_equations]
  
 
=== Package Overview ===
 
=== Package Overview ===
Ligne 59 : Ligne 74 :
  
 
==== How to monitor events ====
 
==== How to monitor events ====
 
+
* '''create an EventHandler implementation''' <br> You need to create an EventHandler implementation for the event you want to trace.<br>The most important method here is the g() method :<br><code>double g(double t, double[] y) throws EventException;</code> <br>This method (which takes as input a solution of the integration problem at a given "time" t) should be designed so that '''when the event occurs, the sign of the method changes'''. It should also be continuous.<br>The other methods of the interface are :  
***create an EventHandler implementation**
+
** <syntaxhighlight lang="java">int eventOccurred(double t, double[] y, boolean increasing, boolean forward) throws EventException</syntaxhighlight> <br> This method is called when an event happens. It should return :
You need to create an EventHandler implementation for the event you want to trace.
+
The most important method here is the g() method :
+
<code>double g(double t, double[] y) throws EventException;</code>
+
This method (which takes as input a solution of the integration problem at a given "time" t) should be designed so that'''when the event occurs, the sign of the method changes'''. It should also be continuous.
+
The other methods of the interface are :
+
** <syntaxhighlight lang="java">int eventOccurred(double t,
+
                  double[] y,
+
                  boolean increasing, boolean forward)
+
                  throws EventException;</syntaxhighlight>
+
This method is called when an event happens. It should return :
+
 
*** STOP if the integration computation should stop
 
*** STOP if the integration computation should stop
 
*** RESET_STATE if the event handler wants to change the state vector before the integration resumes (the resetState method will be called)
 
*** RESET_STATE if the event handler wants to change the state vector before the integration resumes (the resetState method will be called)
 
*** RESET_DERIVATIVES if the state vector's derivatives need to be recomputed before the integration resumes
 
*** RESET_DERIVATIVES if the state vector's derivatives need to be recomputed before the integration resumes
 
*** CONTINUE if the integration should continue as if nothing happened
 
*** CONTINUE if the integration should continue as if nothing happened
** <syntaxhighlight lang="java">void resetState(double t,
+
** <syntaxhighlight lang="java">void resetState(double t, double[] y) throws EventException</syntaxhighlight> <br> This method is called when eventOccured has returned RESET_STATE. This method should modify the y array, which will change the way the integration performs.
                double[] y)
+
* '''add the EventHandler to an appropriate integrator''' <br>Using an EventHandler on a given integration problem is simple : just add it to the integrator instance before computing the solution.<br><syntaxhighlight lang="java">integrator.addEventHandler(eventHandler, maxCheckInterval, convergence, maxIterationCount);</syntaxhighlight> <br>Aside from the EventHandler itself, the other parameters are :<br>
                throws EventException</syntaxhighlight>
+
This method is called when eventOccured has returned RESET_STATE. This method should modify the y array, which will change the way the integration performs.
+
 
+
***add the EventHandler to an appropriate integrator**
+
Using an EventHandler on a given integration problem is simple : just add it to the integrator instance before computing the solution.
+
<code>integrator.addEventHandler(eventHandler, maxCheckInterval, convergence, maxIterationCount);</code>
+
Aside from the EventHandler itself, the other parameters are :
+
 
** maxCheckInterval : Maximal time interval between events handler checks.
 
** maxCheckInterval : Maximal time interval between events handler checks.
 
** convergence : precision needed for the event "time" value.
 
** convergence : precision needed for the event "time" value.
 
** iterationCount : maximum number of iterations to find the event "time" value when an event has been identified. Reaching this number means there is a problem with finding the event quickly enough (so, this counter is a way to interrupt an event search that takes too long, since finding an event should be fast if the g() function is continuous).
 
** iterationCount : maximum number of iterations to find the event "time" value when an event has been identified. Reaching this number means there is a problem with finding the event quickly enough (so, this counter is a way to interrupt an event search that takes too long, since finding an event should be fast if the g() function is continuous).
  
'''*run the integrator'''
+
*'''run the integrator'''
 
Please see the relevant section.
 
Please see the relevant section.
  
Ligne 99 : Ligne 97 :
 
== Contents ==
 
== Contents ==
 
=== Interfaces ===
 
=== Interfaces ===
|=(% colspan="3" %)Interface|=(% colspan="6" %)Summary|=Javadoc
+
{| class="wikitable"
|(% colspan="3" %)'''FirstOrderIntegrator'''|(% colspan="6" %)This interface represents a first order integrator for differential equations.|[{{PathCurrentJavaDoc}}/fr/cnes/sirius/patrius/math/ode/FirstOrderIntegrator.html ...]
+
|-
|(% colspan="3" %)'''ODEIntegrator'''|(% colspan="6" %)This interface defines the common parts shared by integrators for first and second order differential equations.|[{{PathCurrentJavaDoc}}/fr/cnes/sirius/patrius/math/ode/ODEIntegrator.html ...]
+
! scope="col"| Interface
 +
! scope="col"| Summary
 +
! scope="col"| Javadoc
 +
|-
 +
|'''FirstOrderIntegrator'''
 +
|This interface represents a first order integrator for differential equations.
 +
|[{{JavaDoc4.0}}/fr/cnes/sirius/patrius/math/ode/FirstOrderIntegrator.html ...]
 +
|-
 +
|'''ODEIntegrator'''
 +
|This interface defines the common parts shared by integrators for first and second order differential equations.
 +
|[{{JavaDoc4.0}}/fr/cnes/sirius/patrius/math/ode/ODEIntegrator.html ...]
 +
|}
  
|=(% colspan="3" %)Interface|=(% colspan="6" %)Summary|=Javadoc
+
{| class="wikitable"
|(% colspan="3" %)'''EventHandler'''|(% colspan="6" %)This interface represents a handler for discrete events triggered during ODE integration.|[{{PathCurrentJavaDoc}}/fr/cnes/sirius/patrius/math/ode/events/EventHandler.html ...]
+
|-
 +
! scope="col"| Interface
 +
! scope="col"| Summary
 +
! scope="col"| Javadoc
 +
|-
 +
|'''EventHandler'''
 +
|This interface represents a handler for discrete events triggered during ODE integration.
 +
|[{{JavaDoc4.0}}/fr/cnes/sirius/patrius/math/ode/events/EventHandler.html ...]
 +
|}
  
 
=== Classes ===
 
=== Classes ===
|=(% colspan="3" %)Interface|=(% colspan="6" %)Summary|=Javadoc
 
|(% colspan="3" %)'''AbstractIntegrator'''|(% colspan="6" %)Base class managing common boilerplate for all integrators.|[{{PathCurrentJavaDoc}}/fr/cnes/sirius/patrius/math/ode/AbstractIntegrator.html ...]
 
|(% colspan="3" %)'''AdaptiveStepsizeIntegrator'''|(% colspan="6" %)This abstract class holds the common part of all adaptive stepsize integrators for Ordinary Differential Equations.|[{{PathCurrentJavaDoc}}/fr/cnes/sirius/patrius/math/ode/nonstiff/AdaptiveStepsizeIntegrator.html ...]
 
|(% colspan="3" %)'''ClassicalRungeKuttaIntegrator'''|(% colspan="6" %)This class implements the classical fourth order Runge-Kutta integrator for Ordinary Differential Equations (it is the most often used Runge-Kutta method).|[{{PathCurrentJavaDoc}}/fr/cnes/sirius/patrius/math/ode/nonstiff/ClassicalRungeKuttaIntegrator.html ...]
 
|(% colspan="3" %)'''RungeKutta6Integrator'''|(% colspan="6" %)This class implements the sixth order Runge-Kutta integrator for Ordinary Differential Equations (it is used as the default Stela Integretor). Warning: this integrator currently has an underlying linear step interpolator.|[{{PathCurrentJavaDoc}}/fr/cnes/sirius/patrius/math/ode/nonstiff/RungeKutta6Integrator.html ...]
 
|(% colspan="3" %)'''DormandPrince54Integrator'''|(% colspan="6" %)This class implements the 5(4) Dormand-Prince integrator for Ordinary Differential Equations.|[{{PathCurrentJavaDoc}}/fr/cnes/sirius/patrius/math/ode/nonstiff/DormandPrince54Integrator.html ...]
 
|(% colspan="3" %)'''DormandPrince853Integrator'''|(% colspan="6" %)This class implements the 8(5,3) Dormand-Prince integrator for Ordinary Differential Equations.|[{{PathCurrentJavaDoc}}/fr/cnes/sirius/patrius/math/ode/nonstiff/DormandPrince853Integrator.html ...]
 
|(% colspan="3" %)'''GraggBulirschStoerIntegrator'''|(% colspan="6" %)This class implements a Gragg-Bulirsch-Stoer integrator for Ordinary Differential Equations.|[{{PathCurrentJavaDoc}}/fr/cnes/sirius/patrius/math/ode/nonstiff/GraggBulirschStoerIntegrator.html ...]
 
|(% colspan="3" %)'''RungeKuttaIntegrator'''|(% colspan="6" %)This class implements the common part of all fixed step Runge-Kutta integrators for Ordinary Differential Equations.|[{{PathCurrentJavaDoc}}/fr/cnes/sirius/patrius/math/ode/nonstiff/RungeKuttaIntegrator.html ...]
 
  
|=(% colspan="3" %)Interface|=(% colspan="6" %)Summary|=Javadoc
+
{| class="wikitable"
|(% colspan="3" %)'''EventState'''|(% colspan="6" %)This class handles the state for one EventHandler during integration steps.|[{{PathCurrentJavaDoc}}/fr/cnes/sirius/patrius/math/ode/events/EventState.html ...]
+
|-
 +
! scope="col"| Class
 +
! scope="col"| Summary
 +
! scope="col"| Javadoc
 +
|-
 +
|'''AbstractIntegrator'''
 +
|Base class managing common boilerplate for all integrators.
 +
|[{{JavaDoc4.0}}/fr/cnes/sirius/patrius/math/ode/AbstractIntegrator.html ...]
 +
|-
 +
|'''AdaptiveStepsizeIntegrator'''
 +
|This abstract class holds the common part of all adaptive stepsize integrators for Ordinary Differential Equations.
 +
|[{{JavaDoc4.0}}/fr/cnes/sirius/patrius/math/ode/nonstiff/AdaptiveStepsizeIntegrator.html ...]
 +
|-
 +
|'''ClassicalRungeKuttaIntegrator'''
 +
|This class implements the classical fourth order Runge-Kutta integrator for Ordinary Differential Equations (it is the most often used Runge-Kutta method).
 +
|[{{JavaDoc4.0}}/fr/cnes/sirius/patrius/math/ode/nonstiff/ClassicalRungeKuttaIntegrator.html ...]
 +
|-
 +
|'''RungeKutta6Integrator'''
 +
|This class implements the sixth order Runge-Kutta integrator for Ordinary Differential Equations (it is used as the default Stela Integretor). Warning: this integrator currently has an underlying linear step interpolator.
 +
|[{{JavaDoc4.0}}/fr/cnes/sirius/patrius/math/ode/nonstiff/RungeKutta6Integrator.html ...]
 +
|-
 +
|'''DormandPrince54Integrator'''
 +
|This class implements the 5(4) Dormand-Prince integrator for Ordinary Differential Equations.
 +
|[{{JavaDoc4.0}}/fr/cnes/sirius/patrius/math/ode/nonstiff/DormandPrince54Integrator.html ...]
 +
|-
 +
|'''DormandPrince853Integrator'''
 +
|This class implements the 8(5,3) Dormand-Prince integrator for Ordinary Differential Equations.
 +
|[{{JavaDoc4.0}}/fr/cnes/sirius/patrius/math/ode/nonstiff/DormandPrince853Integrator.html ...]
 +
|-
 +
|'''GraggBulirschStoerIntegrator'''
 +
|This class implements a Gragg-Bulirsch-Stoer integrator for Ordinary Differential Equations.
 +
|[{{JavaDoc4.0}}/fr/cnes/sirius/patrius/math/ode/nonstiff/GraggBulirschStoerIntegrator.html ...]
 +
|-
 +
|'''RungeKuttaIntegrator'''
 +
|This class implements the common part of all fixed step Runge-Kutta integrators for Ordinary Differential Equations.
 +
|[{{JavaDoc4.0}}/fr/cnes/sirius/patrius/math/ode/nonstiff/RungeKuttaIntegrator.html ...]
 +
|}
 +
 
 +
{| class="wikitable"
 +
|-
 +
! scope="col"| Class
 +
! scope="col"| Summary
 +
! scope="col"| Javadoc
 +
|-
 +
|'''EventState'''
 +
|This class handles the state for one EventHandler during integration steps.
 +
|[{{JavaDoc4.0}}/fr/cnes/sirius/patrius/math/ode/events/EventState.html ...]
 +
|}
 +
 
 +
[[Category:User_Manual_4.0_Mathematics]]

Version actuelle en date du 21 février 2018 à 08:42

Introduction

Scope

This library can compute solutions for ordinary differential equations, as numerical approximations. The problems are usually in the form of : Compute an estimate of y(t) from t=t0 to t=t1, knowing the derivative y'=f(t,y), and y(t0)=y0.

The library can also handle multiple discrete events detection based on the results of the ongoing estimation, which can be used to dynamically alter the conditions of the problem being solved, or even stop the integration (for instance : when the function y reaches an expected value, the value of t at this point being the information needed, there is no need to go on).

Javadoc

Integrators

The ODE integrators are provided in the following packages :

Library Javadoc
Patrius Package fr.cnes.sirius.patrius.math.ode
Patrius Package fr.cnes.sirius.patrius.math.ode.nonstiff
Patrius Package fr.cnes.sirius.patrius.math.ode.sampling

Event handling

The events are managed in the following package :

Library Javadoc
Patrius Package fr.cnes.sirius.patrius.math.ode.events

Links

None as of now.

Useful Documents

A general purpose explanation of this section can be found here :

http://en.wikipedia.org/wiki/Numerical_ordinary_differential_equations

Package Overview

Integrators :

Integrators2.PNG

Events package :

PATRIMOINESIRIUSSUMDiagEvents.png

Features Description

Integrators

The integrators providedinclude :

  • the Classical Runge Kutta integrator,
  • the Dormand Prince 8(5, 3) integrator and
  • the Gragg Bulirsch Stoer integrator.
  • the 6^^th^^ order Runge-Kutta integretor.

The ODE package documentation can be found here .

Events

Event handling during an integrator run is a core functionality of the math package, therefore this is already well-documented in the Javadoc (please see the relevant section). This here is a short summary of how event handling works.

How to monitor events

  • create an EventHandler implementation
    You need to create an EventHandler implementation for the event you want to trace.
    The most important method here is the g() method :
    double g(double t, double[] y) throws EventException;
    This method (which takes as input a solution of the integration problem at a given "time" t) should be designed so that when the event occurs, the sign of the method changes. It should also be continuous.
    The other methods of the interface are :
    • int eventOccurred(double t, double[] y, boolean increasing, boolean forward) throws EventException

      This method is called when an event happens. It should return :
      • STOP if the integration computation should stop
      • RESET_STATE if the event handler wants to change the state vector before the integration resumes (the resetState method will be called)
      • RESET_DERIVATIVES if the state vector's derivatives need to be recomputed before the integration resumes
      • CONTINUE if the integration should continue as if nothing happened
    • void resetState(double t, double[] y) throws EventException

      This method is called when eventOccured has returned RESET_STATE. This method should modify the y array, which will change the way the integration performs.
  • add the EventHandler to an appropriate integrator
    Using an EventHandler on a given integration problem is simple : just add it to the integrator instance before computing the solution.
    integrator.addEventHandler(eventHandler, maxCheckInterval, convergence, maxIterationCount);

    Aside from the EventHandler itself, the other parameters are :
    • maxCheckInterval : Maximal time interval between events handler checks.
    • convergence : precision needed for the event "time" value.
    • iterationCount : maximum number of iterations to find the event "time" value when an event has been identified. Reaching this number means there is a problem with finding the event quickly enough (so, this counter is a way to interrupt an event search that takes too long, since finding an event should be fast if the g() function is continuous).
  • run the integrator

Please see the relevant section.

About the EventState class

The EventState class is a very important class for event detection (one EventState instance is needed for each EventHandler to work), but since the integrator instantiates EventStates when needed, a regular user never needs to interact directy with an EventState object. Therefore, describing the EventState class is out of the scope of this document; all relevant information can be found in the Javadoc if needed.

Getting Started

Contents

Interfaces

Interface Summary Javadoc
FirstOrderIntegrator This interface represents a first order integrator for differential equations. ...
ODEIntegrator This interface defines the common parts shared by integrators for first and second order differential equations. ...
Interface Summary Javadoc
EventHandler This interface represents a handler for discrete events triggered during ODE integration. ...

Classes

Class Summary Javadoc
AbstractIntegrator Base class managing common boilerplate for all integrators. ...
AdaptiveStepsizeIntegrator This abstract class holds the common part of all adaptive stepsize integrators for Ordinary Differential Equations. ...
ClassicalRungeKuttaIntegrator This class implements the classical fourth order Runge-Kutta integrator for Ordinary Differential Equations (it is the most often used Runge-Kutta method). ...
RungeKutta6Integrator This class implements the sixth order Runge-Kutta integrator for Ordinary Differential Equations (it is used as the default Stela Integretor). Warning: this integrator currently has an underlying linear step interpolator. ...
DormandPrince54Integrator This class implements the 5(4) Dormand-Prince integrator for Ordinary Differential Equations. ...
DormandPrince853Integrator This class implements the 8(5,3) Dormand-Prince integrator for Ordinary Differential Equations. ...
GraggBulirschStoerIntegrator This class implements a Gragg-Bulirsch-Stoer integrator for Ordinary Differential Equations. ...
RungeKuttaIntegrator This class implements the common part of all fixed step Runge-Kutta integrators for Ordinary Differential Equations. ...
Class Summary Javadoc
EventState This class handles the state for one EventHandler during integration steps. ...