<?xml-stylesheet type="text/xsl" href="../styles/pmathml.xsl"?>
<!-- saved from url=(0014)about:internet -->
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:dsi="http://www.w3.org/1999/xlink" xmlns:m="http://www.w3.org/1998/Math/MathML" xml:space="preserve"><head><meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"/><title>D02MN Sub-chapter Introduction : NAG Library, Mark 22</title><link rel="stylesheet" href="../styles/libdoc.css" type="text/css"/><script type="text/javascript">
   function showLevel(_levelId){
    var thisLevel = document.getElementById(_levelId);
    var thisplus = document.getElementById( _levelId.concat('plus'));
    var thisminus = document.getElementById( _levelId.concat('minus'));
    if(thisLevel.style.display != "block"){
     thisLevel.style.display = "block";
     thisplus.style.display = "none";
     thisminus.style.display = "inline";
     }
    else{
     thisLevel.style.display = "none";
     thisminus.style.display = "none";
     thisplus.style.display = "inline";
     }
    }
  </script></head><body><hr/><div><a class="chap" href="d02conts.xml">D02 Chapter Contents</a></div><div><a class="chapint" href="../../pdf/D02/d02mnintro.pdf">D02MN Chapter Introduction (PDF version)</a></div>
<div><a class="htmltoc" href="../FRONTMATTER/manconts.xml">NAG Library Manual</a></div><hr/><h1 class="libdoc">NAG Library Sub-chapter Introduction<br/><br/>D02M&#8211;N &#8211; Integrators for Stiff Ordinary Differential Systems</h1><div class="htmltoc">
<h2 class="htmltoc"><span class="htmltochead" onclick="showLevel('htmltoc');"><span class="htmltocplus" id="htmltocplus">+</span><span class="htmltocminus" id="htmltocminus">&#8722;</span></span>&#160;Contents</h2>
<div class="htmltocitem" id="htmltoc">
<div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#d02mnintint">1&#160;&#160;<b>Introduction</b></a>
</div><div class="htmltoc">
<span class="htmltocplus">&#160;&#160;&#160;</span>
<a class="htmltoc" href="#references">2&#160;&#160;<b>References</b></a>
</div>
</div>
</div><h2 class="standard"><a class="sec" name="d02mnintint" id="d02mnintint"/>1&#160;&#160;Introduction</h2>
<div class="paramtext">This sub-chapter contains the specifications of the integrators, the setup routines and diagnostic routines which have been developed from the SPRINT
package, <a class="ref" href="#ref535">Berzins and Furzeland (1985)</a>, and from the DASSL package, <a class="ref" href="#ref826">Brenan <span class="italic">et al.</span> (1996)</a>.</div><div class="paramtext">The SPRINT explicit integrators <a class="rout" href="../D02/d02nbf.xml">D02NBF</a>, <a class="rout" href="../D02/d02ncf.xml">D02NCF</a> and <a class="rout" href="../D02/d02ndf.xml">D02NDF</a> are designed for solving stiff systems of explicitly defined ordinary differential equations,

<div class="formula"><table class="formula"><tr><td class="formula"><m:math display="block">
<m:msup><m:mi>y</m:mi><m:mo>&#8242;</m:mo></m:msup><m:mo>=</m:mo><m:mi>g</m:mi><m:mfenced separators=""><m:mi>t</m:mi><m:mo>,</m:mo><m:mi>y</m:mi></m:mfenced><m:mtext>.</m:mtext>
</m:math></td><td class="formula2"/></tr></table></div>

The SPRINT implicit integrators <a class="rout" href="../D02/d02ngf.xml">D02NGF</a>, <a class="rout" href="../D02/d02nhf.xml">D02NHF</a> and <a class="rout" href="../D02/d02njf.xml">D02NJF</a> are designed for solving stiff systems of implicitly defined ordinary differential equations,

