2 C ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3 SUBROUTINE KppDecomp
( JVS
, IER
)
4 C ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5 C Sparse LU factorization
6 C ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
8 INCLUDE
'KPP_ROOT_Parameters.h'
9 INCLUDE
'KPP_ROOT_Sparse.h'
12 KPP_REAL JVS
(KPP_LU_NONZERO
), W
(KPP_NVAR
)
18 IF ( JVS
( LU_DIAG
(k
) ) .EQ
. 0. ) THEN
22 DO kk
= LU_CROW
(k
), LU_CROW
(k
+1)-1
23 W
( LU_ICOL
(kk
) ) = JVS
(kk
)
25 DO kk
= LU_CROW
(k
), LU_DIAG
(k
)-1
27 a
= -W
(j
) / JVS
( LU_DIAG
(j
) )
29 DO jj
= LU_DIAG
(j
)+1, LU_CROW
(j
+1)-1
30 W
( LU_ICOL
(jj
) ) = W
( LU_ICOL
(jj
) ) + a*JVS
(jj
)
33 DO kk
= LU_CROW
(k
), LU_CROW
(k
+1)-1
34 JVS
(kk
) = W
( LU_ICOL
(kk
) )
40 C ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
41 SUBROUTINE KppDecompCmplx
( JVS
, IER
)
42 C ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
43 C Sparse LU factorization, complex
44 C ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
46 INCLUDE
'KPP_ROOT_Parameters.h'
47 INCLUDE
'KPP_ROOT_Sparse.h'
50 DOUBLE COMPLEX JVS
(KPP_LU_NONZERO
), W
(KPP_NVAR
), a
55 IF ( JVS
( LU_DIAG
(k
) ) .EQ
. 0. ) THEN
59 DO kk
= LU_CROW
(k
), LU_CROW
(k
+1)-1
60 W
( LU_ICOL
(kk
) ) = JVS
(kk
)
62 DO kk
= LU_CROW
(k
), LU_DIAG
(k
)-1
64 a
= -W
(j
) / JVS
( LU_DIAG
(j
) )
66 DO jj
= LU_DIAG
(j
)+1, LU_CROW
(j
+1)-1
67 W
( LU_ICOL
(jj
) ) = W
( LU_ICOL
(jj
) ) + a*JVS
(jj
)
70 DO kk
= LU_CROW
(k
), LU_CROW
(k
+1)-1
71 JVS
(kk
) = W
( LU_ICOL
(kk
) )
77 C ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
78 SUBROUTINE KppSolveIndirect
( JVS
, X
)
79 C ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
80 C Sparse solve subroutine using indirect addressing
81 C ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
82 INCLUDE
'KPP_ROOT_Parameters.h'
83 INCLUDE
'KPP_ROOT_Sparse.h'
86 KPP_REAL JVS
(KPP_LU_NONZERO
), X
(KPP_NVAR
), sum
89 DO j
= LU_CROW
(i
), LU_DIAG
(i
)-1
90 X
(i
) = X
(i
) - JVS
(j
)*X
(LU_ICOL
(j
));
96 DO j
= LU_DIAG
(i
)+1, LU_CROW
(i
+1)-1
97 sum
= sum
- JVS
(j
)*X
(LU_ICOL
(j
));
99 X
(i
) = sum
/JVS
(LU_DIAG
(i
));
105 C ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
106 SUBROUTINE KppSolveCmplx
( JVS
, X
)
107 C ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
108 C Complex sparse solve subroutine using indirect addressing
109 C ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
110 INCLUDE
'KPP_ROOT_Parameters.h'
111 INCLUDE
'KPP_ROOT_Sparse.h'
114 DOUBLE COMPLEX JVS
(KPP_LU_NONZERO
), X
(KPP_NVAR
), sum
117 DO j
= LU_CROW
(i
), LU_DIAG
(i
)-1
118 X
(i
) = X
(i
) - JVS
(j
)*X
(LU_ICOL
(j
));
124 DO j
= LU_DIAG
(i
)+1, LU_CROW
(i
+1)-1
125 sum
= sum
- JVS
(j
)*X
(LU_ICOL
(j
));
127 X
(i
) = sum
/JVS
(LU_DIAG
(i
));