nls2.integ.ctx - Description of Integration Context for nls2


On to:
DESCRIPTION
REFERENCES
REFERENCES OF THE SOLVER PACKAGE
EXAMPLE





DESCRIPTION:

When an "nls2" model is described by an ordinary differential equations system, the argument "integ.ctx" must be provided. (See `nls2', argument `integ.ctx').
This argument is a list with at least the component "start", (the initial value of the integration variable), and, when the model is evaluated by programs, the component "nb.theta.odes", (the number of parameters of the odes to be estimated; "odes" stands for ordinary differential equations system).
In addition, it can contain the following components:
integ.values
the values for which the odes should be integrated. If these values are independent variables, this component is not required. If not, it is a matrix: the number of columns is equal to the number of time values and the number of rows is equal to the number of curves (if one curve, a single row).
cond.start
the initial values of the odes. If these values are unknown, they are considered as parameters to be estimated and the component "cond.start" is not required. If not, it is a matrix: the number of columns is equal to the number of equations of the system described in the model description-file and the number of rows is equal to the number of curves (if one curve, a single row).
print
a logic that is TRUE if printing of intermediate results are required. The printing frequency is controlled by argument "control" of `nls2' (see `nls2.control', argument `freq'). Default: FALSE.
iopt
an integer vector of length 9 that contains optional inputs of LSODA. The first 4 elements are ignored in this version and must be set to 0. The next ones must be set to 0 if their default value is required.
- iopt(5)=1 to generate extra printing at method switches. (lsoda switches automatically between stiff and nonstiff methods). 0 means no extra printing (the default).
- iopt(6) is the maximum number of (internally defined) steps allowed during one call to the solver. The default value is 500.
- iopt(7) is the maximum number of messages printed (per problem) warning that t + h = t on a step (h = step size). The default value is 10.
- iopt(8) is the maximum order to be allowed for the nonstiff (adams) method. The default value is 12.
- iopt(9) is the maximum order to be allowed for the stiff (bdf) method. The default value is 5.

Sommaire

ropt
a double vector of length 7 that contains optional inputs of LSODA. The first 4 elements are ignored in this version and must be set to 0. The next ones must be set to 0 if their default value is required.
ropt(5) is the step size to be attempted on the first step. The default value is determined by the solver.
ropt(6) is the maximum absolute step size allowed. The default value is infinite.
ropt(7) is the minimum absolute step size allowed. The default value is 0.
itol
an integer that controls the integration tolerance for LSODA, Default: 1. See the component `atol'.
rtol
the relative error tolerance. Default: 1.e-5. See the component `atol'.
atol
the absolute error tolerance. Default: 1.e-7.
The components itol, rtol, and atol determine the error control performed by the solver. The solver will control the vector e = (e(i)) of estimated local errors in y, according to an inequality of the form max-norm of ( e(i)/ewt(i) ) .le. 1, where ewt = (ewt(i)) is a vector of positive error weights. The values of rtol and atol should all be non-negative. The following table gives the types (scalar/array) of rtol and atol, and the corresponding form of ewt(i).
   itol    rtol       atol          ewt(i)
    1     scalar     scalar     rtol*abs(y(i)) + atol
    2     scalar     array      rtol*abs(y(i)) + atol(i)
    3     array      scalar     rtol(i)*abs(y(i)) + atol
    4     array      array      rtol(i)*abs(y(i)) + atol(i)
If global errors are to be estimated by making a repeated run on the same problem with smaller tolerances, then all components of rtol and atol (i.e. of ewt) should be scaled down uniformly.

Sommaire


REFERENCES:

ODEPACK: A systematized collection of ODE solvers, Hindmarsh A.C. (1983). Scientific Computing, R. S. Stepleman et al. (eds.), North Holland, Amsterdam, 1983, pp. 55-64.

Automatic selection of methods for solving stiff and nonstiff systems of ordinary differential equations, Linda R. Petzold, SIAM J. SCI. STAT. COMPUT. 4 (1983), pp. 136-148.


REFERENCES OF THE SOLVER PACKAGE:

The authors:
Linda R. Petzold and Alan C. Kindmarsh, Computing and mathematics research division, l-316, Lawrence Livermore national laboratory, Livermore, ca 94550.

The version:
This is the March 30, 1987 version of lsoda: livermore solver for ordinary differential equations, with automatic method switching for stiff and nonstiff problems. It always starts with the nonstiff method.
This version is in double precision.

More explanations can be found in the comments included in the source-files of LSODA provided in the directory src/lsoda in the nls2 tar-archive file.


Sommaire

EXAMPLE:

The description file of the model is the following:

resp f;
varind t;
parresp pe, pc, mm, mv, mo, ov;
varint x;
valint t;
pbisresp mme, mve, vt0, a, moe, moi, phi;
aux z1, z2;
F Ve, Vc;
dF dVe, dVc;
subroutine;
begin
z1 = vt0*(1-ov)*moi/1e+3;
z2 = phi*mv*Vc/mm ;
dVe = -(mme/mve)*pe*a*((moe+mo)/1e+3 - (z1+z2)/Ve);
dVc = (mm/mv)*pc*a*(mo/1e+3 - z2/Ve);
f = Ve[t]/vt0 + Vc[t]/vt0 + ov;
end


The initial values of the odes are known. There are 15 curves and 2 equations, so "cond.start" is a 2-columns and 15-rows matrix. The S-commands to create the integration context are:
# Creation of the integration context:
integ.ctx<-list(start=0, nb.theta.odes=6,
   cond.start=matrix(c(
    rep(c(1.35660e-6,0,1.35660e-6,0
        ,1.35660e-6,0, 1.49226e-6,0),3),
    1.35660e-6, 0, 1.49226e-06, 0, 
         1.49226e-06, 0), ncol=2), byrow=T)

Sommaire


- Mon Sep 30 1996 -