<div class="formula"><table class="formula"><tr><td class="formula"><m:math display="block">
<m:mi>A</m:mi><m:mfenced separators=""><m:mi>t</m:mi><m:mo>,</m:mo><m:mi>y</m:mi></m:mfenced><m:msup><m:mi>y</m:mi><m:mo>&#8242;</m:mo></m:msup><m:mo>=</m:mo><m:mi>g</m:mi><m:mfenced separators=""><m:mi>t</m:mi><m:mo>,</m:mo><m:mi>y</m:mi></m:mfenced><m:mtext>.</m:mtext>
</m:math></td><td class="formula2"/></tr></table></div></div><div class="paramtext">The DASSL integrator <a class="rout" href="../D02/d02nef.xml">D02NEF</a> is designed for solving systems of the form, <m:math><m:mi>F</m:mi><m:mfenced separators=""><m:mi>t</m:mi><m:mo>,</m:mo><m:mi>y</m:mi><m:mo>,</m:mo><m:mrow><m:mi>y</m:mi><m:mo>&#8242;</m:mo></m:mrow></m:mfenced><m:mo>=</m:mo><m:mn>0</m:mn></m:math>.  These formulations permits solution of differential/algebraic systems
(DAEs).  The facilities provided are essentially those of the explicit solvers.</div><div class="paramtext">The SPRINT integrator routines have almost identical calling sequences but each is designed to solve a problem where the Jacobian is of a particular structure: full matrix (<a class="rout" href="../D02/d02nbf.xml">D02NBF</a> and <a class="rout" href="../D02/d02ngf.xml">D02NGF</a>), banded matrix (<a class="rout" href="../D02/d02ncf.xml">D02NCF</a> and <a class="rout" href="../D02/d02nhf.xml">D02NHF</a>) or sparse matrix (<a class="rout" href="../D02/d02ndf.xml">D02NDF</a> and <a class="rout" href="../D02/d02njf.xml">D02NJF</a>).  Each of these structures has associated with it a linear algebra setup routine: <a class="rout" href="../D02/d02nsf.xml">D02NSF</a>, <a class="rout" href="../D02/d02ntf.xml">D02NTF</a> and <a class="rout" href="../D02/d02nuf.xml">D02NUF</a> respectively.  A linear algebra setup routine must be called before the first call to the appropriate integrator.  These linear algebra setup routines check various parameters of the corresponding integrator routine and set certain parameters for the linear algebra computations.  A routine, <a class="rout" href="../D02/d02nxf.xml">D02NXF</a>, is supplied which permits extraction of diagnostic information after a call to either of the sparse linear algebra solvers <a class="rout" href="../D02/d02ndf.xml">D02NDF</a> and <a class="rout" href="../D02/d02njf.xml">D02NJF</a>.</div><div class="paramtext">With the SPRINT integrators are also associated three integrator setup routines
<a class="rout" href="../D02/d02mvf.xml">D02MVF</a>, <a class="rout" href="../D02/d02nvf.xml">D02NVF</a> and <a class="rout" href="../D02/d02nwf.xml">D02NWF</a>,
one of which must be called before the first call to any integrator routine.  They provide input to the Backward Differentiation Formulae (BDF), the Blend
Formulae and the special fixed leading coefficient BDF codes respectively.  On return from an integrator, if it is feasible to continue the integration,
<a class="rout" href="../D02/d02nzf.xml">D02NZF</a> may be called to reset various integration parameters.  It is often of considerable interest to determine statistics concerning the integration process.  <a class="rout" href="../D02/d02nyf.xml">D02NYF</a> is provided with this aim in mind.  It should prove especially useful to those who wish to integrate many similar problems as it provides suitable values for many of the input parameters and indications of the difficulties encountered when solving the problem.</div><div class="paramtext">Hence, the general form of a program calling one of the integrator routines
<a class="rout" href="../D02/d02nbf.xml">D02NBF</a>, <a class="rout" href="../D02/d02ncf.xml">D02NCF</a>, <a class="rout" href="../D02/d02ndf.xml">D02NDF</a>, <a class="rout" href="../D02/d02ngf.xml">D02NGF</a>, <a class="rout" href="../D02/d02nhf.xml">D02NHF</a> or <a class="rout" href="../D02/d02njf.xml">D02NJF</a>
will be
<pre class="verbatim">
declarations 
   .  
   .  
call linear algebra setup routine 
call integrator setup routine 
call integrator 
call integrator diagnostic routine (if required)  
call linear algebra diagnostic routine (if appropriate and if required)  
   .  
   .  
