1 C ------------------------------------------------------------------------------
2 C Subroutine for the derivative of Fun with respect to rate coefficients
3 C -----------------------------------------------------------------------------
5 SUBROUTINE dFun_dRcoeff
( V
, F
, NCOEFF
, JCOEFF
, DFDR
)
8 INCLUDE
'KPP_ROOT_Parameters.h'
9 INCLUDE
'KPP_ROOT_Sparse.h'
11 C V - Concentrations of variable/radical/fixed species
12 KPP_REAL V
(NVAR
), F
(NFIX
)
13 C NCOEFF - the number of rate coefficients with respect to which we differentiate
15 C JCOEFF - a vector of integers containing the indices of reactions (rate
16 C coefficients) with respect to which we differentiate
17 INTEGER JCOEFF
(NCOEFF
)
18 C DFDR - a matrix containg derivative values; specifically,
19 C column j contains d Fun(1:NVAR) / d RCT( JCOEFF(j) )
20 C for each 1 <= j <= NCOEFF
21 C This matrix is stored in a column-wise linearized format
22 KPP_REAL DFDR
(NVAR*NCOEFF
)
24 C Local vector with reactant products
25 KPP_REAL A_RPROD
(NREACT
)
29 C Compute the reactant products of all reactions
30 CALL ReactantProd
( V
, F
, A_RPROD
)
32 C Compute the derivatives by multiplying column JCOEFF(j) of the stoichiometric matrix with A_RPROD
34 C Initialize the j-th column of derivative matrix to zero
36 DFDR
(i
+NVAR*
(j
-1)) = 0.0D0
38 C Column JCOEFF(j) in the stoichiometric matrix times the
39 C reactant product of the JCOEFF(j)-th reaction
40 C give the j-th column of the derivative matrix
41 aj
= A_RPROD
(JCOEFF
(j
))
42 DO k
=CCOL_STOICM
(JCOEFF
(j
)),CCOL_STOICM
(JCOEFF
(j
)+1)-1
43 DFDR
(IROW_STOICM
(k
)+NVAR*
(j
-1)) = STOICM
(k
)*aj