1 C ------------------------------------------------------------------------------
2 C Subroutine for the derivative of Jac with respect to rate coefficients
4 C -----------------------------------------------------------------------------
6 SUBROUTINE dJac_dRcoeff
( V
, F
, U
, NCOEFF
, JCOEFF
, DJDR
)
9 INCLUDE
'KPP_ROOT_Parameters.h'
10 INCLUDE
'KPP_ROOT_Sparse.h'
12 C V - Concentrations of variable/radical/fixed species
13 KPP_REAL V
(NVAR
), F
(NFIX
)
14 C U - User-supplied Vector
16 C NCOEFF - the number of rate coefficients with respect to which we differentiate
18 C JCOEFF - a vector of integers containing the indices of reactions (rate
19 C coefficients) with respect to which we differentiate
20 INTEGER JCOEFF
(NCOEFF
)
21 C DFDR - a matrix containg derivative values; specifically,
22 C column j contains d Jac(1:NVAR) / d RCT( JCOEFF(j) ) * U
23 C for each 1 <= j <= NCOEFF
24 C This matrix is stored in a column-wise linearized format
25 KPP_REAL DJDR
(NVAR*NCOEFF
)
27 C Local vector for Jacobian of reactant products
28 KPP_REAL JV_RPROD
(NJVRP
)
32 C Compute the Jacobian of all reactant products
33 CALL JacReactantProd
( V
, F
, JV_RPROD
)
35 C Compute the derivatives by multiplying column JCOEFF(j) of the stoichiometric matrix with A_PROD
37 C Initialize the j-th column of derivative matrix to zero
39 DJDR
(i
+NVAR*
(j
-1)) = 0.0D0
41 C Column JCOEFF(j) in the stoichiometric matrix times the
42 C ( Gradient of reactant product of the JCOEFF(j)-th reaction X user vector )
43 C give the j-th column of the derivative matrix
45 C Row JCOEFF(j) of JV_RPROD times the user vector
47 DO k
=CROW_JVRP
(JCOEFF
(j
)),CROW_JVRP
(JCOEFF
(j
)+1)-1
48 aj
= aj
+ JV_RPROD
(k
)*U
(ICOL_JVRP
(k
))
50 C Column JCOEFF(j) of Stoichiom. matrix times aj
51 DO k
=CCOL_STOICM
(JCOEFF
(j
)),CCOL_STOICM
(JCOEFF
(j
)+1)-1
52 DJDR
(IROW_STOICM
(k
)+NVAR*
(j
-1)) = STOICM
(k
)*aj