STOP  
END
</pre></div><div class="paramtext">With the DASSL integrator, <a class="rout" href="../D02/d02nef.xml">D02NEF</a>, the associated setup routine is <a class="rout" href="../D02/d02mwf.xml">D02MWF</a> and the associated continuation call routine is <a class="rout" href="../D02/d02mcf.xml">D02MCF</a>.  <a class="rout" href="../D02/d02npf.xml">D02NPF</a> may be called following a call to the setup routine to specify that the Jacobian is banded and to supply its dimensions.</div><div class="paramtext">The required calling sequence for different Jacobian structures and system types is represented diagrammatically in <a class="fig" href="#D02MN1">Figure 1</a>.
<div class="figure"><a name="D02MN1" id="D02MN1"/><img src="../figures/D02MN1fl18.png" style="height: 36em" alt="Schema for SPRINT forward communication routine calling sequences"/></div><div class="figure"><b>Figure 1: Schema for SPRINT forward communication routine calling sequences</b></div>
</div><div class="paramtext">The integrators <a class="rout" href="../D02/d02nmf.xml">D02NMF</a> and <a class="rout" href="../D02/d02nnf.xml">D02NNF</a> are reverse communication routines designed for solving explicit and implicit stiff ordinary differential systems respectively.  You are warned that you should use these routines only when the integrators mentioned above are inadequate for their application.  For example, if it is difficult to write one or more of the user-supplied routine <a class="arg" href="../D02/d02nbf.xml#FCN">FCN</a> (<a class="arg" href="../D02/d02ngf.xml#RESID">RESID</a>) or <a class="arg" href="../D02/d02ngf.xml#JAC">JAC</a> (or <a class="arg" href="../D02/d02ngf.xml#MONITR">MONITR</a>) or if the integrators are to be embedded in a package, it may be advisable to consider these routines.</div><div class="paramtext">Since these routines use reverse communication you do not need to define any routines with a prescribed argument list. This makes them especially suitable for large scale computations where encapsulation of the definition of the differential system or its Jacobian matrix in a prescribed routine form may be particularly difficult to achieve.</div><div class="paramtext"><a class="rout" href="../D02/d02nmf.xml">D02NMF</a> is the reverse communication counterpart of the forward communication routines <a class="rout" href="../D02/d02nbf.xml">D02NBF</a>, <a class="rout" href="../D02/d02ncf.xml">D02NCF</a> and <a class="rout" href="../D02/d02ndf.xml">D02NDF</a> whereas
<a class="rout" href="../D02/d02nnf.xml">D02NNF</a> is the reverse communication counterpart of the forward communication routines <a class="rout" href="../D02/d02ngf.xml">D02NGF</a>, <a class="rout" href="../D02/d02nhf.xml">D02NHF</a> and <a class="rout" href="../D02/d02njf.xml">D02NJF</a>.  When using these reverse communication routines it is necessary to call the same linear algebra and integrator setup routines as for the forward communication counterpart.  All the other continuation and interrogation routines available for use with the forward communication routines are also available to you when calling the reverse communication routines.</div><div class="paramtext">There is also a routine, <a class="rout" href="../D02/d02nrf.xml">D02NRF</a>, to tell you how to supply the Jacobian when the sparse linear algebra option is being employed with either of <a class="rout" href="../D02/d02nmf.xml">D02NMF</a> and <a class="rout" href="../D02/d02nnf.xml">D02NNF</a>.  Hence, the general form of a program calling one of the integrator routines <a class="rout" href="../D02/d02nmf.xml">D02NMF</a> or <a class="rout" href="../D02/d02nnf.xml">D02NNF</a> will be
<pre class="verbatim">
     declarations 
     call linear algebra setup routine 
     call integrator setup routine 
     IREVCM = 0  
1000 call integrator( ..., IREVCM, ...)  
     IF (IREVCM.GT.0) THEN  
     
        evaluate residual and Jacobian (including a call to D02NRF if 
        sparse linear algebra is being used), call the MONITR routine etc.  
    
        GO TO 1000  
     ENDIF  
 
     call integrator diagnostic routine (if required)  
     call linear algebra diagnostic routine (if appropriate and if required)  

     STOP 
     END
</pre></div><div class="paramtext">The required calling sequence in the case of reverse communication, is represented diagramatically in <a class="fig" href="#D02MN2">Figure 2</a>.</div><div class="paramtext">In the example programs for the eight SPRINT integrators <a class="rout" href="../D02/d02nbf.xml">D02NBF</a>, <a class="rout" href="../D02/d02ncf.xml">D02NCF</a>, <a class="rout" href="../D02/d02ndf.xml">D02NDF</a>, <a class="rout" href="../D02/d02ngf.xml">D02NGF</a>, <a class="rout" href="../D02/d02nhf.xml">D02NHF</a>, <a class="rout" href="../D02/d02njf.xml">D02NJF</a>, <a class="rout" href="../D02/d02nmf.xml">D02NMF</a> and <a class="rout" href="../D02/d02nnf.xml">D02NNF</a> we attempt to illustrate the various options available.  Many of these options are available in all the routines and you are invited to scan all the example programs for illustrations of their use.  In each case we use as an example the stiff Robertson problem

