Rev | Line | |
---|
[2696] | 1 | C --- Plain QSSA with fixed step size |
---|
| 2 | C |
---|
| 3 | SUBROUTINE INTEGRATE( TIN, TOUT ) |
---|
| 4 | |
---|
| 5 | INCLUDE 'KPP_ROOT_params.h' |
---|
| 6 | INCLUDE 'KPP_ROOT_global.h' |
---|
| 7 | |
---|
| 8 | C TIN - Start Time |
---|
| 9 | KPP_REAL TIN |
---|
| 10 | C TOUT - End Time |
---|
| 11 | KPP_REAL TOUT |
---|
| 12 | |
---|
| 13 | C Local variables |
---|
| 14 | KPP_REAL P_VAR(NVAR), D_VAR(NVAR) |
---|
| 15 | LOGICAL IsReject |
---|
| 16 | KPP_REAL T, Tnext, STEP, Told, SUP |
---|
| 17 | KPP_REAL ratio, tmp |
---|
| 18 | INTEGER i |
---|
| 19 | |
---|
| 20 | T = TIN |
---|
| 21 | Tnext = TOUT |
---|
| 22 | STEP = 0.1 |
---|
| 23 | Told = T |
---|
| 24 | SUP = 1e-14 |
---|
| 25 | IsReject = .false. |
---|
| 26 | |
---|
| 27 | C -- BELOW THIS LIMIT USE TAYLOR INSTEAD OF EXP --- |
---|
| 28 | |
---|
| 29 | do while ( T.lt.Tnext ) |
---|
| 30 | |
---|
| 31 | if ( T.gt.Tnext ) then |
---|
| 32 | STEP = Tnext - Told |
---|
| 33 | T = Tnext |
---|
| 34 | end if |
---|
| 35 | |
---|
| 36 | CALL FSPLIT_VAR ( VAR, P_VAR, D_VAR ) |
---|
| 37 | |
---|
| 38 | do i=1,NVAR |
---|
| 39 | if ( abs(D_VAR(i)).gt.SUP ) then |
---|
| 40 | ratio = P_VAR(i)/D_VAR(i) |
---|
| 41 | tmp = exp(-D_VAR(i)*STEP) |
---|
| 42 | VAR(i) = tmp * (VAR(i) - ratio) + ratio |
---|
| 43 | else |
---|
| 44 | tmp = D_VAR(i) * STEP |
---|
| 45 | VAR(i) = VAR(i) + P_VAR(i) * 0.5 * STEP * ( 1 - 0.5 * tmp * |
---|
| 46 | * ( 1 - 1.0 / 3.0 * tmp ) ) |
---|
| 47 | end if |
---|
| 48 | end do |
---|
| 49 | |
---|
| 50 | T = T + STEP |
---|
| 51 | TIME = T |
---|
| 52 | |
---|
| 53 | end do |
---|
| 54 | |
---|
| 55 | RETURN |
---|
| 56 | END |
---|
Note: See
TracBrowser
for help on using the repository browser.