1 SUBROUTINE INTEGRATE
( TIN
, TOUT
)
3 INCLUDE
'KPP_ROOT_params.h'
4 INCLUDE
'KPP_ROOT_global.h'
13 EXTERNAL FUNC_CHEM
, JAC_CHEM
17 CALL ROS1
(NVAR
,TIN
,TOUT
,STEPMIN
,VAR
,
18 + Info
,FUNC_CHEM
,JAC_CHEM
)
27 SUBROUTINE ROS1
(N
,T
,Tnext
,Hstart
,
28 + y
,Info
,FUNC_CHEM
,JAC_CHEM
)
30 INCLUDE
'KPP_ROOT_params.h'
31 INCLUDE
'KPP_ROOT_sparse.h'
33 C Linearly Implicit Euler
34 C A method of theoretical interest but of no practical value
37 C y = Vector of (NVAR) concentrations, contains the
38 C initial values on input
39 C [T, Tnext] = the integration interval
40 C Hmin, Hmax = lower and upper bounds for the selected step-size.
41 C Note that for Step = Hmin the current computed
42 C solution is unconditionally accepted by the error
44 C AbsTol, RelTol = (NVAR) dimensional vectors of
45 C componentwise absolute and relative tolerances.
46 C FUNC_CHEM = name of routine of derivatives. KPP syntax.
47 C See the header below.
48 C JAC_CHEM = name of routine that computes the Jacobian, in
49 C sparse format. KPP syntax. See the header below.
50 C Info(1) = 1 for Autonomous system
51 C = 0 for nonAutonomous system
54 C y = the values of concentrations at Tend.
55 C T = equals TENDon output.
56 C Info(2) = # of FUNC_CHEM CALLs.
57 C Info(3) = # of JAC_CHEM CALLs.
58 C Info(4) = # of accepted steps.
59 C Info(5) = # of rejected steps.
60 C Hstart = The last accepted stepsize
62 C Adrian Sandu, December 2001
65 KPP_REAL JAC
(LU_NONZERO
)
68 KPP_REAL T
, Tnext
, Tplus
69 KPP_REAL elo
,ghinv
,uround
71 INTEGER n
,nfcn
,njac
,Naccept
,Nreject
,i
,j
73 LOGICAL IsReject
, Autonomous
74 EXTERNAL FUNC_CHEM
, JAC_CHEM
82 C === Starting the time loop ===
86 IF ( Tplus
.gt
. Tnext
) THEN
91 C Initial Function and Jacobian values
92 CALL FUNC_CHEM
(NVAR
, T
, y
, Fv
)
94 CALL JAC_CHEM
(NVAR
, T
, y
, JAC
)
97 C Form the Prediction matrix and compute its LU factorization
99 JAC
(LU_DIAG
(j
)) = JAC
(LU_DIAG
(j
)) - 1.0d0
/H
101 CALL KppDecomp
(JAC
, ier
)
104 PRINT
*,'ROS1: Singular factorization at T=',T
,'; H=',H
108 C ------------ STAGE 1-------------------------
109 CALL KppSolve
(JAC
, Fv
)
111 C ---- The Solution ---
117 C ======= End of the time loop ===============================
118 IF ( T
.lt
. Tnext
) GO TO 10
120 C ======= Output Information =================================
131 SUBROUTINE FUNC_CHEM
(N
, T
, Y
, P
)
132 INCLUDE
'KPP_ROOT_params.h'
133 INCLUDE
'KPP_ROOT_global.h'
136 KPP_REAL Y
(NVAR
), P
(NVAR
)
141 CALL Fun
( Y
, FIX
, RCONST
, P
)
147 SUBROUTINE JAC_CHEM
(N
, T
, Y
, J
)
148 INCLUDE
'KPP_ROOT_params.h'
149 INCLUDE
'KPP_ROOT_global.h'
152 KPP_REAL Y
(NVAR
), J
(LU_NONZERO
)
157 CALL Jac_SP
( Y
, FIX
, RCONST
, J
)