<div class="formula"><table class="formula"><tr><td class="formula"><m:math display="block">
<m:mtable columnalign="left left right left">
 <m:mtr>
  <m:mtd><m:msup><m:mi>a</m:mi><m:mo>&#8242;</m:mo></m:msup></m:mtd>
  <m:mtd><m:mo>=</m:mo></m:mtd>
  <m:mtd><m:mrow><m:mo>-</m:mo><m:mn>0.04</m:mn></m:mrow><m:mi>a</m:mi></m:mtd>
  <m:mtd><m:mo>+</m:mo></m:mtd>
  <m:mtd><m:msup><m:mn>10</m:mn><m:mn>4</m:mn></m:msup><m:mi>b</m:mi><m:mi>c</m:mi></m:mtd>
  <m:mtd/></m:mtr><m:mtr>
  <m:mtd/>
  <m:mtd/>
  <m:mtd/>
  <m:mtd/>
  <m:mtd/>
  <m:mtd/>
  <m:mtd/></m:mtr><m:mtr>
  <m:mtd><m:msup><m:mi>b</m:mi><m:mo>&#8242;</m:mo></m:msup></m:mtd>
  <m:mtd><m:mo>=</m:mo></m:mtd>
  <m:mtd><m:mn>0.04</m:mn><m:mi>a</m:mi></m:mtd>
  <m:mtd><m:mo>-</m:mo></m:mtd>
  <m:mtd><m:msup><m:mn>10</m:mn><m:mn>4</m:mn></m:msup><m:mi>b</m:mi><m:mi>c</m:mi></m:mtd>
  <m:mtd><m:mo>-</m:mo></m:mtd>
  <m:mtd><m:mn>3</m:mn><m:mo>&#215;</m:mo><m:msup><m:mn>10</m:mn><m:mn>7</m:mn></m:msup><m:msup><m:mi>b</m:mi><m:mn>2</m:mn></m:msup></m:mtd>
 </m:mtr><m:mtr>
  <m:mtd/>
  <m:mtd/>
  <m:mtd/>
  <m:mtd/>
  <m:mtd/>
  <m:mtd/>
  <m:mtd/></m:mtr><m:mtr>
  <m:mtd><m:msup><m:mi>c</m:mi><m:mo>&#8242;</m:mo></m:msup></m:mtd>
  <m:mtd><m:mo>=</m:mo></m:mtd>
  <m:mtd/>
  <m:mtd/>
  <m:mtd/>
  <m:mtd/>
  <m:mtd><m:mn>3</m:mn><m:mo>&#215;</m:mo><m:msup><m:mn>10</m:mn><m:mn>7</m:mn></m:msup><m:msup><m:mi>b</m:mi><m:mn>2</m:mn></m:msup></m:mtd>
 </m:mtr>
</m:mtable>
</m:math></td><td class="formula2"/></tr></table></div>

despite the fact that it is not a sensible choice to use either the banded or the sparse linear algebra for this problem.  Their use here serves for illustration of the techniques involved.  For the implicit integrators
<a class="rout" href="../D02/d02ngf.xml">D02NGF</a>, <a class="rout" href="../D02/d02nhf.xml">D02NHF</a> and <a class="rout" href="../D02/d02njf.xml">D02NJF</a>
we write the Robertson problem in residual form, as an implicit differential system and as a differential/algebraic system respectively.  Here we are exploiting the fact that <m:math><m:mi>a</m:mi><m:mo>+</m:mo><m:mi>b</m:mi><m:mo>+</m:mo><m:mi>c</m:mi></m:math>&#160;is constant and hence one of the equations may be replaced by <m:math>
 <m:msup>
  <m:mfenced separators=""><m:mi>a</m:mi><m:mo>+</m:mo><m:mi>b</m:mi><m:mo>+</m:mo><m:mi>c</m:mi></m:mfenced>
  <m:mo>&#8242;</m:mo>
 </m:msup>
 <m:mo>=</m:mo>
 <m:mn>0.0</m:mn>
</m:math>&#160;or <m:math><m:mi>a</m:mi><m:mo>+</m:mo><m:mi>b</m:mi><m:mo>+</m:mo><m:mi>c</m:mi><m:mo>=</m:mo><m:mn>1.0</m:mn></m:math>&#160;(for our particular choice of initial conditions).  For the reverse communication routines <a class="rout" href="../D02/d02nmf.xml">D02NMF</a> and <a class="rout" href="../D02/d02nnf.xml">D02NNF</a> our examples are intended only to illustrate the reverse communication technique.
<div class="figure"><a name="D02MN2" id="D02MN2"/><img src="../figures/D02MN2fl18.png" style="height: 30em" alt="Schema for SPRINT reverse communication routine calling sequences"/></div><div class="figure"><b>Figure 2: Schema for SPRINT reverse communication routine calling sequences</b></div>
</div><div class="paramtext">The DASSL integrator <a class="rout" href="../D02/d02nef.xml">D02NEF</a> can solve DAEs of the fully implicit form <m:math><m:mi>F</m:mi><m:mfenced separators=""><m:mi>t</m:mi><m:mo>,</m:mo><m:mi>y</m:mi><m:mo>,</m:mo><m:mrow><m:mi>y</m:mi><m:mo>&#8242;</m:mo></m:mrow></m:mfenced><m:mo>=</m:mo><m:mn>0</m:mn></m:math>&#160;and therefore has increased functionality over the SPRINT integrators.  Additionally <a class="rout" href="../D02/d02nef.xml">D02NEF</a> can be used to solve difficult algebraic problems by continuation; for example, the nonlinear algebraic problem 

<div class="formula"><table class="formula"><tr><td class="formula"><m:math display="block">
 <m:mi>f</m:mi><m:mfenced separators=""><m:mi>x</m:mi></m:mfenced><m:mo>=</m:mo><m:mn>0</m:mn>
</m:math></td><td class="formula2"/></tr></table></div>

can be solved by integrating solutions of 

<div class="formula"><table class="formula"><tr><td class="formula"><m:math display="block">
 <m:mi>f</m:mi><m:mfenced separators=""><m:mi>x</m:mi></m:mfenced>
 <m:mo>+</m:mo>
 <m:mfenced separators=""><m:mn>1</m:mn><m:mo>-</m:mo><m:mi>t</m:mi></m:mfenced>
 <m:mi>g</m:mi><m:mfenced separators=""><m:mi>x</m:mi></m:mfenced>
 <m:mo>=</m:mo>
 <m:mn>0</m:mn>
</m:math></td><td class="formula2"/></tr></table></div>

where the solution to <m:math>
 <m:mi>f</m:mi><m:mfenced separators=""><m:mi>x</m:mi></m:mfenced>
 <m:mo>+</m:mo><m:mi>g</m:mi><m:mfenced separators=""><m:mi>x</m:mi></m:mfenced>
 <m:mo>=</m:mo>
 <m:mn>0</m:mn>
</m:math>&#160;is known.  The solution of this type of problem is illustrated in <a class="sec" href="../D02/d02nef.xml#example">Section 9</a> in D02NEF.</div><h2 class="standard"><a class="sec" name="references" id="references"/>2&#160;&#160;References</h2><div class="paramtext"><a name="ref535" id="ref535"/>Berzins M and Furzeland R M (1985)  A user's manual for SPRINT &#8211; A versatile software package for solving systems of algebraic, ordinary and partial differential equations: Part 1 &#8211; Algebraic and ordinary differential equations <i>Report TNER.85.085</i> Shell Research Limited </div>
<div class="paramtext"><a name="ref826" id="ref826"/>Brenan K, Campbell S and Petzold L (1996)  Numerical Solution of Initial-value Problems in Differential-algebraic Equations SIAM, Philadelphia </div><hr/><div><a class="chap" href="d02conts.xml">D02 Chapter Contents</a></div><div><a class="chapint" href="../../pdf/D02/d02mnintro.pdf">D02MN Chapter Introduction (PDF version)</a></div>
<div><a class="htmltoc" href="../FRONTMATTER/manconts.xml">NAG Library Manual</a></div>
<div><hr/><a class="genint" href="../FRONTMATTER/copyright.xml">&#169; The Numerical Algorithms Group Ltd, Oxford, UK. 2009</a></div></body></html>
